Merge "Run groovy bpmn/vcpe tests"
authorSteve Smokowski <ss835w@att.com>
Wed, 13 Mar 2019 18:44:01 +0000 (18:44 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 13 Mar 2019 18:44:01 +0000 (18:44 +0000)
24 files changed:
adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java [new file with mode: 0755]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java [new file with mode: 0644]
adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml [new file with mode: 0644]
adapters/mso-vnfm-adapter/pom.xml [new file with mode: 0644]
adapters/pom.xml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolationbeans/RequestStatus.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/WatchdogDistributionStatus.java
packages/docker/pom.xml

diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
new file mode 100644 (file)
index 0000000..c24c45c
--- /dev/null
@@ -0,0 +1,17 @@
+<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.so.adapters</groupId>
+        <artifactId>mso-vnfm-adapter</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>mso-vnfm-adapter-api</artifactId>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+    <name>mso-vnfm-adapter-api</name>
+    <description>MSO VNFM adapter API</description>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
new file mode 100644 (file)
index 0000000..0cf1ce7
--- /dev/null
@@ -0,0 +1,17 @@
+<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.so.adapters</groupId>
+        <artifactId>mso-vnfm-adapter</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+    <name>mso-vnfm-adapter-ext-clients</name>
+    <description>Clients for the vnfm adpater to use towards REST endpoints which are external to the VNFM adapter/</description>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
new file mode 100644 (file)
index 0000000..4554835
--- /dev/null
@@ -0,0 +1,80 @@
+<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.so.adapters</groupId>
+        <artifactId>mso-vnfm-adapter</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>mso-vnfm-etsi-adapter</artifactId>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    </properties>
+    <name>mso-vnfm-etsi-adapter</name>
+    <description>MSO ETSI compliant VNFM Adapter</description>
+
+    <build>
+        <finalName>${project.artifactId}-${project.version}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication</mainClass>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>original</id>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-security</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.so.adapters</groupId>
+            <artifactId>mso-adapters-rest-interface</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
new file mode 100644 (file)
index 0000000..cdf7de8
--- /dev/null
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter;
+
+/**
+ * Adapter constants
+ */
+public class Constants {
+
+    public static final String SERVICE_NAME = "vnfm-adapter";
+    public static final String SERVICE_VERSION = "v1";
+    public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION;
+
+    private Constants() {}
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
new file mode 100755 (executable)
index 0000000..024e936
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController;
+import org.slf4j.Logger;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * The spring boot application for the VNFM (Virtual Network Function Manager) Adapter.
+ * <p>
+ * The VNFM Adapter receives requests through its REST API {@link VnfmAdapterController} which it adapts
+ * into ETSI SOL003 compliant LCM (Life Cycle Management) calls towards an ETSI compliant VNFM.
+ *
+ * @see <a href=
+ *      "https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/003/02.05.01_60/gs_nfv-sol003v020501p.pdf">ETSI
+ *      SOL003 v2.5.1</a>
+ */
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+public class VnfmAdapterApplication {
+    private static final Logger logger = getLogger(VnfmAdapterApplication.class);
+
+
+    /**
+     * Entry point for the Spring boot application
+     *
+     * @param args arguments for the application
+     */
+    public static void main(final String[] args) {
+        new SpringApplication(VnfmAdapterApplication.class).run(args);
+        logger.info("VnfmAdapterApplication started!");
+    }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/WebSecurityConfigImpl.java
new file mode 100644 (file)
index 0000000..6baa672
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+/**
+ * Configure the web security for the application.
+ */
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+    @Override
+    protected void configure(final HttpSecurity http) throws Exception {
+        http.csrf().disable().authorizeRequests().antMatchers("/manage/health","/manage/info").permitAll()
+                .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and()
+                .httpBasic();
+    }
+
+    @Override
+    public void configure(final WebSecurity web) throws Exception {
+        super.configure(web);
+        final StrictHttpFirewall firewall = new MSOSpringFirewall();
+        web.httpFirewall(firewall);
+    }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
new file mode 100644 (file)
index 0000000..4dabec3
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest;
+
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
+ */
+@Controller
+@RequestMapping(value = BASE_URL)
+public class VnfmAdapterController {
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
new file mode 100644 (file)
index 0000000..7719c0c
--- /dev/null
@@ -0,0 +1,31 @@
+# Copyright Â© 2019 Nordix Foundation
+#
+# 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.
+server:
+  port: 9092
+  tomcat:
+      max-threads: 50
+
+#Actuator
+management:
+  endpoints:
+    web:
+      base-path: /manage
+      exposure:
+        include: "*"
+  metrics:
+    se-global-registry: false
+    export:
+      prometheus:
+        enabled: true # Whether exporting of metrics to Prometheus is enabled.
+        step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java
new file mode 100644 (file)
index 0000000..ee22e03
--- /dev/null
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest;
+
+import static org.junit.Assert.assertEquals;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class HealthCheckTest {
+
+    @LocalServerPort
+    private int port;
+
+    private final TestRestTemplate restTemplate = new TestRestTemplate();
+
+    @Test
+    public void testHealthcheck() throws Exception {
+        final RequestEntity<Void> request =
+                RequestEntity.get(new URI("http://localhost:" + port + "/manage/health")).build();
+        final ResponseEntity<Void> response = restTemplate.exchange(request, Void.class);
+        assertEquals(200, response.getStatusCode().value());
+    }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml
new file mode 100644 (file)
index 0000000..cc5a068
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright Â© 2019 Nordix Foundation
+#
+# 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.
+spring:
+  security:
+    usercredentials:
+    - username: test
+      password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+      role: BPEL-Client
\ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml
new file mode 100644 (file)
index 0000000..9cc1705
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.so</groupId>
+        <artifactId>adapters</artifactId>
+        <version>1.4.0-SNAPSHOT</version>
+    </parent>
+    <groupId>org.onap.so.adapters</groupId>
+    <artifactId>mso-vnfm-adapter</artifactId>
+    <name>MSO VNFM Adapter</name>
+    <description>MSO Adapter for VNFM</description>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>mso-vnfm-adapter-api</module>
+        <module>mso-vnfm-adapter-ext-clients</module>
+        <module>mso-vnfm-etsi-adapter</module>
+    </modules>
+</project>
index 634a161..d00304b 100644 (file)
@@ -20,6 +20,7 @@
                <module>mso-catalog-db-adapter</module>         
                <module>mso-vfc-adapter</module>
                <module>mso-openstack-adapters</module>
+               <module>mso-vnfm-adapter</module>
   </modules>
 
        <dependencies>
index fedbde2..b086b8a 100644 (file)
@@ -163,7 +163,7 @@ public class GeneralTopologyObjectMapper {
                        vfModuleInformation.setFromPreload(requestContext.getRequestParameters().getUsePreload());                      
                }
                else {
-                       vfModuleInformation.setFromPreload(false);
+                       vfModuleInformation.setFromPreload(true);
                }
                
                return vfModuleInformation;
index 3bb5427..630bcce 100644 (file)
@@ -362,7 +362,7 @@ public class GeneralTopologyObjectMapperTest  extends TestDataSetup {
                assertNull(gcRequestInput.getOnapModelInformation());
                assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
                assertNotNull(gcRequestInput.getVfModuleId());
-               assertFalse(gcRequestInput.getFromPreload());
+               assertTrue(gcRequestInput.getFromPreload());
        }
        
        @Test
@@ -386,7 +386,7 @@ public class GeneralTopologyObjectMapperTest  extends TestDataSetup {
                assertNull(gcRequestInput.getOnapModelInformation());
                assertEquals(vfModule.getVfModuleId(),gcRequestInput.getVfModuleId());
                assertNotNull(gcRequestInput.getVfModuleId());
-               assertFalse(gcRequestInput.getFromPreload());
+               assertTrue(gcRequestInput.getFromPreload());
        }
        
        @Test
index 4c3597b..710c820 100644 (file)
 package org.onap.so.serviceinstancebeans;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 @JsonInclude(Include.NON_DEFAULT)
 public class RequestStatus {
 
-    protected String requestState;
+       @JsonProperty("requestState")
+       protected String requestState;
+       @JsonProperty("statusMessage")
     protected String statusMessage;
+       @JsonProperty("percentProgress")
     protected Integer percentProgress;
+       @JsonProperty("timestamp")
     protected String timeStamp;
 
-
        public String getRequestState() {
                return requestState;
        }
@@ -60,6 +64,6 @@ public class RequestStatus {
        @Override
        public String toString() {
                return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
-                               .append("percentProgress", percentProgress).append("timeStamp", timeStamp).toString();
+                               .append("percentProgress", percentProgress).append("timestamp", timeStamp).toString();
        }
 }
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/RequestStatusTest.java
new file mode 100644 (file)
index 0000000..fa4d2f7
--- /dev/null
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.so.serviceinstancebeans;
+
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.junit.Test;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class RequestStatusTest {
+
+       @Test
+       public void requestStatusDefaultValues() throws Exception {
+               RequestStatus requestStatus = new RequestStatus();
+               requestStatus.setRequestState("COMPLETE");
+               requestStatus.setStatusMessage("STATUS: COMPLETED");
+               requestStatus.setPercentProgress(100);
+               requestStatus.setTimeStamp("Fri, 08 Mar 2019 04:41:42 GMT");
+               String expectedResponse = "{\"requestState\":\"COMPLETE\",\"statusMessage\":\"STATUS: COMPLETED\",\"percentProgress\":100,\"timestamp\":\"Fri, 08 Mar 2019 04:41:42 GMT\"}";
+
+               ObjectMapper mapper = new ObjectMapper();       
+               String realResponse = mapper.writeValueAsString(requestStatus);         
+               
+               JSONAssert.assertEquals(expectedResponse, realResponse, false);
+       }
+}
index 7ef712e..6fd765b 100644 (file)
@@ -38,7 +38,7 @@ public class RequestStatus implements Serializable {
     protected String statusMessage;
        @JsonProperty("percentProgress")
     protected String percentProgress;
-       @JsonProperty("timeStamp")
+       @JsonProperty("timestamp")
     protected String timeStamp;
 
 
index edb92ef..8e1a6f5 100644 (file)
@@ -71,6 +71,23 @@ public class RequestParametersValidation implements ValidationRule{
                }
                if(requestScope.equalsIgnoreCase(ModelType.vfModule.name())){
                        if(action == Action.createInstance || action == Action.updateInstance){                         
+                               if(requestParameters.isUsePreload() == null){                                   
+                                       if(reqVersion >= 4){                                            
+                                               if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == true) {                                                       
+                                                       requestParameters.setUsePreload(true);
+                                               }
+                                               else {                                                  
+                                                       requestParameters.setUsePreload(false);
+                                               }
+                                       }
+                                       else {                                  
+                                               requestParameters.setUsePreload(true);
+                                       }
+                               }
+                       }
+               }
+               if(requestScope.equalsIgnoreCase(ModelType.service.name())){
+                       if(action == Action.createInstance){                            
                                if(requestParameters.isUsePreload() == null){                                   
                                        if(reqVersion >= 4){                                            
                                                if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == false) {                                                      
index 2813ef7..8d456e3 100644 (file)
@@ -66,7 +66,7 @@ public class RequestParametersValidationTest extends BaseTest{
                RequestParametersValidation validation = new RequestParametersValidation();
                validation.validate(info);
                
-               assertFalse(info.getReqParameters().getUsePreload());           
+               assertTrue(info.getReqParameters().getUsePreload());            
        }
        
        @Test
@@ -100,4 +100,68 @@ public class RequestParametersValidationTest extends BaseTest{
                
                assertTrue(info.getReqParameters().getUsePreload());
        }
+       
+       @Test
+       public void testServiceWithFalseALaCarte() throws IOException, ValidationException {
+               String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
+               ObjectMapper mapper = new ObjectMapper();
+               ServiceInstancesRequest sir  = mapper.readValue(requestJson, ServiceInstancesRequest.class);    
+               sir.getRequestDetails().getRequestParameters().setUsePreload(null);             
+               ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 
+                                                                                                                               6, false, sir.getRequestDetails().getRequestParameters());              
+               sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+               info.setRequestScope("service");
+               RequestParametersValidation validation = new RequestParametersValidation();
+               validation.validate(info);
+               
+               assertFalse(info.getReqParameters().getUsePreload());           
+       }
+       
+       @Test
+       public void testServiceWithNoALaCarte() throws IOException, ValidationException {
+               String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json")));
+               ObjectMapper mapper = new ObjectMapper();
+               ServiceInstancesRequest sir  = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+               ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 
+                                                                                                                               6, false, sir.getRequestDetails().getRequestParameters());
+               sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+               sir.getRequestDetails().getRequestParameters().setSubscriptionServiceType("subscriptionServiceType");
+               info.setRequestScope("service");
+               RequestParametersValidation validation = new RequestParametersValidation();
+               validation.validate(info);
+               
+               assertFalse(info.getReqParameters().getUsePreload());           
+       }
+       
+       @Test
+       public void testServiceWithTrueALaCarte() throws IOException, ValidationException {
+               String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.json")));
+               ObjectMapper mapper = new ObjectMapper();
+               ServiceInstancesRequest sir  = mapper.readValue(requestJson, ServiceInstancesRequest.class);
+               sir.getRequestDetails().getRequestParameters().setUsePreload(null);
+               ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 
+                                                                                                                               6, true, sir.getRequestDetails().getRequestParameters());
+               sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");       
+               info.setRequestScope("service");
+               RequestParametersValidation validation = new RequestParametersValidation();
+               validation.validate(info);
+               
+               assertTrue(info.getReqParameters().getUsePreload());
+       }
+       
+       @Test
+       public void testServiceWithReqVersionBelow4() throws IOException, ValidationException {
+               String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json")));
+               ObjectMapper mapper = new ObjectMapper();
+               ServiceInstancesRequest sir  = mapper.readValue(requestJson, ServiceInstancesRequest.class);            
+               sir.getRequestDetails().getRequestParameters().setUsePreload(null);
+               ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, 
+                                                                                                                               3, false, sir.getRequestDetails().getRequestParameters());
+               sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b");
+               info.setRequestScope("service");
+               RequestParametersValidation validation = new RequestParametersValidation();
+               validation.validate(info);
+               
+               assertTrue(info.getReqParameters().getUsePreload());
+       }       
 }
index dde4392..3b2eca7 100644 (file)
@@ -29,7 +29,7 @@
           "requestState": "COMPLETE",
           "statusMessage": "STATUS: COMPLETED",
           "percentProgress": 100,
-          "timeStamp": "Fri, 01 Jul 2016 04:41:42 GMT"
+          "timestamp": "Fri, 01 Jul 2016 04:41:42 GMT"
         }
       }
     },
@@ -63,7 +63,7 @@
           "requestState": "COMPLETE",
           "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
           "percentProgress": 100,
-          "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+          "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
         }
       }
     },
