Skip to content

Commit

Permalink
Add another protocol level config test
Browse files Browse the repository at this point in the history
  • Loading branch information
mbechler committed May 17, 2020
1 parent aacf7e9 commit 2b1503f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/java/jcifs/tests/ContextConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,36 @@ public void testMinMaxVersions () throws CIFSException {

// needs to be adjusted when default changes
assertEquals(DialectVersion.SMB210, p3.getMaximumVersion());

}


@Test
// #226
public void testLegacyConfig () throws CIFSException {
Properties prop1 = new Properties();
prop1.setProperty("jcifs.smb.client.enableSMB2", "false");
prop1.setProperty("jcifs.smb.client.disableSMB1", "false");
PropertyConfiguration p1 = new PropertyConfiguration(prop1);

assertEquals(DialectVersion.SMB1, p1.getMinimumVersion());
assertEquals(DialectVersion.SMB1, p1.getMaximumVersion());

Properties prop2 = new Properties();
prop2.setProperty("jcifs.smb.client.enableSMB2", "true");
prop2.setProperty("jcifs.smb.client.disableSMB1", "false");
PropertyConfiguration p2 = new PropertyConfiguration(prop2);

assertEquals(DialectVersion.SMB1, p2.getMinimumVersion());
// needs to be adjusted when default changes
assertEquals(DialectVersion.SMB210, p2.getMaximumVersion());

Properties prop3 = new Properties();
prop3.setProperty("jcifs.smb.client.enableSMB2", "true");
prop3.setProperty("jcifs.smb.client.disableSMB1", "true");
PropertyConfiguration p3 = new PropertyConfiguration(prop3);

assertEquals(DialectVersion.SMB202, p3.getMinimumVersion());
}

}

0 comments on commit 2b1503f

Please sign in to comment.