...
Code Block |
---|
@Test public void testServerWithRealUrl() throws CmpClientException { setValidCsrMetaValuesAndDateValues(); csrMeta.externalCaUrl("http://127.0.0.1/ejbca/publicweb/cmp/cmpRAcmp"); csrMeta.password("mypassword"); CmpClientImpl cmpClient = new CmpClientImpl(); try { cmpClient.createCertRequest("data", "RA", csrMeta, cert, notBefore, notAfter); } catch (CAOfflineException e) { e.printStackTrace(); } } private void setValidCsrMetaValuesAndDateValues() { ArrayList<RDN> rdns = new ArrayList<>(); try { rdns.add(new RDN("O=CommonCompany")); } catch (CertException e) { e.printStackTrace(); } csrMeta = new CSRMeta(rdns); csrMeta.cn("Node123"); csrMeta.san("CommonName.com"); csrMeta.password("password"); csrMeta.email("CommonName@cn.com"); csrMeta.issuerCn("ManagementCA"); when(kpg.generateKeyPair()).thenReturn(keyPair); csrMeta.keypair(trans); csrMeta.externalCaUrl("http://127.0.0.1/ejbca/publicweb/cmp/cmp"); try { notBefore = Optional.ofNullable(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2019/11/11 12:00:00")); notAfter = Optional.ofNullable(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse("2020/11/11 12:00:00")); } catch (ParseException e) { e.printStackTrace(); } } |
...