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;
@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";
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);
@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