Merge "Fixed sonar issues in RDN class"
diff --git a/certService/helm/aaf-cert-service/resources/cmpServers.json b/certService/helm/aaf-cert-service/resources/cmpServers.json
index 921a51e..d6557c5 100644
--- a/certService/helm/aaf-cert-service/resources/cmpServers.json
+++ b/certService/helm/aaf-cert-service/resources/cmpServers.json
@@ -2,7 +2,7 @@
"cmpv2Servers": [
{
"caName": "Client",
- "url": "http://mycontainer:8080/ejbca/publicweb/cmp/cmp",
+ "url": "http://aafcert-ejbca:8080/ejbca/publicweb/cmp/cmp",
"issuerDN": "CN=ManagementCA",
"caMode": "CLIENT",
"authentication": {
@@ -12,7 +12,7 @@
},
{
"caName": "RA",
- "url": "http://mycontainer:8080/ejbca/publicweb/cmp/cmpRA",
+ "url": "http://aafcert-ejbca:8080/ejbca/publicweb/cmp/cmpRA",
"issuerDN": "CN=ManagementCA",
"caMode": "RA",
"authentication": {
@@ -21,4 +21,4 @@
}
}
]
-}
\ No newline at end of file
+}
diff --git a/certServiceClient/README.md b/certServiceClient/README.md
index c1d56ad..092eb32 100644
--- a/certServiceClient/README.md
+++ b/certServiceClient/README.md
@@ -31,6 +31,30 @@
docker run --name aaf-certservice-client nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-client:1.0.0
```
+### Running client as standalone docker container
+```
+AAFCERT_CLIENT_IMAGE=nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-client:latest
+DOCKER_ENV_FILE= <path to envfile>
+NETWORK_CERT_SERVICE= <docker network of cert service>
+
+docker run --env-file $DOCKER_ENV_FILE --network $NETWORK_CERT_SERVICE $AAFCERT_CLIENT_IMAGE
+```
+Sample Environment file:
+```aidl
+#Client envs
+REQUEST_TIMEOUT=1000
+OUTPUT_PATH=/var/log
+CA_NAME=RA
+#Csr config envs
+COMMON_NAME=onap.org
+ORGANIZATION=Linux-Foundation
+ORGANIZATION_UNIT=ONAP
+LOCATION=San-Francisco
+STATE=California
+COUNTRY=US
+SANS=example.com:example2.com
+```
+
### Logs locally
path:
@@ -40,4 +64,16 @@
### Logs in Docker container
```
docker logs aaf-certservice-client
+```
+###Exit codes
+```
+0 Success
+1 Invalid client configuration
+2 Invalid CSR data
+3 Failed key pair generation
+4 Failed CSR generation
+5 API return unsuccessful response
+6 Problem with Http Client connection
+7 Failed PKCS12 conversion
+8 Failed Private Key to PEM Encoding
```
\ No newline at end of file
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/AppExitHandler.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/AppExitHandler.java
index 3e33a48..e29142e 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/AppExitHandler.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/AppExitHandler.java
@@ -25,7 +25,7 @@
public static final Logger LOGGER = LoggerFactory.getLogger(AppExitHandler.class);
public void exit(int exitCode) {
- LOGGER.debug("Application exits with following exit code: " + exitCode);
+ LOGGER.debug("Application exits with following exit code: {}", exitCode);
System.exit(exitCode);
}
}
\ No newline at end of file
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
index 1ce7637..59fd5ef 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForClient.java
@@ -24,9 +24,6 @@
public class EnvsForClient {
private final EnvProvider envProvider = new EnvProvider();
- public EnvsForClient() {
- }
-
public Optional<String> getUrlToCertService() {
return readEnv(ClientConfigurationEnvs.REQUEST_URL);
}
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForCsr.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForCsr.java
index 77efc19..5a1d33b 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForCsr.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/EnvsForCsr.java
@@ -24,8 +24,6 @@
public class EnvsForCsr {
private final EnvProvider envProvider = new EnvProvider();
- public EnvsForCsr() {}
-
public Optional<String> getCommonName() {
return readEnv(CsrConfigurationEnvs.COMMON_NAME);
}
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
index d6496b7..58d3f6b 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/configuration/model/ClientConfiguration.java
@@ -22,8 +22,8 @@
public class ClientConfiguration implements ConfigurationModel {
- Integer DEFAULT_TIMEOUT_MS = 30000;
- String DEFAULT_REQUEST_URL = "http://cert-service:8080/v1/certificate/";
+ private static final Integer DEFAULT_TIMEOUT_MS = 30000;
+ private static final String DEFAULT_REQUEST_URL = "http://cert-service:8080/v1/certificate/";
private String urlToCertService;
private Integer requestTimeout;
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/CertServiceApiResponseException.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/CertServiceApiResponseException.java
index 40470af..7286318 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/CertServiceApiResponseException.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/CertServiceApiResponseException.java
@@ -24,7 +24,7 @@
import org.onap.aaf.certservice.client.api.ExitableException;
public class CertServiceApiResponseException extends ExitableException {
- private final ExitCode EXIT_CODE = ExitCode.CERT_SERVICE_API_CONNECTION_EXCEPTION;
+ private static final ExitCode EXIT_CODE = ExitCode.CERT_SERVICE_API_CONNECTION_EXCEPTION;
public CertServiceApiResponseException(String url, int responseCode, String messageFromAPI) {
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/HttpClientException.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/HttpClientException.java
index d6fb146..28f8307 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/HttpClientException.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/httpclient/exception/HttpClientException.java
@@ -24,7 +24,7 @@
import org.onap.aaf.certservice.client.api.ExitableException;
public class HttpClientException extends ExitableException {
- private final ExitCode EXIT_CODE = ExitCode.HTTP_CLIENT_EXCEPTION;
+ private static final ExitCode EXIT_CODE = ExitCode.HTTP_CLIENT_EXCEPTION;
public HttpClientException(Throwable e) {
super(e);