X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Faaf%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Fsso%2Ftest%2FJU_AAFSSO.java;h=368a5e29d6264f20fd97c6cc0cda94d7f3cdc3a6;hb=4b5a7d721d994a49057e9bfb403c7bff1b376660;hp=7a64f71ca51efebec2cdcb8707cd7127648cc363;hpb=4906c14f770e85452240fc8e04807b6114fab1ca;p=aaf%2Fauthz.git diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java index 7a64f71c..368a5e29 100644 --- a/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java +++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/sso/test/JU_AAFSSO.java @@ -39,82 +39,82 @@ import org.onap.aaf.cadi.sso.AAFSSO; public class JU_AAFSSO { - private static final String resourceDirString = "src/test/resources"; - private static final String aafDir = resourceDirString + "/aaf"; - - private ByteArrayInputStream inStream; - - @Before - public void setup() { - System.setProperty("user.home", aafDir); - - // Simulate user input - inStream = new ByteArrayInputStream("test\npassword".getBytes()); - System.setIn(inStream); - } - - @After - public void tearDown() { - recursiveDelete(new File(aafDir)); - } - - @Test - public void test() throws IOException, CadiException { - AAFSSO sso; - String[] args; - - args = new String[] { - "-login", - "-noexit", - }; - sso = new AAFSSO(args); - - assertThat(new File(aafDir).exists(), is(true)); - assertThat(new File(aafDir + "/.aaf").exists(), is(true)); - assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(true)); - assertThat(new File(aafDir + "/.aaf/sso.out").exists(), is(true)); - assertThat(sso.loginOnly(), is(true)); + private static final String resourceDirString = "src/test/resources"; + private static final String aafDir = resourceDirString + "/aaf"; + + private ByteArrayInputStream inStream; + + @Before + public void setup() { + System.setProperty("user.home", aafDir); + + // Simulate user input + inStream = new ByteArrayInputStream("test\npassword".getBytes()); + System.setIn(inStream); + } + + @After + public void tearDown() { + recursiveDelete(new File(aafDir)); + } + + @Test + public void test() throws IOException, CadiException { + AAFSSO sso; + String[] args; + + args = new String[] { + "-login", + "-noexit", + }; + sso = new AAFSSO(args); + + assertThat(new File(aafDir).exists(), is(true)); + assertThat(new File(aafDir + "/.aaf").exists(), is(true)); + assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(true)); + assertThat(new File(aafDir + "/.aaf/sso.out").exists(), is(true)); + assertThat(sso.loginOnly(), is(true)); // Not necessarily true -// assertThat(new File(aafDir + "/.aaf/sso.props").exists(), is(true)); - - sso.setLogDefault(); - sso.setStdErrDefault(); - - inStream.reset(); - args = new String[] { - "-logout", - "\\*", - "-noexit", - }; - sso = new AAFSSO(args); - - assertThat(new File(aafDir).exists(), is(true)); - assertThat(new File(aafDir + "/.aaf").exists(), is(true)); - assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(false)); - assertThat(new File(aafDir + "/.aaf/sso.out").exists(), is(true)); - assertThat(sso.loginOnly(), is(false)); - - PropAccess access = sso.access(); - assertThat(sso.enc_pass(), is(access.getProperty(Config.AAF_APPPASS))); - assertThat(sso.user(), is(access.getProperty(Config.AAF_APPID))); - - sso.addProp("key", "value"); - assertThat(sso.err(), is(nullValue())); - - assertThat(sso.useX509(), is(false)); - - sso.close(); - } - - private void recursiveDelete(File file) { - for (File f : file.listFiles()) { - if (f.isDirectory()) { - recursiveDelete(f); - } - f.delete(); - } - file.delete(); - } +// assertThat(new File(aafDir + "/.aaf/sso.props").exists(), is(true)); + + sso.setLogDefault(); + sso.setStdErrDefault(); + + inStream.reset(); + args = new String[] { + "-logout", + "\\*", + "-noexit", + }; + sso = new AAFSSO(args); + + assertThat(new File(aafDir).exists(), is(true)); + assertThat(new File(aafDir + "/.aaf").exists(), is(true)); + assertThat(new File(aafDir + "/.aaf/keyfile").exists(), is(false)); + assertThat(new File(aafDir + "/.aaf/sso.out").exists(), is(true)); + assertThat(sso.loginOnly(), is(false)); + + PropAccess access = sso.access(); + assertThat(sso.enc_pass(), is(access.getProperty(Config.AAF_APPPASS))); + assertThat(sso.user(), is(access.getProperty(Config.AAF_APPID))); + + sso.addProp("key", "value"); + assertThat(sso.err(), is(nullValue())); + + assertThat(sso.useX509(), is(false)); + + sso.close(); + } + + private void recursiveDelete(File file) { + for (File f : file.listFiles()) { + if (f.isDirectory()) { + recursiveDelete(f); + } + f.delete(); + } + file.delete(); + } }