@Test public void testPromptForCredentialWithEmptyPasswd() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add(null); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(outContent.toString(), 1, rc); assertTrue(outContent.toString().contains("Passwords don't match")); }
@Test public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "created.")); String[] args2 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args2); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "deleted.")); }
@Test public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "created.")); String[] args2 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args2); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "deleted.")); }
@Test public void testPromptForCredentialWithEmptyPasswd() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add(null); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(outContent.toString(), 1, rc); assertTrue(outContent.toString().contains("Passwords don't match")); }