Fix Invalid BPMN

Fix invalid BPMN for a 2nd time, add JUNIT to fail verify on invalid
BPMN

Issue-ID: SO-804

Change-Id: I0ead7d8ebc42dbfe6b18cb29e3962cceb6d7cc23


Change-Id: I0ead7d8ebc42dbfe6b18cb29e3962cceb6d7cc23
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java
new file mode 100644
index 0000000..3f1a5ea
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/InfraEmbeddedMariaDbConfig.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+        entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+        basePackages = { "org.onap.so.db.request.data.repository"}
+)
+@Profile({"test"})
+public class InfraEmbeddedMariaDbConfig {
+
+    @Primary
+    @Bean(name = "requestEntityManagerFactory")
+    public LocalContainerEntityManagerFactoryBean
+    entityManagerFactory(
+            EntityManagerFactoryBuilder builder,
+            DataSource dataSource
+    ) {
+        return builder
+                .dataSource(dataSource)
+                .packages("org.onap.so.db.request.beans")
+                .persistenceUnit("requestDB")
+                .build();
+    }
+
+    @Bean(name = "requestTransactionManager")
+    public PlatformTransactionManager transactionManager(
+            @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+                    entityManagerFactory
+    ) {
+        return new JpaTransactionManager(entityManagerFactory);
+    }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
new file mode 100644
index 0000000..314cc0b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.onap.so;
+
+import java.io.IOException;
+
+import javax.annotation.PreDestroy;
+
+import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
+import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Profile;
+
+import ch.vorburger.mariadb4j.MariaDB4jService;
+
+@SpringBootApplication
+@Profile("test")
+@EnableProcessApplication("MSO CommonBPMN Test Application")
+@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
+		@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
+		@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
+		@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+public class TestApplication {
+	public static void main(String... args) {
+		SpringApplication.run(TestApplication.class, args);
+		System.getProperties().setProperty("mso.db", "MARIADB");
+		System.getProperties().setProperty("server.name", "Springboot");
+		
+		
+	}
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/ValidBPMNTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/ValidBPMNTest.java
new file mode 100644
index 0000000..0521fa7
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/ValidBPMNTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============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.onap.so;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration
+@AutoConfigureWireMock(port = 0)
+public class ValidBPMNTest {
+    
+    @Test
+    public void verifyApplicationStartup(){
+        //Verifys Springboot app can start up and all BPMN's are in fact parsable
+        assert(true);
+    }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml
new file mode 100644
index 0000000..8a5ade6
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/application-test.yaml
@@ -0,0 +1,208 @@
+aai:
+  auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
+  endpoint: http://localhost:${wiremock.server.port}
+appc:
+  client:
+    key: iaEMAfjsVsZnraBP
+    response:
+      timeout: '120000'
+    secret: wcivUjsjXzmGFBfxMmyJu9dz
+    poolMembers: localhost:3904
+    service: ueb
+    topic:
+      read:
+        name: APPC-TEST-AMDOCS2
+        timeout: '120000'
+      write: APPC-TEST-AMDOCS1-DEV3
+      sdnc:
+        read: SDNC-LCM-READ
+        write: SDNC-LCM-WRITE
+mso:
+  adapters:
+    completemsoprocess:
+      endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
+    db:
+      auth: 757A94191D685FD2092AC1490730A4FC
+      endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+      spring:
+        endpoint: http://localhost:${wiremock.server.port}
+    network:
+      endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter
+      rest:
+        endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks
+    openecomp:
+      db:
+        endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+    po:
+      auth: 757A94191D685FD2092AC1490730A4FC
+      password: 3141634BF7E070AA289CF2892C986C0B
+    sdnc:
+      endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter
+      rest:
+        endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc
+      timeout: PT60S
+    tenant:
+      endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock
+    vnf:
+      endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter
+      rest:
+        endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
+    volume-groups:
+      rest:
+        endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups
+    vnf-async:
+      endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync
+    workflow:
+      message:
+        endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message
+        
+  async:
+      core-pool-size: 50
+      max-pool-size: 50
+      queue-capacity: 500
+  
+  bpmn:
+    optimisticlockingexception:
+      retrycount: '3'
+  callbackRetryAttempts: '5'
+  catalog:
+    db:
+      endpoint: http://localhost:${wiremock.server.port}/
+      spring:
+        endpoint: http://localhost:${wiremock.server.port}  
+  correlation:
+        timeout: 60
+  db:
+    auth: Basic YnBlbDptc28tZGItMTUwNyE=
+  default:
+    adapter:
+      namespace: http://org.onap.so
+  healthcheck:
+    log:
+      debug: 'false'
+  infra:
+    customer:
+      id: testCustIdInfra
+  logPath: logs
+  msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+  po:
+    timeout: PT60S
+  request:
+    db:
+      endpoint: http://localhost:${wiremock.server.port}/
+  rollback: 'true'
+  sdnc:    
+    password: 3141634BF7E070AA289CF2892C986C0B      
+  site-name: localDevEnv
+  workflow:   
+    default:
+      aai:
+        cloud-region:
+          version: '9'
+        generic-vnf:
+          version: '9'
+        v8:
+          customer:
+            uri: /aai/v8/business/customers/customer
+          generic-query:
+            uri: /aai/v8/search/generic-query
+          l3-network:
+            uri: /aai/v8/network/l3-networks/l3-network
+          network-policy:
+            uri: /aai/v8/network/network-policies/network-policy
+          nodes-query:
+            uri: /aai/v8/search/nodes-query
+          route-table-reference:
+            uri: /aai/v8/network/route-table-references/route-table-reference
+          tenant:
+            uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+          vce:
+            uri: /aai/v8/network/vces/vce
+          vpn-binding:
+            uri: /aai/v8/network/vpn-bindings/vpn-binding
+        v9:
+          cloud-region:
+            uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
+          generic-vnf:
+            uri: /aai/v9/network/generic-vnfs/generic-vnf
+    global:
+      default:
+        aai:
+          namespace: http://org.openecomp.aai.inventory/
+          version: '8'
+    message:
+      endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage
+    notification:
+      name: GenericNotificationService
+    sdncadapter:
+      callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
+    vnfadapter:
+      create:
+        callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+      delete:
+        callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+      query:
+        callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1
+      rollback:
+        callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+  global:
+    dmaap:
+      username: dmaapUsername
+      password: dmaapPassword
+      host: http://localhost:28090
+      publisher:
+        topic: com.att.mso.asyncStatusUpdate 
+  service-plugin:
+    third-sp-endpoint:
+    oof-calc-endpoint:
+policy:
+  auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+  client:
+    auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+  endpoint: https://localhost:8081/pdp/api/
+  environment: TEST
+sniro:
+  conductor:
+    enabled: true
+    host: http://localhost:${wiremock.server.port}
+    uri: /v1/release-orders
+    headers.auth: Basic dGVzdDp0ZXN0cHdk
+  manager:
+    timeout: PT30M
+    host: http://localhost:${wiremock.server.port}
+    uri.v1: /sniro/api/v2/placement
+    uri.v2: /sniro/api/placement/v2
+    headers.auth: Basic dGVzdDp0ZXN0cHdk
+    headers.patchVersion: 1
+    headers.minorVersion: 1
+    headers.latestVersion: 2
+spring:
+  datasource:
+    url: jdbc:mariadb://localhost:3307/camundabpmn
+    username: root
+    password: password
+    driver-class-name: org.mariadb.jdbc.Driver
+    initialize: true
+  jpa:   
+    generate-ddl: false
+    show-sql: false
+    hibernate:      
+      ddl-auto: none
+      naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+      enable-lazy-load-no-trans: true
+    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+  security:
+    usercredentials:
+    -  
+      username: test
+      password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+      role: BPEL-Client
+mariaDB4j:
+  dataDir: 
+  port: 3307
+  databaseName: camundabpmn
+camunda:
+  bpm:
+    metrics:
+      enabled: false
+      db-reporter-activate: false
\ No newline at end of file