updating docker repository to onap nexus for Catalog Service and Auth Service 89/113489/3
authorRavi Mantena <rx908f@att.com>
Fri, 2 Oct 2020 15:10:15 +0000 (11:10 -0400)
committerRavi Mantena <rx908f@att.com>
Fri, 2 Oct 2020 15:47:26 +0000 (11:47 -0400)
Issue-ID: DCAEGEN2-2317
Change-Id: Id1ca3eb92586d859cf757779b77e6b89bc641df2
Signed-off-by: Ravi Mantena <rx908f@att.com>
mod2/auth-service/Dockerfile
mod2/auth-service/pom.xml
mod2/auth-service/src/main/resources/application.properties
mod2/catalog-service/pom.xml
mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/blueprintgenerator/DeploymentArtifactGenerator.java [moved from mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/mock/MockDeploymentArtifactGenerator.java with 63% similarity]
mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/deploymentartifact/DeploymentArtifactServiceImplTest.java

index aa8707f..b125fc0 100644 (file)
@@ -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
index 75782f4..3723584 100644 (file)
@@ -40,7 +40,7 @@
                <maven.compiler.source>${java.version}</maven.compiler.source>
                <maven.compiler.target>${java.version}</maven.compiler.target>
                <dockerfile-maven-plugin.version>1.4.10</dockerfile-maven-plugin.version>
-               <docker.image.name>${project.groupId}.${project.artifactId}</docker.image.name>
+               <docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
        </properties>
 
        <dependencies>
index f3f5d37..f02d084 100644 (file)
@@ -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
index 37aaf46..fee27ec 100644 (file)
         <maven.compiler.target>${java.version}</maven.compiler.target>
         <spring-boot.version>2.2.9.RELEASE</spring-boot.version>
         <dockerfile-maven-plugin.version>1.4.10</dockerfile-maven-plugin.version>
-        <docker.image.name>${project.groupId}.${project.artifactId}</docker.image.name>
+        <docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
     </properties>
     <dependencies>
+        <dependency>
+            <groupId>org.onap.dcaegen2.platform.mod</groupId>
+            <artifactId>blueprint-generator</artifactId>
+            <version>1.5.2-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
  *  ============LICENSE_END=========================================================
  */
 
-package org.onap.dcaegen2.platform.mod.mock;
+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 MockDeploymentArtifactGenerator implements DeploymentArtifactGeneratorStrategy {
+public class DeploymentArtifactGenerator implements DeploymentArtifactGeneratorStrategy {
 
     /**
      * null implementation.
@@ -38,8 +43,19 @@ public class MockDeploymentArtifactGenerator implements DeploymentArtifactGenera
      * @param release
      * @return
      */
-    @Override
+
+      @Override
     public Map<String, Object> generateForRelease(Specification activeSpec, String release) {
-        return null;
+
+        ComponentSpec inboundComponentSpec = new ComponentSpec();
+        inboundComponentSpec.createComponentSpecFromString(new Gson().toJson(activeSpec.getSpecContent()));
+
+        Blueprint blueprint = new Blueprint().createBlueprint(inboundComponentSpec,"",'d',"","");
+
+        Map<String, Object> modifiedResponse = new HashMap<>();
+        modifiedResponse.put("content",  blueprint.blueprintToString());
+        modifiedResponse.put("fileName", "filenamePlaceholder" + ".yaml");
+        return modifiedResponse;
     }
+
 }
index 749d8b1..9074650 100644 (file)
@@ -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<String, Object> 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{