Update the test cases for the LDAP tools so that the tests providing invalid
arguments include a message with the reason that each argument set was invalid.
This can be used to help identify which particular set of arguments caused a
problem if any of the associated unit tests fail.
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | |
| | | String[] args = {}; // No arguments |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | | reasonList.add("No arguments"); |
| | | |
| | | args = new String[] // No value for "-D" argument. |
| | | args = new String[] |
| | | { |
| | | "-D", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-D' argument"); |
| | | |
| | | args = new String[] // No value for "-w" argument. |
| | | args = new String[] |
| | | { |
| | | "-w", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-w' argument"); |
| | | |
| | | args = new String[] // No value for "-j" argument. |
| | | args = new String[] |
| | | { |
| | | "-j", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-j' argument"); |
| | | |
| | | args = new String[] // No value for "-i" argument. |
| | | args = new String[] |
| | | { |
| | | "-i", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-i' argument"); |
| | | |
| | | args = new String[] // No value for "-K" argument. |
| | | args = new String[] |
| | | { |
| | | "-K", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-K' argument"); |
| | | |
| | | args = new String[] // No value for "-P" argument. |
| | | args = new String[] |
| | | { |
| | | "-P", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-P' argument"); |
| | | |
| | | args = new String[] // No value for "-W" argument. |
| | | args = new String[] |
| | | { |
| | | "-W", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-W' argument"); |
| | | |
| | | args = new String[] // No value for "-h" argument. |
| | | args = new String[] |
| | | { |
| | | "-h", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-h' argument"); |
| | | |
| | | args = new String[] // No value for "-p" argument. |
| | | args = new String[] |
| | | { |
| | | "-p", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-p' argument"); |
| | | |
| | | args = new String[] // No value for "-V" argument. |
| | | args = new String[] |
| | | { |
| | | "-V", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-V' argument"); |
| | | |
| | | args = new String[] // No value for "-f" argument. |
| | | args = new String[] |
| | | { |
| | | "-f", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-f' argument"); |
| | | |
| | | args = new String[] // No value for "-J" argument. |
| | | args = new String[] |
| | | { |
| | | "-J", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-J' argument"); |
| | | |
| | | args = new String[] // No value for "-o" argument. |
| | | args = new String[] |
| | | { |
| | | "-o", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-o' argument"); |
| | | |
| | | args = new String[] // No value for "--assertionFilter" argument. |
| | | args = new String[] |
| | | { |
| | | "--assertionFilter", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--assertionFilter' argument"); |
| | | |
| | | args = new String[] // Invalid short argument |
| | | args = new String[] |
| | | { |
| | | "-I" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid short argument"); |
| | | |
| | | args = new String[] // Invalid long argument |
| | | args = new String[] |
| | | { |
| | | "--invalidLongArgument" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid long argument"); |
| | | |
| | | args = new String[] // Invalid assertion filter |
| | | args = new String[] |
| | | { |
| | | "--assertionFilter", "(invalidfilter)", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid assertion filter"); |
| | | |
| | | args = new String[] // Invalid bind password file path |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-j", "no.such.file", |
| | |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid bind password file path"); |
| | | |
| | | args = new String[] // Both bind password and password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both bind password and password file"); |
| | | |
| | | args = new String[] // Non-numeric LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "nonnumeric", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric LDAP version"); |
| | | |
| | | args = new String[] // Invalid LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "1", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid LDAP version"); |
| | | |
| | | args = new String[] // Invalid DN file path. |
| | | args = new String[] |
| | | { |
| | | "-f", "no.such.file", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid DN file path"); |
| | | |
| | | args = new String[] // Invalid control criticality |
| | | args = new String[] |
| | | { |
| | | "-J", "1.2.3.4:invalidcriticality", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid control criticality"); |
| | | |
| | | args = new String[] // Non-numeric port |
| | | args = new String[] |
| | | { |
| | | "-p", "nonnumeric", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric port"); |
| | | |
| | | args = new String[] // Port value out of range. |
| | | args = new String[] |
| | | { |
| | | "-p", "999999", |
| | | "uid:test.user", |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Port value out of range"); |
| | | |
| | | args = new String[] // SASL external without SSL or StartTLS |
| | | args = new String[] |
| | | { |
| | | "-r", |
| | | "-K", "key.store.file", |
| | |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without SSL or StartTLS"); |
| | | |
| | | args = new String[] // SASL external without keystore file |
| | | args = new String[] |
| | | { |
| | | "-Z", |
| | | "-r", |
| | |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without keystore file"); |
| | | |
| | | args = new String[] // No trailing arguments |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No trailing arguments"); |
| | | |
| | | args = new String[] // Only one trailing argument. |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "uid:test.user", |
| | | "uid:test.user" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Only one trailing argument"); |
| | | |
| | | args = new String[] // Malformed attribute-value assertion |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | |
| | | "uid=test.user,o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Malformed attribute-value assertion"); |
| | | |
| | | |
| | | Object[][] returnArray = new Object[argLists.size()][1]; |
| | | Object[][] returnArray = new Object[argLists.size()][2]; |
| | | for (int i=0; i < argLists.size(); i++) |
| | | { |
| | | returnArray[i][0] = argLists.get(i); |
| | | returnArray[i][1] = reasonList.get(i); |
| | | } |
| | | return returnArray; |
| | | } |
| | |
| | | /** |
| | | * Tests the LDAPCompare tool with sets of invalid arguments. |
| | | * |
| | | * @param args The set of arguments to use for the LDAPCompare tool. |
| | | * @param args The set of arguments to use for the LDAPCompare |
| | | * tool. |
| | | * @param invalidReason The reason the provided set of arguments is invalid. |
| | | */ |
| | | @Test(dataProvider = "invalidArgs") |
| | | public void testInvalidArguments(String[] args) |
| | | public void testInvalidArguments(String[] args, String invalidReason) |
| | | { |
| | | assertFalse(LDAPCompare.mainCompare(args, false, null, null) == 0); |
| | | assertFalse(LDAPCompare.mainCompare(args, false, null, null) == 0, |
| | | "Should have been invalid because: " + invalidReason); |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | |
| | | String[] args = {}; // No arguments |
| | | args = new String[] // No value for "-D" argument. |
| | | String[] args = new String[] |
| | | { |
| | | "-D", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-D' argument"); |
| | | |
| | | args = new String[] // No value for "-w" argument. |
| | | args = new String[] |
| | | { |
| | | "-w", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-w' argument"); |
| | | |
| | | args = new String[] // No value for "-j" argument. |
| | | args = new String[] |
| | | { |
| | | "-j", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-j' argument"); |
| | | |
| | | args = new String[] // No value for "-i" argument. |
| | | args = new String[] |
| | | { |
| | | "-i", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-i' argument"); |
| | | |
| | | args = new String[] // No value for "-K" argument. |
| | | args = new String[] |
| | | { |
| | | "-K", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-K' argument"); |
| | | |
| | | args = new String[] // No value for "-P" argument. |
| | | args = new String[] |
| | | { |
| | | "-P", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-P' argument"); |
| | | |
| | | args = new String[] // No value for "-W" argument. |
| | | args = new String[] |
| | | { |
| | | "-W", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-W' argument"); |
| | | |
| | | args = new String[] // No value for "-h" argument. |
| | | args = new String[] |
| | | { |
| | | "-h", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-h' argument"); |
| | | |
| | | args = new String[] // No value for "-p" argument. |
| | | args = new String[] |
| | | { |
| | | "-p", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-p' argument"); |
| | | |
| | | args = new String[] // No value for "-V" argument. |
| | | args = new String[] |
| | | { |
| | | "-V", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-V' argument"); |
| | | |
| | | args = new String[] // No value for "-f" argument. |
| | | args = new String[] |
| | | { |
| | | "-f", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-f' argument"); |
| | | |
| | | args = new String[] // No value for "-J" argument. |
| | | args = new String[] |
| | | { |
| | | "-J", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-J' argument"); |
| | | |
| | | args = new String[] // No value for "-o" argument. |
| | | args = new String[] |
| | | { |
| | | "-o", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-o' argument"); |
| | | |
| | | args = new String[] // Invalid short argument |
| | | args = new String[] |
| | | { |
| | | "-I" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid short argument"); |
| | | |
| | | args = new String[] // Invalid long argument |
| | | args = new String[] |
| | | { |
| | | "--invalidLongArgument" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid long argument"); |
| | | |
| | | args = new String[] // Invalid bind password file path |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-j", "no.such.file", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid bind password file path"); |
| | | |
| | | args = new String[] // Both bind password and password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both bind password and password file"); |
| | | |
| | | args = new String[] // Non-numeric LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "nonnumeric", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric LDAP version"); |
| | | |
| | | args = new String[] // Invalid LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "1", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid LDAP version"); |
| | | |
| | | args = new String[] // Invalid DN file path. |
| | | args = new String[] |
| | | { |
| | | "-f", "no.such.file", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid DN file path"); |
| | | |
| | | args = new String[] // Invalid control criticality |
| | | args = new String[] |
| | | { |
| | | "-J", "1.2.3.4:invalidcriticality", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid control criticality"); |
| | | |
| | | args = new String[] // Non-numeric port |
| | | args = new String[] |
| | | { |
| | | "-p", "nonnumeric", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric port"); |
| | | |
| | | args = new String[] // Port value out of range. |
| | | args = new String[] |
| | | { |
| | | "-p", "999999", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Port value out of range"); |
| | | |
| | | args = new String[] // SASL external without SSL or StartTLS |
| | | args = new String[] |
| | | { |
| | | "-r", |
| | | "-K", "key.store.file", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without SSL or StartTLS"); |
| | | |
| | | args = new String[] // SASL external without keystore file |
| | | args = new String[] |
| | | { |
| | | "-Z", |
| | | "-r", |
| | | "o=test" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without keystore file"); |
| | | |
| | | |
| | | Object[][] returnArray = new Object[argLists.size()][1]; |
| | | Object[][] returnArray = new Object[argLists.size()][2]; |
| | | for (int i=0; i < argLists.size(); i++) |
| | | { |
| | | returnArray[i][0] = argLists.get(i); |
| | | returnArray[i][1] = reasonList.get(i); |
| | | } |
| | | return returnArray; |
| | | } |
| | |
| | | /** |
| | | * Tests the LDAPDelete tool with sets of invalid arguments. |
| | | * |
| | | * @param args The set of arguments to use for the LDAPDelete tool. |
| | | * @param args The set of arguments to use for the LDAPDelete tool. |
| | | * @param invalidReason The reason the provided set of arguments was |
| | | * invalid. |
| | | */ |
| | | @Test(dataProvider = "invalidArgs") |
| | | public void testInvalidArguments(String[] args) |
| | | public void testInvalidArguments(String[] args, String invalidReason) |
| | | { |
| | | assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0); |
| | | assertFalse(LDAPDelete.mainDelete(args, false, null, null) == 0, |
| | | "Should have been invalid because: " + invalidReason); |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | |
| | | String[] args; |
| | | args = new String[] // Missing value for -D argument. |
| | | args = new String[] |
| | | { |
| | | "-D" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-D' argument"); |
| | | |
| | | args = new String[] // Missing value for -w argument. |
| | | args = new String[] |
| | | { |
| | | "-w" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-w' argument"); |
| | | |
| | | args = new String[] // Missing value for -j argument. |
| | | args = new String[] |
| | | { |
| | | "-j" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-j' argument"); |
| | | |
| | | args = new String[] // Missing value for -Y argument. |
| | | args = new String[] |
| | | { |
| | | "-Y" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-Y' argument"); |
| | | |
| | | args = new String[] // Missing value for -i argument. |
| | | args = new String[] |
| | | { |
| | | "-i" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-i' argument"); |
| | | |
| | | args = new String[] // Missing value for -K argument. |
| | | args = new String[] |
| | | { |
| | | "-K" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-K' argument"); |
| | | |
| | | args = new String[] // Missing value for -P argument. |
| | | args = new String[] |
| | | { |
| | | "-P" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-P' argument"); |
| | | |
| | | args = new String[] // Missing value for -W argument. |
| | | args = new String[] |
| | | { |
| | | "-W" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-W' argument"); |
| | | |
| | | args = new String[] // Missing value for -h argument. |
| | | args = new String[] |
| | | { |
| | | "-h" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-h' argument"); |
| | | |
| | | args = new String[] // Missing value for -p argument. |
| | | args = new String[] |
| | | { |
| | | "-p" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-p' argument"); |
| | | |
| | | args = new String[] // Missing value for -V argument. |
| | | args = new String[] |
| | | { |
| | | "-V" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-V' argument"); |
| | | |
| | | args = new String[] // Missing value for -f argument. |
| | | args = new String[] |
| | | { |
| | | "-f" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-f' argument"); |
| | | |
| | | args = new String[] // Missing value for -J argument. |
| | | args = new String[] |
| | | { |
| | | "-J" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-J' argument"); |
| | | |
| | | args = new String[] // Missing value for -o argument. |
| | | args = new String[] |
| | | { |
| | | "-o" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-o' argument"); |
| | | |
| | | args = new String[] // Missing value for --assertionFilter argument. |
| | | args = new String[] |
| | | { |
| | | "-assertionFilter" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--assertionFilter' argument"); |
| | | |
| | | args = new String[] // Missing value for --preReadAttributes argument. |
| | | args = new String[] |
| | | { |
| | | "--preReadAttributes" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--preReadAttributes' argument"); |
| | | |
| | | args = new String[] // Missing value for --postReadAttributes argument. |
| | | args = new String[] |
| | | { |
| | | "--postReadAttributes" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--postReadAttributes' argument"); |
| | | |
| | | args = new String[] // Invalid bind password file path |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-j", "no.such.file", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid bind password file path"); |
| | | |
| | | args = new String[] // Both bind password and password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "-j", validPasswordFile, |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both bind password and password file"); |
| | | |
| | | args = new String[] // Non-numeric LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "nonnumeric", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric LDAP version"); |
| | | |
| | | args = new String[] // Invalid LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-V", "1", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid LDAP version"); |
| | | |
| | | args = new String[] // Invalid control criticality |
| | | args = new String[] |
| | | { |
| | | "-J", "1.2.3.4:invalidcriticality", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid control criticality"); |
| | | |
| | | args = new String[] // Non-numeric port |
| | | args = new String[] |
| | | { |
| | | "-p", "nonnumeric", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric port"); |
| | | |
| | | args = new String[] // Port value out of range. |
| | | args = new String[] |
| | | { |
| | | "-p", "999999", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Port value out of range"); |
| | | |
| | | args = new String[] // SASL external without SSL or StartTLS |
| | | args = new String[] |
| | | { |
| | | "-r", |
| | | "-K", "key.store.file", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without SSL or StartTLS"); |
| | | |
| | | args = new String[] // SASL external without keystore file |
| | | args = new String[] |
| | | { |
| | | "-Z", |
| | | "-r", |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without keystore file"); |
| | | |
| | | args = new String[] // Invalid LDAP assertion filter |
| | | args = new String[] |
| | | { |
| | | "--assertionFilter", "(invalid)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid LDAP assertion filter"); |
| | | |
| | | args = new String[] // No such LDIF file |
| | | args = new String[] |
| | | { |
| | | "-f", "no.such.file" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No such LDIF file"); |
| | | |
| | | |
| | | Object[][] returnArray = new Object[argLists.size()][1]; |
| | | Object[][] returnArray = new Object[argLists.size()][2]; |
| | | for (int i=0; i < argLists.size(); i++) |
| | | { |
| | | returnArray[i][0] = argLists.get(i); |
| | | returnArray[i][1] = reasonList.get(i); |
| | | } |
| | | return returnArray; |
| | | } |
| | |
| | | /** |
| | | * Tests the LDAPModify tool with sets of invalid arguments. |
| | | * |
| | | * @param args The set of arguments to use for the LDAPModify tool. |
| | | * @param args The set of arguments to use for the LDAPModify tool. |
| | | * @param invalidReason The reason the provided arguments were invalid. |
| | | */ |
| | | @Test(dataProvider = "invalidArgs") |
| | | public void testInvalidArguments(String[] args) |
| | | public void testInvalidArguments(String[] args, String invalidReason) |
| | | { |
| | | assertFalse(LDAPModify.mainModify(args, false, null, null) == 0); |
| | | assertFalse(LDAPModify.mainModify(args, false, null, null) == 0, |
| | | "Should have been invalid because: " + invalidReason); |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | |
| | | String[] args = {}; // No arguments. |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | | reasonList.add("No arguments were provided"); |
| | | |
| | | args = new String[] // Missing value for -h argument. |
| | | args = new String[] |
| | | { |
| | | "-h" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-h' argument"); |
| | | |
| | | args = new String[] // Missing value for -p argument. |
| | | args = new String[] |
| | | { |
| | | "-p" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-p' argument"); |
| | | |
| | | args = new String[] // Missing value for -D argument. |
| | | args = new String[] |
| | | { |
| | | "-D" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-D' argument"); |
| | | |
| | | args = new String[] // Missing value for -w argument. |
| | | args = new String[] |
| | | { |
| | | "-w" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-w' argument"); |
| | | |
| | | args = new String[] // Missing value for -W argument. |
| | | args = new String[] |
| | | { |
| | | "-W" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-W' argument"); |
| | | |
| | | args = new String[] // Missing value for -a argument. |
| | | args = new String[] |
| | | { |
| | | "-a" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-a' argument"); |
| | | |
| | | args = new String[] // Missing value for -n argument. |
| | | args = new String[] |
| | | { |
| | | "-n" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-n' argument"); |
| | | |
| | | args = new String[] // Missing value for -N argument. |
| | | args = new String[] |
| | | { |
| | | "-N" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-N' argument"); |
| | | |
| | | args = new String[] // Missing value for -c argument. |
| | | args = new String[] |
| | | { |
| | | "-c" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-c' argument"); |
| | | |
| | | args = new String[] // Missing value for -C argument. |
| | | args = new String[] |
| | | { |
| | | "-C" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-C' argument"); |
| | | |
| | | args = new String[] // Missing value for -k argument. |
| | | args = new String[] |
| | | { |
| | | "-k" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-k' argument"); |
| | | |
| | | args = new String[] // Missing value for -K argument. |
| | | args = new String[] |
| | | { |
| | | "-K" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-K' argument"); |
| | | |
| | | args = new String[] // Missing value for -t argument. |
| | | args = new String[] |
| | | { |
| | | "-t" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-t' argument"); |
| | | |
| | | args = new String[] // Missing value for -T argument. |
| | | args = new String[] |
| | | { |
| | | "-T" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-T' argument"); |
| | | |
| | | args = new String[] // Invalid bind password file path |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-W", "no.such.file" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid bind password file path"); |
| | | |
| | | args = new String[] // Both bind password and password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | | "-W", currentPasswordFile |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both bind password and bind password file"); |
| | | |
| | | args = new String[] // Both current password and current password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-c", "password", |
| | | "-C", currentPasswordFile |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both current password and current password file"); |
| | | |
| | | args = new String[] // Both new password and new password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-n", "password", |
| | | "-N", newPasswordFile |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both new password and new password file"); |
| | | |
| | | args = new String[] // Both SSL and StartTLS |
| | | args = new String[] |
| | | { |
| | | "-Z", |
| | | "-q" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both SSL and StartTLS"); |
| | | |
| | | args = new String[] // Non-numeric port |
| | | args = new String[] |
| | | { |
| | | "-p", "nonnumeric" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric port"); |
| | | |
| | | args = new String[] // Port value out of range. |
| | | args = new String[] |
| | | { |
| | | "-p", "999999" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Port value out of range"); |
| | | |
| | | args = new String[] // Bind DN without a password or password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Bind Dn without a password or password file"); |
| | | |
| | | args = new String[] // Bind password without a DN |
| | | args = new String[] |
| | | { |
| | | "-w", "password" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Bind password without a DN"); |
| | | |
| | | args = new String[] // Bind password file without a DN |
| | | args = new String[] |
| | | { |
| | | "-W", currentPasswordFile |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Bind password file without a DN"); |
| | | |
| | | args = new String[] // No bind credentials, with authzID, no current PW |
| | | args = new String[] |
| | | { |
| | | "-a", "u:test.user" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No bind credentials, with authzID, no current PW"); |
| | | |
| | | args = new String[] // Provide DN for authzID without DN |
| | | args = new String[] |
| | | { |
| | | "-A" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Provide DN for authzID without DN"); |
| | | |
| | | |
| | | Object[][] returnArray = new Object[argLists.size()][1]; |
| | | Object[][] returnArray = new Object[argLists.size()][2]; |
| | | for (int i=0; i < argLists.size(); i++) |
| | | { |
| | | returnArray[i][0] = argLists.get(i); |
| | | returnArray[i][1] = reasonList.get(i); |
| | | } |
| | | return returnArray; |
| | | } |
| | |
| | | /** |
| | | * Tests the LDAPModify tool with sets of invalid arguments. |
| | | * |
| | | * @param args The set of arguments to use for the LDAPModify tool. |
| | | * @param args The set of arguments to use for the LDAPModify tool. |
| | | * @param invalidReason The reason the provided arguments were invalid. |
| | | */ |
| | | @Test(dataProvider = "invalidArgs") |
| | | public void testInvalidArguments(String[] args) |
| | | public void testInvalidArguments(String[] args, String invalidReason) |
| | | { |
| | | assertFalse(LDAPPasswordModify.mainPasswordModify(args, false, null, |
| | | null) == 0); |
| | | null) == 0, |
| | | "Should have been invalid because: " + invalidReason); |
| | | } |
| | | |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | |
| | | String[] args = {}; // No arguments |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | | reasonList.add("No arguments"); |
| | | |
| | | args = new String[] // No value for '-b' argument |
| | | args = new String[] |
| | | { |
| | | "-b" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-b' argument"); |
| | | |
| | | args = new String[] // No value for '-D' argument |
| | | args = new String[] |
| | | { |
| | | "-D" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-D' argument"); |
| | | |
| | | args = new String[] // No value for '-w' argument |
| | | args = new String[] |
| | | { |
| | | "-w" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-w' argument"); |
| | | |
| | | args = new String[] // No value for '-j' argument |
| | | args = new String[] |
| | | { |
| | | "-j" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-j' argument"); |
| | | |
| | | args = new String[] // No value for '-Y' argument |
| | | args = new String[] |
| | | { |
| | | "-Y" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-Y' argument"); |
| | | |
| | | args = new String[] // No value for '-i' argument |
| | | args = new String[] |
| | | { |
| | | "-i" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-i' argument"); |
| | | |
| | | args = new String[] // No value for '-K' argument |
| | | args = new String[] |
| | | { |
| | | "-K" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-K' argument"); |
| | | |
| | | args = new String[] // No value for '-P' argument |
| | | args = new String[] |
| | | { |
| | | "-P" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-P' argument"); |
| | | |
| | | args = new String[] // No value for '-W' argument |
| | | args = new String[] |
| | | { |
| | | "-W" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-W' argument"); |
| | | |
| | | args = new String[] // No value for '-h' argument |
| | | args = new String[] |
| | | { |
| | | "-h" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-h' argument"); |
| | | |
| | | args = new String[] // No value for '-p' argument |
| | | args = new String[] |
| | | { |
| | | "-p" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-p' argument"); |
| | | |
| | | args = new String[] // No value for '-V' argument |
| | | args = new String[] |
| | | { |
| | | "-V" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-V' argument"); |
| | | |
| | | args = new String[] // No value for '-f' argument |
| | | args = new String[] |
| | | { |
| | | "-f" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-f' argument"); |
| | | |
| | | args = new String[] // No value for '-J' argument |
| | | args = new String[] |
| | | { |
| | | "-J" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-J' argument"); |
| | | |
| | | args = new String[] // No value for '-z' argument |
| | | args = new String[] |
| | | { |
| | | "-z" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-z' argument"); |
| | | |
| | | args = new String[] // No value for '-l' argument |
| | | args = new String[] |
| | | { |
| | | "-l" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-l' argument"); |
| | | |
| | | args = new String[] // No value for '-s' argument |
| | | args = new String[] |
| | | { |
| | | "-s" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-s' argument"); |
| | | |
| | | args = new String[] // No value for '-a' argument |
| | | args = new String[] |
| | | { |
| | | "-a" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-a' argument"); |
| | | |
| | | args = new String[] // No value for '-o' argument |
| | | args = new String[] |
| | | { |
| | | "-o" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-o' argument"); |
| | | |
| | | args = new String[] // No value for '-c' argument |
| | | args = new String[] |
| | | { |
| | | "-c" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '-c' argument"); |
| | | |
| | | args = new String[] // No value for '--assertionFilter' argument |
| | | args = new String[] |
| | | { |
| | | "--assertionFilter" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--assertionFilter' argument"); |
| | | |
| | | args = new String[] // No value for '--matchedValuesFilter' argument |
| | | args = new String[] |
| | | { |
| | | "--matchedValuesFilter" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No value for '--matchedValuesFilter' argument"); |
| | | |
| | | args = new String[] // Invalid short argument |
| | | args = new String[] |
| | | { |
| | | "-I" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid short argument"); |
| | | |
| | | args = new String[] // Invalid long argument |
| | | args = new String[] |
| | | { |
| | | "--invalidLongArgument" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid long argument"); |
| | | |
| | | args = new String[] // No base DN |
| | | args = new String[] |
| | | { |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No base DN"); |
| | | |
| | | args = new String[] // Base DN with no value |
| | | { |
| | | "-b" |
| | | }; |
| | | argLists.add(args); |
| | | |
| | | args = new String[] // No filter |
| | | args = new String[] |
| | | { |
| | | "-b", "" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("No filter"); |
| | | |
| | | args = new String[] // Invalid search filter |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "(invalidfilter)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid search filter"); |
| | | |
| | | args = new String[] // Invalid assertion filter |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "--assertionFilter", "(invalidfilter)", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid assertion filter"); |
| | | |
| | | args = new String[] // Invalid matched values filter |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "--matchedValuesFilter", "(invalidfilter)", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid matched values filter"); |
| | | |
| | | args = new String[] // Invalid bind password file path |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-j", "no.such.file", |
| | |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid bind password file path"); |
| | | |
| | | args = new String[] // Both bind password and password file |
| | | args = new String[] |
| | | { |
| | | "-D", "cn=Directory Manager", |
| | | "-w", "password", |
| | |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Both bind password and bind password file"); |
| | | |
| | | args = new String[] // Non-numeric LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-V", "nonnumeric", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric LDAP version"); |
| | | |
| | | args = new String[] // Invalid LDAP version. |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-V", "1", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid LDAP version"); |
| | | |
| | | args = new String[] // Invalid filter file path. |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-f", "no.such.file" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid filter file path"); |
| | | |
| | | args = new String[] // Invalid control criticality |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-J", "1.2.3.4:invalidcriticality", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid control criticality"); |
| | | |
| | | args = new String[] // Invalid scope |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-s", "invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid scope"); |
| | | |
| | | args = new String[] // Invalid dereference policy |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-a", "invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid dereference policy"); |
| | | |
| | | args = new String[] // Invalid psearch descriptor |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-C", "invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid psearch descriptor"); |
| | | |
| | | args = new String[] // Invalid psearch changetype |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-C", "ps:invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid psearch changetype"); |
| | | |
| | | args = new String[] // Invalid psearch changetype in list |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-C", "ps:add,delete,modify,modifydn,invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid psearch changetype in list"); |
| | | |
| | | args = new String[] // Invalid psearch changesOnly |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-C", "ps:all:invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid psearch changesOnly"); |
| | | |
| | | args = new String[] // Invalid psearch entryChangeControls |
| | | args = new String[] |
| | | { |
| | | "-b", "", |
| | | "-C", "ps:all:1:invalid", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Invalid psearch entryChangeControls"); |
| | | |
| | | args = new String[] // Non-numeric port |
| | | args = new String[] |
| | | { |
| | | "-p", "nonnumeric", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric port"); |
| | | |
| | | args = new String[] // Port value out of range. |
| | | args = new String[] |
| | | { |
| | | "-p", "999999", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Port value out of range"); |
| | | |
| | | args = new String[] // Non-numeric size limit |
| | | args = new String[] |
| | | { |
| | | "-z", "nonnumeric", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric size limit"); |
| | | |
| | | args = new String[] // Size limit out of range. |
| | | { |
| | | "-z", "-1", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | |
| | | args = new String[] // Non-numeric time limit |
| | | args = new String[] |
| | | { |
| | | "-l", "nonnumeric", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("Non-numeric time limit"); |
| | | |
| | | args = new String[] // Time limit out of range. |
| | | { |
| | | "-l", "-1", |
| | | "-b", "", |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | |
| | | args = new String[] // SASL external without SSL or StartTLS |
| | | args = new String[] |
| | | { |
| | | "-r", |
| | | "-b", "", |
| | |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without SSL or StartTLS"); |
| | | |
| | | args = new String[] // SASL external without keystore file |
| | | args = new String[] |
| | | { |
| | | "-Z", |
| | | "-r", |
| | |
| | | "(objectClass=*)" |
| | | }; |
| | | argLists.add(args); |
| | | reasonList.add("SASL external without a keystore file"); |
| | | |
| | | |
| | | Object[][] returnArray = new Object[argLists.size()][1]; |
| | | Object[][] returnArray = new Object[argLists.size()][2]; |
| | | for (int i=0; i < argLists.size(); i++) |
| | | { |
| | | returnArray[i][0] = argLists.get(i); |
| | | returnArray[i][1] = reasonList.get(i); |
| | | } |
| | | return returnArray; |
| | | } |
| | |
| | | /** |
| | | * Tests the LDAPSearch tool with sets of invalid arguments. |
| | | * |
| | | * @param args The set of arguments to use for the LDAPSearch tool. |
| | | * @param args The set of arguments to use for the LDAPSearch tool. |
| | | * @param invalidReason The reason that the set of arguments is not valid. |
| | | */ |
| | | @Test(dataProvider = "invalidArgs") |
| | | public void testInvalidArguments(String[] args) |
| | | public void testInvalidArguments(String[] args, String invalidReason) |
| | | { |
| | | assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0); |
| | | assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0, |
| | | "Should have been invalid because: " + invalidReason); |
| | | } |
| | | |
| | | |