From 3708e8fed17cb2af766296bcba2bf4ccf535b0ec Mon Sep 17 00:00:00 2001 From: Ravi Mantena Date: Fri, 2 Oct 2020 11:10:15 -0400 Subject: updating docker repository to onap nexus for Catalog Service and Auth Service Issue-ID: DCAEGEN2-2317 Change-Id: Id1ca3eb92586d859cf757779b77e6b89bc641df2 Signed-off-by: Ravi Mantena --- mod2/auth-service/Dockerfile | 2 +- mod2/auth-service/pom.xml | 2 +- .../src/main/resources/application.properties | 3 +- mod2/catalog-service/pom.xml | 8 ++- .../DeploymentArtifactGenerator.java | 61 ++++++++++++++++++++++ .../mod/mock/MockDeploymentArtifactGenerator.java | 45 ---------------- .../DeploymentArtifactServiceImplTest.java | 17 ++++++ 7 files changed, 88 insertions(+), 50 deletions(-) create mode 100644 mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/blueprintgenerator/DeploymentArtifactGenerator.java delete mode 100644 mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/mock/MockDeploymentArtifactGenerator.java (limited to 'mod2') diff --git a/mod2/auth-service/Dockerfile b/mod2/auth-service/Dockerfile index aa8707f..b125fc0 100644 --- a/mod2/auth-service/Dockerfile +++ b/mod2/auth-service/Dockerfile @@ -11,4 +11,4 @@ COPY ${PROJECT_BUILD_DIR_NAME}/${FINAL_JAR} . ENTRYPOINT ["java", \ "-Djava.security.egd=file:/dev/./urandom", \ - "-jar", "auth-service-1.0.0-SNAPSHOT.jar"] \ No newline at end of file + "-jar", "mod-auth-service.jar"] \ No newline at end of file diff --git a/mod2/auth-service/pom.xml b/mod2/auth-service/pom.xml index 75782f4..3723584 100644 --- a/mod2/auth-service/pom.xml +++ b/mod2/auth-service/pom.xml @@ -40,7 +40,7 @@ ${java.version} ${java.version} 1.4.10 - ${project.groupId}.${project.artifactId} + onap/${project.groupId}.${project.artifactId} diff --git a/mod2/auth-service/src/main/resources/application.properties b/mod2/auth-service/src/main/resources/application.properties index f3f5d37..f02d084 100644 --- a/mod2/auth-service/src/main/resources/application.properties +++ b/mod2/auth-service/src/main/resources/application.properties @@ -22,8 +22,7 @@ server.port=8082 -#spring.data.mongodb.host=mongo_db -spring.data.mongodb.host=localhost +spring.data.mongodb.host=mongo_db #spring.data.mongodb.host=zlecdyh2bdcc1s2dokr05.ec53e7.dyh2b.tci.att.com spring.data.mongodb.port=27017 spring.data.mongodb.database=dcae_mod diff --git a/mod2/catalog-service/pom.xml b/mod2/catalog-service/pom.xml index 37aaf46..fee27ec 100644 --- a/mod2/catalog-service/pom.xml +++ b/mod2/catalog-service/pom.xml @@ -38,9 +38,15 @@ ${java.version} 2.2.9.RELEASE 1.4.10 - ${project.groupId}.${project.artifactId} + onap/${project.groupId}.${project.artifactId} + + org.onap.dcaegen2.platform.mod + blueprint-generator + 1.5.2-SNAPSHOT + compile + org.springframework.boot spring-boot-starter-data-mongodb-reactive diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/blueprintgenerator/DeploymentArtifactGenerator.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/blueprintgenerator/DeploymentArtifactGenerator.java new file mode 100644 index 0000000..5d7668d --- /dev/null +++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/blueprintgenerator/DeploymentArtifactGenerator.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START======================================================= + * org.onap.dcae + * ================================================================================ + * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.blueprintgenerator; + +import com.google.gson.Gson; +import org.onap.blueprintgenerator.models.blueprint.Blueprint; +import org.onap.blueprintgenerator.models.componentspec.ComponentSpec; +import org.onap.dcaegen2.platform.mod.model.specification.Specification; +import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactGeneratorStrategy; +import org.springframework.stereotype.Component; + + +import java.util.HashMap; +import java.util.Map; + +/** + * Mock implementation for DeploymentArtifactGenerator + */ +@Component +public class DeploymentArtifactGenerator implements DeploymentArtifactGeneratorStrategy { + + /** + * null implementation. + * @param activeSpec + * @param release + * @return + */ + + @Override + public Map generateForRelease(Specification activeSpec, String release) { + + ComponentSpec inboundComponentSpec = new ComponentSpec(); + inboundComponentSpec.createComponentSpecFromString(new Gson().toJson(activeSpec.getSpecContent())); + + Blueprint blueprint = new Blueprint().createBlueprint(inboundComponentSpec,"",'d',"",""); + + Map modifiedResponse = new HashMap<>(); + modifiedResponse.put("content", blueprint.blueprintToString()); + modifiedResponse.put("fileName", "filenamePlaceholder" + ".yaml"); + return modifiedResponse; + } + +} diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/mock/MockDeploymentArtifactGenerator.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/mock/MockDeploymentArtifactGenerator.java deleted file mode 100644 index 24c31ed..0000000 --- a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/mock/MockDeploymentArtifactGenerator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.dcae - * ================================================================================ - * Copyright (c) 2020 AT&T Intellectual Property. 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.dcaegen2.platform.mod.mock; - -import org.onap.dcaegen2.platform.mod.model.specification.Specification; -import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactGeneratorStrategy; -import org.springframework.stereotype.Component; - -import java.util.Map; - -/** - * Mock implementation for DeploymentArtifactGenerator - */ -@Component -public class MockDeploymentArtifactGenerator implements DeploymentArtifactGeneratorStrategy { - - /** - * null implementation. - * @param activeSpec - * @param release - * @return - */ - @Override - public Map generateForRelease(Specification activeSpec, String release) { - return null; - } -} diff --git a/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/deploymentartifact/DeploymentArtifactServiceImplTest.java b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/deploymentartifact/DeploymentArtifactServiceImplTest.java index 749d8b1..9074650 100644 --- a/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/deploymentartifact/DeploymentArtifactServiceImplTest.java +++ b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/deploymentartifact/DeploymentArtifactServiceImplTest.java @@ -25,8 +25,11 @@ import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifac import org.onap.dcaegen2.platform.mod.model.exceptions.deploymentartifact.DeploymentArtifactNotFound; import org.onap.dcaegen2.platform.mod.model.microserviceinstance.MsInstance; import org.onap.dcaegen2.platform.mod.model.restapi.DeploymentArtifactPatchRequest; +import org.onap.dcaegen2.platform.mod.model.specification.DeploymentType; +import org.onap.dcaegen2.platform.mod.model.specification.Specification; import org.onap.dcaegen2.platform.mod.objectmothers.DeploymentArtifactObjectMother; import org.onap.dcaegen2.platform.mod.objectmothers.MsInstanceObjectMother; +import org.onap.dcaegen2.platform.mod.objectmothers.SpecificationObjectMother; import org.onap.dcaegen2.platform.mod.web.service.microserviceinstance.MsInstanceService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -36,6 +39,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import java.util.Arrays; import java.util.List; +import java.util.Map; import java.util.Optional; import static org.onap.dcaegen2.platform.mod.objectmothers.MsInstanceObjectMother.*; @@ -98,6 +102,19 @@ class DeploymentArtifactServiceImplTest { assertThat(deployments.size()).isEqualTo(1); } + @Test + void test_GenerateForRelease_shouldReturnCorrectBlueprint(){ + Specification specification = SpecificationObjectMother.getMockSpecification(DeploymentType.K8S); + when(deploymentArtifactGeneratorStrategy.generateForRelease(specification, "")).thenReturn(DeploymentArtifactObjectMother.createBlueprintResponse()); + Map response = deploymentArtifactGeneratorStrategy.generateForRelease(specification, ""); + verify(deploymentArtifactGeneratorStrategy, atLeastOnce()).generateForRelease(specification,""); + assertThat(response).isNotNull(); + assertThat(response.get("content")).isNotNull(); + assertThat(response.get("fileName")).isNotNull(); + assertThat((String)response.get("content")).contains("tosca_definitions_version"); + + } + @Test void test_GenerateBlueprint_shouldReturnCorrectBlueprint() throws Exception{ -- cgit 1.2.3-korg