@@ -97,7 +97,7 @@
           "requestState": "PENDING",
           "statusMessage": "STATUS: Vf Module deletion pending.",
           "percentProgress": 0,
-          "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+          "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
         }
       }
     },
           "requestState": "UNLOCKED",
           "statusMessage": "STATUS: Vf Module deletion pending.",
           "percentProgress": 0,
-          "timeStamp": "Mon, 30 Jul 2018 06:09:01 GMT"
+          "timestamp": "Mon, 30 Jul 2018 06:09:01 GMT"
         }
       }
     }
index ecbf7a9..90089c0 100644 (file)
@@ -28,7 +28,7 @@
                "requestState":"COMPLETE",
                "statusMessage":"STATUS: Vf Module has been deleted successfully.",
                "percentProgress":100,
-               "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+               "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
             }
          }
       },
@@ -60,7 +60,7 @@
                "requestState":"PENDING",
                "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
                "percentProgress":0,
-               "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+               "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
             }
          }
       },
                "requestState":"PENDING",
                "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
                "percentProgress":0,
-               "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT"
+               "timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
             }
          }
       }
index 69d84b7..c8ad5f1 100644 (file)
@@ -56,7 +56,6 @@ public class WatchdogDistributionStatus implements Serializable {
        @Column(name = "MODIFY_TIME")
        @Temporal(TemporalType.TIMESTAMP)
        private Date modifyTime;
-       @Version
        @Column(name = "LOCK_VERSION")
     private int version; 
        
index 11b7de6..49f6422 100644 (file)
                                                                <dockerFile>Dockerfile.so-base-image</dockerFile>
                                                        </build>
                                                </image>
+                                               <image>
+                                                       <name>onap/so/vnfm-adapter</name>
+                                                       <build>
+                                                               <cleanup>try</cleanup>
+                                                               <dockerFileDir>docker-files</dockerFileDir>
+                                                               <dockerFile>Dockerfile.so-app</dockerFile>
+                                                               <tags>
+                                                                       <tag>${project.version}</tag>
+                                                                       <tag>${project.version}-${maven.build.timestamp}</tag>
+                                                                       <tag>${project.docker.latesttag.version}</tag>
+                                                               </tags>
+                                                               <assembly>
+                                                                       <inline>
+                                                                               <dependencySets>
+                                                                                       <dependencySet>
+                                                                                               <includes>
+                                                                                                       <include>org.onap.so.adapters:mso-vnfm-etsi-adapter</include>
+                                                                                               </includes>
+                                                                                               <outputFileNameMapping>app.jar</outputFileNameMapping>
+                                                                                       </dependencySet>
+                                                                               </dependencySets>
+                                                                       </inline>
+                                                               </assembly>
+                                                       </build>
+                                               </image>
                                                <image>
                                                        <name>onap/so/catalog-db-adapter</name>
                                                        <build>
        </build>
 
        <dependencies>
+               <dependency>
+                       <groupId>org.onap.so.adapters</groupId>
+                       <artifactId>mso-vnfm-etsi-adapter</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
                <dependency>
                        <groupId>org.onap.so.adapters</groupId>
                        <artifactId>mso-catalog-db-adapter</artifactId>