-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checking whether CIFS parent file is a valid path (Fixes #153)
- Loading branch information
1 parent
4d8df71
commit 2fc4d51
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/test/java/com/xebialabs/overthere/cifs/CifsFileTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.xebialabs.overthere.cifs; | ||
|
||
import com.xebialabs.overthere.ConnectionOptions; | ||
import com.xebialabs.overthere.OverthereFile; | ||
import com.xebialabs.overthere.cifs.winrm.CifsWinRmConnection; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
import static com.xebialabs.overthere.ConnectionOptions.*; | ||
import static com.xebialabs.overthere.OperatingSystemFamily.WINDOWS; | ||
import static com.xebialabs.overthere.cifs.CifsConnectionBuilder.*; | ||
import static com.xebialabs.overthere.cifs.CifsConnectionType.WINRM_INTERNAL; | ||
import static com.xebialabs.overthere.util.DefaultAddressPortMapper.INSTANCE; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.nullValue; | ||
import static org.testng.Assert.*; | ||
|
||
public class CifsFileTest { | ||
|
||
private ConnectionOptions options; | ||
|
||
@BeforeMethod | ||
public void setupOptions() { | ||
options = new ConnectionOptions(); | ||
options.set(OPERATING_SYSTEM, WINDOWS); | ||
options.set(CONNECTION_TYPE, WINRM_INTERNAL); | ||
options.set(PASSWORD, "foobar"); | ||
options.set(PORT, PORT_DEFAULT_WINRM_HTTP); | ||
options.set(CIFS_PORT, CIFS_PORT_DEFAULT); | ||
options.set(ADDRESS, "localhost"); | ||
} | ||
|
||
|
||
@Test | ||
public void shouldReturnNullForParentFileOfRoot() { | ||
options.set(USERNAME, "[email protected]"); | ||
CifsWinRmConnection cifsWinRmConnection = new CifsWinRmConnection(CIFS_PROTOCOL, options, INSTANCE); | ||
OverthereFile file = cifsWinRmConnection.getFile("C:\\"); | ||
assertThat(file.getParentFile(), nullValue()); | ||
} | ||
|
||
|
||
} |