Update CM to us Local Intermediate Certs
[aaf/authz.git] / cadi / aaf / src / test / java / org / onap / aaf / cadi / cm / test / JU_PlaceArtifactInKeystore.java
index 02054cb..0b086f1 100644 (file)
@@ -39,7 +39,7 @@ import java.security.cert.CertificateException;
 import org.junit.*;
 import org.mockito.*;
 import org.onap.aaf.cadi.CadiException;
-import org.onap.aaf.cadi.cm.PlaceArtifactInKeystore;
+import org.onap.aaf.cadi.configure.PlaceArtifactInKeystore;
 import org.onap.aaf.misc.env.Env;
 import org.onap.aaf.misc.env.TimeTaken;
 import org.onap.aaf.misc.env.Trans;
@@ -53,6 +53,7 @@ public class JU_PlaceArtifactInKeystore {
        @Mock private CertInfo certInfoMock;
        @Mock private Artifact artiMock;
 
+       private static final String caName = "onap";
        private static final String dirName = "src/test/resources/artifacts";
        private static final String nsName = "org.onap.test";
        private static final String mechID = "m12345";
@@ -77,6 +78,7 @@ public class JU_PlaceArtifactInKeystore {
                when(certInfoMock.getChallenge()).thenReturn(luggagePassword);
                when(certInfoMock.getCerts()).thenReturn(certs);
 
+               when(artiMock.getCa()).thenReturn(caName);
                when(artiMock.getDir()).thenReturn(dirName);
                when(artiMock.getNs()).thenReturn(nsName);
                when(artiMock.getMechid()).thenReturn(mechID);
@@ -94,13 +96,15 @@ public class JU_PlaceArtifactInKeystore {
 
        @Test
        public void test() throws CadiException {
-               PlaceArtifactInKeystore placer = new PlaceArtifactInKeystore("pkcs12");
+               // Note: PKCS12 can't be tested in JDK 7 and earlier.  Can't handle Trusting Certificates.
+               PlaceArtifactInKeystore placer = new PlaceArtifactInKeystore("jks");
 
                certs.add(x509String);
                certs.add(x509Chain);
                assertThat(placer.place(transMock, certInfoMock, artiMock, "machine"), is(true));
-               for (String ext : new String[] {"chal", "keyfile", "pkcs12", "props", "trust.pkcs12"}) {
-                       assertThat(new File(dirName + '/' + nsName + '.' + ext).exists(), is(true));
+               for (String ext : new String[] {"chal", "keyfile", "jks", "trust.jks", "cred.props"}) {
+                       File f = new File(dirName + '/' + nsName + '.' + ext);
+                       assertThat(f.exists(), is(true));
                }
 
                // coverage