/* 
 * Licensed to the soi-toolkit project under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The soi-toolkit project licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.soitoolkit.commons.mule.test.sftp;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;

import org.apache.sshd.common.Session;
import org.apache.sshd.server.SshFile;
import org.junit.Test;

public class SftpServerTest {

	@Test
	public void testGetModifiedNativeFileSystemFactory() {
		SftpServer sftpServer = new SftpServer() {
			@Override
			String getUsername(Session session) {
				return "anyuser";
			}
		};

		String subDirname = SftpServerTest.class.getSimpleName() + "-test";
		File subdir = new File(SftpServer.SFTP_ROOT_DIR + File.separator
				+ subDirname);
		subdir.mkdirs();
		assertTrue(subdir.exists());

		Session session = null;
		SshFile sshFile = sftpServer.getModifiedNativeFileSystemFactory()
				.createFileSystemView(session).getFile(subDirname);

		assertTrue(sshFile.doesExist());
		assertTrue(sshFile.isDirectory());
		assertEquals(subdir.getAbsolutePath(), sshFile.getAbsolutePath());
	}
}

@@ -1722,73 +1722,358 @@
 ;%0A%09%09
-assertEquals(subdir.getAbsolutePath(), sshFile.getAbsolutePath())
+// fix for windows paths%0A%09%09String expectedPath = getOsUnifiedPath(subdir);%0A%09%09assertEquals(expectedPath, sshFile.getAbsolutePath());%0A%09%7D%0A%0A%09private String getOsUnifiedPath(File f) %7B%0A%09%09String osUnifiedPath = f.getAbsolutePath().replace('%5C%5C', '/');%0A%09%09if (osUnifiedPath.charAt(0) != '/') %7B%0A%09%09%09osUnifiedPath = '/' + osUnifiedPath;%0A%09%09%7D%0A%09%09return osUnifiedPath
 ;%0A%09%7D

Update issue 125