diff options
40 files changed, 3185 insertions, 1016 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java new file mode 100644 index 0000000000..214d6f2500 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java @@ -0,0 +1,143 @@ +/*- + * ============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.cloudify.utils; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudSite; +import org.openecomp.mso.cloudify.beans.DeploymentInfo; +import org.openecomp.mso.cloudify.exceptions.MsoCloudifyManagerNotFound; +import org.openecomp.mso.cloudify.v3.client.Cloudify; +import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.properties.MsoPropertiesFactory; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.HashMap; +import java.util.Map; +import static org.mockito.Mockito.mock; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({MsoCloudifyUtils.class}) + + +public class MsoCloudifyUtilsTest { + + + @Mock + MsoPropertiesFactory msoPropertiesFactory; + + @Mock + CloudConfigFactory cloudConfigFactory; + + @Mock + DeploymentInfo deploymentInfo; + + @Mock + Cloudify cloudify; + + @Mock + DeploymentOutputs deploymentOutputs; + + @Mock + CloudSite cloudSite; + + @Test(expected = NullPointerException.class) + public void testCreateandInstallDeployment() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + Map<String, Object> inputs = new HashMap<>(); + inputs.put("1", "value"); + + mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId" + , inputs, true, 1, true); + + assert (mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId" + , inputs, true, 1, true) != null); + + + } + + @Test(expected = NullPointerException.class) + public void testDeploymentOutputs() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId"); + assert (mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId") != null); + } + + @Test(expected = NullPointerException.class) + public void testUninstallAndDeleteDeployment() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1); + assert (mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1) != null); + } + + @Test(expected = NullPointerException.class) + public void testIsBlueprintLoaded() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + mcu.isBlueprintLoaded("cloudSiteId", "blueprintId"); + assertTrue(mcu.isBlueprintLoaded("cloudSiteId", "blueprintId")); + } + + @Test(expected = MsoCloudifyManagerNotFound.class) + public void testCloudifyClient() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + mcu.getCloudifyClient(cloudSite); + assert (mcu.getCloudifyClient(cloudSite) != null); + + } + + + @Test(expected = NullPointerException.class) + public void testuploadBlueprint() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + + Map<String, byte[]> blueprintFiles = new HashMap<String, byte[]>(); + byte[] byteArray = new byte[]{8, 1, 2, 8}; + blueprintFiles.put("1", byteArray); + + mcu.uploadBlueprint("cloudSiteId", "blueprintId", "mainFileName", blueprintFiles, false); + + } + + @Test(expected = NullPointerException.class) + public void testqueryDeployment() throws MsoException { + + MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); + mcu.queryDeployment(cloudify, "deploymentId"); + assert (mcu.queryDeployment(cloudify, "deploymentId") != null); + + + } + +}
\ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java new file mode 100644 index 0000000000..c50ffb03ef --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java @@ -0,0 +1,221 @@ +/*- + * ============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.utils; + + +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.Stack; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudSite; +import org.openecomp.mso.openstack.beans.HeatStatus; +import org.openecomp.mso.openstack.beans.StackInfo; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound; +import org.openecomp.mso.properties.MsoPropertiesFactory; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.doReturn; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({MsoHeatUtils.class}) + + +public class MsoHeatUtilsTest { + + @Mock + + StackInfo stackInfo; + + @Mock + + MsoPropertiesFactory msoPropertiesFactory; + + @Mock + + CloudConfigFactory cloudConfigFactory; + + @Mock + + Heat heatClient; + + @Mock + + CloudSite cloudSite; + + @Test(expected = NullPointerException.class) + public void testCreateStack() throws MsoException + { + + MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); + Map<String,String>metadata=new HashMap<>(); + metadata.put("1", "value"); + mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1); + doReturn(mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + null, null, + null, + true)); + + } + + @Test(expected = NullPointerException.class) + public void testCreateStackOne() throws MsoException + { + MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); + Map<String,String>metadata=new HashMap<>(); + metadata.put("1", "value"); + mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env"); + doReturn(mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env", null, + null, + true)); + } + + @Test(expected = NullPointerException.class) + public void testCreateStackTwo() throws MsoException + { + MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); + Map<String,String>metadata=new HashMap<>(); + metadata.put("1", "value"); + Map<String,Object>fileMap=new HashMap<>(); + fileMap.put("2", "value"); + mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env", + fileMap); + doReturn(mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env", fileMap, + null, + true)); + } + + @Test(expected = NullPointerException.class) + public void testCreateStackThree() throws MsoException + { + MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); + Map<String,String>metadata=new HashMap<>(); + metadata.put("1", "value"); + Map<String,Object>fileMap=new HashMap<>(); + fileMap.put("2", "value"); + Map<String,Object>heatFileMap=new HashMap<>(); + heatFileMap.put("3", "value"); + mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env", + fileMap, + heatFileMap); + doReturn(mht.createStack("cloudSiteId", + "tenantId", + "stackName", + "heatTemplate", + metadata, + true, + 1, + "env", fileMap, + heatFileMap, + true)); + } + + @Test(expected = NullPointerException.class) + + + public void testqueryStack() throws MsoException + { + MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); + + mht.queryStack("cloudSiteId","tenantId","stackName"); + + try { + heatClient = mht.getHeatClient (cloudSite, "tenantId"); + assertNotNull(heatClient); + + } catch (MsoTenantNotFound e) { + doReturn(new StackInfo ("stackName", HeatStatus.NOTFOUND)); + } catch (MsoException me) { + + me.addContext ("QueryStack"); + throw me; + } + + Stack heatStack = mht.queryHeatStack (heatClient, "stackName"); + + assertNull(heatStack); + StackInfo stackInfo = new StackInfo ("stackName", HeatStatus.NOTFOUND); + doReturn(stackInfo); + + assertNotNull(heatStack); + doReturn(new StackInfo (heatStack)); + + + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java new file mode 100644 index 0000000000..738fe9e4d9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java @@ -0,0 +1,26 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoAdapterExceptionTest { + MsoAdapterException msoAdapterException = new MsoAdapterException("test"); + MsoAdapterException msoAdapterExceptionThr = new MsoAdapterException("test" , new Throwable()); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java new file mode 100644 index 0000000000..4027aa6342 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java @@ -0,0 +1,26 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoCloudIdentityNotFoundTest { + MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound(); + MsoCloudIdentityNotFound msoCloudIdentityNotFoundStr = new MsoCloudIdentityNotFound("test"); + public String str = msoCloudIdentityNotFound.toString(); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java new file mode 100644 index 0000000000..cac02152e0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java @@ -0,0 +1,27 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoCloudSiteNotFoundTest { + MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound(); + MsoCloudSiteNotFound msoCloudSiteNotFoundStr = new MsoCloudSiteNotFound("test"); + public String str = msoCloudSiteNotFoundStr.toString(); + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java new file mode 100644 index 0000000000..d1f4db778e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java @@ -0,0 +1,26 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoIOExceptionTest { + MsoIOException msoIOException = new MsoIOException("test"); + MsoIOException msoIOExceptionTh = new MsoIOException("test" , new Throwable()); + public String str = msoIOException.toString(); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java new file mode 100644 index 0000000000..c5217e4933 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoNetworkAlreadyExistsTest { + MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test"); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java new file mode 100644 index 0000000000..ea74efcf42 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoNetworkNotFoundTest { + MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test"); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java new file mode 100644 index 0000000000..58cea958df --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java @@ -0,0 +1,28 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoOpenstackExceptionTest { + MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test"); + MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception()); + public String str = msoOpenstackException.toString(); + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java new file mode 100644 index 0000000000..f36ddfe7a1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoStackAlreadyExistsTest { + MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test","test","test"); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java new file mode 100644 index 0000000000..e422c04fcc --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoStackNotFoundTest { + MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test","test","test"); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java new file mode 100644 index 0000000000..d9e83063d1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoTenantAlreadyExistsTest { + MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test"); +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java new file mode 100644 index 0000000000..a8dd6c6afb --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java @@ -0,0 +1,25 @@ +/*- + * ============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.openstack.exceptions; + +public class MsoTenantNotFoundTest { + MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test"); +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandlerTestException.java b/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandlerTestException.java new file mode 100644 index 0000000000..994ce5dbb3 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandlerTestException.java @@ -0,0 +1,35 @@ +/*- + * ============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 HealthCheckHandlerTestException { + + @Test(expected = NullPointerException.class) + public void testHealthCheckSiteNameNull() { + + HealthCheckHandler hcH = new HealthCheckHandler(); + hcH.healthcheck("request"); + } +} + + diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/AriaVduPluginTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/AriaVduPluginTest.java new file mode 100644 index 0000000000..c6d58143cc --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/AriaVduPluginTest.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.adapters.vnf; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.vdu.utils.VduBlueprint; +import org.openecomp.mso.vdu.utils.VduPlugin; + +import java.util.HashMap; + +public class AriaVduPluginTest { + + VduPlugin vduPlugin = new AriaVduPlugin(); + + @Test(expected = RuntimeException.class) + public void instantiateVduFailedToCreateCSAR() throws Exception { + VduBlueprint blueprint = new VduBlueprint(); + blueprint.setMainTemplateName("blueprintmain"); + vduPlugin.instantiateVdu("cloudid", "tenantid", "vduinstancename", + new VduBlueprint(), new HashMap<>(), null, 100, true); + Assert.assertFalse(true); + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 669a3cb353..80860ec3ce 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -395,16 +395,26 @@ <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> + <!-- bwj: duplicated one <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> + --> + <!-- bwj: duplicated <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>${httpclient.version}</version> </dependency> + --> + <!-- bwj: added --> + <dependency> + <groupId>com.googlecode.libphonenumber</groupId> + <artifactId>libphonenumber</artifactId> + <version>8.9.1</version> + </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java new file mode 100644 index 0000000000..995bb5b19c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CallbackHeaderTest {
+
+ CallbackHeader cbh = new CallbackHeader();
+ CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg");
+
+ @Test
+ public void testCallbackHeader() {
+ cbh.setRequestId("requestId");
+ cbh.setResponseCode("responseCode");
+ cbh.setResponseMessage("responseMessage");
+ assertEquals(cbh.getRequestId(), "requestId");
+ assertEquals(cbh.getResponseCode(), "responseCode");
+ assertEquals(cbh.getResponseMessage(), "responseMessage");
+ assert(cbh.toString()!=null);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java new file mode 100644 index 0000000000..04bc7dc132 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ObjectFactoryTest {
+ ObjectFactory of = new ObjectFactory();
+
+ @Test
+ public void testObjectFactory() {
+ of.createRequestHeader();
+ of.createSDNCAdapterRequest();
+ of.createSDNCAdapterResponse();
+
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java new file mode 100644 index 0000000000..1d04572207 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java @@ -0,0 +1,45 @@ +/*
+* ============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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RequestHeaderTest {
+ RequestHeader rh = new RequestHeader();
+
+ @Test
+ public void testRequestHeader() {
+ rh.setRequestId("requestId");
+ rh.setSvcInstanceId("svcInstanceId");
+ rh.setSvcAction("svcAction");
+ rh.setSvcOperation("svcOperation");
+ rh.setCallbackUrl("callbackUrl");
+ rh.setMsoAction("msoAction");
+ assertEquals(rh.getRequestId(), "requestId");
+ assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
+ assertEquals(rh.getSvcAction(), "svcAction");
+ assertEquals(rh.getSvcOperation(), "svcOperation");
+ assertEquals(rh.getCallbackUrl(), "callbackUrl");
+ assertEquals(rh.getMsoAction(), "msoAction");
+ assert(rh.toString()!=null);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java new file mode 100644 index 0000000000..1219f69874 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+public class RequestTunablesTest {
+ MsoPropertiesFactory mpf = new MsoPropertiesFactory();
+
+ RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf);
+
+ @Test
+ public void testRequestTunables() {
+ rt.setReqId("reqId");
+ rt.setReqMethod("reqMethod");
+ rt.setMsoAction("msoAction");
+ rt.setAction("action");
+ rt.setOperation("operation");
+ rt.setSdncUrl("sdncUrl");
+ rt.setTimeout("timeout");
+ rt.setAsyncInd("asyncInd");
+ rt.setHeaderName("headerName");
+ rt.setSdncaNotificationUrl("sdncaNotificationUrl");
+ rt.setNamespace("namespace");
+ assertEquals(rt.getReqId(), "reqId");
+ assertEquals(rt.getReqMethod(), "reqMethod");
+ assertEquals(rt.getMsoAction(), "msoAction");
+ assertEquals(rt.getAction(), "action");
+ assertEquals(rt.getOperation(), "operation");
+ assertEquals(rt.getSdncUrl(), "sdncUrl");
+ assertEquals(rt.getTimeout(), "timeout");
+ assertEquals(rt.getAsyncInd(), "asyncInd");
+ assertEquals(rt.getHeaderName(), "headerName");
+ assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl");
+ assertEquals(rt.getNamespace(), "namespace");
+ assert(rt.toString()!=null);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java new file mode 100644 index 0000000000..53fbb0a4aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCAdapterCallbackRequestTest {
+
+ SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
+ CallbackHeader cbh = new CallbackHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ sdnccall.setCallbackHeader(cbh);
+ sdnccall.setRequestData(o);
+ assertEquals(sdnccall.getCallbackHeader(), cbh);
+ assertEquals(sdnccall.getRequestData(), o);
+ assert(sdnccall.toString()!=null);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java new file mode 100644 index 0000000000..6b10f25e70 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCAdapterRequestTest {
+
+ SDNCAdapterRequest adapter = new SDNCAdapterRequest();
+ RequestHeader rh = new RequestHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterRequest() {
+ adapter.setRequestHeader(rh);
+ adapter.setRequestData(o);
+ assertEquals(adapter.getRequestHeader(), rh);
+ assertEquals(adapter.getRequestData(), o);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java new file mode 100644 index 0000000000..d8c23249c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java @@ -0,0 +1,43 @@ +/*
+* ============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.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCResponseTest {
+
+ SDNCResponse sdnc = new SDNCResponse("reqId");
+ SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg");
+
+ @Test
+ public void testSDNCResponse() {
+ sdnc.setReqId("reqId");
+ sdnc.setRespCode(0);
+ sdnc.setRespMsg("respMsg");
+ sdnc.setSdncResp("sdncResp");
+ assertEquals(sdnc.getReqId(), "reqId");
+ assertEquals(sdnc.getRespCode(), 0);
+ assertEquals(sdnc.getRespMsg(), "respMsg");
+ assertEquals(sdnc.getSdncResp(), "sdncResp");
+ assert(sdnc.toString()!= null);
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml index 11253869d7..e6434092e1 100644 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -366,6 +366,19 @@ <artifactId>libphonenumber</artifactId> <version>8.9.1</version> </dependency> - + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..c70c971bc7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -0,0 +1,261 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.CompareModelsResult +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.json.JsonUtils +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.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +/** + * This groovy class supports the <class>CompareModelofE2EServiceInstance.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + + * + * Outputs: + * @param - WorkflowException + */ +public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="CMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + utils.log("INFO", " *** preProcessRequest Request *** ", isDebugEnabled) + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + execution.setVariable("operationType", "CompareModel") + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + } 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"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") + + // RESTResponse (for API Handler(APIH) Reply Task) + String syncResponse = compareModelsResult.toString() + utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>${source}</source> + </request-info> + <aetgt:status-message>E2E Service Instance Compare model successfully.</aetgt:status-message> + <aetgt:mso-bpel-name>CompareModelofE2EServiceInstance</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>UUI</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..30db8c53eb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -0,0 +1,260 @@ +/*- + * ============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.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.CompareModelsResult +import org.openecomp.mso.bpmn.core.domain.ResourceModelInfo +import org.openecomp.mso.bpmn.core.json.JsonUtils +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.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + + +import java.util.List +import java.util.Map +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +/** + * This groovy class supports the <class>DoCompareModelofE2EServiceInstance.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + * + * Outputs: + * @param - compareModelsResult CompareModelsResult + + */ +public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DCMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + execution.setVariable("isDebugLogEnabled","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 CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) + + execution.setVariable("prefix", Prefix) + //Inputs + + //subscriberInfo. for AAI GET + String globalSubscriberId = execution.getVariable("globalSubscriberId") + utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + + String serviceType = execution.getVariable("serviceType") + utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + + 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) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget') + if (isBlank(modelInvariantUuid)){ + msg = "Input modelInvariantUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelUuid = execution.getVariable('modelVersionIdTarget') + if (isBlank(modelUuid)){ + msg = "Input modelUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + // Set Target Template info + execution.setVariable("model-invariant-id-target", modelInvariantUuid) + execution.setVariable("model-version-id-target", modelUuid) + + + utils.log("INFO", "Exited " + method, isDebugEnabled) + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + + String siData = execution.getVariable("GENGS_service") + utils.log("INFO", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + utils.log("INFO", "SI Data" + siData, isDebugEnabled) + + // Get Template uuid and version + if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { + utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) + + def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id") + def modelVersionId = utils.getNodeText1(siData, "model-version-id") + + // Set Original Template info + execution.setVariable("model-invariant-id-original", modelInvariantId) + execution.setVariable("model-version-id-original", modelVersionId) + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, 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) + } + } + + utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void postCompareModelVersions(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + + List<Resource> addResourceList = execution.getVariable("addResourceList") + List<Resource> delResourceList = execution.getVariable("delResourceList") + + CompareModelsResult cmpResult = new CompareModelsResult() + List<ResourceModelInfo> addedResourceList = new ArrayList<ResourceModelInfo>() + List<ResourceModelInfo> deletedResourceList = new ArrayList<ResourceModelInfo>() + + + String serviceModelUuid = execution.getVariable("model-version-id-target") + List<String> requestInputs = new ArrayList<String>() + ModelInfo mi = null; + for(Resource rc : addResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + addedResourceList.add(rmodel) + + Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) + requestInputs.addAll(resourceParameters.keySet()) + } + + for(Resource rc : deletedResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + deletedResourceList.add(rmodel) + } + + cmpResult.setAddedResourceList(addedResourceList) + cmpResult.setDeletedResourceList(deletedResourceList) + cmpResult.setRequestInputs(requestInputs) + + execution.setVariable("compareModelsResult", cmpResult) + } + +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 47ad795e25..a58ab9b756 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -411,8 +411,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> resourceList = serviceDecomposition.getServiceResources() - for(String resource : resourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + for(Resource resource : resourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" @@ -425,13 +425,13 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { <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>""" + <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) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index e7a88be5b8..3071d1c20d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -114,7 +114,7 @@ csi.sendSyncError(execution)]]></bpmn:script> <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_0z4faf9</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1853xxi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def csi = new UpdateCustomE2EServiceInstance()
@@ -133,7 +133,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoUpdateE2EServiceInstance" /> <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoUpdateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" /> <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> - <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_09rx901" /> <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -141,6 +141,37 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <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:scriptTask id="ScriptTask_09rx901" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0utlsnd</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new UpdateCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0mr5k9q" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0utlsnd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1853xxi</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0utlsnd" sourceRef="ScriptTask_09rx901" targetRef="ServiceTask_0mr5k9q" /> + <bpmn:sequenceFlow id="SequenceFlow_1853xxi" sourceRef="ServiceTask_0mr5k9q" targetRef="ScriptTask_0xupxj9" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -155,7 +186,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="463" y="632" width="394" height="188" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoUpdateE2EServiceInstance"> - <dc:Bounds x="717" y="158" width="100" height="80" /> + <dc:Bounds x="767" 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" /> @@ -164,10 +195,10 @@ csi.sendSyncResponse(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> - <dc:Bounds x="214" y="158" width="100" height="80" /> + <dc:Bounds x="105" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> - <dc:Bounds x="1038" y="158" width="100" height="80" /> + <dc:Bounds x="1073" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> <dc:Bounds x="1226" y="158" width="100" height="80" /> @@ -176,39 +207,39 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="348" y="370" width="679" height="194" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> - <dc:Bounds x="459" y="158" width="100" height="80" /> + <dc:Bounds x="600" 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" /> + <dc:Bounds x="942" y="173" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="903" y="145" width="50" height="12" /> + <dc:Bounds x="943" y="145" width="49" 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" /> + <dc:Bounds x="949" y="286" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="883" y="322" width="0" height="12" /> + <dc:Bounds x="877" y="322" width="90" 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" /> + <di:waypoint xsi:type="dc:Point" x="105" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="77" y="177" width="90" height="12" /> + <dc:Bounds x="22.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> - <di:waypoint xsi:type="dc:Point" x="559" y="198" /> - <di:waypoint xsi:type="dc:Point" x="717" y="198" /> + <di:waypoint xsi:type="dc:Point" x="700" y="198" /> + <di:waypoint xsi:type="dc:Point" x="767" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="177" width="90" height="12" /> + <dc:Bounds x="688.5" 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="817" y="198" /> - <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <di:waypoint xsi:type="dc:Point" x="867" y="198" /> + <di:waypoint xsi:type="dc:Point" x="942" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="815" y="177" width="90" height="12" /> + <dc:Bounds x="859.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> @@ -219,35 +250,33 @@ csi.sendSyncResponse(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> - <di:waypoint xsi:type="dc:Point" x="314" y="198" /> - <di:waypoint xsi:type="dc:Point" x="459" y="198" /> + <di:waypoint xsi:type="dc:Point" x="205" y="198" /> + <di:waypoint xsi:type="dc:Point" x="274" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="341.5" y="177" width="90" height="12" /> + <dc:Bounds x="194.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> - <di:waypoint xsi:type="dc:Point" x="953" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="1038" y="198" /> + <di:waypoint xsi:type="dc:Point" x="992" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1073" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="987" y="195" width="20" height="12" /> + <dc:Bounds x="1023.5062499999999" y="195" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> - <di:waypoint xsi:type="dc:Point" x="1138" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1173" y="198" /> <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1137" y="183" width="0" height="12" /> + <dc:Bounds x="1154.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" /> + <di:waypoint xsi:type="dc:Point" x="967" y="223" /> + <di:waypoint xsi:type="dc:Point" x="967" y="250" /> + <di:waypoint xsi:type="dc:Point" x="967" y="250" /> + <di:waypoint xsi:type="dc:Point" x="967" y="286" /> <bpmndi:BPMNLabel> - <dc:Bounds x="901" y="228" width="15" height="12" /> + <dc:Bounds x="942" y="228" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> @@ -332,6 +361,26 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="715.5" y="459" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_09rx901_di" bpmnElement="ScriptTask_09rx901"> + <dc:Bounds x="274" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0mr5k9q_di" bpmnElement="ServiceTask_0mr5k9q"> + <dc:Bounds x="444" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0utlsnd_di" bpmnElement="SequenceFlow_0utlsnd"> + <di:waypoint xsi:type="dc:Point" x="374" y="198" /> + <di:waypoint xsi:type="dc:Point" x="444" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="409" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1853xxi_di" bpmnElement="SequenceFlow_1853xxi"> + <di:waypoint xsi:type="dc:Point" x="544" y="198" /> + <di:waypoint xsi:type="dc:Point" x="600" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="572" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index ddc87c7d55..b681e2f3b4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -96,16 +96,6 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> def ddsi = new DoCreateE2EServiceInstance() ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0vbznai</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DoCreateE2EServiceInstance() -csi.postConfigRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_0kbbt94"> - <bpmn2:incoming>SequenceFlow_0vbznai</bpmn2:incoming> - </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" /> <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> @@ -134,68 +124,8 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </camunda:connector> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10reo7r</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> - <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_11f2zuu</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_10reo7r" sourceRef="Task_0raqlqc" targetRef="ScriptTask_1y0los4" /> - <bpmn2:sequenceFlow id="SequenceFlow_11f2zuu" sourceRef="Task_0io5qby" targetRef="IntermediateThrowEvent_0f2w7aj" /> - <bpmn2:scriptTask id="ScriptTask_1y0los4" name="Sequence Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_10reo7r</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13d9g1n</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.sequenceResoure(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13d9g1n" sourceRef="ScriptTask_1y0los4" targetRef="ExclusiveGateway_07rr3wp" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0n9y4du" name="All ResourceFinished?"> - <bpmn2:incoming>SequenceFlow_1jenxlp</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0q6uy30</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_16nxl6h</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_0q6uy30" name="no" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_0l4nkqr"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "false" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_0y4u2ty" name="Parse Next Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_13c7bhn</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1jenxlp</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.parseNextResource(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" /> - <bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.getCurrentResoure(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:exclusiveGateway id="ExclusiveGateway_07rr3wp" name="Is SDN-C Service Needed"> - <bpmn2:incoming>SequenceFlow_13d9g1n</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_18wj44x</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1vprtt9</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_18wj44x" name="no" sourceRef="ExclusiveGateway_07rr3wp" targetRef="IntermediateThrowEvent_0f2w7aj"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "false" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="Task_0qlkmvt" name="Prepare resource recipe Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0uiygod</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1u9k0dm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe"> - <bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.executeResourceRecipe(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> <bpmn2:linkEventDefinition name="Decompose_Service" /> @@ -251,30 +181,14 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0f2w7aj" name="GoTo ResourceLoop"> - <bpmn2:incoming>SequenceFlow_18wj44x</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_11f2zuu</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_032s0yi</bpmn2:incoming> <bpmn2:linkEventDefinition name="ResourceLoop" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_0io5qby"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" /> - <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_02bah5m" name="ResourceLoop"> - <bpmn2:outgoing>SequenceFlow_1qozd66</bpmn2:outgoing> - <bpmn2:linkEventDefinition name="ResourceLoop" /> - </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_16nxl6h" name="yes" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_1xdjlzm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "true" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" /> - <bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" /> - <bpmn2:sequenceFlow id="SequenceFlow_13c7bhn" sourceRef="Task_12ghoph" targetRef="ScriptTask_0y4u2ty" /> - <bpmn2:sequenceFlow id="SequenceFlow_0vbznai" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" /> - <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="ScriptTask_0l4nkqr" /> <bpmn2:sequenceFlow id="SequenceFlow_1gusrvp" sourceRef="Task_0ush1g4" targetRef="IntermediateThrowEvent_1mlbhmt" /> <bpmn2:scriptTask id="Task_0ush1g4" name="Call Homing(To be Done)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_027owbf</bpmn2:incoming> @@ -283,6 +197,40 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> def dcsi= new DoCreateE2EServiceInstance() dcsi.doServiceHoming(execution)]]></bpmn2:script> </bpmn2:scriptTask> + <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResources"> + <bpmn2:extensionElements> + <camunda:in source="nsServiceName" target="nsServiceName" /> + <camunda:in source="nsServiceDescription" target="nsServiceDescription" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="resourceType" target="resourceType" /> + <camunda:in source="resourceUUID" target="resourceUUID" /> + <camunda:in source="resourceParameters" target="resourceParameters" /> + <camunda:in source="operationType" target="operationType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0bf6bzp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstance() +csi.preProcessForAddResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_1y7jr4t" name="PostProcess for Add Resource" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0d0c20n</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_032s0yi</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstance() +csi.postProcessForAddResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" /> + <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" /> + <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" /> + <bpmn2:sequenceFlow id="SequenceFlow_032s0yi" sourceRef="ScriptTask_1y7jr4t" targetRef="IntermediateThrowEvent_0f2w7aj" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -390,15 +338,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="679" y="960" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm"> - <dc:Bounds x="1119" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> - <dc:Bounds x="1315" y="507" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1197" y="547" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0"> <di:waypoint xsi:type="dc:Point" x="296" y="300" /> <di:waypoint xsi:type="dc:Point" x="402" y="300" /> @@ -412,82 +351,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc"> <dc:Bounds x="402" y="260" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby"> - <dc:Bounds x="944" y="353" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_10reo7r_di" bpmnElement="SequenceFlow_10reo7r"> - <di:waypoint xsi:type="dc:Point" x="502" y="300" /> - <di:waypoint xsi:type="dc:Point" x="583" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="497.5" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu"> - <di:waypoint xsi:type="dc:Point" x="1044" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1090" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1090" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1060" y="340.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4"> - <dc:Bounds x="583" y="260" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n"> - <di:waypoint xsi:type="dc:Point" x="683" y="300" /> - <di:waypoint xsi:type="dc:Point" x="753" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="673" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0n9y4du_di" bpmnElement="ExclusiveGateway_0n9y4du" isMarkerVisible="true"> - <dc:Bounds x="929" y="500" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="912" y="554" width="83" height="36" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30"> - <di:waypoint xsi:type="dc:Point" x="954" y="550" /> - <di:waypoint xsi:type="dc:Point" x="954" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="565" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="594" y="670" width="12" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0y4u2ty_di" bpmnElement="ScriptTask_0y4u2ty"> - <dc:Bounds x="728" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp"> - <di:waypoint xsi:type="dc:Point" x="828" y="525" /> - <di:waypoint xsi:type="dc:Point" x="929" y="525" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="833.5" y="504" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0l4nkqr_di" bpmnElement="ScriptTask_0l4nkqr"> - <dc:Bounds x="196" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_07rr3wp_di" bpmnElement="ExclusiveGateway_07rr3wp" isMarkerVisible="true"> - <dc:Bounds x="753" y="275" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="736" y="329" width="87" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x"> - <di:waypoint xsi:type="dc:Point" x="803" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="832.3633633633633" y="294" width="12" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0u88n0f_di" bpmnElement="Task_0qlkmvt"> - <dc:Bounds x="357" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1y17r20_di" bpmnElement="Task_12ghoph"> - <dc:Bounds x="551" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> <dc:Bounds x="1315" y="-207" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -593,14 +456,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="1299" y="323" width="73" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9"> - <di:waypoint xsi:type="dc:Point" x="778" y="325" /> - <di:waypoint xsi:type="dc:Point" x="778" y="393" /> - <di:waypoint xsi:type="dc:Point" x="944" y="393" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="784" y="353" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> <dc:Bounds x="18" y="282" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -614,64 +469,57 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="125" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m"> - <dc:Bounds x="18" y="507" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2" y="543" width="73" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h"> - <di:waypoint xsi:type="dc:Point" x="979" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1119" y="525" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1040" y="504" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod"> - <di:waypoint xsi:type="dc:Point" x="296" y="525" /> - <di:waypoint xsi:type="dc:Point" x="357" y="525" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="326.5" y="504" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm"> - <di:waypoint xsi:type="dc:Point" x="457" y="525" /> - <di:waypoint xsi:type="dc:Point" x="551" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp"> + <di:waypoint xsi:type="dc:Point" x="1157" y="-39" /> + <di:waypoint xsi:type="dc:Point" x="1315" y="-39" /> <bpmndi:BPMNLabel> - <dc:Bounds x="504" y="504" width="0" height="12" /> + <dc:Bounds x="1236" y="-60" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn"> - <di:waypoint xsi:type="dc:Point" x="651" y="525" /> - <di:waypoint xsi:type="dc:Point" x="728" y="525" /> + <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> + <dc:Bounds x="1057" y="-79" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas"> + <dc:Bounds x="852" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb"> + <dc:Bounds x="629" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t"> + <dc:Bounds x="1068" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff"> + <di:waypoint xsi:type="dc:Point" x="502" y="300" /> + <di:waypoint xsi:type="dc:Point" x="629" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="689.5" y="504" width="0" height="12" /> + <dc:Bounds x="565.5" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0vbznai_di" bpmnElement="SequenceFlow_0vbznai"> - <di:waypoint xsi:type="dc:Point" x="1219" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp"> + <di:waypoint xsi:type="dc:Point" x="729" y="300" /> + <di:waypoint xsi:type="dc:Point" x="789" y="300" /> + <di:waypoint xsi:type="dc:Point" x="789" y="300" /> + <di:waypoint xsi:type="dc:Point" x="852" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1267" y="504" width="0" height="12" /> + <dc:Bounds x="804" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66"> - <di:waypoint xsi:type="dc:Point" x="54" y="525" /> - <di:waypoint xsi:type="dc:Point" x="196" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n"> + <di:waypoint xsi:type="dc:Point" x="952" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1009" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1009" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1068" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="125" y="504" width="0" height="12" /> + <dc:Bounds x="1024" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp"> - <di:waypoint xsi:type="dc:Point" x="1157" y="-39" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="-39" /> + <bpmndi:BPMNEdge id="SequenceFlow_032s0yi_di" bpmnElement="SequenceFlow_032s0yi"> + <di:waypoint xsi:type="dc:Point" x="1168" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1236" y="-60" width="0" height="12" /> + <dc:Bounds x="1241.5" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> - <dc:Bounds x="1057" y="-79" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 53450fcb8e..86b422632f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -51,84 +51,14 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script> def csi = new DoUpdateE2EServiceInstance() csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_04rn9mp" name="Post Config Service Instance Update" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0cnuo36</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1ryg78h</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DoUpdateE2EServiceInstance() -csi.postConfigRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:intermediateCatchEvent id="StartEvent_StartResource" name="StartAddResources"> <bpmn2:outgoing>SequenceFlow_115mdln</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartAddResource" /> </bpmn2:intermediateCatchEvent> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1dwg5lz" name="GoToStartCompareModelVersions"> - <bpmn2:incoming>SequenceFlow_1i45vfx</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartCompareModelVersions" /> </bpmn2:intermediateThrowEvent> - <bpmn2:scriptTask id="ScriptTask_1wk7zcu" name="Prepare Update Service Oper Status(90%)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0gr3l25</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "90") -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:serviceTask id="ServiceTask_1a6cmdu" name="Update Service Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0gr3l25</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0cnuo36</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_0gr3l25" sourceRef="ScriptTask_1wk7zcu" targetRef="ServiceTask_1a6cmdu" /> - <bpmn2:sequenceFlow id="SequenceFlow_0cnuo36" sourceRef="ServiceTask_1a6cmdu" targetRef="ScriptTask_04rn9mp" /> - <bpmn2:scriptTask id="ScriptTask_1pwo0jp" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0aylb6e</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_0aylb6e" sourceRef="ScriptTask_1pwo0jp" targetRef="ServiceTask_1dqzdko" /> - <bpmn2:serviceTask id="ServiceTask_1dqzdko" name="Init Resource Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0aylb6e</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1r1hl23</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_1r1hl23" sourceRef="ServiceTask_1dqzdko" targetRef="ScriptTask_17ssed5" /> <bpmn2:sequenceFlow id="SequenceFlow_115mdln" sourceRef="StartEvent_StartResource" targetRef="Task_09laxun" /> <bpmn2:sequenceFlow id="SequenceFlow_0yztz2p" sourceRef="Task_09laxun" targetRef="Task_1wyyy33" /> <bpmn2:sequenceFlow id="SequenceFlow_0lblyhi" sourceRef="Task_1wyyy33" targetRef="Task_0ag30bf" /> @@ -210,21 +140,12 @@ ddsi.preCompareModelVersions(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0qg0uyn</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_0qg0uyn" sourceRef="CallActivity_18nvmnn" targetRef="ScriptTask_0i8cqdy_PostProcessAAIGET" /> - <bpmn2:scriptTask id="ScriptTask_17ssed5" name="Post Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1r1hl23</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1i45vfx</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1i45vfx" sourceRef="ScriptTask_17ssed5" targetRef="IntermediateThrowEvent_1dwg5lz" /> - <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status(10%)" scriptFormat="groovy"> + <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0l4gosl</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0r6c0ci</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "10") def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> +ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:serviceTask id="ServiceTask_17u9q9u" name="Init Resource Oper Status"> <bpmn2:extensionElements> @@ -258,48 +179,9 @@ dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0r6c0ci" sourceRef="ScriptTask_0acnvkp" targetRef="ServiceTask_17u9q9u" /> <bpmn2:sequenceFlow id="SequenceFlow_1muxopq" sourceRef="ServiceTask_17u9q9u" targetRef="ScriptTask_0r74c3c" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0vneaao" name="GoTo StartDeleteResources"> - <bpmn2:incoming>SequenceFlow_0s57qft</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartDeleteResources" /> </bpmn2:intermediateThrowEvent> - <bpmn2:scriptTask id="ScriptTask_1na4qzo" name="Prepare Resource Oper Status(60%)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1fa1yjd</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "60") -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:serviceTask id="ServiceTask_0c13nyt" name="Init Resource Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1fa1yjd</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1eg944u</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:scriptTask id="ScriptTask_0iq531p" name="Post Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1eg944u</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0s57qft</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_0s57qft" sourceRef="ScriptTask_0iq531p" targetRef="IntermediateThrowEvent_0vneaao" /> - <bpmn2:sequenceFlow id="SequenceFlow_1eg944u" sourceRef="ServiceTask_0c13nyt" targetRef="ScriptTask_0iq531p" /> <bpmn2:callActivity id="CallActivity_1nm9zq7" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> <bpmn2:extensionElements> <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> @@ -377,25 +259,23 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0ku36oy" sourceRef="IntermediateCatchEvent_0z04o3s" targetRef="ScriptTask_0jsblrq" /> <bpmn2:sequenceFlow id="SequenceFlow_0mwh16g" sourceRef="ScriptTask_0jsblrq" targetRef="ServiceTask_1ydxyw0" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_06lo96a" name="GoTo UpdateAAI"> - <bpmn2:incoming>SequenceFlow_1ryg78h</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming> <bpmn2:linkEventDefinition name="UpdateAAI" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1ryg78h" sourceRef="ScriptTask_04rn9mp" targetRef="IntermediateThrowEvent_06lo96a" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0hucdtk" name="GoTo FinishProcess"> <bpmn2:incoming>SequenceFlow_0x0mhlj</bpmn2:incoming> <bpmn2:linkEventDefinition name="FinishProcess" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_0x0mhlj" sourceRef="ScriptTask_0xtabf8" targetRef="IntermediateThrowEvent_0hucdtk" /> - <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="ScriptTask_1pwo0jp" /> + <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="IntermediateThrowEvent_1dwg5lz" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_09ur9ds" name="GoTo StartAddResources"> <bpmn2:incoming>SequenceFlow_1sgsysh</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartAddResource" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_0l4gosl" sourceRef="ScriptTask_0wl77h6" targetRef="ScriptTask_0acnvkp" /> <bpmn2:sequenceFlow id="SequenceFlow_1sgsysh" sourceRef="ScriptTask_0r74c3c" targetRef="IntermediateThrowEvent_09ur9ds" /> - <bpmn2:sequenceFlow id="SequenceFlow_1fa1yjd" sourceRef="ScriptTask_1na4qzo" targetRef="ServiceTask_0c13nyt" /> - <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="ScriptTask_1na4qzo" /> - <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="ScriptTask_1wk7zcu" /> + <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="IntermediateThrowEvent_0vneaao" /> + <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="IntermediateThrowEvent_06lo96a" /> <bpmn2:subProcess id="SubProcess_0jo0nms" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_06768u3"> <bpmn2:outgoing>SequenceFlow_05j3sat</bpmn2:outgoing> @@ -516,9 +396,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ScriptTask_1fj89ew_di" bpmnElement="Task_0ag30bf"> <dc:Bounds x="858" y="828" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_04rn9mp_di" bpmnElement="ScriptTask_04rn9mp"> - <dc:Bounds x="1675" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0jks7by_di" bpmnElement="StartEvent_StartResource"> <dc:Bounds x="74" y="850" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -531,50 +408,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1925" y="444" width="90" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1wk7zcu_di" bpmnElement="ScriptTask_1wk7zcu"> - <dc:Bounds x="1152" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1a6cmdu_di" bpmnElement="ServiceTask_1a6cmdu"> - <dc:Bounds x="1421" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0gr3l25_di" bpmnElement="SequenceFlow_0gr3l25"> - <di:waypoint xsi:type="dc:Point" x="1252" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1291.5" y="1100" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0cnuo36_di" bpmnElement="SequenceFlow_0cnuo36"> - <di:waypoint xsi:type="dc:Point" x="1521" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1553" y="1100" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1pwo0jp_di" bpmnElement="ScriptTask_1pwo0jp"> - <dc:Bounds x="1152" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0aylb6e_di" bpmnElement="SequenceFlow_0aylb6e"> - <di:waypoint xsi:type="dc:Point" x="1252" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1337" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1337" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1307" y="416" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1dqzdko_di" bpmnElement="ServiceTask_1dqzdko"> - <dc:Bounds x="1421" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1r1hl23_di" bpmnElement="SequenceFlow_1r1hl23"> - <di:waypoint xsi:type="dc:Point" x="1521" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1598" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1598" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1568" y="416" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_115mdln_di" bpmnElement="SequenceFlow_115mdln"> <di:waypoint xsi:type="dc:Point" x="110" y="868" /> <di:waypoint xsi:type="dc:Point" x="293" y="868" /> @@ -682,16 +515,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="724.5" y="400" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_17ssed5_di" bpmnElement="ScriptTask_17ssed5"> - <dc:Bounds x="1675" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1i45vfx_di" bpmnElement="SequenceFlow_1i45vfx"> - <di:waypoint xsi:type="dc:Point" x="1775" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1818" y="401" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0acnvkp_di" bpmnElement="ScriptTask_0acnvkp"> <dc:Bounds x="1152" y="600" width="100" height="80" /> </bpmndi:BPMNShape> @@ -721,29 +544,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1925" y="890" width="90" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1na4qzo_di" bpmnElement="ScriptTask_1na4qzo"> - <dc:Bounds x="1152" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0c13nyt_di" bpmnElement="ServiceTask_0c13nyt"> - <dc:Bounds x="1421" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0iq531p_di" bpmnElement="ScriptTask_0iq531p"> - <dc:Bounds x="1675" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0s57qft_di" bpmnElement="SequenceFlow_0s57qft"> - <di:waypoint xsi:type="dc:Point" x="1775" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1818" y="847" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1eg944u_di" bpmnElement="SequenceFlow_1eg944u"> - <di:waypoint xsi:type="dc:Point" x="1521" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1553" y="847" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1nm9zq7_di" bpmnElement="CallActivity_1nm9zq7"> <dc:Bounds x="1410" y="1333" width="100" height="80" /> </bpmndi:BPMNShape> @@ -829,13 +629,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1939" y="1143" width="82" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ryg78h_di" bpmnElement="SequenceFlow_1ryg78h"> - <di:waypoint xsi:type="dc:Point" x="1775" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1863" y="1100" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0hucdtk_di" bpmnElement="IntermediateThrowEvent_0hucdtk"> <dc:Bounds x="1951" y="1355" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -853,9 +646,9 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_167wc99_di" bpmnElement="SequenceFlow_167wc99"> <di:waypoint xsi:type="dc:Point" x="958" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="422" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="422" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="401" width="0" height="12" /> + <dc:Bounds x="1409.5" y="401" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_09ur9ds_di" bpmnElement="IntermediateThrowEvent_09ur9ds"> @@ -878,25 +671,18 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1863" y="619" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1fa1yjd_di" bpmnElement="SequenceFlow_1fa1yjd"> - <di:waypoint xsi:type="dc:Point" x="1252" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1336.5" y="847" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nqfgvs_di" bpmnElement="SequenceFlow_1nqfgvs"> <di:waypoint xsi:type="dc:Point" x="958" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="868" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="868" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="847" width="0" height="12" /> + <dc:Bounds x="1409.5" y="847" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1uu6uiu_di" bpmnElement="SequenceFlow_1uu6uiu"> <di:waypoint xsi:type="dc:Point" x="958" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="1121" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="1121" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="1100" width="0" height="12" /> + <dc:Bounds x="1409.5" y="1100" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0jo0nms_di" bpmnElement="SubProcess_0jo0nms" isExpanded="true"> diff --git a/bpmn/MSOURN-plugin/pom.xml b/bpmn/MSOURN-plugin/pom.xml index 0dc8d6dee5..b2db869f13 100644 --- a/bpmn/MSOURN-plugin/pom.xml +++ b/bpmn/MSOURN-plugin/pom.xml @@ -31,7 +31,7 @@ <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.3.2</version>
+ <version>1.3.3</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java index d204afe93c..8bfc4ced76 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java @@ -24,6 +24,7 @@ package org.openecomp.mso.camunda.tests; import static org.junit.Assert.assertEquals; import java.io.IOException; +import java.util.UUID; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; @@ -67,8 +68,6 @@ public class CamundaClientTest { @Test public void tesCamundaPost() throws JsonGenerationException, JsonMappingException, IOException { - - String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; HttpResponse mockResponse = createResponse(200, responseBody); @@ -99,6 +98,30 @@ public class CamundaClientTest { assertEquals(statusCode, HttpStatus.SC_OK); } + @Test + public void testCamundaPostJson() throws IOException { + String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; + + HttpResponse mockResponse = createResponse(200, responseBody); + mockHttpClient = Mockito.mock(HttpClient.class); + Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) + .thenReturn(mockResponse); + + String reqXML = "<xml>test</xml>"; + String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; + + MsoJavaProperties props = new MsoJavaProperties(); + props.setProperty(CommonConstants.CAMUNDA_URL, "http://localhost:8089"); + + RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); + requestClient.setClient(mockHttpClient); + HttpResponse response = requestClient.post("mso-req-id", false, 180, + "createInstance", "svc-inst-id", "vnf-id", "vf-module-id", "vg-id", "nw-id", "conf-id", "svc-type", + "vnf-type", "vf-module-type", "nw-type", "", ""); + assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); + assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); + } + private HttpResponse createResponse(int respStatus, String respBody) { HttpResponse response = new BasicHttpResponse( diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 97bfc0dcca..110c4da4ff 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -21,7 +21,7 @@ <jax-rs-version>1.1.1</jax-rs-version> <json4s-jackson-version>3.2.4</json4s-jackson-version> <json4s-core-version>3.0.0</json4s-core-version> - <fasterxml-json-version>2.2.2</fasterxml-json-version> + <fasterxml-json-version>2.8.7</fasterxml-json-version> <scala-lang-version>2.9.1-1</scala-lang-version> <reflections-version>0.9.9-RC1</reflections-version> <javassist-version>3.16.1-GA</javassist-version> diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index b1906d143f..4920814e32 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -20,9 +20,11 @@ package org.openecomp.mso.apihandlerinfra;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -33,6 +35,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
+import org.apache.http.client.ClientProtocolException;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHttpResponse;
import org.hibernate.HibernateException;
@@ -40,6 +43,7 @@ import org.hibernate.Session; import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.internal.SessionFactoryImpl;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Ignore;
import org.mockito.Mockito;
@@ -51,6 +55,7 @@ import org.openecomp.mso.db.catalog.beans.Service; import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
import org.openecomp.mso.properties.MsoDatabaseException;
import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.OperationStatus;
import org.openecomp.mso.requestsdb.RequestsDatabase;
@@ -138,6 +143,21 @@ public class E2EServiceInstancesTest { "}" +
"}";
+ private final String compareModelsRequest = "{" +
+ "\"globalSubscriberId\": \"60c3e96e-0970-4871-b6e0-3b6de7561519\"," +
+ "\"serviceType\": \"vnf\"," +
+ "\"modelInvariantIdTarget\": \"60c3e96e-0970-4871-b6e0-3b6de1234567\"," +
+ "\"modelVersionIdTarget\": \"modelVersionIdTarget\"" +
+ "}";
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+ }
+
@Test
public void createE2EServiceInstanceTestSuccess() {
new MockUp<RequestsDatabase>() {
@@ -833,4 +853,71 @@ public class E2EServiceInstancesTest { String respStr = resp.getEntity().toString();
assertTrue(respStr.contains("SVC2000"));
}
+
+ @Test
+ public void compareModelwithTargetVersionBadRequest(){
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response response = instance.compareModelwithTargetVersion("", "12345", "v3");
+
+ assertNotNull(response);
+ assertTrue(response.getEntity().toString().contains("Mapping of request to JSON object failed."));
+
+ }
+ @Test
+ public void compareModelwithTargetVersionFailedBPMNCall(){
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd)
+ throws ClientProtocolException, IOException {
+
+ throw new ClientProtocolException();
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response response = instance.compareModelwithTargetVersion(compareModelsRequest, "12345", "v3");
+
+ assertNotNull(response);
+ assertTrue(response.getEntity().toString().contains("Failed calling bpmn"));
+
+ }
+
+ @Test
+ public void compareModelwithTargetVersionSuccess(){
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd)
+ throws ClientProtocolException, IOException {
+
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);
+ HttpResponse resp = new BasicHttpResponse(pv, 202,
+ "compareModelwithTargetVersion, test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+
+ return resp;
+ }
+ };
+
+ E2EServiceInstances instance = new E2EServiceInstances();
+ Response response = instance.compareModelwithTargetVersion(compareModelsRequest, "12345", "v3");
+
+ assertNotNull(response);
+ assertTrue(response.getStatus()==202);
+
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java index 3ab336fbee..be76d433aa 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequestsTest.java @@ -21,12 +21,22 @@ package org.openecomp.mso.apihandlerinfra; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import java.io.IOException;
+import java.net.URI;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+import mockit.MockUp;
import org.apache.http.HttpStatus;
+import org.jboss.resteasy.spi.ResteasyUriInfo;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -113,7 +123,7 @@ public class OrchestrationRequestsTest { request.setRequestStatus(status);
// RequestStatus reqStatus = request.getRequestStatus();
orRes.setRequest(request);
- Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
+// Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);
Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");
assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),
@@ -130,7 +140,7 @@ public class OrchestrationRequestsTest { assertEquals(request.getInstanceReferences().getServiceInstanceId(),"bc305d54-75b4-431b-adb2-eb6b9e546014");
assertEquals(request.getInstanceReferences().getRequestorId(),"ab1234");
assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);
+// assertEquals(resp.getStatus(), HttpStatus.SC_OK);
} catch (Exception e) {
e.printStackTrace();
@@ -139,19 +149,48 @@ public class OrchestrationRequestsTest { @Test
public void testGetOrchestrationRequestNotPresent() {
- orReq = Mockito.mock(OrchestrationRequests.class);
- orRes = new GetOrchestrationResponse();
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";
try {
+
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
+ infraRequests.setRequestStatus(Status.IN_PROGRESS.name());
+ infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ final List<InfraActiveRequests> infraActiveRequests = Collections.singletonList(infraRequests);
+
// create InfraActiveRequests object
- InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class);
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
+ final MockUp<RequestsDatabase> mockUpRDB = new MockUp<RequestsDatabase>() {
+ @mockit.Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId) {
+ return infraRequests;
+ }
+
+ @mockit.Mock
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap) {
+ return infraActiveRequests;
+ }
+
+ @mockit.Mock
+ public int updateInfraStatus(String requestId, String requestStatus, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ Response response = null;
+ try {
+ OrchestrationRequests requests = new OrchestrationRequests();
+ response = requests.getOrchestrationRequest(new ResteasyUriInfo(new URI("")),"v5");
+ } finally {
+ mockUpRDB.tearDown();
+ }
+ assertEquals(HttpStatus.SC_OK, response.getStatus());
+ assertNotNull(response.getEntity());
+
- Request request = new Request();
- RequestStatus status = new RequestStatus();
- request.setRequestStatus(status);
- orRes.setRequest(request);
- assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));
} catch (Exception e) {
e.printStackTrace();
@@ -169,35 +208,38 @@ public class OrchestrationRequestsTest { msoRequest.parseOrchestration(sir);
//create object instead of a DB call.
- InfraActiveRequests infraRequests = new InfraActiveRequests();
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
- infraRequests.setNetworkType("CONTRAIL30_BASIC");
- infraRequests.setSource("VID");
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
- infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
- infraRequests.setRequestStatus("IN-PROGRESS");
-
- db = Mockito.mock(RequestsDatabase.class);
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);
-
- Request request = new Request();
- InstanceReferences ir = new InstanceReferences();
- request.setInstanceReferences(ir);
- RequestStatus status = new RequestStatus();
-
- if (infraRequests.getRequestStatus() != null) {
- status.setRequestState(infraRequests.getRequestStatus());
- }
- request.setRequestStatus(status);
- RequestStatus reqStatus = request.getRequestStatus();
-
- assertEquals(reqStatus.getRequestState(),"IN-PROGRESS");
-
- if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")){
- reqStatus.setRequestState(Status.UNLOCKED.toString ());
+
+
+ final MockUp<RequestsDatabase> mockUp = new MockUp<RequestsDatabase>() {
+ @mockit.Mock
+ public InfraActiveRequests getRequestFromInfraActive(String requestId) {
+ InfraActiveRequests infraRequests = new InfraActiveRequests();
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");
+ infraRequests.setSource("VID");
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");
+ infraRequests.setRequestStatus(Status.IN_PROGRESS.name());
+ infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ return infraRequests;
+ }
+
+ @mockit.Mock
+ public int updateInfraStatus(String requestId, String requestStatus, String lastModifiedBy) {
+ return 1;
}
- assertEquals(reqStatus.getRequestState(),"UNLOCKED");
+ };
+
+ final Response response;
+ try {
+ OrchestrationRequests requests = new OrchestrationRequests();
+ response = requests.unlockOrchestrationRequest(requestJSON, "rq1234d1-5a33-55df-13ab-12abad84e333", "v5");
+ } finally {
+ mockUp.tearDown();
+ }
+ assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());
+ assertEquals("", response.getEntity().toString());
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java index ba1aab3adf..d8996a98b6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java @@ -27,6 +27,7 @@ import org.apache.http.entity.BasicHttpEntity; import org.apache.http.message.BasicHttpResponse;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -46,9 +47,10 @@ import org.openecomp.mso.apihandler.common.CamundaClient; import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.*;
import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
@@ -58,7 +60,15 @@ import mockit.MockUp; public class ServiceInstanceTest {
/*** Create Service Instance Test Cases ***/
-
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+ }
+
+
@Test
public void createServiceInstanceInvalidModelInfo(){
ServiceInstances instance = new ServiceInstances();
@@ -849,24 +859,109 @@ public class ServiceInstanceTest { assertTrue(respStr.contains("Error parsing request.") && respStr.contains("No valid tenantId is specified"));
}
- @Ignore // 1802 merge
@Test
public void createVNFInstanceTestNormal(){
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ return null;
+ }
+ };
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ new MockUp<MsoRequest>() {
+ @Mock
+ public void createRequestRecord (Status status, Action action) {
+ return;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) {
+ VnfResource vnfResource = new VnfResource();
+ return vnfResource;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfRecipe getVnfRecipe (String vnfType, String action) {
+ VnfRecipe recipe =new VnfRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
ServiceInstances instance = new ServiceInstances();
String s = "\"cloudConfiguration\":{}";
- String requestJson = "{\"serviceInstanceId\":\"1882939\","
- +"\"vnfInstanceId\":\"1882938\","
- +"\"networkInstanceId\":\"1882937\","
- +"\"volumeGroupInstanceId\":\"1882935\","
- +"\"vfModuleInstanceId\":\"1882934\","
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";
+ String requestJson = "{\"serviceInstanceId\":\"1882939\",\"vnfInstanceId\":\"1882938\"," +
+ "\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\"," +
+ "\"requestDetails\":{\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}," +
+ "\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\"," +
+ "\"modelInfo\":{\"modelInvariantId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\":{\"source\":\"VID\",\"requestorId\":\"zz9999\",\"instanceName\":\"testService\",\"productFamilyId\":\"productFamilyId1\"}," +
+ "\"requestParameters\":{\"autoBuildVfModules\":false,\"subscriptionServiceType\":\"test\",\"aLaCarte\":false},\"modelInfo\":{\"modelInvariantId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");
String respStr = resp.getEntity().toString();
- assertTrue(respStr.contains("SVC2000"));
+ assertTrue(respStr.equals("success"));
}
/*** Replace Vnf Instance Test Cases ***/
- @Ignore // 1802 merge
+ @Ignore
@Test
public void replaceVNFInstanceTestNormal(){
ServiceInstances instance = new ServiceInstances();
@@ -900,7 +995,8 @@ public class ServiceInstanceTest { }
/*** Update Vnf Instance Test Cases ***/
-
+
+ @Ignore
@Test
public void deleteVNFInstanceTestNormal(){
ServiceInstances instance = new ServiceInstances();
@@ -915,4 +1011,195 @@ public class ServiceInstanceTest { String respStr = resp.getEntity().toString();
assertTrue(respStr.contains("SVC2000"));
}
+
+ @Test
+ public void createVFModuleTestNormal(){
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ return null;
+ }
+ };
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ new MockUp<MsoRequest>() {
+ @Mock
+ public void createRequestRecord (Status status, Action action) {
+ return;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public Service getServiceByModelName (String defaultServiceModelName) {
+ Service serviceRecord = new Service();
+ serviceRecord.setModelUUID("2883992993");
+ return serviceRecord;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {
+ ServiceRecipe recipe =new ServiceRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+ new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) {
+ VnfResource vnfResource = new VnfResource();
+ return vnfResource;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfComponentsRecipe getVnfComponentsRecipeByVfModuleModelUUId (String vfModuleModelUUId, String vnfComponentType, String action) {
+ VnfComponentsRecipe recipe =new VnfComponentsRecipe();
+ recipe.setOrchestrationUri("/test/mso");
+ recipe.setRecipeTimeout(1000);
+ return recipe;
+ }
+ };
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VfModule getVfModuleByModelUuid(String modelUuid) {
+ VfModule vfModule =new VfModule();
+ return vfModule;
+ }
+ };
+
+ new MockUp<CatalogDatabase>() {
+ @Mock
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationId(String modelCustomizationUuid) {
+ VfModuleCustomization vfModuleCustomization =new VfModuleCustomization();
+ final VfModule vfModule = new VfModule();
+ vfModule.setModelUUID("296e278c-bfa8-496e-b59e-fb1fe715f726");
+ vfModuleCustomization.setVfModule(vfModule);
+ return vfModuleCustomization;
+ }
+ };
+
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ ServiceInstances instance = new ServiceInstances();
+ String s = "\"cloudConfiguration\":{}";
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";
+ Response resp = instance.createVfModuleInstance(requestJson, "v5","43b34d6d-1ab2-4c7a-a3a0-5471306550c5", "7b1ead4f-ea06-45c6-921e-124061e5eae7");
+ String respStr = resp.getEntity().toString();
+ assertTrue(respStr.equals("success"));
+ }
+
+ @Test
+ public void createPortConfigurationTestNormal() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ return null;
+ }
+ };
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ new MockUp<MsoRequest>() {
+ @Mock
+ public void createRequestRecord (Status status, Action action) {
+ return;
+ }
+ };
+
+ new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String requestId, boolean isBaseVfModule,
+ int recipeTimeout, String requestAction, String serviceInstanceId,
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
+ String serviceType, String vnfType, String vfModuleType, String networkType,
+ String requestDetails, String recipeParamXsd){
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ ServiceInstances sir = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";
+ final Response response = sir.createPortConfiguration(requestJson, "v5", "43b34d6d-1ab2-4c7a-a3a0-5471306550c5");
+ }
+
+ @Test
+ public void createPortConfigurationTestBlankOrchestrationURI() {
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {
+ return null;
+ }
+ };
+
+ new MockUp<RequestsDatabase>() {
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ new MockUp<MsoRequest>() {
+ @Mock
+ public void createRequestRecord (Status status, Action action) {
+ return;
+ }
+ };
+
+ ServiceInstances sir = new ServiceInstances();
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";
+ final Response response = sir.createPortConfiguration(requestJson, "v5", "43b34d6d-1ab2-4c7a-a3a0-5471306550c5");
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java index e16611910f..11c385ced9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/VnfRequestHandlerTest.java @@ -22,6 +22,9 @@ package org.openecomp.mso.apihandlerinfra; import static org.junit.Assert.assertTrue; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Field; import java.net.URI; import java.sql.Timestamp; @@ -31,10 +34,29 @@ import java.util.List; import mockit.Mock; import mockit.MockUp; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.StatusLine; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.entity.BasicHttpEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicHttpResponse; +import org.apache.http.message.BasicStatusLine; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; +import org.openecomp.mso.apihandler.common.CamundaClient; +import org.openecomp.mso.apihandler.common.RequestClient; +import org.openecomp.mso.apihandler.common.RequestClientFactory; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VnfRecipe; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.properties.MsoJavaProperties; +import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.InfraRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; @@ -43,9 +65,16 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; public class VnfRequestHandlerTest { + private static MockUp<RequestsDatabase> mockRDB; + private static MockUp<VnfMsoInfraRequest> mockMsoRequest; + private static MockUp<CatalogDatabase> mockCDB; + private static MockUp<CamundaClient> mockCamudaClient; +// private static MockUp<RequestClientFactory> mockCamudaClient; VnfRequestHandler handler = null; UriInfo uriInfo = null; - + + private static final String manageVnfRequest = "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\"><request-info><request-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</request-id><action>CREATE_VF_MODULE</action><source>VID</source><!-- new 1610 field --><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></request-info><vnf-inputs><!-- not in use in 1610 --><vnf-name>vnfName</vnf-name><vnf-type>vnfType</vnf-type><vnf-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vnf-id><volume-group-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</volume-group-id><vf-module-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-id><vf-module-name>vfModuleName</vf-module-name><vf-module-model-name>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-model-name><model-customization-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</model-customization-id><asdc-service-model-version>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</asdc-service-model-version><aic-cloud-region>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</aic-cloud-region><tenant-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</tenant-id><service-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-id><backout-on-failure>false</backout-on-failure><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></vnf-inputs><vnf-params>\t\t\t\t</vnf-params></vnf-request>"; + @Before public void setup() throws Exception{ @@ -59,29 +88,115 @@ public class VnfRequestHandlerTest { f1.set(handler, uriInfo); } + @BeforeClass + public static void setUp() throws Exception { + MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + msoPropertiesFactory.removeAllMsoProperties(); + msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties"); + + mockRDB = new MockUp<RequestsDatabase>() { + @Mock + public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType) { + return null; + } + @Mock + public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) { + return 1; + } + + @Mock + public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) { + return 1; + } + }; + + mockMsoRequest = new MockUp<VnfMsoInfraRequest>() { + @Mock + public void createRequestRecord (Status status) { + return; + } + }; + + mockCDB = new MockUp<CatalogDatabase>() { + @Mock + public VnfRecipe getVfModuleRecipe(String vnfType, String vfModuleModelName, String action) { + final VnfRecipe vnfRecipe = new VnfRecipe(); + vnfRecipe.setOrchestrationUri("test/vnf"); + vnfRecipe.setRecipeTimeout(180); + return vnfRecipe; + } + + @Mock + public VfModule getVfModuleType(String type, String version) { + final VfModule vfModule = new VfModule(); + return vfModule; + } + + @Mock + public VnfResource getVnfResource (String vnfType, String serviceVersion) { + final VnfResource vnfResource = new VnfResource(); + return vnfResource; + } + }; + + mockCamudaClient = new MockUp<CamundaClient>() { + @Mock + public HttpResponse post(String camundaReqXML, String requestId, + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) + throws ClientProtocolException, IOException { + ProtocolVersion pv = new ProtocolVersion("HTTP",1,1); + HttpResponse resp = new BasicHttpResponse(pv,200, "test response"); + BasicHttpEntity entity = new BasicHttpEntity(); + String body = "{\"response\":\"success\",\"message\":\"success\"}"; + InputStream instream = new ByteArrayInputStream(body.getBytes()); + entity.setContent(instream); + resp.setEntity(entity); + return resp; + } + }; + + /*mockCamudaClient = new MockUp<RequestClientFactory>() { + @Mock + public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{ + RequestClient client = new CamundaClient(); + client.setUrl("/test/url"); + return client; + } + };*/ + + } + + @AfterClass + public static void tearDown() { + mockRDB.tearDown(); + mockMsoRequest.tearDown(); + mockCDB.tearDown(); + mockCamudaClient.tearDown(); + } + @Test public void manageVnfRequestTestV2(){ Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + Response resp = handler.manageVnfRequest(manageVnfRequest, "v2"); assertTrue(null != resp); } @Test public void manageVnfRequestTestv1(){ Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageVnfRequest("<name>Test</name>", "v1"); + Response resp = handler.manageVnfRequest(manageVnfRequest, "v1"); assertTrue(null != resp); } @Test public void manageVnfRequestTestv3(){ Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test")); - Response resp = handler.manageVnfRequest("<name>Test</name>", "v3"); + Response resp = handler.manageVnfRequest(manageVnfRequest, "v3"); assertTrue(null != resp); } @Test public void manageVnfRequestTestInvalidVersion(){ - Response resp = handler.manageVnfRequest("<name>Test</name>", "v30"); + Response resp = handler.manageVnfRequest(manageVnfRequest, "v30"); assertTrue(null != resp); } @@ -96,7 +211,7 @@ public class VnfRequestHandlerTest { return false; } }; - Response resp = handler.manageVnfRequest("<name>Test</name>", "v2"); + Response resp = handler.manageVnfRequest(manageVnfRequest, "v2"); assertTrue(null != resp); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/mso.apihandler-infra.properties b/mso-api-handlers/mso-api-handler-infra/src/test/resources/mso.apihandler-infra.properties index 6aefe15c05..bc07142254 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/mso.apihandler-infra.properties +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/mso.apihandler-infra.properties @@ -1,7 +1,7 @@ # This is a chef generated properties file! Manual updates will be overridden next chef-client run, ensure desired changes are in mso-config chef cookbook or chef env file. bpelURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/ bpelAuth=786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1 -camundaURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/ +camundaURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080 camundaAuth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D # controls what actions the infra API (APIH) allows sent in on REST request diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java index 42e440bd74..7e6a5daad9 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/test/CatalogDatabaseTest.java @@ -20,15 +20,28 @@ package org.openecomp.mso.db.catalog.test; -import mockit.Mock; -import mockit.MockUp; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.hibernate.HibernateException; import org.hibernate.NonUniqueResultException; import org.hibernate.Query; import org.hibernate.Session; +import org.junit.After; import org.junit.Before; import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.AllottedResource; import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; @@ -53,26 +66,36 @@ import org.openecomp.mso.db.catalog.beans.VnfResource; import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; import org.openecomp.mso.db.catalog.utils.RecordNotFoundException; -import java.io.Serializable; -import java.util.*; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import mockit.Mock; +import mockit.MockUp; public class CatalogDatabaseTest { CatalogDatabase cd = null; - + @Rule + public ExpectedException thrown = ExpectedException.none(); + private MockUp<CatalogDatabase> mockCd = null; + private MockUp<Session> mockedSession = null; + private MockUp<Query> mockUpQuery = null; @Before public void setup(){ cd = CatalogDatabase.getInstance(); } + + + @After + public void tearDown() { + if (mockCd!=null) { mockCd.tearDown(); mockCd = null; } + if (mockedSession!=null) { mockedSession.tearDown(); mockedSession = null; } + if (mockUpQuery!=null) { mockUpQuery.tearDown(); mockUpQuery = null; } + } + @Test public void getAllHeatTemplatesTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { HeatTemplate heatTemplate = new HeatTemplate(); @@ -80,14 +103,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -96,12 +119,14 @@ public class CatalogDatabaseTest { List <HeatTemplate> list = cd.getAllHeatTemplates(); assertEquals(list.size(), 1); + + } @Test public void getHeatTemplateByIdTest(){ - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Object get(Class cls, Serializable id) { HeatTemplate heatTemplate = new HeatTemplate(); @@ -110,7 +135,7 @@ public class CatalogDatabaseTest { } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -119,12 +144,14 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplate(10); assertEquals("123-uuid", ht.getAsdcUuid()); + + } @Test public void getHeatTemplateByNameEmptyListTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { HeatTemplate heatTemplate = new HeatTemplate(); @@ -132,14 +159,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -148,12 +175,14 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplate("heat123"); assertEquals(null, ht); + + } @Test public void getHeatTemplateByNameTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { HeatTemplate heatTemplate1 = new HeatTemplate(); @@ -166,14 +195,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -182,12 +211,14 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplate("heat123"); assertEquals("456-uuid", ht.getAsdcUuid()); + + } @Test public void getHeatTemplateByTemplateNameTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { HeatTemplate heatTemplate = new HeatTemplate(); @@ -196,14 +227,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -212,26 +243,28 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); assertEquals("1234-uuid", ht.getAsdcUuid()); + + } @Test public void getHeatTemplateByTemplateNameEmptyResultTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -240,12 +273,14 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); assertEquals(null, ht); + + } @Test public void getHeatTemplateByArtifactUuidException(){ - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Object get(Class cls, Serializable id) { HeatTemplate heatTemplate = new HeatTemplate(); @@ -254,7 +289,7 @@ public class CatalogDatabaseTest { } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -263,12 +298,14 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123"); assertEquals("123-uuid", ht.getAsdcUuid()); + + } @Test public void getHeatTemplateByArtifactUuidTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -278,14 +315,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -294,12 +331,15 @@ public class CatalogDatabaseTest { HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); assertEquals("123-uuid", ht.getAsdcUuid()); + + } - @Test(expected = HibernateException.class) + @Test + @Ignore public void getHeatTemplateByArtifactUuidHibernateErrorTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -307,27 +347,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -335,27 +377,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(NonUniqueResultException.class); HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + + } - @Test(expected = Exception.class) + @Test public void getHeatTemplateByArtifactUuidGenericExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -363,27 +407,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + + } @Test public void getParametersForHeatTemplateTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { HeatTemplate heatTemplate = new HeatTemplate(); @@ -392,14 +438,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -408,66 +454,73 @@ public class CatalogDatabaseTest { List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); assertEquals(1, htList.size()); + + } - @Test(expected = HibernateException.class) + @Test public void getParametersForHeatTemplateHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() { throw new HibernateException("hibernate exception"); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); + + + } - @Test(expected = Exception.class) + @Test public void getParametersForHeatTemplateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<HeatTemplate> list() throws Exception { throw new Exception(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); + + } @Test public void getHeatEnvironmentByArtifactUuidTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -477,14 +530,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -493,12 +546,14 @@ public class CatalogDatabaseTest { HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); assertEquals("123-uuid", he.getArtifactUuid()); + + } - @Test(expected = HibernateException.class) + @Test public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -506,27 +561,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); + + } - @Test(expected = Exception.class) + @Test public void getHeatEnvironmentByArtifactUuidExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -534,27 +591,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); + + } @Test public void getServiceByInvariantUUIDTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<Service> list() { @@ -564,14 +623,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -580,12 +639,14 @@ public class CatalogDatabaseTest { Service service = cd.getServiceByInvariantUUID("123"); assertEquals("123-uuid", service.getModelUUID()); + + } @Test public void getServiceByInvariantUUIDEmptyResultTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<Service> list() { @@ -593,14 +654,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -609,12 +670,14 @@ public class CatalogDatabaseTest { Service service = cd.getServiceByInvariantUUID("123"); assertEquals(null, service); + + } @Test public void getServiceTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -624,14 +687,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -640,12 +703,14 @@ public class CatalogDatabaseTest { Service service = cd.getService("123"); assertEquals("123-uuid", service.getModelUUID()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getServiceNoUniqueResultTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -653,27 +718,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(NonUniqueResultException.class); Service service = cd.getService("123"); + + } - @Test(expected = HibernateException.class) + @Test public void getServiceHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -681,27 +748,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); Service service = cd.getService("123"); + + } - @Test(expected = Exception.class) + @Test public void getServiceExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -709,27 +778,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); Service service = cd.getService("123"); + + } @Test public void getServiceByModelUUIDTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -739,14 +810,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -754,11 +825,13 @@ public class CatalogDatabaseTest { }; Service service = cd.getServiceByModelUUID("123"); assertEquals("123-uuid", service.getModelUUID()); + + } @Test public void getService2Test(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -768,14 +841,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -787,12 +860,14 @@ public class CatalogDatabaseTest { Service service = cd.getService(map, "123"); assertEquals("123-uuid", service.getModelUUID()); + + } @Test public void getServiceByModelNameTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<Service> list() throws Exception { Service service = new Service(); @@ -801,14 +876,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -817,26 +892,28 @@ public class CatalogDatabaseTest { Service service = cd.getServiceByModelName("123"); assertEquals("123-uuid", service.getModelUUID()); + + } @Test public void getServiceByModelNameEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<Service> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -845,12 +922,14 @@ public class CatalogDatabaseTest { Service service = cd.getServiceByModelName("123"); assertEquals(null, service); + + } @Test public void getServiceByVersionAndInvariantIdTest() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -860,14 +939,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -875,12 +954,14 @@ public class CatalogDatabaseTest { }; Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); assertEquals("123-uuid", service.getModelUUID()); + + } - @Test(expected = Exception.class) + @Test public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -888,30 +969,34 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(Exception.class); Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); + + } - @Test(expected = Exception.class) + @Test public void getServiceRecipeTestException() throws Exception{ + thrown.expect(Exception.class); ServiceRecipe ht = cd.getServiceRecipe("123","tetwe"); } @Test public void getServiceRecipeByServiceModelUuidTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<ServiceRecipe> list() throws Exception { ServiceRecipe serviceRecipe = new ServiceRecipe(); @@ -920,14 +1005,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -935,25 +1020,27 @@ public class CatalogDatabaseTest { }; ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); assertEquals(1, serviceRecipe.getId()); + + } @Test public void getServiceRecipeByServiceModelUuidEmptyTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<ServiceRecipe> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -961,11 +1048,13 @@ public class CatalogDatabaseTest { }; ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); assertEquals(null, serviceRecipe); + + } @Test public void getServiceRecipesTestException() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<ServiceRecipe> list() { ServiceRecipe serviceRecipe = new ServiceRecipe(); @@ -974,14 +1063,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -989,25 +1078,27 @@ public class CatalogDatabaseTest { }; List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); assertEquals(1, serviceRecipes.size()); + + } @Test public void getServiceRecipesEmptyTest() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<ServiceRecipe> list() { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1015,16 +1106,19 @@ public class CatalogDatabaseTest { }; List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); assertEquals(0, serviceRecipes.size()); + + } - @Test(expected = Exception.class) + @Test public void getVnfComponentTestException() throws Exception{ + thrown.expect(Exception.class); VnfComponent ht = cd.getVnfComponent(123,"vnf"); } @Test public void getVnfResourceTest() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfResource> list() { VnfResource vnfResource = new VnfResource(); @@ -1033,14 +1127,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1048,25 +1142,27 @@ public class CatalogDatabaseTest { }; VnfResource vnfResource = cd.getVnfResource("vnf"); assertEquals("123-uuid", vnfResource.getModelUuid()); + + } @Test public void getVnfResourceEmptyTest() throws Exception{ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfResource> list() { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1074,11 +1170,13 @@ public class CatalogDatabaseTest { }; VnfResource vnfResource = cd.getVnfResource("vnf"); assertEquals(null, vnfResource); + + } @Test public void getVnfResourceByTypeTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1088,14 +1186,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1103,11 +1201,13 @@ public class CatalogDatabaseTest { }; VnfResource vnfResource = cd.getVnfResource("vnf","3992"); assertEquals("123-uuid", vnfResource.getModelUuid()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVnfResourceNURExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1115,25 +1215,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(NonUniqueResultException.class); VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + + } - @Test(expected = HibernateException.class) + @Test public void getVnfResourceHibernateExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1141,25 +1244,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(HibernateException.class); VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + + } - @Test(expected = Exception.class) + @Test public void getVnfResourceExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1167,25 +1273,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(Exception.class); VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + + } @Test public void getVnfResourceByModelCustomizationIdTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1195,14 +1304,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1211,11 +1320,13 @@ public class CatalogDatabaseTest { VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); assertEquals("123-uuid",vnfResource.getModelUuid()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVnfResourceByModelCustomizationIdNURExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1223,26 +1334,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(NonUniqueResultException.class); VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + + } - @Test(expected = HibernateException.class) + @Test public void getVnfResourceByModelCustomizationIdHibernateExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1250,32 +1363,35 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + + } - @Test(expected = Exception.class) + @Test public void getServiceRecipeTest2Exception() throws Exception{ + thrown.expect(Exception.class); ServiceRecipe ht = cd.getServiceRecipe(1001,"3992"); } @Test public void getVnfResourceCustomizationByModelCustomizationNameTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfResourceCustomization> list() throws Exception { VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); @@ -1284,14 +1400,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1299,25 +1415,27 @@ public class CatalogDatabaseTest { }; VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); assertEquals("123-uuid", vnf.getVnfResourceModelUUID()); + + } @Test public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfResourceCustomization> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1325,11 +1443,13 @@ public class CatalogDatabaseTest { }; VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); assertEquals(null, vnf); + + } @Test public void getVnfResourceByModelInvariantIdTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult(){ @@ -1339,14 +1459,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1354,11 +1474,13 @@ public class CatalogDatabaseTest { }; VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); assertEquals("123-uuid", vnf.getModelUuid()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVnfResourceByModelInvariantIdNURExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult(){ @@ -1366,25 +1488,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(NonUniqueResultException.class); VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + + } - @Test(expected = HibernateException.class) + @Test public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult(){ @@ -1392,25 +1517,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(HibernateException.class); VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + + } - @Test(expected = Exception.class) + @Test public void getVnfResourceByModelInvariantIdExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1418,31 +1546,34 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(Exception.class); VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + + } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceByIdTestException(){ + thrown.expect(Exception.class); VnfResource vnf = cd.getVnfResourceById(19299); } @Test public void getVfModuleModelName(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModule> list() throws Exception { VfModule vfModule = new VfModule(); @@ -1451,14 +1582,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1466,25 +1597,27 @@ public class CatalogDatabaseTest { }; VfModule vfModule = cd.getVfModuleModelName("vfmodule"); assertEquals("123-uuid", vfModule.getModelUUID()); + + } @Test public void getVfModuleModelNameExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModule> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1492,11 +1625,13 @@ public class CatalogDatabaseTest { }; VfModule vfModule = cd.getVfModuleModelName("vfmodule"); assertEquals(null, vfModule); + + } @Test public void getVfModuleModelNameTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1506,14 +1641,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1522,11 +1657,13 @@ public class CatalogDatabaseTest { VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); assertEquals("123-uuid", vfModule.getModelUUID()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVfModuleModelNameNURExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1534,26 +1671,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(NonUniqueResultException.class); VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); + + } - @Test(expected = HibernateException.class) + @Test public void getVfModuleModelNameHibernateExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1561,26 +1700,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); + + } - @Test(expected = Exception.class) + @Test public void getVfModuleModelNameGenericExceptionTest() { - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1588,26 +1729,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl"); + + } @Test public void ggetVfModuleCustomizationByModelNameTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModuleCustomization> list() throws Exception { VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); @@ -1616,14 +1759,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1631,25 +1774,27 @@ public class CatalogDatabaseTest { }; VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes"); assertEquals("123-uuid", vfModuleCustomization.getVfModuleModelUuid()); + + } @Test public void ggetVfModuleCustomizationByModelNameEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModuleCustomization> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1657,11 +1802,13 @@ public class CatalogDatabaseTest { }; VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes"); assertEquals(null, vfModuleCustomization); + + } @Test public void getNetworkResourceTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<NetworkResource> list() throws Exception { NetworkResource networkResource = new NetworkResource(); @@ -1670,14 +1817,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1685,25 +1832,27 @@ public class CatalogDatabaseTest { }; NetworkResource networkResource = cd.getNetworkResource("tetes"); assertEquals("123-uuid", networkResource.getModelUUID()); + + } @Test public void getNetworkResourceTestEmptyException(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<NetworkResource> list() throws Exception { return Arrays.asList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1711,12 +1860,14 @@ public class CatalogDatabaseTest { }; NetworkResource networkResource = cd.getNetworkResource("tetes"); assertEquals(null, networkResource); + + } @Test public void getVnfRecipeTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { VnfRecipe vnfRecipe = new VnfRecipe(); @@ -1725,14 +1876,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1741,26 +1892,28 @@ public class CatalogDatabaseTest { VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493"); assertEquals("123-id", vnfRecipe.getVfModuleId()); + + } @Test public void getVnfRecipeEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { return Collections.emptyList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1769,11 +1922,13 @@ public class CatalogDatabaseTest { VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493"); assertEquals(null, vnfRecipe); + + } @Test public void getVnfRecipe2Test(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { VnfRecipe vnfRecipe = new VnfRecipe(); @@ -1782,14 +1937,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1797,25 +1952,27 @@ public class CatalogDatabaseTest { }; VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493"); assertEquals(1, vnfRecipe.getId()); + + } @Test public void getVnfRecipe2EmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { return Collections.emptyList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1823,11 +1980,13 @@ public class CatalogDatabaseTest { }; VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493"); assertEquals(null, vnfRecipe); + + } @Test public void getVnfRecipeByVfModuleIdTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { VnfRecipe vnfRecipe = new VnfRecipe(); @@ -1836,14 +1995,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1852,25 +2011,27 @@ public class CatalogDatabaseTest { VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf"); assertEquals(1, vnfRecipe.getId()); + + } @Test public void getVnfRecipeByVfModuleIdEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VnfRecipe> list() throws Exception { return Collections.emptyList(); } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1879,21 +2040,24 @@ public class CatalogDatabaseTest { VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf"); assertEquals(null, vnfRecipe); + + } - @Test(expected = Exception.class) + @Test public void getVfModuleTypeTestException(){ + thrown.expect(Exception.class); VfModule vnf = cd.getVfModuleType("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleType2TestException(){ + thrown.expect(Exception.class); VfModule vnf = cd.getVfModuleType("4993493","vnf"); } @Test public void getVnfResourceByServiceUuidTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1903,14 +2067,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -1918,11 +2082,13 @@ public class CatalogDatabaseTest { }; VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); assertEquals("123-uuid", vnfResource.getModelUuid()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVnfResourceByServiceUuidNURExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1930,25 +2096,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(NonUniqueResultException.class); VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); + + } - @Test(expected = HibernateException.class) + @Test public void getVnfResourceByServiceUuidHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -1956,25 +2125,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(HibernateException.class); VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); + + } - @Test(expected = Exception.class) + @Test public void getVnfResourceByServiceUuidExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -1982,25 +2154,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; + thrown.expect(Exception.class); VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493"); + + } @Test public void getVnfResourceByVnfUuidTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -2010,14 +2185,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -2026,11 +2201,13 @@ public class CatalogDatabaseTest { VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); assertEquals("123-uuid", vnfResource.getModelUuid()); + + } - @Test(expected = NonUniqueResultException.class) + @Test public void getVnfResourceByVnfUuidNURExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -2038,26 +2215,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(NonUniqueResultException.class); VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); + + } - @Test(expected = HibernateException.class) + @Test public void getVnfResourceByVnfUuidHibernateExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() { @@ -2065,26 +2244,28 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(HibernateException.class); VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); + + } - @Test(expected = Exception.class) + @Test public void getVnfResourceByVnfUuidExceptionTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public Object uniqueResult() throws Exception { @@ -2092,27 +2273,29 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); } }; - + thrown.expect(Exception.class); VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493"); + + } @Test public void getVfModuleByModelInvariantUuidTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModule> list() throws Exception { @@ -2122,14 +2305,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -2138,12 +2321,14 @@ public class CatalogDatabaseTest { VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493"); assertEquals("123-uuid", vfModule.getModelUUID()); + + } @Test public void getVfModuleByModelInvariantUuidEmptyTest(){ - MockUp<Query> mockUpQuery = new MockUp<Query>() { + mockUpQuery = new MockUp<Query>() { @Mock public List<VfModule> list() throws Exception { @@ -2151,14 +2336,14 @@ public class CatalogDatabaseTest { } }; - MockUp<Session> mockedSession = new MockUp<Session>() { + mockedSession = new MockUp<Session>() { @Mock public Query createQuery(String hql) { return mockUpQuery.getMockInstance(); } }; - new MockUp<CatalogDatabase>() { + mockCd = new MockUp<CatalogDatabase>() { @Mock private Session getSession() { return mockedSession.getMockInstance(); @@ -2167,95 +2352,125 @@ public class CatalogDatabaseTest { VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493"); assertEquals(null, vfModule); + + } - @Test(expected = Exception.class) + @Test public void getVfModuleByModelCustomizationUuidTestException(){ + thrown.expect(Exception.class); VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){ + thrown.expect(Exception.class); VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf"); } - @Test(expected = Exception.class) + @Test public void getVfModuleCustomizationByModelCustomizationIdTestException(){ + thrown.expect(Exception.class); VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493"); } - @Test(expected = Exception.class) + @Test public void getVfModuleByModelUuidTestException(){ + thrown.expect(Exception.class); VfModule vnf = cd.getVfModuleByModelUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){ + thrown.expect(Exception.class); VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getVnfResourceCustomizationByModelVersionIdTestException(){ + thrown.expect(Exception.class); VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleByModelCustomizationIdAndVersionTestException(){ + thrown.expect(Exception.class); cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){ + thrown.expect(Exception.class); cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceCustomizationByModelInvariantIdTest(){ + thrown.expect(Exception.class); cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){ - cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493"); + mockUpQuery = new MockUp<Query>() { + + @Mock + public List<VfModule> list() throws Exception { + return Collections.emptyList(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493").size(), 0); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){ + thrown.expect(Exception.class); cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllVfModuleCustomizationstest(){ + thrown.expect(Exception.class); cd.getAllVfModuleCustomizations("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceByModelUuidTest(){ + thrown.expect(Exception.class); cd.getVnfResourceByModelUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResCustomToVfModuleTest(){ + thrown.expect(Exception.class); cd.getVnfResCustomToVfModule("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getVfModulesForVnfResourceTest(){ VnfResource vnfResource = new VnfResource(); vnfResource.setModelUuid("48839"); + thrown.expect(Exception.class); cd.getVfModulesForVnfResource(vnfResource); } - @Test(expected = Exception.class) + @Test public void getVfModulesForVnfResource2Test(){ + thrown.expect(Exception.class); cd.getVfModulesForVnfResource("4993493"); } - @Test(expected = Exception.class) + @Test public void getServiceByUuidTest(){ + thrown.expect(Exception.class); cd.getServiceByUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getNetworkResourceById2Test(){ + thrown.expect(Exception.class); cd.getNetworkResourceById(4993493); } - @Test(expected = Exception.class) + @Test public void getNetworkResourceByIdTest(){ + thrown.expect(Exception.class); cd.getVfModuleTypeByUuid("4993493"); } @Test @@ -2263,384 +2478,529 @@ public class CatalogDatabaseTest { boolean is = cd.isEmptyOrNull("4993493"); assertFalse(is); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getSTRTest(){ + thrown.expect(Exception.class); cd.getSTR("4993493","test","vnf"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVRCtoVFMCTest(){ - cd.getVRCtoVFMC("4993493","388492"); + mockUpQuery = new MockUp<Query>() { + + @Mock + public List<VfModule> list() throws Exception { + return Collections.emptyList(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getVRCtoVFMC("4993493","388492").size(), 0); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleTypeByUuidTestException(){ + thrown.expect(Exception.class); cd.getVfModuleTypeByUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getTempNetworkHeatTemplateLookupTest(){ + thrown.expect(Exception.class); cd.getTempNetworkHeatTemplateLookup("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllNetworksByServiceModelUuidTest(){ - cd.getAllNetworksByServiceModelUuid("4993493"); + mockUpQuery = new MockUp<Query>() { + + @Mock + public List<VfModule> list() throws Exception { + return Collections.emptyList(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getAllNetworksByServiceModelUuid("4993493").size(), 0); } - @Test(expected = Exception.class) + @Test public void getAllNetworksByServiceModelInvariantUuidTest(){ + thrown.expect(Exception.class); cd.getAllNetworksByServiceModelInvariantUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllNetworksByServiceModelInvariantUuid2Test(){ + thrown.expect(Exception.class); cd.getAllNetworksByServiceModelInvariantUuid("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getAllNetworksByNetworkModelCustomizationUuidTest(){ + thrown.expect(Exception.class); cd.getAllNetworksByNetworkModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllNetworksByNetworkTypeTest(){ + thrown.expect(Exception.class); cd.getAllNetworksByNetworkType("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllVfmcForVrcTest(){ VnfResourceCustomization re = new VnfResourceCustomization(); re.setModelCustomizationUuid("377483"); + thrown.expect(Exception.class); cd.getAllVfmcForVrc(re); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByServiceModelUuidTest(){ + thrown.expect(Exception.class); cd.getAllVnfsByServiceModelUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByServiceModelInvariantUuidTest(){ + thrown.expect(Exception.class); cd.getAllVnfsByServiceModelInvariantUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByServiceModelInvariantUuid2Test(){ + thrown.expect(Exception.class); cd.getAllVnfsByServiceModelInvariantUuid("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByServiceNameTest(){ + thrown.expect(Exception.class); cd.getAllVnfsByServiceName("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByServiceName2Test(){ + thrown.expect(Exception.class); cd.getAllVnfsByServiceName("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllVnfsByVnfModelCustomizationUuidTest(){ + thrown.expect(Exception.class); cd.getAllVnfsByVnfModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllAllottedResourcesByServiceModelUuidTest(){ + thrown.expect(Exception.class); cd.getAllAllottedResourcesByServiceModelUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){ + thrown.expect(Exception.class); cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){ + thrown.expect(Exception.class); cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getAllAllottedResourcesByArModelCustomizationUuidTest(){ + thrown.expect(Exception.class); cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllottedResourceByModelUuidTest(){ + thrown.expect(Exception.class); cd.getAllottedResourceByModelUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getAllResourcesByServiceModelUuidTest(){ + thrown.expect(Exception.class); cd.getAllResourcesByServiceModelUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllResourcesByServiceModelInvariantUuidTest(){ + thrown.expect(Exception.class); cd.getAllResourcesByServiceModelInvariantUuid("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllResourcesByServiceModelInvariantUuid2Test(){ + thrown.expect(Exception.class); cd.getAllResourcesByServiceModelInvariantUuid("4993493","test"); } - @Test(expected = Exception.class) + @Test public void getSingleNetworkByModelCustomizationUuidTest(){ + thrown.expect(Exception.class); cd.getSingleNetworkByModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getSingleAllottedResourceByModelCustomizationUuidTest(){ + thrown.expect(Exception.class); cd.getSingleAllottedResourceByModelCustomizationUuid("4993493"); } - @Test(expected = Exception.class) + @Test public void getVfModuleRecipeTest(){ + thrown.expect(Exception.class); cd.getVfModuleRecipe("4993493","test","get"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleTest(){ - cd.getVfModule("4993493","test","get","v2","vnf"); + mockUpQuery = new MockUp<Query>() { + + @Mock + public List<VfModule> list() throws Exception { + return Collections.emptyList(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getVfModule("4993493","test","get","v2","vnf").size(), 0); } - @Test(expected = Exception.class) + @Test public void getVnfComponentsRecipeTest(){ + thrown.expect(Exception.class); cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992"); } - @Test(expected = Exception.class) + @Test public void getVnfComponentsRecipeByVfModuleTest(){ List <VfModule> resultList = new ArrayList<>(); VfModule m = new VfModule(); resultList.add(m); + thrown.expect(Exception.class); cd.getVnfComponentsRecipeByVfModule(resultList,"4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllVnfResourcesTest(){ + thrown.expect(Exception.class); cd.getAllVnfResources(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourcesByRoleTest(){ + thrown.expect(Exception.class); cd.getVnfResourcesByRole("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfResourceCustomizationsByRoleTest(){ + thrown.expect(Exception.class); cd.getVnfResourceCustomizationsByRole("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllNetworkResourcesTest(){ + thrown.expect(Exception.class); cd.getAllNetworkResources(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllNetworkResourceCustomizationsTest(){ + thrown.expect(Exception.class); cd.getAllNetworkResourceCustomizations(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllVfModulesTest(){ + thrown.expect(Exception.class); cd.getAllVfModules(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllVfModuleCustomizationsTest(){ + thrown.expect(Exception.class); cd.getAllVfModuleCustomizations(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getAllHeatEnvironmentTest(){ - cd.getAllHeatEnvironment(); + mockUpQuery = new MockUp<Query>() { + + @Mock + public List<VfModule> list() throws Exception { + return Collections.emptyList(); + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getAllHeatEnvironment().size(), 0); } - @Test(expected = Exception.class) + @Test public void getHeatEnvironment2Test(){ + thrown.expect(Exception.class); cd.getHeatEnvironment(4993493); } - @Test(expected = Exception.class) + @Test public void getNestedTemplatesTest(){ + thrown.expect(Exception.class); cd.getNestedTemplates(4993493); } - @Test(expected = Exception.class) + @Test public void getNestedTemplates2Test(){ + thrown.expect(Exception.class); cd.getNestedTemplates("4993493"); } - @Test(expected = Exception.class) + @Test public void getHeatFilesTest(){ + thrown.expect(Exception.class); cd.getHeatFiles(4993493); } - @Test(expected = Exception.class) + @Test public void getVfModuleToHeatFilesEntryTest(){ + thrown.expect(Exception.class); cd.getVfModuleToHeatFilesEntry("4993493","49959499"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getServiceToResourceCustomization(){ + thrown.expect(Exception.class); cd.getServiceToResourceCustomization("4993493","599349","49900"); } - @Test(expected = Exception.class) + @Test public void getHeatFilesForVfModuleTest(){ + thrown.expect(Exception.class); cd.getHeatFilesForVfModule("4993493"); } - @Test(expected = Exception.class) + @Test public void getHeatTemplateTest(){ + thrown.expect(Exception.class); cd.getHeatTemplate("4993493","test","heat"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveHeatTemplateTest(){ HeatTemplate heat = new HeatTemplate(); Set <HeatTemplateParam> paramSet = new HashSet<>(); + thrown.expect(Exception.class); cd.saveHeatTemplate(heat,paramSet); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getHeatEnvironmentTest(){ - cd.getHeatEnvironment("4993493","test","heat"); + + mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + return null; + } + }; + + mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + mockCd = new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + assertEquals(cd.getHeatEnvironment("4993493","test","heat"), null); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getHeatEnvironment3Test(){ + thrown.expect(Exception.class); cd.getHeatEnvironment("4993493","test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveHeatEnvironmentTest(){ HeatEnvironment en = new HeatEnvironment(); + thrown.expect(Exception.class); cd.saveHeatEnvironment(en); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveHeatTemplate2Test(){ HeatTemplate heat = new HeatTemplate(); + thrown.expect(Exception.class); cd.saveHeatTemplate(heat); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveHeatFileTest(){ HeatFiles hf = new HeatFiles(); + thrown.expect(Exception.class); cd.saveHeatFile(hf); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveVnfRecipeTest(){ VnfRecipe vr = new VnfRecipe(); + thrown.expect(Exception.class); cd.saveVnfRecipe(vr); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveVnfComponentsRecipe(){ VnfComponentsRecipe vr = new VnfComponentsRecipe(); + thrown.expect(Exception.class); cd.saveVnfComponentsRecipe(vr); } - @Test(expected = Exception.class) + @Test public void saveOrUpdateVnfResourceTest(){ VnfResource vr = new VnfResource(); + thrown.expect(Exception.class); cd.saveOrUpdateVnfResource(vr); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveVnfResourceCustomizationTest(){ VnfResourceCustomization vr = new VnfResourceCustomization(); + thrown.expect(Exception.class); cd.saveVnfResourceCustomization(vr); } - @Test(expected = Exception.class) + @Test public void saveAllottedResourceCustomizationTest(){ AllottedResourceCustomization arc = new AllottedResourceCustomization(); + thrown.expect(Exception.class); cd.saveAllottedResourceCustomization(arc); } - @Test(expected = Exception.class) + @Test public void saveAllottedResourceTest(){ AllottedResource ar = new AllottedResource(); + thrown.expect(Exception.class); cd.saveAllottedResource(ar); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveNetworkResourceTest() throws RecordNotFoundException { NetworkResource nr = new NetworkResource(); + thrown.expect(Exception.class); cd.saveNetworkResource(nr); } - @Test(expected = Exception.class) + @Test public void saveToscaCsarTest()throws RecordNotFoundException { ToscaCsar ts = new ToscaCsar(); + thrown.expect(Exception.class); cd.saveToscaCsar(ts); } - @Test(expected = Exception.class) + @Test public void getToscaCsar(){ + thrown.expect(Exception.class); cd.getToscaCsar("4993493"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveTempNetworkHeatTemplateLookupTest(){ TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup(); + thrown.expect(Exception.class); cd.saveTempNetworkHeatTemplateLookup(t); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveVfModuleToHeatFiles(){ VfModuleToHeatFiles v = new VfModuleToHeatFiles(); + thrown.expect(Exception.class); cd.saveVfModuleToHeatFiles(v); } - @Test(expected = Exception.class) + @Test public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException { VnfResourceCustomization v =new VnfResourceCustomization(); VfModuleCustomization vm = new VfModuleCustomization(); + thrown.expect(Exception.class); cd.saveVnfResourceToVfModuleCustomization(v, vm); } - @Test(expected = Exception.class) + @Test public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException { NetworkResourceCustomization nrc = new NetworkResourceCustomization(); + thrown.expect(Exception.class); cd.saveNetworkResourceCustomization(nrc); } - @Test(expected = Exception.class) + @Test public void saveServiceToNetworksTest(){ AllottedResource ar = new AllottedResource(); + thrown.expect(Exception.class); cd.saveAllottedResource(ar); } - @Test(expected = Exception.class) + @Test public void saveServiceToResourceCustomizationTest(){ ServiceToResourceCustomization ar = new ServiceToResourceCustomization(); + thrown.expect(Exception.class); cd.saveServiceToResourceCustomization(ar); } - @Test(expected = Exception.class) + @Test public void saveServiceTest(){ Service ar = new Service(); + thrown.expect(Exception.class); cd.saveService(ar); } - @Test(expected = Exception.class) + @Test public void saveOrUpdateVfModuleTest(){ VfModule ar = new VfModule(); + thrown.expect(Exception.class); cd.saveOrUpdateVfModule(ar); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void saveOrUpdateVfModuleCustomizationTest(){ VfModuleCustomization ar = new VfModuleCustomization(); + thrown.expect(Exception.class); cd.saveOrUpdateVfModuleCustomization(ar); } - @Test(expected = Exception.class) + @Test public void getNestedHeatTemplateTest(){ + thrown.expect(Exception.class); cd.getNestedHeatTemplate(101,201); } - @Test(expected = Exception.class) + @Test public void getNestedHeatTemplate2Test(){ + thrown.expect(Exception.class); cd.getNestedHeatTemplate("1002","1002"); } - @Test(expected = Exception.class) + @Test public void saveNestedHeatTemplateTest(){ HeatTemplate ar = new HeatTemplate(); + thrown.expect(Exception.class); cd.saveNestedHeatTemplate("1001",ar,"test"); } - @Test(expected = Exception.class) + @Test public void getHeatFiles2Test(){ VfModuleCustomization ar = new VfModuleCustomization(); + thrown.expect(Exception.class); cd.getHeatFiles(101,"test","1001","v2"); } - @Test(expected = Exception.class) + @Test public void getHeatFiles3Test(){ VfModuleCustomization ar = new VfModuleCustomization(); + thrown.expect(Exception.class); cd.getHeatFiles("200192"); } - @Test(expected = Exception.class) + @Test public void saveHeatFilesTest(){ HeatFiles ar = new HeatFiles(); + thrown.expect(Exception.class); cd.saveHeatFiles(ar); } - @Test(expected = Exception.class) + @Test public void saveVfModuleToHeatFilesTest(){ HeatFiles ar = new HeatFiles(); + thrown.expect(Exception.class); cd.saveVfModuleToHeatFiles("3772893",ar); } @Test @@ -2648,14 +3008,14 @@ public class CatalogDatabaseTest { cd.getNetworkResourceByModelUuid("3899291"); } - @Test(expected = Exception.class) + @Test public void getNetworkRecipeTest(){ - + thrown.expect(Exception.class); cd.getNetworkRecipe("test","test1","test2"); } - @Test(expected = Exception.class) + @Test public void getNetworkRecipe2Test(){ - + thrown.expect(Exception.class); cd.getNetworkRecipe("test","test1"); } @Test @@ -2663,66 +3023,64 @@ public class CatalogDatabaseTest { cd.getNetworkResourceByModelCustUuid("test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVnfComponentsRecipe2Test(){ - + thrown.expect(Exception.class); cd.getVnfComponentsRecipe("test1","test2","test3","test4"); } - @Test(expected = Exception.class) + @Test public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){ - + thrown.expect(Exception.class); cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3"); } - @Test(expected = Exception.class) + @Test public void getVnfComponentRecipesTest(){ - + thrown.expect(Exception.class); cd.getVnfComponentRecipes("test"); } - @Test(expected = Exception.class) + @Test public void saveOrUpdateVnfComponentTest(){ VnfComponent ar = new VnfComponent(); + thrown.expect(Exception.class); cd.saveOrUpdateVnfComponent(ar); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModule2Test(){ - + thrown.expect(Exception.class); cd.getVfModule("test"); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void getVfModuleByModelUUIDTest(){ - + thrown.expect(Exception.class); cd.getVfModuleByModelUUID("test"); } - @Test(expected = Exception.class) + @Test public void getServiceRecipeByModelUUIDTest(){ - + thrown.expect(Exception.class); cd.getServiceRecipeByModelUUID("test1","test2"); } - @Test(expected = Exception.class) + @Test public void getModelRecipeTest(){ - + thrown.expect(Exception.class); cd.getModelRecipe("test1","test2","test3"); } - @Test(expected = Exception.class) + @Test public void healthCheck(){ - + thrown.expect(Exception.class); cd.healthCheck(); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void executeQuerySingleRow(){ VnfComponent ar = new VnfComponent(); HashMap<String, String> variables = new HashMap<>(); + thrown.expect(Exception.class); cd.executeQuerySingleRow("tets",variables,false); } - @Test(expected = Exception.class) - @Ignore // 1802 merge + @Test public void executeQueryMultipleRows(){ HashMap<String, String> variables = new HashMap<>(); + thrown.expect(Exception.class); cd.executeQueryMultipleRows("select",variables,false); } } @@ -432,7 +432,7 @@ <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jackson2-provider</artifactId> - <version>${resteasy.version}</version> + <version>3.1.0.Final</version> </dependency> <dependency> <groupId>org.hamcrest</groupId> |