diff options
31 files changed, 7677 insertions, 2060 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java index 0af0e9422b..ef37f9f719 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java @@ -7,9 +7,9 @@ * 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. @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; @@ -36,8 +37,8 @@ import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; /** * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud * configuration file to Java. The CloudConfig contains information about - * Openstack cloud configurations. It includes: - * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) + * Openstack cloud configurations. It includes: + * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) * - CloudSite objects, representing LCP nodes (Openstack Compute & other services) * * Note that this is only used to access Cloud Configurations loaded from a JSON @@ -51,19 +52,17 @@ import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; @JsonRootName("cloud_config") public class CloudConfig { - private boolean validCloudConfig = false; + private static final String CLOUD_SITE_VERSION = "2.5"; + private static final String DEFAULT_CLOUD_SITE_ID = "default"; + private boolean validCloudConfig = false; + private static ObjectMapper mapper = new ObjectMapper(); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + protected String configFilePath; + protected int refreshTimerInMinutes; @JsonProperty("identity_services") private Map<String, CloudIdentity> identityServices = new HashMap<>(); @JsonProperty("cloud_sites") - private Map<String, CloudSite> cloudSites = new HashMap<>(); - - private static ObjectMapper mapper = new ObjectMapper(); - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - protected String configFilePath; - - protected int refreshTimerInMinutes; + private Map<String, CloudSite> cloudSites = new HashMap<>(); public CloudConfig() { mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); @@ -71,18 +70,14 @@ public class CloudConfig { } /** - * Get a Map of all IdentityServices that have been loaded. - * - * @return the Map + * Get a map of all identity services that have been loaded. */ public synchronized Map<String, CloudIdentity> getIdentityServices() { return identityServices; } /** - * Get a Map of all CloudSites that have been loaded. - * - * @return the Map + * Get a map of all cloud sites that have been loaded. */ public synchronized Map<String, CloudSite> getCloudSites() { return cloudSites; @@ -93,7 +88,7 @@ public class CloudConfig { * against the regions, and if no match is found there, then against * individual entries to try and find one with a CLLI that matches the ID * and an AIC version of 2.5. - * + * * @param id * the ID to match * @return a CloudSite, or null of no match found @@ -104,53 +99,35 @@ public class CloudConfig { return cloudSites.get(id); } // check for id == CLLI now as well - return getCloudSiteWithClli(id, "2.5"); + return getCloudSiteWithClli(id); } return null; } - /** - * Get a specific CloudSites, based on a CLLI and (optional) version, which - * will be matched against the aic_version field of the CloudSite. - * - * @param clli - * the CLLI to match - * @param version - * the version to match; may be null in which case any version - * matches - * @return a CloudSite, or null of no match found - */ - public synchronized CloudSite getCloudSiteWithClli(String clli, String version) { - if (clli != null) { - // New with 1610 - find cloud site called "DEFAULT" - return that - // object,with the name modified to match what they asked for. We're - // looping thru the cloud sites anyway - so save off the default one in case we - // need it. - CloudSite defaultCloudSite = null; - for (CloudSite cs : cloudSites.values()) { - if (cs.getClli() != null && clli.equals(cs.getClli())) { - if (version == null || version.equals(cs.getAic_version())) { - return cs; - } - } else if ("default".equalsIgnoreCase(cs.getId())) { - // save it off in case we need it - defaultCloudSite = cs.clone(); - } - } - // If we get here - we didn't find a match - so return the default - // cloud site - if (defaultCloudSite != null) { - defaultCloudSite.setRegionId(clli); - defaultCloudSite.setId(clli); - } + private CloudSite getCloudSiteWithClli(String clli) { + Optional <CloudSite> cloudSiteOptional = cloudSites.values().stream().filter(cs -> + cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAic_version()))) + .findAny(); + return cloudSiteOptional.orElse(getDefaultCloudSite(clli)); + } + + // TODO in future the result will be optional + private CloudSite getDefaultCloudSite(String clli) { + Optional<CloudSite> cloudSiteOpt = cloudSites.values().stream() + .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny(); + if (cloudSiteOpt.isPresent()) { + CloudSite defaultCloudSite = cloudSiteOpt.get(); + defaultCloudSite.setRegionId(clli); + defaultCloudSite.setId(clli); return defaultCloudSite; + } else { + return null; } - return null; } /** * Get a specific CloudIdentity, based on an ID. - * + * * @param id * the ID to match * @return a CloudIdentity, or null of no match found @@ -173,7 +150,7 @@ public class CloudConfig { configFilePath = configFile; this.refreshTimerInMinutes = refreshTimer; this.validCloudConfig=false; - + try { reader = new FileReader(configFile); // Parse the JSON input into a CloudConfig @@ -200,7 +177,7 @@ public class CloudConfig { } } this.validCloudConfig=true; - + } finally { try { if (reader != null) { @@ -227,12 +204,9 @@ public class CloudConfig { public synchronized CloudConfig clone() { CloudConfig ccCopy = new CloudConfig(); for (Entry<String, CloudIdentity> e : identityServices.entrySet()) { - ccCopy.identityServices.put(e.getKey(), e.getValue().clone()); } - for (Entry<String, CloudSite> e : cloudSites.entrySet()) { - ccCopy.cloudSites.put(e.getKey(), e.getValue().clone()); } ccCopy.configFilePath = this.configFilePath; @@ -290,5 +264,5 @@ public class CloudConfig { return true; } - + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java deleted file mode 100644 index 9677d0ee1c..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.cloud;
-
-/**
- * This interface provides the method signature for mapping registration.
- * All mappings should be registered by the implementing class.
- */
-@FunctionalInterface
-public interface CloudConfigIdentityMapper {
-
- public void registerAllMappings();
-}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java index fad0c2368b..08ea84d85d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java @@ -22,12 +22,10 @@ package org.openecomp.mso.openstack.utils; import java.io.Serializable; -import java.rmi.server.ObjID; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java deleted file mode 100644 index dd1b396fae..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java +++ /dev/null @@ -1,193 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.adapter_utils.tests; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import java.util.Map; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; - -/** - * This class implements test methods of the CloudConfig features. - */ -public class CloudConfigTest { - - private static CloudConfig con; - private static CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); - - public CloudConfigTest () { - - } - - /** - * This method is called before any test occurs. - * It creates a fake tree from scratch - * @throws MsoCloudIdentityNotFound - */ - @Before - public final void prepare () throws MsoCloudIdentityNotFound { - ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); - String config = classLoader.getResource("cloud_config.json").toString().substring(5); - - cloudConfigFactory.initializeCloudConfig(config,1); - con = cloudConfigFactory.getCloudConfig(); - } - - /** - * This method implements a test for the getCloudConfig method. - */ - @Test - public final void testGetCloudConfig () { - assertNotNull(con); - } - - /** - * This method implements a test for the getCloudSites method. - */ - @Test - public final void testGetCloudSites () { - Map<String,CloudSite> siteMap = con.getCloudSites(); - assertNotNull(siteMap); - - CloudSite site1 = siteMap.get("MT"); - CloudSite site2 = siteMap.get("DAN"); - CloudSite site3 = siteMap.get("MTINJVCC101"); - CloudSite site4 = siteMap.get("MTSNJA4LCP1"); - - assertEquals (site1.getRegionId(), "regionOne"); - assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); - assertEquals (site2.getRegionId(), "RegionOne"); - assertEquals (site2.getIdentityServiceId(), "DAN_KEYSTONE"); - assertEquals (site3.getRegionId(), "regionTwo"); - assertEquals (site3.getIdentityServiceId(), "MTINJVCC101_DCP"); - assertEquals (site4.getRegionId(), "mtsnjlcp1"); - assertEquals (site4.getIdentityServiceId(), "MTSNJA3DCP1"); - } - - - /** - * This method implements a test for the getIdentityServices method. - */ - @Test - public final void testGetIdentityServices () { - Map<String,CloudIdentity> identityMap = con.getIdentityServices (); - assertNotNull(identityMap); - - CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); - CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE"); - CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); - CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); - - assertEquals("john", identity1.getMsoId()); - assertEquals("changeme", identity1.getMsoPass()); - assertEquals("admin", identity1.getAdminTenant()); - assertEquals("_member_", identity1.getMemberRole()); - assertEquals(false, identity1.hasTenantMetadata()); - - assertEquals("mockId", identity2.getMsoId()); - assertEquals("stack123", identity2.getMsoPass()); - assertEquals("service", identity2.getAdminTenant()); - assertEquals("_member_", identity2.getMemberRole()); - assertEquals(false, identity2.hasTenantMetadata()); - - assertEquals("mockIdToo", identity3.getMsoId()); - assertEquals("AICG@mm@@2015", identity3.getMsoPass()); - assertEquals("service", identity3.getAdminTenant()); - assertEquals("admin", identity3.getMemberRole()); - assertEquals(true, identity3.hasTenantMetadata()); - - assertEquals("mockIdToo", identity4.getMsoId()); - assertEquals("2315QRS2015srq", identity4.getMsoPass()); - assertEquals("service", identity4.getAdminTenant()); - assertEquals("admin", identity4.getMemberRole()); - assertEquals(true, identity4.hasTenantMetadata()); - - } - - /** - * This method implements a test for the getCloudSite method. - */ - @Test - public final void testGetCloudSite () { - CloudSite site1 = con.getCloudSite("MT"); - assertNotNull(site1); - assertEquals (site1.getRegionId(), "regionOne"); - assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); - } - - /** - * This method implements a test for the getIdentityService method. - */ - @Test - public final void testGetIdentityService () { - CloudIdentity identity1 = con.getIdentityService("MT_KEYSTONE"); - assertNotNull(identity1); - assertEquals (identity1.getMsoId(), "john"); - assertEquals (identity1.getMsoPass(), "changeme"); - assertEquals (identity1.getAdminTenant(), "admin"); - assertEquals (identity1.getMemberRole(), "_member_"); - assertEquals (identity1.hasTenantMetadata(), false); - - CloudIdentity identity2 = con.getIdentityService("Test"); - assertNull(identity2); - } - - @Test (expected = MsoCloudIdentityNotFound.class) - public final void testLoadWithWrongFile () throws MsoCloudIdentityNotFound { - ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); - String config = classLoader.getResource("cloud_config_bad.json").toString().substring(5); - - cloudConfigFactory.initializeCloudConfig(config,1); - } - - @Test - public final void testReloadWithWrongFile () { - ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); - String config = classLoader.getResource("cloud_config_bad.json").toString().substring(5); - - try { - cloudConfigFactory.initializeCloudConfig(config,1); - Assert.fail("MsoCloudIdentityNotFound was expected"); - } catch (MsoCloudIdentityNotFound e) { - - } - Assert.assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getCloudSites().isEmpty()); - Assert.assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getIdentityServices().isEmpty()); - - // Now reload the right config - config = classLoader.getResource("cloud_config.json").toString().substring(5); - cloudConfigFactory.changeMsoPropertiesFilePath(config); - cloudConfigFactory.reloadCloudConfig(); - Assert.assertTrue("Flag valid Config should be true now that the cloud_config is correct", cloudConfigFactory.getCloudConfig().isValidCloudConfig()); - - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java index cd96756644..6fd95d5948 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java @@ -25,6 +25,7 @@ import java.util.HashMap; import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudConfigTest; import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; import org.openecomp.mso.openstack.exceptions.MsoException; diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java new file mode 100644 index 0000000000..a73e4359fc --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java @@ -0,0 +1,179 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.cloud; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import java.util.Map; +import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; + +public class CloudConfigTest { + + private static String cloudConfigJsonFilePath; + private static String cloudDefaultConfigJsonFilePath; + private static String cloudConfigInvalidJsonFilePath; + + @BeforeClass + public static void preparePaths() { + ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); + cloudConfigJsonFilePath = classLoader.getResource("cloud_config.json").getPath(); + cloudDefaultConfigJsonFilePath = classLoader.getResource("cloud_default_config.json").getPath(); + cloudConfigInvalidJsonFilePath = classLoader.getResource("cloud_config_bad.json").getPath(); + } + + private CloudConfig createTestObject(String jsonFilePath) throws MsoCloudIdentityNotFound { + CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); + cloudConfigFactory.initializeCloudConfig(jsonFilePath, 1); + return cloudConfigFactory.getCloudConfig(); + } + + @Test + public void testGetCloudSites() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudConfigJsonFilePath); + Map<String, CloudSite> siteMap = con.getCloudSites(); + assertNotNull(siteMap); + + CloudSite site1 = siteMap.get("MT"); + CloudSite site2 = siteMap.get("DAN"); + CloudSite site3 = siteMap.get("MTINJVCC101"); + CloudSite site4 = siteMap.get("MTSNJA4LCP1"); + + assertEquals("regionOne", site1.getRegionId()); + assertEquals("MT_KEYSTONE", site1.getIdentityServiceId()); + assertEquals("RegionOne", site2.getRegionId()); + assertEquals("DAN_KEYSTONE", site2.getIdentityServiceId()); + assertEquals("regionTwo", site3.getRegionId()); + assertEquals("MTINJVCC101_DCP", site3.getIdentityServiceId()); + assertEquals("mtsnjlcp1", site4.getRegionId()); + assertEquals("MTSNJA3DCP1", site4.getIdentityServiceId()); + } + + @Test + public void testGetIdentityServices() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudConfigJsonFilePath); + Map<String, CloudIdentity> identityMap = con.getIdentityServices(); + assertNotNull(identityMap); + + CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); + CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE"); + CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); + CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); + + assertEquals("john", identity1.getMsoId()); + assertEquals("changeme", identity1.getMsoPass()); + assertEquals("admin", identity1.getAdminTenant()); + assertEquals("_member_", identity1.getMemberRole()); + assertFalse(identity1.hasTenantMetadata()); + + assertEquals("mockId", identity2.getMsoId()); + assertEquals("stack123", identity2.getMsoPass()); + assertEquals("service", identity2.getAdminTenant()); + assertEquals("_member_", identity2.getMemberRole()); + assertFalse(identity2.hasTenantMetadata()); + + assertEquals("mockIdToo", identity3.getMsoId()); + assertEquals("AICG@mm@@2015", identity3.getMsoPass()); + assertEquals("service", identity3.getAdminTenant()); + assertEquals("admin", identity3.getMemberRole()); + assertTrue(identity3.hasTenantMetadata()); + + assertEquals("mockIdToo", identity4.getMsoId()); + assertEquals("2315QRS2015srq", identity4.getMsoPass()); + assertEquals("service", identity4.getAdminTenant()); + assertEquals("admin", identity4.getMemberRole()); + assertTrue(identity4.hasTenantMetadata()); + } + + @Test + public void cloudSiteIsGotById_when_IdFound() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudConfigJsonFilePath); + CloudSite cloudSite = con.getCloudSite("MT"); + assertNotNull(cloudSite); + assertEquals("regionOne", cloudSite.getRegionId()); + assertEquals("MT_KEYSTONE", cloudSite.getIdentityServiceId()); + } + + @Test + public void cloudSiteIsGotByClli_when_IdNotFound() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudConfigJsonFilePath); + CloudSite cloudSite = con.getCloudSite("CS_clli"); + assertNotNull(cloudSite); + assertEquals("clliRegion", cloudSite.getRegionId()); + assertEquals("CS_clli", cloudSite.getClli()); + assertEquals("CS_service", cloudSite.getIdentityServiceId()); + } + + @Test + public void cloudSiteIsGotByDefault_when_IdAndClliNotFound() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudDefaultConfigJsonFilePath); + CloudSite cloudSite = con.getCloudSite("not_existing_id"); + assertNotNull(cloudSite); + assertEquals("not_existing_id", cloudSite.getId()); + assertEquals("not_existing_id", cloudSite.getRegionId()); + } + + @Test + public void testGetIdentityService() throws MsoCloudIdentityNotFound { + CloudConfig con = createTestObject(cloudConfigJsonFilePath); + CloudIdentity identity1 = con.getIdentityService("MT_KEYSTONE"); + assertNotNull(identity1); + assertEquals("john", identity1.getMsoId()); + assertEquals("changeme", identity1.getMsoPass()); + assertEquals("admin", identity1.getAdminTenant()); + assertEquals("_member_", identity1.getMemberRole()); + assertFalse(identity1.hasTenantMetadata()); + + CloudIdentity identity2 = con.getIdentityService("Test"); + assertNull(identity2); + } + + @Test(expected = MsoCloudIdentityNotFound.class) + public void testLoadWithWrongFile() throws MsoCloudIdentityNotFound { + createTestObject(cloudConfigInvalidJsonFilePath); + } + + @Test + public void testReloadWithWrongFile() { + CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); + try { + cloudConfigFactory.initializeCloudConfig(cloudConfigInvalidJsonFilePath, 1); + Assert.fail("MsoCloudIdentityNotFound was expected"); + } catch (MsoCloudIdentityNotFound e) { + + } + assertTrue("Should be an empty CloudConfig", cloudConfigFactory.getCloudConfig().getCloudSites().isEmpty()); + assertTrue("Should be an empty CloudConfig", + cloudConfigFactory.getCloudConfig().getIdentityServices().isEmpty()); + // Now reload the right config + cloudConfigFactory.changeMsoPropertiesFilePath(cloudConfigJsonFilePath); + cloudConfigFactory.reloadCloudConfig(); + assertTrue("Flag valid Config should be true now that the cloud_config is correct", + cloudConfigFactory.getCloudConfig().isValidCloudConfig()); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json index ee3532fe15..ff24633f32 100644 --- a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json +++ b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json @@ -44,7 +44,8 @@ "tenant_metadata": true, "identity_server_type": "KEYSTONE", "identity_authentication_type": "USERNAME_PASSWORD" - } + }, + "CS_service": {} }, "cloud_sites": @@ -76,8 +77,14 @@ "clli": "MTSNJA4LCP1", "aic_version": "2.5", "identity_service_id": "MTSNJA3DCP1" + }, + "CS": + { + "region_id": "clliRegion", + "clli": "CS_clli", + "aic_version": "2.5", + "identity_service_id": "CS_service" } - } } } diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json new file mode 100644 index 0000000000..35d18e9789 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/cloud_default_config.json @@ -0,0 +1,13 @@ +{ + "cloud_config": { + "identity_services": { + "default_service": {} + }, + "cloud_sites": { + "default": { + "region_id": "defaultRegion", + "identity_service_id": "default_service" + } + } + } +}
\ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java index 2a3a64ce1b..5bb1dacb4a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java @@ -26,7 +26,6 @@ import org.codehaus.jackson.map.JsonDeserializer; import org.codehaus.jackson.map.ObjectMapper; import java.io.IOException; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java index c2ea8242c3..3e9f5c6b58 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java @@ -19,7 +19,6 @@ */ package org.openecomp.mso.adapters.json; -import org.codehaus.jackson.JsonGenerationException; import org.codehaus.jackson.JsonGenerator; import org.codehaus.jackson.map.JsonSerializer; import org.codehaus.jackson.map.SerializerProvider; @@ -47,12 +46,9 @@ import java.util.Map; public class MapSerializer extends JsonSerializer<Map<String, String>> { @Override public void serialize(Map<String, String> map, JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException, - JsonGenerationException { - + SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); jsonGenerator.writeArrayFieldStart("entry"); - for (Map.Entry<String,String> entry : map.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); @@ -61,7 +57,6 @@ public class MapSerializer extends JsonSerializer<Map<String, String>> { jsonGenerator.writeStringField("value", value); jsonGenerator.writeEndObject(); } - jsonGenerator.writeEndArray(); jsonGenerator.writeEndObject(); } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/AdapterRestInterfaceTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/AdapterRestInterfaceTest.java deleted file mode 100644 index 00c853ba0d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/AdapterRestInterfaceTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters;
-
-import java.io.IOException;
-import java.util.HashMap;
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.map.SerializerProvider;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.openecomp.mso.adapters.json.MapSerializer;
-
-public class AdapterRestInterfaceTest {
-
- @Test
- public final void mapSerializerTest() {
- MapSerializer mapSerializer = new MapSerializer();
- mapSerializer.isUnwrappingSerializer();
- mapSerializer.toString();
- mapSerializer.unwrappingSerializer();
- JsonGenerator jsonGenerator = Mockito.mock(JsonGenerator.class);
- SerializerProvider serializerProvider = Mockito
- .mock(SerializerProvider.class);
- try {
- mapSerializer.serialize(new HashMap(), jsonGenerator, serializerProvider);
- } catch (IOException e) {
- }
- }
-
-}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java index 984ba1b0af..5c3470acd9 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java @@ -17,14 +17,12 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.openecomp.mso.test; +package org.openecomp.mso.adapters; import java.lang.reflect.Method; -import java.lang.reflect.Parameter; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; - import org.junit.Test; import org.openecomp.mso.adapters.nwrest.ContrailNetwork; import org.openecomp.mso.adapters.nwrest.CreateNetworkError; @@ -34,7 +32,6 @@ import org.openecomp.mso.adapters.nwrest.DeleteNetworkError; import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; import org.openecomp.mso.adapters.nwrest.NetworkExceptionResponse; -import org.openecomp.mso.adapters.nwrest.NetworkRequestCommon; import org.openecomp.mso.adapters.nwrest.NetworkTechnology; import org.openecomp.mso.adapters.nwrest.ProviderVlanNetwork; import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; @@ -74,7 +71,6 @@ import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupResponse; import org.openecomp.mso.adapters.vnfrest.VfModuleExceptionResponse; import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; -import org.openecomp.mso.adapters.vnfrest.VfResponseCommon; import org.openecomp.mso.adapters.vnfrest.VolumeGroupRollback; import org.openecomp.mso.entity.MsoRequest; diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java new file mode 100644 index 0000000000..f903f21441 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.adapters.json; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.util.HashMap; +import java.util.Map; +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.SerializerProvider; +import org.junit.Test; + +public class MapSerializerTest { + + private static final String JSON_FIELD_NAME_1 = "testKey1"; + private static final String JSON_VALUE_1 = "testValue1"; + private static final String JSON_FIELD_NAME_2 = "testKey2"; + private static final String JSON_VALUE_2 = "testValue2"; + + @Test + public void serializationWritesTheProperFieldsToJson() throws Exception { + JsonGenerator jsonGeneratorMock = mock(JsonGenerator.class); + MapSerializer testedObject = new MapSerializer(); + testedObject.serialize(prepareMap(), jsonGeneratorMock, mock(SerializerProvider.class)); + verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_1); + verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_1); + verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_2); + verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_2); + } + + private Map<String, String> prepareMap() { + Map<String, String> map = new HashMap<>(); + map.put(JSON_FIELD_NAME_1, JSON_VALUE_1); + map.put(JSON_FIELD_NAME_2, JSON_VALUE_2); + return map; + } +} diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java index 70fa7c14be..c2879a4df2 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java @@ -32,23 +32,21 @@ import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; - -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.notification.IArtifactInfo; -import org.openecomp.sdc.api.notification.INotificationData; -import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; -import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; import org.openecomp.mso.asdc.client.ASDCConfiguration; import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException; -import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; import org.openecomp.mso.db.catalog.beans.Service; import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources; import org.openecomp.mso.db.catalog.beans.ServiceToNetworks; import org.openecomp.mso.db.catalog.beans.VnfResource; - +import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.sdc.api.IDistributionClient; +import org.openecomp.sdc.api.notification.IArtifactInfo; +import org.openecomp.sdc.api.notification.INotificationData; +import org.openecomp.sdc.api.notification.IResourceInstance; +import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; /** * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure). * @@ -141,8 +139,10 @@ public final class VfResourceStructure { public void createVfModuleStructures() throws ArtifactInstallerException { + //for vender tosca VNF there is no VFModule in VF if (vfModulesMetadataList == null) { - throw new ArtifactInstallerException("VfModule Meta DATA could not be decoded properly or was not present in the notification"); + LOGGER.info(MessageEnum.ASDC_GENERAL_INFO,"There is no VF mudules in the VF.", "ASDC", "createVfModuleStructures"); + return; } for (IVfModuleData vfModuleMeta:vfModulesMetadataList) { vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta)); diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java index b6dddacd7c..390bf40e44 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/ToscaResourceInstaller.java @@ -197,303 +197,330 @@ public class ToscaResourceInstaller {// implements IVfResourceInstaller { List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList();
int outerLoop = 0;
logger.debug("**vfMondeTEmplatesList.size()=" + vfNodeTemplatesList.size());
- for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
- logger.debug("nodeTemplate outerLoop=" + outerLoop++);
- // extract VF metadata
-
- Metadata metadata = nodeTemplate.getMetaData();
+ for(NodeTemplate nodeTemplate : vfNodeTemplatesList) {
+ logger.debug("nodeTemplate outerLoop=" + outerLoop++);
+ // extract VF metadata
- String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("vfCustomizationUUID=" + vfCustomizationUUID);
+ Metadata metadata = nodeTemplate.getMetaData();
-
- /* HEAT TABLE POPULATION
- * *******************************************************************************************************
- */
-
- int nextLoop = 0;
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
- logger.debug("vfResourceStructure.getVfMOduleStructure() loop, nextLoop = " + nextLoop++);
- logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
-
- // Here we set the right db structure according to the Catalog
- // DB
+ String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata,
+ SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ logger.debug("vfCustomizationUUID=" + vfCustomizationUUID);
- // We expect only one MAIN HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we
- // get the Main IArtifactInfo
+ // extract VF metadata
+ createVnfResource(nodeTemplate, toscaResourceStruct);
- HeatTemplate heatMainTemplate = null;
- HeatEnvironment heatEnv;
-
- HeatTemplate heatVolumeTemplate = null;
- HeatEnvironment heatVolumeEnv;
-
-
- IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
-
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) {
-
- List<VfModuleArtifact> artifacts = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT);
- logger.debug("there are " + artifacts.size() + " artifacts");
- IArtifactInfo mainEnvArtifactInfo = null;
- for (VfModuleArtifact vfma : artifacts) {
- logger.debug("vmfa=" + vfma.toString());
- mainEnvArtifactInfo =
- vfma.getArtifactInfo().getGeneratedArtifact();
-
- // MAIN HEAT
- heatMainTemplate = (HeatTemplate) vfma.getCatalogObject();
-
- // Set HeatTemplateArtifactUUID to use later when setting the VfModule and NetworkResource
- toscaResourceStruct.setHeatTemplateUUID(heatMainTemplate.getArtifactUuid());
+ // check for duplicate record already in the database
+ VnfResource vnfResource =
+ catalogDB.getVnfResource(toscaResourceStruct.getCatalogVnfResource().getModelName(),
+ BigDecimalVersion.castAndCheckNotificationVersionToString(
+ toscaResourceStruct.getCatalogVnfResource().getVersion()));
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo
- .createElementFromVfArtifactInfo(vfma.getArtifactInfo()));
-
- catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfma.incrementDeployedInDB();
- }
-
-
- // VOLUME HEAT
- // We expect only one VOL HEAT per VFMODULE
- // we can also obtain from it the Env ArtifactInfo, that's why
- // we get the Volume IArtifactInfo
-
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) {
- IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0)
- .getArtifactInfo().getGeneratedArtifact();
-
- heatVolumeTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject();
-
- // Set VolHeatTemplate ArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setVolHeatTemplateUUID(heatVolumeTemplate.getArtifactUuid());
-
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()));
+ if(vnfResource != null) {
+ toscaResourceStruct.setVnfAlreadyInstalled(true);
+ }
- catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters());
- // Indicate we have deployed it in the DB
- vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).incrementDeployedInDB();
-
- if (volEnvArtifactInfo != null) {
- heatVolumeEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Set VolHeatTemplate ArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setVolHeatEnvTemplateUUID(heatVolumeEnv.getArtifactUuid());
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatVolumeEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- }
-
- // NESTED HEAT
- // Here we expect many HEAT_NESTED template to be there
- // XXX FIX BY PCLO: Defect# -36643 -US666034 - check first if we really have nested heat templates
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) {
- for (VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_NESTED)) {
-
- // Check if this nested is well referenced by the MAIN HEAT
- String parentArtifactType = ToscaResourceInstaller.identifyParentOfNestedTemplate(vfModuleStructure,heatNestedArtifact);
- HeatTemplate heatNestedTemplate = (HeatTemplate) heatNestedArtifact.getCatalogObject();
-
- if (parentArtifactType != null) {
-
- switch (parentArtifactType) {
- case ASDCConfiguration.HEAT:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
- case ASDCConfiguration.HEAT_VOL:
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
- catalogDB.saveNestedHeatTemplate (heatVolumeTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- break;
-
- default:
- break;
+ if(!toscaResourceStruct.isVnfAlreadyInstalled()) {
- }
- } else { // Assume it belongs to HEAT MAIN
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
-
- catalogDB.saveNestedHeatTemplate (heatMainTemplate.getArtifactUuid(), heatNestedTemplate, heatNestedTemplate.getTemplateName());
- // Indicate we have deployed it in the DB
- heatNestedArtifact.incrementDeployedInDB();
- }
- }
- }
-
- if (mainEnvArtifactInfo != null) {
- heatEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID()
- .get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
-
- // Set HeatEnvironmentArtifactUUID to use later when setting the VfModule
- toscaResourceStruct.setEnvHeatTemplateUUID(heatEnv.getArtifactUuid());
+ catalogDB.saveOrUpdateVnfResource(toscaResourceStruct.getCatalogVnfResource());
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo));
-
- catalogDB.saveHeatEnvironment(heatEnv);
- // Indicate we have deployed it in the DB
- vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB();
- }
-
- // here we expect one VFModule to be there
- //VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate, heatVolumeTemplate, heatEnv, heatVolumeEnv);
- //VfModule vfModule = vfModuleStructure.getCatalogVfModule();
+ }
- // Add this one for logging
- //artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure));
-
- //catalogDB.saveOrUpdateVfModule(vfModule);
-
-
- // extract VF metadata
- createVnfResource(nodeTemplate, toscaResourceStruct);
-
- // check for duplicate record already in the database
- VnfResource vnfResource = catalogDB.getVnfResource(toscaResourceStruct.getCatalogVnfResource().getModelName(),
- BigDecimalVersion.castAndCheckNotificationVersionToString(
- toscaResourceStruct.getCatalogVnfResource().getVersion()));
+ boolean saveVnfCustomization = catalogDB
+ .saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
- if (vnfResource != null) {
- toscaResourceStruct.setVnfAlreadyInstalled(true);
- }
-
-
- if(!toscaResourceStruct.isVnfAlreadyInstalled()) {
-
- catalogDB.saveOrUpdateVnfResource(toscaResourceStruct.getCatalogVnfResource());
-
- }
-
-
- boolean saveVnfCustomization = catalogDB.saveVnfResourceCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization());
-
- if(saveVnfCustomization){
- catalogDB.saveServiceToResourceCustomization(toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
- }
-
- List<org.openecomp.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
- logger.debug("vfGroups:" + vfGroups.toString());
-
- Collections.sort(vfGroups, new Comparator<org.openecomp.sdc.toscaparser.api.Group>() {
- @Override
- public int compare(org.openecomp.sdc.toscaparser.api.Group group1, org.openecomp.sdc.toscaparser.api.Group group2) {
-
- //Field name1Field = group1.class.getDeclaredField("name");
- //name1Field.setAccessible(true);
- String thisName = group1.getName(); //(String) name1Field.get(group1);
- String thatName = group2.getName(); // (String) name1Field.get(group2);
-
- Matcher m = lastDigit.matcher(thisName);
- Matcher m2 = lastDigit.matcher(thatName);
-
- String thisDigit = "0";
- String thatDigit = "0";
- if (m.find()) {
- thisDigit = m.group();
- } else {
- return -1;
- }
- if (m2.find()) {
- thatDigit = m2.group();
- } else {
- return 1;
- }
-
- return new Integer(thisDigit).compareTo(new Integer(thatDigit));
+ if(saveVnfCustomization) {
+ catalogDB.saveServiceToResourceCustomization(
+ toscaResourceStruct.getCatalogVfServiceToResourceCustomization());
+ }
- }
- });
-
- logger.debug("vfGroupsAfter:" + vfGroups.toString());
+ /*
+ * HEAT TABLE POPULATION
+ * *********************************************************************************
+ * **********************
+ */
-
- for(Group group : vfGroups){
-
-
- //boolean saveVFModule = createVFModule(group, nodeTemplate, toscaResourceStruct, vfMetadata);
- if (vfMetadata.getVfModuleModelCustomizationUUID() == null) {
- logger.debug("NULL 1");
- } else {
- logger.debug("vfMetadata.getMCU=" + vfMetadata.getVfModuleModelCustomizationUUID());
- }
- if (group.getMetadata() == null) {
- logger.debug("NULL 3");
- } else {
- logger.debug("group.getMetadata().getValue() = " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"));
- }
- if (vfMetadata.getVfModuleModelCustomizationUUID().equals(group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) {
- logger.debug("Found a match at " + vfMetadata.getVfModuleModelCustomizationUUID());
- createVFModule(group, nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata);
-
- catalogDB.saveOrUpdateVfModule(toscaResourceStruct.getCatalogVfModule());
-
- catalogDB.saveOrUpdateVfModuleCustomization(toscaResourceStruct.getCatalogVfModuleCustomization());
-
- catalogDB.saveVnfResourceToVfModuleCustomization(toscaResourceStruct.getCatalogVnfResourceCustomization(), toscaResourceStruct.getCatalogVfModuleCustomization());
-
+ int nextLoop = 0;
+ for(VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
+ logger.debug("vfResourceStructure.getVfMOduleStructure() loop, nextLoop = " + nextLoop++);
+ logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
- } else {
- if(toscaResourceStruct.getCatalogVfModuleCustomization() != null){
- logger.debug("No match for " + toscaResourceStruct.getCatalogVfModuleCustomization().getModelCustomizationUuid());
- } else {
- logger.debug("No match for vfModuleModelCustomizationUUID");
- }
- }
-
- }
-
- } //Commented out to process VFModules each time
-
+ // Here we set the right db structure according to the Catalog
+ // DB
-
- // Here we expect many HEAT_TEMPLATE files to be there
- if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) {
- for (VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap()
- .get(ASDCConfiguration.HEAT_ARTIFACT)) {
-
- HeatFiles heatFile = (HeatFiles) heatArtifact.getCatalogObject();
-
- // Add this one for logging
- artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo()));
-
- if(toscaResourceStruct.getCatalogVfModule() != null && heatFile != null){
- catalogDB.saveVfModuleToHeatFiles (toscaResourceStruct.getCatalogVfModule().getModelUUID(), heatFile);
- }
- // Indicate we will deploy it in the DB
- heatArtifact.incrementDeployedInDB();
- }
- }
-
- }
+ // We expect only one MAIN HEAT per VFMODULE
+ // we can also obtain from it the Env ArtifactInfo, that's why
+ // we
+ // get the Main IArtifactInfo
- }
+ HeatTemplate heatMainTemplate = null;
+ HeatEnvironment heatEnv;
+
+ HeatTemplate heatVolumeTemplate = null;
+ HeatEnvironment heatVolumeEnv;
+
+ IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+
+ if(vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) {
+
+ List<VfModuleArtifact> artifacts =
+ vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT);
+ logger.debug("there are " + artifacts.size() + " artifacts");
+ IArtifactInfo mainEnvArtifactInfo = null;
+ for(VfModuleArtifact vfma : artifacts) {
+ logger.debug("vmfa=" + vfma.toString());
+ mainEnvArtifactInfo = vfma.getArtifactInfo().getGeneratedArtifact();
+
+ // MAIN HEAT
+ heatMainTemplate = (HeatTemplate)vfma.getCatalogObject();
+
+ // Set HeatTemplateArtifactUUID to use later when setting the VfModule
+ // and NetworkResource
+ toscaResourceStruct.setHeatTemplateUUID(heatMainTemplate.getArtifactUuid());
+
+ // Add this one for logging
+ artifactListForLogging
+ .add(ASDCElementInfo.createElementFromVfArtifactInfo(vfma.getArtifactInfo()));
+
+ catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters());
+ // Indicate we have deployed it in the DB
+ vfma.incrementDeployedInDB();
+ }
+
+ // VOLUME HEAT
+ // We expect only one VOL HEAT per VFMODULE
+ // we can also obtain from it the Env ArtifactInfo, that's why
+ // we get the Volume IArtifactInfo
+
+ if(vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) {
+ IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap()
+ .get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getGeneratedArtifact();
+
+ heatVolumeTemplate = (HeatTemplate)vfModuleStructure.getArtifactsMap()
+ .get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject();
+
+ // Set VolHeatTemplate ArtifactUUID to use later when setting the
+ // VfModule
+ toscaResourceStruct.setVolHeatTemplateUUID(heatVolumeTemplate.getArtifactUuid());
+
+ // Add this one for logging
+ artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure
+ .getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo()));
+
+ catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters());
+ // Indicate we have deployed it in the DB
+ vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0)
+ .incrementDeployedInDB();
+
+ if(volEnvArtifactInfo != null) {
+ heatVolumeEnv = (HeatEnvironment)vfResourceStructure.getArtifactsMapByUUID()
+ .get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
+
+ // Set VolHeatTemplate ArtifactUUID to use later when setting the
+ // VfModule
+ toscaResourceStruct.setVolHeatEnvTemplateUUID(heatVolumeEnv.getArtifactUuid());
+
+ // Add this one for logging
+ artifactListForLogging
+ .add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo));
+
+ catalogDB.saveHeatEnvironment(heatVolumeEnv);
+ // Indicate we have deployed it in the DB
+ vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID())
+ .incrementDeployedInDB();
+ }
+
+ }
+
+ // NESTED HEAT
+ // Here we expect many HEAT_NESTED template to be there
+ // XXX FIX BY PCLO: Defect# -36643 -US666034 - check first if we really have
+ // nested heat templates
+ if(vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) {
+ for(VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap()
+ .get(ASDCConfiguration.HEAT_NESTED)) {
+
+ // Check if this nested is well referenced by the MAIN HEAT
+ String parentArtifactType = ToscaResourceInstaller
+ .identifyParentOfNestedTemplate(vfModuleStructure, heatNestedArtifact);
+ HeatTemplate heatNestedTemplate = (HeatTemplate)heatNestedArtifact.getCatalogObject();
+
+ if(parentArtifactType != null) {
+
+ switch(parentArtifactType) {
+ case ASDCConfiguration.HEAT:
+
+ // Add this one for logging
+ artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(
+ heatNestedArtifact.getArtifactInfo()));
+
+ catalogDB.saveNestedHeatTemplate(heatMainTemplate.getArtifactUuid(),
+ heatNestedTemplate, heatNestedTemplate.getTemplateName());
+ // Indicate we have deployed it in the DB
+ heatNestedArtifact.incrementDeployedInDB();
+ break;
+ case ASDCConfiguration.HEAT_VOL:
+
+ // Add this one for logging
+ artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(
+ heatNestedArtifact.getArtifactInfo()));
+ catalogDB.saveNestedHeatTemplate(heatVolumeTemplate.getArtifactUuid(),
+ heatNestedTemplate, heatNestedTemplate.getTemplateName());
+ // Indicate we have deployed it in the DB
+ heatNestedArtifact.incrementDeployedInDB();
+ break;
+
+ default:
+ break;
+
+ }
+ } else { // Assume it belongs to HEAT MAIN
+ // Add this one for logging
+ artifactListForLogging.add(ASDCElementInfo
+ .createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo()));
+
+ catalogDB.saveNestedHeatTemplate(heatMainTemplate.getArtifactUuid(),
+ heatNestedTemplate, heatNestedTemplate.getTemplateName());
+ // Indicate we have deployed it in the DB
+ heatNestedArtifact.incrementDeployedInDB();
+ }
+ }
+ }
+
+ if(mainEnvArtifactInfo != null) {
+ heatEnv = (HeatEnvironment)vfResourceStructure.getArtifactsMapByUUID()
+ .get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject();
+
+ // Set HeatEnvironmentArtifactUUID to use later when setting the
+ // VfModule
+ toscaResourceStruct.setEnvHeatTemplateUUID(heatEnv.getArtifactUuid());
+
+ // Add this one for logging
+ artifactListForLogging
+ .add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo));
+
+ catalogDB.saveHeatEnvironment(heatEnv);
+ // Indicate we have deployed it in the DB
+ vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID())
+ .incrementDeployedInDB();
+ }
+
+ // here we expect one VFModule to be there
+ // VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate,
+ // heatVolumeTemplate, heatEnv, heatVolumeEnv);
+ // VfModule vfModule = vfModuleStructure.getCatalogVfModule();
+
+ // Add this one for logging
+ // artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure));
+
+ // catalogDB.saveOrUpdateVfModule(vfModule);
+
+ List<org.openecomp.sdc.toscaparser.api.Group> vfGroups =
+ toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
+ logger.debug("vfGroups:" + vfGroups.toString());
+
+ Collections.sort(vfGroups, new Comparator<org.openecomp.sdc.toscaparser.api.Group>() {
+
+ @Override
+ public int compare(org.openecomp.sdc.toscaparser.api.Group group1,
+ org.openecomp.sdc.toscaparser.api.Group group2) {
+
+ // Field name1Field = group1.class.getDeclaredField("name");
+ // name1Field.setAccessible(true);
+ String thisName = group1.getName(); // (String)
+ // name1Field.get(group1);
+ String thatName = group2.getName(); // (String)
+ // name1Field.get(group2);
+
+ Matcher m = lastDigit.matcher(thisName);
+ Matcher m2 = lastDigit.matcher(thatName);
+
+ String thisDigit = "0";
+ String thatDigit = "0";
+ if(m.find()) {
+ thisDigit = m.group();
+ } else {
+ return -1;
+ }
+ if(m2.find()) {
+ thatDigit = m2.group();
+ } else {
+ return 1;
+ }
+
+ return new Integer(thisDigit).compareTo(new Integer(thatDigit));
+
+ }
+ });
+
+ logger.debug("vfGroupsAfter:" + vfGroups.toString());
+
+ for(Group group : vfGroups) {
+
+ // boolean saveVFModule = createVFModule(group, nodeTemplate,
+ // toscaResourceStruct, vfMetadata);
+ if(vfMetadata.getVfModuleModelCustomizationUUID() == null) {
+ logger.debug("NULL 1");
+ } else {
+ logger.debug("vfMetadata.getMCU=" + vfMetadata.getVfModuleModelCustomizationUUID());
+ }
+ if(group.getMetadata() == null) {
+ logger.debug("NULL 3");
+ } else {
+ logger.debug("group.getMetadata().getValue() = "
+ + group.getMetadata().getValue("vfModuleModelCustomizationUUID"));
+ }
+ if(vfMetadata.getVfModuleModelCustomizationUUID()
+ .equals(group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) {
+ logger.debug("Found a match at " + vfMetadata.getVfModuleModelCustomizationUUID());
+ createVFModule(group, nodeTemplate, toscaResourceStruct, vfResourceStructure,
+ vfMetadata);
+
+ catalogDB.saveOrUpdateVfModule(toscaResourceStruct.getCatalogVfModule());
+
+ catalogDB.saveOrUpdateVfModuleCustomization(
+ toscaResourceStruct.getCatalogVfModuleCustomization());
+
+ catalogDB.saveVnfResourceToVfModuleCustomization(
+ toscaResourceStruct.getCatalogVnfResourceCustomization(),
+ toscaResourceStruct.getCatalogVfModuleCustomization());
+
+ } else {
+ if(toscaResourceStruct.getCatalogVfModuleCustomization() != null) {
+ logger.debug("No match for " + toscaResourceStruct.getCatalogVfModuleCustomization()
+ .getModelCustomizationUuid());
+ } else {
+ logger.debug("No match for vfModuleModelCustomizationUUID");
+ }
+ }
+
+ }
+
+ } // Commented out to process VFModules each time
+
+ // Here we expect many HEAT_TEMPLATE files to be there
+ if(vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) {
+ for(VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap()
+ .get(ASDCConfiguration.HEAT_ARTIFACT)) {
+
+ HeatFiles heatFile = (HeatFiles)heatArtifact.getCatalogObject();
+
+ // Add this one for logging
+ artifactListForLogging.add(
+ ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo()));
+
+ if(toscaResourceStruct.getCatalogVfModule() != null && heatFile != null) {
+ catalogDB.saveVfModuleToHeatFiles(
+ toscaResourceStruct.getCatalogVfModule().getModelUUID(), heatFile);
+ }
+ // Indicate we will deploy it in the DB
+ heatArtifact.incrementDeployedInDB();
+ }
+ }
+
+ }
+
+ }
/* END OF HEAT TABLE POPULATION
* ***************************************************************************************************
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy index 06992455a2..719aeb837f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy @@ -986,4 +986,31 @@ class MsoUtils { return requestId
}
+
+ /**
+ * Remove all the empty nodes and attributes from the within the given node
+ * @param node
+ * @return true if all empty nodes and attributes were removed.
+ */
+ public boolean cleanNode( Node node ) {
+ node.attributes().with { a ->
+ a.findAll { !it.value }.each { a.remove( it.key ) }
+ }
+ node.children().with { kids ->
+ kids.findAll { it instanceof Node ? !cleanNode( it ) : false }
+ .each { kids.remove( it ) }
+ }
+ node.attributes() || node.children() || node.text()
+ }
+
+ /**
+ *
+ * @param xml
+ * @return String representation of xml after removing the empty nodes and attributes
+ */
+ public String cleanNode(String xmlString) {
+ def xml = new XmlParser(false, false).parseText(xmlString)
+ cleanNode(xml)
+ return XmlUtil.serialize(xml)
+ }
}
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index b3eddeda41..6884c1e33b 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -167,5 +167,11 @@ <artifactId>status-control</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.8.0</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java index e9da2355e4..77e418d4c3 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/BaseTask.java @@ -23,510 +23,432 @@ package org.openecomp.mso.bpmn.core; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.Expression; import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.core.internal.VariableNameExtractor; /** * Base class for service tasks. */ public class BaseTask implements JavaDelegate { - /** - * Get the value of a required field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Object getField(Expression expression, - DelegateExecution execution, String fieldName) { - return getFieldImpl(expression, execution, fieldName, false); - } - - /** - * Gets the value of an optional field. There are three conditions - * in which this method returns null: - * <p> - * <ol> - * <li> The expression itself is null (i.e. the field is missing - * altogether.</li> - * <li>The expression evaluates to a null value.</li> - * <li>The expression references a single variable which has not - * been set.</li> - * </ol> - * <p> - * Examples:<br> - * Expression ${x} when x is null: return null<br> - * Expression ${x} when x is unset: return null<br> - * Expression ${x+y} when x and/or y are unset: exception<br> - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Object getOptionalField(Expression expression, - DelegateExecution execution, String fieldName) { - return getFieldImpl(expression, execution, fieldName, true); - } - - /** - * Get the value of a required output variable field. This method - * throws MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression produces a null or - * illegal variable name. Legal variable names contain only letters, - * numbers, and the underscore character ('_'). - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the output variable name - */ - protected String getOutputField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof String) { - String variable = (String) o; - if (!isLegalVariable(variable)) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "'" + variable - + "' is not a legal variable name"); - } - return variable; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "expected a variable name string" - + ", got object of type " + o.getClass().getName()); - } - } - - /** - * Get the value of an optional output variable field. This method - * throws BadInjectedFieldException if the expression produces an illegal - * variable name. Legal variable names contain only letters, numbers, - * and the underscore character ('_'). - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the output variable name, possibly null - */ - protected String getOptionalOutputField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof String) { - String variable = (String) o; - if (!isLegalVariable(variable)) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "'" + variable - + "' is not a legal variable name"); - } - return variable; - } else if (o == null) { - return null; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "expected a variable name string" - + ", got object of type " + o.getClass().getName()); - } - } - - /** - * Get the value of a required string field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value. - * <p> - * Note: the result is coerced to a string value, if necessary. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected String getStringField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof String) { - return (String) o; - } else { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - - /** - * Gets the value of an optional string field. There are three conditions - * in which this method returns null: - * <p> - * <ol> - * <li> The expression itself is null (i.e. the field is missing - * altogether.</li> - * <li>The expression evaluates to a null value.</li> - * <li>The expression references a single variable which has not - * been set.</li> - * </ol> - * <p> - * Examples:<br> - * Expression ${x} when x is null: return null<br> - * Expression ${x} when x is unset: return null<br> - * Expression ${x+y} when x and/or y are unset: exception<br> - * <p> - * Note: the result is coerced to a string value, if necessary. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected String getOptionalStringField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof String) { - return (String) o; - } else if (o == null) { - return null; - } else { - return o.toString(); - } - } - - /** - * Get the value of a required integer field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value or a value that cannot be coerced to an integer. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Integer getIntegerField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof Integer) { - return (Integer) o; - } else { - try { - return Integer.parseInt(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - } - - /** - * Gets the value of an optional integer field. There are three conditions - * in which this method returns null: - * <p> - * <ol> - * <li> The expression itself is null (i.e. the field is missing - * altogether.</li> - * <li>The expression evaluates to a null value.</li> - * <li>The expression references a single variable which has not - * been set.</li> - * </ol> - * <p> - * Examples:<br> - * Expression ${x} when x is null: return null<br> - * Expression ${x} when x is unset: return null<br> - * Expression ${x+y} when x and/or y are unset: exception<br> - * <p> - * Note: the result is coerced to an integer value, if necessary. This - * method throws BadInjectedFieldException if the result cannot be coerced - * to an integer. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Integer getOptionalIntegerField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof Integer) { - return (Integer) o; - } else if (o == null) { - return null; - } else { - try { - return Integer.parseInt(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Integer"); - } - } - } - - /** - * Gets the value of an optional long field. There are three conditions - * in which this method returns null: - * <p> - * <ol> - * <li> The expression itself is null (i.e. the field is missing - * altogether.</li> - * <li>The expression evaluates to a null value.</li> - * <li>The expression references a single variable which has not - * been set.</li> - * </ol> - * <p> - * Examples:<br> - * Expression ${x} when x is null: return null<br> - * Expression ${x} when x is unset: return null<br> - * Expression ${x+y} when x and/or y are unset: exception<br> - * <p> - * Note: the result is coerced to a long value, if necessary. This - * method throws BadInjectedFieldException if the result cannot be coerced - * to a long. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value, possibly null - */ - protected Long getOptionalLongField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, true); - if (o instanceof Long) { - return (Long) o; - } else if (o == null) { - return null; - } else { - try { - return Long.parseLong(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Long"); - } - } - } - - /** - * Get the value of a required long field. This method throws - * MissingInjectedFieldException if the expression is null, and - * BadInjectedFieldException if the expression evaluates to a null - * value or a value that cannot be coerced to a long. - * - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @return the field value - */ - protected Long getLongField(Expression expression, - DelegateExecution execution, String fieldName) { - Object o = getFieldImpl(expression, execution, fieldName, false); - if (o instanceof Long) { - return (Long) o; - } else { - try { - return Long.parseLong(o.toString()); - } catch (NumberFormatException e) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "cannot convert '" + o.toString() - + "' to Long"); - } - } - } - - /** - * Common implementation for field "getter" methods. - * @param expression the expression - * @param execution the execution - * @param fieldName the field name (for logging and exceptions) - * @param optional true if the field is optional - * @return the field value, possibly null - */ - private Object getFieldImpl(Expression expression, - DelegateExecution execution, String fieldName, boolean optional) { - if (expression == null) { - if (!optional) { - throw new MissingInjectedFieldException( - fieldName, getTaskName()); - } - return null; - } - - Object value; - - try { - value = expression.getValue(execution); - } catch (Exception e) { - if (!optional) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // At this point, we have an exception that occurred while - // evaluating an expression for an optional field. A common - // problem is that the expression is a simple reference to a - // variable which has never been set, e.g. the expression is - // ${x}. The normal activiti behavior is to throw an exception, - // but we don't like that, so we have the following workaround, - // which parses the expression text to see if it is a "simple" - // variable reference, and if so, returns null. If the - // expression is anything other than a single variable - // reference, then an exception is thrown, as it would have - // been without this workaround. - - // Get the expression text so we can parse it - String s = expression.getExpressionText(); - -// if (isDebugEnabled(execution)) { -// logDebug(execution, getTaskName() + " field '" + fieldName -// + "' expression evaluation failed: " + s); -// } - - int len = s.length(); - int i = 0; - - // Skip whitespace - while (i < len && Character.isWhitespace(s.charAt(i))) { - i++; - } - - // Next character must be '$' - if (i == len || s.charAt(i++) != '$') { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // Skip whitespace - while (i < len && Character.isWhitespace(s.charAt(i))) { - i++; - } - - // Next character must be '{' - if (i == len || s.charAt(i++) != '{') { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // Skip whitespace - while (i < len && Character.isWhitespace(s.charAt(i))) { - i++; - } - - // Collect the variable name - StringBuilder variable = new StringBuilder(); - while (i < len && isWordCharacter(s.charAt(i))) { - variable.append(s.charAt(i)); - i++; - } - - if (variable.length() == 0) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // Skip whitespace - while (i < len && Character.isWhitespace(s.charAt(i))) { - i++; - } - - // Next character must be '}' - if (i == len || s.charAt(i++) != '}') { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // Skip whitespace - while (i < len && Character.isWhitespace(s.charAt(i))) { - i++; - } - - // Must be at end of string - if (i != len) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - -// if (isDebugEnabled(execution)) { -// logDebug(execution, "Checking if variable '" -// + variable.toString() + "' exists"); -// } - - // If the variable exists then the problem was - // something else... - if (execution.hasVariable(variable.toString())) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), e.getClass().getSimpleName(), e); - } - - // The variable doesn't exist. - -// if (isDebugEnabled(execution)) { -// logDebug(execution, "Variable '" + variable.toString() -// + "' does not exist [ok]"); -// } - - value = null; - } - - if (value == null && !optional) { - throw new BadInjectedFieldException( - fieldName, getTaskName(), "required field has null value"); - } - - return value; - } - - /** - * Tests if a character is a "word" character. - * @param c the character - * @return true if the character is a "word" character. - */ - private boolean isWordCharacter(char c) { - return (Character.isLetterOrDigit(c) || c == '_'); - } - - /** - * Tests if the specified string is a legal flow variable name. - * @param name the string - * @return true if the string is a legal flow variable name - */ - private boolean isLegalVariable(String name) { - if (name == null) { - return false; - } - - int len = name.length(); - - if (len == 0) { - return false; - } - - char c = name.charAt(0); - - if (!Character.isLetter(c) && c != '_') { - return false; - } - - for (int i = 1; i < len; i++) { - c = name.charAt(i); - if (!Character.isLetterOrDigit(c) && c != '_') { - return false; - } - } - - return true; - } - - /** - * Returns the name of the task (normally the java class name). - * @return the name of the task - */ - public String getTaskName() { - return getClass().getSimpleName(); - } - - @Override - public void execute(DelegateExecution execution) throws Exception { } + /** + * Get the value of a required field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Object getField(Expression expression, + DelegateExecution execution, String fieldName) { + return getFieldImpl(expression, execution, fieldName, false); + } + + /** + * Gets the value of an optional field. There are three conditions + * in which this method returns null: + * <p> + * <ol> + * <li> The expression itself is null (i.e. the field is missing + * altogether.</li> + * <li>The expression evaluates to a null value.</li> + * <li>The expression references a single variable which has not + * been set.</li> + * </ol> + * <p> + * Examples:<br> + * Expression ${x} when x is null: return null<br> + * Expression ${x} when x is unset: return null<br> + * Expression ${x+y} when x and/or y are unset: exception<br> + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Object getOptionalField(Expression expression, + DelegateExecution execution, String fieldName) { + return getFieldImpl(expression, execution, fieldName, true); + } + + /** + * Get the value of a required output variable field. This method + * throws MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression produces a null or + * illegal variable name. Legal variable names contain only letters, + * numbers, and the underscore character ('_'). + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the output variable name + */ + protected String getOutputField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof String) { + String variable = (String) o; + if (!isLegalVariable(variable)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "'" + variable + + "' is not a legal variable name"); + } + return variable; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "expected a variable name string" + + ", got object of type " + o.getClass().getName()); + } + } + + /** + * Get the value of an optional output variable field. This method + * throws BadInjectedFieldException if the expression produces an illegal + * variable name. Legal variable names contain only letters, numbers, + * and the underscore character ('_'). + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the output variable name, possibly null + */ + protected String getOptionalOutputField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof String) { + String variable = (String) o; + if (!isLegalVariable(variable)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "'" + variable + + "' is not a legal variable name"); + } + return variable; + } else if (o == null) { + return null; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "expected a variable name string" + + ", got object of type " + o.getClass().getName()); + } + } + + /** + * Get the value of a required string field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value. + * <p> + * Note: the result is coerced to a string value, if necessary. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected String getStringField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof String) { + return (String) o; + } else { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + + /** + * Gets the value of an optional string field. There are three conditions + * in which this method returns null: + * <p> + * <ol> + * <li> The expression itself is null (i.e. the field is missing + * altogether.</li> + * <li>The expression evaluates to a null value.</li> + * <li>The expression references a single variable which has not + * been set.</li> + * </ol> + * <p> + * Examples:<br> + * Expression ${x} when x is null: return null<br> + * Expression ${x} when x is unset: return null<br> + * Expression ${x+y} when x and/or y are unset: exception<br> + * <p> + * Note: the result is coerced to a string value, if necessary. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected String getOptionalStringField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof String) { + return (String) o; + } else if (o == null) { + return null; + } else { + return o.toString(); + } + } + + /** + * Get the value of a required integer field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value or a value that cannot be coerced to an integer. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Integer getIntegerField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof Integer) { + return (Integer) o; + } else { + try { + return Integer.parseInt(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + } + + /** + * Gets the value of an optional integer field. There are three conditions + * in which this method returns null: + * <p> + * <ol> + * <li> The expression itself is null (i.e. the field is missing + * altogether.</li> + * <li>The expression evaluates to a null value.</li> + * <li>The expression references a single variable which has not + * been set.</li> + * </ol> + * <p> + * Examples:<br> + * Expression ${x} when x is null: return null<br> + * Expression ${x} when x is unset: return null<br> + * Expression ${x+y} when x and/or y are unset: exception<br> + * <p> + * Note: the result is coerced to an integer value, if necessary. This + * method throws BadInjectedFieldException if the result cannot be coerced + * to an integer. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Integer getOptionalIntegerField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof Integer) { + return (Integer) o; + } else if (o == null) { + return null; + } else { + try { + return Integer.parseInt(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Integer"); + } + } + } + + /** + * Gets the value of an optional long field. There are three conditions + * in which this method returns null: + * <p> + * <ol> + * <li> The expression itself is null (i.e. the field is missing + * altogether.</li> + * <li>The expression evaluates to a null value.</li> + * <li>The expression references a single variable which has not + * been set.</li> + * </ol> + * <p> + * Examples:<br> + * Expression ${x} when x is null: return null<br> + * Expression ${x} when x is unset: return null<br> + * Expression ${x+y} when x and/or y are unset: exception<br> + * <p> + * Note: the result is coerced to a long value, if necessary. This + * method throws BadInjectedFieldException if the result cannot be coerced + * to a long. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value, possibly null + */ + protected Long getOptionalLongField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, true); + if (o instanceof Long) { + return (Long) o; + } else if (o == null) { + return null; + } else { + try { + return Long.parseLong(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Long"); + } + } + } + + /** + * Get the value of a required long field. This method throws + * MissingInjectedFieldException if the expression is null, and + * BadInjectedFieldException if the expression evaluates to a null + * value or a value that cannot be coerced to a long. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @return the field value + */ + protected Long getLongField(Expression expression, + DelegateExecution execution, String fieldName) { + Object o = getFieldImpl(expression, execution, fieldName, false); + if (o instanceof Long) { + return (Long) o; + } else { + try { + return Long.parseLong(o.toString()); + } catch (NumberFormatException e) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "cannot convert '" + o.toString() + + "' to Long"); + } + } + } + + /** + * Common implementation for field "getter" methods. + * + * @param expression the expression + * @param execution the execution + * @param fieldName the field name (for logging and exceptions) + * @param optional true if the field is optional + * @return the field value, possibly null + */ + private Object getFieldImpl(Expression expression, + DelegateExecution execution, String fieldName, boolean optional) { + if (expression == null) { + if (!optional) { + throw new MissingInjectedFieldException( + fieldName, getTaskName()); + } + return null; + } + + Object value = null; + + try { + value = expression.getValue(execution); + } catch (Exception e) { + if (!optional) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), e.getClass().getSimpleName(), e); + } + + // At this point, we have an exception that occurred while + // evaluating an expression for an optional field. A common + // problem is that the expression is a simple reference to a + // variable which has never been set, e.g. the expression is + // ${x}. The normal activiti behavior is to throw an exception, + // but we don't like that, so we have the following workaround, + // which parses the expression text to see if it is a "simple" + // variable reference, and if so, returns null. If the + // expression is anything other than a single variable + // reference, then an exception is thrown, as it would have + // been without this workaround. + + // Get the expression text so we can parse it + String s = expression.getExpressionText(); + new VariableNameExtractor(s).extract().ifPresent(name -> { + if (execution.hasVariable(name)) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), e.getClass().getSimpleName(), e); + } + }); + } + + if (value == null && !optional) { + throw new BadInjectedFieldException( + fieldName, getTaskName(), "required field has null value"); + } + + return value; + } + + /** + * Tests if a character is a "word" character. + * + * @param c the character + * @return true if the character is a "word" character. + */ + private static boolean isWordCharacter(char c) { + return (Character.isLetterOrDigit(c) || c == '_'); + } + + /** + * Tests if the specified string is a legal flow variable name. + * + * @param name the string + * @return true if the string is a legal flow variable name + */ + private boolean isLegalVariable(String name) { + if (name == null) { + return false; + } + + int len = name.length(); + + if (len == 0) { + return false; + } + + char c = name.charAt(0); + + if (!Character.isLetter(c) && c != '_') { + return false; + } + + for (int i = 1; i < len; i++) { + c = name.charAt(i); + if (!Character.isLetterOrDigit(c) && c != '_') { + return false; + } + } + + return true; + } + + /** + * Returns the name of the task (normally the java class name). + * + * @return the name of the task + */ + public String getTaskName() { + return getClass().getSimpleName(); + } + + @Override + public void execute(DelegateExecution execution) throws Exception { + } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java new file mode 100644 index 0000000000..e1aaba74da --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractor.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.core.internal; + +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Extracts variable name from expression if entire expression is just + * one variable, for example "${x}". + * + * Ignores all whitespaces, except inside variable name. + * + * Examples: + * "${x}", extracted variable name is "x" + * " ${\t weird_NAME }", extracted variable name is "weird_NAME" + * "${incorrect name}", no extracted name + * "${two}+${two}", no extracted name + */ +public class VariableNameExtractor { + + private static final Pattern VARIABLE_NAME_PATTERN = Pattern + .compile("^\\s*\\$\\s*\\{\\s*([a-zA-Z0-9_]+)\\s*\\}\\s*$"); + + private final String expression; + + + /** + * Creates new VariableNameExtractor + * @param expression expression to be parsed + */ + public VariableNameExtractor(String expression) { + this.expression = expression; + } + + /** + * Extracts variable name from expression given in constructor + * @return Optional of variable name, empty if expression wasn't single variable + */ + public Optional<String> extract() { + Matcher matcher = VARIABLE_NAME_PATTERN.matcher(expression); + if (!matcher.matches()) { + return Optional.empty(); + } + return Optional.of(matcher.group(1)); + } + +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java new file mode 100644 index 0000000000..57f479f7cb --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.core.internal; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Optional; +import org.junit.Test; + +public class VariableNameExtractorTest { + + @Test + public void shouldExtractVariableName() throws Exception { + // given + String name = "A_different_NAME123"; + String variable = "${A_different_NAME123}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional<String> extracted = extractor.extract(); + // then + assertThat(extracted).isPresent().contains(name); + } + + @Test + public void shouldExtractVariableNameFromWhitespaces() throws Exception { + // given + String name = "name"; + String variable = " \n\t$ \n\t{ \n\tname \n\t} \n\t"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional<String> extracted = extractor.extract(); + // then + assertThat(extracted).isPresent().contains(name); + } + + @Test + public void shouldReturnEmptyIfThereIsMoreThanVariable() throws Exception { + // given + String variable = "a ${test}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional<String> extracted = extractor.extract(); + // then + assertThat(extracted).isNotPresent(); + } + + @Test + public void shouldReturnEmptyIfVariableNameIsIncorrect() throws Exception { + // given + String variable = "${name with space}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional<String> extracted = extractor.extract(); + // then + assertThat(extracted).isNotPresent(); + } + + @Test + public void shouldReturnEmptyIfTwoVariablesPresent() throws Exception { + // given + String variable = "${var1} ${var2}"; + VariableNameExtractor extractor = new VariableNameExtractor(variable); + // when + Optional<String> extracted = extractor.extract(); + // then + assertThat(extracted).isNotPresent(); + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy new file mode 100644 index 0000000000..cc34b03c64 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy @@ -0,0 +1,1082 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.infrastructure.scripts;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import 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.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.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+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;
+
+/**
+ * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - globalSubscriberId
+ * @param - subscriptionServiceType
+ * @param - serviceInstanceId
+ * @param - serviceInstanceName - O
+ * @param - serviceModelInfo
+ * @param - productFamilyId
+ * @param - disableRollback
+ * @param - failExists - TODO
+ * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
+ * @param - sdncVersion ("1610")
+ * @param - serviceDecomposition - Decomposition for R1710
+ * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored)
+ *
+ * Outputs:
+ * @param - rollbackData (localRB->null)
+ * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
+ * @param - WorkflowException
+ * @param - serviceInstanceName - (GET from AAI if null in input)
+ *
+ */
+public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
+
+ String Prefix="DCRESI_"
+ private static final String DebugFlag = "isDebugEnabled"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void preProcessRequest (Execution execution) {
+ //only for dug
+ execution.setVariable("isDebugLogEnabled","true")
+ execution.setVariable("unit_test", "true")
+ execution.setVariable("skipVFC", "true")
+
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String msg = ""
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRequest *****", isDebugEnabled)
+
+ utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
+
+ try {
+ execution.setVariable("prefix", Prefix)
+ //Inputs
+ //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
+ String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+ utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
+
+ //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
+ String serviceType = execution.getVariable("serviceType")
+ utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
+
+ //requestDetails.requestParameters. for SDNC assignTopology
+ String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId
+
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ if (isBlank(serviceType)) {
+ msg = "Input serviceType is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ if (productFamilyId == null) {
+ execution.setVariable("productFamilyId", "")
+ }
+
+ String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ if (isBlank(sdncCallbackUrl)) {
+ msg = "URN_mso_workflow_sdncadapter_callback is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
+ utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+
+ //requestDetails.modelInfo.for AAI PUT servieInstanceData
+ //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
+
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
+ utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+ utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+
+ String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
+ utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
+ execution.setVariable("serviceModelName", serviceModelName)
+
+ //aai serviceType and Role can be setted as fixed value now.
+ String aaiServiceType = serviceType
+ String aaiServiceRole = serviceType+"Role"
+
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ execution.setVariable("modelUuid", modelUuid)
+
+ //AAI PUT
+ String oStatus = execution.getVariable("initialStatus") ?: ""
+ utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
+ if ("TRANSPORT".equalsIgnoreCase(serviceType))
+ {
+ oStatus = "Created"
+ }
+
+
+
+ String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
+ utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
+ String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+ utils.log("INFO","namespace: " + namespace, isDebugEnabled)
+ /*
+ String serviceInstanceData =
+ """<service-instance xmlns=\"${namespace}\">
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ <service-type>${aaiServiceType}</service-type>
+ <service-role>${aaiServiceRole}</service-role>
+ ${statusLine}
+ <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
+ <model-version-id>${modelUuid}</model-version-id>
+ </service-instance>""".trim()
+ */
+ //begin only for test
+ String serviceInstanceData =
+ """<service-instance xmlns=\"${namespace}\">
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ <service-type>${aaiServiceType}</service-type>
+ <service-role>${aaiServiceRole}</service-role>
+ ${statusLine}
+ </service-instance>""".trim()
+ //end only for test
+ execution.setVariable("serviceInstanceData", serviceInstanceData)
+ utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
+ utils.logAudit(serviceInstanceData)
+ utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
+ utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
+
+ execution.setVariable("serviceSDNCCreate", "false")
+ execution.setVariable("operationStatus", "Waiting deploy resource...")
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessAAIGET(Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET ***** ", isDebugEnabled)
+ String msg = ""
+
+ try {
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
+ if(succInAAI != true){
+ utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled)
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ utils.logAudit("workflowException: " + workflowException)
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }
+ else
+ {
+ msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ else
+ {
+ boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
+ if(foundInAAI == true){
+ utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
+ msg = "ServiceInstance already exists in AAI:" + serviceInstanceName
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessAAIPUT(Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIPUT ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator")
+ if(succInAAI != true){
+ utils.log("INFO","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled)
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ utils.logAudit("workflowException: " + workflowException)
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }
+ }
+ else
+ {
+ //start rollback set up
+ RollbackData rollbackData = new RollbackData()
+ def disableRollback = execution.getVariable("disableRollback")
+ rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+ }
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessAAIGET2(Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessAAIGET2 ***** ", isDebugEnabled)
+ String msg = ""
+
+ try {
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
+ if(succInAAI != true){
+ utils.log("INFO","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled)
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ utils.logAudit("workflowException: " + workflowException)
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }
+ else
+ {
+ msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ else
+ {
+ boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
+ if(foundInAAI == true){
+ String aaiService = execution.getVariable("GENGS_service")
+ if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) {
+ execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name"))
+ utils.log("INFO","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled)
+ }
+ }
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void preProcessRollback (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 preProcessRollback ***** ", isDebugEnabled)
+ try {
+
+ Object workflowException = execution.getVariable("WorkflowException");
+
+ if (workflowException instanceof WorkflowException) {
+ utils.log("INFO", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
+ execution.setVariable("prevWorkflowException", workflowException);
+ //execution.setVariable("WorkflowException", null);
+ }
+ } catch (BpmnError e) {
+ utils.log("INFO", "BPMN Error during preProcessRollback", isDebugEnabled)
+ } catch(Exception ex) {
+ String msg = "Exception in preProcessRollback. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessRollback (Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCreateE2EServiceInstanceV2 postProcessRollback ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ Object workflowException = execution.getVariable("prevWorkflowException");
+ if (workflowException instanceof WorkflowException) {
+ utils.log("INFO", "Setting prevException to WorkflowException: ", isDebugEnabled)
+ execution.setVariable("WorkflowException", workflowException);
+ }
+ execution.setVariable("rollbackData", null)
+ } catch (BpmnError b) {
+ utils.log("INFO", "BPMN Error during postProcessRollback", isDebugEnabled)
+ throw b;
+ } catch(Exception ex) {
+ msg = "Exception in postProcessRollback. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * Init the service Operation Status
+ */
+ public void preUpdateServiceOperationStatus(Execution execution){
+ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String serviceName = execution.getVariable("serviceInstanceName")
+ String operationType = "CREATE"
+ String userId = ""
+ String result = "processing"
+ String progress = execution.getVariable("progress")
+ utils.log("INFO", "progress: " + progress , isDebugEnabled)
+ if ("100".equalsIgnoreCase(progress))
+ {
+ result = "finished"
+ }
+ String reason = ""
+ String operationContent = "Prepare service creation : " + execution.getVariable("operationStatus")
+
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <serviceName>${serviceName}</serviceName>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
+
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+
+ public void preInitResourcesOperStatus(Execution execution){
+ def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
+ String resourceTemplateUUIDs = ""
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service creation"
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+ String incomingRequest = execution.getVariable("uuiRequest")
+ String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
+ List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
+ for(String resource : resourceList){
+ resourceTemplateUUIDs = resourceTemplateUUIDs + jsonUtil.getJsonValue(resource, "resourceId") + ":"
+ }
+
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * prepare resource create request
+ */
+ public void preResourceRequest(execution){
+ def method = getClass().getSimpleName() + '.preResourceRequest(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preResourceRequest Process ======== ", isDebugEnabled)
+ try {
+ String resourceType = execution.getVariable("resourceType")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String nsServiceName = resourceType + "_" + serviceInstanceName
+ execution.setVariable("nsServiceName", nsServiceName)
+ utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceId = execution.getVariable("serviceInstanceId")
+ execution.setVariable("serviceId", serviceId)
+ String operationId = execution.getVariable("operationId")
+ String incomingRequest = execution.getVariable("uuiRequest")
+ String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
+ String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
+ execution.setVariable("nsServiceDescription", nsServiceDescription)
+ utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+ List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
+ for(String resource : resourceList){
+ String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
+ if(StringUtils.containsIgnoreCase(resourceName, resourceType)){
+ String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
+ String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
+ String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
+ execution.setVariable("resourceUUID", resourceUUID)
+ execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
+ execution.setVariable("resourceParameters", resourceParameters)
+ utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
+ utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
+ utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
+ }
+ }
+ } catch (BpmnError b) {
+ utils.log("INFO", "BPMN Error during preResourceRequest", isDebugEnabled)
+ throw b;
+ } catch(Exception ex) {
+ msg = "Exception in preResourceRequest. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * post config request.
+ */
+ public void postConfigRequest(execution){
+ //now do noting
+ }
+
+ /***********************************************************************************************/
+
+ private void loadResourcesProperties(Execution execution) {
+ def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String loadFilePath = "/etc/mso/config.d/reources.json"
+ try{
+ def jsonPayload = new File(loadFilePath).text
+ utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)
+
+ String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
+ utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)
+
+ String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
+ //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)
+ execution.setVariable("createResourceSort", createResourceSort)
+
+ String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
+ //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)
+ execution.setVariable("deleteResourceSort", deleteResourceSort)
+
+
+ String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
+ //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)
+ execution.setVariable("resourceControllerType", resourceControllerType)
+
+
+ }catch(Exception ex){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ private sortCreateResource(Execution execution) {
+ def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String createResourceSortDef = """[
+ {
+ "resourceType":"vEPC"
+ },
+ {
+ "resourceType":"vIMS"
+ },
+ {
+ "resourceType":"vCPE"
+ },
+ {
+ "resourceType":"vFW"
+ },
+ {
+ "resourceType":"Underlay"
+ },
+ {
+ "resourceType":"Overlay"
+ },
+ {
+ "resourceType":"GRE_AAR"
+ },
+ {
+ "resourceType":"APN_AAR"
+ },
+ {
+ "resourceType":"VPN_SAR"
+ },
+ {
+ "resourceType":"GRE_SAR"
+ }
+
+ ]""".trim()
+
+ try{
+
+ loadResourcesProperties(execution)
+ String createResourceSort = execution.getVariable("createResourceSort")
+ if (isBlank(createResourceSort)) {
+ createResourceSort = createResourceSortDef;
+ }
+
+ List<String> sortResourceList = jsonUtil.StringArrayToList(execution, createResourceSort)
+ utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled)
+
+ JSONArray newResourceList = new JSONArray()
+ int resSortCount = sortResourceList.size()
+
+
+ for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
+ String sortResource = sortResourceList[currentResource]
+ String resourceType = jsonUtil.getJsonValue(sortResource, "resourceType")
+ List<String> resourceList = execution.getVariable(Prefix+"resourceList")
+
+ for (String resource : resourceList) {
+ //utils.log("INFO", "resource : " + resource, isDebugEnabled)
+ String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
+ //utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
+ String[] split = resourceName.split("_")
+
+ utils.log("INFO", "split : " + split, isDebugEnabled)
+ int strLen = split.size()
+ String allottedResourceType = ""
+
+ if (strLen <2) {
+ allottedResourceType = split[0]
+ }
+ else {
+ allottedResourceType = split[0] + "_" + split[1]
+ }
+
+ if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
+ utils.log("INFO", "allottedResourceType : " + allottedResourceType + " resourceType : " + resourceType, isDebugEnabled)
+ utils.log("INFO", "resource : " + resource , isDebugEnabled)
+ JSONObject jsonObj = new JSONObject(resource)
+ newResourceList.put(jsonObj)
+
+ }
+ utils.log("INFO", "Get next sort type " , isDebugEnabled)
+ }
+ }
+ utils.log("INFO", "newResourceList : " + newResourceList, isDebugEnabled)
+ String newResourceStr = newResourceList.toString()
+ List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
+
+ execution.setVariable(Prefix+"resourceList", newResourceListStr)
+ utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled)
+
+ }catch(Exception ex){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+
+ }
+ /**
+ * get service resources
+ */
+ public void getServiceResources(Execution execution){
+ def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 getServiceResources Process ======== ", isDebugEnabled)
+ try{
+ execution.setVariable(Prefix+"resourceCount", 0)
+ execution.setVariable(Prefix+"nextResource", 0)
+
+ String incomingRequest = execution.getVariable("uuiRequest")
+ String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
+ utils.log("INFO", "Resources String : " + resourcesStr, isDebugEnabled)
+ if (!isBlank(resourcesStr)) {
+ List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
+ utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
+ execution.setVariable(Prefix+"resourceList", resourceList)
+ execution.setVariable(Prefix+"resourceCount", resourceList.size())
+ execution.setVariable(Prefix+"nextResource", 0)
+ }
+
+ int resourceNum = execution.getVariable(Prefix+"nextResource")
+ utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
+
+ int resourceCount = execution.getVariable(Prefix+"resourceCount")
+ utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
+
+ if (resourceNum < resourceCount) {
+ execution.setVariable(Prefix+"resourceFinish", false)
+ }
+ else {
+ execution.setVariable(Prefix+"resourceFinish", true)
+ }
+ sortCreateResource(execution)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing getServiceResources. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during getServiceResources Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * prepare Decompose next resource to create request
+ */
+ public void preProcessDecomposeNextResource(Execution execution){
+ def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessDecomposeNextResource Process ======== ", isDebugEnabled)
+ try{
+ int resourceNum = execution.getVariable(Prefix+"nextResource")
+ List<String> resourceList = execution.getVariable(Prefix+"resourceList")
+ utils.log("INFO", "Resource List : " + resourceList, isDebugEnabled)
+
+ String resource = resourceList[resourceNum]
+ execution.setVariable(Prefix+"resource", resource)
+ utils.log("INFO", "Current Resource : " + resource, isDebugEnabled)
+
+ String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
+ execution.setVariable(Prefix+"resourceName", resourceName)
+ utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
+
+ String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
+ execution.setVariable("resourceUUID", resourceUUID)
+ utils.log("INFO", "resource UUID : " + resourceUUID, isDebugEnabled)
+
+ String resourceInvariantUUID = jsonUtil.getJsonValue(resource, "resourceDefId")
+ execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
+
+
+ String resourceParameters = jsonUtil.getJsonValue(resource, "nsParameters")
+ execution.setVariable("resourceParameters", resourceParameters)
+ utils.log("INFO", "resource Parameters : " + resourceParameters, isDebugEnabled)
+
+ execution.setVariable(Prefix+"nextResource", resourceNum + 1)
+ utils.log("INFO", "next Resource num : " + execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
+
+ int resourceCount = execution.getVariable(Prefix+"resourceCount")
+ if (resourceCount >0 ){
+ int progress = (resourceNum*100) / resourceCount
+ execution.setVariable("progress", progress.toString() )
+ }
+
+ execution.setVariable("operationStatus", resourceName )
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing preProcessDecomposeNextResource. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during preProcessDecomposeNextResource Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * post Decompose next resource to create request
+ */
+ public void postProcessDecomposeNextResource(Execution execution){
+ def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== STARTED DoCreateE2EServiceInstanceV2 postProcessDecomposeNextResource Process ======== ", isDebugEnabled)
+ try{
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+
+ int resourceNum = execution.getVariable(Prefix+"nextResource")
+ utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextResource"), isDebugEnabled)
+
+ int resourceCount = execution.getVariable(Prefix+"resourceCount")
+ utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"resourceCount"), isDebugEnabled)
+
+ if (resourceNum < resourceCount) {
+ execution.setVariable(Prefix+"resourceFinish", false)
+ }
+ else {
+ execution.setVariable(Prefix+"resourceFinish", true)
+ }
+
+ utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)
+
+ if (resourceCount >0 ){
+ int progress = (resourceNum*100) / resourceCount
+ execution.setVariable("progress", progress.toString() )
+ utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)
+ }
+ execution.setVariable("operationStatus", resourceName )
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in "+method + "- " + e.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * prepare check Resource Type
+ */
+ public void checkResourceType(Execution execution){
+ def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String resourceControllerTypeDef = """[
+ {
+ "resourceType":"vEPC",
+ "controllerType":"VFC"
+ },
+ {
+ "resourceType":"vIMS",
+ "controllerType":"VFC"
+ },
+ {
+ "resourceType":"vCPE",
+ "controllerType":"VFC"
+ },
+ {
+ "resourceType":"vFW",
+ "controllerType":"VFC"
+ },
+ {
+ "resourceType":"Underlay",
+ "controllerType":"SDNC"
+ },
+ {
+ "resourceType":"Overlay",
+ "controllerType":"SDNC"
+ },
+ {
+ "resourceType":"VPN_SAR",
+ "controllerType":"SDNC"
+ },
+ {
+ "resourceType":"GRE_AAR",
+ "controllerType":"APPC"
+ },
+ {
+ "resourceType":"GRE_SAR",
+ "controllerType":"SDNC"
+ } ,
+ {
+ "resourceType":"APN_AAR",
+ "controllerType":"APPC"
+ }
+
+ ]""".trim()
+
+ try{
+
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
+ execution.setVariable("resourceName", resourceName)
+
+ String[] split = resourceName.split("_")
+
+ utils.log("INFO", "split : " + split, isDebugEnabled)
+ int strLen = split.size()
+ String allottedResourceType = ""
+
+ if (strLen <2) {
+ allottedResourceType = split[0]
+ }
+ else {
+ allottedResourceType = split[0] + "_" + split[1]
+ }
+
+ loadResourcesProperties(execution)
+ String resourceControllerType= execution.getVariable("resourceControllerType")
+ if (isBlank(resourceControllerType)) {
+ resourceControllerType = resourceControllerTypeDef;
+ }
+ utils.log("INFO", "resourceControllerType: " + resourceControllerType, isDebugEnabled)
+
+ List<String> ResourceTypeList = jsonUtil.StringArrayToList(execution, resourceControllerType)
+ utils.log("INFO", "ResourceTypeList : " + ResourceTypeList, isDebugEnabled)
+ execution.setVariable("controllerType", "Other")
+ execution.setVariable(Prefix+"resourceType", "")
+ for (String resourceMap : ResourceTypeList) {
+ String resourceType = jsonUtil.getJsonValue(resourceMap, "resourceType")
+ String controllerType = jsonUtil.getJsonValue(resourceMap, "controllerType")
+ //utils.log("INFO", "resourceMap.resourceType : " + resourceType, isDebugEnabled)
+ //utils.log("INFO", "resourceMap.controllerType : " + controllerType, isDebugEnabled)
+ //utils.log("INFO", "resourceName : " + resourceName, isDebugEnabled)
+ //utils.log("INFO", "allottedResourceType : " + allottedResourceType, isDebugEnabled )
+
+ if (StringUtils.containsIgnoreCase(allottedResourceType, resourceType)) {
+ execution.setVariable("controllerType", controllerType)
+ execution.setVariable(Prefix+"resourceType", resourceType)
+ utils.log("INFO", "found controller type : " + controllerType, isDebugEnabled)
+ break
+ }
+ }
+ utils.log("INFO", "controller Type : " + execution.getVariable("controllerType"), isDebugEnabled)
+ utils.log("INFO", "resource Type : " + execution.getVariable(Prefix+"resourceType"), isDebugEnabled)
+
+ if (execution.getVariable("controllerType") == "") {
+ String exceptionMessage = "Resource name can not find controller type,please check the resource Name: "+ resourceName
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ if (execution.getVariable(Prefix+"resourceType") == "vCPE") {
+ execution.setVariable("skipVFC", "false")
+ utils.log("INFO", "vCPE will deploy ", isDebugEnabled)
+ }
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * prepare post Unkown Resource Type
+ */
+ public void postOtherControllerType(Execution execution){
+ def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postOtherControllerType Process ======== ", isDebugEnabled)
+ try{
+
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ String resourceType = execution.getVariable(Prefix+"resourceType")
+ String controllerType = execution.getVariable("controllerType")
+
+ String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
+ utils.log("DEBUG", msg, isDebugEnabled)
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * prepare Controller resource create request
+ */
+ public void preProcessResourceRequestForController(execution){
+ def method = getClass().getSimpleName() + '.preProcessResourceRequestForController(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 preProcessResourceRequestForController Process ======== ", isDebugEnabled)
+ try{
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ String resourceType = execution.getVariable(Prefix+"resourceType")
+ String serviceInstanceName =execution.getVariable("serviceInstanceName")
+ String nsServiceName = resourceType + "_" + serviceInstanceName
+ execution.setVariable("nsServiceName", nsServiceName)
+ utils.log("INFO", "Prepare Controller Request nsServiceName:" + nsServiceName, isDebugEnabled)
+
+ String serviceId = execution.getVariable("serviceInstanceId")
+ execution.setVariable("serviceId", serviceId)
+ utils.log("INFO", "Prepare Controller Request serviceId:" + serviceId, isDebugEnabled)
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ utils.log("INFO", "Prepare Controller Request globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
+
+ String incomingRequest = execution.getVariable("uuiRequest")
+ String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
+ execution.setVariable("nsServiceDescription", nsServiceDescription)
+ utils.log("INFO", "Prepare Controller Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+
+ String resourceUUID = execution.getVariable("resourceUUID")
+
+ utils.log("INFO", "Prepare Controller Request resourceUUID:" + resourceUUID, isDebugEnabled)
+
+ String resourceInvariantUUID = execution.getVariable("resourceInvariantUUID")
+ utils.log("INFO", "Prepare Controller Request resourceInvariantUUID:" + resourceInvariantUUID, isDebugEnabled)
+
+ String resourceParameters = execution.getVariable("resourceParameters")
+ execution.setVariable("resourceParameters", resourceParameters)
+ utils.log("INFO", "Prepare Controller Request resourceParameters:" + resourceParameters, isDebugEnabled)
+
+
+
+ }catch(Exception e){
+ String exceptionMessage = "Bpmn error encountered in "+ method + " - " + e.getMessage()
+ utils.log("ERROR", exceptionMessage, isDebugEnabled)
+ execution.setVariable(Prefix+"ErrorResponse", exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * post process VFC resource create request
+ */
+ public void postProcessResourceRequestForVFC(execution){
+ def method = getClass().getSimpleName() + '.postProcessResourceRequestForVFC(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForVFC Process ======== ", isDebugEnabled)
+ try{
+
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForVFC. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForVFC Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+
+ /**
+ * post process SDNC resource create request
+ */
+ public void postProcessResourceRequestForSDNC(execution){
+ def method = getClass().getSimpleName() + '.postProcessResourceRequestForSDNC(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== Enter DoCreateE2EServiceInstanceV2 postProcessResourceRequestForSDNC Process ======== ", isDebugEnabled)
+ try{
+
+ execution.setVariable("serviceSDNCCreate", "true")
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing postProcessResourceRequestForSDNC. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable(Prefix+"ErrorResponse", "Error Occurred during postProcessResourceRequestForSDNC Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+
+
+}
+
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy new file mode 100644 index 0000000000..7de0ed0b02 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy @@ -0,0 +1,1187 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.json.JSONArray;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+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.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+
+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.runtime.Execution
+import org.json.JSONObject;
+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
+
+import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def;
+
+/**
+ * This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - globalSubscriberId - O
+ * @param - subscriptionServiceType - O
+ * @param - serviceInstanceId
+ * @param - serviceInstanceName - O
+ * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM)
+ * @param - sdncVersion
+ * @param - failNotFound - TODO
+ * @param - serviceInputParams - TODO
+ *
+ * Outputs:
+ * @param - WorkflowException
+ *
+ * Rollback - Deferred
+ */
+public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProcessor {
+
+ String Prefix="DDELSI_"
+ private static final String DebugFlag = "isDebugEnabled"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void preProcessRequest (Execution execution) {
+
+ def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
+ String msg = ""
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("prefix",Prefix)
+
+ //Inputs
+ //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology
+ String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+ if (globalSubscriberId == null)
+ {
+ execution.setVariable("globalSubscriberId", "")
+ }
+
+ //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology
+ String serviceType = execution.getVariable("serviceType")
+ if (serviceType == null)
+ {
+ execution.setVariable("serviceType", "")
+ }
+
+ //Generated in parent for AAI PUT
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)){
+ msg = "Input serviceInstanceId is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ if (isBlank(sdncCallbackUrl)) {
+ msg = "URN_mso_workflow_sdncadapter_callback is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
+ utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
+
+ StringBuilder sbParams = new StringBuilder()
+ Map<String, String> paramsMap = execution.getVariable("serviceInputParams")
+ if (paramsMap != null)
+ {
+ sbParams.append("<service-input-parameters>")
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """ <param>
+ <name>${paramName}</name>
+ <value>${paramValue}</value>
+ </param>
+ """
+ sbParams.append(paramsXml)
+ }
+ sbParams.append("</service-input-parameters>")
+ }
+ String siParamsXml = sbParams.toString()
+ if (siParamsXml == null)
+ siParamsXml = ""
+ execution.setVariable("siParamsXml", siParamsXml)
+ execution.setVariable("operationStatus", "Waiting delete resource...")
+ execution.setVariable("progress", "0")
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+
+
+ public void postProcessAAIGET(Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ String msg = ""
+
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ utils.log("INFO","serviceInstanceId: "+serviceInstanceId, isDebugEnabled)
+
+ boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
+ utils.log("INFO","foundInAAI: "+foundInAAI, isDebugEnabled)
+
+ String serviceType = ""
+
+
+ if(foundInAAI == true){
+ 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 to delete id:" + serviceInstanceId
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ }else{
+ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
+ if(succInAAI != true){
+ 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 = "Bpmn error encountered in " + method + "--" + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ private void loadResourcesProperties(Execution execution) {
+ def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String loadFilePath = "/etc/mso/config.d/reources.json"
+ try{
+ def jsonPayload = new File(loadFilePath).text
+ utils.log("INFO","jsonPayload: " + jsonPayload, isDebugEnabled)
+
+ String resourcesProperties = jsonUtil.prettyJson(jsonPayload.toString())
+ utils.log("INFO","resourcesProperties: " + resourcesProperties, isDebugEnabled)
+
+ String createResourceSort = jsonUtil.getJsonValue(resourcesProperties, "CreateResourceSort")
+ //utils.log("INFO","createResourceSort: " + createResourceSort, isDebugEnabled)
+ execution.setVariable("createResourceSort", createResourceSort)
+
+ String deleteResourceSort = jsonUtil.getJsonValue(resourcesProperties, "DeleteResourceSort")
+ //utils.log("INFO","deleteResourceSort: " + deleteResourceSort, isDebugEnabled)
+ execution.setVariable("deleteResourceSort", deleteResourceSort)
+
+
+ String resourceControllerType = jsonUtil.getJsonValue(resourcesProperties, "ResourceControllerType")
+ //utils.log("INFO","resourceControllerType: " + resourceControllerType, isDebugEnabled)
+ execution.setVariable("resourceControllerType", resourceControllerType)
+
+
+ }catch(Exception ex){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ private void sortDeleteResource(Execution execution) {
+ def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String deleteResourceSortDef = """[
+ {
+ "resourceType":"GRE_SAR"
+ },
+ {
+ "resourceType":"VPN_SAR"
+ },
+ {
+ "resourceType":"APN_AAR"
+ },
+ {
+ "resourceType":"GRE_AAR"
+ },
+ {
+ "resourceType":"Overlay"
+ },
+ {
+ "resourceType":"Underlay"
+ },
+ {
+ "resourceType":"vIMS"
+ },
+ {
+ "resourceType":"vCPE"
+ },
+ {
+ "resourceType":"vFW"
+ },
+ {
+ "resourceType":"vEPC"
+ }
+
+
+ ]""".trim()
+
+ try{
+ loadResourcesProperties(execution)
+ String deleteResourceSort = execution.getVariable("deleteResourceSort")
+ if (isBlank(deleteResourceSort)) {
+ deleteResourceSort = deleteResourceSortDef;
+ }
+
+ List<String> sortResourceList = jsonUtil.StringArrayToList(execution, deleteResourceSort)
+ utils.log("INFO", "sortResourceList : " + sortResourceList, isDebugEnabled)
+
+ JSONArray newResourceList = new JSONArray()
+ int resSortCount = sortResourceList.size()
+
+ for ( int currentResource = 0 ; currentResource < resSortCount ; currentResource++ ) {
+ String currentSortResource = sortResourceList[currentResource]
+ String sortResourceType = jsonUtil.getJsonValue(currentSortResource, "resourceType")
+ List<String> resourceList = execution.getVariable(Prefix+"resourceList")
+
+ for (String resource : resourceList) {
+ //utils.log("INFO", "resource : " + resource, isDebugEnabled)
+ String resourceType = jsonUtil.getJsonValue(resource, "resourceType")
+
+ if (StringUtils.containsIgnoreCase(resourceType, sortResourceType)) {
+ JSONObject jsonObj = new JSONObject(resource)
+ newResourceList.put(jsonObj)
+ }
+ utils.log("INFO", "Get next sort type " , isDebugEnabled)
+ }
+ }
+
+ String newResourceStr = newResourceList.toString()
+ List<String> newResourceListStr = jsonUtil.StringArrayToList(execution, newResourceStr)
+
+ execution.setVariable(Prefix+"resourceList", newResourceListStr)
+ utils.log("INFO", "newResourceList : " + newResourceListStr, isDebugEnabled)
+
+ }catch(Exception ex){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in " + method + " - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+
+ }
+ public void prepareServiceDeleteResource(Execution execution) {
+ def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ try {
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ // confirm if ServiceInstance was found
+ if ( !execution.getVariable("GENGS_FoundIndicator") )
+ {
+ String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. Service Instance was not found in AAI by id: " + serviceInstanceId
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+
+ execution.setVariable(Prefix+"resourceList", "")
+ execution.setVariable(Prefix+"resourceCount", 0)
+ execution.setVariable(Prefix+"nextResource", 0)
+ execution.setVariable(Prefix+"resourceFinish", true)
+
+ // get SI extracted by GenericGetService
+ String serviceInstanceAaiRecord = execution.getVariable("GENGS_service");
+ utils.log("INFO", "serviceInstanceAaiRecord: " +serviceInstanceAaiRecord, isDebugEnabled)
+
+ String aaiJsonRecord = jsonUtil.xml2json(serviceInstanceAaiRecord)
+
+ //utils.log("INFO", "aaiJsonRecord: " +aaiJsonRecord, isDebugEnabled)
+ def serviceInstanceName = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-instance-name")
+ execution.setVariable("serviceInstanceName",serviceInstanceName)
+
+ def serviceType = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.service-type")
+ execution.setVariable("serviceType",serviceType)
+
+
+ String relationshipList = jsonUtil.getJsonValue(aaiJsonRecord, "service-instance.relationship-list")
+ //utils.log("INFO", "relationship-list:" + relationshipList, isDebugEnabled)
+ if (! isBlank(relationshipList)){
+ utils.log("INFO", "relationship-list exists" , isDebugEnabled)
+ String relationShip = jsonUtil.getJsonValue(relationshipList, "relationship")
+ utils.log("INFO", "relationship: " + relationShip, isDebugEnabled)
+ JSONArray allResources = new JSONArray()
+ JSONArray serviceResources = new JSONArray()
+ JSONArray networkResources = new JSONArray()
+ JSONArray allottedResources = new JSONArray()
+
+
+ if (! isBlank(relationShip)){
+ JSONArray jsonArray = new JSONArray();
+ if (relationShip.startsWith("{") && relationShip.endsWith("}")) {
+ JSONObject jsonObject = new JSONObject(relationShip);
+ jsonArray.put(jsonObject);
+ } else if (relationShip.startsWith("[") && relationShip.endsWith("]")) {
+ jsonArray = new JSONArray(relationShip);
+ } else {
+ utils.log("INFO", "The relationShip fomart is error" , isDebugEnabled)
+ }
+
+ List<String> relationList = jsonUtil.StringArrayToList(execution, jsonArray.toString())
+
+ utils.log("INFO", "relationList: " + relationList, isDebugEnabled)
+
+ int relationNum =relationList.size()
+ utils.log("INFO", "**************relationList size: " + relationNum, isDebugEnabled)
+
+ for ( int currentRelation = 0 ; currentRelation < relationNum ; currentRelation++ ) {
+ utils.log("INFO", "current Relation num: " + currentRelation, isDebugEnabled)
+ String relation = relationList[currentRelation]
+ utils.log("INFO", "relation: " + relation, isDebugEnabled)
+
+ String relatedTo = jsonUtil.getJsonValue(relation, "related-to")
+ utils.log("INFO", "relatedTo: " + relatedTo, isDebugEnabled)
+
+ String relatedLink = jsonUtil.getJsonValue(relation, "related-link")
+ utils.log("INFO", "relatedLink: " + relatedLink, isDebugEnabled)
+
+ if (StringUtils.equalsIgnoreCase(relatedTo, "allotted-resource")) {
+ utils.log("INFO", "allotted-resource exists ", isDebugEnabled)
+
+ String aaiArRsp = getAaiAr(execution, relatedLink)
+ utils.log("INFO", "aaiArRsp: " + aaiArRsp, isDebugEnabled)
+ if (! isBlank(aaiArRsp)) {
+ def type = utils.getNodeText1(aaiArRsp, "type")
+ def id = utils.getNodeText1(aaiArRsp, "id")
+ def role = utils.getNodeText1(aaiArRsp, "role")
+ def resourceVersion = utils.getNodeText1(aaiArRsp, "resource-version")
+
+ JSONObject jObject = new JSONObject()
+ jObject.put("resourceType", type)
+ jObject.put("resourceInstanceId", id)
+ jObject.put("resourceRole", role)
+ jObject.put("resourceVersion", resourceVersion)
+
+ allResources.put(jObject)
+ utils.log("INFO", "allResources: " + allResources, isDebugEnabled)
+ allottedResources.put(jObject)
+ utils.log("INFO", "allottedResources: " + allottedResources, isDebugEnabled)
+ }
+ }
+ else if (StringUtils.equalsIgnoreCase(relatedTo, "service-instance")){
+ utils.log("INFO", "service-instance exists ", isDebugEnabled)
+ JSONObject jObject = new JSONObject()
+
+ //relationship-data
+ String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data")
+ utils.log("INFO", "rsDataStr: " + rsDataStr, isDebugEnabled)
+ List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
+ utils.log("INFO", "rsDataList: " + rsDataList, isDebugEnabled)
+ for(String rsData : rsDataList){
+ utils.log("INFO", "rsData: " + rsData, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rsData, "relationship-key")
+ def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
+ if(eKey.equals("service-instance.service-instance-id")){
+ jObject.put("resourceInstanceId", eValue)
+ }
+ if(eKey.equals("service-subscription.service-type")){
+ jObject.put("resourceType", eValue)
+ }
+ }
+
+ //related-to-property
+ String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property")
+ utils.log("INFO", "related-to-property: " + rPropertyStr, isDebugEnabled)
+ if (rPropertyStr instanceof JSONArray){
+ List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
+ for (String rProperty : rPropertyList) {
+ utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
+ def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
+ if(eKey.equals("service-instance.service-instance-name")){
+ jObject.put("resourceName", eValue)
+ }
+ }
+ }
+ else {
+ String rProperty = rPropertyStr
+ utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
+ def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
+ if (eKey.equals("service-instance.service-instance-name")) {
+ jObject.put("resourceName", eValue)
+ }
+ }
+
+ allResources.put(jObject)
+ utils.log("INFO", "allResources: " + allResources, isDebugEnabled)
+
+ serviceResources.put(jObject)
+ utils.log("INFO", "serviceResources: " + serviceResources, isDebugEnabled)
+ }
+ else if (StringUtils.equalsIgnoreCase(relatedTo, "configuration")) {
+ utils.log("INFO", "configuration ", isDebugEnabled)
+ JSONObject jObject = new JSONObject()
+
+ //relationship-data
+ String rsDataStr = jsonUtil.getJsonValue(relation, "relationship-data")
+ utils.log("INFO", "rsDataStr: " + rsDataStr, isDebugEnabled)
+ List<String> rsDataList = jsonUtil.StringArrayToList(execution, rsDataStr)
+ utils.log("INFO", "rsDataList: " + rsDataList, isDebugEnabled)
+ for (String rsData : rsDataList) {
+ utils.log("INFO", "rsData: " + rsData, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rsData, "relationship-key")
+ def eValue = jsonUtil.getJsonValue(rsData, "relationship-value")
+ if(eKey.equals("configuration.configuration-id")){
+ jObject.put("resourceInstanceId", eValue)
+ }
+ }
+
+
+ //related-to-property
+ String rPropertyStr = jsonUtil.getJsonValue(relation, "related-to-property")
+ utils.log("INFO", "related-to-property: " + rPropertyStr, isDebugEnabled)
+ if (rPropertyStr instanceof JSONArray){
+ List<String> rPropertyList = jsonUtil.StringArrayToList(execution, rPropertyStr)
+ for(String rProperty : rPropertyList){
+ utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
+ def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
+ if(eKey.equals("configuration.configuration-type")){
+ jObject.put("resourceType", eValue)
+ }
+ }
+ }
+ else {
+ String rProperty = rPropertyStr
+ utils.log("INFO", "rProperty: " + rProperty, isDebugEnabled)
+ def eKey = jsonUtil.getJsonValue(rProperty, "property-key")
+ def eValue = jsonUtil.getJsonValue(rProperty, "property-value")
+ if(eKey.equals("configuration.configuration-type")){
+ jObject.put("resourceType", eValue)
+ }
+ }
+ allResources.put(jObject)
+ utils.log("INFO", "allResources: " + allResources, isDebugEnabled)
+
+ networkResources.put(jObject)
+ utils.log("INFO", "networkResources: " + networkResources, isDebugEnabled)
+ }
+ utils.log("INFO", "Get Next releation resource " , isDebugEnabled)
+
+ }
+ utils.log("INFO", "Get releation finished. " , isDebugEnabled)
+ }
+
+ execution.setVariable("serviceRelationShip", allResources.toString())
+ utils.log("INFO", "allResources: " + allResources.toString(), isDebugEnabled)
+ String serviceRelationShip = execution.getVariable("serviceRelationShip")
+ utils.log("INFO", "serviceRelationShip: " + serviceRelationShip, isDebugEnabled)
+ if ((! isBlank(serviceRelationShip)) && (! serviceRelationShip.isEmpty())) {
+
+ List<String> relationShipList = jsonUtil.StringArrayToList(execution, serviceRelationShip)
+ utils.log("INFO", "relationShipList: " + relationShipList, isDebugEnabled)
+ execution.setVariable(Prefix+"resourceList", relationShipList)
+
+ int resourceCount = relationShipList.size()
+ utils.log("INFO", "resourceCount: " + resourceCount, isDebugEnabled)
+ execution.setVariable(Prefix+"resourceCount",resourceCount )
+
+ int resourceNum = 0
+ execution.setVariable(Prefix+"nextResource", resourceNum)
+ utils.log("INFO", "start sort delete resource: ", isDebugEnabled)
+ sortDeleteResource(execution)
+
+
+ if (resourceNum < resourceCount) {
+ execution.setVariable(Prefix+"resourceFinish", false)
+ }
+ else {
+ execution.setVariable(Prefix+"resourceFinish", true)
+ }
+ utils.log("INFO", "Resource list set end : " + resourceCount, isDebugEnabled)
+ }
+
+ execution.setVariable("serviceResources", serviceResources.toString())
+ utils.log("INFO", "serviceResources: " + serviceResources, isDebugEnabled)
+ String serviceResourcesShip = execution.getVariable("serviceResources")
+ utils.log("INFO", "serviceResourcesShip: " + serviceResourcesShip, isDebugEnabled)
+
+ if ((! isBlank(serviceResourcesShip)) && (! serviceResourcesShip.isEmpty())) {
+ List<String> serviceResourcesList = jsonUtil.StringArrayToList(execution, serviceResourcesShip)
+ utils.log("INFO", "serviceResourcesList: " + serviceResourcesList, isDebugEnabled)
+ execution.setVariable(Prefix+"serviceResourceList", serviceResourcesList)
+ execution.setVariable(Prefix+"serviceResourceCount", serviceResourcesList.size())
+ execution.setVariable(Prefix+"nextServiceResource", 0)
+ utils.log("INFO", "Service Resource list set end : " + serviceResourcesList.size(), isDebugEnabled)
+
+ }
+
+ execution.setVariable("allottedResources", allottedResources.toString())
+ utils.log("INFO", "allottedResources: " + allottedResources, isDebugEnabled)
+ String allottedResourcesShip = execution.getVariable("allottedResources")
+ utils.log("INFO", "allottedResourcesShip: " + allottedResourcesShip, isDebugEnabled)
+ if ((! isBlank(allottedResourcesShip)) && (! allottedResourcesShip.isEmpty())) {
+ List<String> allottedResourcesList = jsonUtil.StringArrayToList(execution, allottedResourcesShip)
+ utils.log("INFO", "allottedResourcesList: " + allottedResourcesList, isDebugEnabled)
+ execution.setVariable(Prefix+"allottedResourcesList", allottedResourcesList)
+ execution.setVariable(Prefix+"allottedResourcesListCount", allottedResourcesList.size())
+ execution.setVariable(Prefix+"nextAllottedResourcesList", 0)
+ utils.log("INFO", "Allotted Resource list set end : " + allottedResourcesList.size(), isDebugEnabled)
+
+ }
+ execution.setVariable("networkResources", networkResources.toString())
+ utils.log("INFO", "networkResources: " + networkResources, isDebugEnabled)
+ String networkResourcesShip = execution.getVariable("networkResources")
+ utils.log("INFO", "networkResourcesShip: " + networkResourcesShip, isDebugEnabled)
+ if ((! isBlank(networkResourcesShip)) && (! networkResourcesShip.isEmpty())) {
+ List<String> networkResourcesList = jsonUtil.StringArrayToList(execution, networkResourcesShip)
+ utils.log("INFO", "networkResourcesList: " + networkResourcesList, isDebugEnabled)
+ execution.setVariable(Prefix+"networkResourcesList", networkResourcesList)
+ execution.setVariable(Prefix+"networkResourcesListCount", networkResourcesList.size())
+ execution.setVariable(Prefix+"nextNetworkResourcesList", 0)
+ utils.log("INFO", "Network Resource list set end : " + networkResourcesList.size(), isDebugEnabled)
+
+ }
+ }
+ } catch (BpmnError e){
+ throw e;
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in DeleteMobileAPNCustService flow. prepareServiceDeleteResource() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ private String getAaiAr(Execution execution, String relink) {
+ def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ AaiUtil aaiUtil = new AaiUtil(this)
+ String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink
+
+ utils.log("DEBUG", "get AR info " + aaiEndpoint, isDebugEnabled)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, aaiEndpoint)
+
+ int responseCode = response.getStatusCode()
+ utils.log("DEBUG", "get AR info responseCode:" + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ utils.log("DEBUG", "get AR info " + aaiResponse, isDebugEnabled)
+
+ if(responseCode < 200 || responseCode >= 300 || isBlank(aaiResponse)) {
+ return null
+ }
+
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ return aaiResponse
+ }
+ /**
+ * prepare Decompose next resource to create request
+ */
+ public void preProcessDecomposeNextResource(Execution execution){
+ def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== STARTED preProcessDecomposeNextResource Process ======== ", isDebugEnabled)
+ try{
+ int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
+ List<String> serviceResourceList = execution.getVariable(Prefix+"serviceResourceList")
+ utils.log("INFO", "Service Resource List : " + serviceResourceList, isDebugEnabled)
+
+ String serviceResource = serviceResourceList[resourceNum]
+ execution.setVariable(Prefix+"serviceResource", serviceResource)
+ utils.log("INFO", "Current Service Resource : " + serviceResource, isDebugEnabled)
+
+ String resourceType = jsonUtil.getJsonValue(serviceResource, "resourceType")
+ execution.setVariable("resourceType", resourceType)
+ utils.log("INFO", "resourceType : " + resourceType, isDebugEnabled)
+
+ String resourceInstanceId = jsonUtil.getJsonValue(serviceResource, "resourceInstanceId")
+ execution.setVariable("resourceInstanceId", resourceInstanceId)
+ utils.log("INFO", "resourceInstanceId : " + resourceInstanceId, isDebugEnabled)
+
+ String resourceRole = jsonUtil.getJsonValue(serviceResource, "resourceRole")
+ execution.setVariable("resourceRole", resourceRole)
+ utils.log("INFO", "resourceRole : " + resourceRole, isDebugEnabled)
+
+ String resourceVersion = jsonUtil.getJsonValue(serviceResource, "resourceVersion")
+ execution.setVariable("resourceVersion", resourceVersion)
+ utils.log("INFO", "resourceVersion : " + resourceVersion, isDebugEnabled)
+
+ String resourceName = jsonUtil.getJsonValue(serviceResource, "resourceName")
+ if (isBlank(resourceName)){
+ resourceName = resourceInstanceId
+ }
+ execution.setVariable(Prefix+"resourceName", resourceName)
+ utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
+
+
+ execution.setVariable(Prefix+"nextServiceResource", resourceNum + 1)
+
+ int serviceResourceCount = execution.getVariable(Prefix+"serviceResourceCount")
+ if (serviceResourceCount >0 ){
+ int progress = (resourceNum*100) / serviceResourceCount
+ execution.setVariable("progress", progress.toString() )
+ }
+ execution.setVariable("operationStatus", resourceName )
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method preProcessDecomposeNextResource() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * post Decompose next resource to create request
+ */
+ public void postProcessDecomposeNextResource(Execution execution){
+ def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO", " ======== STARTED postProcessDecomposeNextResource Process ======== ", isDebugEnabled)
+ try{
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ int resourceNum = execution.getVariable(Prefix+"nextServiceResource")
+ utils.log("DEBUG", "Current Resource count:"+ execution.getVariable(Prefix+"nextServiceResource"), isDebugEnabled)
+
+ int resourceCount = execution.getVariable(Prefix+"serviceResourceCount")
+ utils.log("DEBUG", "Total Resource count:"+ execution.getVariable(Prefix+"serviceResourceCount"), isDebugEnabled)
+
+ if (resourceNum < resourceCount) {
+ execution.setVariable(Prefix+"resourceFinish", false)
+ }
+ else {
+ execution.setVariable(Prefix+"resourceFinish", true)
+ }
+
+ utils.log("DEBUG", "Resource Finished:"+ execution.getVariable(Prefix+"resourceFinish"), isDebugEnabled)
+
+ if (resourceCount >0 ){
+ int progress = (resourceNum*100) / resourceCount
+
+ execution.setVariable("progress", progress.toString() )
+ utils.log("DEBUG", "progress :"+ execution.getVariable("progress"), isDebugEnabled)
+ }
+ execution.setVariable("operationStatus", resourceName )
+
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateMobileAPNCustService flow. Unexpected Error from method postProcessDecomposeNextResource() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * prepare post Unkown Resource Type
+ */
+ public void postOtherControllerType(Execution execution){
+ def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ try{
+
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ String resourceType = execution.getVariable(Prefix+"resourceType")
+ String controllerType = execution.getVariable("controllerType")
+
+ String msg = "Resource name: "+ resourceName + " resource Type: " + resourceType+ " controller Type: " + controllerType + " can not be processed n the workflow"
+ utils.log("DEBUG", msg, isDebugEnabled)
+
+ }catch(Exception e){
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in DoCreateMobileAPNServiceInstance flow. Unexpected Error from method postOtherControllerType() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ /**
+ * prepare delete parameters
+ */
+ public void preSDNCResourceDelete(execution, resourceName){
+ // we use resource instance ids for delete flow as resourceTemplateUUIDs
+
+ def method = getClass().getSimpleName() + '.preSDNCResourceDelete(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== STARTED preSDNCResourceDelete Process ======== ", isDebugEnabled)
+ String networkResources = execution.getVariable("networkResources")
+
+
+ execution.setVariable("foundResource", false)
+ if (networkResources != null) {
+ def jsonSlurper = new JsonSlurper()
+ List relationShipList = jsonSlurper.parseText(networkResources)
+ relationShipList.each {
+ if(StringUtils.containsIgnoreCase(it.resourceType, resourceName)) {
+ String resourceInstanceUUID = it.resourceInstanceId
+ String resourceTemplateUUID = it.resourceInstanceId
+ execution.setVariable("resourceTemplateId", resourceTemplateUUID)
+ execution.setVariable("resourceInstanceId", resourceInstanceUUID)
+ execution.setVariable("resourceType", resourceName)
+ execution.setVariable("foundResource", true)
+ utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
+ }
+ }
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ public void preProcessSDNCDelete (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled)
+ String msg = ""
+
+ try {
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+ def serviceInstanceName = execution.getVariable("serviceInstanceName")
+ def callbackURL = execution.getVariable("sdncCallbackUrl")
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceId = execution.getVariable("productFamilyId")
+ def subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+
+ String serviceModelInfo = execution.getVariable("serviceModelInfo")
+ def modelInvariantUuid = ""
+ def modelVersion = ""
+ def modelUuid = ""
+ def modelName = ""
+ if (!isBlank(serviceModelInfo))
+ {
+ modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
+ modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
+ modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
+ modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
+
+ if (modelInvariantUuid == null) {
+ modelInvariantUuid = ""
+ }
+ if (modelVersion == null) {
+ modelVersion = ""
+ }
+ if (modelUuid == null) {
+ modelUuid = ""
+ }
+ if (modelName == null) {
+ modelName = ""
+ }
+ }
+ if (serviceInstanceName == null) {
+ serviceInstanceName = ""
+ }
+ if (serviceId == null) {
+ serviceId = ""
+ }
+
+ def siParamsXml = execution.getVariable("siParamsXml")
+ def serviceType = execution.getVariable("serviceType")
+ if (serviceType == null)
+ {
+ serviceType = ""
+ }
+
+ def sdncRequestId = UUID.randomUUID().toString()
+
+ String sdncDelete =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
+ xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${requestId}</request-id>
+ <source>MSO</source>
+ <notification-url/>
+ <order-number/>
+ <order-version/>
+ <request-action>DeleteServiceInstance</request-action>
+ </request-information>
+ <service-information>
+ <service-id>${serviceId}</service-id>
+ <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
+ <model-uuid>${modelUuid}</model-uuid>
+ <model-version>${modelVersion}</model-version>
+ <model-name>${modelName}</model-name>
+ </onap-model-information>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <subscriber-name/>
+ <global-customer-id>${globalSubscriberId}</global-customer-id>
+ </service-information>
+ <service-request-input>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ ${siParamsXml}
+ </service-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
+
+ sdncDelete = utils.formatXml(sdncDelete)
+ def sdncRequestId2 = UUID.randomUUID().toString()
+ String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
+ execution.setVariable("sdncDelete", sdncDelete)
+ execution.setVariable("sdncDeactivate", sdncDeactivate)
+ utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
+ utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch(Exception ex) {
+ msg = "Exception in preProcessSDNCDelete. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage())
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessSDNCDelete(Execution execution, String response, String action) {
+
+ def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** postProcessSDNC " + action + " *****", isDebugEnabled)
+ String msg = ""
+
+ /*try {
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+ utils.log("INFO", "SDNCResponse: " + response, isDebugEnabled)
+ utils.log("INFO", "workflowException: " + workflowException, isDebugEnabled)
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == "true"){
+ utils.log("INFO","Good response from SDNC Adapter for service-instance " + action + "response:\n" + response, isDebugEnabled)
+
+ }else{
+ msg = "Bad Response from SDNC Adapter for service-instance " + action
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg)
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch(Exception ex) {
+ msg = "Exception in postProcessSDNC " + action + " Exception:" + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }*/
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessAAIDEL(Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessAAIDEL(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
+ if(succInAAI != true){
+ msg = "Error deleting Service-instance in AAI" + serviceInstanceId
+ utils.log("INFO", msg, isDebugEnabled)
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ utils.logAudit("workflowException: " + workflowException)
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }
+ else
+ {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIDEL. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+ /**
+ * Init the service Operation Status
+ */
+ public void preUpdateServiceOperationStatus(Execution execution){
+ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String serviceName = execution.getVariable("serviceInstanceName")
+ String operationType = "DELETE"
+ String userId = ""
+ String result = "processing"
+ String progress = execution.getVariable("progress")
+ utils.log("INFO", "progress: " + progress , isDebugEnabled)
+ if ("100".equalsIgnoreCase(progress))
+ {
+ result = "finished"
+ }
+ String reason = ""
+ String operationContent = "Prepare service delete: " + execution.getVariable("operationStatus")
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <serviceName>${serviceName}</serviceName>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing preUpdateServiceOperationStatus: \n" + payload, isDebugEnabled)
+
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing preUpdateServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preUpdateServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "======== COMPLETED preUpdateServiceOperationStatus Process ======== ", isDebugEnabled)
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void preInitResourcesOperStatus(Execution execution){
+ def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ String msg=""
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = "DELETE"
+ String resourceTemplateUUIDs = ""
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service delete"
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ String serviceRelationShip = execution.getVariable("serviceRelationShip")
+ utils.log("INFO", "serviceRelationShip: " + serviceRelationShip, isDebugEnabled)
+ if (! isBlank(serviceRelationShip)) {
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+ List relationShipList = jsonSlurper.parseText(serviceRelationShip)
+
+ if (relationShipList != null) {
+ relationShipList.each {
+ resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
+ }
+ }
+ }
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("DoCustomDeleteE2EServiceInstanceV2 Outgoing initResourceOperationStatus Request: " + payload)
+
+ }catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoCustomDeleteE2EServiceInstanceV2.preInitResourcesOperStatus. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+
+
+ /**
+ * prepare delete parameters
+ */
+ public void preProcessVFCResourceDelete(execution){
+ // we use resource instance ids for delete flow as resourceTemplateUUIDs
+
+ def method = getClass().getSimpleName() + '.preProcessVFCResourceDelete(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== STARTED preProcessVFCResourceDelete Process ======== ", isDebugEnabled)
+ try{
+ String serviceResource = execution.getVariable("serviceResource")
+ utils.log("INFO", "serviceResource : " + serviceResource, isDebugEnabled)
+
+ String resourceInstanceId = execution.getVariable("resourceInstanceId")
+ utils.log("INFO", "resourceInstanceId : " + resourceInstanceId, isDebugEnabled)
+
+ execution.setVariable("resourceTemplateId", resourceInstanceId)
+ utils.log("INFO", "resourceTemplateId : " + resourceInstanceId, isDebugEnabled)
+
+ String resourceType = execution.getVariable("resourceType")
+ utils.log("INFO", "resourceType : " + resourceType, isDebugEnabled)
+
+
+ String resourceName = execution.getVariable(Prefix+"resourceName")
+ if (isBlank(resourceName)){
+ resourceName = resourceInstanceId
+ }
+ execution.setVariable("resourceName", resourceName)
+ utils.log("INFO", "resource Name : " + resourceName, isDebugEnabled)
+
+ utils.log("INFO", "Delete Resource Info: resourceInstanceId :" + resourceInstanceId + " resourceTemplateId: " + resourceInstanceId + " resourceType: " + resourceType, isDebugEnabled)
+ }catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoDeleteE2EServiceInstance.preProcessVFCResourceDelete. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessVFCDelete(Execution execution, String response, String action) {
+ def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+
+ utils.log("INFO", " ======== STARTED postProcessVFCDelete Process ======== ", isDebugEnabled)
+ try{
+
+ }catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoDeleteE2EServiceInstance.postProcessVFCDelete. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+}
+
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn new file mode 100644 index 0000000000..90636f61fb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceV2.bpmn @@ -0,0 +1,1051 @@ +<?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.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="DoCreateE2EServiceInstanceV2" name="DoCreateE2EServiceInstanceV2" isExecutable="true"> + <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" /> + <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstanceV2() +dcsi.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="CustomE2EGetService" targetRef="ScriptTask_0i8cqdy_PostProcessAAIGET" /> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="CustomE2EGetService" /> + <bpmn2:callActivity id="CustomE2EGetService" name="Call Custom E2E Get Service" calledElement="CustomE2EGetService"> + <bpmn2:extensionElements> + <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" /> + <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> + <camunda:in sourceExpression="service-instance" target="GENGS_type" /> + <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> + <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="serviceType" target="GENGS_serviceType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:callActivity id="CustomE2EPutService" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> + <bpmn2:extensionElements> + <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> + <camunda:in source="serviceInstanceId" target="GENPS_serviceInstanceId" /> + <camunda:in source="serviceType" target="GENPS_serviceType" /> + <camunda:in sourceExpression="service-instance" target="GENPS_type" /> + <camunda:in source="serviceInstanceData" target="GENPS_payload" /> + <camunda:out source="GENPS_SuccessIndicator" target="GENPS_SuccessIndicator" /> + <camunda:in source="msoRequestId" target="GENPS_requesId" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0zmz5am</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_129ih1g</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_129ih1g" sourceRef="CustomE2EPutService" targetRef="ScriptTask_0q37vn9_PostProcessAAIPUT" /> + <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_0yljq9y"> + <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_117lkk3"> + <bpmn2:incoming>SequenceFlow_1xzgv5k</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:callActivity id="CallActivity_1srx6p6" name="Call DoCreateE2EServiceInstanceRollback" calledElement="DoCreateE2EServiceInstanceRollback"> + <bpmn2:extensionElements> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="rollbackData" target="rollbackData" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:out source="rollbackError" target="rollbackErrror" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1lqktwf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0eumzpf</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0eumzpf" sourceRef="CallActivity_1srx6p6" targetRef="ScriptTask_1p0vyip" /> + <bpmn2:sequenceFlow id="SequenceFlow_0tgrn11" sourceRef="StartEvent_0yljq9y" targetRef="ScriptTask_0ocetux" /> + <bpmn2:scriptTask id="ScriptTask_0ocetux" name="Pre Process Rollback" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstanceV2() +dcsi.preProcessRollback(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" /> + <bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0eumzpf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstanceV2() +dcsi.postProcessRollback(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="ScriptTask_0i8cqdy_PostProcessAAIGET" name="Post Process AAI GET" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10aubhh</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstanceV2() +dcsi.postProcessAAIGET(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_0q37vn9_PostProcessAAIPUT" name="Post Process AAI PUT" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_129ih1g</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_03fabby</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateE2EServiceInstanceV2() +ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_0kbbt94" /> + <bpmn2:sequenceFlow id="SequenceFlow_03fabby" sourceRef="ScriptTask_0q37vn9_PostProcessAAIPUT" targetRef="IntermediateThrowEvent_0cabwkq" /> + <bpmn2:scriptTask id="Task_1u82cbz" name="PreProcess Decompose Next Resouce" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_13l7ffp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0gorww6</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.preProcessDecomposeNextResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1761epe" default="SequenceFlow_14ef6wp"> + <bpmn2:incoming>SequenceFlow_1wf52w6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1t9tmp4</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_14ef6wp</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_163tmnq</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0gorww6" sourceRef="Task_1u82cbz" targetRef="ScriptTask_1oc0qjo" /> + <bpmn2:sequenceFlow id="SequenceFlow_1t9tmp4" name="VFC" sourceRef="ExclusiveGateway_1761epe" targetRef="Task_09laxun"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("controllerType") =="VFC"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="Task_09laxun" name="PreProcess Resource Request for VFC" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1t9tmp4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1t4cc7w</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.preProcessResourceRequestForController(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1t4cc7w" sourceRef="Task_09laxun" targetRef="ExclusiveGateway_1xkr802" /> + <bpmn2:callActivity id="Task_1wyyy33" name="Call DoCreateVFCNetworkServiceInstance" calledElement="DoCreateVFCNetworkServiceInstance"> + <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_1a1du22</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1p99k36</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1p99k36" sourceRef="Task_1wyyy33" targetRef="ExclusiveGateway_1iu2jb7" /> + <bpmn2:scriptTask id="Task_0ag30bf" name="PostProcess Resource Request for VFC" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0cyffv0</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_07q8ra0</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.postProcessResourceRequestForVFC(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_1op29ls" name="PostProcess Resource Request for SDNC" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_06byir6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ylmq2b</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.postProcessResourceRequestForSDNC(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_0g6otdg" name="PreProcess Resource Request for SDNC" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0vey6x4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0br9juy</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.preProcessResourceRequestForController(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0r4jkig"> + <bpmn2:incoming>SequenceFlow_0ylmq2b</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_07q8ra0</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0gxsqsa</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1yhd9dp</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0ylmq2b" sourceRef="ScriptTask_1op29ls" targetRef="ExclusiveGateway_0r4jkig" /> + <bpmn2:sequenceFlow id="SequenceFlow_07q8ra0" sourceRef="Task_0ag30bf" targetRef="ExclusiveGateway_0r4jkig" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1pwgsa8" name="Resource Finish?" default="SequenceFlow_13l7ffp"> + <bpmn2:incoming>SequenceFlow_1rhn48b</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1mbrbsc</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_13l7ffp</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1fq4qzy</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_13l7ffp" name="No" sourceRef="ExclusiveGateway_1pwgsa8" targetRef="Task_1u82cbz" /> + <bpmn2:scriptTask id="Task_0vtxtuq_QueryServiceResources" name="Query Service Resources" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1r1hl23</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1ct6u3o</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.getServiceResources(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:serviceTask id="ServiceTask_1t9ln4p" name="Call Sync SDNC service Create " camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> + <bpmn2:incoming>SequenceFlow_1vio1tn</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_07pkpa0</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:serviceTask id="CallActivity_0x5g3pa" name="Call DoCreateSDNCNetworkInstance" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncNetworkTopologyOperationTask"> + <bpmn2:incoming>SequenceFlow_0br9juy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_06byir6</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:scriptTask id="ScriptTask_04rn9mp" name="Post Config Service Instance Creation" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0cnuo36</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1lkpfe2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.postConfigRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1xkr802" name="skip VFC?" default="SequenceFlow_1a1du22"> + <bpmn2:incoming>SequenceFlow_1t4cc7w</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1a1du22</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_14jy44g</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_1a1du22" name="No" sourceRef="ExclusiveGateway_1xkr802" targetRef="Task_1wyyy33" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1iu2jb7"> + <bpmn2:incoming>SequenceFlow_1p99k36</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_14jy44g</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0cyffv0</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0cyffv0" sourceRef="ExclusiveGateway_1iu2jb7" targetRef="Task_0ag30bf" /> + <bpmn2:sequenceFlow id="SequenceFlow_14jy44g" name="yes" sourceRef="ExclusiveGateway_1xkr802" targetRef="ExclusiveGateway_1iu2jb7"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("skipVFC") == "true" }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_0br9juy" sourceRef="ScriptTask_0g6otdg" targetRef="CallActivity_0x5g3pa" /> + <bpmn2:sequenceFlow id="SequenceFlow_06byir6" sourceRef="CallActivity_0x5g3pa" targetRef="ScriptTask_1op29ls" /> + <bpmn2:sequenceFlow id="SequenceFlow_14ef6wp" name="Other" sourceRef="ExclusiveGateway_1761epe" targetRef="Task_0zhvu4r_llllll" /> + <bpmn2:scriptTask id="Task_0zhvu4r_llllll" name="PosOtherCotrollerType" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_14ef6wp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0gxsqsa</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.postOtherControllerType(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0gxsqsa" sourceRef="Task_0zhvu4r_llllll" targetRef="ExclusiveGateway_0r4jkig" /> + <bpmn2:sequenceFlow id="SequenceFlow_10aubhh" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="IntermediateThrowEvent_0aggdcl_GoToStartService" /> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0aggdcl_GoToStartService" name="GoTo StartService"> + <bpmn2:incoming>SequenceFlow_10aubhh</bpmn2:incoming> + <bpmn2:linkEventDefinition name="StartService" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:intermediateCatchEvent id="StartEvent_0l5bz4h_StartService" name="StartService"> + <bpmn2:outgoing>SequenceFlow_0zmz5am</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="StartService" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0zmz5am" sourceRef="StartEvent_0l5bz4h_StartService" targetRef="CustomE2EPutService" /> + <bpmn2:sequenceFlow id="SequenceFlow_1rhn48b" sourceRef="StartEvent_StartResource" targetRef="ExclusiveGateway_1pwgsa8" /> + <bpmn2:intermediateCatchEvent id="StartEvent_StartResource" name="StartResource"> + <bpmn2:outgoing>SequenceFlow_1rhn48b</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="StartResource" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1ct6u3o" sourceRef="Task_0vtxtuq_QueryServiceResources" targetRef="IntermediateThrowEvent_1dwg5lz" /> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1dwg5lz" name="GoTo StartResource"> + <bpmn2:incoming>SequenceFlow_1ct6u3o</bpmn2:incoming> + <bpmn2:linkEventDefinition name="StartResource" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1rebkae" sourceRef="StartEvent_0jhv664" targetRef="ScriptTask_1wk7zcu" /> + <bpmn2:intermediateCatchEvent id="StartEvent_0jhv664" name="FinishProcess"> + <bpmn2:outgoing>SequenceFlow_1rebkae</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="FinishProcess" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:endEvent id="EndEvent_0x8im5g"> + <bpmn2:incoming>SequenceFlow_1lkpfe2</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1lkpfe2" sourceRef="ScriptTask_04rn9mp" targetRef="EndEvent_0x8im5g" /> + <bpmn2:sequenceFlow id="SequenceFlow_1fq4qzy" name="Yes" sourceRef="ExclusiveGateway_1pwgsa8" targetRef="IntermediateThrowEvent_GoToFinishProcess"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCRESI_resourceFinish") == true }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_GoToFinishProcess" name="GoTo FinishProcess"> + <bpmn2:incoming>SequenceFlow_1fq4qzy</bpmn2:incoming> + <bpmn2:linkEventDefinition name="FinishProcess" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:scriptTask id="ScriptTask_1aszwcv_CheckResourceType" name="Check Resouce Type" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_10jgs3j</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1wf52w6</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.checkResourceType(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1wf52w6" sourceRef="ScriptTask_1aszwcv_CheckResourceType" targetRef="ExclusiveGateway_1761epe" /> + <bpmn2:scriptTask id="ScriptTask_0jm9d9b" name="PostProcess Decompose Next Resouce" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1yhd9dp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0uj9myy</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstanceV2() +csi.postProcessDecomposeNextResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1yhd9dp" sourceRef="ExclusiveGateway_0r4jkig" targetRef="ScriptTask_0jm9d9b" /> + <bpmn2:sequenceFlow id="SequenceFlow_0uj9myy" sourceRef="ScriptTask_0jm9d9b" targetRef="ScriptTask_1vo6y1t" /> + <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0cabwkq" name="GoTo UpdateResourceOperStatus"> + <bpmn2:incoming>SequenceFlow_03fabby</bpmn2:incoming> + <bpmn2:linkEventDefinition name="UpdateResourceOperStatus" /> + </bpmn2:intermediateThrowEvent> + <bpmn2:intermediateCatchEvent id="StartEvent_1p7w4fj" name="Update Resource Oper Status"> + <bpmn2:outgoing>SequenceFlow_0e8oxe4</bpmn2:outgoing> + <bpmn2:linkEventDefinition name="UpdateResourceOperStatus" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0e8oxe4" sourceRef="StartEvent_1p7w4fj" targetRef="ScriptTask_0vaaotj" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0pz2s2d"> + <bpmn2:incoming>SequenceFlow_07pkpa0</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_01zluif</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0vey6x4</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_0vey6x4" sourceRef="ExclusiveGateway_0pz2s2d" targetRef="ScriptTask_0g6otdg" /> + <bpmn2:sequenceFlow id="SequenceFlow_07pkpa0" sourceRef="ServiceTask_1t9ln4p" targetRef="ExclusiveGateway_0pz2s2d" /> + <bpmn2:sequenceFlow id="SequenceFlow_163tmnq" name="SDNC" sourceRef="ExclusiveGateway_1761epe" targetRef="ExclusiveGateway_0k814as"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("controllerType") =="SDNC"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0k814as" name="SDNC service Create?" default="SequenceFlow_1vio1tn"> + <bpmn2:incoming>SequenceFlow_163tmnq</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01zluif</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1vio1tn</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_01zluif" name="yes" sourceRef="ExclusiveGateway_0k814as" targetRef="ExclusiveGateway_0pz2s2d"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("unit_test") == "true" || execution.getVariable("serviceSDNCCreate") == "true" }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1vio1tn" name="no" sourceRef="ExclusiveGateway_0k814as" targetRef="ServiceTask_1t9ln4p" /> + <bpmn2:scriptTask id="ScriptTask_0vaaotj" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0e8oxe4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1sata7n</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:serviceTask id="ServiceTask_1jbqff7" 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_1sata7n</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0x0jvs1</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1sata7n" sourceRef="ScriptTask_0vaaotj" targetRef="ServiceTask_1jbqff7" /> + <bpmn2:sequenceFlow id="SequenceFlow_0x0jvs1" sourceRef="ServiceTask_1jbqff7" targetRef="ScriptTask_1pwo0jp" /> + <bpmn2:scriptTask id="ScriptTask_1wk7zcu" name="Prepare Update Service Oper Status(100%)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1rebkae</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0gr3l25</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("operationStatus", "End") +def ddsi = new DoCreateE2EServiceInstanceV2() +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_1vo6y1t" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0uj9myy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_037rvnb</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +def ddsi = new DoCreateE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_037rvnb" sourceRef="ScriptTask_1vo6y1t" targetRef="ServiceTask_13w9clz" /> + <bpmn2:serviceTask id="ServiceTask_13w9clz" 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_037rvnb</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1mbrbsc</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_1mbrbsc" sourceRef="ServiceTask_13w9clz" targetRef="ExclusiveGateway_1pwgsa8" /> + <bpmn2:scriptTask id="ScriptTask_1pwo0jp" name="Prepare Resource Oper Status" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0x0jvs1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0aylb6e</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateE2EServiceInstanceV2() +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="Task_0vtxtuq_QueryServiceResources" /> + <bpmn2:serviceTask id="ServiceTask_0uiibxn" 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_01oo8ar</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10jgs3j</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_10jgs3j" sourceRef="ServiceTask_0uiibxn" targetRef="ScriptTask_1aszwcv_CheckResourceType" /> + <bpmn2:scriptTask id="ScriptTask_1oc0qjo" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0gorww6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01oo8ar</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +def ddsi = new DoCreateE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_01oo8ar" sourceRef="ScriptTask_1oc0qjo" targetRef="ServiceTask_0uiibxn" /> + </bpmn2:process> + <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateE2EServiceInstanceV2"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent"> + <dc:Bounds x="-14" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-20" y="120" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> + <dc:Bounds x="187" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61"> + <di:waypoint xsi:type="dc:Point" x="22" y="97" /> + <di:waypoint xsi:type="dc:Point" x="187" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="59.5" y="82" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4"> + <di:waypoint xsi:type="dc:Point" x="664" y="97" /> + <di:waypoint xsi:type="dc:Point" x="917" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745.5" y="82" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="CallActivity_1md4kyb_di"> + <di:waypoint xsi:type="dc:Point" x="287" y="97" /> + <di:waypoint xsi:type="dc:Point" x="564" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="380.5" y="82" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="CustomE2EGetService"> + <dc:Bounds x="564" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="CustomE2EPutService"> + <dc:Bounds x="564" y="244" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_129ih1g_di" bpmnElement="SequenceFlow_129ih1g"> + <di:waypoint xsi:type="dc:Point" x="664" y="284" /> + <di:waypoint xsi:type="dc:Point" x="917" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745.5" y="269" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> + <dc:Bounds x="-11" y="1751" width="783" height="195" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y"> + <dc:Bounds x="85" y="1828" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="58" y="1869" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3"> + <dc:Bounds x="718" y="1828" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="691" y="1869" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1srx6p6_di" bpmnElement="CallActivity_1srx6p6"> + <dc:Bounds x="383" y="1806" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf"> + <di:waypoint xsi:type="dc:Point" x="483" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="551" y="1846" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="472" y="1831" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11"> + <di:waypoint xsi:type="dc:Point" x="121" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="220" y="1846" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="126" y="1831" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy_PostProcessAAIGET"> + <dc:Bounds x="917" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9_PostProcessAAIPUT"> + <dc:Bounds x="917" y="244" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux"> + <dc:Bounds x="220" y="1806" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf"> + <di:waypoint xsi:type="dc:Point" x="320" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="383" y="1846" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="307" y="1831" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1p0vyip_di" bpmnElement="ScriptTask_1p0vyip"> + <dc:Bounds x="551" y="1806" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k"> + <di:waypoint xsi:type="dc:Point" x="651" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="683" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="683" y="1846" /> + <di:waypoint xsi:type="dc:Point" x="718" y="1846" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="653" y="1846" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> + <dc:Bounds x="-823" y="841" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-941" y="881" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03fabby_di" bpmnElement="SequenceFlow_03fabby"> + <di:waypoint xsi:type="dc:Point" x="1017" y="284" /> + <di:waypoint xsi:type="dc:Point" x="1239" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1083" y="263" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1etg91s_di" bpmnElement="Task_1u82cbz"> + <dc:Bounds x="398" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1761epe_di" bpmnElement="ExclusiveGateway_1761epe" isMarkerVisible="true"> + <dc:Bounds x="1137" y="1189" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1117" y="1243" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gorww6_di" bpmnElement="SequenceFlow_0gorww6"> + <di:waypoint xsi:type="dc:Point" x="498" y="665" /> + <di:waypoint xsi:type="dc:Point" x="580" y="665" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="494" y="644" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1t9tmp4_di" bpmnElement="SequenceFlow_1t9tmp4"> + <di:waypoint xsi:type="dc:Point" x="1162" y="1189" /> + <di:waypoint xsi:type="dc:Point" x="1162" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="1095" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1166" y="1097" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1azssf7_di" bpmnElement="Task_09laxun"> + <dc:Bounds x="995" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1t4cc7w_di" bpmnElement="SequenceFlow_1t4cc7w"> + <di:waypoint xsi:type="dc:Point" x="995" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="866" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="885.5" y="996" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1v57nb9_di" bpmnElement="Task_1wyyy33"> + <dc:Bounds x="539" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1p99k36_di" bpmnElement="SequenceFlow_1p99k36"> + <di:waypoint xsi:type="dc:Point" x="539" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="401" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="425" y="996" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1fj89ew_di" bpmnElement="Task_0ag30bf"> + <dc:Bounds x="226" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1op29ls_di" bpmnElement="ScriptTask_1op29ls"> + <dc:Bounds x="226" y="1339" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0g6otdg_di" bpmnElement="ScriptTask_0g6otdg"> + <dc:Bounds x="643" y="1339" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0r4jkig_di" bpmnElement="ExclusiveGateway_0r4jkig" isMarkerVisible="true"> + <dc:Bounds x="126" y="1189" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="123" y="1243" width="60" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ylmq2b_di" bpmnElement="SequenceFlow_0ylmq2b"> + <di:waypoint xsi:type="dc:Point" x="226" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="151" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="151" y="1239" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="143.5" y="1358" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07q8ra0_di" bpmnElement="SequenceFlow_07q8ra0"> + <di:waypoint xsi:type="dc:Point" x="226" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="151" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="151" y="1189" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="143.5" y="996" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1pwgsa8_di" bpmnElement="ExclusiveGateway_1pwgsa8" isMarkerVisible="true"> + <dc:Bounds x="212" y="640" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="194" y="694" width="86" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13l7ffp_di" bpmnElement="SequenceFlow_13l7ffp"> + <di:waypoint xsi:type="dc:Point" x="262" y="665" /> + <di:waypoint xsi:type="dc:Point" x="398" y="665" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="377.03973509933775" y="644" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_08hez0f_di" bpmnElement="Task_0vtxtuq_QueryServiceResources"> + <dc:Bounds x="917" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1t9ln4p_di" bpmnElement="ServiceTask_1t9ln4p"> + <dc:Bounds x="881" y="1339" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1asiahh_di" bpmnElement="CallActivity_0x5g3pa"> + <dc:Bounds x="429" y="1339" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04rn9mp_di" bpmnElement="ScriptTask_04rn9mp"> + <dc:Bounds x="539" y="1590" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1xkr802_di" bpmnElement="ExclusiveGateway_1xkr802" isMarkerVisible="true"> + <dc:Bounds x="816" y="992" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="817" y="1051" width="51" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1a1du22_di" bpmnElement="SequenceFlow_1a1du22"> + <di:waypoint xsi:type="dc:Point" x="816" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="639" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="721.1366906474819" y="996" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1iu2jb7_di" bpmnElement="ExclusiveGateway_1iu2jb7" isMarkerVisible="true"> + <dc:Bounds x="351" y="992" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="331" y="1051" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cyffv0_di" bpmnElement="SequenceFlow_0cyffv0"> + <di:waypoint xsi:type="dc:Point" x="351" y="1017" /> + <di:waypoint xsi:type="dc:Point" x="326" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="293.5" y="996" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14jy44g_di" bpmnElement="SequenceFlow_14jy44g"> + <di:waypoint xsi:type="dc:Point" x="841" y="992" /> + <di:waypoint xsi:type="dc:Point" x="841" y="932" /> + <di:waypoint xsi:type="dc:Point" x="376" y="932" /> + <di:waypoint xsi:type="dc:Point" x="376" y="992" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="599.5643203883494" y="911" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0br9juy_di" bpmnElement="SequenceFlow_0br9juy"> + <di:waypoint xsi:type="dc:Point" x="643" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="529" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="541" y="1358" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06byir6_di" bpmnElement="SequenceFlow_06byir6"> + <di:waypoint xsi:type="dc:Point" x="429" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="326" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="332.5" y="1358" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14ef6wp_di" bpmnElement="SequenceFlow_14ef6wp"> + <di:waypoint xsi:type="dc:Point" x="1137" y="1214" /> + <di:waypoint xsi:type="dc:Point" x="639" y="1214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="874.1140567200987" y="1193" width="29" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1pcl6u1_di" bpmnElement="Task_0zhvu4r_llllll"> + <dc:Bounds x="539" y="1174" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gxsqsa_di" bpmnElement="SequenceFlow_0gxsqsa"> + <di:waypoint xsi:type="dc:Point" x="539" y="1214" /> + <di:waypoint xsi:type="dc:Point" x="176" y="1214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="312.5" y="1193" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_10aubhh_di" bpmnElement="SequenceFlow_10aubhh"> + <di:waypoint xsi:type="dc:Point" x="1017" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1239" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1128" y="76" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1m5zb3d_di" bpmnElement="IntermediateThrowEvent_0aggdcl_GoToStartService"> + <dc:Bounds x="1239" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1213" y="119" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1vjqlwn_di" bpmnElement="StartEvent_0l5bz4h_StartService"> + <dc:Bounds x="-14" y="266" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-26" y="306" width="60" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0zmz5am_di" bpmnElement="SequenceFlow_0zmz5am"> + <di:waypoint xsi:type="dc:Point" x="22" y="284" /> + <di:waypoint xsi:type="dc:Point" x="564" y="284" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="248" y="263" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rhn48b_di" bpmnElement="SequenceFlow_1rhn48b"> + <di:waypoint xsi:type="dc:Point" x="22" y="595" /> + <di:waypoint xsi:type="dc:Point" x="237" y="595" /> + <di:waypoint xsi:type="dc:Point" x="237" y="640" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="129.5" y="574" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0jks7by_di" bpmnElement="StartEvent_StartResource"> + <dc:Bounds x="-14" y="577" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-31" y="617" width="71" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ct6u3o_di" bpmnElement="SequenceFlow_1ct6u3o"> + <di:waypoint xsi:type="dc:Point" x="1018" y="491" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="491" /> + <di:waypoint xsi:type="dc:Point" x="1085" y="491" /> + <di:waypoint xsi:type="dc:Point" x="1239" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1100" y="485" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0ys6800_di" bpmnElement="IntermediateThrowEvent_1dwg5lz"> + <dc:Bounds x="1239" y="473" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1222" y="513" width="71" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1rebkae_di" bpmnElement="SequenceFlow_1rebkae"> + <di:waypoint xsi:type="dc:Point" x="40" y="1630" /> + <di:waypoint xsi:type="dc:Point" x="148" y="1630" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="49" y="1609" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_05z1jyy_di" bpmnElement="StartEvent_0jhv664"> + <dc:Bounds x="4" y="1612" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-13" y="1652" width="70" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0x8im5g_di" bpmnElement="EndEvent_0x8im5g"> + <dc:Bounds x="723" y="1612" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="741" y="1652" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lkpfe2_di" bpmnElement="SequenceFlow_1lkpfe2"> + <di:waypoint xsi:type="dc:Point" x="639" y="1630" /> + <di:waypoint xsi:type="dc:Point" x="723" y="1630" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="636" y="1609" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fq4qzy_di" bpmnElement="SequenceFlow_1fq4qzy"> + <di:waypoint xsi:type="dc:Point" x="237" y="690" /> + <di:waypoint xsi:type="dc:Point" x="237" y="794" /> + <di:waypoint xsi:type="dc:Point" x="258" y="794" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="227.12763168720514" y="735.6050882148045" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_11jt9tx_di" bpmnElement="IntermediateThrowEvent_GoToFinishProcess"> + <dc:Bounds x="258" y="776" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="242" y="816" width="70" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1aszwcv_di" bpmnElement="ScriptTask_1aszwcv_CheckResourceType"> + <dc:Bounds x="1027" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wf52w6_di" bpmnElement="SequenceFlow_1wf52w6"> + <di:waypoint xsi:type="dc:Point" x="1127" y="665" /> + <di:waypoint xsi:type="dc:Point" x="1240" y="665" /> + <di:waypoint xsi:type="dc:Point" x="1240" y="1214" /> + <di:waypoint xsi:type="dc:Point" x="1187" y="1214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1210" y="933.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0jm9d9b_di" bpmnElement="ScriptTask_0jm9d9b"> + <dc:Bounds x="-9" y="1174" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1yhd9dp_di" bpmnElement="SequenceFlow_1yhd9dp"> + <di:waypoint xsi:type="dc:Point" x="126" y="1214" /> + <di:waypoint xsi:type="dc:Point" x="91" y="1214" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="108.5" y="1193" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0uj9myy_di" bpmnElement="SequenceFlow_0uj9myy"> + <di:waypoint xsi:type="dc:Point" x="41" y="1174" /> + <di:waypoint xsi:type="dc:Point" x="41" y="985" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="11" y="1073.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_0nf1193_di" bpmnElement="IntermediateThrowEvent_0cabwkq"> + <dc:Bounds x="1239" y="266" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1219" y="306" width="83" height="36" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0v3ecwh_di" bpmnElement="StartEvent_1p7w4fj"> + <dc:Bounds x="-14" y="473" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-38" y="513" width="86" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0e8oxe4_di" bpmnElement="SequenceFlow_0e8oxe4"> + <di:waypoint xsi:type="dc:Point" x="22" y="491" /> + <di:waypoint xsi:type="dc:Point" x="226" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="79" y="470" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0pz2s2d_di" bpmnElement="ExclusiveGateway_0pz2s2d" isMarkerVisible="true"> + <dc:Bounds x="791" y="1354" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="726" y="1408" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0vey6x4_di" bpmnElement="SequenceFlow_0vey6x4"> + <di:waypoint xsi:type="dc:Point" x="791" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="743" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="722" y="1358" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07pkpa0_di" bpmnElement="SequenceFlow_07pkpa0"> + <di:waypoint xsi:type="dc:Point" x="881" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="841" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="816" y="1358" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_163tmnq_di" bpmnElement="SequenceFlow_163tmnq"> + <di:waypoint xsi:type="dc:Point" x="1162" y="1239" /> + <di:waypoint xsi:type="dc:Point" x="1162" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="1070" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1171" y="1300" width="31" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0k814as_di" bpmnElement="ExclusiveGateway_0k814as" isMarkerVisible="true"> + <dc:Bounds x="1020" y="1354" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1022" y="1410" width="46" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01zluif_di" bpmnElement="SequenceFlow_01zluif"> + <di:waypoint xsi:type="dc:Point" x="1045" y="1354" /> + <di:waypoint xsi:type="dc:Point" x="1045" y="1295" /> + <di:waypoint xsi:type="dc:Point" x="816" y="1295" /> + <di:waypoint xsi:type="dc:Point" x="816" y="1354" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="922" y="1274" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vio1tn_di" bpmnElement="SequenceFlow_1vio1tn"> + <di:waypoint xsi:type="dc:Point" x="1020" y="1379" /> + <di:waypoint xsi:type="dc:Point" x="981" y="1379" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1001" y="1402" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0vaaotj_di" bpmnElement="ScriptTask_0vaaotj"> + <dc:Bounds x="226" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1jbqff7_di" bpmnElement="ServiceTask_1jbqff7"> + <dc:Bounds x="390" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1sata7n_di" bpmnElement="SequenceFlow_1sata7n"> + <di:waypoint xsi:type="dc:Point" x="326" y="491" /> + <di:waypoint xsi:type="dc:Point" x="390" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="313" y="470" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0x0jvs1_di" bpmnElement="SequenceFlow_0x0jvs1"> + <di:waypoint xsi:type="dc:Point" x="490" y="491" /> + <di:waypoint xsi:type="dc:Point" x="564" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="482" y="470" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1wk7zcu_di" bpmnElement="ScriptTask_1wk7zcu"> + <dc:Bounds x="148" y="1590" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1a6cmdu_di" bpmnElement="ServiceTask_1a6cmdu"> + <dc:Bounds x="379" y="1590" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gr3l25_di" bpmnElement="SequenceFlow_0gr3l25"> + <di:waypoint xsi:type="dc:Point" x="248" y="1630" /> + <di:waypoint xsi:type="dc:Point" x="379" y="1630" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="313.5" y="1609" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0cnuo36_di" bpmnElement="SequenceFlow_0cnuo36"> + <di:waypoint xsi:type="dc:Point" x="479" y="1630" /> + <di:waypoint xsi:type="dc:Point" x="539" y="1630" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="509" y="1609" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1vo6y1t_di" bpmnElement="ScriptTask_1vo6y1t"> + <dc:Bounds x="-9" y="905" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_037rvnb_di" bpmnElement="SequenceFlow_037rvnb"> + <di:waypoint xsi:type="dc:Point" x="41" y="905" /> + <di:waypoint xsi:type="dc:Point" x="41" y="844" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="56" y="868.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_13w9clz_di" bpmnElement="ServiceTask_13w9clz"> + <dc:Bounds x="-9" y="764" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1mbrbsc_di" bpmnElement="SequenceFlow_1mbrbsc"> + <di:waypoint xsi:type="dc:Point" x="41" y="764" /> + <di:waypoint xsi:type="dc:Point" x="41" y="665" /> + <di:waypoint xsi:type="dc:Point" x="212" y="665" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="56" y="708.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1pwo0jp_di" bpmnElement="ScriptTask_1pwo0jp"> + <dc:Bounds x="564" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0aylb6e_di" bpmnElement="SequenceFlow_0aylb6e"> + <di:waypoint xsi:type="dc:Point" x="664" y="491" /> + <di:waypoint xsi:type="dc:Point" x="741" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="702.5" y="470" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1dqzdko_di" bpmnElement="ServiceTask_1dqzdko"> + <dc:Bounds x="741" y="451" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1r1hl23_di" bpmnElement="SequenceFlow_1r1hl23"> + <di:waypoint xsi:type="dc:Point" x="841" y="491" /> + <di:waypoint xsi:type="dc:Point" x="917" y="491" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="879" y="470" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0uiibxn_di" bpmnElement="ServiceTask_0uiibxn"> + <dc:Bounds x="750" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10jgs3j_di" bpmnElement="SequenceFlow_10jgs3j"> + <di:waypoint xsi:type="dc:Point" x="850" y="665" /> + <di:waypoint xsi:type="dc:Point" x="1027" y="665" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="938.5" y="644" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1oc0qjo_di" bpmnElement="ScriptTask_1oc0qjo"> + <dc:Bounds x="580" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01oo8ar_di" bpmnElement="SequenceFlow_01oo8ar"> + <di:waypoint xsi:type="dc:Point" x="680" y="665" /> + <di:waypoint xsi:type="dc:Point" x="750" y="665" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="715" y="644" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn new file mode 100644 index 0000000000..f66a3c6a42 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstanceV2.bpmn @@ -0,0 +1,956 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> + <bpmn:process id="DoCustomDeleteE2EServiceInstanceV2" name="DoCustomDeleteE2EServiceInstanceV2" isExecutable="true"> + <bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow"> + <bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_06phzgv" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0vz7cd9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11e6bfy</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preProcessRequest(execution) +]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1uqzt26"> + <bpmn:incoming>SequenceFlow_06tonva</bpmn:incoming> + </bpmn:endEvent> + <bpmn:callActivity id="CallActivity_06izbke" name="Call AAI GenericDelete Service " calledElement="GenericDeleteService"> + <bpmn:extensionElements> + <camunda:in source="serviceInstanceId" target="GENDS_serviceInstanceId" /> + <camunda:in source="serviceType" target="GENDS_serviceType" /> + <camunda:in source="globalSubscriberId" target="GENDS_globalCustomerId" /> + <camunda:in sourceExpression="service-instance" target="GENDS_type" /> + <camunda:out source="GENDS_FoundIndicator" target="GENDS_FoundIndicator" /> + <camunda:in sourceExpression="""" target="GENGS_serviceType" /> + <camunda:out source="GENDS_SuccessIndicator" target="GENDS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowExcpeton" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0t5f2dt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0g6bxqw</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1rtnsh8" name="Post Process AAI GET" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_188ejvu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00a3ijv</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.postProcessAAIGET(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_01erufg" name="Post Process AAI Delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0g6bxqw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.postProcessAAIDEL(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:subProcess id="SubProcess_1u8zt9i" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0sf5lpt"> + <bpmn:outgoing>SequenceFlow_1921mo3</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_06utmg4"> + <bpmn:incoming>SequenceFlow_18vlzfo</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0nha3pr" name="Log / Print Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1921mo3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18vlzfo</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1921mo3" name="" sourceRef="StartEvent_0sf5lpt" targetRef="ScriptTask_0nha3pr" /> + <bpmn:sequenceFlow id="SequenceFlow_18vlzfo" name="" sourceRef="ScriptTask_0nha3pr" targetRef="EndEvent_06utmg4" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="SequenceFlow_0vz7cd9" sourceRef="StartEvent_0212h2r" targetRef="ScriptTask_06phzgv" /> + <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="CallActivity_076pc2z" /> + <bpmn:sequenceFlow id="SequenceFlow_0e7inkl" sourceRef="ScriptTask_01erufg" targetRef="ScriptTask_1vlvb1r" /> + <bpmn:sequenceFlow id="SequenceFlow_0g6bxqw" sourceRef="CallActivity_06izbke" targetRef="ScriptTask_01erufg" /> + <bpmn:scriptTask id="ScriptTask_postProcessVFCDelete" name="Post Process VFC Delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1931m8u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17b01zs</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +String response = execution.getVariable("vfcDeleteResponse") +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.postProcessVFCDelete(execution, response, "delete")]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1g0tsto" name="Post Process SDNC Delete" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1w2n8dn</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09z6zl7</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +String response = execution.getVariable("sdncDeleteResponse") +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.postProcessSDNCDelete(execution, response, "delete")]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0z30dax" name="Prepare Resource Delele For Overlay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1jfyo1x</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1t1mg6y</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +String resourceName = "underlay" +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preSDNCResourceDelete(execution, resourceName )]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0rpu756" sourceRef="CallActivity_Del_SDNC_cust" targetRef="ExclusiveGateway_0plkf6p" /> + <bpmn:sequenceFlow id="SequenceFlow_1wnkgpx" sourceRef="Task_preProcessVFCResourceDelete" targetRef="Task_CallNetworkServiceDeleteforVFC" /> + <bpmn:sequenceFlow id="SequenceFlow_1931m8u" sourceRef="Task_CallNetworkServiceDeleteforVFC" targetRef="ScriptTask_postProcessVFCDelete" /> + <bpmn:scriptTask id="Task_preProcessVFCResourceDelete" name="Prepare Resource Delele For VFC" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1bx4es4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wnkgpx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preProcessVFCResourceDelete(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_CallNetworkServiceDeleteforVFC" name="Call Network Service Delete for VFC" calledElement="DoDeleteVFCNetworkServiceInstance"> + <bpmn:extensionElements> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="serviceInstanceId" target="serviceId" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="resourceTemplateId" target="resourceTemplateId" /> + <camunda:in source="resourceInstanceId" target="resourceInstanceId" /> + <camunda:in source="resourceType" target="resourceType" /> + <camunda:in source="operationType" target="operationType" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1wnkgpx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1931m8u</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:serviceTask id="CallActivity_Del_SDNC_cust" name="Call Custom Delete SDNC Overlay" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncNetworkTopologyOperationTask"> + <bpmn:incoming>SequenceFlow_0a1q5fw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rpu756</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1g4djgh" sourceRef="Task_1j1u666" targetRef="ExclusiveGateway_125wehq" /> + <bpmn:sequenceFlow id="SequenceFlow_0uc2beq" sourceRef="Task_0edkv0m" targetRef="ExclusiveGateway_1kavnc9" /> + <bpmn:scriptTask id="Task_14erap6" name="Prepare Resource Delele For Underlay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1lv9vmb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16r9z75</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +String resourceName = "underlay" +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preSDNCResourceDelete(execution, resourceName )]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="Task_1j1u666" name="Call Custom Delete SDNC Underlay" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncNetworkTopologyOperationTask"> + <bpmn:incoming>SequenceFlow_0m7ks9t</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1g4djgh</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Task_0edkv0m" name="Call Delete SDNC Service Topology" camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> + <bpmn:incoming>SequenceFlow_0akcnw7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uc2beq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_076pc2z" name="Call AAI Generic GetService" calledElement="GenericGetService"> + <bpmn:extensionElements> + <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> + <camunda:in sourceExpression="service-instance" target="GENGS_type" /> + <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> + <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> + <camunda:out source="GENGS_service" target="GENGS_service" /> + <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> + <camunda:in source="serviceType" target="GENGS_serviceType" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_188ejvu</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_188ejvu" sourceRef="CallActivity_076pc2z" targetRef="ScriptTask_1rtnsh8" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1d5z35x" name="GoTo Delete SDNC Resource"> + <bpmn:incoming>SequenceFlow_1qzxy2i</bpmn:incoming> + <bpmn:linkEventDefinition name="DeleteSDNCResource" /> + </bpmn:intermediateThrowEvent> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_1h6kkwi" name="Start Delete SDNC Resource"> + <bpmn:outgoing>SequenceFlow_1jfyo1x</bpmn:outgoing> + <bpmn:linkEventDefinition name="DeleteSDNCResource" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_1jfyo1x" sourceRef="IntermediateThrowEvent_1h6kkwi" targetRef="ScriptTask_0z30dax" /> + <bpmn:sequenceFlow id="SequenceFlow_09z6zl7" sourceRef="ScriptTask_1g0tsto" targetRef="IntermediateThrowEvent_01vy71e" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_01vy71e" name="GoTo Delete VFC Resource"> + <bpmn:incoming>SequenceFlow_09z6zl7</bpmn:incoming> + <bpmn:linkEventDefinition name="DeleteVFCResource" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_17b01zs" sourceRef="ScriptTask_postProcessVFCDelete" targetRef="ScriptTask_postProcessDecomposeNextResource" /> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0ow0ck5" name="Start Delete VFC Resource"> + <bpmn:outgoing>SequenceFlow_0homduu</bpmn:outgoing> + <bpmn:linkEventDefinition name="DeleteVFCResource" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0homduu" sourceRef="IntermediateThrowEvent_0ow0ck5" targetRef="ExclusiveGateway_ServiceResourceIsFinish" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_03gc5du" name="Start Delete Service Instance"> + <bpmn:outgoing>SequenceFlow_0t5f2dt</bpmn:outgoing> + <bpmn:linkEventDefinition name="DeleteServiceInstance" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_0t5f2dt" sourceRef="IntermediateCatchEvent_03gc5du" targetRef="CallActivity_06izbke" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_ServiceResourceIsFinish" name="Service Resource Finish?" default="SequenceFlow_0n7qeqt"> + <bpmn:incoming>SequenceFlow_0homduu</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0eoibq3</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0n7qeqt</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_13c2v9z</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0n7qeqt" name="No" sourceRef="ExclusiveGateway_ServiceResourceIsFinish" targetRef="ScriptTask_preProcessDecomposeNextResource" /> + <bpmn:scriptTask id="ScriptTask_preProcessDecomposeNextResource" name="PreProcess Decompose Next Resouce" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n7qeqt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1a5ki3p</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preProcessDecomposeNextResource(execution )]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1a5ki3p" sourceRef="ScriptTask_preProcessDecomposeNextResource" targetRef="ScriptTask_0mjvi2p" /> + <bpmn:scriptTask id="ScriptTask_postProcessDecomposeNextResource" name="PostProcess Decompose Next Resouce" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_17b01zs</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0gxv0wp</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.postProcessDecomposeNextResource(execution )]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0gxv0wp" sourceRef="ScriptTask_postProcessDecomposeNextResource" targetRef="ScriptTask_06sbvjm" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_01fw8bb" name="GoTo Delete Servcie Instance"> + <bpmn:incoming>SequenceFlow_13c2v9z</bpmn:incoming> + <bpmn:linkEventDefinition name="DeleteServiceInstance" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_13c2v9z" name="Yes" sourceRef="ExclusiveGateway_ServiceResourceIsFinish" targetRef="IntermediateThrowEvent_01fw8bb"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{ execution.getVariable("DDELSI_resourceFinish") != null && execution.getVariable("DDELSI_resourceFinish") == true }]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_052agzc" name="Found Resource?" default="SequenceFlow_1fac57w"> + <bpmn:incoming>SequenceFlow_1t1mg6y</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a1q5fw</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1fac57w</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1t1mg6y" sourceRef="ScriptTask_0z30dax" targetRef="ExclusiveGateway_052agzc" /> + <bpmn:sequenceFlow id="SequenceFlow_0a1q5fw" name="Yes" sourceRef="ExclusiveGateway_052agzc" targetRef="CallActivity_Del_SDNC_cust"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{ execution.getVariable("foundResource") != null && execution.getVariable("foundResource") == true }]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_0plkf6p"> + <bpmn:incoming>SequenceFlow_0rpu756</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1fac57w</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1lv9vmb</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1lv9vmb" sourceRef="ExclusiveGateway_0plkf6p" targetRef="Task_14erap6" /> + <bpmn:sequenceFlow id="SequenceFlow_1fac57w" name="No" sourceRef="ExclusiveGateway_052agzc" targetRef="ExclusiveGateway_0plkf6p" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0u98ylh" name="Found Resource?" default="SequenceFlow_00knko8"> + <bpmn:incoming>SequenceFlow_16r9z75</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0m7ks9t</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_00knko8</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_16r9z75" sourceRef="Task_14erap6" targetRef="ExclusiveGateway_0u98ylh" /> + <bpmn:sequenceFlow id="SequenceFlow_0m7ks9t" name="Yes" sourceRef="ExclusiveGateway_0u98ylh" targetRef="Task_1j1u666"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{ execution.getVariable("foundResource") != null && execution.getVariable("foundResource") == true }]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_125wehq" default="SequenceFlow_15pzf5n"> + <bpmn:incoming>SequenceFlow_1g4djgh</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00knko8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0akcnw7</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_15pzf5n</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0akcnw7" name="yes" sourceRef="ExclusiveGateway_125wehq" targetRef="Task_0edkv0m"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{ execution.getVariable("foundResource") != null && execution.getVariable("foundResource") == true }]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_00knko8" name="No" sourceRef="ExclusiveGateway_0u98ylh" targetRef="ExclusiveGateway_125wehq" /> + <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1t1fier" name="Start UpateOperStatus"> + <bpmn:outgoing>SequenceFlow_033eqeg</bpmn:outgoing> + <bpmn:linkEventDefinition name="UpateOperStatus" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="SequenceFlow_033eqeg" sourceRef="IntermediateCatchEvent_1t1fier" targetRef="ScriptTask_1ut5zs5" /> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1q64g27" name="GoTo UpateOperStatus"> + <bpmn:incoming>SequenceFlow_00a3ijv</bpmn:incoming> + <bpmn:linkEventDefinition name="UpateOperStatus" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_00a3ijv" sourceRef="ScriptTask_1rtnsh8" targetRef="IntermediateThrowEvent_1q64g27" /> + <bpmn:scriptTask id="ScriptTask_PrepareServiceResources" name="Prepare Service Resources" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_18wibmi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11405m9</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.prepareServiceDeleteResource(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_11405m9" sourceRef="ScriptTask_PrepareServiceResources" targetRef="ScriptTask_0w4scer" /> + <bpmn:scriptTask id="ScriptTask_1ut5zs5" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_033eqeg</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sm5x5e</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0kl5qtj" name="Update Service Oper Status"> + <bpmn: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> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1sm5x5e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18wibmi</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1sm5x5e" sourceRef="ScriptTask_1ut5zs5" targetRef="ServiceTask_0kl5qtj" /> + <bpmn:sequenceFlow id="SequenceFlow_18wibmi" sourceRef="ServiceTask_0kl5qtj" targetRef="ScriptTask_PrepareServiceResources" /> + <bpmn:scriptTask id="ScriptTask_1vlvb1r" name="Prepare Update Service Oper Status(100%)" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0e7inkl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0l4qcge</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +execution.setVariable("progress", "100") +execution.setVariable("operationStatus", "End") +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0lint2e" name="Update Service Oper Status"> + <bpmn: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> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0l4qcge</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06tonva</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0l4qcge" sourceRef="ScriptTask_1vlvb1r" targetRef="ServiceTask_0lint2e" /> + <bpmn:sequenceFlow id="SequenceFlow_06tonva" sourceRef="ServiceTask_0lint2e" targetRef="EndEvent_1uqzt26" /> + <bpmn:scriptTask id="ScriptTask_06sbvjm" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0gxv0wp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1i96ytk</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1i96ytk" sourceRef="ScriptTask_06sbvjm" targetRef="ServiceTask_0bia9bb" /> + <bpmn:serviceTask id="ServiceTask_0bia9bb" name="Update Service Oper Status"> + <bpmn: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> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1i96ytk</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0eoibq3</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0eoibq3" sourceRef="ServiceTask_0bia9bb" targetRef="ExclusiveGateway_ServiceResourceIsFinish" /> + <bpmn:scriptTask id="ScriptTask_0mjvi2p" name="Prepare Update Service Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1a5ki3p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1oo4g4h</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* + +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1oo4g4h" sourceRef="ScriptTask_0mjvi2p" targetRef="ServiceTask_0vk2b9b" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1kavnc9"> + <bpmn:incoming>SequenceFlow_0uc2beq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_15pzf5n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1w2n8dn</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1w2n8dn" sourceRef="ExclusiveGateway_1kavnc9" targetRef="ScriptTask_1g0tsto" /> + <bpmn:sequenceFlow id="SequenceFlow_15pzf5n" sourceRef="ExclusiveGateway_125wehq" targetRef="ExclusiveGateway_1kavnc9" /> + <bpmn:serviceTask id="ServiceTask_0vk2b9b" name="Update Service Oper Status"> + <bpmn: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> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1oo4g4h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1bx4es4</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1bx4es4" sourceRef="ServiceTask_0vk2b9b" targetRef="Task_preProcessVFCResourceDelete" /> + <bpmn:scriptTask id="ScriptTask_0w4scer" name="Prepare Resource Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_11405m9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15d5odq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCustomDeleteE2EServiceInstanceV2() +ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_15d5odq" sourceRef="ScriptTask_0w4scer" targetRef="ServiceTask_1mg7vnx" /> + <bpmn:serviceTask id="ServiceTask_1mg7vnx" name="Init Resource Oper 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_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> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_15d5odq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qzxy2i</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_1qzxy2i" sourceRef="ServiceTask_1mg7vnx" targetRef="IntermediateThrowEvent_1d5z35x" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCustomDeleteE2EServiceInstanceV2"> + <bpmndi:BPMNShape id="StartEvent_0212h2r_di" bpmnElement="StartEvent_0212h2r"> + <dc:Bounds x="75" y="110" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="69" y="151" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_06phzgv_di" bpmnElement="ScriptTask_06phzgv"> + <dc:Bounds x="311" y="88" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1uqzt26_di" bpmnElement="EndEvent_1uqzt26"> + <dc:Bounds x="1078" y="1238" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1006" y="1279" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_06izbke_di" bpmnElement="CallActivity_06izbke"> + <dc:Bounds x="214" y="1216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rtnsh8_di" bpmnElement="ScriptTask_1rtnsh8"> + <dc:Bounds x="1055" y="88" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01erufg_di" bpmnElement="ScriptTask_01erufg"> + <dc:Bounds x="462" y="1216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_1u8zt9i_di" bpmnElement="SubProcess_1u8zt9i" isExpanded="true"> + <dc:Bounds x="192" y="1439" width="467" height="193" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0vz7cd9_di" bpmnElement="SequenceFlow_0vz7cd9"> + <di:waypoint xsi:type="dc:Point" x="111" y="128" /> + <di:waypoint xsi:type="dc:Point" x="311" y="128" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="107" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_11e6bfy_di" bpmnElement="SequenceFlow_11e6bfy"> + <di:waypoint xsi:type="dc:Point" x="411" y="128" /> + <di:waypoint xsi:type="dc:Point" x="461" y="128" /> + <di:waypoint xsi:type="dc:Point" x="667" y="128" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="107" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e7inkl_di" bpmnElement="SequenceFlow_0e7inkl"> + <di:waypoint xsi:type="dc:Point" x="562" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="657" y="1256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="564.5" y="1235" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g6bxqw_di" bpmnElement="SequenceFlow_0g6bxqw"> + <di:waypoint xsi:type="dc:Point" x="314" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="462" y="1256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="343" y="1235" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt"> + <dc:Bounds x="260" y="1506" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="188" y="1547" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_06utmg4_di" bpmnElement="EndEvent_06utmg4"> + <dc:Bounds x="553" y="1506" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="481" y="1547" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0nha3pr_di" bpmnElement="ScriptTask_0nha3pr"> + <dc:Bounds x="364" y="1484" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1921mo3_di" bpmnElement="SequenceFlow_1921mo3"> + <di:waypoint xsi:type="dc:Point" x="296" y="1524" /> + <di:waypoint xsi:type="dc:Point" x="364" y="1524" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="240" y="1509" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18vlzfo_di" bpmnElement="SequenceFlow_18vlzfo"> + <di:waypoint xsi:type="dc:Point" x="464" y="1524" /> + <di:waypoint xsi:type="dc:Point" x="553" y="1524" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420" y="1509" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0mdub03_di" bpmnElement="ScriptTask_postProcessVFCDelete"> + <dc:Bounds x="1046" y="1107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1g0tsto_di" bpmnElement="ScriptTask_1g0tsto"> + <dc:Bounds x="1045" y="775" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0z30dax_di" bpmnElement="ScriptTask_0z30dax"> + <dc:Bounds x="311" y="577" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0rpu756_di" bpmnElement="SequenceFlow_0rpu756"> + <di:waypoint xsi:type="dc:Point" x="411" y="823" /> + <di:waypoint xsi:type="dc:Point" x="530" y="823" /> + <di:waypoint xsi:type="dc:Point" x="530" y="743" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="426" y="802" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1wnkgpx_di" bpmnElement="SequenceFlow_1wnkgpx"> + <di:waypoint xsi:type="dc:Point" x="931" y="980" /> + <di:waypoint xsi:type="dc:Point" x="1046" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="943.5" y="959" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1931m8u_di" bpmnElement="SequenceFlow_1931m8u"> + <di:waypoint xsi:type="dc:Point" x="1096" y="1020" /> + <di:waypoint xsi:type="dc:Point" x="1096" y="1107" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1066" y="1058" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_00301ai_di" bpmnElement="Task_preProcessVFCResourceDelete"> + <dc:Bounds x="831" y="940" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1mwacgl_di" bpmnElement="Task_CallNetworkServiceDeleteforVFC"> + <dc:Bounds x="1046" y="940" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0v9q75y_di" bpmnElement="CallActivity_Del_SDNC_cust"> + <dc:Bounds x="311" y="784" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1g4djgh_di" bpmnElement="SequenceFlow_1g4djgh"> + <di:waypoint xsi:type="dc:Point" x="757" y="815" /> + <di:waypoint xsi:type="dc:Point" x="913" y="815" /> + <di:waypoint xsi:type="dc:Point" x="913" y="743" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="790" y="794" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0uc2beq_di" bpmnElement="SequenceFlow_0uc2beq"> + <di:waypoint xsi:type="dc:Point" x="1095" y="657" /> + <di:waypoint xsi:type="dc:Point" x="1096" y="693" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1050.5" y="654" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1e5z0wu_di" bpmnElement="Task_14erap6"> + <dc:Bounds x="657" y="577" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0f0965f_di" bpmnElement="Task_1j1u666"> + <dc:Bounds x="657" y="775" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0p4b7e1_di" bpmnElement="Task_0edkv0m"> + <dc:Bounds x="1055" y="577" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_076pc2z_di" bpmnElement="CallActivity_076pc2z"> + <dc:Bounds x="667" y="88" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_188ejvu_di" bpmnElement="SequenceFlow_188ejvu"> + <di:waypoint xsi:type="dc:Point" x="767" y="128" /> + <di:waypoint xsi:type="dc:Point" x="1055" y="128" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="866" y="107" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1gbu8tc_di" bpmnElement="IntermediateThrowEvent_1d5z35x"> + <dc:Bounds x="1294" y="376" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1275" y="416" width="82" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0a6c9bw_di" bpmnElement="IntermediateThrowEvent_1h6kkwi"> + <dc:Bounds x="71" y="599" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="52" y="639" width="82" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1jfyo1x_di" bpmnElement="SequenceFlow_1jfyo1x"> + <di:waypoint xsi:type="dc:Point" x="107" y="617" /> + <di:waypoint xsi:type="dc:Point" x="209" y="617" /> + <di:waypoint xsi:type="dc:Point" x="209" y="617" /> + <di:waypoint xsi:type="dc:Point" x="311" y="617" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="611" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09z6zl7_di" bpmnElement="SequenceFlow_09z6zl7"> + <di:waypoint xsi:type="dc:Point" x="1145" y="815" /> + <di:waypoint xsi:type="dc:Point" x="1294" y="815" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1175" y="794" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_01qtcpf_di" bpmnElement="IntermediateThrowEvent_01vy71e"> + <dc:Bounds x="1294" y="797" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1271" y="837" width="86" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17b01zs_di" bpmnElement="SequenceFlow_17b01zs"> + <di:waypoint xsi:type="dc:Point" x="1046" y="1147" /> + <di:waypoint xsi:type="dc:Point" x="895" y="1147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="925.5" y="1126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_197wgz2_di" bpmnElement="IntermediateThrowEvent_0ow0ck5"> + <dc:Bounds x="71" y="905" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="49" y="945" width="82" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0homduu_di" bpmnElement="SequenceFlow_0homduu"> + <di:waypoint xsi:type="dc:Point" x="107" y="923" /> + <di:waypoint xsi:type="dc:Point" x="204" y="923" /> + <di:waypoint xsi:type="dc:Point" x="204" y="955" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="111" y="902" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_03gc5du_di" bpmnElement="IntermediateCatchEvent_03gc5du"> + <dc:Bounds x="57" y="1238" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="36" y="1278" width="82" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0t5f2dt_di" bpmnElement="SequenceFlow_0t5f2dt"> + <di:waypoint xsi:type="dc:Point" x="93" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="154" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="154" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="214" y="1256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="124" y="1250" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_18ardb3_di" bpmnElement="ExclusiveGateway_ServiceResourceIsFinish" isMarkerVisible="true"> + <dc:Bounds x="179" y="955" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="196" y="911" width="88" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0n7qeqt_di" bpmnElement="SequenceFlow_0n7qeqt"> + <di:waypoint xsi:type="dc:Point" x="229" y="980" /> + <di:waypoint xsi:type="dc:Point" x="311" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="263" y="959" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_01wud4g_di" bpmnElement="ScriptTask_preProcessDecomposeNextResource"> + <dc:Bounds x="311" y="940" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1a5ki3p_di" bpmnElement="SequenceFlow_1a5ki3p"> + <di:waypoint xsi:type="dc:Point" x="411" y="980" /> + <di:waypoint xsi:type="dc:Point" x="470" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="395.5" y="959" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_06p63xt_di" bpmnElement="ScriptTask_postProcessDecomposeNextResource"> + <dc:Bounds x="795" y="1107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gxv0wp_di" bpmnElement="SequenceFlow_0gxv0wp"> + <di:waypoint xsi:type="dc:Point" x="795" y="1147" /> + <di:waypoint xsi:type="dc:Point" x="612" y="1147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="658.5" y="1126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_01fw8bb_di" bpmnElement="IntermediateThrowEvent_01fw8bb"> + <dc:Bounds x="186" y="1061" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="166" y="1101" width="82" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13c2v9z_di" bpmnElement="SequenceFlow_13c2v9z"> + <di:waypoint xsi:type="dc:Point" x="204" y="1005" /> + <di:waypoint xsi:type="dc:Point" x="204" y="1061" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="219" y="1014" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_052agzc_di" bpmnElement="ExclusiveGateway_052agzc" isMarkerVisible="true"> + <dc:Bounds x="336" y="693" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="253" y="691" width="88" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1t1mg6y_di" bpmnElement="SequenceFlow_1t1mg6y"> + <di:waypoint xsi:type="dc:Point" x="361" y="657" /> + <di:waypoint xsi:type="dc:Point" x="361" y="693" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="331" y="669" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0a1q5fw_di" bpmnElement="SequenceFlow_0a1q5fw"> + <di:waypoint xsi:type="dc:Point" x="361" y="743" /> + <di:waypoint xsi:type="dc:Point" x="361" y="784" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="367" y="758" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0plkf6p_di" bpmnElement="ExclusiveGateway_0plkf6p" isMarkerVisible="true"> + <dc:Bounds x="505" y="693" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="485" y="747" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lv9vmb_di" bpmnElement="SequenceFlow_1lv9vmb"> + <di:waypoint xsi:type="dc:Point" x="530" y="693" /> + <di:waypoint xsi:type="dc:Point" x="530" y="618" /> + <di:waypoint xsi:type="dc:Point" x="657" y="618" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="500" y="650" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fac57w_di" bpmnElement="SequenceFlow_1fac57w"> + <di:waypoint xsi:type="dc:Point" x="386" y="718" /> + <di:waypoint xsi:type="dc:Point" x="505" y="718" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="439" y="697" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0u98ylh_di" bpmnElement="ExclusiveGateway_0u98ylh" isMarkerVisible="true"> + <dc:Bounds x="682" y="693" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="612" y="687" width="88" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_16r9z75_di" bpmnElement="SequenceFlow_16r9z75"> + <di:waypoint xsi:type="dc:Point" x="707" y="657" /> + <di:waypoint xsi:type="dc:Point" x="707" y="693" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="677" y="669" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0m7ks9t_di" bpmnElement="SequenceFlow_0m7ks9t"> + <di:waypoint xsi:type="dc:Point" x="707" y="743" /> + <di:waypoint xsi:type="dc:Point" x="707" y="775" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="713" y="753" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_125wehq_di" bpmnElement="ExclusiveGateway_125wehq" isMarkerVisible="true"> + <dc:Bounds x="888" y="693" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="868" y="747" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0akcnw7_di" bpmnElement="SequenceFlow_0akcnw7"> + <di:waypoint xsi:type="dc:Point" x="913" y="693" /> + <di:waypoint xsi:type="dc:Point" x="913" y="617" /> + <di:waypoint xsi:type="dc:Point" x="1055" y="617" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="919" y="649" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00knko8_di" bpmnElement="SequenceFlow_00knko8"> + <di:waypoint xsi:type="dc:Point" x="732" y="718" /> + <di:waypoint xsi:type="dc:Point" x="888" y="718" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="803" y="697" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1t1fier_di" bpmnElement="IntermediateCatchEvent_1t1fier"> + <dc:Bounds x="71" y="376" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="56" y="416" width="85" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_033eqeg_di" bpmnElement="SequenceFlow_033eqeg"> + <di:waypoint xsi:type="dc:Point" x="107" y="394" /> + <di:waypoint xsi:type="dc:Point" x="209" y="394" /> + <di:waypoint xsi:type="dc:Point" x="209" y="394" /> + <di:waypoint xsi:type="dc:Point" x="311" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="388" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="IntermediateThrowEvent_1q64g27_di" bpmnElement="IntermediateThrowEvent_1q64g27"> + <dc:Bounds x="1294" y="110" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1274" y="150" width="85" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00a3ijv_di" bpmnElement="SequenceFlow_00a3ijv"> + <di:waypoint xsi:type="dc:Point" x="1155" y="128" /> + <di:waypoint xsi:type="dc:Point" x="1294" y="128" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1179.5" y="107" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1fqk4c6_di" bpmnElement="ScriptTask_PrepareServiceResources"> + <dc:Bounds x="657" y="354" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11405m9_di" bpmnElement="SequenceFlow_11405m9"> + <di:waypoint xsi:type="dc:Point" x="757" y="394" /> + <di:waypoint xsi:type="dc:Point" x="810" y="394" /> + <di:waypoint xsi:type="dc:Point" x="810" y="394" /> + <di:waypoint xsi:type="dc:Point" x="863" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="780" y="388" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ut5zs5_di" bpmnElement="ScriptTask_1ut5zs5"> + <dc:Bounds x="311" y="354" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0kl5qtj_di" bpmnElement="ServiceTask_0kl5qtj"> + <dc:Bounds x="470" y="354" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1sm5x5e_di" bpmnElement="SequenceFlow_1sm5x5e"> + <di:waypoint xsi:type="dc:Point" x="411" y="394" /> + <di:waypoint xsi:type="dc:Point" x="470" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="395.5" y="373" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18wibmi_di" bpmnElement="SequenceFlow_18wibmi"> + <di:waypoint xsi:type="dc:Point" x="570" y="394" /> + <di:waypoint xsi:type="dc:Point" x="657" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="568.5" y="373" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1vlvb1r_di" bpmnElement="ScriptTask_1vlvb1r"> + <dc:Bounds x="657" y="1216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0lint2e_di" bpmnElement="ServiceTask_0lint2e"> + <dc:Bounds x="882" y="1216" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0l4qcge_di" bpmnElement="SequenceFlow_0l4qcge"> + <di:waypoint xsi:type="dc:Point" x="757" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="882" y="1256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="819.5" y="1235" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06tonva_di" bpmnElement="SequenceFlow_06tonva"> + <di:waypoint xsi:type="dc:Point" x="982" y="1256" /> + <di:waypoint xsi:type="dc:Point" x="1078" y="1256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1030" y="1235" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_06sbvjm_di" bpmnElement="ScriptTask_06sbvjm"> + <dc:Bounds x="512" y="1107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1i96ytk_di" bpmnElement="SequenceFlow_1i96ytk"> + <di:waypoint xsi:type="dc:Point" x="512" y="1147" /> + <di:waypoint xsi:type="dc:Point" x="411" y="1147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="461.5" y="1126" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0bia9bb_di" bpmnElement="ServiceTask_0bia9bb"> + <dc:Bounds x="311" y="1107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0eoibq3_di" bpmnElement="SequenceFlow_0eoibq3"> + <di:waypoint xsi:type="dc:Point" x="311" y="1147" /> + <di:waypoint xsi:type="dc:Point" x="106" y="1147" /> + <di:waypoint xsi:type="dc:Point" x="106" y="980" /> + <di:waypoint xsi:type="dc:Point" x="179" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="121" y="1057.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0mjvi2p_di" bpmnElement="ScriptTask_0mjvi2p"> + <dc:Bounds x="470" y="940" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1oo4g4h_di" bpmnElement="SequenceFlow_1oo4g4h"> + <di:waypoint xsi:type="dc:Point" x="570" y="980" /> + <di:waypoint xsi:type="dc:Point" x="638" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="604" y="959" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1kavnc9_di" bpmnElement="ExclusiveGateway_1kavnc9" isMarkerVisible="true"> + <dc:Bounds x="1071" y="693" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1051" y="747" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1w2n8dn_di" bpmnElement="SequenceFlow_1w2n8dn"> + <di:waypoint xsi:type="dc:Point" x="1096" y="743" /> + <di:waypoint xsi:type="dc:Point" x="1095" y="775" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1095.5" y="738" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15pzf5n_di" bpmnElement="SequenceFlow_15pzf5n"> + <di:waypoint xsi:type="dc:Point" x="938" y="718" /> + <di:waypoint xsi:type="dc:Point" x="1005" y="718" /> + <di:waypoint xsi:type="dc:Point" x="1005" y="718" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="718" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1020" y="712" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0vk2b9b_di" bpmnElement="ServiceTask_0vk2b9b"> + <dc:Bounds x="638" y="940" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1bx4es4_di" bpmnElement="SequenceFlow_1bx4es4"> + <di:waypoint xsi:type="dc:Point" x="738" y="980" /> + <di:waypoint xsi:type="dc:Point" x="831" y="980" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="784.5" y="959" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0w4scer_di" bpmnElement="ScriptTask_0w4scer"> + <dc:Bounds x="863" y="354" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15d5odq_di" bpmnElement="SequenceFlow_15d5odq"> + <di:waypoint xsi:type="dc:Point" x="963" y="394" /> + <di:waypoint xsi:type="dc:Point" x="1055" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="964" y="373" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1mg7vnx_di" bpmnElement="ServiceTask_1mg7vnx"> + <dc:Bounds x="1055" y="354" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qzxy2i_di" bpmnElement="SequenceFlow_1qzxy2i"> + <di:waypoint xsi:type="dc:Point" x="1155" y="394" /> + <di:waypoint xsi:type="dc:Point" x="1294" y="394" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1224.5" y="373" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml index dead7d02d8..c17015c003 100644 --- a/bpmn/MSORESTClient/pom.xml +++ b/bpmn/MSORESTClient/pom.xml @@ -22,11 +22,6 @@ <artifactId>httpmime</artifactId>
<version>4.5</version>
</dependency>
- <dependency>
- <groupId>com.metaparadigm</groupId>
- <artifactId>json-rpc</artifactId>
- <version>1.0</version>
- </dependency>
<dependency>
<groupId>org.mockito</groupId>
diff --git a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java index 3d181e35b4..963554191e 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java +++ b/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java @@ -172,6 +172,7 @@ public enum MessageEnum implements EELFResolvableErrorEnum{ ASDC_GENERAL_EXCEPTION_ARG,
ASDC_GENERAL_EXCEPTION,
ASDC_GENERAL_WARNING,
+ ASDC_GENERAL_INFO,
ASDC_AUDIT_EXEC,
ASDC_GENERAL_METRICS,
ASDC_CREATE_SERVICE,
diff --git a/common/src/main/resources/ASDC.properties b/common/src/main/resources/ASDC.properties index 015ca3510e..4f3864dac2 100644 --- a/common/src/main/resources/ASDC.properties +++ b/common/src/main/resources/ASDC.properties @@ -208,3 +208,8 @@ ASDC_PROPERTIES_NOT_FOUND=\ Please verify whether properties file exist or readable|\ Please verify whether properties file exist or readable|\ Properties file not found +ASDC_GENERAL_INFO=\ + MSO-ASDC-9305I|\ + INFO: {0}|\ + No resolution needed|\ + General Info diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 8b663c1394..0dc9e348e9 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -171,5 +171,11 @@ <artifactId>common</artifactId> <version>${project.version}</version> </dependency> - </dependencies> + <dependency> + <groupId>org.jmockit</groupId> + <artifactId>jmockit</artifactId> + <version>1.8</version> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index dd60bc7d9c..0219e304cb 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -155,29 +155,29 @@ public class CatalogDatabase implements Closeable { * @return A list of HeatTemplate objects */ @SuppressWarnings("unchecked") - public List <HeatTemplate> getAllHeatTemplates () { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get all Heat templates"); + public List <HeatTemplate> getAllHeatTemplates() { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get all Heat templates"); String hql = "FROM HeatTemplate"; - Query query = getSession ().createQuery (hql); + Query query = getSession().createQuery(hql); - List <HeatTemplate> result = query.list (); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null); + List <HeatTemplate> result = query.list(); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllHeatTemplates", null); return result; } /** * Fetch a specific Heat Template by ID. * - * @param templateId + * @param templateId template id * @return HeatTemplate object or null if none found */ @Deprecated - public HeatTemplate getHeatTemplate (int templateId) { - long startTime = System.currentTimeMillis (); + public HeatTemplate getHeatTemplate(int templateId) { + long startTime = System.currentTimeMillis(); LOGGER.debug ("Catalog database - get Heat template with id " + templateId); - HeatTemplate template = (HeatTemplate) getSession ().get (HeatTemplate.class, templateId); + HeatTemplate template = (HeatTemplate) getSession().get(HeatTemplate.class, templateId); LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); return template; } @@ -185,31 +185,31 @@ public class CatalogDatabase implements Closeable { /** * Return the newest version of a specific Heat Template (queried by Name). * - * @param templateName + * @param templateName template name * @return HeatTemplate object or null if none found */ - public HeatTemplate getHeatTemplate (String templateName) { + public HeatTemplate getHeatTemplate(String templateName) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Heat template with name " + templateName); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Heat template with name " + templateName); String hql = "FROM HeatTemplate WHERE templateName = :template_name"; - Query query = getSession ().createQuery (hql); - query.setParameter ("template_name", templateName); + Query query = getSession().createQuery (hql); + query.setParameter("template_name", templateName); @SuppressWarnings("unchecked") - List <HeatTemplate> resultList = query.list (); + List <HeatTemplate> resultList = query.list(); // See if something came back. Name is unique, so if (resultList.isEmpty ()) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found", "CatalogDB", "getHeatTemplate", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get(0); } /** @@ -219,29 +219,29 @@ public class CatalogDatabase implements Closeable { * @param version * @return HeatTemplate object or null if none found */ - public HeatTemplate getHeatTemplate (String templateName, String version) { + public HeatTemplate getHeatTemplate(String templateName, String version) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Heat template with name " + templateName + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Heat template with name " + templateName + " and version " + version); String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version"; - Query query = getSession ().createQuery (hql); - query.setParameter ("template_name", templateName); - query.setParameter ("version", version); + Query query = getSession().createQuery(hql); + query.setParameter("template_name", templateName); + query.setParameter("version", version); @SuppressWarnings("unchecked") - List <HeatTemplate> resultList = query.list (); + List <HeatTemplate> resultList = query.list(); // See if something came back. - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found.", "CatalogDB", "getHeatTemplate", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. No template found.", "CatalogDB", "getHeatTemplate", null); return null; } // Name + Version is unique, so should only be one element - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplate", null); + return resultList.get(0); } /** @@ -266,10 +266,10 @@ public class CatalogDatabase implements Closeable { * * @param artifactUuid * @return HeatTemplate object or null if none found - */ + */ public HeatTemplate getHeatTemplateByArtifactUuidRegularQuery(String artifactUuid) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Heat template (regular query) with artifactUuid " + artifactUuid); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Heat template (regular query) with artifactUuid " + artifactUuid); String hql = "FROM HeatTemplate WHERE artifactUuid = :artifactUuidValue"; HashMap<String, String> variables = new HashMap<>(); @@ -277,9 +277,9 @@ public class CatalogDatabase implements Closeable { HeatTemplate template = (HeatTemplate) this.executeQuerySingleRow(hql, variables, true); if (template == null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getHeatTemplateByArtifactUuidRegularQuery", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getHeatTemplateByArtifactUuidRegularQuery", null); } else { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplateByArtifactUuidRegularQuery", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatTemplateByArtifactUuidRegularQuery", null); } return template; } @@ -314,19 +314,18 @@ public class CatalogDatabase implements Closeable { * @return HeatEnvironment object or null if none found */ public HeatEnvironment getHeatEnvironmentByArtifactUuid(String artifactUuid) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Heat Environment with artifactUuid " + artifactUuid); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Heat Environment with artifactUuid " + artifactUuid); String hql = "FROM HeatEnvironment WHERE artifactUuid = :artifactUuidValue"; Query query = getSession().createQuery(hql); - query.setParameter ("artifactUuidValue", artifactUuid); + query.setParameter("artifactUuidValue", artifactUuid); HeatEnvironment environment = null; try { - environment = (HeatEnvironment) query.uniqueResult (); + environment = (HeatEnvironment) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row for Envt - data integrity error: artifactUuid='" + artifactUuid +"'", nure); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for heatEnvironment artifactUuid=" + artifactUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for artifactUuid==" + artifactUuid); - environment = null; } catch (org.hibernate.HibernateException he) { LOGGER.debug("Hibernate Exception - while searching for envt: artifactUuid='" + artifactUuid + "' " + he.getMessage()); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching envt for artifactUuid=" + artifactUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching envt for artifactUuid=" + artifactUuid); @@ -352,11 +351,11 @@ public class CatalogDatabase implements Closeable { */ public Service getServiceByInvariantUUID (String modelInvariantUUID) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get service with Invariant UUID " + modelInvariantUUID); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get service with Invariant UUID " + modelInvariantUUID); String hql = "FROM Service WHERE modelInvariantUUID = :model_invariant_uuid"; - Query query = getSession ().createQuery (hql); + Query query = getSession().createQuery(hql); query.setParameter ("model_invariant_uuid", modelInvariantUUID); @SuppressWarnings("unchecked") @@ -379,16 +378,16 @@ public class CatalogDatabase implements Closeable { */ public Service getService (String modelName) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get service with name " + modelName); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get service with name " + modelName); String hql = "FROM Service WHERE modelName = :MODEL_NAME"; - Query query = getSession ().createQuery (hql); - query.setParameter ("MODEL_NAME", modelName); + Query query = getSession().createQuery(hql); + query.setParameter("MODEL_NAME", modelName); Service service = null; try { - service = (Service) query.uniqueResult (); + service = (Service) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelName='" + modelName + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelName=" + modelName, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelName=" + modelName); @@ -413,8 +412,8 @@ public class CatalogDatabase implements Closeable { public Service getServiceByModelUUID (String modelUUID) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get service with Model UUID " + modelUUID); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get service with Model UUID " + modelUUID); String hql = "FROM Service WHERE modelUUID = :MODEL_UUID"; HashMap<String, String> parameters = new HashMap<>(); @@ -463,25 +462,25 @@ public class CatalogDatabase implements Closeable { LOGGER.debug ("Catalog database - get service modelUUID with id " + serviceNameVersionId); String hql = "FROM Service WHERE MODEL_UUID = :MODEL_UUID and http_method = :http_method"; - query = getSession ().createQuery (hql); - query.setParameter ("MODEL_UUID", serviceNameVersionId); + query = getSession().createQuery(hql); + query.setParameter("MODEL_UUID", serviceNameVersionId); } else { serviceId = map.get("serviceId"); serviceVersion = map.get("serviceVersion"); - LOGGER.debug ("Catalog database - get serviceId with id " + serviceId + " and serviceVersion with " + serviceVersion); + LOGGER.debug("Catalog database - get serviceId with id " + serviceId + " and serviceVersion with " + serviceVersion); String hql = "FROM Service WHERE service_id = :service_id and service_version = :service_version and http_method = :http_method"; - query = getSession ().createQuery (hql); - query.setParameter ("service_id", serviceId); - query.setParameter ("service_version", serviceVersion); + query = getSession().createQuery(hql); + query.setParameter("service_id", serviceId); + query.setParameter("service_version", serviceVersion); } - query.setParameter ("http_method", httpMethod); + query.setParameter("http_method", httpMethod); - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); Service service = null; try { - service = (Service) query.uniqueResult (); + service = (Service) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - data integrity error: service_id='" + serviceId + "', serviceVersion='" + serviceVersion + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for service_id=" + serviceId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for service_id=" + serviceId); @@ -512,37 +511,37 @@ public class CatalogDatabase implements Closeable { * @param modelName * @return Service object or null if none found */ - public Service getServiceByModelName (String modelName){ + public Service getServiceByModelName(String modelName){ - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get service with name " + modelName); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get service with name " + modelName); String hql = "FROM Service WHERE modelName = :MODEL_NAME"; - Query query = getSession ().createQuery (hql); - query.setParameter ("MODEL_NAME", modelName); + Query query = getSession().createQuery(hql); + query.setParameter("MODEL_NAME", modelName); @SuppressWarnings("unchecked") - List <Service> resultList = query.list (); + List <Service> resultList = query.list(); // See if something came back. - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByModelName", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByModelName", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator ()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByModelName", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByModelName", null); + return resultList.get(0); } public Service getServiceByVersionAndInvariantId(String modelInvariantId, String modelVersion) throws Exception { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get service with modelInvariantId: " + modelInvariantId + " and modelVersion: " + modelVersion); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get service with modelInvariantId: " + modelInvariantId + " and modelVersion: " + modelVersion); String hql = "FROM Service WHERE modelInvariantUUID = :MODEL_INVARIANT_UUID AND version = :VERSION_STR"; - Query query = getSession ().createQuery (hql); - query.setParameter ("MODEL_INVARIANT_UUID", modelInvariantId); + Query query = getSession().createQuery(hql); + query.setParameter("MODEL_INVARIANT_UUID", modelInvariantId); query.setParameter("VERSION_STR", modelVersion); Service result = null; @@ -555,11 +554,11 @@ public class CatalogDatabase implements Closeable { } // See if something came back. if (result==null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByVersionAndInvariantId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByVersionAndInvariantId", null); return null; } - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByVersionAndInvariantId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByVersionAndInvariantId", null); return result; } @@ -615,67 +614,67 @@ public class CatalogDatabase implements Closeable { * @param action * * @return ServiceRecipe object or null if none found */ - public ServiceRecipe getServiceRecipeByServiceModelUuid (String serviceModelUuid, String action) { + public ServiceRecipe getServiceRecipeByServiceModelUuid(String serviceModelUuid, String action) { StringBuilder hql; if(action == null){ - hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid"); + hql = new StringBuilder("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid"); }else { - hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid AND action = :action "); + hql = new StringBuilder("FROM ServiceRecipe WHERE serviceModelUuid = :serviceModelUuid AND action = :action "); } long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Service recipe with serviceModelUuid " + serviceModelUuid + LOGGER.debug("Catalog database - get Service recipe with serviceModelUuid " + serviceModelUuid + " and action " + action ); - Query query = getSession ().createQuery (hql.toString ()); - query.setParameter ("serviceModelUuid", serviceModelUuid); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); if(action != null){ - query.setParameter (ACTION, action); + query.setParameter(ACTION, action); } @SuppressWarnings("unchecked") - List <ServiceRecipe> resultList = query.list (); + List <ServiceRecipe> resultList = query.list(); - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipe", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipe", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipe", null); + return resultList.get(0); } - public List<ServiceRecipe> getServiceRecipes (String serviceModelUuid) { + public List<ServiceRecipe> getServiceRecipes(String serviceModelUuid) { StringBuilder hql; - hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceModelUUID = :serviceModelUUID"); + hql = new StringBuilder("FROM ServiceRecipe WHERE serviceModelUUID = :serviceModelUUID"); - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get Service recipe with serviceModelUUID " + serviceModelUuid); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Service recipe with serviceModelUUID " + serviceModelUuid); - Query query = getSession ().createQuery (hql.toString ()); - query.setParameter ("serviceModelUUID", serviceModelUuid); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUUID", serviceModelUuid); @SuppressWarnings("unchecked") - List <ServiceRecipe> resultList = query.list (); + List <ServiceRecipe> resultList = query.list(); - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipes", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipes", null); return Collections.EMPTY_LIST; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipes", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipes", null); return resultList; } @@ -734,48 +733,48 @@ public class CatalogDatabase implements Closeable { */ public VnfResource getVnfResource (String vnfType) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get vnf resource with model_name " + vnfType); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get vnf resource with model_name " + vnfType); String hql = "FROM VnfResource WHERE modelName = :vnf_name"; - Query query = getSession ().createQuery (hql); - query.setParameter ("vnf_name", vnfType); + Query query = getSession().createQuery(hql); + query.setParameter("vnf_name", vnfType); @SuppressWarnings("unchecked") - List <VnfResource> resultList = query.list (); + List <VnfResource> resultList = query.list(); // See if something came back. Name is unique, so - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF not found", "CatalogDB", "getVnfResource", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF not found", "CatalogDB", "getVnfResource", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null); + return resultList.get(0); } /** * Return the newest version of a specific VNF resource (queried by Name). * * @param vnfType - * @param version + * @param serviceVersion * @return VnfResource object or null if none found */ public VnfResource getVnfResource (String vnfType, String serviceVersion) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VNF resource with model_name " + vnfType + " and version=" + serviceVersion); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get VNF resource with model_name " + vnfType + " and version=" + serviceVersion); String hql = "FROM VnfResource WHERE modelName = :vnfName and version = :serviceVersion"; - Query query = getSession ().createQuery (hql); - query.setParameter ("vnfName", vnfType); - query.setParameter ("serviceVersion", serviceVersion); + Query query = getSession().createQuery(hql); + query.setParameter("vnfName", vnfType); + query.setParameter("serviceVersion", serviceVersion); VnfResource resource = null; try { - resource = (VnfResource) query.uniqueResult (); + resource = (VnfResource) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vnfType='" + vnfType + "', serviceVersion='" + serviceVersion + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnfType=" + vnfType + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnfType=" + vnfType); @@ -808,22 +807,22 @@ public class CatalogDatabase implements Closeable { * @param modelCustomizationId * @return VnfResource object or null if none found */ - public VnfResource getVnfResourceByModelCustomizationId (String modelCustomizationId) { + public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); String hql = "SELECT vr " + "FROM VnfResource as vr JOIN vr.vnfResourceCustomizations as vrc " + "WHERE vrc.modelCustomizationUuid = :modelCustomizationId"; - Query query = getSession ().createQuery (hql); - query.setParameter ("modelCustomizationId", modelCustomizationId); + Query query = getSession().createQuery(hql); + query.setParameter("modelCustomizationId", modelCustomizationId); VnfResource resource = null; try { - resource = (VnfResource) query.uniqueResult (); - } catch (org.hibernate.NonUniqueResultException nure) { + resource = (VnfResource) query.uniqueResult(); + } catch(org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationId + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationId, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationId=" + modelCustomizationId); @@ -840,9 +839,9 @@ public class CatalogDatabase implements Closeable { throw e; } if (resource == null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResourceByModelCustomizationId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResourceByModelCustomizationId", null); } else { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceByModelCustomizationId", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceByModelCustomizationId", null); } return resource; } @@ -855,53 +854,54 @@ public class CatalogDatabase implements Closeable { */ public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationName (String modelCustomizationName, String modelVersionId) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VNF resource Customization with modelCustomizationName " + modelCustomizationName + " serviceModelUUID " + modelVersionId); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get VNF resource Customization with modelCustomizationName " + modelCustomizationName + " serviceModelUUID " + modelVersionId); String hql = "SELECT vrc FROM VnfResourceCustomization as vrc WHERE vrc.modelCustomizationUuid IN " + "(SELECT src.resourceModelCustomizationUUID FROM ServiceToResourceCustomization src " + "WHERE src.serviceModelUUID = :modelVersionId)" + "AND vrc.modelInstanceName = :modelCustomizationName"; - Query query = getSession ().createQuery (hql); - query.setParameter ("modelCustomizationName", modelCustomizationName); - query.setParameter ("modelVersionId", modelVersionId); + Query query = getSession().createQuery(hql); + query.setParameter("modelCustomizationName", modelCustomizationName); + query.setParameter("modelVersionId", modelVersionId); @SuppressWarnings("unchecked") - List <VnfResourceCustomization> resultList = query.list (); + List<VnfResourceCustomization> resultList = query.list(); - if (resultList.isEmpty ()) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VnfResourceCustomization not found", "CatalogDB", "getVnfResourceCustomizationByModelCustomizationName", null); + if (resultList.isEmpty()) { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VnfResourceCustomization not found", "CatalogDB", "getVnfResourceCustomizationByModelCustomizationName", null); return null; } - Collections.sort (resultList, new MavenLikeVersioningComparator ()); - Collections.reverse (resultList); + Collections.sort(resultList, new MavenLikeVersioningComparator()); + Collections.reverse(resultList); - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceCustomizationByModelCustomizationName", null); - return resultList.get (0); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResourceCustomizationByModelCustomizationName", null); + return resultList.get(0); } /** * Return the newest version of a specific VNF resource (queried by modelInvariantId). * - * @param version + * @param modelInvariantUuid model invariant ID + * @param modelVersion model version * @return VnfResource object or null if none found */ public VnfResource getVnfResourceByModelInvariantId(String modelInvariantUuid, String modelVersion) { - long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VNF resource with modelInvariantUuid " + modelInvariantUuid); + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get VNF resource with modelInvariantUuid " + modelInvariantUuid); String hql = "FROM VnfResource WHERE modelInvariantUuid = :modelInvariantUuid and version = :serviceVersion"; - Query query = getSession ().createQuery (hql); - query.setParameter ("modelInvariantUuid", modelInvariantUuid); - query.setParameter ("serviceVersion", modelVersion); + Query query = getSession().createQuery(hql); + query.setParameter("modelInvariantUuid", modelInvariantUuid); + query.setParameter("serviceVersion", modelVersion); VnfResource resource = null; try { - resource = (VnfResource) query.uniqueResult (); + resource = (VnfResource) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantUuid='" + modelInvariantUuid + "', serviceVersion='" + modelVersion + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelInvariantUuid=" + modelInvariantUuid + " and serviceVersion=" + modelVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelInvariantUuid=" + modelInvariantUuid); @@ -4880,7 +4880,7 @@ public class CatalogDatabase implements Closeable { } public < E > E executeQuerySingleRow(String hql, HashMap<String, String> variables, boolean retry) { - long startTime = System.currentTimeMillis (); + long startTime = System.currentTimeMillis(); LOGGER.debug("Catalog database - executeQuery: " + hql + (retry ? ", retry=true" : ", retry=false")); Query query = getSession().createQuery(hql); @@ -4895,7 +4895,7 @@ public class CatalogDatabase implements Closeable { E theObject = null; try { - theObject = (E) query.uniqueResult (); + theObject = (E) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for " + hql, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for " + hql ); diff --git a/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml index d806b48b45..cd37fc9a99 100644 --- a/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml +++ b/mso-catalog-db/src/main/resources/ServiceToResourceCustomization.hbm.xml @@ -29,11 +29,11 @@ <composite-id>
<key-property name="modelType" type="string" column="MODEL_TYPE" length="20" />
<key-property name="resourceModelCustomizationUUID" type="string" column="RESOURCE_MODEL_CUSTOMIZATION_UUID" length="200" />
+ <key-property name="serviceModelUUID" type="string" column="SERVICE_MODEL_UUID" length="200" />
</composite-id>
<property name="created" type="timestamp" generated="insert" update="false" insert="false" not-null="true">
<column name="CREATION_TIMESTAMP" default="CURRENT_TIMESTAMP"/>
</property>
- <property name="serviceModelUUID" type="string" column="SERVICE_MODEL_UUID" length="200" not-null="true"/>
</class>
</hibernate-mapping>
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 a00079d8a9..219e70ea87 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 @@ -1,757 +1,2009 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.db.catalog.test;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResource;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
-import org.openecomp.mso.db.catalog.beans.HeatFiles;
-import org.openecomp.mso.db.catalog.beans.HeatTemplate;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
-import org.openecomp.mso.db.catalog.beans.NetworkResource;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
-import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
-import org.openecomp.mso.db.catalog.beans.VnfComponent;
-import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
-import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
-
-public class CatalogDatabaseTest {
-
- CatalogDatabase cd = null;
-
- @Before
- public void setup(){
- cd = CatalogDatabase.getInstance();
- }
- @Test(expected = Exception.class)
- public void getAllHeatTemplatesTestException(){
- List <HeatTemplate> list = cd.getAllHeatTemplates();
- }
-
- @Test(expected = Exception.class)
- public void getHeatTemplateTestException(){
- HeatTemplate ht = cd.getHeatTemplate(10);
- }
-
- @Test(expected = Exception.class)
- public void getHeatTemplateTest2Exception(){
- HeatTemplate ht = cd.getHeatTemplate("heat123");
- }
-
- @Test(expected = Exception.class)
- public void getHeatTemplateTest3Exception(){
- HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
- }
-
- @Test(expected = Exception.class)
- public void getHeatTemplateByArtifactUuidException(){
- HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
- }
-
- @Test(expected = Exception.class)
- public void getHeatTemplateByArtifactUuidRegularQueryException(){
- HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123");
- }
-
- @Test(expected = Exception.class)
- public void getParametersForHeatTemplateTestException(){
- List<HeatTemplateParam> ht = cd.getParametersForHeatTemplate("123");
- }
-
- @Test(expected = Exception.class)
- public void getHeatEnvironmentByArtifactUuidTestException(){
- HeatEnvironment ht = cd.getHeatEnvironmentByArtifactUuid("123");
- }
-
- @Test(expected = Exception.class)
- public void getServiceByInvariantUUIDTestException(){
- Service ht = cd.getServiceByInvariantUUID("123");
- }
-
- @Test(expected = Exception.class)
- public void getServiceTestException(){
- Service ht = cd.getService("123");
- }
-
- @Test(expected = Exception.class)
- public void getServiceByModelUUIDTestException(){
- Service ht = cd.getServiceByModelUUID("123");
- }
-
- @Test(expected = Exception.class)
- public void getService2TestException(){
- HashMap<String, String> map = new HashMap<>();
- map.put("serviceNameVersionId", "v2");
- Service ht = cd.getService(map, "123");
- }
-
- @Test(expected = Exception.class)
- public void getServiceByModelNameTestException(){
- Service ht = cd.getServiceByModelName("123");
- }
-
- @Test(expected = Exception.class)
- public void getServiceByVersionAndInvariantIdTestException() throws Exception{
- Service ht = cd.getServiceByVersionAndInvariantId("123","tetwe");
- }
-
- @Test(expected = Exception.class)
- public void getServiceRecipeTestException() throws Exception{
- ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
- }
-
- @Test(expected = Exception.class)
- public void getServiceRecipeByServiceModelUuidTestException() throws Exception{
- ServiceRecipe ht = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
- }
-
- @Test(expected = Exception.class)
- public void getServiceRecipesTestException() throws Exception{
- List<ServiceRecipe> ht = cd.getServiceRecipes("123");
- }
-
- @Test(expected = Exception.class)
- public void getVnfComponentTestException() throws Exception{
- VnfComponent ht = cd.getVnfComponent(123,"vnf");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResourceTestException() throws Exception{
- VnfResource ht = cd.getVnfResource("vnf");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResource2TestException() throws Exception{
- VnfResource ht = cd.getVnfResource("vnf","3992");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResourceByModelCustomizationIdTestException() throws Exception{
- VnfResource ht = cd.getVnfResourceByModelCustomizationId("3992");
- }
-
- @Test(expected = Exception.class)
- public void getServiceRecipeTest2Exception() throws Exception{
- ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelCustomizationNameTestException(){
- VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResourceByModelInvariantIdTestException(){
- VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
- }
-
- @Test(expected = Exception.class)
- public void getVnfResourceByIdTestException(){
- VnfResource vnf = cd.getVnfResourceById(19299);
- }
-
- @Test(expected = Exception.class)
- public void getVfModuleModelNameTestException(){
- VfModule vnf = cd.getVfModuleModelName("tetes");
- }
-
- @Test(expected = Exception.class)
- public void getVfModuleModelName2TestException(){
- VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl");
- }
-
- @Test(expected = Exception.class)
- public void ggetVfModuleCustomizationByModelNameTestException(){
- VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes");
- }
-
- @Test(expected = Exception.class)
- public void getNetworkResourceTestException(){
- NetworkResource vnf = cd.getNetworkResource("tetes");
- }
-
- @Test(expected = Exception.class)
- public void getVnfRecipeTestException(){
- VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493");
- }
-
- @Test(expected = Exception.class)
- public void getVnfRecipe2TestException(){
- VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493");
- }
-
- @Test(expected = Exception.class)
- public void getVnfRecipeByVfModuleIdTestException(){
- VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
- }
-
- @Test(expected = Exception.class)
- public void getVfModuleTypeTestException(){
- VfModule vnf = cd.getVfModuleType("4993493");
- }
-
- @Test(expected = Exception.class)
- public void getVfModuleType2TestException(){
- VfModule vnf = cd.getVfModuleType("4993493","vnf");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceByServiceUuidTestException(){
- VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceByVnfUuidTestException(){
- VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelInvariantUuidTestException(){
- VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationUuidTestException(){
- VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
- VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
- }
- @Test(expected = Exception.class)
- public void getVfModuleCustomizationByModelCustomizationIdTestException(){
- VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelUuidTestException(){
- VfModule vnf = cd.getVfModuleByModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
- VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelVersionIdTestException(){
- VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationIdAndVersionTestException(){
- cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
- cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationByModelInvariantIdTest(){
- cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
- }
- @Test(expected = Exception.class)
- public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
- cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
- cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getAllVfModuleCustomizationstest(){
- cd.getAllVfModuleCustomizations("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceByModelUuidTest(){
- cd.getVnfResourceByModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResCustomToVfModuleTest(){
- cd.getVnfResCustomToVfModule("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getVfModulesForVnfResourceTest(){
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelUuid("48839");
- cd.getVfModulesForVnfResource(vnfResource);
- }
- @Test(expected = Exception.class)
- public void getVfModulesForVnfResource2Test(){
- cd.getVfModulesForVnfResource("4993493");
- }
- @Test(expected = Exception.class)
- public void getServiceByUuidTest(){
- cd.getServiceByUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getNetworkResourceById2Test(){
- cd.getNetworkResourceById(4993493);
- }
- @Test(expected = Exception.class)
- public void getNetworkResourceByIdTest(){
- cd.getVfModuleTypeByUuid("4993493");
- }
- @Test
- public void isEmptyOrNullTest(){
- boolean is = cd.isEmptyOrNull("4993493");
- assertFalse(is);
- }
- @Test(expected = Exception.class)
- public void getSTRTest(){
- cd.getSTR("4993493","test","vnf");
- }
- @Test(expected = Exception.class)
- public void getVRCtoVFMCTest(){
- cd.getVRCtoVFMC("4993493","388492");
- }
- @Test(expected = Exception.class)
- public void getVfModuleTypeByUuidTestException(){
- cd.getVfModuleTypeByUuid("4993493");
- }
-
- @Test(expected = Exception.class)
- public void getTempNetworkHeatTemplateLookupTest(){
- cd.getTempNetworkHeatTemplateLookup("4993493");
- }
-
- @Test(expected = Exception.class)
- public void getAllNetworksByServiceModelUuidTest(){
- cd.getAllNetworksByServiceModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllNetworksByServiceModelInvariantUuidTest(){
- cd.getAllNetworksByServiceModelInvariantUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllNetworksByServiceModelInvariantUuid2Test(){
- cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getAllNetworksByNetworkModelCustomizationUuidTest(){
- cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllNetworksByNetworkTypeTest(){
- cd.getAllNetworksByNetworkType("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllVfmcForVrcTest(){
- VnfResourceCustomization re = new VnfResourceCustomization();
- re.setModelCustomizationUuid("377483");
- cd.getAllVfmcForVrc(re);
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByServiceModelUuidTest(){
- cd.getAllVnfsByServiceModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByServiceModelInvariantUuidTest(){
- cd.getAllVnfsByServiceModelInvariantUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByServiceModelInvariantUuid2Test(){
- cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByServiceNameTest(){
- cd.getAllVnfsByServiceName("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByServiceName2Test(){
- cd.getAllVnfsByServiceName("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllVnfsByVnfModelCustomizationUuidTest(){
- cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelUuidTest(){
- cd.getAllAllottedResourcesByServiceModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
- cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
- cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
- cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllottedResourceByModelUuidTest(){
- cd.getAllottedResourceByModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllResourcesByServiceModelUuidTest(){
- cd.getAllResourcesByServiceModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllResourcesByServiceModelInvariantUuidTest(){
- cd.getAllResourcesByServiceModelInvariantUuid("4993493");
- }
-
- @Test(expected = Exception.class)
- public void getAllResourcesByServiceModelInvariantUuid2Test(){
- cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getSingleNetworkByModelCustomizationUuidTest(){
- cd.getSingleNetworkByModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getSingleAllottedResourceByModelCustomizationUuidTest(){
- cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
- }
- @Test(expected = Exception.class)
- public void getVfModuleRecipeTest(){
- cd.getVfModuleRecipe("4993493","test","get");
- }
- @Test(expected = Exception.class)
- public void getVfModuleTest(){
- cd.getVfModule("4993493","test","get","v2","vnf");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentsRecipeTest(){
- cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentsRecipeByVfModuleTest(){
- List <VfModule> resultList = new ArrayList<>();
- VfModule m = new VfModule();
- resultList.add(m);
- cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
- }
- @Test(expected = Exception.class)
- public void getAllVnfResourcesTest(){
- cd.getAllVnfResources();
- }
- @Test(expected = Exception.class)
- public void getVnfResourcesByRoleTest(){
- cd.getVnfResourcesByRole("4993493");
- }
- @Test(expected = Exception.class)
- public void getVnfResourceCustomizationsByRoleTest(){
- cd.getVnfResourceCustomizationsByRole("4993493");
- }
- @Test(expected = Exception.class)
- public void getAllNetworkResourcesTest(){
- cd.getAllNetworkResources();
- }
- @Test(expected = Exception.class)
- public void getAllNetworkResourceCustomizationsTest(){
- cd.getAllNetworkResourceCustomizations();
- }
- @Test(expected = Exception.class)
- public void getAllVfModulesTest(){
- cd.getAllVfModules();
- }
- @Test(expected = Exception.class)
- public void getAllVfModuleCustomizationsTest(){
- cd.getAllVfModuleCustomizations();
- }
- @Test(expected = Exception.class)
- public void getAllHeatEnvironmentTest(){
- cd.getAllHeatEnvironment();
- }
- @Test(expected = Exception.class)
- public void getHeatEnvironment2Test(){
- cd.getHeatEnvironment(4993493);
- }
- @Test(expected = Exception.class)
- public void getNestedTemplatesTest(){
- cd.getNestedTemplates(4993493);
- }
- @Test(expected = Exception.class)
- public void getNestedTemplates2Test(){
- cd.getNestedTemplates("4993493");
- }
- @Test(expected = Exception.class)
- public void getHeatFilesTest(){
- cd.getHeatFiles(4993493);
- }
- @Test(expected = Exception.class)
- public void getVfModuleToHeatFilesEntryTest(){
- cd.getVfModuleToHeatFilesEntry("4993493","49959499");
- }
- @Test(expected = Exception.class)
- public void getServiceToResourceCustomization(){
- cd.getServiceToResourceCustomization("4993493","599349","49900");
- }
- @Test(expected = Exception.class)
- public void getHeatFilesForVfModuleTest(){
- cd.getHeatFilesForVfModule("4993493");
- }
- @Test(expected = Exception.class)
- public void getHeatTemplateTest(){
- cd.getHeatTemplate("4993493","test","heat");
- }
-
- @Test(expected = Exception.class)
- public void saveHeatTemplateTest(){
- HeatTemplate heat = new HeatTemplate();
- Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>();
- cd.saveHeatTemplate(heat,paramSet);
- }
- @Test(expected = Exception.class)
- public void getHeatEnvironmentTest(){
- cd.getHeatEnvironment("4993493","test","heat");
- }
- @Test(expected = Exception.class)
- public void getHeatEnvironment3Test(){
- cd.getHeatEnvironment("4993493","test");
- }
- @Test(expected = Exception.class)
- public void saveHeatEnvironmentTest(){
- HeatEnvironment en = new HeatEnvironment();
- cd.saveHeatEnvironment(en);
- }
- @Test(expected = Exception.class)
- public void saveHeatTemplate2Test(){
- HeatTemplate heat = new HeatTemplate();
- cd.saveHeatTemplate(heat);
- }
- @Test(expected = Exception.class)
- public void saveHeatFileTest(){
- HeatFiles hf = new HeatFiles();
- cd.saveHeatFile(hf);
- }
- @Test(expected = Exception.class)
- public void saveVnfRecipeTest(){
- VnfRecipe vr = new VnfRecipe();
- cd.saveVnfRecipe(vr);
- }
- @Test(expected = Exception.class)
- public void saveVnfComponentsRecipe(){
- VnfComponentsRecipe vr = new VnfComponentsRecipe();
- cd.saveVnfComponentsRecipe(vr);
- }
- @Test(expected = Exception.class)
- public void saveOrUpdateVnfResourceTest(){
- VnfResource vr = new VnfResource();
- cd.saveOrUpdateVnfResource(vr);
- }
- @Test(expected = Exception.class)
- public void saveVnfResourceCustomizationTest(){
- VnfResourceCustomization vr = new VnfResourceCustomization();
- cd.saveVnfResourceCustomization(vr);
- }
- @Test(expected = Exception.class)
- public void saveAllottedResourceCustomizationTest(){
- AllottedResourceCustomization arc = new AllottedResourceCustomization();
- cd.saveAllottedResourceCustomization(arc);
- }
- @Test(expected = Exception.class)
- public void saveAllottedResourceTest(){
- AllottedResource ar = new AllottedResource();
- cd.saveAllottedResource(ar);
- }
- @Test(expected = Exception.class)
- public void saveNetworkResourceTest() throws RecordNotFoundException {
- NetworkResource nr = new NetworkResource();
- cd.saveNetworkResource(nr);
- }
- @Test(expected = Exception.class)
- public void saveToscaCsarTest()throws RecordNotFoundException {
- ToscaCsar ts = new ToscaCsar();
- cd.saveToscaCsar(ts);
- }
- @Test(expected = Exception.class)
- public void getToscaCsar(){
- cd.getToscaCsar("4993493");
- }
- @Test(expected = Exception.class)
- public void saveTempNetworkHeatTemplateLookupTest(){
- TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
- cd.saveTempNetworkHeatTemplateLookup(t);
- }
- @Test(expected = Exception.class)
- public void saveVfModuleToHeatFiles(){
- VfModuleToHeatFiles v = new VfModuleToHeatFiles();
- cd.saveVfModuleToHeatFiles(v);
- }
- @Test(expected = Exception.class)
- public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
- VnfResourceCustomization v =new VnfResourceCustomization();
- VfModuleCustomization vm = new VfModuleCustomization();
- cd.saveVnfResourceToVfModuleCustomization(v, vm);
- }
- @Test(expected = Exception.class)
- public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
- NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- cd.saveNetworkResourceCustomization(nrc);
- }
-
- @Test(expected = Exception.class)
- public void saveServiceToNetworksTest(){
- AllottedResource ar = new AllottedResource();
- cd.saveAllottedResource(ar);
- }
- @Test(expected = Exception.class)
- public void saveServiceToResourceCustomizationTest(){
- ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
- cd.saveServiceToResourceCustomization(ar);
- }
- @Test(expected = Exception.class)
- public void saveServiceTest(){
- Service ar = new Service();
- cd.saveService(ar);
- }
- @Test(expected = Exception.class)
- public void saveOrUpdateVfModuleTest(){
- VfModule ar = new VfModule();
- cd.saveOrUpdateVfModule(ar);
- }
- @Test(expected = Exception.class)
- public void saveOrUpdateVfModuleCustomizationTest(){
- VfModuleCustomization ar = new VfModuleCustomization();
- cd.saveOrUpdateVfModuleCustomization(ar);
- }
-
- @Test(expected = Exception.class)
- public void getNestedHeatTemplateTest(){
- cd.getNestedHeatTemplate(101,201);
- }
- @Test(expected = Exception.class)
- public void getNestedHeatTemplate2Test(){
- cd.getNestedHeatTemplate("1002","1002");
- }
- @Test(expected = Exception.class)
- public void saveNestedHeatTemplateTest(){
- HeatTemplate ar = new HeatTemplate();
- cd.saveNestedHeatTemplate("1001",ar,"test");
- }
- @Test(expected = Exception.class)
- public void getHeatFiles2Test(){
- VfModuleCustomization ar = new VfModuleCustomization();
- cd.getHeatFiles(101,"test","1001","v2");
- }
- @Test(expected = Exception.class)
- public void getHeatFiles3Test(){
- VfModuleCustomization ar = new VfModuleCustomization();
- cd.getHeatFiles("200192");
- }
- @Test(expected = Exception.class)
- public void saveHeatFilesTest(){
- HeatFiles ar = new HeatFiles();
- cd.saveHeatFiles(ar);
- }
- @Test(expected = Exception.class)
- public void saveVfModuleToHeatFilesTest(){
- HeatFiles ar = new HeatFiles();
- cd.saveVfModuleToHeatFiles("3772893",ar);
- }
- @Test
- public void getNetworkResourceByModelUuidTest(){
-
- cd.getNetworkResourceByModelUuid("3899291");
- }
- @Test(expected = Exception.class)
- public void getNetworkRecipeTest(){
-
- cd.getNetworkRecipe("test","test1","test2");
- }
- @Test(expected = Exception.class)
- public void getNetworkRecipe2Test(){
-
- cd.getNetworkRecipe("test","test1");
- }
- @Test
- public void getNetworkResourceByModelCustUuidTest(){
-
- cd.getNetworkResourceByModelCustUuid("test");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentsRecipe2Test(){
-
- cd.getVnfComponentsRecipe("test1","test2","test3","test4");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
-
- cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentRecipesTest(){
-
- cd.getVnfComponentRecipes("test");
- }
- @Test(expected = Exception.class)
- public void saveOrUpdateVnfComponentTest(){
- VnfComponent ar = new VnfComponent();
- cd.saveOrUpdateVnfComponent(ar);
- }
-
- @Test(expected = Exception.class)
- public void getVfModule2Test(){
-
- cd.getVfModule("test");
- }
- @Test(expected = Exception.class)
- public void getVfModuleByModelUUIDTest(){
-
- cd.getVfModuleByModelUUID("test");
- }
- @Test(expected = Exception.class)
- public void getServiceRecipeByModelUUIDTest(){
-
- cd.getServiceRecipeByModelUUID("test1","test2");
- }
- @Test(expected = Exception.class)
- public void getModelRecipeTest(){
-
- cd.getModelRecipe("test1","test2","test3");
- }
- @Test(expected = Exception.class)
- public void healthCheck(){
-
- cd.healthCheck();
- }
- @Test(expected = Exception.class)
- public void executeQuerySingleRow(){
- VnfComponent ar = new VnfComponent();
- HashMap<String, String> variables = new HashMap<String, String>();
- cd.executeQuerySingleRow("tets",variables,false);
- }
- @Test(expected = Exception.class)
- public void executeQueryMultipleRows(){
- HashMap<String, String> variables = new HashMap<String, String>();
- cd.executeQueryMultipleRows("select",variables,false);
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.db.catalog.test; + +import mockit.Mock; +import mockit.MockUp; +import org.hibernate.HibernateException; +import org.hibernate.NonUniqueResultException; +import org.hibernate.Query; +import org.hibernate.Session; +import org.junit.Before; +import org.junit.Test; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.AllottedResource; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.db.catalog.beans.HeatEnvironment; +import org.openecomp.mso.db.catalog.beans.HeatFiles; +import org.openecomp.mso.db.catalog.beans.HeatTemplate; +import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; +import org.openecomp.mso.db.catalog.beans.NetworkResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceRecipe; +import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization; +import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup; +import org.openecomp.mso.db.catalog.beans.ToscaCsar; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles; +import org.openecomp.mso.db.catalog.beans.VnfComponent; +import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe; +import org.openecomp.mso.db.catalog.beans.VnfRecipe; +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.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class CatalogDatabaseTest { + + CatalogDatabase cd = null; + + @Before + public void setup(){ + cd = CatalogDatabase.getInstance(); + } + + + @Test + public void getAllHeatTemplatesTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + HeatTemplate heatTemplate = new HeatTemplate(); + return Arrays.asList(heatTemplate); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + List <HeatTemplate> list = cd.getAllHeatTemplates(); + assertEquals(list.size(), 1); + } + + @Test + public void getHeatTemplateByIdTest(){ + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Object get(Class cls, Serializable id) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setAsdcUuid("123-uuid"); + return heatTemplate; + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplate(10); + assertEquals("123-uuid", ht.getAsdcUuid()); + } + + @Test + public void getHeatTemplateByNameEmptyListTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + HeatTemplate heatTemplate = new HeatTemplate(); + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplate("heat123"); + assertEquals(null, ht); + } + + @Test + public void getHeatTemplateByNameTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + HeatTemplate heatTemplate1 = new HeatTemplate(); + heatTemplate1.setAsdcUuid("123-uuid"); + heatTemplate1.setVersion("1.2"); + HeatTemplate heatTemplate2 = new HeatTemplate(); + heatTemplate2.setAsdcUuid("456-uuid"); + heatTemplate2.setVersion("1.3"); + return Arrays.asList(heatTemplate1, heatTemplate2); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplate("heat123"); + assertEquals("456-uuid", ht.getAsdcUuid()); + } + + @Test + public void getHeatTemplateByTemplateNameTest() { + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setAsdcUuid("1234-uuid"); + return Arrays.asList(heatTemplate); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); + assertEquals("1234-uuid", ht.getAsdcUuid()); + } + + @Test + public void getHeatTemplateByTemplateNameEmptyResultTest() { + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplate("heat123","v2"); + assertEquals(null, ht); + } + + @Test + public void getHeatTemplateByArtifactUuidException(){ + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Object get(Class cls, Serializable id) { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setAsdcUuid("123-uuid"); + return heatTemplate; + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123"); + assertEquals("123-uuid", ht.getAsdcUuid()); + } + + @Test + public void getHeatTemplateByArtifactUuidTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setAsdcUuid("123-uuid"); + return heatTemplate; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + assertEquals("123-uuid", ht.getAsdcUuid()); + } + + @Test(expected = HibernateException.class) + public void getHeatTemplateByArtifactUuidHibernateErrorTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + } + + @Test(expected = NonUniqueResultException.class) + public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + throw new NonUniqueResultException(2); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + } + + @Test(expected = Exception.class) + public void getHeatTemplateByArtifactUuidGenericExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new Exception(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid"); + } + + @Test + public void getParametersForHeatTemplateTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setAsdcUuid("1234-uuid"); + return Arrays.asList(heatTemplate); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); + assertEquals(1, htList.size()); + } + + @Test(expected = HibernateException.class) + public void getParametersForHeatTemplateHibernateExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); + } + + @Test(expected = Exception.class) + public void getParametersForHeatTemplateExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<HeatTemplate> list() throws Exception { + throw new Exception(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3"); + } + + @Test + public void getHeatEnvironmentByArtifactUuidTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setArtifactUuid("123-uuid"); + return heatEnvironment; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); + assertEquals("123-uuid", he.getArtifactUuid()); + } + + @Test(expected = HibernateException.class) + public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); + } + + @Test(expected = Exception.class) + public void getHeatEnvironmentByArtifactUuidExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new Exception(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123"); + } + + @Test + public void getServiceByInvariantUUIDTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public List<Service> list() { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return Arrays.asList(service); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getServiceByInvariantUUID("123"); + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test + public void getServiceByInvariantUUIDEmptyResultTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public List<Service> list() { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getServiceByInvariantUUID("123"); + assertEquals(null, service); + } + + @Test + public void getServiceTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return service; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getService("123"); + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test(expected = NonUniqueResultException.class) + public void getServiceNoUniqueResultTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new NonUniqueResultException(-1); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getService("123"); + } + + @Test(expected = HibernateException.class) + public void getServiceHibernateExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getService("123"); + } + + @Test(expected = Exception.class) + public void getServiceExceptionTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new Exception("generic exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getService("123"); + } + + @Test + public void getServiceByModelUUIDTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return service; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + Service service = cd.getServiceByModelUUID("123"); + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test + public void getService2Test(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return service; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + HashMap<String, String> map = new HashMap<>(); + map.put("serviceNameVersionId", "v2"); + Service service = cd.getService(map, "123"); + + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test + public void getServiceByModelNameTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<Service> list() throws Exception { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return Arrays.asList(service); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getServiceByModelName("123"); + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test + public void getServiceByModelNameEmptyTest(){ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<Service> list() throws Exception { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + Service service = cd.getServiceByModelName("123"); + assertEquals(null, service); + } + + @Test + public void getServiceByVersionAndInvariantIdTest() throws Exception{ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + Service service = new Service(); + service.setModelUUID("123-uuid"); + return service; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); + assertEquals("123-uuid", service.getModelUUID()); + } + + @Test(expected = Exception.class) + public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{ + + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new NonUniqueResultException(-1); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + Service service = cd.getServiceByVersionAndInvariantId("123","tetwe"); + } + + @Test(expected = Exception.class) + public void getServiceRecipeTestException() throws Exception{ + ServiceRecipe ht = cd.getServiceRecipe("123","tetwe"); + } + + @Test + public void getServiceRecipeByServiceModelUuidTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<ServiceRecipe> list() throws Exception { + ServiceRecipe serviceRecipe = new ServiceRecipe(); + serviceRecipe.setId(1); + return Arrays.asList(serviceRecipe); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); + assertEquals(1, serviceRecipe.getId()); + } + + @Test + public void getServiceRecipeByServiceModelUuidEmptyTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<ServiceRecipe> list() throws Exception { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe"); + assertEquals(null, serviceRecipe); + } + + @Test + public void getServiceRecipesTestException() throws Exception{ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<ServiceRecipe> list() { + ServiceRecipe serviceRecipe = new ServiceRecipe(); + serviceRecipe.setId(1); + return Arrays.asList(serviceRecipe); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); + assertEquals(1, serviceRecipes.size()); + } + + @Test + public void getServiceRecipesEmptyTest() throws Exception{ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<ServiceRecipe> list() { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123"); + assertEquals(0, serviceRecipes.size()); + } + + @Test(expected = Exception.class) + public void getVnfComponentTestException() throws Exception{ + VnfComponent ht = cd.getVnfComponent(123,"vnf"); + } + + @Test + public void getVnfResourceTest() throws Exception{ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<VnfResource> list() { + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUuid("123-uuid"); + return Arrays.asList(vnfResource); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf"); + assertEquals("123-uuid", vnfResource.getModelUuid()); + } + + @Test + public void getVnfResourceEmptyTest() throws Exception{ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<VnfResource> list() { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf"); + assertEquals(null, vnfResource); + } + + @Test + public void getVnfResourceByTypeTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUuid("123-uuid"); + return vnfResource; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + assertEquals("123-uuid", vnfResource.getModelUuid()); + } + + @Test(expected = NonUniqueResultException.class) + public void getVnfResourceNURExceptionTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + throw new NonUniqueResultException(-1); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + } + + @Test(expected = HibernateException.class) + public void getVnfResourceHibernateExceptionTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + } + + @Test(expected = Exception.class) + public void getVnfResourceExceptionTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new Exception(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnfResource = cd.getVnfResource("vnf","3992"); + } + + @Test + public void getVnfResourceByModelCustomizationIdTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUuid("123-uuid"); + return vnfResource; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + assertEquals("123-uuid",vnfResource.getModelUuid()); + } + + @Test(expected = NonUniqueResultException.class) + public void getVnfResourceByModelCustomizationIdNURExceptionTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new NonUniqueResultException(-1); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + } + + @Test(expected = HibernateException.class) + public void getVnfResourceByModelCustomizationIdHibernateExceptionTest() { + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + + VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992"); + } + + + @Test(expected = Exception.class) + public void getServiceRecipeTest2Exception() throws Exception{ + ServiceRecipe ht = cd.getServiceRecipe(1001,"3992"); + } + + @Test + public void getVnfResourceCustomizationByModelCustomizationNameTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<VnfResourceCustomization> list() throws Exception { + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setVnfResourceModelUUID("123-uuid"); + return Arrays.asList(vnfResourceCustomization); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); + assertEquals("123-uuid", vnf.getVnfResourceModelUUID()); + } + + @Test + public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + @Mock + public List<VnfResourceCustomization> list() throws Exception { + return Arrays.asList(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234"); + assertEquals(null, vnf); + } + + @Test + public void getVnfResourceByModelInvariantIdTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult(){ + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUuid("123-uuid"); + return vnfResource; + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + assertEquals("123-uuid", vnf.getModelUuid()); + } + + @Test(expected = NonUniqueResultException.class) + public void getVnfResourceByModelInvariantIdNURExceptionTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult(){ + throw new NonUniqueResultException(-1); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + } + + @Test(expected = HibernateException.class) + public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult(){ + throw new HibernateException("hibernate exception"); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + } + + @Test(expected = Exception.class) + public void getVnfResourceByModelInvariantIdExceptionTest(){ + MockUp<Query> mockUpQuery = new MockUp<Query>() { + + @Mock + public Object uniqueResult() throws Exception { + throw new Exception(); + } + }; + + MockUp<Session> mockedSession = new MockUp<Session>() { + @Mock + public Query createQuery(String hql) { + return mockUpQuery.getMockInstance(); + } + }; + + new MockUp<CatalogDatabase>() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; + VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234"); + } + + @Test(expected = Exception.class) + public void getVnfResourceByIdTestException(){ + VnfResource vnf = cd.getVnfResourceById(19299); + } + + @Test(expected = Exception.class) + public void getVfModuleModelNameTestException(){ + VfModule vnf = cd.getVfModuleModelName("tetes"); + } + + @Test(expected = Exception.class) + public void getVfModuleModelName2TestException(){ + VfModule vnf = cd.getVfModuleModelName("tetes","4kidsl"); + } + + @Test(expected = Exception.class) + public void ggetVfModuleCustomizationByModelNameTestException(){ + VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelName("tetes"); + } + + @Test(expected = Exception.class) + public void getNetworkResourceTestException(){ + NetworkResource vnf = cd.getNetworkResource("tetes"); + } + + @Test(expected = Exception.class) + public void getVnfRecipeTestException(){ + VnfRecipe vnf = cd.getVnfRecipe("tetes","ergfedrf","4993493"); + } + + @Test(expected = Exception.class) + public void getVnfRecipe2TestException(){ + VnfRecipe vnf = cd.getVnfRecipe("tetes","4993493"); + } + + @Test(expected = Exception.class) + public void getVnfRecipeByVfModuleIdTestException(){ + VnfRecipe vnf = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf"); + } + + @Test(expected = Exception.class) + public void getVfModuleTypeTestException(){ + VfModule vnf = cd.getVfModuleType("4993493"); + } + + @Test(expected = Exception.class) + public void getVfModuleType2TestException(){ + VfModule vnf = cd.getVfModuleType("4993493","vnf"); + } + @Test(expected = Exception.class) + public void getVnfResourceByServiceUuidTestException(){ + VnfResource vnf = cd.getVnfResourceByServiceUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceByVnfUuidTestException(){ + VnfResource vnf = cd.getVnfResourceByVnfUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelInvariantUuidTestException(){ + VfModule vnf = cd.getVfModuleByModelInvariantUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelCustomizationUuidTestException(){ + VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){ + VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf"); + } + @Test(expected = Exception.class) + public void getVfModuleCustomizationByModelCustomizationIdTestException(){ + VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelUuidTestException(){ + VfModule vnf = cd.getVfModuleByModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){ + VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceCustomizationByModelVersionIdTestException(){ + VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelCustomizationIdAndVersionTestException(){ + cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){ + cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test"); + } + @Test(expected = Exception.class) + public void getVnfResourceCustomizationByModelInvariantIdTest(){ + cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test"); + } + @Test(expected = Exception.class) + public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){ + cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){ + cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test"); + } + @Test(expected = Exception.class) + public void getAllVfModuleCustomizationstest(){ + cd.getAllVfModuleCustomizations("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceByModelUuidTest(){ + cd.getVnfResourceByModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResCustomToVfModuleTest(){ + cd.getVnfResCustomToVfModule("4993493","test"); + } + @Test(expected = Exception.class) + public void getVfModulesForVnfResourceTest(){ + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUuid("48839"); + cd.getVfModulesForVnfResource(vnfResource); + } + @Test(expected = Exception.class) + public void getVfModulesForVnfResource2Test(){ + cd.getVfModulesForVnfResource("4993493"); + } + @Test(expected = Exception.class) + public void getServiceByUuidTest(){ + cd.getServiceByUuid("4993493"); + } + @Test(expected = Exception.class) + public void getNetworkResourceById2Test(){ + cd.getNetworkResourceById(4993493); + } + @Test(expected = Exception.class) + public void getNetworkResourceByIdTest(){ + cd.getVfModuleTypeByUuid("4993493"); + } + @Test + public void isEmptyOrNullTest(){ + boolean is = cd.isEmptyOrNull("4993493"); + assertFalse(is); + } + @Test(expected = Exception.class) + public void getSTRTest(){ + cd.getSTR("4993493","test","vnf"); + } + @Test(expected = Exception.class) + public void getVRCtoVFMCTest(){ + cd.getVRCtoVFMC("4993493","388492"); + } + @Test(expected = Exception.class) + public void getVfModuleTypeByUuidTestException(){ + cd.getVfModuleTypeByUuid("4993493"); + } + + @Test(expected = Exception.class) + public void getTempNetworkHeatTemplateLookupTest(){ + cd.getTempNetworkHeatTemplateLookup("4993493"); + } + + @Test(expected = Exception.class) + public void getAllNetworksByServiceModelUuidTest(){ + cd.getAllNetworksByServiceModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllNetworksByServiceModelInvariantUuidTest(){ + cd.getAllNetworksByServiceModelInvariantUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllNetworksByServiceModelInvariantUuid2Test(){ + cd.getAllNetworksByServiceModelInvariantUuid("4993493","test"); + } + @Test(expected = Exception.class) + public void getAllNetworksByNetworkModelCustomizationUuidTest(){ + cd.getAllNetworksByNetworkModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllNetworksByNetworkTypeTest(){ + cd.getAllNetworksByNetworkType("4993493"); + } + @Test(expected = Exception.class) + public void getAllVfmcForVrcTest(){ + VnfResourceCustomization re = new VnfResourceCustomization(); + re.setModelCustomizationUuid("377483"); + cd.getAllVfmcForVrc(re); + } + @Test(expected = Exception.class) + public void getAllVnfsByServiceModelUuidTest(){ + cd.getAllVnfsByServiceModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllVnfsByServiceModelInvariantUuidTest(){ + cd.getAllVnfsByServiceModelInvariantUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllVnfsByServiceModelInvariantUuid2Test(){ + cd.getAllVnfsByServiceModelInvariantUuid("4993493","test"); + } + @Test(expected = Exception.class) + public void getAllVnfsByServiceNameTest(){ + cd.getAllVnfsByServiceName("4993493","test"); + } + @Test(expected = Exception.class) + public void getAllVnfsByServiceName2Test(){ + cd.getAllVnfsByServiceName("4993493"); + } + @Test(expected = Exception.class) + public void getAllVnfsByVnfModelCustomizationUuidTest(){ + cd.getAllVnfsByVnfModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllAllottedResourcesByServiceModelUuidTest(){ + cd.getAllAllottedResourcesByServiceModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){ + cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){ + cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test"); + } + @Test(expected = Exception.class) + public void getAllAllottedResourcesByArModelCustomizationUuidTest(){ + cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllottedResourceByModelUuidTest(){ + cd.getAllottedResourceByModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllResourcesByServiceModelUuidTest(){ + cd.getAllResourcesByServiceModelUuid("4993493"); + } + @Test(expected = Exception.class) + public void getAllResourcesByServiceModelInvariantUuidTest(){ + cd.getAllResourcesByServiceModelInvariantUuid("4993493"); + } + + @Test(expected = Exception.class) + public void getAllResourcesByServiceModelInvariantUuid2Test(){ + cd.getAllResourcesByServiceModelInvariantUuid("4993493","test"); + } + @Test(expected = Exception.class) + public void getSingleNetworkByModelCustomizationUuidTest(){ + cd.getSingleNetworkByModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getSingleAllottedResourceByModelCustomizationUuidTest(){ + cd.getSingleAllottedResourceByModelCustomizationUuid("4993493"); + } + @Test(expected = Exception.class) + public void getVfModuleRecipeTest(){ + cd.getVfModuleRecipe("4993493","test","get"); + } + @Test(expected = Exception.class) + public void getVfModuleTest(){ + cd.getVfModule("4993493","test","get","v2","vnf"); + } + @Test(expected = Exception.class) + public void getVnfComponentsRecipeTest(){ + cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992"); + } + @Test(expected = Exception.class) + public void getVnfComponentsRecipeByVfModuleTest(){ + List <VfModule> resultList = new ArrayList<>(); + VfModule m = new VfModule(); + resultList.add(m); + cd.getVnfComponentsRecipeByVfModule(resultList,"4993493"); + } + @Test(expected = Exception.class) + public void getAllVnfResourcesTest(){ + cd.getAllVnfResources(); + } + @Test(expected = Exception.class) + public void getVnfResourcesByRoleTest(){ + cd.getVnfResourcesByRole("4993493"); + } + @Test(expected = Exception.class) + public void getVnfResourceCustomizationsByRoleTest(){ + cd.getVnfResourceCustomizationsByRole("4993493"); + } + @Test(expected = Exception.class) + public void getAllNetworkResourcesTest(){ + cd.getAllNetworkResources(); + } + @Test(expected = Exception.class) + public void getAllNetworkResourceCustomizationsTest(){ + cd.getAllNetworkResourceCustomizations(); + } + @Test(expected = Exception.class) + public void getAllVfModulesTest(){ + cd.getAllVfModules(); + } + @Test(expected = Exception.class) + public void getAllVfModuleCustomizationsTest(){ + cd.getAllVfModuleCustomizations(); + } + @Test(expected = Exception.class) + public void getAllHeatEnvironmentTest(){ + cd.getAllHeatEnvironment(); + } + @Test(expected = Exception.class) + public void getHeatEnvironment2Test(){ + cd.getHeatEnvironment(4993493); + } + @Test(expected = Exception.class) + public void getNestedTemplatesTest(){ + cd.getNestedTemplates(4993493); + } + @Test(expected = Exception.class) + public void getNestedTemplates2Test(){ + cd.getNestedTemplates("4993493"); + } + @Test(expected = Exception.class) + public void getHeatFilesTest(){ + cd.getHeatFiles(4993493); + } + @Test(expected = Exception.class) + public void getVfModuleToHeatFilesEntryTest(){ + cd.getVfModuleToHeatFilesEntry("4993493","49959499"); + } + @Test(expected = Exception.class) + public void getServiceToResourceCustomization(){ + cd.getServiceToResourceCustomization("4993493","599349","49900"); + } + @Test(expected = Exception.class) + public void getHeatFilesForVfModuleTest(){ + cd.getHeatFilesForVfModule("4993493"); + } + @Test(expected = Exception.class) + public void getHeatTemplateTest(){ + cd.getHeatTemplate("4993493","test","heat"); + } + + @Test(expected = Exception.class) + public void saveHeatTemplateTest(){ + HeatTemplate heat = new HeatTemplate(); + Set <HeatTemplateParam> paramSet = new HashSet<HeatTemplateParam>(); + cd.saveHeatTemplate(heat,paramSet); + } + @Test(expected = Exception.class) + public void getHeatEnvironmentTest(){ + cd.getHeatEnvironment("4993493","test","heat"); + } + @Test(expected = Exception.class) + public void getHeatEnvironment3Test(){ + cd.getHeatEnvironment("4993493","test"); + } + @Test(expected = Exception.class) + public void saveHeatEnvironmentTest(){ + HeatEnvironment en = new HeatEnvironment(); + cd.saveHeatEnvironment(en); + } + @Test(expected = Exception.class) + public void saveHeatTemplate2Test(){ + HeatTemplate heat = new HeatTemplate(); + cd.saveHeatTemplate(heat); + } + @Test(expected = Exception.class) + public void saveHeatFileTest(){ + HeatFiles hf = new HeatFiles(); + cd.saveHeatFile(hf); + } + @Test(expected = Exception.class) + public void saveVnfRecipeTest(){ + VnfRecipe vr = new VnfRecipe(); + cd.saveVnfRecipe(vr); + } + @Test(expected = Exception.class) + public void saveVnfComponentsRecipe(){ + VnfComponentsRecipe vr = new VnfComponentsRecipe(); + cd.saveVnfComponentsRecipe(vr); + } + @Test(expected = Exception.class) + public void saveOrUpdateVnfResourceTest(){ + VnfResource vr = new VnfResource(); + cd.saveOrUpdateVnfResource(vr); + } + @Test(expected = Exception.class) + public void saveVnfResourceCustomizationTest(){ + VnfResourceCustomization vr = new VnfResourceCustomization(); + cd.saveVnfResourceCustomization(vr); + } + @Test(expected = Exception.class) + public void saveAllottedResourceCustomizationTest(){ + AllottedResourceCustomization arc = new AllottedResourceCustomization(); + cd.saveAllottedResourceCustomization(arc); + } + @Test(expected = Exception.class) + public void saveAllottedResourceTest(){ + AllottedResource ar = new AllottedResource(); + cd.saveAllottedResource(ar); + } + @Test(expected = Exception.class) + public void saveNetworkResourceTest() throws RecordNotFoundException { + NetworkResource nr = new NetworkResource(); + cd.saveNetworkResource(nr); + } + @Test(expected = Exception.class) + public void saveToscaCsarTest()throws RecordNotFoundException { + ToscaCsar ts = new ToscaCsar(); + cd.saveToscaCsar(ts); + } + @Test(expected = Exception.class) + public void getToscaCsar(){ + cd.getToscaCsar("4993493"); + } + @Test(expected = Exception.class) + public void saveTempNetworkHeatTemplateLookupTest(){ + TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup(); + cd.saveTempNetworkHeatTemplateLookup(t); + } + @Test(expected = Exception.class) + public void saveVfModuleToHeatFiles(){ + VfModuleToHeatFiles v = new VfModuleToHeatFiles(); + cd.saveVfModuleToHeatFiles(v); + } + @Test(expected = Exception.class) + public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException { + VnfResourceCustomization v =new VnfResourceCustomization(); + VfModuleCustomization vm = new VfModuleCustomization(); + cd.saveVnfResourceToVfModuleCustomization(v, vm); + } + @Test(expected = Exception.class) + public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException { + NetworkResourceCustomization nrc = new NetworkResourceCustomization(); + cd.saveNetworkResourceCustomization(nrc); + } + + @Test(expected = Exception.class) + public void saveServiceToNetworksTest(){ + AllottedResource ar = new AllottedResource(); + cd.saveAllottedResource(ar); + } + @Test(expected = Exception.class) + public void saveServiceToResourceCustomizationTest(){ + ServiceToResourceCustomization ar = new ServiceToResourceCustomization(); + cd.saveServiceToResourceCustomization(ar); + } + @Test(expected = Exception.class) + public void saveServiceTest(){ + Service ar = new Service(); + cd.saveService(ar); + } + @Test(expected = Exception.class) + public void saveOrUpdateVfModuleTest(){ + VfModule ar = new VfModule(); + cd.saveOrUpdateVfModule(ar); + } + @Test(expected = Exception.class) + public void saveOrUpdateVfModuleCustomizationTest(){ + VfModuleCustomization ar = new VfModuleCustomization(); + cd.saveOrUpdateVfModuleCustomization(ar); + } + + @Test(expected = Exception.class) + public void getNestedHeatTemplateTest(){ + cd.getNestedHeatTemplate(101,201); + } + @Test(expected = Exception.class) + public void getNestedHeatTemplate2Test(){ + cd.getNestedHeatTemplate("1002","1002"); + } + @Test(expected = Exception.class) + public void saveNestedHeatTemplateTest(){ + HeatTemplate ar = new HeatTemplate(); + cd.saveNestedHeatTemplate("1001",ar,"test"); + } + @Test(expected = Exception.class) + public void getHeatFiles2Test(){ + VfModuleCustomization ar = new VfModuleCustomization(); + cd.getHeatFiles(101,"test","1001","v2"); + } + @Test(expected = Exception.class) + public void getHeatFiles3Test(){ + VfModuleCustomization ar = new VfModuleCustomization(); + cd.getHeatFiles("200192"); + } + @Test(expected = Exception.class) + public void saveHeatFilesTest(){ + HeatFiles ar = new HeatFiles(); + cd.saveHeatFiles(ar); + } + @Test(expected = Exception.class) + public void saveVfModuleToHeatFilesTest(){ + HeatFiles ar = new HeatFiles(); + cd.saveVfModuleToHeatFiles("3772893",ar); + } + @Test + public void getNetworkResourceByModelUuidTest(){ + + cd.getNetworkResourceByModelUuid("3899291"); + } + @Test(expected = Exception.class) + public void getNetworkRecipeTest(){ + + cd.getNetworkRecipe("test","test1","test2"); + } + @Test(expected = Exception.class) + public void getNetworkRecipe2Test(){ + + cd.getNetworkRecipe("test","test1"); + } + @Test + public void getNetworkResourceByModelCustUuidTest(){ + + cd.getNetworkResourceByModelCustUuid("test"); + } + @Test(expected = Exception.class) + public void getVnfComponentsRecipe2Test(){ + + cd.getVnfComponentsRecipe("test1","test2","test3","test4"); + } + @Test(expected = Exception.class) + public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){ + + cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3"); + } + @Test(expected = Exception.class) + public void getVnfComponentRecipesTest(){ + + cd.getVnfComponentRecipes("test"); + } + @Test(expected = Exception.class) + public void saveOrUpdateVnfComponentTest(){ + VnfComponent ar = new VnfComponent(); + cd.saveOrUpdateVnfComponent(ar); + } + + @Test(expected = Exception.class) + public void getVfModule2Test(){ + + cd.getVfModule("test"); + } + @Test(expected = Exception.class) + public void getVfModuleByModelUUIDTest(){ + + cd.getVfModuleByModelUUID("test"); + } + @Test(expected = Exception.class) + public void getServiceRecipeByModelUUIDTest(){ + + cd.getServiceRecipeByModelUUID("test1","test2"); + } + @Test(expected = Exception.class) + public void getModelRecipeTest(){ + + cd.getModelRecipe("test1","test2","test3"); + } + @Test(expected = Exception.class) + public void healthCheck(){ + + cd.healthCheck(); + } + @Test(expected = Exception.class) + public void executeQuerySingleRow(){ + VnfComponent ar = new VnfComponent(); + HashMap<String, String> variables = new HashMap<String, String>(); + cd.executeQuerySingleRow("tets",variables,false); + } + @Test(expected = Exception.class) + public void executeQueryMultipleRows(){ + HashMap<String, String> variables = new HashMap<String, String>(); + cd.executeQueryMultipleRows("select",variables,false); + } +} |