diff options
Diffstat (limited to 'adapters/mso-vnf-adapter')
13 files changed, 470 insertions, 182 deletions
diff --git a/adapters/mso-vnf-adapter/pom.xml b/adapters/mso-vnf-adapter/pom.xml index 643f42f2ba..c4eb83c879 100644 --- a/adapters/mso-vnf-adapter/pom.xml +++ b/adapters/mso-vnf-adapter/pom.xml @@ -1,175 +1,169 @@ -<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.2.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnf-adapter</artifactId>
- <packaging>war</packaging>
- <name>mso-vnf-adapter</name>
- <description>Web Service and REST endpoint for VNF operations</description>
-
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <warSourceDirectory>WebContent</warSourceDirectory>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- <attachClasses>true</attachClasses>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jvnet.jax-ws-commons</groupId>
- <artifactId>jaxws-maven-plugin</artifactId>
- <version>2.3</version>
- <executions>
- <execution>
- <id>Synch</id>
- <goals>
- <goal>wsgen</goal>
- </goals>
- <configuration>
- <verbose>true</verbose>
- <sei>org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl</sei>
- <genWsdl>true</genWsdl>
- <inlineSchemas>true</inlineSchemas>
- </configuration>
- </execution>
- <execution>
- <id>Asynch</id>
- <goals>
- <goal>wsgen</goal>
- </goals>
- <configuration>
- <verbose>true</verbose>
- <sei>org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl</sei>
- <genWsdl>true</genWsdl>
- <inlineSchemas>true</inlineSchemas>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapter-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.xml.ws</groupId>
- <artifactId>jaxws-tools</artifactId>
- <version>2.2.7</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.jvnet.jax-ws-commons
- </groupId>
- <artifactId>
- jaxws-maven-plugin
- </artifactId>
- <versionRange>
- [2.3,)
- </versionRange>
- <goals>
- <goal>wsgen</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapter-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapters-rest-interface</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnf-adapter-async-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax</groupId>
- <artifactId>javaee-web-api</artifactId>
- <version>6.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.spec.javax.ejb</groupId>
- <artifactId>jboss-ejb-api_3.2_spec</artifactId>
- <version>1.0.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-ext-api</artifactId>
- <version>2.2.0.Final</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>status-control</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>aria-client</artifactId>
- <version>1.2.0</version>
- </dependency>
- <dependency>
- <groupId>org.jmockit</groupId>
- <artifactId>jmockit</artifactId>
- <version>1.8</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
- <!-- <dependency> -->
- <!-- <groupId>org.onap.so</groupId> -->
- <!-- <artifactId>mso-catalog-db</artifactId> -->
- <!-- <version>${project.version}</version> -->
- <!-- </dependency> -->
- <!-- <dependency> -->
- <!-- <groupId>log4j</groupId> -->
- <!-- <artifactId>log4j</artifactId> -->
- <!-- <version>1.2.17</version> -->
- <!-- </dependency> -->
- </dependencies>
-</project>
+<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.2.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnf-adapter</artifactId> + <packaging>war</packaging> + <name>mso-vnf-adapter</name> + <description>Web Service and REST endpoint for VNF operations</description> + + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <artifactId>maven-war-plugin</artifactId> + <version>2.4</version> + <configuration> + <warSourceDirectory>WebContent</warSourceDirectory> + <failOnMissingWebXml>false</failOnMissingWebXml> + <attachClasses>true</attachClasses> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxws-maven-plugin</artifactId> + <version>2.4.1</version> + <executions> + <execution> + <id>Synch</id> + <goals> + <goal>wsgen</goal> + </goals> + <configuration> + <verbose>true</verbose> + <sei>org.openecomp.mso.adapters.vnf.MsoVnfAdapterImpl</sei> + <genWsdl>true</genWsdl> + <inlineSchemas>true</inlineSchemas> + </configuration> + </execution> + <execution> + <id>Asynch</id> + <goals> + <goal>wsgen</goal> + </goals> + <configuration> + <verbose>true</verbose> + <sei>org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsyncImpl</sei> + <genWsdl>true</genWsdl> + <inlineSchemas>true</inlineSchemas> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-adapter-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.sun.xml.ws</groupId> + <artifactId>jaxws-tools</artifactId> + <version>2.2.7</version> + </dependency> + </dependencies> + </plugin> + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings + only. It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.codehaus.mojo + </groupId> + <artifactId> + jaxws-maven-plugin + </artifactId> + <versionRange> + [2.4.1,) + </versionRange> + <goals> + <goal>wsgen</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + <dependencies> + <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-adapter-utils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-adapters-rest-interface</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so.adapters</groupId> + <artifactId>mso-vnf-adapter-async-client</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>javax</groupId> + <artifactId>javaee-web-api</artifactId> + <version>6.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.jboss.spec.javax.ejb</groupId> + <artifactId>jboss-ejb-api_3.2_spec</artifactId> + <version>1.0.0.Final</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.jboss.ejb3</groupId> + <artifactId>jboss-ejb3-ext-api</artifactId> + <version>2.2.0.Final</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>status-control</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>aria-client</artifactId> + <version>1.2.0</version> + </dependency> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>1.8</version> + <scope>test</scope> + </dependency> + <!-- <dependency> --> + <!-- <groupId>org.onap.so</groupId> --> + <!-- <artifactId>mso-catalog-db</artifactId> --> + <!-- <version>${project.version}</version> --> + <!-- </dependency> --> + <!-- <dependency> --> + <!-- <groupId>log4j</groupId> --> + <!-- <artifactId>log4j</artifactId> --> + <!-- <version>1.2.17</version> --> + <!-- </dependency> --> + </dependencies> +</project> diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java new file mode 100644 index 0000000000..12e2fa04e5 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 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.openecomp.mso.adapters.vnf; + +import org.junit.Test; + +public class HealthCheckHandlerTest { + + HealthCheckHandler healthCheckHandler = new HealthCheckHandler(); + + @Test(expected = ClassFormatError.class) + public void healthcheckTest() throws Exception { + healthCheckHandler.healthcheck("req-123"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index 0d737fb2ba..b00b7a0e36 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vnf.test;
+package org.openecomp.mso.adapters.vnf;
import java.util.HashMap;
import java.util.Map;
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java index ade234e14e..d1c090dc9e 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vnf.test;
+package org.openecomp.mso.adapters.vnf;
import java.util.HashMap;
import java.util.Map;
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index e9732d6f35..a773d13bb1 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.vnf.test;
+package org.openecomp.mso.adapters.vnf;
import java.util.HashMap;
import java.util.Map;
diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java index deb1252492..8ee9d7f8f1 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnf.test; +package org.openecomp.mso.adapters.vnf; import static org.junit.Assert.assertFalse; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestExceptionTest.java new file mode 100644 index 0000000000..2b258d646a --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestExceptionTest.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf; + +import org.junit.Test; +import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; + +public class VnfAdapterRestExceptionTest { + + VnfAdapterRest vnfAdapterRest = new VnfAdapterRest(); + + @Test(expected = ClassFormatError.class) + public void healthcheckClassFormatError() throws Exception { + vnfAdapterRest.healthcheck(); + } + + @Test(expected = ClassFormatError.class) + public void deleteVfModuleClassFormatError() throws Exception { + DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setVfModuleId("moduleid"); + deleteVfModuleRequest.setVnfId("vnfid"); + vnfAdapterRest.deleteVfModule("vnfid", "moduleid", deleteVfModuleRequest); + } + + @Test(expected = NullPointerException.class) + public void queryVfModuleNullPointerException() throws Exception { + vnfAdapterRest.queryVfModule("vnfid", "vfmoduleid", "cloudid", "tenantid", "modulename", true, "req-id", "sinstanceid"); + } + + @Test(expected = ClassFormatError.class) + public void createVfModuleClassFormatError() throws Exception { + CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest(); + createVfModuleRequest.setVnfId("vnfid"); + vnfAdapterRest.createVfModule("vnfid", createVfModuleRequest); + } + + @Test(expected = ClassFormatError.class) + public void updateVfModuleClassFormatError() throws Exception { + UpdateVfModuleRequest updateVfModuleRequest = new UpdateVfModuleRequest(); + updateVfModuleRequest.setVnfId("vnfid"); + updateVfModuleRequest.setVfModuleId("moduleid"); + vnfAdapterRest.updateVfModule("vnfid", "moduleid", updateVfModuleRequest); + } + + @Test(expected = NullPointerException.class) + public void rollbackVfModuleNullPointerException() throws Exception { + RollbackVfModuleRequest rollbackVfModuleRequest = new RollbackVfModuleRequest(); + vnfAdapterRest.rollbackVfModule("vnfid", "moduleid", rollbackVfModuleRequest); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java new file mode 100644 index 0000000000..b74fe49b90 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf; + +import org.junit.Test; +import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; + +public class VnfAdapterRestV2ExceptionTest { + + VnfAdapterRestV2 vnfAdapterRestV2 = new VnfAdapterRestV2(); + + @Test(expected = ClassFormatError.class) + public void healthcheck() throws Exception { + vnfAdapterRestV2.healthcheck(); + } + + @Test(expected = ClassFormatError.class) + public void deleteVfModuleClassFormatError() throws Exception { + DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setVnfId("vnfid"); + deleteVfModuleRequest.setVfModuleId("moduleid"); + vnfAdapterRestV2.deleteVfModule("vnfid", "moduleid", "mode", deleteVfModuleRequest); + } + + @Test(expected = NullPointerException.class) + public void queryVfModuleNullPointerException() throws Exception { + vnfAdapterRestV2.queryVfModule("vnfid", "moduleid", "cloudid", "teanantid", "vfmodulename", true, "requestid", "serviceinstanceid", "mode"); + } + + @Test(expected = ClassFormatError.class) + public void createVfModuleClassFormatError() throws Exception { + vnfAdapterRestV2.createVfModule("vnfid", "create", new CreateVfModuleRequest()); + } + + @Test(expected = ClassFormatError.class) + public void updateVfModulClassFormatErrore() throws Exception { + vnfAdapterRestV2.updateVfModule("vnfid", "moduleid", "mode", new UpdateVfModuleRequest()); + } + + @Test(expected = NullPointerException.class) + public void rollbackVfModuleNullPointerException() throws Exception { + vnfAdapterRestV2.rollbackVfModule("vnfid", "moduleid", new RollbackVfModuleRequest()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java index c4f3be43f5..a807aafd24 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnf.test; +package org.openecomp.mso.adapters.vnf; import java.util.HashMap; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java index 8fbfda1b1e..a820202855 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnf.test; +package org.openecomp.mso.adapters.vnf; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java index 76d73cd70b..aca88f3352 100644 --- a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.adapters.vnf.test; +package org.openecomp.mso.adapters.vnf; import java.util.Map; diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestExceptionTest.java new file mode 100644 index 0000000000..26acc9b233 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestExceptionTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf; + +import org.junit.Test; +import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; + +public class VolumeAdapterRestExceptionTest { + + VolumeAdapterRest volumeAdapterRest = new VolumeAdapterRest(); + + @Test(expected = ClassFormatError.class) + public void createVNFVolumesClassFormatError() throws Exception { + volumeAdapterRest.createVNFVolumes(new CreateVolumeGroupRequest()); + } + + @Test(expected = ClassFormatError.class) + public void deleteVNFVolumesClassFormatError() throws Exception { + volumeAdapterRest.deleteVNFVolumes("grpid", new DeleteVolumeGroupRequest()); + } + + @Test(expected = ClassFormatError.class) + public void rollbackVNFVolumesClassFormatError() throws Exception { + volumeAdapterRest.rollbackVNFVolumes("grpid", new RollbackVolumeGroupRequest()); + } + + @Test(expected = ClassFormatError.class) + public void updateVNFVolumesClassFormatError() throws Exception { + volumeAdapterRest.updateVNFVolumes("grpid", new UpdateVolumeGroupRequest()); + } + + @Test(expected = NullPointerException.class) + public void queryVNFVolumesNullPointerException() throws Exception { + volumeAdapterRest.queryVNFVolumes("grpid", "cloudid", "tenantid", "stackid", true, "requestid", "serviceid"); + } + + @Test + public void testMap() throws Exception { + volumeAdapterRest.testMap(); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java new file mode 100644 index 0000000000..52e78a2a79 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf; + +import org.junit.Test; +import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; +import org.openecomp.mso.adapters.vnfrest.VolumeGroupRollback; + +public class VolumeAdapterRestV2ExceptionTest { + + VolumeAdapterRestV2 volumeAdapterRestV2 = new VolumeAdapterRestV2(); + + @Test(expected = ClassFormatError.class) + public void createVNFVolumesClassFormatError() throws Exception { + volumeAdapterRestV2.createVNFVolumes("mode", new CreateVolumeGroupRequest()); + } + + @Test(expected = ClassFormatError.class) + public void deleteVNFVolumesClassFormatError() throws Exception { + volumeAdapterRestV2.deleteVNFVolumes("volumegrpid", "mode", new DeleteVolumeGroupRequest()); + } + + @Test(expected = ClassFormatError.class) + public void rollbackVNFVolumesClassFormatError() throws Exception { + RollbackVolumeGroupRequest rollbackVolumeGroupRequest = new RollbackVolumeGroupRequest(); + VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback(); + volumeGroupRollback.setVolumeGroupId("grpid"); + rollbackVolumeGroupRequest.setVolumeGroupRollback(volumeGroupRollback); + volumeAdapterRestV2.rollbackVNFVolumes("grpid", rollbackVolumeGroupRequest); + } + + @Test(expected = ClassFormatError.class) + public void updateVNFVolumesClassFormatError() throws Exception { + volumeAdapterRestV2.updateVNFVolumes("vgid", "mode", new UpdateVolumeGroupRequest()); + } + + @Test(expected = NullPointerException.class) + public void queryVNFVolumesNullPointerException() throws Exception { + volumeAdapterRestV2.queryVNFVolumes("vgid", "cloudid", "tenantid", + "stackid", true, "test", "test", "test"); + } + +}
\ No newline at end of file |