diff options
Diffstat (limited to 'ms')
-rw-r--r-- | ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt | 128 | ||||
-rw-r--r-- | ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt | 50 | ||||
-rw-r--r-- | ms/cds-sdc-listener/application/pom.xml | 215 | ||||
-rw-r--r-- | ms/cds-sdc-listener/application/src/main/docker/Dockerfile | 13 | ||||
-rwxr-xr-x | ms/cds-sdc-listener/application/src/main/docker/start.sh | 6 | ||||
-rw-r--r-- | ms/pom.xml | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/pom.xml | 89 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java) | 8 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java) | 4 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java) | 28 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java) | 4 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java) | 34 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java) | 10 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java) | 8 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java) | 22 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java) | 15 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java (renamed from ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java) | 2 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/resources/application.yml (renamed from ms/cds-sdc-listener/application/src/main/resources/application.yml) | 0 | ||||
-rw-r--r-- | ms/sdclistener/application/src/main/resources/logback.xml (renamed from ms/cds-sdc-listener/application/src/main/resources/logback.xml) | 0 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java (renamed from ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java) | 20 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java (renamed from ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java) | 10 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java (renamed from ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java) | 8 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java (renamed from ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java) | 18 | ||||
-rw-r--r-- | ms/sdclistener/application/src/test/resources/service-Testsvc140.csar (renamed from ms/cds-sdc-listener/application/src/test/resources/service-Testsvc140.csar) | bin | 116298 -> 116298 bytes | |||
-rw-r--r-- | ms/sdclistener/application/src/test/resources/testcba.zip (renamed from ms/cds-sdc-listener/application/src/test/resources/testcba.zip) | bin | 15123 -> 15123 bytes | |||
-rwxr-xr-x | ms/sdclistener/distribution/pom.xml | 183 | ||||
-rwxr-xr-x[-rw-r--r--] | ms/sdclistener/distribution/src/main/dc/docker-compose.yaml (renamed from ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml) | 2 | ||||
-rwxr-xr-x | ms/sdclistener/distribution/src/main/docker/Dockerfile | 16 | ||||
-rwxr-xr-x | ms/sdclistener/distribution/src/main/docker/distribution.xml | 47 | ||||
-rw-r--r-- | ms/sdclistener/distribution/src/main/docker/startService.sh | 12 | ||||
-rwxr-xr-x | ms/sdclistener/parent/pom.xml | 246 | ||||
-rw-r--r-- | ms/sdclistener/pom.xml (renamed from ms/cds-sdc-listener/pom.xml) | 26 |
37 files changed, 890 insertions, 346 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt new file mode 100644 index 000000000..c5fbea80f --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CDS + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts; + +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.node.ObjectNode +import io.mockk.every +import io.mockk.mockk +import kotlinx.coroutines.runBlocking +import org.junit.Test +import org.junit.runner.RunWith +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ActionIdentifiers +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.CommonHeader +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive +import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName +import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext +import org.onap.ccsdk.cds.controllerblueprints.core.service.DefaultBluePrintRuntimeService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.springframework.test.context.junit4.SpringRunner +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull + +/** + * Unit test cases for abstract component function. + */ +@RunWith(SpringRunner::class) +class AbstractComponentFunctionTest { + + lateinit var blueprintContext: BluePrintContext + + @BeforeTest + fun init() { + blueprintContext = mockk<BluePrintContext>() + every { blueprintContext.rootPath } returns normalizedPathName("target") + } + + /** + * Tests the abstract component functionality. + */ + @Test + fun testAbstractComponent() { + runBlocking { + val bluePrintRuntime = mockk<DefaultBluePrintRuntimeService>("1234") + val samp = SampleComponent() + val comp = samp as AbstractComponentFunction + + comp.bluePrintRuntimeService = bluePrintRuntime + comp.stepName = "sample-step" + assertNotNull(comp, "failed to get kotlin instance") + + val input = getMockedInput(bluePrintRuntime) + + val output = comp.applyNB(input) + + assertEquals(output.actionIdentifiers.actionName, "activate") + assertEquals(output.commonHeader.requestId, "1234") + assertEquals(output.stepData!!.name, "activate-restconf") + assertEquals(output.status.message, "success") + } + } + + + /** + * Mocked input for abstract function test. + */ + private fun getMockedInput(bluePrintRuntime: DefaultBluePrintRuntimeService): + ExecutionServiceInput { + val operationInputs = hashMapOf<String, JsonNode>() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE] = + "activate-restconf".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_INTERFACE] = + "interfaceName".asJsonPrimitive() + operationInputs[BluePrintConstants.PROPERTY_CURRENT_OPERATION] = + "operationName".asJsonPrimitive() + + val stepInputData = StepData().apply { + name = "activate-restconf" + properties = operationInputs + } + val executionServiceInput = ExecutionServiceInput().apply { + commonHeader = CommonHeader().apply { + requestId = "1234" + } + actionIdentifiers = ActionIdentifiers().apply { + actionName = "activate" + } + payload = JacksonUtils.jsonNode("{}") as ObjectNode + } + executionServiceInput.stepData = stepInputData + + every { + bluePrintRuntime.resolveNodeTemplateInterfaceOperationInputs( + "activate-restconf", "interfaceName", "operationName") + } returns operationInputs + + val operationOutputs = hashMapOf<String, JsonNode>() + every { + bluePrintRuntime.resolveNodeTemplateInterfaceOperationOutputs( + "activate-restconf", "interfaceName", "operationName") + } returns operationOutputs + every { bluePrintRuntime.bluePrintContext() } returns blueprintContext + + return executionServiceInput + } +} diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt new file mode 100644 index 000000000..e09cbfb66 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/SampleComponent.kt @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CDS + * ================================================================================ + * Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts + +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction +import org.slf4j.LoggerFactory + +open class SampleComponent : AbstractComponentFunction() { + + val log = LoggerFactory.getLogger(SampleComponent::class.java)!! + + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + } +} + +open class SampleScriptComponent : AbstractComponentFunction() { + + val log = LoggerFactory.getLogger(SampleScriptComponent::class.java)!! + + + override suspend fun processNB(executionRequest: ExecutionServiceInput) { + } + + override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { + } +}
\ No newline at end of file diff --git a/ms/cds-sdc-listener/application/pom.xml b/ms/cds-sdc-listener/application/pom.xml deleted file mode 100644 index 3f8e1a319..000000000 --- a/ms/cds-sdc-listener/application/pom.xml +++ /dev/null @@ -1,215 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Copyright (C) 2019 Bell Canada. All rights reserved. - ~ - ~ NOTICE: All the intellectual and technical concepts contained herein are - ~ proprietary to Bell Canada and are protected by trade secret or copyright law. - ~ Unauthorized copying of this file, via any medium is strictly prohibited. - --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>1.2.2-SNAPSHOT</version> - </parent> - - <groupId>org.onap.ccsdk.cds</groupId> - <modelVersion>4.0.0</modelVersion> - <artifactId>cds-sdc-listener-application</artifactId> - <version>0.4.2-SNAPSHOT</version> - <name>CDS-SDC Listener Application</name> - - <properties> - <grpc.version>1.17.1</grpc.version> - <protobuf.version>3.6.1</protobuf.version> - <image.name>onap/ccsdk-cds-sdc-listener</image.name> - <docker.push.phase>deploy</docker.push.phase> - <project.version>${parent.version}</project.version> - <!-- Start of Docker Related Properties --> - <docker.fabric.version>0.26.1</docker.fabric.version> - <ccsdk.project.version>${project.version}</ccsdk.project.version> - </properties> - - <dependencies> - <!-- Spring boot --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - - <!-- SDC Distribution client dependency --> - <dependency> - <groupId>org.onap.sdc.sdc-distribution-client</groupId> - <artifactId>sdc-distribution-client</artifactId> - <version>1.3.0</version> - </dependency> - - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <version>1.19</version> - <scope>test</scope> - </dependency> - - <!-- GRPC Dependencies --> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-netty</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-protobuf</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-stub</artifactId> - <version>${grpc.version}</version> - </dependency> - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>${protobuf.version}</version> - </dependency> - <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-testing</artifactId> - <version>${grpc.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.cds.components</groupId> - <artifactId>proto-definition</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>io.projectreactor</groupId> - <artifactId>reactor-core</artifactId> - <version>3.2.6.RELEASE</version> - <scope>compile</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <id>repackage</id> - <goals> - <goal>repackage</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <version>1.8</version> - <executions> - <execution> - <id>copy</id> - <phase>package</phase> - <configuration> - <target> - <echo>ANT TASK - copying Docker files</echo> - <copy todir="${basedir}/target/docker-stage" overwrite="true" flatten="true"> - <fileset dir="${basedir}/src/main/docker"> - <include name="Dockerfile"/> - <include name="start.sh"/> - </fileset> - <fileset dir="${basedir}/target"> - <include name="*.jar"/> - </fileset> - <fileset dir="${basedir}/src/main/resources/"> - <include name="application.yml"/> - </fileset> - </copy> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.groovy.maven</groupId> - <artifactId>gmaven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <phase>validate</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <source>${basedir}/../../../TagVersion.groovy</source> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>docker</id> - <build> - <plugins> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>${docker.fabric.version}</version> - <inherited>false</inherited> - <configuration> - <images> - <image> - <name>${image.name}</name> - <build> - <cleanup>try</cleanup> - <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> - <tags> - <tag>${project.docker.latestminortag.version}</tag> - <tag>${project.docker.latestfulltag.version}</tag> - <tag>${project.docker.latesttagtimestamp.version}</tag> - </tags> - </build> - </image> - </images> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <id>generate-images</id> - <phase>package</phase> - <goals> - <goal>build</goal> - </goals> - </execution> - <execution> - <id>push-images</id> - <phase>${docker.push.phase}</phase> - <goals> - <goal>build</goal> - <goal>push</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> - -</project> diff --git a/ms/cds-sdc-listener/application/src/main/docker/Dockerfile b/ms/cds-sdc-listener/application/src/main/docker/Dockerfile deleted file mode 100644 index 062f65767..000000000 --- a/ms/cds-sdc-listener/application/src/main/docker/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM openjdk:8-jdk-alpine - -ENV HTTP_PROXY ${HTTP_PROXY} -ENV HTTPS_PROXY ${HTTPS_PROXY} - -RUN mkdir -p /opt/app/onap/ /opt/app/onap/config -WORKDIR /opt/app/onap/ -COPY start.sh /opt/app/onap/ -COPY application.yml /opt/app/onap/config -RUN chmod 751 /opt/app/onap/start.sh -COPY cds-sdc-listener-application-0.4.2-SNAPSHOT.jar /opt/app/onap/cds-sdc-listener-distribution.jar -EXPOSE 9000 -ENTRYPOINT /opt/app/onap/start.sh diff --git a/ms/cds-sdc-listener/application/src/main/docker/start.sh b/ms/cds-sdc-listener/application/src/main/docker/start.sh deleted file mode 100755 index f24d15618..000000000 --- a/ms/cds-sdc-listener/application/src/main/docker/start.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -extraArgs=$@ -java -jar /opt/app/onap/cds-sdc-listener-distribution.jar \ --Dspring.config=/opt/app/onap/config/application.yml \ --Djava.security.egd=file:/dev/./urandom \ -${extraArgs} diff --git a/ms/pom.xml b/ms/pom.xml index d1c87c995..b97ebc03f 100644 --- a/ms/pom.xml +++ b/ms/pom.xml @@ -36,6 +36,6 @@ <module>controllerblueprints</module> <module>blueprintsprocessor</module> <module>command-executor</module> - <module>cds-sdc-listener</module> + <module>sdclistener</module> </modules> </project> diff --git a/ms/sdclistener/application/pom.xml b/ms/sdclistener/application/pom.xml new file mode 100644 index 000000000..5513279cc --- /dev/null +++ b/ms/sdclistener/application/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2019 Bell Canada. All rights reserved. + ~ + ~ NOTICE: All the intellectual and technical concepts contained herein are + ~ proprietary to Bell Canada and are protected by trade secret or copyright law. + ~ Unauthorized copying of this file, via any medium is strictly prohibited. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <version>0.4.2-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + + <artifactId>application</artifactId> + <packaging>jar</packaging> + <version>0.4.2-SNAPSHOT</version> + <name>SDC Listener Application</name> + + <properties> + <protobuf.version>3.6.1</protobuf.version> + <project.version>${parent.version}</project.version> + </properties> + + <dependencies> + <!-- Spring boot --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + + <!-- SDC Distribution client dependency --> + <dependency> + <groupId>org.onap.sdc.sdc-distribution-client</groupId> + <artifactId>sdc-distribution-client</artifactId> + <version>1.3.0</version> + </dependency> + + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <scope>test</scope> + </dependency> + + <!-- GRPC Dependencies --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-netty</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-protobuf</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-stub</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.components</groupId> + <artifactId>proto-definition</artifactId> + </dependency> + + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <scope>compile</scope> + </dependency> + </dependencies> +</project> diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java index 6f0f65323..253b576d2 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerApplication.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerApplication.java @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; @SpringBootApplication -@EnableConfigurationProperties(CdsSdcListenerConfiguration.class) -public class CdsSdcListenerApplication { +@EnableConfigurationProperties(SdcListenerConfiguration.class) +public class SdcListenerApplication { public static void main(String[] args) { - SpringApplication.run(CdsSdcListenerApplication.class, args); + SpringApplication.run(SdcListenerApplication.class, args); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java index 3dfb07eb8..06e2a0342 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfiguration.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfiguration.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import java.util.List; import org.onap.sdc.api.consumer.IConfiguration; @@ -25,7 +25,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * distribution client needs. */ @ConfigurationProperties("listenerservice") -public class CdsSdcListenerConfiguration implements IConfiguration { +public class SdcListenerConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java index 58c667c26..eb339aef7 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerNotificationCallback.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/SdcListenerNotificationCallback.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS; import java.io.File; @@ -22,10 +22,10 @@ import java.nio.file.Paths; import java.util.List; import java.util.Objects; import java.util.Optional; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.service.ListenerService; -import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus; -import org.onap.ccsdk.cds.cdssdclistener.util.FileUtil; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.service.ListenerService; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.util.FileUtil; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.INotificationCallback; import org.onap.sdc.api.notification.IArtifactInfo; @@ -43,10 +43,10 @@ import org.springframework.stereotype.Component; @ConfigurationProperties("listenerservice") @Component @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerNotificationCallback implements INotificationCallback { +public class SdcListenerNotificationCallback implements INotificationCallback { @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; @Autowired private ListenerService listenerService; @@ -55,20 +55,20 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback private String pathToStoreArchives; @Autowired - private CdsSdcListenerStatus listenerStatus; + private SdcListenerStatus listenerStatus; - private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerNotificationCallback.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SdcListenerNotificationCallback.class); @Override public void activateCallback(INotificationData notificationData) { final String distributionId = notificationData.getDistributionID(); - cdsSdcListenerDto.setDistributionId(distributionId); + sdcListenerDto.setDistributionId(distributionId); LOGGER.info("Received service distribution from SDC with the id {}", distributionId); processNotification(notificationData); } private void processNotification(INotificationData notificationData) { - final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient(); + final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient(); notificationData.getServiceArtifacts() .forEach(artifactInfo -> downloadCsarArtifacts(artifactInfo, distributionClient)); } @@ -83,7 +83,7 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback final String url = info.getArtifactURL(); final String id = info.getArtifactUUID(); - if (Objects.equals(info.getArtifactType(), CdsSdcListenerConfiguration.TOSCA_CSAR)) { + if (Objects.equals(info.getArtifactType(), SdcListenerConfiguration.TOSCA_CSAR)) { LOGGER.info("Trying to download the artifact from : {} and UUID is {} ", url, id); // Download the artifact @@ -92,7 +92,7 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback if (!Objects.equals(result.getDistributionActionResult(), SUCCESS)) { String errorMessage = String.format("Failed to download the artifact from : %s due to %s ", url, result.getDistributionActionResult()); - listenerStatus.sendResponseStatusBackToSDC(cdsSdcListenerDto.getDistributionId(), + listenerStatus.sendResponseStatusBackToSDC(sdcListenerDto.getDistributionId(), DistributionStatusEnum.COMPONENT_DONE_ERROR, errorMessage); LOGGER.error(errorMessage); } else { @@ -124,6 +124,6 @@ public class CdsSdcListenerNotificationCallback implements INotificationCallback } } - listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, cdsSdcListenerDto.getManagedChannelForGrpc()); + listenerService.saveBluePrintToCdsDatabase(cbaArchivePath, sdcListenerDto.getManagedChannelForGrpc()); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java index bae4a3754..6f782d10a 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerAuthClientInterceptor.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerAuthClientInterceptor.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.client; +package org.onap.ccsdk.cds.sdclistener.client; import io.grpc.CallOptions; import io.grpc.Channel; @@ -33,7 +33,7 @@ import org.springframework.stereotype.Component; */ @ConfigurationProperties("listenerservice") @Component -public class CdsSdcListenerAuthClientInterceptor implements ClientInterceptor { +public class SdcListenerAuthClientInterceptor implements ClientInterceptor { @Value("${listenerservice.config.authHeader}") private String basicAuth; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java index 8d6aca5cd..973f950bc 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/client/CdsSdcListenerClient.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/client/SdcListenerClient.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.client; +package org.onap.ccsdk.cds.sdclistener.client; import java.util.Optional; -import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerConfiguration; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerNotificationCallback; -import org.onap.ccsdk.cds.cdssdclistener.exceptions.CdsSdcListenerException; +import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.SdcListenerNotificationCallback; +import org.onap.ccsdk.cds.sdclistener.exceptions.SdcListenerException; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientFactory; @@ -34,18 +34,18 @@ import org.springframework.stereotype.Component; @Component @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerClient { +public class SdcListenerClient { - private static Logger LOG = LoggerFactory.getLogger(CdsSdcListenerClient.class); + private static Logger LOG = LoggerFactory.getLogger(SdcListenerClient.class); @Autowired - private CdsSdcListenerConfiguration configuration; + private SdcListenerConfiguration configuration; @Autowired - private CdsSdcListenerNotificationCallback notification; + private SdcListenerNotificationCallback notification; @Autowired - private CdsSdcListenerDto listenerDto; + private SdcListenerDto listenerDto; private IDistributionClient distributionClient; @@ -53,11 +53,11 @@ public class CdsSdcListenerClient { * This method initializes the SDC Distribution client. */ @EventListener(ApplicationReadyEvent.class) - public void initSdcClient() throws CdsSdcListenerException { + public void initSdcClient() throws SdcListenerException { LOG.info("Initialize the SDC distribution client"); distributionClient = Optional.of(DistributionClientFactory.createDistributionClient()) - .orElseThrow(() -> new CdsSdcListenerException("Could not able to create SDC Distribution client")); + .orElseThrow(() -> new SdcListenerException("Could not able to create SDC Distribution client")); listenerDto.setManagedChannelForGrpc(); @@ -67,9 +67,9 @@ public class CdsSdcListenerClient { startSdcClientBasedOnTheResult(result); } - private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws CdsSdcListenerException { + private void startSdcClientBasedOnTheResult(IDistributionClientResult result) throws SdcListenerException { if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "SDC distribution client init failed with reason:" + result.getDistributionMessageResult()); } @@ -79,16 +79,16 @@ public class CdsSdcListenerClient { result = this.distributionClient.start(); if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "Startup of the SDC distribution client failed with reason: " + result.getDistributionMessageResult()); } } - private void closeSdcDistributionclient() throws CdsSdcListenerException { + private void closeSdcDistributionclient() throws SdcListenerException { LOG.info("Closing SDC distribution client"); IDistributionClientResult status = this.distributionClient.stop(); if (status.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - throw new CdsSdcListenerException( + throw new SdcListenerException( "Failed to close the SDC distribution client due to : " + status.getDistributionMessageResult()); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java index a1bb116bf..a9e51ac12 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/controller/HealthCheck.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/controller/HealthCheck.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.controller; +package org.onap.ccsdk.cds.sdclistener.controller; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java index 68669307e..c7c3d4829 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/dto/CdsSdcListenerDto.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/dto/SdcListenerDto.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.dto; +package org.onap.ccsdk.cds.sdclistener.dto; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; import org.onap.sdc.api.IDistributionClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -26,7 +26,7 @@ import org.springframework.stereotype.Component; @Component @ConfigurationProperties("listenerservice") -public class CdsSdcListenerDto { +public class SdcListenerDto { @Value("${listenerservice.config.grpcAddress}") private String grpcAddress; @@ -35,7 +35,7 @@ public class CdsSdcListenerDto { private int grpcPort; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; private IDistributionClient distributionClient; private ManagedChannel managedChannel; @@ -60,7 +60,7 @@ public class CdsSdcListenerDto { public void setManagedChannelForGrpc() { managedChannel = ManagedChannelBuilder.forAddress(grpcAddress, grpcPort) .usePlaintext() - .intercept(cdsSdcListenerAuthClientInterceptor) + .intercept(sdcListenerAuthClientInterceptor) .build(); } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java index eff5ef050..23f669f1e 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/exceptions/CdsSdcListenerException.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/exceptions/SdcListenerException.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.exceptions; +package org.onap.ccsdk.cds.sdclistener.exceptions; -public class CdsSdcListenerException extends Exception { +public class SdcListenerException extends Exception { /** * @param message The message to dump */ - public CdsSdcListenerException(final String message) { + public SdcListenerException(final String message) { super(message); } @@ -28,7 +28,7 @@ public class CdsSdcListenerException extends Exception { * @param message The message to dump * @param cause The Throwable cause object */ - public CdsSdcListenerException(final String message, final Throwable cause) { + public SdcListenerException(final String message, final Throwable cause) { super(message, cause); } } diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java index b05245392..96b2ff081 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcesssorHandler.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcesssorHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.handler; +package org.onap.ccsdk.cds.sdclistener.handler; import io.grpc.ManagedChannel; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java index e55aeb134..446c3e621 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerService.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerService.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import io.grpc.ManagedChannel; import java.nio.file.Path; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java index 1cf1a1bae..9a6ae8779 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImpl.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImpl.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import static java.nio.file.Files.walk; import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR; @@ -33,17 +33,15 @@ import java.util.Enumeration; import java.util.List; import java.util.Optional; import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.commons.io.FileUtils; import org.apache.tomcat.util.http.fileupload.IOUtils; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.handler.BluePrintProcesssorHandler; -import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus; -import org.onap.ccsdk.cds.cdssdclistener.util.FileUtil; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.util.FileUtil; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintUploadInput; import org.onap.ccsdk.cds.controllerblueprints.management.api.FileChunk; @@ -63,13 +61,13 @@ public class ListenerServiceImpl implements ListenerService { private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @Autowired - private CdsSdcListenerStatus listenerStatus; + private SdcListenerStatus listenerStatus; @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; @Value("${listenerservice.config.grpcAddress}") private String grpcAddress; @@ -161,7 +159,7 @@ public class ListenerServiceImpl implements ListenerService { } private void prepareRequestForCdsBackend(List<File> files, ManagedChannel managedChannel, String path) { - final String distributionId = cdsSdcListenerDto.getDistributionId(); + final String distributionId = sdcListenerDto.getDistributionId(); files.forEach(zipFile -> { try { diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java index 676c85c98..60463762b 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/DistributionStatusMessage.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/DistributionStatusMessage.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.status; +package org.onap.ccsdk.cds.sdclistener.status; import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; import org.onap.sdc.utils.DistributionStatusEnum; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java index 60d3127f9..ff64c0d0c 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/status/CdsSdcListenerStatus.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/status/SdcListenerStatus.java @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.status; +package org.onap.ccsdk.cds.sdclistener.status; import static org.onap.sdc.utils.DistributionActionResultEnum.SUCCESS; import java.util.Objects; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.util.BuilderUtil; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.util.BuilderUtil; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; import org.onap.sdc.api.results.IDistributionClientResult; -import org.onap.sdc.impl.DistributionClientImpl; import org.onap.sdc.utils.DistributionStatusEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,16 +34,16 @@ import org.springframework.stereotype.Component; @Component @ConfigurationProperties("listenerservice") @ComponentScan("org.onap.ccsdk.cds.cdssdclistener.dto") -public class CdsSdcListenerStatus { +public class SdcListenerStatus { - private static final Logger LOGGER = LoggerFactory.getLogger(CdsSdcListenerStatus.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SdcListenerStatus.class); private static final String COMPONENT_NAME = "cds"; @Value("${listenerservice.config.consumerId}") private String consumerId; @Autowired - private CdsSdcListenerDto cdsSdcListenerDto; + private SdcListenerDto sdcListenerDto; /** * Send the response back to SDC. @@ -55,7 +54,7 @@ public class CdsSdcListenerStatus { */ public void sendResponseStatusBackToSDC(String distributionID, DistributionStatusEnum status, String errorReason) { - final IDistributionClient distributionClient = cdsSdcListenerDto.getDistributionClient(); + final IDistributionClient distributionClient = sdcListenerDto.getDistributionClient(); IFinalDistrStatusMessage finalDistribution = new BuilderUtil<>(new DistributionStatusMessage()) .build(builder -> { diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java index 4df545c82..1f546d107 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/BuilderUtil.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/BuilderUtil.java @@ -5,7 +5,7 @@ * proprietary to Bell Canada and are protected by trade secret or copyright law. * Unauthorized copying of this file, via any medium is strictly prohibited. */ -package org.onap.ccsdk.cds.cdssdclistener.util; +package org.onap.ccsdk.cds.sdclistener.util; import java.util.function.Consumer; diff --git a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java index 11f4eade1..967e854d7 100644 --- a/ms/cds-sdc-listener/application/src/main/java/org/onap/ccsdk/cds/cdssdclistener/util/FileUtil.java +++ b/ms/sdclistener/application/src/main/java/org/onap/ccsdk/cds/sdclistener/util/FileUtil.java @@ -6,7 +6,7 @@ * Unauthorized copying of this file, via any medium is strictly prohibited. */ -package org.onap.ccsdk.cds.cdssdclistener.util; +package org.onap.ccsdk.cds.sdclistener.util; import static java.nio.file.Files.walk; import java.io.File; diff --git a/ms/cds-sdc-listener/application/src/main/resources/application.yml b/ms/sdclistener/application/src/main/resources/application.yml index b3f8443eb..b3f8443eb 100644 --- a/ms/cds-sdc-listener/application/src/main/resources/application.yml +++ b/ms/sdclistener/application/src/main/resources/application.yml diff --git a/ms/cds-sdc-listener/application/src/main/resources/logback.xml b/ms/sdclistener/application/src/main/resources/logback.xml index b26cbcbe4..b26cbcbe4 100644 --- a/ms/cds-sdc-listener/application/src/main/resources/logback.xml +++ b/ms/sdclistener/application/src/main/resources/logback.xml diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java index e980c24c6..c9f2c5a39 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerClientTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerClientTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import mockit.Expectations; import mockit.Injectable; @@ -24,9 +24,9 @@ import mockit.VerificationsInOrder; import mockit.integration.junit4.JMockit; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerClient; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.exceptions.CdsSdcListenerException; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerClient; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.exceptions.SdcListenerException; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.results.IDistributionClientResult; import org.onap.sdc.impl.DistributionClientFactory; @@ -34,16 +34,16 @@ import org.onap.sdc.impl.DistributionClientResultImpl; import org.onap.sdc.utils.DistributionActionResultEnum; @RunWith(JMockit.class) -public class CdsSdcListenerClientTest { +public class SdcListenerClientTest { @Tested - private CdsSdcListenerClient cdsSdcListenerClient; + private SdcListenerClient sdcListenerClient; @Test public void testInitCdsClientSuccesfully(@Injectable IDistributionClient distributionClient, - @Injectable CdsSdcListenerConfiguration configuration, - @Injectable CdsSdcListenerNotificationCallback notification, - @Injectable CdsSdcListenerDto cdsSdcListenerDto) throws CdsSdcListenerException { + @Injectable SdcListenerConfiguration configuration, + @Injectable SdcListenerNotificationCallback notification, + @Injectable SdcListenerDto sdcListenerDto) throws SdcListenerException { //Arrange new MockUp<DistributionClientFactory>() { @@ -64,7 +64,7 @@ public class CdsSdcListenerClientTest { }}; // Act - cdsSdcListenerClient.initSdcClient(); + sdcListenerClient.initSdcClient(); // Verify new VerificationsInOrder() {{ diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java index f940db2aa..01ffe1ba9 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/CdsSdcListenerConfigurationTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/SdcListenerConfigurationTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener; +package org.onap.ccsdk.cds.sdclistener; import static org.junit.Assert.assertEquals; import org.junit.Test; @@ -24,12 +24,12 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties(CdsSdcListenerConfiguration.class) -@SpringBootTest(classes = {CdsSdcListenerConfigurationTest.class}) -public class CdsSdcListenerConfigurationTest { +@EnableConfigurationProperties(SdcListenerConfiguration.class) +@SpringBootTest(classes = {SdcListenerConfigurationTest.class}) +public class SdcListenerConfigurationTest { @Autowired - private CdsSdcListenerConfiguration listenerConfiguration; + private SdcListenerConfiguration listenerConfiguration; @Test public void testCdsSdcListenerConfiguration() { diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java index f700a7dd2..ee20f8771 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/handler/BluePrintProcessorHandlerTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/handler/BluePrintProcessorHandlerTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.handler; +package org.onap.ccsdk.cds.sdclistener.handler; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -31,7 +31,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementOutput; import org.onap.ccsdk.cds.controllerblueprints.management.api.BluePrintManagementServiceGrpc.BluePrintManagementServiceImplBase; @@ -43,7 +43,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({BluePrintProcesssorHandler.class, CdsSdcListenerAuthClientInterceptor.class}) +@EnableConfigurationProperties({BluePrintProcesssorHandler.class, SdcListenerAuthClientInterceptor.class}) @SpringBootTest(classes = {BluePrintProcessorHandlerTest.class}) public class BluePrintProcessorHandlerTest { @@ -51,7 +51,7 @@ public class BluePrintProcessorHandlerTest { private BluePrintProcesssorHandler bluePrintProcesssorHandler; @Autowired - private CdsSdcListenerAuthClientInterceptor cdsSdcListenerAuthClientInterceptor; + private SdcListenerAuthClientInterceptor sdcListenerAuthClientInterceptor; @Rule public GrpcCleanupRule grpcCleanup = new GrpcCleanupRule(); diff --git a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java index 359ee6cc4..f5ff2bdb8 100644 --- a/ms/cds-sdc-listener/application/src/test/java/org/onap/ccsdk/cds/cdssdclistener/service/ListenerServiceImplTest.java +++ b/ms/sdclistener/application/src/test/java/org/onap/ccsdk/cds/sdclistener/service/ListenerServiceImplTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.ccsdk.cds.cdssdclistener.service; +package org.onap.ccsdk.cds.sdclistener.service; import static junit.framework.TestCase.assertTrue; import java.io.File; @@ -27,11 +27,11 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; -import org.onap.ccsdk.cds.cdssdclistener.CdsSdcListenerConfiguration; -import org.onap.ccsdk.cds.cdssdclistener.client.CdsSdcListenerAuthClientInterceptor; -import org.onap.ccsdk.cds.cdssdclistener.dto.CdsSdcListenerDto; -import org.onap.ccsdk.cds.cdssdclistener.handler.BluePrintProcesssorHandler; -import org.onap.ccsdk.cds.cdssdclistener.status.CdsSdcListenerStatus; +import org.onap.ccsdk.cds.sdclistener.SdcListenerConfiguration; +import org.onap.ccsdk.cds.sdclistener.client.SdcListenerAuthClientInterceptor; +import org.onap.ccsdk.cds.sdclistener.dto.SdcListenerDto; +import org.onap.ccsdk.cds.sdclistener.handler.BluePrintProcesssorHandler; +import org.onap.ccsdk.cds.sdclistener.status.SdcListenerStatus; import org.onap.sdc.api.results.IDistributionClientDownloadResult; import org.onap.sdc.impl.mock.DistributionClientResultStubImpl; import org.springframework.beans.factory.annotation.Autowired; @@ -40,9 +40,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@EnableConfigurationProperties({CdsSdcListenerAuthClientInterceptor.class, - BluePrintProcesssorHandler.class, CdsSdcListenerDto.class, ListenerServiceImpl.class, CdsSdcListenerStatus.class, - CdsSdcListenerConfiguration.class}) +@EnableConfigurationProperties({SdcListenerAuthClientInterceptor.class, + BluePrintProcesssorHandler.class, SdcListenerDto.class, ListenerServiceImpl.class, SdcListenerStatus.class, + SdcListenerConfiguration.class}) @SpringBootTest(classes = {ListenerServiceImplTest.class}) public class ListenerServiceImplTest { diff --git a/ms/cds-sdc-listener/application/src/test/resources/service-Testsvc140.csar b/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar Binary files differindex 4aa0de72b..4aa0de72b 100644 --- a/ms/cds-sdc-listener/application/src/test/resources/service-Testsvc140.csar +++ b/ms/sdclistener/application/src/test/resources/service-Testsvc140.csar diff --git a/ms/cds-sdc-listener/application/src/test/resources/testcba.zip b/ms/sdclistener/application/src/test/resources/testcba.zip Binary files differindex c886fe6bc..c886fe6bc 100644 --- a/ms/cds-sdc-listener/application/src/test/resources/testcba.zip +++ b/ms/sdclistener/application/src/test/resources/testcba.zip diff --git a/ms/sdclistener/distribution/pom.xml b/ms/sdclistener/distribution/pom.xml new file mode 100755 index 000000000..a79a14c52 --- /dev/null +++ b/ms/sdclistener/distribution/pom.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2019 IBM, Bell Canada. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <version>0.4.2-SNAPSHOT</version> + <relativePath>../parent</relativePath> + </parent> + <artifactId>distribution</artifactId> + <packaging>pom</packaging> + <name>SDC Listener Distribution</name> + <properties> + <assembly.id>maven</assembly.id> + <name.space>org.onap.ccsdk.cds</name.space> + <serviceArtifactName>sdclistener</serviceArtifactName> + <image.name>onap/ccsdk-sdclistener</image.name> + <!--disabled for now to mirror #85964 https://gerrit.onap.org/r/#/c/85964/2/ms/command-executor/pom.xml--> + <!--<docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>--> + <docker.push.phase>deploy</docker.push.phase> + <docker.verbose>true</docker.verbose> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>application</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-dockerfile</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <resources> + <resource> + <directory>src/main/docker</directory> + <includes> + <include>*</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>ant-test</id> + <phase>package</phase> + <configuration> + <tasks> + <fixcrlf srcdir="${basedir}" eol="unix" includes="**/*.sh, **/*.source"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <!--build the final artifact for docker deployment --> + <artifactId>maven-assembly-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <!-- <skipAssembly>${skip.assembly}</skipAssembly> --> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <descriptors> + <descriptor>src/main/docker/distribution.xml</descriptor> + </descriptors> + <tarLongFileMode>posix</tarLongFileMode> + </configuration> + <executions> + <execution> + <id>${assembly.id}</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.groovy.maven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source>${basedir}/../../../TagVersion.groovy</source> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> + + <profiles> + <profile> + <id>docker</id> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.26.1</version> + <inherited>false</inherited> + <configuration> + <images> + <image> + <name>${image.name}</name> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> + <tags> + <tag>${project.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> + </tags> + </build> + </image> + </images> + <verbose>true</verbose> + </configuration> + <executions> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>${docker.push.phase}</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml index 1e7384744..1c68f6cf3 100644..100755 --- a/ms/cds-sdc-listener/application/src/main/docker/docker-compose.yaml +++ b/ms/sdclistener/distribution/src/main/dc/docker-compose.yaml @@ -2,7 +2,7 @@ version: '3.3' services: cds-sdc-listener: - image: onap/cdssdclistener:latest + image: onap/ccsdk-sdclistener:latest container_name: cdssdclistener restart: always environment: diff --git a/ms/sdclistener/distribution/src/main/docker/Dockerfile b/ms/sdclistener/distribution/src/main/docker/Dockerfile new file mode 100755 index 000000000..e945188a8 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM openjdk:8-jdk-alpine + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} + +# add entrypoint +COPY startService.sh /startService.sh +RUN chmod 751 /startService.sh +# add application +COPY @project.build.finalName@-@assembly.id@.tar.gz /source.tar.gz +RUN tar -xzf /source.tar.gz -C /tmp \ + && cp -rf /tmp/@project.build.finalName@/opt / \ + && rm -rf /source.tar.gz \ + && rm -rf /tmp/@project.build.finalName@ + +ENTRYPOINT /startService.sh diff --git a/ms/sdclistener/distribution/src/main/docker/distribution.xml b/ms/sdclistener/distribution/src/main/docker/distribution.xml new file mode 100755 index 000000000..e9e8eefa5 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/distribution.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2018-2019 Bell Canada. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd"> + <!-- create a tar.gz file containing the projects dependencies --> + <id>${assembly.id}</id> + <formats> + <format>tar.gz</format> + </formats> + <dependencySets> + <dependencySet> + <outputDirectory>/opt/app/onap/lib</outputDirectory> + <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}</outputFileNameMapping> + <excludes> + <exclude>org.slf4j:slf4j-simple</exclude> + </excludes> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>${project.basedir}/../application/src/main/resources</directory> + <includes> + <include>application.properties</include> + <include>application.yml</include> + <include>logback.xml</include> + </includes> + <outputDirectory>/opt/app/onap/config</outputDirectory> + <useDefaultExcludes>true</useDefaultExcludes> + </fileSet> + </fileSets> +</assembly> diff --git a/ms/sdclistener/distribution/src/main/docker/startService.sh b/ms/sdclistener/distribution/src/main/docker/startService.sh new file mode 100644 index 000000000..7ad6171b8 --- /dev/null +++ b/ms/sdclistener/distribution/src/main/docker/startService.sh @@ -0,0 +1,12 @@ +#!/bin/sh +echo "Starting SDC Listener" + +export APP_HOME=/opt/app/onap +export APP_CONFIG_HOME=${APP_HOME}/config +echo "APP Config HOME : ${APP_CONFIG_HOME}" + +java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \ +-Dlogging.config=${APP_CONFIG_HOME}/logback.xml \ +-Djava.security.egd=file:/dev/./urandom \ +-Dspring.config.location=${APP_CONFIG_HOME}/ \ +org.onap.ccsdk.cds.sdclistener.SdcListenerApplication diff --git a/ms/sdclistener/parent/pom.xml b/ms/sdclistener/parent/pom.xml new file mode 100755 index 000000000..fabdc2530 --- /dev/null +++ b/ms/sdclistener/parent/pom.xml @@ -0,0 +1,246 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright © 2017-2018 AT&T Intellectual Property. + ~ + ~ Modifications Copyright © 2018 - 2019 IBM, Bell Canada + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.ccsdk.cds</groupId> + <artifactId>sdclistener</artifactId> + <version>0.4.2-SNAPSHOT</version> + </parent> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>parent</artifactId> + <packaging>pom</packaging> + <name>SDC Listener Parent</name> + <description>SDC Listener Parent</description> + <properties> + <spring.boot.version>2.1.3.RELEASE</spring.boot.version> + <spring.version>5.1.5.RELEASE</spring.version> + <grpc.version>1.18.0</grpc.version> + <protobuff.java.utils.version>3.6.1</protobuff.java.utils.version> + <eelf.version>1.0.0</eelf.version> + <sli.version>0.4.2-SNAPSHOT</sli.version> + <guava.version>27.0.1-jre</guava.version> + <onap.logger.slf4j>1.2.2</onap.logger.slf4j> + <powermock.version>1.7.4</powermock.version> + <mockk.version>1.9</mockk.version> + <dmaap.client.version>1.1.5</dmaap.client.version> + <mockkserver.version>5.5.1</mockkserver.version> + <sdc-distribution-client.version>1.3.0</sdc-distribution-client.version> + <jmockit.version>1.19</jmockit.version> + <reactorcore.version>3.2.6.RELEASE</reactorcore.version> + </properties> + <dependencyManagement> + <dependencies> + <!-- Spring Boot --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>${spring.boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <!-- Common Utils Dependencies --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.2.1</version> + </dependency> + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.2</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-compress</artifactId> + <version>1.15</version> + </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </dependency> + + <!-- GRPC Dependencies --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-core</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-netty</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-protobuf</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-stub</artifactId> + <version>${grpc.version}</version> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + <version>${protobuff.java.utils.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.components</groupId> + <artifactId>proto-definition</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <version>${reactorcore.version}</version> + </dependency> + + <!-- Blueprint Processor Application Module Dependencies --> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>processor-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>db-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>rest-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>dmaap-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>grpc-lib</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>execution-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>workflow-service</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>resource-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>selfservice-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> + + + <!-- Controller Blueprints Application Dependency --> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>resource-dict</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-scripts</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>db-resources</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.cds.controllerblueprints</groupId> + <artifactId>blueprint-validation</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- Test Dependency --> + <dependency> + <groupId>io.grpc</groupId> + <artifactId>grpc-testing</artifactId> + <version>${grpc.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>${jmockit.version}</version> + <scope>test</scope> + </dependency> + + <!-- SDC Distribution client dependency --> + <dependency> + <groupId>org.onap.ccsdk.cds.sdclistener</groupId> + <artifactId>application</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.sdc.sdc-distribution-client</groupId> + <artifactId>sdc-distribution-client</artifactId> + <version>${sdc-distribution-client.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.5.1</version> + <configuration> + <source>${maven.compiler.source}</source> + <target>${maven.compiler.target}</target> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/ms/cds-sdc-listener/pom.xml b/ms/sdclistener/pom.xml index 6c533e16b..70e8529f6 100644 --- a/ms/cds-sdc-listener/pom.xml +++ b/ms/sdclistener/pom.xml @@ -14,8 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.cds</groupId> <artifactId>ms</artifactId> @@ -23,17 +23,27 @@ <relativePath>..</relativePath> </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>cds-sdc-listener</artifactId> - <name>CDS-SDC Listener Root</name> - <description>A microservice to get the cba file from SDC and store it into database at runtime</description> + <artifactId>sdclistener</artifactId> + <name>SDC Listener Root</name> + <description>SDC Listener Root</description> <packaging>pom</packaging> + <properties> + <service.name>sdclistener</service.name> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <build.number>${maven.build.timestamp}</build.number> + <java.version>1.8</java.version> + <maven.compiler.target>1.8</maven.compiler.target> + <maven.compiler.source>1.8</maven.compiler.source> + <ccsdk.project.version>${project.version}</ccsdk.project.version> + </properties> + <modules> + <module>parent</module> <module>application</module> - <!-- Module is not currently working <module>distribution</module> - --> </modules> </project> |