X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Fcore%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2Ftest%2FJU_CmdLine.java;h=b2820db2b223fd8fb5a85c8b52cea6411d57758a;hb=abf7c0e407c97250c07d408c314c5aa1c757263e;hp=5da67ce09148e879f082e6687aad228000511e76;hpb=a20accc73189d8e5454cd26049c0e6fae75da16f;p=aaf%2Fauthz.git diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java index 5da67ce0..b2820db2 100644 --- a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java +++ b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CmdLine.java @@ -32,6 +32,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; @@ -42,6 +43,7 @@ import java.util.Properties; import org.onap.aaf.cadi.CmdLine; import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.Symm; +import org.onap.aaf.cadi.util.Chmod; public class JU_CmdLine { @@ -67,11 +69,30 @@ public class JU_CmdLine { p.setProperty("force_exit", "false"); CmdLine.access = new PropAccess(p); - - password = "password"; + File test = new File("test"); + if(test.exists()) { + if(!test.isDirectory()) { + test.delete(); + test.mkdirs(); + } + } else { + test.mkdirs(); + } + + File keyF= new File(test,"keyfile"); + if(!keyF.exists()) { + FileOutputStream fos = new FileOutputStream(keyF); + try { + fos.write(Symm.keygen()); + fos.flush(); + } finally { + fos.close(); + } + } keyfile = "test/keyfile"; + password = "password"; - FileInputStream fis = new FileInputStream(keyfile); + FileInputStream fis = new FileInputStream(keyF); try { symm = Symm.obtain(fis); } finally { @@ -97,12 +118,12 @@ public class JU_CmdLine { assertThat(decrypted, is(password)); } - @Test - public void regurgitateTest() { - // TODO: We may still want to remove the regurgitate functionality - // from the CmdLine - Ian - fail("Tests not yet implemented"); - } + // @Test + // public void regurgitateTest() { + // // TODO: We may still want to remove the regurgitate functionality + // // from the CmdLine - Ian + // fail("Tests not yet implemented"); + // } @Test public void encode64Test() throws Exception {