diff options
112 files changed, 6397 insertions, 1742 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java new file mode 100644 index 0000000000..2729cf8620 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.cloudify.beans; + +import org.junit.Test; +import org.openecomp.mso.cloudify.v3.model.Execution; + +import java.util.HashMap; + +public class DeploymentInfoTest { + + DeploymentInfo deploymentInfo = new DeploymentInfo(); + + @Test + public void getId() throws Exception { + deploymentInfo.getId(); + } + + @Test + public void setId() throws Exception { + deploymentInfo.setId("test"); + } + + @Test + public void getStatus() throws Exception { + deploymentInfo.getStatus(); + } + + @Test + public void setStatus() throws Exception { + deploymentInfo.setStatus(DeploymentStatus.CREATED); + } + + @Test + public void getOutputs() throws Exception { + deploymentInfo.getOutputs(); + } + + @Test + public void setOutputs() throws Exception { + deploymentInfo.setOutputs(new HashMap<>()); + } + + @Test + public void getInputs() throws Exception { + deploymentInfo.getInputs(); + } + + @Test + public void setInputs() throws Exception { + deploymentInfo.setInputs(new HashMap<>()); + } + + @Test + public void getActionStatus() throws Exception { + deploymentInfo.getActionStatus(); + } + + @Test + public void getErrorMessage() throws Exception { + deploymentInfo.getErrorMessage(); + } + + @Test + public void saveExecutionStatus() throws Exception { + deploymentInfo.saveExecutionStatus(new Execution()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java new file mode 100644 index 0000000000..d4389bf7aa --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.cloudify.exceptions; + +import org.junit.Test; + +public class MsoCloudifyExceptionTest { + + MsoCloudifyException msoCloudifyException = new MsoCloudifyException(0, "test", "test"); + + @Test + public void setPendingWorkflow() throws Exception { + msoCloudifyException.setPendingWorkflow(true); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java new file mode 100644 index 0000000000..64b8823d1c --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.cloudify.exceptions; + +import org.junit.Test; +import org.openecomp.mso.cloudify.v3.model.Execution; + +public class MsoCloudifyTimeoutTest { + + MsoCloudifyTimeout msoCloudifyTimeout = new MsoCloudifyTimeout(new Execution()); + + @Test + public void getExecution() throws Exception { + msoCloudifyTimeout.getExecution(); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java new file mode 100644 index 0000000000..14f0485ba1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java @@ -0,0 +1,48 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +public class HostRouteTest { + + HostRoute hostRoute = new HostRoute(); + + @Test + public void getPrefix() throws Exception { + hostRoute.getPrefix(); + } + + @Test + public void setPrefix() throws Exception { + hostRoute.setPrefix("192.168.21/0"); + } + + @Test + public void getNextHop() throws Exception { + hostRoute.setNextHop("127.0.0.1"); + } + + @Test + public void setNextHop() throws Exception { + hostRoute.setNextHop("127.0.0.1"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java new file mode 100644 index 0000000000..6e1f392c80 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java @@ -0,0 +1,60 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +import java.util.HashMap; + +public class MsoTenantTest { + + MsoTenant msoTenant = new MsoTenant(); + + @Test + public void getTenantId() throws Exception { + msoTenant.getTenantId(); + } + + @Test + public void setTenantId() throws Exception { + msoTenant.setTenantId("id-123"); + } + + @Test + public void getTenantName() throws Exception { + msoTenant.getTenantName(); + } + + @Test + public void setTenantName() throws Exception { + msoTenant.setTenantName("test"); + } + + @Test + public void getMetadata() throws Exception { + msoTenant.getMetadata(); + } + + @Test + public void setMetadata() throws Exception { + msoTenant.setMetadata(new HashMap<>()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java new file mode 100644 index 0000000000..ec0b917a3d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java @@ -0,0 +1,86 @@ +/*- + * ============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.openstack.beans; + +import com.woorea.openstack.quantum.model.Network; +import org.junit.Test; + +import java.util.Arrays; + +public class NetworkInfoTest { + + NetworkInfo networkInfo = new NetworkInfo(new Network()); + + @Test + public void getName() throws Exception { + networkInfo.getName(); + } + + @Test + public void setName() throws Exception { + networkInfo.setName("test"); + } + + @Test + public void getId() throws Exception { + networkInfo.getId(); + } + + @Test + public void setId() throws Exception { + networkInfo.setId("test"); + } + + @Test + public void getStatus() throws Exception { + networkInfo.getStatus(); + } + + @Test + public void setStatus() throws Exception { + networkInfo.setStatus(null); + } + + @Test + public void getProvider() throws Exception { + networkInfo.getProvider(); + } + + @Test + public void setProvider() throws Exception { + networkInfo.setProvider("provider"); + } + + @Test + public void getVlans() throws Exception { + networkInfo.getVlans(); + } + + @Test + public void setVlans() throws Exception { + networkInfo.setVlans(Arrays.asList(10, 20, 30)); + } + + @Test + public void getSubnets() throws Exception { + networkInfo.getSubnets(); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java new file mode 100644 index 0000000000..b6245f642f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java @@ -0,0 +1,151 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; +import org.openecomp.mso.entity.MsoRequest; + +import java.util.Arrays; + +public class NetworkRollbackTest { + + NetworkRollback networkRollback = new NetworkRollback(); + + @Test + public void getNetworkId() throws Exception { + networkRollback.getNetworkId(); + } + + @Test + public void setNetworkId() throws Exception { + networkRollback.setNetworkId("255.255.255.0"); + } + + @Test + public void getNeutronNetworkId() throws Exception { + networkRollback.getNeutronNetworkId(); + } + + @Test + public void setNeutronNetworkId() throws Exception { + networkRollback.setNeutronNetworkId("192.168.0.0"); + } + + @Test + public void getNetworkStackId() throws Exception { + networkRollback.getNetworkStackId(); + } + + @Test + public void setNetworkStackId() throws Exception { + networkRollback.setNetworkStackId("id-123"); + } + + @Test + public void getTenantId() throws Exception { + networkRollback.getTenantId(); + } + + @Test + public void setTenantId() throws Exception { + networkRollback.setTenantId("id-123"); + } + + @Test + public void getCloudId() throws Exception { + networkRollback.getCloudId(); + } + + @Test + public void setCloudId() throws Exception { + networkRollback.setCloudId("id-123"); + } + + @Test + public void getNetworkType() throws Exception { + networkRollback.getNetworkType(); + } + + @Test + public void setNetworkType() throws Exception { + networkRollback.setNetworkType("type"); + } + + @Test + public void getModelCustomizationUuid() throws Exception { + networkRollback.getModelCustomizationUuid(); + } + + @Test + public void setModelCustomizationUuid() throws Exception { + networkRollback.setModelCustomizationUuid("id-123"); + } + + @Test + public void getNetworkCreated() throws Exception { + networkRollback.getNetworkCreated(); + } + + @Test + public void setNetworkCreated() throws Exception { + networkRollback.setNetworkCreated(true); + } + + @Test + public void getNetworkName() throws Exception { + networkRollback.getNetworkName(); + } + + @Test + public void setNetworkName() throws Exception { + networkRollback.setNetworkName("test"); + } + + @Test + public void getPhysicalNetwork() throws Exception { + networkRollback.getPhysicalNetwork(); + } + + @Test + public void setPhysicalNetwork() throws Exception { + networkRollback.setPhysicalNetwork("test"); + } + + @Test + public void getVlans() throws Exception { + networkRollback.getVlans(); + } + + @Test + public void setVlans() throws Exception { + networkRollback.setVlans(Arrays.asList(10, 20)); + } + + @Test + public void getMsoRequest() throws Exception { + networkRollback.getMsoRequest(); + } + + @Test + public void setMsoRequest() throws Exception { + networkRollback.setMsoRequest(new MsoRequest()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java new file mode 100644 index 0000000000..9795c18197 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java @@ -0,0 +1,48 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +public class PoolTest { + + Pool pool = new Pool(); + + @Test + public void getStart() throws Exception { + pool.getStart(); + } + + @Test + public void setStart() throws Exception { + pool.setStart("test"); + } + + @Test + public void getEnd() throws Exception { + pool.getEnd(); + } + + @Test + public void setEnd() throws Exception { + pool.setEnd("test"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java new file mode 100644 index 0000000000..fd34f48276 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java @@ -0,0 +1,48 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +public class RouteTargetTest { + + RouteTarget routeTarget = new RouteTarget(); + + @Test + public void getRouteTarget() throws Exception { + routeTarget.getRouteTarget(); + } + + @Test + public void setRouteTarget() throws Exception { + routeTarget.setRouteTarget("1.1.1.1"); + } + + @Test + public void getRouteTargetRole() throws Exception { + routeTarget.getRouteTargetRole(); + } + + @Test + public void setRole() throws Exception { + routeTarget.setRole("test"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java new file mode 100644 index 0000000000..b549b5f853 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java @@ -0,0 +1,90 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +import java.util.HashMap; + +public class StackInfoTest { + + StackInfo stackInfo = new StackInfo(); + + @Test + public void getName() throws Exception { + stackInfo.getName(); + } + + @Test + public void setName() throws Exception { + stackInfo.setName("test"); + } + + @Test + public void getCanonicalName() throws Exception { + stackInfo.getCanonicalName(); + } + + @Test + public void setCanonicalName() throws Exception { + stackInfo.setCanonicalName("test"); + } + + @Test + public void getStatus() throws Exception { + stackInfo.getStatus(); + } + + @Test + public void setStatus() throws Exception { + stackInfo.setStatus(HeatStatus.BUILDING); + } + + @Test + public void getStatusMessage() throws Exception { + stackInfo.getStatusMessage(); + } + + @Test + public void setStatusMessage() throws Exception { + stackInfo.setStatusMessage("test"); + } + + @Test + public void getOutputs() throws Exception { + stackInfo.getOutputs(); + } + + @Test + public void setOutputs() throws Exception { + stackInfo.setOutputs(new HashMap<>()); + } + + @Test + public void getParameters() throws Exception { + stackInfo.getParameters(); + } + + @Test + public void setParameters() throws Exception { + stackInfo.setParameters(new HashMap<>()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java new file mode 100644 index 0000000000..42781c04d1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java @@ -0,0 +1,141 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collections; + +public class SubnetTest { + + Subnet subnet = new Subnet(); + + @Test + public void getSubnetName() throws Exception { + subnet.getSubnetName(); + } + + @Test + public void setSubnetName() throws Exception { + subnet.setSubnetName("test"); + } + + @Test + public void getAllocationPools() throws Exception { + subnet.getAllocationPools(); + } + + @Test + public void getCidr() throws Exception { + subnet.getCidr(); + } + + @Test + public void getDnsNameServers() throws Exception { + subnet.getDnsNameServers(); + } + + @Test + public void getEnableDHCP() throws Exception { + subnet.getEnableDHCP(); + } + + @Test + public void getAddrFromStart() throws Exception { + subnet.getAddrFromStart(); + } + + @Test + public void setAddrFromStart() throws Exception { + subnet.setAddrFromStart(true); + } + + @Test + public void getGatewayIp() throws Exception { + subnet.getGatewayIp(); + } + + @Test + public void getHostRoutes() throws Exception { + subnet.getHostRoutes(); + } + + @Test + public void getNeutronId() throws Exception { + subnet.getNeutronId(); + } + + @Test + public void getIpVersion() throws Exception { + subnet.getIpVersion(); + } + + @Test + public void getSubnetId() throws Exception { + subnet.getSubnetId(); + } + + @Test + public void setAllocationPools() throws Exception { + subnet.setAllocationPools(Arrays.asList()); + } + + @Test + public void setCidr() throws Exception { + subnet.setCidr("255.255.255.0"); + } + + @Test + public void setDnsNameServers() throws Exception { + subnet.setDnsNameServers(Arrays.asList()); + } + + @Test + public void setEnableDHCP() throws Exception { + subnet.setEnableDHCP(true); + } + + @Test + public void setGatewayIp() throws Exception { + subnet.setGatewayIp("192.168.0.1"); + } + + @Test + public void setHostRoutes() throws Exception { + subnet.setHostRoutes(Collections.emptyList()); + } + + @Test + public void setNeutronId() throws Exception { + subnet.setNeutronId("test"); + } + + @Test + public void setIpVersion() throws Exception { + subnet.setIpVersion("ipv4"); + } + + @Test + public void setSubnetId() throws Exception { + subnet.setSubnetId("1.0.0.0"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java new file mode 100644 index 0000000000..9891811b86 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java @@ -0,0 +1,179 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; +import org.openecomp.mso.entity.MsoRequest; + +public class VnfRollbackTest { + + VnfRollback vnfRollback = new VnfRollback(); + + @Test + public void getVnfId() throws Exception { + vnfRollback.getVnfId(); + } + + @Test + public void setVnfId() throws Exception { + vnfRollback.setVnfId("test"); + } + + @Test + public void getTenantId() throws Exception { + vnfRollback.getTenantId(); + } + + @Test + public void setTenantId() throws Exception { + vnfRollback.setTenantId("test"); + } + + @Test + public void getCloudSiteId() throws Exception { + vnfRollback.getCloudSiteId(); + } + + @Test + public void setCloudSiteId() throws Exception { + vnfRollback.setCloudSiteId("test"); + } + + @Test + public void getTenantCreated() throws Exception { + vnfRollback.getTenantCreated(); + } + + @Test + public void setTenantCreated() throws Exception { + vnfRollback.setTenantCreated(true); + } + + @Test + public void getVnfCreated() throws Exception { + vnfRollback.getVnfCreated(); + } + + @Test + public void setVnfCreated() throws Exception { + vnfRollback.setVnfCreated(true); + } + + @Test + public void getMsoRequest() throws Exception { + vnfRollback.getMsoRequest(); + } + + @Test + public void setMsoRequest() throws Exception { + vnfRollback.setMsoRequest(new MsoRequest()); + } + + @Test + public void getVolumeGroupName() throws Exception { + vnfRollback.getVolumeGroupName(); + } + + @Test + public void setVolumeGroupName() throws Exception { + vnfRollback.setVolumeGroupName("test"); + } + + @Test + public void getVolumeGroupId() throws Exception { + vnfRollback.getVolumeGroupId(); + } + + @Test + public void setVolumeGroupId() throws Exception { + vnfRollback.setVolumeGroupId("test"); + } + + @Test + public void getRequestType() throws Exception { + vnfRollback.getRequestType(); + } + + @Test + public void setRequestType() throws Exception { + vnfRollback.setRequestType("test"); + } + + @Test + public void getVolumeGroupHeatStackId() throws Exception { + vnfRollback.getVolumeGroupHeatStackId(); + } + + @Test + public void setVolumeGroupHeatStackId() throws Exception { + vnfRollback.setVolumeGroupHeatStackId("test"); + } + + @Test + public void getBaseGroupHeatStackId() throws Exception { + vnfRollback.getBaseGroupHeatStackId(); + } + + @Test + public void setBaseGroupHeatStackId() throws Exception { + vnfRollback.setBaseGroupHeatStackId("test"); + } + + @Test + public void isBase() throws Exception { + vnfRollback.isBase(); + } + + @Test + public void setIsBase() throws Exception { + vnfRollback.setIsBase(true); + } + + @Test + public void getVfModuleStackId() throws Exception { + vnfRollback.getVfModuleStackId(); + } + + @Test + public void setVfModuleStackId() throws Exception { + vnfRollback.setVfModuleStackId("test"); + } + + @Test + public void getModelCustomizationUuid() throws Exception { + vnfRollback.getModelCustomizationUuid(); + } + + @Test + public void setModelCustomizationUuid() throws Exception { + vnfRollback.setModelCustomizationUuid("test"); + } + + @Test + public void getMode() throws Exception { + vnfRollback.getMode(); + } + + @Test + public void setMode() throws Exception { + vnfRollback.setMode("test"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index 67b1f3124e..67d81dbb49 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -45,7 +45,7 @@ jaxws-maven-plugin </artifactId> <versionRange> - [2.3,) + [2.3.1,) </versionRange> <goals> <goal>wsgen</goal> @@ -87,12 +87,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <version>1.3</version> - <scope>test</scope> -</dependency> -<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImplTest.java new file mode 100644 index 0000000000..506b3bd95f --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImplTest.java @@ -0,0 +1,74 @@ +/*- + * ============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.requestsdb; + +import org.junit.Test; + +public class MsoRequestsDbAdapterImplTest { + + // TODO: following test case is done for coverage + // later it should be modified for proper test. + MsoRequestsDbAdapterImpl msoRequestsDbAdapter = new MsoRequestsDbAdapterImpl(); + + @Test(expected = NullPointerException.class) + public void updateInfraRequest() throws Exception { + msoRequestsDbAdapter.updateInfraRequest("test", "test", + "test", "test", RequestStatusType.COMPLETE, "test", + "test", "test", "test", "test", + "test", "test", "test", + "test", "test", "tets"); + } + + @Test(expected = NullPointerException.class) + public void getInfraRequest() throws Exception { + msoRequestsDbAdapter.getInfraRequest("test"); + } + + @Test(expected = NullPointerException.class) + public void getSiteStatus() throws Exception { + msoRequestsDbAdapter.getSiteStatus("test"); + } + + @Test(expected = NullPointerException.class) + public void updateServiceOperationStatus() throws Exception { + msoRequestsDbAdapter.updateServiceOperationStatus("test", "test", + "test", "test", "test", "test", + "test", "test"); + } + + @Test(expected = NullPointerException.class) + public void initResourceOperationStatus() throws Exception { + msoRequestsDbAdapter.initResourceOperationStatus("test", "test", "test", "uuid"); + } + + @Test(expected = NullPointerException.class) + public void getResourceOperationStatus() throws Exception { + msoRequestsDbAdapter.getResourceOperationStatus("test", "test", "uuid"); + } + + @Test(expected = NullPointerException.class) + public void updateResourceOperationStatus() throws Exception { + msoRequestsDbAdapter.updateResourceOperationStatus("test", "test", + "uuid", "type", "instance-id", + "jobid", "test", "progress", "errorcode", + "status-desc"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-tenant-adapter/pom.xml b/adapters/mso-tenant-adapter/pom.xml index 6604e7e664..0b15b0dd6f 100644 --- a/adapters/mso-tenant-adapter/pom.xml +++ b/adapters/mso-tenant-adapter/pom.xml @@ -151,11 +151,5 @@ <artifactId>status-control</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> </dependencies> </project> diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java new file mode 100644 index 0000000000..e60a143b11 --- /dev/null +++ b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java @@ -0,0 +1,64 @@ +/*- + * ============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.tenant; + +import org.junit.Test; +import org.openecomp.mso.adapters.tenantrest.TenantRollback; +import org.openecomp.mso.entity.MsoRequest; + +import javax.validation.constraints.Null; +import javax.xml.ws.Holder; +import java.util.HashMap; + +public class MsoTenantAdapterImplTest { + + // TODO: following test case is done for coverage + // later it should be modified for proper test. + + MsoTenantAdapterImpl msoTenantAdapter = new MsoTenantAdapterImpl(); + + @Test + public void healthCheck() throws Exception { + msoTenantAdapter.healthCheck(); + } + + @Test(expected = NullPointerException.class) + public void createTenant() throws Exception { + msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(), + true, true, new MsoRequest(), new Holder(), new Holder()); + } + + @Test(expected = NullPointerException.class) + public void queryTenant() throws Exception { + msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(), + new Holder<>(), new Holder<>(), new Holder<>()); + } + + @Test(expected = NullPointerException.class) + public void deleteTenant() throws Exception { + msoTenantAdapter.deleteTenant("cloud", "tenant", new MsoRequest(), new Holder()); + } + + @Test + public void rollbackTenant() throws Exception { + msoTenantAdapter.rollbackTenant(new TenantRollback()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java new file mode 100644 index 0000000000..e4203baef8 --- /dev/null +++ b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java @@ -0,0 +1,59 @@ +/*- + * ============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.tenant; + +import org.junit.Test; +import org.openecomp.mso.adapters.tenantrest.CreateTenantRequest; +import org.openecomp.mso.adapters.tenantrest.DeleteTenantRequest; +import org.openecomp.mso.adapters.tenantrest.RollbackTenantRequest; + +public class TenantAdapterRestTest { + + // TODO: following test case is done for coverage + // later it should be modified for proper test. + + TenantAdapterRest tenantAdapterRest = new TenantAdapterRest(); + + @Test(expected = ClassFormatError.class) + public void healthcheck() throws Exception { + tenantAdapterRest.healthcheck(); + } + + @Test(expected = ClassFormatError.class) + public void createTenant() throws Exception { + tenantAdapterRest.createTenant(new CreateTenantRequest()); + } + + @Test(expected = ClassFormatError.class) + public void deleteTenant() throws Exception { + tenantAdapterRest.deleteTenant("test", new DeleteTenantRequest()); + } + + @Test(expected = ClassFormatError.class) + public void queryTenant() throws Exception { + tenantAdapterRest.queryTenant("test", "test", "requestid", "serviceInstanceId"); + } + + @Test(expected = ClassFormatError.class) + public void rollbackTenant() throws Exception { + tenantAdapterRest.rollbackTenant("action", new RollbackTenantRequest()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java new file mode 100644 index 0000000000..293c037eca --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java @@ -0,0 +1,49 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class CustomerModelTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + CustomerModel customerModel = new CustomerModel(); + + @Test + public void getGlobalCustomerId() throws Exception { + customerModel.getGlobalCustomerId(); + } + + @Test + public void setGlobalCustomerId() throws Exception { + customerModel.setGlobalCustomerId("test"); + } + + @Test + public void getServiceType() throws Exception { + customerModel.getServiceType(); + } + + @Test + public void setServiceType() throws Exception { + customerModel.setServiceType("service"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java new file mode 100644 index 0000000000..e4b275cd41 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java @@ -0,0 +1,49 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class LocationConstraintTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + LocationConstraint locationConstraint = new LocationConstraint(); + + @Test + public void getVnfProfileId() throws Exception { + locationConstraint.getVnfProfileId(); + } + + @Test + public void setVnfProfileId() throws Exception { + locationConstraint.setVnfProfileId("profileID"); + } + + @Test + public void getLocationConstraints() throws Exception { + locationConstraint.getLocationConstraints(); + } + + @Test + public void setLocationConstraints() throws Exception { + locationConstraint.setLocationConstraints(new VimLocation()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java new file mode 100644 index 0000000000..3e6aeded20 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java @@ -0,0 +1,69 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class NSResourceInputParameterTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter(); + + @Test + public void getNsServiceName() throws Exception { + nsResourceInputParameter.getNsServiceName(); + } + + @Test + public void setNsServiceName() throws Exception { + nsResourceInputParameter.setNsServiceName("service"); + } + + @Test + public void getNsServiceDescription() throws Exception { + nsResourceInputParameter.getNsServiceDescription(); + } + + @Test + public void setNsServiceDescription() throws Exception { + nsResourceInputParameter.setNsServiceDescription("desc"); + } + + @Test + public void getNsParameters() throws Exception { + nsResourceInputParameter.getNsParameters(); + } + + @Test + public void setNsParameters() throws Exception { + nsResourceInputParameter.setNsParameters(new NsParameters()); + } + + @Test + public void getNsOperationKey() throws Exception { + nsResourceInputParameter.getNsOperationKey(); + } + + @Test + public void setNsOperationKey() throws Exception { + nsResourceInputParameter.setNsOperationKey(new NsOperationKey()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java new file mode 100644 index 0000000000..56a06173e0 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java @@ -0,0 +1,69 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class NsCreateReqTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsCreateReq nsCreateReq = new NsCreateReq(); + + @Test + public void getContext() throws Exception { + nsCreateReq.getContext(); + } + + @Test + public void setContext() throws Exception { + nsCreateReq.setContext(new CustomerModel()); + } + + @Test + public void getCsarId() throws Exception { + nsCreateReq.getCsarId(); + } + + @Test + public void setCsarId() throws Exception { + nsCreateReq.setCsarId("csarid"); + } + + @Test + public void getNsName() throws Exception { + nsCreateReq.getNsName(); + } + + @Test + public void setNsName() throws Exception { + nsCreateReq.setNsName("nsname"); + } + + @Test + public void getDescription() throws Exception { + nsCreateReq.getDescription(); + } + + @Test + public void setDescription() throws Exception { + nsCreateReq.setDescription("desc"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java new file mode 100644 index 0000000000..d63748d9dd --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java @@ -0,0 +1,39 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class NsInstantiateReqTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsInstantiateReq nsInstantiateReq = new NsInstantiateReq(); + + @Test + public void getNsInstanceId() throws Exception { + nsInstantiateReq.getNsInstanceId(); + } + + @Test + public void setNsInstanceId() throws Exception { + nsInstantiateReq.setNsInstanceId("test"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java new file mode 100644 index 0000000000..79b5fb2b57 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java @@ -0,0 +1,79 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class NsOperationKeyTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsOperationKey nsOperationKey = new NsOperationKey(); + + @Test + public void getGlobalSubscriberId() throws Exception { + nsOperationKey.getGlobalSubscriberId(); + } + + @Test + public void setGlobalSubscriberId() throws Exception { + nsOperationKey.setGlobalSubscriberId("subscriberid"); + } + + @Test + public void getServiceType() throws Exception { + nsOperationKey.getServiceType(); + } + + @Test + public void setServiceType() throws Exception { + nsOperationKey.setServiceType("servicetype"); + } + + @Test + public void getServiceId() throws Exception { + nsOperationKey.getServiceId(); + } + + @Test + public void setServiceId() throws Exception { + nsOperationKey.setServiceId("serviceid"); + } + + @Test + public void getOperationId() throws Exception { + nsOperationKey.getOperationId(); + } + + @Test + public void setOperationId() throws Exception { + nsOperationKey.setOperationId("test"); + } + + @Test + public void getNodeTemplateUUID() throws Exception { + nsOperationKey.getNodeTemplateUUID(); + } + + @Test + public void setNodeTemplateUUID() throws Exception { + nsOperationKey.setNodeTemplateUUID("nodeTemplateid"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java new file mode 100644 index 0000000000..512c061e6d --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java @@ -0,0 +1,52 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; + +public class NsParametersTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsParameters nsParameters = new NsParameters(); + + @Test + public void getLocationConstraints() throws Exception { + nsParameters.getLocationConstraints(); + } + + @Test + public void setLocationConstraints() throws Exception { + nsParameters.setLocationConstraints(Collections.emptyList()); + } + + @Test + public void getAdditionalParamForNs() throws Exception { + nsParameters.getAdditionalParamForNs(); + } + + @Test + public void setAdditionalParamForNs() throws Exception { + nsParameters.setAdditionalParamForNs(new HashMap<>()); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java new file mode 100644 index 0000000000..2569631db3 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java @@ -0,0 +1,61 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +import java.util.Arrays; + +public class NsProgressStatusTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + NsProgressStatus nsProgressStatus = new NsProgressStatus(); + + @Test + public void getJobId() throws Exception { + nsProgressStatus.getJobId(); + } + + @Test + public void setJobId() throws Exception { + nsProgressStatus.setJobId("jobid"); + } + + @Test + public void getResponseDescriptor() throws Exception { + nsProgressStatus.getResponseDescriptor(); + } + + @Test + public void setResponseDescriptor() throws Exception { + nsProgressStatus.setResponseDescriptor(new ResponseDescriptor()); + } + + @Test + public void getResponseHistoryList() throws Exception { + nsProgressStatus.getResponseHistoryList(); + } + + @Test + public void setResponseHistoryList() throws Exception { + nsProgressStatus.setResponseHistoryList(Arrays.asList(new ResponseDescriptor())); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java new file mode 100644 index 0000000000..0bfb0df6e3 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java @@ -0,0 +1,79 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class ResponseDescriptorTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + ResponseDescriptor responseDescriptor = new ResponseDescriptor(); + + @Test + public void getStatus() throws Exception { + responseDescriptor.getStatus(); + } + + @Test + public void setStatus() throws Exception { + responseDescriptor.setStatus("test"); + } + + @Test + public void getProgress() throws Exception { + responseDescriptor.getProgress(); + } + + @Test + public void setProgress() throws Exception { + responseDescriptor.setProgress("10"); + } + + @Test + public void getStatusDescription() throws Exception { + responseDescriptor.getStatusDescription(); + } + + @Test + public void setStatusDescription() throws Exception { + responseDescriptor.setStatusDescription("test"); + } + + @Test + public void getErrorCode() throws Exception { + responseDescriptor.getErrorCode(); + } + + @Test + public void setErrorCode() throws Exception { + responseDescriptor.setErrorCode(-1); + } + + @Test + public void getResponseId() throws Exception { + responseDescriptor.getResponseId(); + } + + @Test + public void setResponseId() throws Exception { + responseDescriptor.setResponseId(1); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java new file mode 100644 index 0000000000..5117e73ac2 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java @@ -0,0 +1,76 @@ +/*- + * ============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.vfc.model; + +import org.junit.Test; + +import java.util.HashMap; + +public class RestfulResponseTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + RestfulResponse restfulResponse = new RestfulResponse(); + + @Test + public void getStatus() throws Exception { + restfulResponse.getStatus(); + } + + @Test + public void setStatus() throws Exception { + restfulResponse.setStatus(1); + } + + @Test + public void getRespHeaderMap() throws Exception { + restfulResponse.getRespHeaderMap(); + } + + @Test + public void setRespHeaderMap() throws Exception { + restfulResponse.setRespHeaderMap(new HashMap<>()); + } + + @Test + public void getRespHeaderInt() throws Exception { + restfulResponse.getRespHeaderInt("1"); + } + + @Test + public void getRespHeaderLong() throws Exception { + restfulResponse.getRespHeaderLong("1"); + } + + @Test + public void getRespHeaderStr() throws Exception { + restfulResponse.getRespHeaderStr("test"); + } + + @Test + public void getResponseContent() throws Exception { + restfulResponse.getResponseContent(); + } + + @Test + public void setResponseContent() throws Exception { + restfulResponse.setResponseContent("responseString"); + } + +}
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java new file mode 100644 index 0000000000..d3da7f6b3a --- /dev/null +++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java @@ -0,0 +1,39 @@ + +/*- + * ============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.vfc.model; + +import org.junit.Test; + +public class VimLocationTest { + // TODO: following test case is done for coverage + // later it should be modified for proper test. + VimLocation vimLocation = new VimLocation(); + + @Test + public void getVimId() throws Exception { + vimLocation.getVimId(); + } + + @Test + public void setVimId() throws Exception { + vimLocation.setVimId("vimid"); + } + +}
\ No newline at end of file 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 diff --git a/aria/aria-rest-server/pom.xml b/aria/aria-rest-server/pom.xml index 87c8f3e888..d74ea93025 100644 --- a/aria/aria-rest-server/pom.xml +++ b/aria/aria-rest-server/pom.xml @@ -86,7 +86,7 @@ </environmentVariables> </configuration> </execution> - <execution> + <!--execution> <id>deploy</id> <phase>deploy</phase> <goals><goal>exec</goal></goals> @@ -105,7 +105,7 @@ <WHEEL_PATH>${project.build.directory}/${wheel.name}</WHEEL_PATH> </environmentVariables> </configuration> - </execution> + </execution--> </executions> </plugin> </plugins> diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index a06a16ddd8..ff21372240 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -28,12 +28,6 @@ </build> <dependencies> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-all</artifactId> - <version>1.10.19</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.jmockit</groupId> <artifactId>jmockit</artifactId> diff --git a/asdc-controller/src/main/resources/resource-examples/service-MdnsPreload17100914-csar.csar b/asdc-controller/src/main/resources/resource-examples/service-MdnsPreload17100914-csar.csar Binary files differindex 31fff49889..f1a72f791a 100644 --- a/asdc-controller/src/main/resources/resource-examples/service-MdnsPreload17100914-csar.csar +++ b/asdc-controller/src/main/resources/resource-examples/service-MdnsPreload17100914-csar.csar diff --git a/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar b/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar Binary files differindex 2686e4ba57..a189ed6c04 100644 --- a/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar +++ b/asdc-controller/src/main/resources/resource-examples/service_Rg511NfmService.csar diff --git a/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar b/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar Binary files differindex d2983ce609..df4f4cb5e2 100644 --- a/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar +++ b/asdc-controller/src/main/resources/resource-examples/service_Rg516VmmscSrvc_csar.csar diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java index 787453ed28..13cff65018 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java @@ -20,21 +20,25 @@ */
package org.openecomp.mso.bpmn.common.util;
-
+import java.io.IOException;
import java.security.GeneralSecurityException;
import org.openecomp.mso.logger.MsoLogger;
+import java.util.Properties;
public class CryptoHandler implements ICryptoHandler {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
- private static String msoAaiEncryptedPwd = "C1FC4A39E16419DD41DFC1212843F440";
+ private static String msoAaiEncryptedPwd;
@Override
public String getMsoAaiPassword() {
+ Properties keyProp = new Properties ();
try {
+ keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("urn.properties"));
+ msoAaiEncryptedPwd =(String) keyProp.get ("mso.AaiEncrypted.Pwd");
return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
+ } catch (GeneralSecurityException | IOException e) {
LOGGER.debug("GeneralSecurityException :",e);
return null;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties index 5bf8e24815..12253aa9d2 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties +++ b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties @@ -27,3 +27,4 @@ AAIEndPoint= http://localhost:28090/ SDNCEndPoint=http://localhost:28090/SDNCAdapter/ msoRollback = true +mso.AaiEncrypted.Pwd = C1FC4A39E16419DD41DFC1212843F440 diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd index e743dc754e..0472e54693 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd +++ b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MSOWorkflowSchemaV1.xsd @@ -1,13 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - ========================================================================= - AT&T Proprietary (Internal Use Only) Not for use or disclosure outside - the AT&T companies except under written agreement (c) 2015 AT&T - Intellectual Property. All rights reserved. AT&T and the AT&T logo are - trademarks of AT&T Intellectual Property. - ======================================================================= - --> - <!-- ================================================================ Description: This is the schema for LPP Configuration Component diff --git a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd index ce92a4909b..c5fa26c998 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd +++ b/bpmn/MSOCommonBPMN/src/main/resources/xsd/MsoServiceRequestTypesV1.xsd @@ -1,12 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - ========================================================================= - AT&T Proprietary (Internal Use Only) Not for use or disclosure outside - the AT&T companies except under written agreement (c) 2015 AT&T - Intellectual Property. All rights reserved. AT&T and the AT&T logo are - trademarks of AT&T Intellectual Property. - ======================================================================= - --> + <!-- ================================================================ Description: This is the schema for MSO Request data diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java new file mode 100644 index 0000000000..09720be9b9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/AllottedResourceTest.java @@ -0,0 +1,57 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AllottedResourceTest {
+ private AllottedResource ar = new AllottedResource();
+ TunnelConnect tc = new TunnelConnect();
+
+ @Test
+ public void testAllottedResource() {
+ ar.setAllottedResourceType("allottedResourceType");
+ ar.setAllottedResourceRole("allottedResourceRole");
+ ar.setProvidingServiceModelName("providingServiceModelName");
+ ar.setProvidingServiceModelInvariantUuid("providingServiceModelInvariantUuid");
+ ar.setProvidingServiceModelUuid("providingServiceModelUuid");
+ ar.setNfFunction("nfFunction");
+ ar.setNfType("nfType");
+ ar.setNfRole("nfRole");
+ ar.setNfNamingCode("nfNamingCode");
+ ar.setOrchestrationStatus("orchestrationStatus");
+ ar.setTunnelConnect(tc);
+ assertEquals(ar.getAllottedResourceType(), "allottedResourceType");
+ assertEquals(ar.getAllottedResourceRole(), "allottedResourceRole");
+ assertEquals(ar.getProvidingServiceModelName(), "providingServiceModelName");
+ assertEquals(ar.getProvidingServiceModelInvariantUuid(), "providingServiceModelInvariantUuid");
+ assertEquals(ar.getProvidingServiceModelUuid(), "providingServiceModelUuid");
+ assertEquals(ar.getNfFunction(), "nfFunction");
+ assertEquals(ar.getNfType(), "nfType");
+ assertEquals(ar.getNfRole(), "nfRole");
+ assertEquals(ar.getNfNamingCode(), "nfNamingCode");
+ assertEquals(ar.getOrchestrationStatus(), "orchestrationStatus");
+ assertEquals(ar.getTunnelConnect(), tc);
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java new file mode 100644 index 0000000000..ecaf601c90 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigResourceTest.java @@ -0,0 +1,39 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ConfigResourceTest {
+ private ConfigResource configresource = new ConfigResource();{
+ configresource.resourceType = ResourceType.CONFIGURATION;
+ }
+
+ @Test
+ public void testConfigResource() {
+ configresource.setToscaNodeType("toscaNodeType");
+ assertEquals(configresource.getToscaNodeType(), "toscaNodeType");
+
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java new file mode 100644 index 0000000000..df8440addf --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ConfigurationTest.java @@ -0,0 +1,47 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ConfigurationTest {
+ private Configuration configuration = new Configuration();
+
+ @Test
+ public void testConfigurationTest() {
+ configuration.setId("id");
+ configuration.setName("name");
+ configuration.setType("type");
+ configuration.setOrchestrationStatus("orchestrationStatus");
+ configuration.setTunnelBandwidth("tunnelBandwidth");
+ configuration.setVendorAllowedMaxBandwidth("vendorAllowedMaxBandwidth");
+ configuration.setResourceVersion("resourceVersion");
+ assertEquals(configuration.getId(), "id");
+ assertEquals(configuration.getName(), "name");
+ assertEquals(configuration.getType(), "type");
+ assertEquals(configuration.getOrchestrationStatus(), "orchestrationStatus");
+ assertEquals(configuration.getTunnelBandwidth(), "tunnelBandwidth");
+ assertEquals(configuration.getVendorAllowedMaxBandwidth(), "vendorAllowedMaxBandwidth");
+ assertEquals(configuration.getResourceVersion(), "resourceVersion");
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java new file mode 100644 index 0000000000..1a4e0898ee --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CustomerTest.java @@ -0,0 +1,38 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CustomerTest {
+ private Customer customer = new Customer();
+
+ @Test
+ public void testCustomer() {
+ customer.setSubscriptionServiceType("subscriptionServiceType");
+ customer.setGlobalSubscriberId("globalSubscriberId");
+ assertEquals(customer.getSubscriptionServiceType(), "subscriptionServiceType");
+ assertEquals(customer.getGlobalSubscriberId(), "globalSubscriberId");
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java new file mode 100644 index 0000000000..e334348b5d --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/HomingSolutionTest.java @@ -0,0 +1,58 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class HomingSolutionTest {
+
+ private HomingSolution homingsolution = new HomingSolution();
+ InventoryType inventory = InventoryType.cloud;
+ VnfResource vnfresource = new VnfResource();
+ License license = new License();
+
+ @Test
+ public void testHomingSolution() {
+ homingsolution.setInventoryType(inventory);
+ homingsolution.setRehome(true);
+ homingsolution.setServiceInstanceId("serviceInstanceId");
+ homingsolution.setCloudOwner("cloudOwner");
+ homingsolution.setCloudRegionId("cloudRegionId");
+ homingsolution.setAicClli("aicClli");
+ homingsolution.setAicVersion("aicVersion");
+ homingsolution.setTenant("tenant");
+ homingsolution.setVnf(vnfresource);
+ homingsolution.setLicense(license);
+ assertEquals(homingsolution.getInventoryType(), inventory);
+ assertEquals(homingsolution.isRehome(), true);
+ assertEquals(homingsolution.getServiceInstanceId(), "serviceInstanceId");
+ assertEquals(homingsolution.getCloudOwner(), "cloudOwner");
+ assertEquals(homingsolution.getCloudRegionId(), "cloudRegionId");
+ assertEquals(homingsolution.getAicClli(), "aicClli");
+ assertEquals(homingsolution.getAicVersion(), "aicVersion");
+ assertEquals(homingsolution.getTenant(), "tenant");
+ assertEquals(homingsolution.getVnf(), vnfresource);
+ assertEquals(homingsolution.getLicense(), license);
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java new file mode 100644 index 0000000000..9ed194c455 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/LicenseTest.java @@ -0,0 +1,89 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.BDDMockito.Then;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+//@RunWith(PowerMockRunner.class)
+//@PrepareForTest({License.class})
+public class LicenseTest {
+
+ //@Mock
+ private License license= new License();
+ //@InjectMocks
+ //private LicenseTest licenceTest;
+ List<String> entitlementPoolList = new ArrayList<String>();
+ private List<String> licenseKeyGroupList = new ArrayList<String>();
+ //JSONArray array = new JSONArray(entitlementPoolList);
+ //JSONArray array1 = new JSONArray(licenseKeyGroupList);
+ //@PrepareForTest({License.class})
+ Long serialVersionUID = 333L;
+
+ @Test
+ public void testLicense() {
+ license.setEntitlementPoolList(entitlementPoolList);
+ license.setLicenseKeyGroupList(licenseKeyGroupList);
+ //license.addEntitlementPool("entitlementPoolUuid");
+ license.addLicenseKeyGroup("licenseKeyGroupUuid");
+ assertEquals(license.getEntitlementPoolList(), entitlementPoolList);
+ assertEquals(license.getLicenseKeyGroupList(), licenseKeyGroupList);
+ assert(license.getEntitlementPoolListAsString()!= null);
+ assert(license.getLicenseKeyGroupListAsString()!=null);
+ license.addEntitlementPool("entitlementPoolUuid");
+ //assertEquals(license.getSerialversionuid(), serialVersionUID);
+ //assertArrayEquals(license.getSerialversionuid(), serialVersionUID);
+ //assert
+
+ /*PowerMockito.mockStatic(License.class);
+ Mockito.when(License.getSerialversionuid()).thenReturn(getserial());
+ assertEquals(License.getSerialversionuid(),"abc");*/
+
+ }
+ // @Before
+ // public void mocksetUp() {
+// Long serialVersionUID = 333L;
+// PowerMockito.mockStatic(License.class);
+// expect (license.getSerialversionuid()).andReturn(serialVersionUID);
+// //PowerMockito.when(license.getSerialversionuid().
+// //PowerMockito.when(MathUtil.addInteger(2, 2)).thenReturn(1);
+// }
+
+ /*private Long getserial() {
+
+ return abc;
+ }*/
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java new file mode 100644 index 0000000000..90eb230a4c --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModelInfoTest.java @@ -0,0 +1,47 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ModelInfoTest {
+ private ModelInfo modelinfo = new ModelInfo();
+
+ @Test
+ public void testModelInfo() {
+ modelinfo.setModelName("modelName");
+ modelinfo.setModelUuid("modelUuid");
+ modelinfo.setModelInvariantUuid("modelInvariantUuid");
+ modelinfo.setModelVersion("modelVersion");
+ modelinfo.setModelCustomizationUuid("modelCustomizationUuid");
+ modelinfo.setModelInstanceName("modelInstanceName");
+ modelinfo.setModelType("modelType");
+ assertEquals(modelinfo.getModelName(), "modelName");
+ assertEquals(modelinfo.getModelUuid(), "modelUuid");
+ assertEquals(modelinfo.getModelInvariantUuid(), "modelInvariantUuid");
+ assertEquals(modelinfo.getModelVersion(), "modelVersion");
+ assertEquals(modelinfo.getModelCustomizationUuid(), "modelCustomizationUuid");
+ assertEquals(modelinfo.getModelInstanceName(), "modelInstanceName");
+ assertEquals(modelinfo.getModelType(), "modelType");
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java new file mode 100644 index 0000000000..58cd45c3f1 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ModuleResourceTest.java @@ -0,0 +1,48 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ModuleResourceTest {
+ private ModuleResource moduleresource = new ModuleResource();
+
+ @Test
+ public void testModuleResource() {
+
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+ assertEquals(moduleresource.getVfModuleName(), "vfModuleName");
+ assertEquals(moduleresource.getHeatStackId(), "heatStackId");
+ assertEquals(moduleresource.getIsBase(), true);
+ assertEquals(moduleresource.getVfModuleLabel(), "vfModuleLabel");
+ assertEquals(moduleresource.getInitialCount(), 0);
+ assertEquals(moduleresource.getVfModuleType(), "vfModuleType");
+ assertEquals(moduleresource.isHasVolumeGroup(), true);
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java new file mode 100644 index 0000000000..22e62663c9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/NetworkResourceTest.java @@ -0,0 +1,42 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class NetworkResourceTest {
+ private NetworkResource nr = new NetworkResource();
+
+ @Test
+ public void testNetworkResource() {
+ nr.setNetworkType("networkType");
+ nr.setNetworkRole("networkRole");
+ nr.setNetworkTechnology("networkTechnology");
+ nr.setNetworkScope("networkScope");
+ assertEquals(nr.getNetworkType(), "networkType");
+ assertEquals(nr.getNetworkRole(), "networkRole");
+ assertEquals(nr.getNetworkTechnology(), "networkTechnology");
+ assertEquals(nr.getNetworkScope(), "networkScope");
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java new file mode 100644 index 0000000000..215fa3cff9 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/OwningEntityTest.java @@ -0,0 +1,39 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class OwningEntityTest {
+ private OwningEntity oe = new OwningEntity();
+
+ @Test
+ public void testOwingEntity() {
+ oe.setOwningEntityId("owningEntityId");
+ oe.setOwningEntityName("owningEntityName");
+ assertEquals(oe.getOwningEntityId(), "owningEntityId");
+ assertEquals(oe.getOwningEntityName(), "owningEntityName");
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java new file mode 100644 index 0000000000..3a9a53f743 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ProjectTest.java @@ -0,0 +1,36 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ProjectTest {
+
+ private Project project = new Project();
+
+ @Test
+ public void testProject() {
+ project.setProjectName("projectName");
+ assertEquals(project.getProjectName(), "projectName");
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java new file mode 100644 index 0000000000..9a9d41567a --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/RequestTest.java @@ -0,0 +1,44 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RequestTest {
+
+ private Request request = new Request();
+ ModelInfo model = new ModelInfo();
+
+ @Test
+ public void testRequest() {
+ request.setSdncRequestId("sdncRequestId");
+ request.setRequestId("requestId");
+ request.setModelInfo(model);
+ request.setProductFamilyId("productFamilyId");
+ assertEquals(request.getSdncRequestId(), "sdncRequestId");
+ assertEquals(request.getRequestId(), "requestId");
+ assertEquals(request.getModelInfo(), model);
+ assertEquals(request.getProductFamilyId(), "productFamilyId");
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java new file mode 100644 index 0000000000..5eaa60260b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceDecompositionTest.java @@ -0,0 +1,50 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ResourceDecompositionTest {
+
+ private ResourceDecomposition rd = new ResourceDecomposition() {
+ private static final long serialVersionUID = 1L;
+ };
+ ModelInfo model = new ModelInfo();
+ ResourceInstance ri = new ResourceInstance();
+
+
+
+ @Test
+ public void testResourceDecomposition() {
+ rd.setModelInfo(model);
+ rd.setInstanceData(ri);
+ rd.setResourceType("resourceType");
+ rd.setResourceInstanceId("newInstanceId");
+ rd.setResourceInstanceName("newInstanceName");
+ assertEquals(rd.getResourceModel(), model);
+ assertEquals(rd.getModelInfo(), model);
+ assertEquals(rd.getInstanceData(), ri);
+ assertEquals(rd.getResourceInstanceId(), "newInstanceId");
+ assertEquals(rd.getResourceInstanceName(), "newInstanceName");
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java new file mode 100644 index 0000000000..8d6b61f4aa --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ResourceTest.java @@ -0,0 +1,68 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ResourceTest {
+ private Resource resource = new Resource() {
+ private static final long serialVersionUID = 1L;
+
+
+ };
+ ModelInfo model = new ModelInfo();
+ ResourceInstance ri = new ResourceInstance();
+ HomingSolution hs = new HomingSolution();
+ ResourceType rt = ResourceType.VNF;
+ public long concurrencyCounter = 1L;
+ long initval = resource.getConcurrencyCounter();
+
+ @Test
+ public void testResource() {
+ resource.setResourceId("resourceId");
+ resource.setModelInfo(model);
+ resource.setResourceInstance(ri);
+ resource.setHomingSolution(hs);
+ resource.setCurrentHomingSolution(hs);
+ resource.setResourceType(rt);
+ resource.setToscaNodeType("toscaNodeType");
+ resource.setResourceInstanceId("newInstanceId");
+ resource.setResourceInstanceName("newInstanceName");
+ resource.incrementConcurrencyCounter();
+ assertEquals(resource.getResourceId(), "resourceId");
+ assertEquals(resource.getModelInfo(), model);
+ assertEquals(resource.getResourceInstance(), ri);
+ assertEquals(resource.getHomingSolution(), hs);
+ assertEquals(resource.getCurrentHomingSolution(), hs);
+ assertEquals(resource.getResourceType(), rt);
+ assertEquals(resource.getToscaNodeType(), "toscaNodeType");
+ assertEquals(resource.getResourceInstanceId(), "newInstanceId");
+ assertEquals(resource.getResourceInstanceName(), "newInstanceName");
+ assertEquals(resource.getConcurrencyCounter(), initval+1);
+
+
+
+
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java new file mode 100644 index 0000000000..58548db23b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceDecompositionTest.java @@ -0,0 +1,83 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.Test;
+
+public class ServiceDecompositionTest {
+ private ServiceDecomposition sd = new ServiceDecomposition();
+ ModelInfo model= new ModelInfo();
+ ServiceInstance si= new ServiceInstance();
+ Project project= new Project();
+ OwningEntity oe= new OwningEntity();
+ //VnfResource vnf = new VnfResource();
+ List<VnfResource> vnfResources;
+ List<NetworkResource> networkResources;
+ List<ConfigResource> configResources;
+ List<AllottedResource> allottedResources;
+ Request request= new Request();
+ Customer customer= new Customer();
+
+
+ @Test
+ public void testServiceDecomposition() {
+ sd.setModelInfo(model);
+ sd.setServiceInstance(si);
+ sd.setProject(project);
+ sd.setOwningEntity(oe);
+ sd.setServiceVnfs(vnfResources);
+ sd.setServiceConfigs(configResources);
+ sd.setServiceNetworks(networkResources);
+ sd.setServiceAllottedResources(allottedResources);
+ sd.setServiceConfigResources(configResources);
+ sd.setServiceType("serviceType");
+ sd.setServiceRole("serviceRole");
+ sd.setRequest(request);
+ sd.setCustomer(customer);
+ sd.setCallbackURN("callbackURN");
+ sd.setSdncVersion("sdncVersion");
+ assertEquals(sd.getModelInfo(), model);
+ assertEquals(sd.getServiceInstance(), si);
+ assertEquals(sd.getProject(), project);
+ assertEquals(sd.getOwningEntity(), oe);
+ assertEquals(sd.getServiceVnfs(), vnfResources);
+ assertEquals(sd.getServiceConfigs(), configResources);
+ assertEquals(sd.getServiceNetworks(), networkResources);
+ assertEquals(sd.getServiceAllottedResources(), allottedResources);
+ assertEquals(sd.getServiceConfigResources(), configResources);
+ assertEquals(sd.getRequest(), request);
+ assertEquals(sd.getCustomer(), customer);
+ assertEquals(sd.getCallbackURN(), "callbackURN");
+ assertEquals(sd.getSdncVersion(), "sdncVersion");
+
+
+
+
+
+
+
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java new file mode 100644 index 0000000000..b600fef3fd --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/ServiceInstanceTest.java @@ -0,0 +1,61 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+public class ServiceInstanceTest {
+
+ private ServiceInstance si= new ServiceInstance();
+ Map serviceParams;
+ Configuration config= new Configuration();
+ ModelInfo model= new ModelInfo();
+
+ @Test
+ public void testServiceInstance() {
+ si.setServiceType("serviceType");
+ si.setServiceId("serviceId");
+ si.setServiceParams(serviceParams);
+ si.setInstanceId("instanceId");
+ si.setInstanceName("instanceName");
+ si.setOrchestrationStatus("orchestrationStatus");
+ si.setConfiguration(config);
+ si.setModelInfo(model);
+ si.setEnvironmentContext("environmentContext");
+ si.setWorkloadContext("workloadContext");
+ assertEquals(si.getServiceType(), "serviceType");
+ assertEquals(si.getServiceId(), "serviceId");
+ assertEquals(si.getServiceParams(), serviceParams);
+ assertEquals(si.getInstanceId(), "instanceId");
+ assertEquals(si.getInstanceName(), "instanceName");
+ assertEquals(si.getOrchestrationStatus(), "orchestrationStatus");
+ assertEquals(si.getConfiguration(), config);
+ assertEquals(si.getModelInfo(), model);
+ assertEquals(si.getEnvironmentContext(), "environmentContext");
+ assertEquals(si.getWorkloadContext(), "workloadContext");
+
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java new file mode 100644 index 0000000000..7e9aef29a6 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/SubscriberTest.java @@ -0,0 +1,41 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SubscriberTest {
+ Subscriber subscriber= new Subscriber("globalId", "name", "commonSiteId");
+
+ @Test
+ public void testSubscriber() {
+ subscriber.setGlobalId("globalId");
+ subscriber.setName("name");
+ subscriber.setCommonSiteId("commonSiteId");
+ assertEquals(subscriber.getGlobalId(), "globalId");
+ assertEquals(subscriber.getName(), "name");
+ assertEquals(subscriber.getCommonSiteId(), "commonSiteId");
+
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java new file mode 100644 index 0000000000..2a5639f0ff --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/TunnelConnectTest.java @@ -0,0 +1,44 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TunnelConnectTest {
+ private TunnelConnect tc= new TunnelConnect();
+
+ @Test
+ public void testTunnelConnect() {
+ tc.setId("id");
+ tc.setUpBandwidth("upBandwidth");
+ tc.setDownBandwidth("downBandwidth");
+ tc.setUpBandwidth2("upBandwidth2");
+ tc.setDownBandwidth2("downBandwidth2");
+ assertEquals(tc.getId(), "id");
+ assertEquals(tc.getUpBandwidth(), "upBandwidth");
+ assertEquals(tc.getDownBandwidth(), "downBandwidth");
+ assertEquals(tc.getUpBandwidth2(), "upBandwidth2");
+ assertEquals(tc.getDownBandwidth2(), "downBandwidth2");
+
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java new file mode 100644 index 0000000000..e476ef9fd5 --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/VnfResourceTest.java @@ -0,0 +1,55 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.List;
+
+import org.junit.Test;
+
+public class VnfResourceTest {
+
+ private VnfResource vnf= new VnfResource();
+ List<ModuleResource> moduleResources;
+
+ @Test
+ public void testVnfResource() {
+ vnf.setModules(moduleResources);
+ vnf.setVnfHostname("vnfHostname");
+ vnf.setVnfType("vnfType");
+ vnf.setNfFunction("nfFunction");
+ vnf.setNfType("nfType");
+ vnf.setNfRole("nfRole");
+ vnf.setNfNamingCode("nfNamingCode");
+ vnf.setMultiStageDesign("multiStageDesign");
+ assertEquals(vnf.getVfModules(), moduleResources);
+ assertEquals(vnf.getVnfHostname(), "vnfHostname");
+ assertEquals(vnf.getVnfType(), "vnfType");
+ assertEquals(vnf.getNfFunction(), "nfFunction");
+ assertEquals(vnf.getNfType(), "nfType");
+ assertEquals(vnf.getNfRole(), "nfRole");
+ assertEquals(vnf.getNfNamingCode(), "nfNamingCode");
+ assertEquals(vnf.getMultiStageDesign(), "multiStageDesign");
+
+
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml index f7170ff231..0329f2883e 100644 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -1,383 +1,383 @@ -<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.so</groupId>
- <artifactId>bpmn</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>MSOInfrastructureBPMN</artifactId>
- <packaging>war</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <id>default-jar</id>
- <phase>package</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- <configuration>
- <excludes>
- <exclude>org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.class</exclude>
-<!-- <exclude>META-INF/</exclude> -->
- </excludes>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>3.0.0</version>
- <executions>
- <execution>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
- <type>jar</type>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-codegen-plugin</artifactId>
- <version>2.5.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/main/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.compile.classpath" />
- </taskdef>
- <mkdir dir="${project.build.outputDirectory}" />
- <groovyc destdir="${project.build.outputDirectory}"
- srcdir="${basedir}/src/main/groovy/" listfiles="true">
- <classpath refid="maven.compile.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/test/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.test.classpath" />
- </taskdef>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <groovyc destdir="${project.build.testOutputDirectory}"
- srcdir="${basedir}/src/test/groovy/" listfiles="true">
- <classpath refid="maven.test.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>2.6</version>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </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.apache.maven.plugins
- </groupId>
- <artifactId>
- maven-antrun-plugin
- </artifactId>
- <versionRange>
- [1.3,)
- </versionRange>
- <goals>
- <goal>run</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <!-- process engine, in compile scope to include it in the war file -->
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine</artifactId>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!-- Using the `DefaultEjbProcessApplication` result in: `java.sql.SQLException:
- You cannot commit during a managed transaction!` -->
- <dependency>
- <!-- CDI integration, needs to be included in WAR, otherwise CDI can not
- work correctly -->
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-cdi</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>22.0</version> <!-- or 22.0-android for the Android flavor -->
- </dependency>
- <dependency>
- <!-- AssertJ Testing Library -->
- <groupId>org.camunda.bpm.extension</groupId>
- <artifactId>camunda-bpm-assert</artifactId>
- <version>1.2</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Spin dataformat support, in compile scope to include it in the war
- file -->
- <dependency>
- <groupId>org.camunda.spin</groupId>
- <artifactId>camunda-spin-dataformat-all</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <artifactId>camunda-spin-dataformat-all</artifactId>
- <groupId>org.camunda.spin</groupId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-plugin-spin</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-plugin-connect</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <!-- Bootstrap for styling via Webjars project -->
- <groupId>org.webjars</groupId>
- <artifactId>bootstrap</artifactId>
- <version>2.3.2</version>
- </dependency>
- <dependency>
- <!-- Needed for InMemoryH2Test -->
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.uuid</groupId>
- <artifactId>java-uuid-generator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>3.4</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCoreBPMN</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCommonBPMN</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCommonBPMN</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <!-- unit test utilities -->
- <groupId>org.onap.so</groupId>
- <artifactId>MSOCoreBPMN</artifactId>
- <version>${project.version}</version>
- <classifier>tests</classifier>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0</version>
- </dependency>
- <!-- for encoding the url the same way A&AI does -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>4.3.2.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>MSORESTClient</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
-
-
- <dependency>
- <groupId>org.camunda.bpm</groupId>
- <artifactId>camunda-engine-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>4.3.2.RELEASE</version>
-</dependency>
-<dependency>
- <!-- Optional Plugin for Camunda BPM Workbench -->
- <groupId>org.camunda.bpm.workbench</groupId>
- <artifactId>camunda-workbench-dist-embeddable</artifactId>
- <version>1.0.0-alpha8</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onap.msb.java-sdk</groupId>
- <artifactId>msb-java-sdk</artifactId>
- <version>1.0.0</version>
- <exclusions>
- <exclusion>
- <groupId>com.eclipsesource.jaxrs</groupId>
- <artifactId>jersey-all</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- bwj add; Jetty-util -->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>9.4.8.v20171121</version>
- </dependency>
- <!-- bwj add; hibernate-validator -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>5.4.2.Final</version>
- </dependency>
- <!-- bwj add; spring-test -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <version>4.3.14.RELEASE</version>
- </dependency>
- <!-- bwj add; libphonenumber -->
- <dependency>
- <groupId>com.googlecode.libphonenumber</groupId>
- <artifactId>libphonenumber</artifactId>
- <version>8.9.1</version>
- </dependency>
-
- <!--for yang tools-->
-<!-- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>generic-resource-api.model</artifactId>
- <version>1.2.0</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"> + <parent> + <groupId>org.onap.so</groupId> + <artifactId>bpmn</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>MSOInfrastructureBPMN</artifactId> + <packaging>war</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.3</version> + <configuration> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>default-jar</id> + <phase>package</phase> + <goals> + <goal>jar</goal> + </goals> + <configuration> + <excludes> + <exclude>org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.class</exclude> +<!-- <exclude>META-INF/</exclude> --> + </excludes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file> + <type>jar</type> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-codegen-plugin</artifactId> + <version>2.5.2</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>2.8</version> + <configuration> + <additionalProjectnatures> + <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature> + </additionalProjectnatures> + <sourceIncludes> + <sourceInclude>**/*.groovy</sourceInclude> + </sourceIncludes> + </configuration> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <configuration> + <tasks> + <mkdir dir="${basedir}/src/main/groovy" /> + <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"> + <classpath refid="maven.compile.classpath" /> + </taskdef> + <mkdir dir="${project.build.outputDirectory}" /> + <groovyc destdir="${project.build.outputDirectory}" + srcdir="${basedir}/src/main/groovy/" listfiles="true"> + <classpath refid="maven.compile.classpath" /> + </groovyc> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <configuration> + <tasks> + <mkdir dir="${basedir}/src/test/groovy" /> + <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc"> + <classpath refid="maven.test.classpath" /> + </taskdef> + <mkdir dir="${project.build.testOutputDirectory}" /> + <groovyc destdir="${project.build.testOutputDirectory}" + srcdir="${basedir}/src/test/groovy/" listfiles="true"> + <classpath refid="maven.test.classpath" /> + </groovyc> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </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.apache.maven.plugins + </groupId> + <artifactId> + maven-antrun-plugin + </artifactId> + <versionRange> + [1.3,) + </versionRange> + <goals> + <goal>run</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <dependencies> + <dependency> + <!-- process engine, in compile scope to include it in the war file --> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine</artifactId> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- Using the `DefaultEjbProcessApplication` result in: `java.sql.SQLException: + You cannot commit during a managed transaction!` --> + <dependency> + <!-- CDI integration, needs to be included in WAR, otherwise CDI can not + work correctly --> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-cdi</artifactId> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>22.0</version> <!-- or 22.0-android for the Android flavor --> + </dependency> + <dependency> + <!-- AssertJ Testing Library --> + <groupId>org.camunda.bpm.extension</groupId> + <artifactId>camunda-bpm-assert</artifactId> + <version>1.2</version> + <scope>test</scope> + </dependency> + + <!-- Spin dataformat support, in compile scope to include it in the war + file --> + <dependency> + <groupId>org.camunda.spin</groupId> + <artifactId>camunda-spin-dataformat-all</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <artifactId>camunda-spin-dataformat-all</artifactId> + <groupId>org.camunda.spin</groupId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-plugin-spin</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-plugin-connect</artifactId> + <scope>compile</scope> + </dependency> + + <dependency> + <!-- Bootstrap for styling via Webjars project --> + <groupId>org.webjars</groupId> + <artifactId>bootstrap</artifactId> + <version>2.3.2</version> + </dependency> + <dependency> + <!-- Needed for InMemoryH2Test --> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.uuid</groupId> + <artifactId>java-uuid-generator</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-all</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.4</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>MSOCoreBPMN</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>MSOCommonBPMN</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>MSOCommonBPMN</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <!-- unit test utilities --> + <groupId>org.onap.so</groupId> + <artifactId>MSOCoreBPMN</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.0</version> + </dependency> + <!-- for encoding the url the same way A&AI does --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>4.3.2.RELEASE</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>MSORESTClient</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.0.1</version> + <scope>provided</scope> + </dependency> + + + <dependency> + <groupId>org.camunda.bpm</groupId> + <artifactId>camunda-engine-spring</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>4.3.2.RELEASE</version> +</dependency> +<dependency> + <!-- Optional Plugin for Camunda BPM Workbench --> + <groupId>org.camunda.bpm.workbench</groupId> + <artifactId>camunda-workbench-dist-embeddable</artifactId> + <version>1.0.0-alpha8</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.onap.msb.java-sdk</groupId> + <artifactId>msb-java-sdk</artifactId> + <version>1.0.0</version> + <exclusions> + <exclusion> + <groupId>com.eclipsesource.jaxrs</groupId> + <artifactId>jersey-all</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- bwj add; Jetty-util --> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-util</artifactId> + <version>9.4.8.v20171121</version> + </dependency> + <!-- bwj add; hibernate-validator --> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + <version>5.4.2.Final</version> + </dependency> + <!-- bwj add; spring-test --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-test</artifactId> + <version>4.3.14.RELEASE</version> + </dependency> + <!-- bwj add; libphonenumber --> + <dependency> + <groupId>com.googlecode.libphonenumber</groupId> + <artifactId>libphonenumber</artifactId> + <version>8.9.1</version> + </dependency> + + <!--for yang tools--> +<!-- <dependency> + <groupId>org.onap.so</groupId> + <artifactId>common</artifactId> + <version>1.1.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.model</artifactId> + <version>1.2.0</version> + </dependency>--> + </dependencies> +</project> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy deleted file mode 100644 index 2d96ac771a..0000000000 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy +++ /dev/null @@ -1,1071 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 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.bpmn.infrastructure.scripts;
-
-import static org.apache.commons.lang3.StringUtils.*;
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.springframework.web.util.UriUtils;
-
-import groovy.json.*
-
-/**
- * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
- *
- * Inputs:
- * @param - msoRequestId
- * @param - globalSubscriberId
- * @param - subscriptionServiceType
- * @param - serviceInstanceId
- * @param - serviceInstanceName - O
- * @param - serviceModelInfo
- * @param - productFamilyId
- * @param - disableRollback
- * @param - failExists - TODO
- * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
- * @param - sdncVersion ("1610")
- * @param - serviceDecomposition - Decomposition for R1710
- * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
- *
- * Outputs:
- * @param - rollbackData (localRB->null)
- * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
- * @param - WorkflowException
- * @param - serviceInstanceName - (GET from AAI if null in input)
- *
- */
-public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
-
- String Prefix="DCRESI_"
- private static final String DebugFlag = "isDebugEnabled"
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
- public void preProcessRequest (DelegateExecution execution) {
- //only for dug
- execution.setVariable("isDebugLogEnabled","true")
- execution.setVariable("unit_test", "true")
- execution.setVariable("skipVFC", "true")
-
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- String msg = ""
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRequest *****", isDebugEnabled)
-
- utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
-
- try {
- execution.setVariable("prefix", Prefix)
- //Inputs
- //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
- String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
- utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
-
- //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
- String serviceType = execution.getVariable("serviceType")
- utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
-
- //requestDetails.requestParameters. for SDNC assignTopology
- String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
-
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId is null"
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- if (isBlank(serviceType)) {
- msg = "Input serviceType is null"
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- if (productFamilyId == null) {
- execution.setVariable("productFamilyId", "")
- }
-
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (isBlank(sdncCallbackUrl)) {
- msg = "URN_mso_workflow_sdncadapter_callback is null"
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
-
- //requestDetails.modelInfo.for AAI PUT servieInstanceData
- //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String uuiRequest = execution.getVariable("uuiRequest")
- utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
-
- String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
- utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
-
- String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
- utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
-
- String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
- utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
- execution.setVariable("serviceModelName", serviceModelName)
-
- //aai serviceType and Role can be setted as fixed value now.
- String aaiServiceType = serviceType
- String aaiServiceRole = serviceType+"Role"
-
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- execution.setVariable("modelUuid", modelUuid)
-
- //AAI PUT
- String oStatus = execution.getVariable("initialStatus") ?: ""
- utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
- if ("TRANSPORT".equalsIgnoreCase(serviceType))
- {
- oStatus = "Created"
- }
-
-
-
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
- utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
- AaiUtil aaiUriUtil = new AaiUtil(this)
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)
- /*
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
- <model-version-id>${modelUuid}</model-version-id>
- </service-instance>""".trim()
- */
- //begin only for test
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- </service-instance>""".trim()
- //end only for test
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
- utils.logAudit(serviceInstanceData)
- utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
- utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
-
- execution.setVariable("serviceSDNCCreate", "false")
- execution.setVariable("operationStatus", "Waiting deploy resource...")
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- public void postProcessAAIGET(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET ***** ", isDebugEnabled)
- String msg = ""
-
- try {
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
- if(!succInAAI){
- utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- utils.logAudit("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- else
- {
- msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
- }
- }
- else
- {
- boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
- if(foundInAAI){
- utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
- msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
- }
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- public void postProcessAAIPUT(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIPUT ***** ", isDebugEnabled)
- String msg = ""
- try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
- if(!succInAAI){
- utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- utils.logAudit("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- }
- else
- {
- //start rollback set up
- RollbackData rollbackData = new RollbackData()
- def disableRollback = execution.getVariable("disableRollback")
- rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
- execution.setVariable("rollbackData", rollbackData)
- }
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- public void postProcessAAIGET2(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET2 ***** ", isDebugEnabled)
- String msg = ""
-
- try {
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
- if(!succInAAI){
- utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
- WorkflowException workflowException = execution.getVariable("WorkflowException")
- utils.logAudit("workflowException: " + workflowException)
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }
- else
- {
- msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
- }
- }
- else
- {
- boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
- if(foundInAAI){
- String aaiService = execution.getVariable("GENGS_service")
- if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
- execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
- utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
- }
- }
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- public void preProcessRollback (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRollback ***** ", isDebugEnabled)
- try {
-
- Object workflowException = execution.getVariable("WorkflowException");
-
- if (workflowException instanceof WorkflowException) {
- utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
- }
- } catch (BpmnError e) {
- utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
- } catch(Exception ex) {
- String msg = "Exception in preProcessRollback. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- public void postProcessRollback (DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessRollback ***** ", isDebugEnabled)
- String msg = ""
- try {
- Object workflowException = execution.getVariable("prevWorkflowException");
- if (workflowException instanceof WorkflowException) {
- utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
- execution.setVariable("WorkflowException", workflowException);
- }
- execution.setVariable("rollbackData", null)
- } catch (BpmnError b) {
- utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
- throw b;
- } catch(Exception ex) {
- msg = "Exception in postProcessRollback. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- /**
- * Init the service Operation Status
- */
- public void preUpdateServiceOperationStatus(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
-
- try{
- String serviceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String serviceName = execution.getVariable("serviceInstanceName")
- String operationType = "CREATE"
- String userId = ""
- String result = "processing"
- String progress = execution.getVariable("progress")
- utils.log("INFO", "progress: " + progress , isDebugEnabled)
- if ("100".equalsIgnoreCase(progress))
- {
- result = "finished"
- }
- String reason = ""
- String operationContent = "Prepare service creation : " + execution.getVariable("operationStatus")
-
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
- serviceId = UriUtils.encode(serviceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceId)
- execution.setVariable("operationId", operationId)
- execution.setVariable("operationType", operationType)
-
- def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
- execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
-
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <serviceName>${serviceName}</serviceName>
- <operationType>${operationType}</operationType>
- <userId>${userId}</userId>
- <result>${result}</result>
- <operationContent>${operationContent}</operationContent>
- <progress>${progress}</progress>
- <reason>${reason}</reason>
- </ns:updateServiceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
- utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
-
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
- }
- utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
-
- public void preInitResourcesOperStatus(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
-
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preInitResourcesOperStatus Process ======== ", isDebugEnabled)
- try{
- String serviceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String operationType = execution.getVariable("operationType")
- String resourceTemplateUUIDs = ""
- String result = "processing"
- String progress = "0"
- String reason = ""
- String operationContent = "Prepare service creation"
- utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
- serviceId = UriUtils.encode(serviceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceId)
- execution.setVariable("operationId", operationId)
- execution.setVariable("operationType", operationType)
- String incomingRequest = execution.getVariable("uuiRequest")
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
- for(String resource : resourceList){
- resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":"
- }
-
- def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
- execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
- utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
-
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <operationType>${operationType}</operationType>
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
- </ns:initResourceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
- utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- /**
- * prepare resource create request
- */
- public void preResourceRequest(execution){
- def method = getClass().getSimpleName() + '.preResourceRequest(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
-
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preResourceRequest Process ======== ", isDebugEnabled)
- try {
- String resourceType = execution.getVariable("resourceType")
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String nsServiceName = resourceType + "_" + serviceInstanceName
- execution.setVariable("nsServiceName", nsServiceName)
- utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
- String serviceId = execution.getVariable("serviceInstanceId")
- execution.setVariable("serviceId", serviceId)
- String operationId = execution.getVariable("operationId")
- String incomingRequest = execution.getVariable("uuiRequest")
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
- String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
- execution.setVariable("nsServiceDescription", nsServiceDescription)
- utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
- for(String resource : resourceList){
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
- if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
- String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
- String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
- String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
- execution.setVariable("resourceUUID", resourceUUID)
- execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
- execution.setVariable("resourceParameters", resourceParameters)
- utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
- utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
- utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
- }
- }
- } catch (BpmnError b) {
- utils.log("INFO", "BPMN Error during preResourceRequest", isDebugEnabled)
- throw b;
- } catch(Exception ex) {
- msg = "Exception in preResourceRequest. " + ex.getMessage()
- utils.log("INFO", msg, isDebugEnabled)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- /**
- * post config request.
- */
- public void postConfigRequest(execution){
- //now do noting
- }
-
- /***********************************************************************************************/
-
- private void loadResourcesProperties(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- String loadFilePath = "/etc/mso/config.d/reources.json"
- try{
- def jsonPayload = new File(loadFilePath).text
- utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)
-
- String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
- utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)
-
- String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
- //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)
- execution.setVariable("createResourceSort", createResourceSort)
-
- String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
- //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)
- execution.setVariable("deleteResourceSort", deleteResourceSort)
-
-
- String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
- //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)
- execution.setVariable("resourceControllerType", resourceControllerType)
-
-
- }catch(Exception ex){
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
- private sortCreateResource(DelegateExecution execution) {
- def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- String createResourceSortDef = """[
- {
- "resourceType":"vEPC"
- },
- {
- "resourceType":"vIMS"
- },
- {
- "resourceType":"vCPE"
- },
- {
- "resourceType":"vFW"
- },
- {
- "resourceType":"Underlay"
- },
- {
- "resourceType":"Overlay"
- },
- {
- "resourceType":"GRE_AAR"
- },
- {
- "resourceType":"APN_AAR"
- },
- {
- "resourceType":"VPN_SAR"
- },
- {
- "resourceType":"GRE_SAR"
- }
-
- ]""".trim()
-
- try{
-
- loadResourcesProperties(execution)
- String createResourceSort = execution.getVariable("createResourceSort")
- if (isBlank(createResourceSort)) {
- createResourceSort = createResourceSortDef;
- }
-
- List<String> sortResourceList = jsonUtil.StringArrayToList(execution, createResourceSort)
- utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled)
-
- JSONArray newResourceList = new JSONArray()
- int resSortCount = sortResourceList.size()
-
-
- for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
- String sortResource = sortResourceList[currentResource]
- String resourceType = jsonUtil.getJsonValue(sortResource, "resourceType")
- List<String> resourceList = execution.getVariable(Prefix+"resourceList")
-
- for (String resource : resourceList) {
- //utils.log("INFO", "resource : " + resource, isDebugEnabled)
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
- //utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
- String[] split = resourceName.split("_")
-
- utils.log("INFO", "split : " + split, isDebugEnabled)
- int strLen = split.size()
- String allottedResourceType = ""
-
- if (strLen <2) {
- allottedResourceType = split[0]
- }
- else {
- allottedResourceType = split[0] + "_" + split[1]
- }
-
- if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
- utils.log("INFO", "allottedResourceType : " + allottedResourceType + " resourceType : " + resourceType, isDebugEnabled)
- utils.log("INFO", "resource : " + resource , isDebugEnabled)
- JSONObject jsonObj = new JSONObject(resource)
- newResourceList.put(jsonObj)
-
- }
- utils.log("INFO", "Get next sort type " , isDebugEnabled)
- }
- }
- utils.log("INFO", "newResourceList : " + newResourceList, isDebugEnabled)
- String newResourceStr = newResourceList.toString()
- List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
-
- execution.setVariable(Prefix+"resourceList", newResourceListStr)
- utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled)
-
- }catch(Exception ex){
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
-
- }
- /**
- * get service resources
- */
- public void getServiceResources(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 getServiceResources Process ======== ", isDebugEnabled)
- try{
- execution.setVariable(Prefix+"resourceCount", 0)
- execution.setVariable(Prefix+"nextResource", 0)
-
- String incomingRequest = execution.getVariable("uuiRequest")
- String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
- utils.log("INFO", "Resources String : " + resourcesStr, isDebugEnabled)
- if (!isBlank(resourcesStr)) {
- List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
- utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
- execution.setVariable(Prefix+"resourceList", resourceList)
- execution.setVariable(Prefix+"resourceCount", resourceList.size())
- execution.setVariable(Prefix+"nextResource", 0)
- }
-
- int resourceNum = execution.getVariable(Prefix+"nextResource")
- utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
-
- int resourceCount = execution.getVariable(Prefix+"resourceCount")
- utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
-
- if (resourceNum < resourceCount) {
- execution.setVariable(Prefix+"resourceFinish", false)
- }
- else {
- execution.setVariable(Prefix+"resourceFinish", true)
- }
- sortCreateResource(execution)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing getServiceResources. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during getServiceResources Method:\n" + e.getMessage())
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- /**
- * prepare Decompose next resource to create request
- */
- public void preProcessDecomposeNextResource(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessDecomposeNextResource Process ======== ", isDebugEnabled)
- try{
- int resourceNum = execution.getVariable(Prefix+"nextResource")
- List<String> resourceList = execution.getVariable(Prefix+"resourceList")
- utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
-
- String resource = resourceList[resourceNum]
- execution.setVariable(Prefix+"resource", resource)
- utils.log("INFO", "Current Resource : " + resource, isDebugEnabled)
-
- String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
- execution.setVariable(Prefix+"resourceName", resourceName)
- utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
-
- String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
- execution.setVariable("resourceUUID", resourceUUID)
- utils.log("INFO", "resource UUID : " + resourceUUID, isDebugEnabled)
-
- String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
- execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
-
-
- String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
- execution.setVariable("resourceParameters", resourceParameters)
- utils.log("INFO", "resource Parameters : " + resourceParameters, isDebugEnabled)
-
- execution.setVariable(Prefix+"nextResource", resourceNum + 1)
- utils.log("INFO", "next Resource num : " + execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
-
- int resourceCount = execution.getVariable(Prefix+"resourceCount")
- if (resourceCount >0 ){
- int progress = (resourceNum*100) / resourceCount
- execution.setVariable("progress", progress.toString() )
- }
-
- execution.setVariable("operationStatus", resourceName )
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing preProcessDecomposeNextResource. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during preProcessDecomposeNextResource Method:\n" + e.getMessage())
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
- /**
- * post Decompose next resource to create request
- */
- public void postProcessDecomposeNextResource(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== STARTED DoCreateE2EServiceInstanceV2 postProcessDecomposeNextResource Process ======== ", isDebugEnabled)
- try{
- String resourceName = execution.getVariable(Prefix+"resourceName")
-
- int resourceNum = execution.getVariable(Prefix+"nextResource")
- utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
-
- int resourceCount = execution.getVariable(Prefix+"resourceCount")
- utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
-
- if (resourceNum < resourceCount) {
- execution.setVariable(Prefix+"resourceFinish", false)
- }
- else {
- execution.setVariable(Prefix+"resourceFinish", true)
- }
-
- utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)
-
- if (resourceCount >0 ){
- int progress = (resourceNum*100) / resourceCount
- execution.setVariable("progress", progress.toString() )
- utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)
- }
- execution.setVariable("operationStatus", resourceName )
-
- }catch(Exception e){
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in "+method + "- " + e.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
- /**
- * prepare check Resource Type
- */
- public void checkResourceType(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- String resourceControllerTypeDef = """[
- {
- "resourceType":"vEPC",
- "controllerType":"VFC"
- },
- {
- "resourceType":"vIMS",
- "controllerType":"VFC"
- },
- {
- "resourceType":"vCPE",
- "controllerType":"VFC"
- },
- {
- "resourceType":"vFW",
- "controllerType":"VFC"
- },
- {
- "resourceType":"Underlay",
- "controllerType":"SDNC"
- },
- {
- "resourceType":"Overlay",
- "controllerType":"SDNC"
- },
- {
- "resourceType":"VPN_SAR",
- "controllerType":"SDNC"
- },
- {
- "resourceType":"GRE_AAR",
- "controllerType":"APPC"
- },
- {
- "resourceType":"GRE_SAR",
- "controllerType":"SDNC"
- } ,
- {
- "resourceType":"APN_AAR",
- "controllerType":"APPC"
- }
-
- ]""".trim()
-
- try{
-
- String resourceName = execution.getVariable(Prefix+"resourceName")
- utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
- execution.setVariable("resourceName", resourceName)
-
- String[] split = resourceName.split("_")
-
- utils.log("INFO", "split : " + split, isDebugEnabled)
- int strLen = split.size()
- String allottedResourceType = ""
-
- if (strLen <2) {
- allottedResourceType = split[0]
- }
- else {
- allottedResourceType = split[0] + "_" + split[1]
- }
-
- loadResourcesProperties(execution)
- String resourceControllerType= execution.getVariable("resourceControllerType")
- if (isBlank(resourceControllerType)) {
- resourceControllerType = resourceControllerTypeDef;
- }
- utils.log("INFO", "resourceControllerType: " + resourceControllerType, isDebugEnabled)
-
- List<String> ResourceTypeList = jsonUtil.StringArrayToList(execution, resourceControllerType)
- utils.log("INFO", "ResourceTypeList : " + ResourceTypeList, isDebugEnabled)
- execution.setVariable("controllerType", "Other")
- execution.setVariable(Prefix+"resourceType", "")
- for (String resourceMap : ResourceTypeList) {
- String resourceType = jsonUtil.getJsonValue(resourceMap, "resourceType")
- String controllerType = jsonUtil.getJsonValue(resourceMap, "controllerType")
- //utils.log("INFO", "resourceMap.resourceType : " + resourceType, isDebugEnabled)
- //utils.log("INFO", "resourceMap.controllerType : " + controllerType, isDebugEnabled)
- //utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
- //utils.log("INFO", "allottedResourceType : " + allottedResourceType, isDebugEnabled )
-
- if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
- execution.setVariable("controllerType", controllerType)
- execution.setVariable(Prefix+"resourceType", resourceType)
- utils.log("INFO", "found controller type : " + controllerType, isDebugEnabled)
- break
- }
- }
- utils.log("INFO", "controller Type : " + execution.getVariable("controllerType"), isDebugEnabled)
- utils.log("INFO", "resource Type : " + execution.getVariable(Prefix+"resourceType"), isDebugEnabled)
-
- if (execution.getVariable("controllerType") == "") {
- String exceptionMessage = "Resource name can not find controller type,please check the resource Name: "+ resourceName
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- if (execution.getVariable(Prefix+"resourceType") == "vCPE") {
- execution.setVariable("skipVFC", "false")
- utils.log("INFO", "vCPE will deploy ", isDebugEnabled)
- }
-
- }catch(Exception e){
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
- /**
- * prepare post Unkown Resource Type
- */
- public void postOtherControllerType(DelegateExecution execution){
- def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
-
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postOtherControllerType Process ======== ", isDebugEnabled)
- try{
-
- String resourceName = execution.getVariable(Prefix+"resourceName")
- String resourceType = execution.getVariable(Prefix+"resourceType")
- String controllerType = execution.getVariable("controllerType")
-
- String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
- utils.log("DEBUG", msg, isDebugEnabled)
-
- }catch(Exception e){
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
- /**
- * prepare Controller resource create request
- */
- public void preProcessResourceRequestForController(execution){
- def method = getClass().getSimpleName() + '.preProcessResourceRequestForController(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessResourceRequestForController Process ======== ", isDebugEnabled)
- try{
- String resourceName = execution.getVariable(Prefix+"resourceName")
- String resourceType = execution.getVariable(Prefix+"resourceType")
- String serviceInstanceName =execution.getVariable("serviceInstanceName")
- String nsServiceName = resourceType + "_" + serviceInstanceName
- execution.setVariable("nsServiceName", nsServiceName)
- utils.log("INFO", "Prepare Controller Request nsServiceName:" + nsServiceName, isDebugEnabled)
-
- String serviceId = execution.getVariable("serviceInstanceId")
- execution.setVariable("serviceId", serviceId)
- utils.log("INFO", "Prepare Controller Request serviceId:" + serviceId, isDebugEnabled)
-
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- utils.log("INFO", "Prepare Controller Request globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
-
- String incomingRequest = execution.getVariable("uuiRequest")
- String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
- execution.setVariable("nsServiceDescription", nsServiceDescription)
- utils.log("INFO", "Prepare Controller Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
-
- String resourceUUID = execution.getVariable("resourceUUID")
-
- utils.log("INFO", "Prepare Controller Request resourceUUID:" + resourceUUID, isDebugEnabled)
-
- String resourceInvariantUUID = execution.getVariable("resourceInvariantUUID")
- utils.log("INFO", "Prepare Controller Request resourceInvariantUUID:" + resourceInvariantUUID, isDebugEnabled)
-
- String resourceParameters = execution.getVariable("resourceParameters")
- execution.setVariable("resourceParameters", resourceParameters)
- utils.log("INFO", "Prepare Controller Request resourceParameters:" + resourceParameters, isDebugEnabled)
-
-
-
- }catch(Exception e){
- String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
- utils.log("ERROR", exceptionMessage, isDebugEnabled)
- execution.setVariable(Prefix+"ErrorResponse", exceptionMessage)
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
- /**
- * post process VFC resource create request
- */
- public void postProcessResourceRequestForVFC(execution){
- def method = getClass().getSimpleName() + '.postProcessResourceRequestForVFC(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForVFC Process ======== ", isDebugEnabled)
- try{
-
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForVFC. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForVFC Method:\n" + e.getMessage())
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
-
- /**
- * post process SDNC resource create request
- */
- public void postProcessResourceRequestForSDNC(execution){
- def method = getClass().getSimpleName() + '.postProcessResourceRequestForSDNC(' +'execution=' + execution.getId() +')'
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("INFO","Entered " + method, isDebugEnabled)
- utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForSDNC Process ======== ", isDebugEnabled)
- try{
-
- execution.setVariable("serviceSDNCCreate", "true")
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForSDNC. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForSDNC Method:\n" + e.getMessage())
- }
- utils.log("INFO", "Exited " + method, isDebugEnabled)
- }
-
-
-
-}
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index deea707a3e..bf2d6bcc36 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -55,7 +55,7 @@ import org.w3c.dom.Node import org.w3c.dom.NodeList
import org.xml.sax.InputSource
/**
- * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
+ * This groovy class supports the <class>DoUpdateE2EServiceInstance.bpmn</class> process.
*
* Inputs:
* @param - msoRequestId
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn new file mode 100644 index 0000000000..074b48a62c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CompareModelofE2EServiceInstance.bpmn @@ -0,0 +1,335 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> + <bpmn:process id="CompareModelofE2EServiceInstance" name="CompareModelofE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_00qj6ro" name="Start Flow"> + <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="SubProcess_0ka59nc" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_0v1ffn4"> + <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0eznq6x"> + <bpmn:incoming>SequenceFlow_1yay321</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" /> + <bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" /> + </bpmn:subProcess> + <bpmn:callActivity id="DoCompareModelofE2EServiceInstance" name="Call DoCompareModelofE2EServiceInstance " calledElement="DoCompareModelofE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="failIfExists" target="failIfExists" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="initialStatus" target="initialStatus" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="URN_mso_adapters_openecomp_db_endpoint" target="URN_mso_adapters_openecomp_db_endpoint" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0tm7z1o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0bpd6c0" name="End"> + <bpmn:incoming>SequenceFlow_0yayvrf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0tm7z1o</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new CompareModelofE2EServiceInstance() +csi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0dug28e"> + <bpmn:outgoing>SequenceFlow_0e1r62n</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_03wysuk"> + <bpmn:incoming>SequenceFlow_1ysapam</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CompareModelofE2EServiceInstance() +csi.prepareFalloutRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_01umodj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ysapam</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CompareModelofE2EServiceInstance() +csi.sendSyncError(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" /> + <bpmn:sequenceFlow id="SequenceFlow_0n9pexp" sourceRef="ScriptTask_1rn6nqi" targetRef="ScriptTask_0u8o9p2" /> + <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12jdmq5</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CompareModelofE2EServiceInstance() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?"> + <bpmn:incoming>SequenceFlow_12jdmq5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fueo69</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0y8s0kd</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_07uk5iy"> + <bpmn:incoming>SequenceFlow_1fueo69</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_0nbdy47" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0s2spoq" sourceRef="StartEvent_00qj6ro" targetRef="ScriptTask_1s09c7d" /> + <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoCompareModelofE2EServiceInstance" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0tm7z1o" sourceRef="ScriptTask_1s09c7d" targetRef="DoCompareModelofE2EServiceInstance" /> + <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0a01ez6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> + <bpmn:sequenceFlow id="SequenceFlow_12jdmq5" sourceRef="ScriptTask_0xupxj9" targetRef="ExclusiveGateway_0aqn64l" /> + <bpmn:scriptTask id="ScriptTask_0hkyfdj" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0y8s0kd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a01ez6</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CompareModelofE2EServiceInstance() +csi.prepareCompletionRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0a01ez6" sourceRef="ScriptTask_0hkyfdj" targetRef="CallActivity_02fyxz0" /> + <bpmn:sequenceFlow id="SequenceFlow_0y8s0kd" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0hkyfdj"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CompareModelofE2EServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_00qj6ro_di" bpmnElement="StartEvent_00qj6ro"> + <dc:Bounds x="-6" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-12" y="221" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0ka59nc_di" bpmnElement="SubProcess_0ka59nc" isExpanded="true"> + <dc:Bounds x="463" y="632" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoCompareModelofE2EServiceInstance"> + <dc:Bounds x="458" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> + <dc:Bounds x="1258" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1268" y="322" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> + <dc:Bounds x="214" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true"> + <dc:Bounds x="348" y="370" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> + <dc:Bounds x="683" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true"> + <dc:Bounds x="903" y="173" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="903" y="145" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy"> + <dc:Bounds x="910" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="883" y="322" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> + <di:waypoint xsi:type="dc:Point" x="30" y="198" /> + <di:waypoint xsi:type="dc:Point" x="214" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="77" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> + <di:waypoint xsi:type="dc:Point" x="558" y="198" /> + <di:waypoint xsi:type="dc:Point" x="683" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="575.5" y="177" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> + <di:waypoint xsi:type="dc:Point" x="928" y="223" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="901" y="228" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> + <dc:Bounds x="611" y="687" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0v1ffn4_di" bpmnElement="StartEvent_0v1ffn4"> + <dc:Bounds x="496" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="469" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0eznq6x_di" bpmnElement="EndEvent_0eznq6x"> + <dc:Bounds x="772" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0dug28e_di" bpmnElement="StartEvent_0dug28e"> + <dc:Bounds x="363" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_03wysuk_di" bpmnElement="EndEvent_03wysuk"> + <dc:Bounds x="942" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="915" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0u8o9p2_di" bpmnElement="ScriptTask_0u8o9p2"> + <dc:Bounds x="621" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ang7q8_di" bpmnElement="CallActivity_1ang7q8"> + <dc:Bounds x="798" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rn6nqi_di" bpmnElement="ScriptTask_1rn6nqi"> + <dc:Bounds x="443" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb"> + <di:waypoint xsi:type="dc:Point" x="532" y="727" /> + <di:waypoint xsi:type="dc:Point" x="611" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321"> + <di:waypoint xsi:type="dc:Point" x="711" y="727" /> + <di:waypoint xsi:type="dc:Point" x="772" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="701.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n"> + <di:waypoint xsi:type="dc:Point" x="399" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="442" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam"> + <di:waypoint xsi:type="dc:Point" x="898" y="474" /> + <di:waypoint xsi:type="dc:Point" x="942" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="875" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp"> + <di:waypoint xsi:type="dc:Point" x="543" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="621" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj"> + <di:waypoint xsi:type="dc:Point" x="721" y="474" /> + <di:waypoint xsi:type="dc:Point" x="798" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="715.5" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0tm7z1o_di" bpmnElement="SequenceFlow_0tm7z1o"> + <di:waypoint xsi:type="dc:Point" x="314" y="198" /> + <di:waypoint xsi:type="dc:Point" x="458" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="386" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> + <dc:Bounds x="1226" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> + <di:waypoint xsi:type="dc:Point" x="1276" y="238" /> + <di:waypoint xsi:type="dc:Point" x="1276" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1201" y="262" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12jdmq5_di" bpmnElement="SequenceFlow_12jdmq5"> + <di:waypoint xsi:type="dc:Point" x="783" y="198" /> + <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="843" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0hkyfdj_di" bpmnElement="ScriptTask_0hkyfdj"> + <dc:Bounds x="1031" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a01ez6_di" bpmnElement="SequenceFlow_0a01ez6"> + <di:waypoint xsi:type="dc:Point" x="1131" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1178.5" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0y8s0kd_di" bpmnElement="SequenceFlow_0y8s0kd"> + <di:waypoint xsi:type="dc:Point" x="953" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1031" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="983" y="177" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java new file mode 100644 index 0000000000..b9f339921d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.bpmn.infrastructure.aai; + +import org.junit.Test; + + +public class AAIServiceInstanceTest { + + AAIServiceInstance test = new AAIServiceInstance("serviceInstanceName","serviceType","serviceRole","orchestrationStatus","modelInvariantUuid","modelVersionId","environmentContext","workloadContext"); + + @Test + public void getServiceInstanceNameTest() throws Exception { + test.getServiceInstanceName(); + } + + @Test + public void setServiceInstanceNameTest() throws Exception { + test.setServiceInstanceName("serviceInstanceName"); + } + + @Test + public void getServiceTypeTest() throws Exception { + test.getServiceType(); + } + + @Test + public void setServiceTypeTest() throws Exception { + test.setServiceType("serviceType"); + } + + + @Test + public void getServiceRoleTest() throws Exception { + test.getServiceRole(); + } + + @Test + public void setServiceRoleTest() throws Exception { + test.setServiceRole("serviceRole"); + } + + @Test + public void getOrchestrationStatusTest() throws Exception { + test.getOrchestrationStatus(); + } + + @Test + public void setOrchestrationStatusTest() throws Exception { + test.setOrchestrationStatus("status"); + } + + @Test + public void getModelInvariantUuidTest() throws Exception { + test.getModelInvariantUuid(); + } + + @Test + public void setModelInvariantUuidTest() throws Exception { + test.setModelInvariantUuid("uuid"); + } + + @Test + public void getModelVersionIdTest() throws Exception { + test.getModelVersionId(); + } + + @Test + public void setModelVersionIdTest() throws Exception { + test.setModelVersionId("versionId"); + } + + @Test + public void getEnvironmentContextTest() throws Exception { + test.getEnvironmentContext(); + } + + @Test + public void setEnvironmentContextTest() throws Exception { + test.setEnvironmentContext("context"); + } + + @Test + public void getWorkloadContextTest() throws Exception { + test.getWorkloadContext(); + } + + @Test + public void setWorkloadContextTest() throws Exception { + test.setWorkloadContext("context"); + } + +} + + diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml index 9c5ce1487e..6f2f007e5f 100644 --- a/bpmn/MSORESTClient/pom.xml +++ b/bpmn/MSORESTClient/pom.xml @@ -1,45 +1,37 @@ -<?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/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>bpmn</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>MSORESTClient</artifactId>
-
- <packaging>jar</packaging>
-
- <name>MSO REST Client API</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpmime</artifactId>
- <version>4.5</version>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.10.19</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>common</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- <build>
- <finalName>MSORESTClient</finalName>
- <plugins>
-
- </plugins>
-
- </build>
-</project>
+<?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/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.so</groupId> + <artifactId>bpmn</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <artifactId>MSORESTClient</artifactId> + + <packaging>jar</packaging> + + <name>MSO REST Client API</name> + + <dependencies> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpmime</artifactId> + <version>4.5</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + <build> + <finalName>MSORESTClient</finalName> + <plugins> + + </plugins> + + </build> +</project> diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java new file mode 100644 index 0000000000..29b7e15364 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderTest.java @@ -0,0 +1,34 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.rest; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class HttpHeaderTest { + + @Test + public void test() { + HttpHeader hth= new HttpHeader("name", "value"); + assertEquals("name", hth.getName()); + assertEquals("value", hth.getValue()); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java new file mode 100644 index 0000000000..d3fd4f9ea5 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java @@ -0,0 +1,50 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.rest; + +import static org.mockito.Mockito.mock; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import org.apache.http.HttpResponse; +import org.apache.http.message.AbstractHttpMessage; +import org.junit.Test; + +public class RESTClientTest { + + @Test + public void test()throws Exception{ + APIResponse apr=mock(APIResponse.class); + HttpResponse response=mock(HttpResponse.class); + AbstractHttpMessage httpMsg=mock(AbstractHttpMessage.class); + RESTClient cle=mock(RESTClient.class); + RESTClient rcl=new RESTClient("URL"); + RESTClient rcle=new RESTClient("URL", "10.5.3.126", 5020); + LinkedHashMap<String, List<String>> headers=new LinkedHashMap<>() ; + List<String>list=new ArrayList<>(); + list.add("value"); + headers.put("name", list); + rcle.setHeader("name", "value"); + rcle.setParameter("name", "value"); + assert(rcle.getHeaders()!=null); + assert(rcle.getParameters()!=null); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java new file mode 100644 index 0000000000..a64f112234 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigTest.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.rest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import org.junit.Test; + +public class RESTConfigTest { + + @Test + public void test() { + RESTConfig rcfg=mock(RESTConfig.class); + RESTConfig rcf=new RESTConfig("URL"); + RESTConfig rcfi=new RESTConfig("URL", true); + RESTConfig rcfo=new RESTConfig("URL", "10.2.3.101", 5020); + RESTConfig rcfn=new RESTConfig("URL", "10.2.3.101", 5020, true); + assert(rcfo.getProxyHost().equals("10.2.3.101")); + assertEquals(5020,rcfn.getProxyPort()); + assert(rcf.getURL().equals("URL")); + assertTrue(rcfn.trustAllCerts()); + } +} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java new file mode 100644 index 0000000000..de2cd0f608 --- /dev/null +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionTest.java @@ -0,0 +1,37 @@ +/* +* ============LICENSE_START======================================================= +* ONAP : SO +* ================================================================================ +* Copyright 2018 TechMahindra +*================================================================================= +* 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.rest; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import org.junit.Test; + +public class RESTExceptionTest { + + @Test + public void test() { + RESTException rexm=mock(RESTException.class); + RESTException rex=new RESTException("Error"); + RESTException recpt=new RESTException(200, "Error"); + assert(rex.getErrorMessage().equals("Error")); + assertEquals(200,recpt.getStatusCode()); + } +} diff --git a/common/pom.xml b/common/pom.xml index aeef257d48..adc102e150 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -53,12 +53,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-library</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.jboss.spec.javax.ejb</groupId> <artifactId>jboss-ejb-api_3.2_spec</artifactId> <version>1.0.0.Final</version> diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java new file mode 100644 index 0000000000..fa24662d69 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java @@ -0,0 +1,58 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.anything; +import static org.hamcrest.CoreMatchers.not; + +import org.hamcrest.Matcher; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoField; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.rule.Rule; + +public class CustomSetterMustExistRule implements Rule { + + private Matcher<PojoField>[] excludeMatchers = new Matcher[]{not(anything())}; + private Matcher<PojoField>[] includeMatchers = new Matcher[]{anything()}; + public CustomSetterMustExistRule() { + } + @Override + public void evaluate(final PojoClass pojoClass) { + for (PojoField fieldEntry : pojoClass.getPojoFields()) { + if (!anyOf(excludeMatchers).matches(fieldEntry) && anyOf(includeMatchers).matches(fieldEntry) && !fieldEntry.isFinal() && !fieldEntry.hasSetter()) { + Affirm.fail(String.format("[%s] is missing a setter", fieldEntry)); + } + } + } + public CustomSetterMustExistRule exclude(Matcher<PojoField>... excludeMatchers) { + this.excludeMatchers = excludeMatchers; + return this; + } + + public CustomSetterMustExistRule include(Matcher<PojoField>... includeMatchers) { + this.includeMatchers = includeMatchers; + return this; + } + +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java new file mode 100644 index 0000000000..f4192e6cc8 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java @@ -0,0 +1,103 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.anything; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.Id; + +import org.hamcrest.Matcher; + +import com.openpojo.business.annotation.BusinessKey; +import com.openpojo.random.RandomFactory; +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoField; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.test.Tester; +import com.openpojo.validation.utils.ValidationHelper; + +public class EqualsAndHashCodeTester implements Tester { + + + private final Matcher m; + public EqualsAndHashCodeTester() { + m = anything(); + } + + public EqualsAndHashCodeTester(Matcher m) { + this.m = m; + } + @Override + public void run(PojoClass pojoClass) { + Class<?> clazz = pojoClass.getClazz(); + if (anyOf(m).matches(clazz)) { + final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass); + final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass); + Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass); + List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields()); + otherFields.removeAll(identityFields); + + for (PojoField field : identityFields) { + final Object value = RandomFactory.getRandomValue(field); + + field.invokeSetter(classInstanceOne, value); + field.invokeSetter(classInstanceTwo, value); + } + + for (PojoField field : otherFields) { + if (field.hasSetter()) { + final Object valueOne = RandomFactory.getRandomValue(field); + final Object valueTwo = RandomFactory.getRandomValue(field); + + field.invokeSetter(classInstanceOne, valueOne); + field.invokeSetter(classInstanceTwo, valueTwo); + } + } + + Affirm.affirmTrue("Equals test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.equals(classInstanceTwo)); + + Affirm.affirmTrue("Equals test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.equals( + classInstanceOne)); + + Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.hashCode() == classInstanceTwo.hashCode()); + + Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test")); + } + } + + + private Set<PojoField> hasIdOrBusinessKey(PojoClass pojoClass) { + final Set<PojoField> fields = new HashSet<>(); + + fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(BusinessKey.class)); + fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(Id.class)); + + return fields; + + } + +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java new file mode 100644 index 0000000000..fdfb9695e7 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java @@ -0,0 +1,69 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anything; + +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +public class HasAnnotationMatcher<T extends Annotation> extends TypeSafeDiagnosingMatcher<AnnotatedElement> { + private final Class<T> annotationType; + private final Matcher<? super T> annotationMatcher; + + public HasAnnotationMatcher(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) { + this.annotationType = annotationType; + this.annotationMatcher = annotationMatcher; + } + + @Override + protected boolean matchesSafely(final AnnotatedElement item, final Description mismatchDescription) { + final T annotation = item.getAnnotation(this.annotationType); + if (annotation == null) { + mismatchDescription.appendText("does not have annotation ").appendText(this.annotationType.getName()); + return false; + } + + if (!this.annotationMatcher.matches(annotation)) { + this.annotationMatcher.describeMismatch(annotation, mismatchDescription); + return false; + } + + return true; + } + + @Override + public void describeTo(final Description description) { + // Intentionally left blank. + } + + public static Matcher<AnnotatedElement> hasAnnotation(final Class<? extends Annotation> annotationType) { + return hasAnnotation(annotationType, anything("")); + } + + public static <T extends Annotation> Matcher<AnnotatedElement> hasAnnotation(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) { + return new HasAnnotationMatcher<T>(annotationType, annotationMatcher); + } +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java new file mode 100644 index 0000000000..f0c1b18df2 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java @@ -0,0 +1,75 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeDiagnosingMatcher; + +import com.openpojo.reflection.PojoField; + +public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> { + private final String attribute; + private final Matcher<?> annotationMatcher; + private final Class<? extends Annotation> annotationClass; + public HasAnnotationPropertyWithValueMatcher(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) { + this.attribute = attribute; + this.annotationMatcher = annotationMatcher; + this.annotationClass = clazz; + } + + @Override + protected boolean matchesSafely(T obj, final Description mismatchDescription) { + final PojoField temp = (PojoField)obj; + final Method method; + try { + Annotation a = temp.getAnnotation(this.annotationClass); + if (a == null) { + mismatchDescription.appendText("does not have annotation ").appendText(this.annotationClass.getSimpleName()); + return false; + } + method = a.getClass().getMethod(attribute); + final Object result = method.invoke(a); + if (!this.annotationMatcher.matches(result)) { + this.annotationMatcher.describeMismatch(result, mismatchDescription); + return false; + } + } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + mismatchDescription.appendText("does not have property ").appendText(attribute); + return false; + } + return true; + } + + @Override + public void describeTo(final Description description) { + // Intentionally left blank. + } + + public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) { + return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher); + } +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java new file mode 100644 index 0000000000..4ef560721f --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java @@ -0,0 +1,81 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.anything; + +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; + +import org.hamcrest.Matcher; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.rule.Rule; + +/** + * This rule ensures that classes have overriden the default equals and hashCode methods from Object + */ +public class HasEqualsAndHashCodeRule implements Rule { + + private final Matcher m; + public HasEqualsAndHashCodeRule() { + m = anything(); + } + + public HasEqualsAndHashCodeRule(Matcher m) { + this.m = m; + } + @Override + public void evaluate(PojoClass pojoClass) { + Class<?> clazz = pojoClass.getClazz(); + if (anyOf(m).matches(clazz)) { + boolean hasEquals = false; + boolean hasHashCode = false; + final String name = clazz.getSimpleName(); + final Method[] methods; + if (clazz.getSuperclass().equals(Object.class)) { + methods = clazz.getDeclaredMethods(); + } else { + methods = clazz.getMethods(); + } + for (Method method : methods) { + Parameter[] parameters = method.getParameters(); + if ("equals".equals(method.getName()) && boolean.class.equals(method.getReturnType()) && parameters.length == 1 && Object.class.equals(parameters[0].getType())) { + hasEquals = true; + } else if ("hashCode".equals(method.getName()) && int.class.equals(method.getReturnType())) { + hasHashCode = true; + } + } + + if (!hasEquals) { + Affirm.fail(String.format( + "[%s] does not override equals", name)); + } + if (!hasHashCode) { + Affirm.fail(String.format( + "[%s] does not override hashCode", name)); + } + } + } + +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java new file mode 100644 index 0000000000..f866650d66 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java @@ -0,0 +1,72 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.anything; + +import java.lang.reflect.Method; +import java.lang.reflect.Parameter; + +import org.hamcrest.Matcher; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.rule.Rule; + +public class HasToStringRule implements Rule { + + private final Matcher m; + public HasToStringRule() { + m = anything(); + } + + public HasToStringRule(Matcher m) { + this.m = m; + } + @Override + public void evaluate(PojoClass pojoClass) { + Class<?> clazz = pojoClass.getClazz(); + if (anyOf(m).matches(clazz)) { + boolean hasToString = false; + final String name = clazz.getSimpleName(); + final Method[] methods; + if (clazz.getSuperclass().equals(Object.class)) { + methods = clazz.getDeclaredMethods(); + } else { + methods = clazz.getMethods(); + } + for (Method method : methods) { + Parameter[] parameters = method.getParameters(); + if ("toString".equals(method.getName()) && String.class.equals(method.getReturnType()) && parameters.length == 0) { + hasToString = true; + break; + } + } + + if (!hasToString) { + Affirm.fail(String.format( + "[%s] does not override toString", name)); + } + } + } + +} diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java b/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java new file mode 100644 index 0000000000..bd582d45dc --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java @@ -0,0 +1,55 @@ +/*- + * ============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.openecomp.mso.openpojo.rules; + +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.anything; + +import org.hamcrest.Matcher; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.validation.affirm.Affirm; +import com.openpojo.validation.test.Tester; +import com.openpojo.validation.utils.ValidationHelper; + +public class ToStringTester implements Tester { + + private final Matcher m; + public ToStringTester() { + m = anything(); + } + + public ToStringTester(Matcher m) { + this.m = m; + } + + @Override + public void run(PojoClass pojoClass) { + Class<?> clazz = pojoClass.getClazz(); + if (anyOf(m).matches(clazz)) { + final Object classInstance = ValidationHelper.getBasicInstance(pojoClass); + + Affirm.affirmFalse("Found default toString output", classInstance.toString().matches(Object.class.getName() + "@" + "\\w+")); + } + + } + +} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java new file mode 100644 index 0000000000..86adb5f458 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.client.aai; + +import org.junit.Test; + +public class AAIUpdatorImplTest { + + AAIUpdatorImpl test = new AAIUpdatorImpl(); + + protected AAIRestClientI client; + + @Test + public void getClientTest() throws Exception { + test.getClient(); + } + + @Test + public void setClientTest() throws Exception { + test.setClient(client); + } + + + @Test(expected = NullPointerException.class) + public void updateVnfToLockedTest() throws Exception { + test.updateVnfToLocked("vnfId","uuId"); + } + + + @Test(expected = NullPointerException.class) + public void updateVnfToUnLockedTest() throws Exception { + test.updateVnfToUnLocked("vnfId","uuId"); + } + +} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java b/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java new file mode 100644 index 0000000000..3895230ed4 --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.client.aai.exceptions; + +import org.junit.Test; + +public class AAIPayloadExceptionTest { + + Throwable t = new Throwable(); + + @Test + public void callConstructorTest() throws Exception { + + AAIPayloadException test1 = new AAIPayloadException("testing"); + + AAIPayloadException test2 = new AAIPayloadException("testing", t); + + AAIPayloadException test3 = new AAIPayloadException(t); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java new file mode 100644 index 0000000000..204dd3e773 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/CompareModelsRequest.java @@ -0,0 +1,68 @@ +/*- + * ============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.apihandlerinfra.e2eserviceinstancebeans; + +import org.codehaus.jackson.map.annotate.JsonSerialize; + +@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT) +public class CompareModelsRequest { + + private String globalSubscriberId; + + private String serviceType; + + private String modelInvariantIdTarget; + + private String modelVersionIdTarget; + + + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getModelInvariantIdTarget() { + return modelInvariantIdTarget; + } + + public void setModelInvariantIdTarget(String modelInvariantIdTarget) { + this.modelInvariantIdTarget = modelInvariantIdTarget; + } + + public String getModelVersionIdTarget() { + return modelVersionIdTarget; + } + + public void setModelVersionIdTarget(String modelVersionIdTarget) { + this.modelVersionIdTarget = modelVersionIdTarget; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandlerTest.java new file mode 100644 index 0000000000..c115b7c44b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/NodeHealthcheckHandlerTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra; + +import org.junit.Test; + +public class NodeHealthcheckHandlerTest { + + // TODO: currently test case is done for coverage + // later, it should be modified properly. + NodeHealthcheckHandler test = new NodeHealthcheckHandler(); + + @Test(expected = NullPointerException.class) + public void nodeHealthcheckTest() throws Exception { + test.nodeHealthcheck(); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RequestActionMapTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RequestActionMapTest.java new file mode 100644 index 0000000000..debaa9b3cd --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/RequestActionMapTest.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra; + +import org.junit.Test; + +public class RequestActionMapTest { + // TODO: currently test case is done for coverage + // later, it should be modified properly. + + RequestActionMap test = new RequestActionMap(); + + @Test + public void getMappedRequestActionTest() throws Exception { + + test.getMappedRequestAction("action"); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcRespTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcRespTest.java new file mode 100644 index 0000000000..e501bf06ca --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/DelE2ESvcRespTest.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.e2eserviceinstancebeans; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class DelE2ESvcRespTest { + + DelE2ESvcResp test = new DelE2ESvcResp(); + + @Test + public void verifyDelE2ESvcResp() throws Exception { + test.setOperationId("operationId"); + assertEquals(test.getOperationId(),"operationId"); + } + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestTest.java new file mode 100644 index 0000000000..489991162c --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2ERequestTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.e2eserviceinstancebeans; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class E2ERequestTest { + + E2ERequest test = new E2ERequest(); + + @Test + public void verifyE2ERequest() throws Exception { + + test.setOperationId("operationId"); + assertEquals(test.getOperationId(),"operationId"); + test.setOperation("operation"); + assertEquals(test.getOperation(),"operation"); + test.setResult("result"); + assertEquals(test.getResult(),"result"); + test.setReason("test"); + assertEquals(test.getReason(),"test"); + test.setUserId("userId"); + assertEquals(test.getUserId(),"userId"); + test.setOperationContent("operation"); + assertEquals(test.getOperationContent(),"operation"); + test.setProgress(123); + assertEquals(test.getProgress(),123); + test.setOperateAt("operate"); + assertEquals(test.getOperateAt(),"operate"); + test.setFinishedAt("finished"); + assertEquals(test.getFinishedAt(),"finished"); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequestTest.java new file mode 100644 index 0000000000..808c701606 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequestTest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.e2eserviceinstancebeans; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class E2EServiceInstanceDeleteRequestTest { + + + E2EServiceInstanceDeleteRequest test = new E2EServiceInstanceDeleteRequest(); + + @Test + public void verifyE2ESerInstanceDelReq() throws Exception { + + test.setGlobalSubscriberId("id"); + assertEquals(test.getGlobalSubscriberId(),"id"); + test.setServiceType("type"); + assertEquals(test.getServiceType(),"type"); + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParamTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParamTest.java new file mode 100644 index 0000000000..23676c0bba --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/E2EUserParamTest.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.e2eserviceinstancebeans; + +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class E2EUserParamTest { + + E2EUserParam test = new E2EUserParam(); + + @Test + public void verifyE2EParam() throws Exception { + + test.setName("name"); + assertEquals(test.getName(),"name"); + test.setValue("value"); + assertEquals(test.getValue(),"value"); + Map<String, Object> additionalProperties = new HashMap<>(); + additionalProperties.put("name", test); + test.setAdditionalProperty("name",test); + assertEquals(test.getAdditionalProperties(),additionalProperties); + + } + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParametersTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParametersTest.java new file mode 100644 index 0000000000..87f9315bc9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/e2eserviceinstancebeans/NsParametersTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.e2eserviceinstancebeans; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; + +public class NsParametersTest { + + NsParameters test = new NsParameters(); + + + @Test + public void verifyNsParameters() throws Exception { + + LocationConstraint obj =new LocationConstraint(); + List<LocationConstraint> locationConstraints = new ArrayList<LocationConstraint>(); + locationConstraints.add(obj); + test.setLocationConstraints(locationConstraints); + assertEquals(test.getLocationConstraints(),locationConstraints); + Map<String, Object> additionalParamForNs = new HashMap<String,Object>(); + additionalParamForNs.put("1",test); + test.setAdditionalParamForNs(additionalParamForNs); + assertEquals(test.getAdditionalParamForNs(),additionalParamForNs); + } + + +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputsTest.java new file mode 100644 index 0000000000..3920094dc6 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkOutputsTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.apihandlerinfra.networkbeans; + +import org.junit.Test; + +public class NetworkOutputsTest { + // TODO: currently test case is done for coverage + // later, it should be modified properly. + + NetworkOutputs test = new NetworkOutputs(); + + @Test + public void getNetworkIdTest() throws Exception { + test.getNetworkId(); + } + + @Test + public void setNetworkIdTest() throws Exception { + test.setNetworkId("id"); + } + + @Test + public void getNetworkNameTest() throws Exception { + test.getNetworkName(); + } + + @Test + public void setNetworkNameTest() throws Exception { + test.setNetworkName("name"); + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetailsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetailsTest.java new file mode 100644 index 0000000000..bfe1ff67e8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestDetailsTest.java @@ -0,0 +1,71 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+public class RequestDetailsTest {
+
+ RequestDetails _requestDetails;
+ RequestInfo _requestInfo;
+
+ public RequestDetailsTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _requestDetails = mock(RequestDetails.class);
+ _requestInfo = new RequestInfo();
+ when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo);
+ }
+
+ @After
+ public void tearDown() {
+ _requestDetails = null;
+ _requestInfo = null;
+ }
+
+ /**
+ * Test of getRequestInfo method
+ */
+ @Test
+ public void testGetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo));
+
+ }
+
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _requestDetails.setRequestInfo(_requestInfo);
+ verify(_requestDetails).setRequestInfo(_requestInfo);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfoTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfoTest.java new file mode 100644 index 0000000000..96a1f9e04d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/RequestInfoTest.java @@ -0,0 +1,118 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class RequestInfoTest {
+
+ RequestInfo _requestInfo;
+ String _source;
+ ValidResponses _responseValue;
+ String _requestorId;
+
+ public RequestInfoTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _requestInfo = mock(RequestInfo.class);
+ _responseValue = ValidResponses.abort;
+ _requestorId = "ab1234";
+ _source = "VID";
+ when(_requestInfo.getRequestorId()).thenReturn(_requestorId);
+ when(_requestInfo.getSource()).thenReturn(_source);
+ when(_requestInfo.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _requestInfo = null;
+ _responseValue = null;
+ }
+
+ /**
+ * Test of getSource method
+ */
+ @Test
+ public void testGetSource() {
+ String result = _requestInfo.getSource();
+ assertEquals(_source, result);
+
+ }
+
+ /**
+ * Test setSource
+ */
+ @Test
+ public void testSetSource() {
+ _requestInfo.setSource("VID");
+ verify(_requestInfo).setSource(_source);
+ }
+
+ /**
+ * Test of getRequestorId method
+ */
+ @Test
+ public void testGetRequestorId() {
+ String result = _requestInfo.getRequestorId();
+ assertEquals(_requestorId, result);
+
+ }
+
+ /**
+ * Test setRequestInfo
+ */
+ @Test
+ public void testSetRequestorId() {
+ _requestInfo.setRequestorId(_requestorId);
+ verify(_requestInfo).setRequestorId(_requestorId);
+ }
+
+
+ /**
+ * Test of getResponseValue method
+ */
+ @Test
+ public void testGetResponseValue() {
+ ValidResponses result = _requestInfo.getResponseValue();
+ assertEquals(_responseValue, result);
+
+ }
+
+ /**
+ * Test setResponseValues method
+ */
+ @Test
+ public void testSetResponseValue() {
+ _requestInfo.setResponseValue(ValidResponses.abort);
+ verify(_requestInfo).setResponseValue(_responseValue);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskListTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskListTest.java new file mode 100644 index 0000000000..4909407722 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskListTest.java @@ -0,0 +1,246 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import org.json.JSONArray;
+
+public class TaskListTest {
+
+ TaskList _taskList;
+ protected String _taskId;
+ protected String _type;
+ protected String _nfRole;
+ protected String _subscriptionServiceType;
+ protected String _originalRequestId;
+ protected String _originalRequestorId;
+ protected String _errorSource;
+ protected String _errorCode;
+ protected String _errorMessage;
+ protected String _buildingBlockName;
+ protected String _buildingBlockStep;
+ protected JSONArray _validResponses;
+
+ public TaskListTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskList = mock(TaskList.class);
+ _taskId = "_taskid";
+ _type = "type";
+ _nfRole = "nfrole";
+ _subscriptionServiceType = "subscriptionservicetype";
+ _originalRequestId = "originalrequestid";
+ _originalRequestorId = "originalrequestorid";
+ _errorSource = "errorsource";
+ _errorCode = "errorcode";
+ _errorMessage = "errormessage";
+ _buildingBlockName = "buildingblockname";
+ _buildingBlockStep = "buildingblockstep";
+ _validResponses = mock(JSONArray.class);
+
+ when(_taskList.getTaskId()).thenReturn(_taskId);
+ when(_taskList.getType()).thenReturn(_type);
+ when(_taskList.getNfRole()).thenReturn(_nfRole);
+ when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType);
+ when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId);
+ when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId);
+ when(_taskList.getErrorSource()).thenReturn(_errorSource);
+ when(_taskList.getErrorCode()).thenReturn(_errorCode);
+ when(_taskList.getErrorMessage()).thenReturn(_errorMessage);
+ when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName);
+ when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep);
+ when(_taskList.getValidResponses()).thenReturn(_validResponses);
+ }
+
+ @After
+ public void tearDown() {
+ _taskList = null;
+ _validResponses = null;
+ }
+
+ @Test
+ public void testGetTaskId() {
+ String result = _taskList.getTaskId();
+ assertEquals(_taskId, result);
+
+ }
+
+ @Test
+ public void testSetTaskId() {
+ _taskList.setTaskId("_taskid");
+ verify(_taskList).setTaskId(_taskId);
+ }
+
+ @Test
+ public void testGetType() {
+ String result = _taskList.getType();
+ assertEquals(_type, result);
+
+ }
+
+ @Test
+ public void testSetType() {
+ _taskList.setType(_type);
+ verify(_taskList).setType(_type);
+ }
+
+ @Test
+ public void testGetNfRole() {
+ String result = _taskList.getNfRole();
+ assertEquals(_nfRole, result);
+
+ }
+
+ @Test
+ public void testSetNfRole() {
+ _taskList.setType(_nfRole);
+ verify(_taskList).setType(_nfRole);
+ }
+
+ @Test
+ public void testGetSubscriptionServiceType() {
+ String result = _taskList.getSubscriptionServiceType();
+ assertEquals(_subscriptionServiceType, result);
+
+ }
+
+ @Test
+ public void testSetSubscriptionServiceType() {
+ _taskList.setSubscriptionServiceType(_subscriptionServiceType);
+ verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType);
+ }
+
+ @Test
+ public void testGetOriginalRequestId() {
+ String result = _taskList.getOriginalRequestId();
+ assertEquals(_originalRequestId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestId() {
+ _taskList.setOriginalRequestId(_originalRequestId);
+ verify(_taskList).setOriginalRequestId(_originalRequestId);
+ }
+
+ @Test
+ public void testGetOriginalRequestorId() {
+ String result = _taskList.getOriginalRequestorId();
+ assertEquals(_originalRequestorId, result);
+
+ }
+
+ @Test
+ public void testSetOriginalRequestorId() {
+ _taskList.setOriginalRequestorId(_originalRequestorId);
+ verify(_taskList).setOriginalRequestorId(_originalRequestorId);
+ }
+
+ @Test
+ public void testGetErrorSource() {
+ String result = _taskList.getErrorSource();
+ assertEquals(_errorSource, result);
+
+ }
+
+ @Test
+ public void testSetErrorSource() {
+ _taskList.setErrorSource(_errorSource);
+ verify(_taskList).setErrorSource(_errorSource);
+ }
+
+ @Test
+ public void testGetErrorCode() {
+ String result = _taskList.getErrorCode();
+ assertEquals(_errorCode, result);
+
+ }
+
+ @Test
+ public void testSetErrorCode() {
+ _taskList.setErrorCode(_errorCode);
+ verify(_taskList).setErrorCode(_errorCode);
+ }
+
+ @Test
+ public void testGetErrorMessage() {
+ String result = _taskList.getErrorMessage();
+ assertEquals(_errorMessage, result);
+
+ }
+
+ @Test
+ public void testSetErrorMessage() {
+ _taskList.setErrorMessage(_errorMessage);
+ verify(_taskList).setErrorMessage(_errorMessage);
+ }
+
+ @Test
+ public void testGetBuildingBlockName() {
+ String result = _taskList.getBuildingBlockName();
+ assertEquals(_buildingBlockName, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockName() {
+ _taskList.setBuildingBlockName(_buildingBlockName);
+ verify(_taskList).setBuildingBlockName(_buildingBlockName);
+ }
+
+ @Test
+ public void testGetBuildingBlockStep() {
+ String result = _taskList.getBuildingBlockStep();
+ assertEquals(_buildingBlockStep, result);
+
+ }
+
+ @Test
+ public void testSetBuildingBlockStep() {
+ _taskList.setBuildingBlockStep(_buildingBlockStep);
+ verify(_taskList).setBuildingBlockStep(_buildingBlockStep);
+ }
+
+ @Test
+ public void testGetValidResponses() {
+
+ JSONArray result = _taskList.getValidResponses();
+ assertEquals(_validResponses, result);
+
+ }
+
+ @Test
+ public void testSetValidResponses() {
+ _taskList.setValidResponses(_validResponses);
+ verify(_taskList).setValidResponses(_validResponses);
+ }
+
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java new file mode 100644 index 0000000000..6d9df82f87 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java @@ -0,0 +1,71 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class TaskRequestReferenceTest {
+
+ TaskRequestReference _taskRequestReference;
+
+ protected String _taskId;
+ public TaskRequestReferenceTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskRequestReference = mock(TaskRequestReference.class);
+ _taskId = "taskid";
+
+ when(_taskRequestReference.getTaskId()).thenReturn(_taskId);
+ }
+
+ @After
+ public void tearDown() {
+ _taskRequestReference = null;
+ }
+
+ /**
+ * Test getTaskRequestReference
+ */
+ @Test
+ public void taskGetRequestReference() {
+ String result = _taskRequestReference.getTaskId();
+ assertEquals(_taskId, result);
+ }
+
+ /**
+ * Test setTaskRequestReference
+ */
+ @Test
+ public void testSetRequestInfo() {
+ _taskRequestReference.setTaskId(_taskId);
+ verify(_taskRequestReference).setTaskId(_taskId);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValueTest.java new file mode 100644 index 0000000000..692cdab877 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariableValueTest.java @@ -0,0 +1,113 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class TaskVariableValueTest {
+ TaskVariableValue _taskVariableValue;
+ protected String _name;
+ protected String _value;
+ protected String _operator;
+
+ public TaskVariableValueTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _taskVariableValue = mock(TaskVariableValue.class);
+ _name = "name";
+ _value = "value";
+ _operator = "operator";
+ when(_taskVariableValue.getName()).thenReturn(_name);
+ when(_taskVariableValue.getValue()).thenReturn(_value);
+ when(_taskVariableValue.getOperator()).thenReturn(_operator);
+ }
+
+ @After
+ public void tearDown() {
+ _taskVariableValue = null;
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetName() {
+ _taskVariableValue.setName(_name);
+ assertEquals(_taskVariableValue.getName(),_name);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetName() {
+ _taskVariableValue.setName(_name);
+ verify(_taskVariableValue).setName(_name);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetValue() {
+ _taskVariableValue.setValue(_value);
+ assertEquals(_taskVariableValue.getValue(),_value);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetValue() {
+ _taskVariableValue.setValue(_value);
+ verify(_taskVariableValue).setValue(_value);
+ }
+
+ /**
+ * Test of getName method
+ */
+ @Test
+ public void testGetOperator() {
+ _taskVariableValue.setOperator(_operator);
+ assertEquals(_taskVariableValue.getOperator(),_operator);
+
+ }
+
+ /**
+ * Test setName
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _taskVariableValue.setOperator(_operator);
+ verify(_taskVariableValue).setOperator(_operator);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariablesTest.java new file mode 100644 index 0000000000..08a9669889 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TaskVariablesTest.java @@ -0,0 +1,69 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+
+public class TaskVariablesTest {
+
+ TaskVariables _taskVariables;
+ private List<TaskVariableValue> _taskVariableValueList;
+
+ public TaskVariablesTest() {
+ }
+
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _taskVariables = mock(TaskVariables.class);
+ _taskVariableValueList = mock(List.class);
+ when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList);
+ }
+
+ @After
+ public void tearDown() {
+ _taskVariables = null;
+ }
+
+ @Test
+ public void testGetTaskVariables() {
+ List<TaskVariableValue> result = _taskVariables.getTaskVariables();
+ assertEquals(_taskVariableValueList, result);
+
+ }
+
+ @Test
+ public void testSetTaskVariables() {
+ _taskVariables.setTaskVariables(_taskVariableValueList);
+ verify(_taskVariables).setTaskVariables(_taskVariableValueList);
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponseTest.java new file mode 100644 index 0000000000..9a9756994c --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksGetResponseTest.java @@ -0,0 +1,69 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.List;
+
+public class TasksGetResponseTest {
+
+ TasksGetResponse _tasksGetResponse;
+ private List<TaskList> _taskList;
+
+ public TasksGetResponseTest() {
+ }
+
+ @SuppressWarnings("unchecked")
+ @Before
+ public void setUp() {
+ _tasksGetResponse = mock(TasksGetResponse.class);
+ _taskList = mock(List.class);
+ when(_tasksGetResponse.getTaskList()).thenReturn(_taskList);
+ }
+
+ @After
+ public void tearDown() {
+ _tasksGetResponse = null;
+ }
+
+ @Test
+ public void testGetTaskList() {
+ List<TaskList> result = _tasksGetResponse.getTaskList();
+ assertEquals(_taskList, result);
+
+ }
+
+ @Test
+ public void testSetTaskList() {
+ _tasksGetResponse.setTaskList(_taskList);
+ verify(_tasksGetResponse).setTaskList(_taskList);
+
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequestTest.java new file mode 100644 index 0000000000..12aa8ef735 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/TasksRequestTest.java @@ -0,0 +1,70 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+
+public class TasksRequestTest {
+ TasksRequest _tasksRequest;
+ private RequestDetails _requestDetails;
+
+ public TasksRequestTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _tasksRequest = mock(TasksRequest.class);
+ _requestDetails = new RequestDetails();
+ when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails);
+ }
+
+ @After
+ public void tearDown() {
+ _tasksRequest = null;
+ }
+
+ /**
+ * Test of getRequestDetails method
+ */
+ @Test
+ public void testGetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails));
+
+ }
+
+ /**
+ * Test setRequestDetails
+ */
+ @Test
+ public void testSetRequestDetails() {
+ _tasksRequest.setRequestDetails(_requestDetails);
+ verify(_tasksRequest).setRequestDetails(_requestDetails);
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValueTest.java new file mode 100644 index 0000000000..8affd08529 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/ValueTest.java @@ -0,0 +1,68 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class ValueTest {
+ Value _valueInstance;
+ protected String _value;
+
+ public ValueTest() {
+ }
+
+ @Before
+ public void setUp() {
+ _valueInstance = mock(Value.class);
+ _value = "_value";
+ when(_valueInstance.getValue()).thenReturn(_value);
+ }
+
+ @After
+ public void tearDown() {
+ _valueInstance = null;
+ }
+
+ /**
+ * Test of getValue method
+ */
+ @Test
+ public void testGetValue() {
+ _valueInstance.setValue(_value);
+ assertEquals(_valueInstance.getValue(),_value);
+
+ }
+
+ /**
+ * Test setValue
+ */
+ @Test
+ public void testSetValue() {
+ _valueInstance.setValue(_value);
+ verify(_valueInstance).setValue(_value);
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/VariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/VariablesTest.java new file mode 100644 index 0000000000..ad61675bbc --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/tasksbeans/VariablesTest.java @@ -0,0 +1,95 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.apihandlerinfra.tasksbeans;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+public class VariablesTest {
+
+ Variables _variables;
+ protected Value _source;
+ protected Value _responseValue;
+ protected Value _requestorId;
+
+ @Before
+ public void setUp() {
+ _variables = mock(Variables.class);
+ _source = mock(Value.class);
+ _responseValue = mock(Value.class);
+ _requestorId = mock(Value.class);
+
+ when(_variables.getSource()).thenReturn(_source);
+ when(_variables.getRequestorId()).thenReturn(_requestorId);
+ when(_variables.getResponseValue()).thenReturn(_responseValue);
+
+ }
+
+ @After
+ public void tearDown() {
+ _variables = null;
+ _source = null;
+ _responseValue = null;
+ _requestorId = null;
+ }
+
+ @Test
+ public void testGetSource() {
+ _variables.setSource(_source);
+ assertTrue(_variables.getSource().equals(_source));
+ }
+
+ @Test
+ public void testSetSource(){
+ _variables.setSource(_source);
+ verify(_variables).setSource(_source);
+ }
+
+ @Test
+ public void testGetResponseValue() {
+ _variables.setResponseValue(_responseValue);
+ assertTrue(_variables.getResponseValue().equals(_responseValue));
+ }
+
+ @Test
+ public void testSetResponseValue(){
+ _variables.setResponseValue(_responseValue);
+ verify(_variables).setResponseValue(_responseValue);
+ }
+
+ @Test
+ public void testGetRequestorId() {
+ _variables.setRequestorId(_requestorId);
+ assertTrue(_variables.getRequestorId().equals(_requestorId));
+ }
+
+ @Test
+ public void testSetRequestorId(){
+ _variables.setRequestorId(_requestorId);
+ verify(_variables).setRequestorId(_requestorId);
+ }
+
+}
diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index 08d5ba7d41..6be4911c6a 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -27,5 +27,11 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar Binary files differindex 2686e4ba57..f052ef9130 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg511NfmService.csar diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar Binary files differindex d2983ce609..eb83644213 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/service_Rg516VmmscSrvc_csar.csar @@ -436,13 +436,22 @@ <artifactId>resteasy-jackson2-provider</artifactId> <version>${resteasy.version}</version> </dependency> - <dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + <version>1.3</version> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-all</artifactId> + <version>1.3</version> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-all</artifactId> @@ -474,12 +483,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-all</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.github.tomakehurst</groupId> <artifactId>wiremock</artifactId> <version>1.56</version> @@ -565,12 +568,6 @@ <scope>compile</scope> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-core</artifactId> - <version>1.3</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> |