summaryrefslogtreecommitdiffstats
path: root/auth/auth-certman/src/test
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-09-07 12:21:34 -0500
committerInstrumental <jonathan.gathman@att.com>2018-09-07 12:22:50 -0500
commit4b5a7d721d994a49057e9bfb403c7bff1b376660 (patch)
treea36d03227b63a3e60346d6c3ca87b061087dae85 /auth/auth-certman/src/test
parent824dc7b5fc0e1ccdf7f460479aff344727f0f01e (diff)
Mass removal of all Tabs (Style Warnings)
Issue-ID: AAF-473 Change-Id: Iaf0ef8120882937959bb0065f2f6ba74a021940f Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-certman/src/test')
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java124
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java124
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java434
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java144
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java260
-rw-r--r--auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java192
6 files changed, 639 insertions, 639 deletions
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
index f50190d3..fc450bef 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Artifact.java
@@ -41,67 +41,67 @@ import org.onap.aaf.auth.env.AuthzTrans;
@RunWith(MockitoJUnitRunner.class)
public class JU_API_Artifact {
-
- @Mock
- private static API_Artifact api;
-
- @Mock
- private static AAF_CM certManApi;
-
- private static AAF_CM noMockAPI;
- private static API_Artifact api_1;
-
- private static HttpServletRequest req;
- private static HttpServletResponse res;
-
- @BeforeClass
- public static void setUp() {
- AuthzTrans trans = mock(AuthzTrans.class);
- req = mock(HttpServletRequest.class);
- trans.setProperty("testTag", "UserValue");
- trans.set(req);
- }
-
- @Rule
+
+ @Mock
+ private static API_Artifact api;
+
+ @Mock
+ private static AAF_CM certManApi;
+
+ private static AAF_CM noMockAPI;
+ private static API_Artifact api_1;
+
+ private static HttpServletRequest req;
+ private static HttpServletResponse res;
+
+ @BeforeClass
+ public static void setUp() {
+ AuthzTrans trans = mock(AuthzTrans.class);
+ req = mock(HttpServletRequest.class);
+ trans.setProperty("testTag", "UserValue");
+ trans.set(req);
+ }
+
+ @Rule
public ExpectedException thrown= ExpectedException.none();
-
- @Test
- public void init_bothValued() {
- try {
- api.init(certManApi);
- } catch (Exception e) {
- thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_Null_() {
- try {
- api.init(null);
- } catch (Exception e) {
- //thrown.expect(Exception.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_NMC_Null() {
- try {
- api_1.init(null);
- } catch (Exception e) {
- //thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_NMC() {
- try {
- api_1.init(noMockAPI);
- } catch (Exception e) {
- //thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
+
+ @Test
+ public void init_bothValued() {
+ try {
+ api.init(certManApi);
+ } catch (Exception e) {
+ thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_Null_() {
+ try {
+ api.init(null);
+ } catch (Exception e) {
+ //thrown.expect(Exception.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_NMC_Null() {
+ try {
+ api_1.init(null);
+ } catch (Exception e) {
+ //thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_NMC() {
+ try {
+ api_1.init(noMockAPI);
+ } catch (Exception e) {
+ //thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
index dbd66e41..f42a02a9 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/api/JU_API_Cert.java
@@ -41,67 +41,67 @@ import org.onap.aaf.auth.env.AuthzTrans;
@RunWith(MockitoJUnitRunner.class)
public class JU_API_Cert {
-
- @Mock
- private static API_Cert api;
-
- @Mock
- private static AAF_CM certManApi;
-
- private static AAF_CM noMockAPI;
- private static API_Cert api_1;
-
- private static HttpServletRequest req;
- private static HttpServletResponse res;
-
- @BeforeClass
- public static void setUp() {
- AuthzTrans trans = mock(AuthzTrans.class);
- req = mock(HttpServletRequest.class);
- trans.setProperty("testTag", "UserValue");
- trans.set(req);
- }
-
- @Rule
+
+ @Mock
+ private static API_Cert api;
+
+ @Mock
+ private static AAF_CM certManApi;
+
+ private static AAF_CM noMockAPI;
+ private static API_Cert api_1;
+
+ private static HttpServletRequest req;
+ private static HttpServletResponse res;
+
+ @BeforeClass
+ public static void setUp() {
+ AuthzTrans trans = mock(AuthzTrans.class);
+ req = mock(HttpServletRequest.class);
+ trans.setProperty("testTag", "UserValue");
+ trans.set(req);
+ }
+
+ @Rule
public ExpectedException thrown= ExpectedException.none();
-
- @Test
- public void init_bothValued() {
- try {
- api.init(certManApi);
- } catch (Exception e) {
- //thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_Null_() {
- try {
- api.init(null);
- } catch (Exception e) {
- //thrown.expect(Exception.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_NMC_Null() {
- try {
- api_1.init(null);
- } catch (Exception e) {
- //thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
-
- @Test
- public void init_NMC() {
- try {
- api_1.init(noMockAPI);
- } catch (Exception e) {
- //thrown.expect(NullPointerException.class);
- e.printStackTrace();
- }
- }
+
+ @Test
+ public void init_bothValued() {
+ try {
+ api.init(certManApi);
+ } catch (Exception e) {
+ //thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_Null_() {
+ try {
+ api.init(null);
+ } catch (Exception e) {
+ //thrown.expect(Exception.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_NMC_Null() {
+ try {
+ api_1.init(null);
+ } catch (Exception e) {
+ //thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void init_NMC() {
+ try {
+ api_1.init(noMockAPI);
+ } catch (Exception e) {
+ //thrown.expect(NullPointerException.class);
+ e.printStackTrace();
+ }
+ }
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
index 1ab0f4bd..1c38a8ed 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/ca/JU_AppCA.java
@@ -60,223 +60,223 @@ import org.onap.aaf.misc.env.Trans;
//TODO: Gabe [JUnit] Import does not exist
@RunWith(MockitoJUnitRunner.class)
public class JU_AppCA {
-
- @Mock
- private static CachedCertDAO certDAO;
-
- @Mock
- private static HttpServletRequest req;
-
- @Mock
- private static CSRMeta csrMeta;
-
- static Trans trans;
-
- static X509andChain cert1;
- static byte [] name = {1,23,4,54,6,56};
-
- private static LocalCA localCA;
-
- @BeforeClass
- public static void setUp() throws CertificateException, CertException, IOException {
- String str = "core java api";
+
+ @Mock
+ private static CachedCertDAO certDAO;
+
+ @Mock
+ private static HttpServletRequest req;
+
+ @Mock
+ private static CSRMeta csrMeta;
+
+ static Trans trans;
+
+ static X509andChain cert1;
+ static byte [] name = {1,23,4,54,6,56};
+
+ private static LocalCA localCA;
+
+ @BeforeClass
+ public static void setUp() throws CertificateException, CertException, IOException {
+ String str = "core java api";
byte[] b = str.getBytes();
- Principal prc = new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US");
- req = mock(HttpServletRequest.class);
- localCA = mock(LocalCA.class);
- X509Certificate cert = new X509Certificate() {
-
- @Override
- public boolean hasUnsupportedCriticalExtension() {
- return false;
- }
-
- @Override
- public Set<String> getNonCriticalExtensionOIDs() {
-
- return null;
- }
-
- @Override
- public byte[] getExtensionValue(String oid) {
-
- return null;
- }
-
- @Override
- public Set<String> getCriticalExtensionOIDs() {
-
- return null;
- }
-
- @Override
- public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException,
- InvalidKeyException, NoSuchProviderException, SignatureException {
-
-
- }
-
- @Override
- public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
- NoSuchProviderException, SignatureException {
-
-
- }
-
- @Override
- public String toString() {
-
- return null;
- }
-
- @Override
- public PublicKey getPublicKey() {
-
- return null;
- }
-
- @Override
- public byte[] getEncoded() throws CertificateEncodingException {
-
- return null;
- }
-
- @Override
- public int getVersion() {
-
- return 0;
- }
-
- @Override
- public byte[] getTBSCertificate() throws CertificateEncodingException {
-
- return null;
- }
-
- @Override
- public boolean[] getSubjectUniqueID() {
-
- return null;
- }
-
- @Override
- public Principal getSubjectDN() {
-
- return null;
- }
-
- @Override
- public byte[] getSignature() {
-
- return null;
- }
-
- @Override
- public byte[] getSigAlgParams() {
-
- return null;
- }
-
- @Override
- public String getSigAlgOID() {
-
- return null;
- }
-
- @Override
- public String getSigAlgName() {
-
- return null;
- }
-
- @Override
- public BigInteger getSerialNumber() {
-
- return null;
- }
-
- @Override
- public Date getNotBefore() {
-
- return null;
- }
-
- @Override
- public Date getNotAfter() {
-
- return null;
- }
-
- @Override
- public boolean[] getKeyUsage() {
-
- return null;
- }
-
- @Override
- public boolean[] getIssuerUniqueID() {
-
- return null;
- }
-
- @Override
- public Principal getIssuerDN() {
-
- return null;
- }
-
- @Override
- public int getBasicConstraints() {
-
- return 0;
- }
-
- @Override
- public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException {
-
-
- }
-
- @Override
- public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException {
-
- }
- };
- X509andChain xac = new X509andChain(cert, new ArrayList<>());
- when(localCA.sign(Mockito.any(Trans.class), Mockito.any(CSRMeta.class))).thenReturn(xac);
- certDAO = mock(CachedCertDAO.class, CALLS_REAL_METHODS);
- }
-
- @Test
- public void identity_True() throws CertificateException, IOException, CertException {
- assertNotNull(localCA.sign(trans, csrMeta));
- }
-
-
- @Test
- public void identityNull() throws CertificateException {
- try {
- assertNotNull(localCA.sign(null, csrMeta));
- } catch (IOException e) {
-
- e.printStackTrace();
- } catch (CertException e) {
-
- e.printStackTrace();
- }
- }
-
- @Test
- public void identityBothNull() throws CertificateException {
- try {
- assertNotNull(localCA.sign(null, null));
- } catch (IOException e) {
-
- e.printStackTrace();
- } catch (CertException e) {
-
- e.printStackTrace();
- }
- }
+ Principal prc = new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US");
+ req = mock(HttpServletRequest.class);
+ localCA = mock(LocalCA.class);
+ X509Certificate cert = new X509Certificate() {
+
+ @Override
+ public boolean hasUnsupportedCriticalExtension() {
+ return false;
+ }
+
+ @Override
+ public Set<String> getNonCriticalExtensionOIDs() {
+
+ return null;
+ }
+
+ @Override
+ public byte[] getExtensionValue(String oid) {
+
+ return null;
+ }
+
+ @Override
+ public Set<String> getCriticalExtensionOIDs() {
+
+ return null;
+ }
+
+ @Override
+ public void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException,
+ InvalidKeyException, NoSuchProviderException, SignatureException {
+
+
+ }
+
+ @Override
+ public void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException {
+
+
+ }
+
+ @Override
+ public String toString() {
+
+ return null;
+ }
+
+ @Override
+ public PublicKey getPublicKey() {
+
+ return null;
+ }
+
+ @Override
+ public byte[] getEncoded() throws CertificateEncodingException {
+
+ return null;
+ }
+
+ @Override
+ public int getVersion() {
+
+ return 0;
+ }
+
+ @Override
+ public byte[] getTBSCertificate() throws CertificateEncodingException {
+
+ return null;
+ }
+
+ @Override
+ public boolean[] getSubjectUniqueID() {
+
+ return null;
+ }
+
+ @Override
+ public Principal getSubjectDN() {
+
+ return null;
+ }
+
+ @Override
+ public byte[] getSignature() {
+
+ return null;
+ }
+
+ @Override
+ public byte[] getSigAlgParams() {
+
+ return null;
+ }
+
+ @Override
+ public String getSigAlgOID() {
+
+ return null;
+ }
+
+ @Override
+ public String getSigAlgName() {
+
+ return null;
+ }
+
+ @Override
+ public BigInteger getSerialNumber() {
+
+ return null;
+ }
+
+ @Override
+ public Date getNotBefore() {
+
+ return null;
+ }
+
+ @Override
+ public Date getNotAfter() {
+
+ return null;
+ }
+
+ @Override
+ public boolean[] getKeyUsage() {
+
+ return null;
+ }
+
+ @Override
+ public boolean[] getIssuerUniqueID() {
+
+ return null;
+ }
+
+ @Override
+ public Principal getIssuerDN() {
+
+ return null;
+ }
+
+ @Override
+ public int getBasicConstraints() {
+
+ return 0;
+ }
+
+ @Override
+ public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException {
+
+
+ }
+
+ @Override
+ public void checkValidity() throws CertificateExpiredException, CertificateNotYetValidException {
+
+ }
+ };
+ X509andChain xac = new X509andChain(cert, new ArrayList<>());
+ when(localCA.sign(Mockito.any(Trans.class), Mockito.any(CSRMeta.class))).thenReturn(xac);
+ certDAO = mock(CachedCertDAO.class, CALLS_REAL_METHODS);
+ }
+
+ @Test
+ public void identity_True() throws CertificateException, IOException, CertException {
+ assertNotNull(localCA.sign(trans, csrMeta));
+ }
+
+
+ @Test
+ public void identityNull() throws CertificateException {
+ try {
+ assertNotNull(localCA.sign(null, csrMeta));
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ } catch (CertException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void identityBothNull() throws CertificateException {
+ try {
+ assertNotNull(localCA.sign(null, null));
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ } catch (CertException e) {
+
+ e.printStackTrace();
+ }
+ }
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
index 337bc9ed..eae37640 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/cert/JU_BCFactory.java
@@ -47,82 +47,82 @@ import org.onap.aaf.misc.env.Trans;
@RunWith(MockitoJUnitRunner.class)
public class JU_BCFactory {
-
- private static BCFactory bcFactory = new BCFactory();
-
- private static BCFactory bcFact;
-
- private static PrivateKey pk;
-
-
- private static Trans trans;
-
-
- private static PKCS10CertificationRequest req;
-
- @BeforeClass
- public static void setUp() throws IOException {
- pk = new XYZKey();
- trans = mock(Trans.class);
- req = mock(PKCS10CertificationRequest.class);
- when(req.getEncoded()).thenReturn(new byte[1]);
- when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken(null, 0) {
-
- @Override
- public void output(StringBuilder sb) {
- // TODO Auto-generated method stub
-
- }
- });
- bcFact = mock(BCFactory.class);
- }
-
- @Test
- public void toStrin() throws OperatorCreationException, IOException, CertException {
- assertNotNull(bcFactory.toString(req));
- }
-
- @Test
- public void toStrinMoc() throws OperatorCreationException, IOException, CertException {
- assertNotNull(bcFact.toString(req));
- }
-
- @Rule
+
+ private static BCFactory bcFactory = new BCFactory();
+
+ private static BCFactory bcFact;
+
+ private static PrivateKey pk;
+
+
+ private static Trans trans;
+
+
+ private static PKCS10CertificationRequest req;
+
+ @BeforeClass
+ public static void setUp() throws IOException {
+ pk = new XYZKey();
+ trans = mock(Trans.class);
+ req = mock(PKCS10CertificationRequest.class);
+ when(req.getEncoded()).thenReturn(new byte[1]);
+ when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken(null, 0) {
+
+ @Override
+ public void output(StringBuilder sb) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ bcFact = mock(BCFactory.class);
+ }
+
+ @Test
+ public void toStrin() throws OperatorCreationException, IOException, CertException {
+ assertNotNull(bcFactory.toString(req));
+ }
+
+ @Test
+ public void toStrinMoc() throws OperatorCreationException, IOException, CertException {
+ assertNotNull(bcFact.toString(req));
+ }
+
+ @Rule
public ExpectedException thrown= ExpectedException.none();
-
- @Test
- public void toCSR() {
- try {
- assertNotNull(bcFactory.toCSR(trans, new File("/random/path")));
- thrown.expect(FileNotFoundException.class);
- } catch (IOException e) {
-
- e.printStackTrace();
- }
- }
-
+
+ @Test
+ public void toCSR() {
+ try {
+ assertNotNull(bcFactory.toCSR(trans, new File("/random/path")));
+ thrown.expect(FileNotFoundException.class);
+ } catch (IOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
}
class XYZKey implements Key, PublicKey, PrivateKey {
-
- int rotValue;
- public XYZKey() {
- rotValue = 1200213;
- }
- public String getAlgorithm() {
- return "XYZ";
- }
+
+ int rotValue;
+ public XYZKey() {
+ rotValue = 1200213;
+ }
+ public String getAlgorithm() {
+ return "XYZ";
+ }
- public String getFormat() {
- return "XYZ Special Format";
- }
+ public String getFormat() {
+ return "XYZ Special Format";
+ }
- public byte[] getEncoded() {
- byte b[] = new byte[4];
- b[3] = (byte) ((rotValue << 24) & 0xff);
- b[2] = (byte) ((rotValue << 16) & 0xff);
- b[1] = (byte) ((rotValue << 8) & 0xff);
- b[0] = (byte) ((rotValue << 0) & 0xff);
- return b;
- }
+ public byte[] getEncoded() {
+ byte b[] = new byte[4];
+ b[3] = (byte) ((rotValue << 24) & 0xff);
+ b[2] = (byte) ((rotValue << 16) & 0xff);
+ b[1] = (byte) ((rotValue << 8) & 0xff);
+ b[0] = (byte) ((rotValue << 0) & 0xff);
+ return b;
+ }
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
index 27ac04e5..48f5f1b6 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/facade/JU_FacadeImpl.java
@@ -52,134 +52,134 @@ import org.onap.aaf.misc.env.TimeTaken;
@RunWith(MockitoJUnitRunner.class)
public class JU_FacadeImpl<REQ,CERT,ARTIFACTS,ERROR> {
-
- private static AuthzTrans trans;
- private static HttpServletResponse resp;
- private static AAF_CM certman;
- private static FacadeImpl hImpl;
- private static CMService service;
- private Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper;
- private Data.TYPE dataType;
- private static AuthzEnv env;
-
- private static FacadeImpl fImpl;
- private static HttpServletRequest req;
-
- @Before
- public void setUp() throws APIException, IOException {
- fImpl = mock(FacadeImpl.class);
- env = mock(AuthzEnv.class);
- resp = mock(HttpServletResponse.class);
- req = mock(HttpServletRequest.class);
- hImpl = mock(FacadeImpl.class, CALLS_REAL_METHODS);
- Result<Void> rvd = (Result) mock(Result.class);
- trans = mock(AuthzTrans.class);
- when(trans.error()).thenReturn(new LogTarget() {
-
- @Override
- public void printf(String fmt, Object... vars) {}
-
- @Override
- public void log(Throwable e, Object... msgs) {
- e.getMessage();
- e.printStackTrace();
- msgs.toString();
-
- }
-
- @Override
- public void log(Object... msgs) {
- }
-
- @Override
- public boolean isLoggable() {
-
- return false;
- }
- });
- when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken("Now", 1) {
-
- @Override
- public void output(StringBuilder sb) {
-
- }
- });
- when(fImpl.check(Mockito.any(AuthzTrans.class), Mockito.any(HttpServletResponse.class), Mockito.anyString())).thenReturn(rvd);
- when(resp.getOutputStream()).thenReturn(new ServletOutputStream() {
-
- @Override
- public void write(int b) throws IOException {
-
-
- }
- });
-
- }
-
- @Test
- public void check() throws IOException {
- AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
- String perms = ap.getInstance();
- assertNotNull(hImpl.check(trans, resp, perms));
- }
-
- @Test
- public void checkNull() throws IOException {
- AAFPermission ap = new AAFPermission(null,null,"Str3","str2");
- String perms = ap.getInstance();
- assertNotNull(hImpl.check(trans, resp, perms));
- }
-
- @Test
- public void checkTwoNull() throws IOException {
- AAFPermission ap = new AAFPermission(null,null,null,"str2");
- String perms = ap.getInstance();
- assertNotNull(fImpl.check(trans, resp, perms));
- }
-
- @Test
- public void checkAllNull() throws IOException {
- AAFPermission ap = new AAFPermission(null,null,null,null);
- String perms = ap.getInstance();
- assertNotNull(fImpl.check(trans, resp, perms));
- }
-
- @Test
- public void checkTrans_null() throws IOException {
- AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
- String perms = ap.getInstance();
- assertNotNull(hImpl.check(null, resp, perms));
- }
-
- @Test
- public void checkRespNull() throws IOException {
- AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
- String perms = ap.getInstance();
- assertNotNull(hImpl.check(trans, null, perms));
- }
-
- @Test
- public void requestCert() {
- assertNotNull(hImpl.requestCert(trans, req, resp, null));
- }
-
- @Test
- public void renewCert() {
- assertNotNull(hImpl.renewCert(trans, req, resp, true));
- }
-
- @Test
- public void dropCert() {
- assertNotNull(hImpl.renewCert(trans, req, resp, true));
- }
-
- @Test
- public void createArtifacts() {
- assertNotNull(hImpl.createArtifacts(trans, req, resp));
- }
-
- @Test
- public void readArtifacts() {
- assertNotNull(hImpl.readArtifacts(trans, req, resp));
- }
+
+ private static AuthzTrans trans;
+ private static HttpServletResponse resp;
+ private static AAF_CM certman;
+ private static FacadeImpl hImpl;
+ private static CMService service;
+ private Mapper<REQ,CERT,ARTIFACTS,ERROR> mapper;
+ private Data.TYPE dataType;
+ private static AuthzEnv env;
+
+ private static FacadeImpl fImpl;
+ private static HttpServletRequest req;
+
+ @Before
+ public void setUp() throws APIException, IOException {
+ fImpl = mock(FacadeImpl.class);
+ env = mock(AuthzEnv.class);
+ resp = mock(HttpServletResponse.class);
+ req = mock(HttpServletRequest.class);
+ hImpl = mock(FacadeImpl.class, CALLS_REAL_METHODS);
+ Result<Void> rvd = (Result) mock(Result.class);
+ trans = mock(AuthzTrans.class);
+ when(trans.error()).thenReturn(new LogTarget() {
+
+ @Override
+ public void printf(String fmt, Object... vars) {}
+
+ @Override
+ public void log(Throwable e, Object... msgs) {
+ e.getMessage();
+ e.printStackTrace();
+ msgs.toString();
+
+ }
+
+ @Override
+ public void log(Object... msgs) {
+ }
+
+ @Override
+ public boolean isLoggable() {
+
+ return false;
+ }
+ });
+ when(trans.start(Mockito.anyString(), Mockito.anyInt())).thenReturn(new TimeTaken("Now", 1) {
+
+ @Override
+ public void output(StringBuilder sb) {
+
+ }
+ });
+ when(fImpl.check(Mockito.any(AuthzTrans.class), Mockito.any(HttpServletResponse.class), Mockito.anyString())).thenReturn(rvd);
+ when(resp.getOutputStream()).thenReturn(new ServletOutputStream() {
+
+ @Override
+ public void write(int b) throws IOException {
+
+
+ }
+ });
+
+ }
+
+ @Test
+ public void check() throws IOException {
+ AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
+ String perms = ap.getInstance();
+ assertNotNull(hImpl.check(trans, resp, perms));
+ }
+
+ @Test
+ public void checkNull() throws IOException {
+ AAFPermission ap = new AAFPermission(null,null,"Str3","str2");
+ String perms = ap.getInstance();
+ assertNotNull(hImpl.check(trans, resp, perms));
+ }
+
+ @Test
+ public void checkTwoNull() throws IOException {
+ AAFPermission ap = new AAFPermission(null,null,null,"str2");
+ String perms = ap.getInstance();
+ assertNotNull(fImpl.check(trans, resp, perms));
+ }
+
+ @Test
+ public void checkAllNull() throws IOException {
+ AAFPermission ap = new AAFPermission(null,null,null,null);
+ String perms = ap.getInstance();
+ assertNotNull(fImpl.check(trans, resp, perms));
+ }
+
+ @Test
+ public void checkTrans_null() throws IOException {
+ AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
+ String perms = ap.getInstance();
+ assertNotNull(hImpl.check(null, resp, perms));
+ }
+
+ @Test
+ public void checkRespNull() throws IOException {
+ AAFPermission ap = new AAFPermission("str0","str1","str3","str2");
+ String perms = ap.getInstance();
+ assertNotNull(hImpl.check(trans, null, perms));
+ }
+
+ @Test
+ public void requestCert() {
+ assertNotNull(hImpl.requestCert(trans, req, resp, null));
+ }
+
+ @Test
+ public void renewCert() {
+ assertNotNull(hImpl.renewCert(trans, req, resp, true));
+ }
+
+ @Test
+ public void dropCert() {
+ assertNotNull(hImpl.renewCert(trans, req, resp, true));
+ }
+
+ @Test
+ public void createArtifacts() {
+ assertNotNull(hImpl.createArtifacts(trans, req, resp));
+ }
+
+ @Test
+ public void readArtifacts() {
+ assertNotNull(hImpl.readArtifacts(trans, req, resp));
+ }
}
diff --git a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
index a8f9934a..90875dab 100644
--- a/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
+++ b/auth/auth-certman/src/test/java/org/onap/aaf/auth/cm/test/CertmanTest.java
@@ -58,109 +58,109 @@ import junit.framework.Assert;
public class CertmanTest {
- private static HMangr hman;
- private static AuthzEnv env;
- private static HBasicAuthSS ss;
- private static RosettaDF<CertificateRequest> reqDF;
- private static RosettaDF<CertInfo> certDF;
+ private static HMangr hman;
+ private static AuthzEnv env;
+ private static HBasicAuthSS ss;
+ private static RosettaDF<CertificateRequest> reqDF;
+ private static RosettaDF<CertInfo> certDF;
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- env = new AuthzEnv();
-// InputStream ris = env.classLoader().getResource("certman.props").openStream();
-// try {
-// env.load(ris);
-// } finally {
-// ris.close();
-// }
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ env = new AuthzEnv();
+// InputStream ris = env.classLoader().getResource("certman.props").openStream();
+// try {
+// env.load(ris);
+// } finally {
+// ris.close();
+// }
//
-// Locator<URI> loc = new DNSLocator(env, "https", "aaf.it.att.com", "8150");
-// for(Item item = loc.first(); item!=null; item=loc.next(item)) {
-// System.out.println(loc.get(item));
-// }
-//
-//
-// SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(env, HttpURLConnection.class);
-// ss = new HBasicAuthSS(si,"m12345@aaf.att.com",
-// env.decrypt("enc:gvptdJyo0iKdVZw2rzMb0woxa7YKMdqLuhfQ4OQfZ8k",false));
-// env.decrypt("enc:jFfAnO3mOKb9Gzm2OFysslmXpbnyuAxuoNJK",false), si);
-// SecuritySetter<HttpURLConnection> ss = new X509SS(si, "aaf");
-
-// hman = new HMangr(env,loc);
+// Locator<URI> loc = new DNSLocator(env, "https", "aaf.it.att.com", "8150");
+// for(Item item = loc.first(); item!=null; item=loc.next(item)) {
+// System.out.println(loc.get(item));
+// }
+//
+//
+// SecurityInfoC<HttpURLConnection> si = SecurityInfoC.instance(env, HttpURLConnection.class);
+// ss = new HBasicAuthSS(si,"m12345@aaf.att.com",
+// env.decrypt("enc:gvptdJyo0iKdVZw2rzMb0woxa7YKMdqLuhfQ4OQfZ8k",false));
+// env.decrypt("enc:jFfAnO3mOKb9Gzm2OFysslmXpbnyuAxuoNJK",false), si);
+// SecuritySetter<HttpURLConnection> ss = new X509SS(si, "aaf");
+
+// hman = new HMangr(env,loc);
//
-// reqDF = env.newDataFactory(CertificateRequest.class);
-// reqDF.out(TYPE.JSON);
-// certDF = env.newDataFactory(CertInfo.class);
- }
+// reqDF = env.newDataFactory(CertificateRequest.class);
+// reqDF.out(TYPE.JSON);
+// certDF = env.newDataFactory(CertInfo.class);
+ }
-// @AfterClass
-// public static void tearDownAfterClass() throws Exception {
-// hman.close();
-// }
+// @AfterClass
+// public static void tearDownAfterClass() throws Exception {
+// hman.close();
+// }
- @Before
- public void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
- }
+ }
- @After
- public void tearDown() throws Exception {
- }
+ @After
+ public void tearDown() throws Exception {
+ }
-// @Test
-// public void testX500Name() throws Exception {
-//
-// for( InetAddress ia : InetAddress.getAllByName("aaf.dev.att.com")) {
-// System.out.printf("%s - %s\n", ia.getHostName(), ia.getHostAddress());
-// InetAddress ia1 = InetAddress.getByName(ia.getHostAddress());
-// System.out.printf("%s - %s\n", ia1.getHostName(), ia1.getHostAddress());
-// }
-//
-// hman.best(ss, new Retryable<Void>() {
-// @Override
-// public Void code(Rcli<?> client) throws APIException, CadiException {
-// CertificateRequest cr = new CertificateRequest();
-// cr.setMechid("a12345@org.osaaf.org");
-// cr.setSponsor("something");
-// cr.getFqdns().add("mithrilcsp.sbc.com");
-// cr.getFqdns().add("zld01907.vci.att.com");
-// cr.getFqdns().add("aaftest.test.att.com");
-//
-// String path = "/cert/local"; // Local Test
-//// String path = "/cert/aaf"; // Official CA
-// long end=0,start = System.nanoTime();
-// try {
-// System.out.println(reqDF.newData().option(Data.PRETTY).load(cr).asString());
-// Future<String> f = client.updateRespondString(path, reqDF, cr);
-// if(f.get(10000)) {
-// end = System.nanoTime();
-// System.out.println(f.body());
-// CertInfo capi = certDF.newData().in(Data.TYPE.JSON).load(f.body()).asObject();
-// for(String c :capi.getCerts()) {
-// for( java.security.cert.Certificate x509 : Factory.toX509Certificate(c)) {
-// System.out.println(x509.toString());
-// }
-// }
-// } else {
-// end = System.nanoTime();
-// String msg = "Client returned " + f.code() + ": " + f.body();
-// System.out.println(msg);
-// Assert.fail(msg);
-// }
-// } catch (CertificateException e) {
-// throw new CadiException(e);
-// } finally {
-// System.out.println(Chrono.millisFromNanos(start,end) + " ms");
-// }
-// return null;
-// }
-// });
-//
-//
-// }
+// @Test
+// public void testX500Name() throws Exception {
+//
+// for( InetAddress ia : InetAddress.getAllByName("aaf.dev.att.com")) {
+// System.out.printf("%s - %s\n", ia.getHostName(), ia.getHostAddress());
+// InetAddress ia1 = InetAddress.getByName(ia.getHostAddress());
+// System.out.printf("%s - %s\n", ia1.getHostName(), ia1.getHostAddress());
+// }
+//
+// hman.best(ss, new Retryable<Void>() {
+// @Override
+// public Void code(Rcli<?> client) throws APIException, CadiException {
+// CertificateRequest cr = new CertificateRequest();
+// cr.setMechid("a12345@org.osaaf.org");
+// cr.setSponsor("something");
+// cr.getFqdns().add("mithrilcsp.sbc.com");
+// cr.getFqdns().add("zld01907.vci.att.com");
+// cr.getFqdns().add("aaftest.test.att.com");
+//
+// String path = "/cert/local"; // Local Test
+//// String path = "/cert/aaf"; // Official CA
+// long end=0,start = System.nanoTime();
+// try {
+// System.out.println(reqDF.newData().option(Data.PRETTY).load(cr).asString());
+// Future<String> f = client.updateRespondString(path, reqDF, cr);
+// if(f.get(10000)) {
+// end = System.nanoTime();
+// System.out.println(f.body());
+// CertInfo capi = certDF.newData().in(Data.TYPE.JSON).load(f.body()).asObject();
+// for(String c :capi.getCerts()) {
+// for( java.security.cert.Certificate x509 : Factory.toX509Certificate(c)) {
+// System.out.println(x509.toString());
+// }
+// }
+// } else {
+// end = System.nanoTime();
+// String msg = "Client returned " + f.code() + ": " + f.body();
+// System.out.println(msg);
+// Assert.fail(msg);
+// }
+// } catch (CertificateException e) {
+// throw new CadiException(e);
+// } finally {
+// System.out.println(Chrono.millisFromNanos(start,end) + " ms");
+// }
+// return null;
+// }
+// });
+//
+//
+// }
//
-// public X500Principal ephemeral() {
-// return null;
-// }
-
+// public X500Principal ephemeral() {
+// return null;
+// }
+
}