aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--certService/README.md10
-rw-r--r--certService/docker-compose.yml31
-rw-r--r--certService/pom.xml59
-rwxr-xr-xcertService/src/main/resources/scripts/ejbca-configuration.sh22
-rw-r--r--certServiceClient/pom.xml21
-rw-r--r--certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java1
-rw-r--r--certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java1
-rw-r--r--pom.xml80
8 files changed, 152 insertions, 73 deletions
diff --git a/certService/README.md b/certService/README.md
index d133e9a3..5a650f1c 100644
--- a/certService/README.md
+++ b/certService/README.md
@@ -60,7 +60,15 @@ Go to the certService subfolder and execute following statement (1.0.0-SNAPSHOT
docker run -p 8080:8080 --name aaf-certservice-api nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-api:1.0.0
```
-
+
+### Running Docker container from docker-compose with EJBCA
+ Docker-compose uses nexus image of certservice.
+
+ ```
+ docker-compose up
+
+ ```
+
### Health Check
Browser:
diff --git a/certService/docker-compose.yml b/certService/docker-compose.yml
new file mode 100644
index 00000000..04d4867f
--- /dev/null
+++ b/certService/docker-compose.yml
@@ -0,0 +1,31 @@
+version: "2.1"
+
+services:
+ ejbca:
+ image: primekey/ejbca-ce
+ hostname: cahostname
+ container_name: mycontainer
+ ports:
+ - "80:8080"
+ - "443:8443"
+ volumes:
+ - ./src/main/resources/scripts/:/opt/primekey/scripts
+ command: bash -c "
+ ./scripts/ejbca-configuration.sh &
+ /opt/primekey/bin/start.sh
+ "
+ healthcheck:
+ test: ["CMD-SHELL", "curl -kI https://localhost:8443/ejbca/publicweb/healthcheck/ejbcahealth"]
+ interval: 10s
+ timeout: 3s
+ retries: 9
+
+ certservice:
+ image: nexus3.onap.org:10001/onap/org.onap.aaf.certservice.aaf-certservice-api:1.0.0
+ container_name: certservice
+ ports:
+ - "8080:8080"
+ depends_on:
+ ejbca:
+ condition: service_healthy
+
diff --git a/certService/pom.xml b/certService/pom.xml
index 2064d58e..20988436 100644
--- a/certService/pom.xml
+++ b/certService/pom.xml
@@ -74,67 +74,18 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- <execution>
- <id>pre-integration-test</id>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>post-integration-test</id>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <quiet>true</quiet>
- <verbose>false</verbose>
- <useStandardDocletOptions>false</useStandardDocletOptions>
- <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
- </configuration>
- <executions>
- <execution>
- <id>aggregate</id>
- <phase>site</phase>
- <goals>
- <goal>aggregate</goal>
- </goals>
- </execution>
- <execution>
- <id>attach-javadoc</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
- <version>${springdoc-openapi-maven-plugin.version}</version>
- <executions>
- <execution>
- <phase>integration-test</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <apiDocsUrl>${springdoc-openapi-maven-plugin.apiDocsUrl}</apiDocsUrl>
- <outputFileName>api-docs.json</outputFileName>
- <outputDir>${project.build.directory}</outputDir>
- </configuration>
</plugin>
</plugins>
</build>
diff --git a/certService/src/main/resources/scripts/ejbca-configuration.sh b/certService/src/main/resources/scripts/ejbca-configuration.sh
new file mode 100755
index 00000000..cdff77de
--- /dev/null
+++ b/certService/src/main/resources/scripts/ejbca-configuration.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+waitForEjbcaStartUp() {
+ sleep $1
+}
+
+configureEjbca() {
+ ejbca.sh config cmp addalias --alias cmpRA
+ ejbca.sh config cmp updatealias --alias cmpRA --key operationmode --value ra
+ ejbca.sh ca editca --caname ManagementCA --field cmpRaAuthSecret --value mypassword
+ ejbca.sh config cmp dumpalias --alias cmpRA
+ ejbca.sh config cmp addalias --alias cmp
+ ejbca.sh config cmp updatealias --alias cmp --key allowautomatickeyupdate --value true
+ ejbca.sh ra addendentity --username Node123 --dn "CN=Node123" --caname ManagementCA --password mypassword --type 1 --token USERGENERATED
+ ejbca.sh ra setclearpwd --username Node123 --password mypassword
+ ejbca.sh config cmp updatealias --alias cmp --key extractusernamecomponent --value CN
+ ejbca.sh config cmp dumpalias --alias cmp
+ ejbca.sh ca getcacert --caname ManagementCA -f /dev/stdout > cacert.pem
+}
+
+waitForEjbcaStartUp 30
+configureEjbca
diff --git a/certServiceClient/pom.xml b/certServiceClient/pom.xml
index 2b4f2d02..2f3aa62e 100644
--- a/certServiceClient/pom.xml
+++ b/certServiceClient/pom.xml
@@ -16,26 +16,29 @@
<packaging>jar</packaging>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>${maven-surefire-plugin.version}</version>
- </plugin>
- </plugins>
- </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ </plugin>
+ </plugins>
</build>
<dependencies>
+
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
+
</dependencies>
diff --git a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java
index f3b1c0f3..8b200be3 100644
--- a/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java
+++ b/certServiceClient/src/main/java/org/onap/aaf/certservice/client/CertServiceClientApp.java
@@ -23,6 +23,5 @@ package org.onap.aaf.certservice.client;
public class CertServiceClientApp {
public static void main(String[] args) {
- System.exit(0);
}
} \ No newline at end of file
diff --git a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java
index a79095c4..e9d169a0 100644
--- a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java
+++ b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/CertServiceClientAppTest.java
@@ -22,6 +22,7 @@ package org.onap.aaf.certservice.client;
import org.junit.jupiter.api.Test;
class CertServiceClientAppTest {
+
// Sonar check for this test disabled due to lack of assertion in test.
// Intention of this test is to check if app runs without exiting Java.
@Test
diff --git a/pom.xml b/pom.xml
index 6c20bb45..38dfc9f3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,7 +52,7 @@
<springdoc-openapi-maven-plugin.version>0.2</springdoc-openapi-maven-plugin.version>
<gson.version>2.8.6</gson.version>
<docker-maven-plugin.version>0.33.0</docker-maven-plugin.version>
- <junit.version>5.6.0</junit.version>
+ <junit.version>5.5.2</junit.version>
<!-- Docker -->
<skipDockerPush>true</skipDockerPush>
@@ -75,13 +75,72 @@
<pluginManagement>
<plugins>
<plugin>
+ <groupId>org.springdoc</groupId>
+ <artifactId>springdoc-openapi-maven-plugin</artifactId>
+ <version>${springdoc-openapi-maven-plugin.version}</version>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <apiDocsUrl>${springdoc-openapi-maven-plugin.apiDocsUrl}</apiDocsUrl>
+ <outputFileName>api-docs.json</outputFileName>
+ <outputDir>${project.build.directory}</outputDir>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot-starter.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>pre-integration-test</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>post-integration-test</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
+ <configuration>
+ <quiet>true</quiet>
+ <verbose>false</verbose>
+ <useStandardDocletOptions>false</useStandardDocletOptions>
+ <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
+ </configuration>
+ <executions>
+ <execution>
+ <id>aggregate</id>
+ <phase>site</phase>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>attach-javadoc</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -175,7 +234,12 @@
</dependency>
<!-- Test dependecies -->
-
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>${assertj-core.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -183,15 +247,15 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>${mockito-core.version}</version>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.assertj</groupId>
- <artifactId>assertj-core</artifactId>
- <version>${assertj-core.version}</version>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
</dependencies>