aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCoreBPMN/src/test/java
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2018-03-07 18:17:22 -0800
committerMarcus G K Williams <marcus.williams@intel.com>2018-03-08 09:17:48 -0800
commit327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e (patch)
tree0d943226962ae31c0bf2fd0696e91c6bb41d099c /bpmn/MSOCoreBPMN/src/test/java
parentdee036198ee09d71bfdd50247c1d23a7f472df87 (diff)
Reduce log noise/warnings format to conventions
Reduce build log warnings by formatting tests to ONAP code conventions (removing tabs etc.) Issue-ID: SO-368 Change-Id: I48c6d359b83617aebeb79db4e30c1d72d31f7eec Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src/test/java')
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java102
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java436
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/internal/VariableNameExtractorTest.java1
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java136
5 files changed, 339 insertions, 337 deletions
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
index 58f1ae264d..861ea0a749 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java
@@ -46,6 +46,7 @@ import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.mso.bpmn.core.json.JsonUtils;
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
index 506dba2552..80871db00d 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java
@@ -36,7 +36,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.core;
@@ -49,56 +49,56 @@ import org.junit.Test;
public class PropertyConfigurationTest {
- @Before
- public void beforeTest() throws IOException {
- Map<String, String> defaultProperties = PropertyConfigurationSetup.createBpmnProperties();
- defaultProperties.put("testValue", "testKey");
- PropertyConfigurationSetup.init(defaultProperties);
- }
-
- @Test
- public void testPropertyFileWatcher() throws InterruptedException, IOException {
- Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning());
- }
-
- @Test
- public void testPropertyLoading() throws IOException, InterruptedException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(props);
- Assert.assertEquals("testValue", props.get("testKey"));
- }
-
- @Test
- public void testPropertyReload() throws IOException, InterruptedException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(properties);
- Assert.assertEquals("testValue", properties.get("testKey"));
+ @Before
+ public void beforeTest() throws IOException {
+ Map<String, String> defaultProperties = PropertyConfigurationSetup.createBpmnProperties();
+ defaultProperties.put("testValue", "testKey");
+ PropertyConfigurationSetup.init(defaultProperties);
+ }
+
+ @Test
+ public void testPropertyFileWatcher() throws InterruptedException, IOException {
+ Assert.assertEquals(true, PropertyConfiguration.getInstance().isFileWatcherRunning());
+ }
+
+ @Test
+ public void testPropertyLoading() throws IOException, InterruptedException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(props);
+ Assert.assertEquals("testValue", props.get("testKey"));
+ }
+
+ @Test
+ public void testPropertyReload() throws IOException, InterruptedException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(properties);
+ Assert.assertEquals("testValue", properties.get("testKey"));
+
+ Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties();
+ newProperties.put("newKey", "newValue");
+ PropertyConfigurationSetup.addProperties(newProperties, 10000);
+
+ // Reload and check for the new value
+ properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(properties);
+ Assert.assertEquals("newValue", properties.get("newKey"));
+ }
- Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties();
- newProperties.put("newKey", "newValue");
- PropertyConfigurationSetup.addProperties(newProperties, 10000);
+ @Test(expected = IllegalArgumentException.class)
+ public void testPropertyFileDoesNotExists_NotIntheList() throws IOException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ propertyConfiguration.getProperties("badfile.properties");
+ Assert.fail("Expected IllegalArgumentException");
+ }
- // Reload and check for the new value
- properties = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(properties);
- Assert.assertEquals("newValue", properties.get("newKey"));
- }
-
- @Test(expected=IllegalArgumentException.class)
- public void testPropertyFileDoesNotExists_NotIntheList() throws IOException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- propertyConfiguration.getProperties("badfile.properties");
- Assert.fail("Expected IllegalArgumentException");
- }
-
- @Test(expected=java.lang.UnsupportedOperationException.class)
- public void testPropertyModificationException() throws IOException {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
- Assert.assertNotNull(props);
- Assert.assertEquals("testValue", props.get("testKey"));
- props.put("newKey", "newvalue");
- }
+ @Test(expected = java.lang.UnsupportedOperationException.class)
+ public void testPropertyModificationException() throws IOException {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String, String> props = propertyConfiguration.getProperties(PropertyConfiguration.MSO_BPMN_PROPERTIES);
+ Assert.assertNotNull(props);
+ Assert.assertEquals("testValue", props.get("testKey"));
+ props.put("newKey", "newvalue");
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
index 2d204c338a..17580c03a5 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java
@@ -43,222 +43,222 @@ import org.openecomp.mso.logger.MsoLogger;
*/
public class TestBaseTask {
- @Rule
- public ProcessEngineRule processEngineRule = new ProcessEngineRule();
-
- @Before
- public void beforeTest() throws Exception {
- CamundaDBSetup.configure();
- PropertyConfigurationSetup.init();
- }
-
- @Test
- @Deployment(resources={"BaseTaskTest.bpmn"})
- public void shouldInvokeService() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("firstName", "Jane");
- variables.put("lastName", "Doe");
- variables.put("age", (Integer)25);
- variables.put("lastVisit", (Long)1438270117000L);
-
- RuntimeService runtimeService = processEngineRule.getRuntimeService();
- assertNotNull(runtimeService);
- processEngineRule.getTaskService();
- runtimeService.startProcessInstanceByKey("BaseTaskTest", variables);
- }
-
- /**
- * Unit test code for BaseTask.
- */
- public static class TestTask extends BaseTask {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private Expression existingString;
- private Expression nonExistingString;
- private Expression existingStringFromVar;
- private Expression nonExistingStringFromVar;
-
- private Expression existingInteger;
- private Expression nonExistingInteger;
- private Expression existingIntegerFromVar;
- private Expression nonExistingIntegerFromVar;
-
- private Expression existingLong;
- private Expression nonExistingLong;
- private Expression existingLongFromVar;
- private Expression nonExistingLongFromVar;
-
- private Expression existingOutputVar;
- private Expression nonExistingOutputVar;
- private Expression existingBadOutputVar;
-
- public void execute(DelegateExecution execution) throws Exception {
- msoLogger.debug("Started executing " + getClass().getSimpleName());
-
- /*********************************************************************/
- msoLogger.debug("Running String Field Tests");
- /*********************************************************************/
-
- String s = getStringField(existingString, execution, "existingString");
- Assert.assertEquals("Hello World", s);
-
- try {
- s = getStringField(nonExistingString, execution, "nonExistingString");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- s = getOptionalStringField(existingString, execution, "existingString");
- Assert.assertEquals("Hello World", s);
-
- s = getOptionalStringField(nonExistingString, execution, "nonExistingString");
- Assert.assertEquals(null, s);
-
- /*********************************************************************/
- msoLogger.debug("Running String Expression Tests");
- /*********************************************************************/
-
- s = getStringField(existingStringFromVar, execution, "existingStringFromVar");
- Assert.assertEquals("Jane", s);
-
- try {
- s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar");
- }
- }
-
- s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar");
- Assert.assertEquals("Jane", s);
-
- s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
- Assert.assertEquals(null, s);
-
- /*********************************************************************/
- msoLogger.debug("Running Integer Field Tests");
- /*********************************************************************/
-
- Integer i = getIntegerField(existingInteger, execution, "existingInteger");
- Assert.assertEquals((Integer)42, i);
-
- try {
- i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger");
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- }
- }
-
- i = getOptionalIntegerField(existingInteger, execution, "existingInteger");
- Assert.assertEquals((Integer)42, i);
-
- i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Integer Expression Tests");
- /*********************************************************************/
-
- i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
- Assert.assertEquals((Integer)25, i);
-
- try {
- i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar");
- }
- }
-
- i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
- Assert.assertEquals((Integer)25, i);
-
- i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Long Field Tests");
- /*********************************************************************/
-
- Long l = getLongField(existingLong, execution, "existingLong");
- Assert.assertEquals((Long)123456789L, l);
-
- try {
- l = getLongField(nonExistingLong, execution, "nonExistingLong");
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- }
- }
-
- l = getOptionalLongField(existingLong, execution, "existingLong");
- Assert.assertEquals((Long)123456789L, l);
-
- l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong");
- Assert.assertEquals(null, l);
-
- /*********************************************************************/
- msoLogger.debug("Running Long Expression Tests");
- /*********************************************************************/
-
- l = getLongField(existingLongFromVar, execution, "existingLongFromVar");
- Assert.assertEquals((Long)1438270117000L, l);
-
- try {
- l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar");
- }
- }
-
- l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar");
- Assert.assertEquals((Long)1438270117000L, l);
-
- l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
- Assert.assertEquals(null, i);
-
- /*********************************************************************/
- msoLogger.debug("Running Output Variable Field Tests");
- /*********************************************************************/
-
- String var = getOutputField(existingOutputVar, execution, "existingOutputVar");
- Assert.assertEquals("goodVariable", var);
-
- try {
- var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar");
- Assert.assertEquals("goodVariable", var);
-
- var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
- Assert.assertEquals(null, var);
-
- try {
- var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar");
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- } catch (Exception e) {
- if (!(e instanceof BadInjectedFieldException)) {
- Assert.fail("Expected BadInjectedFieldException for nonExistingString");
- }
- }
-
- msoLogger.debug("Finished executing " + getClass().getSimpleName());
- }
- }
+ @Rule
+ public ProcessEngineRule processEngineRule = new ProcessEngineRule();
+
+ @Before
+ public void beforeTest() throws Exception {
+ CamundaDBSetup.configure();
+ PropertyConfigurationSetup.init();
+ }
+
+ @Test
+ @Deployment(resources = {"BaseTaskTest.bpmn"})
+ public void shouldInvokeService() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("firstName", "Jane");
+ variables.put("lastName", "Doe");
+ variables.put("age", (Integer) 25);
+ variables.put("lastVisit", (Long) 1438270117000L);
+
+ RuntimeService runtimeService = processEngineRule.getRuntimeService();
+ assertNotNull(runtimeService);
+ processEngineRule.getTaskService();
+ runtimeService.startProcessInstanceByKey("BaseTaskTest", variables);
+ }
+
+ /**
+ * Unit test code for BaseTask.
+ */
+ public static class TestTask extends BaseTask {
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private Expression existingString;
+ private Expression nonExistingString;
+ private Expression existingStringFromVar;
+ private Expression nonExistingStringFromVar;
+
+ private Expression existingInteger;
+ private Expression nonExistingInteger;
+ private Expression existingIntegerFromVar;
+ private Expression nonExistingIntegerFromVar;
+
+ private Expression existingLong;
+ private Expression nonExistingLong;
+ private Expression existingLongFromVar;
+ private Expression nonExistingLongFromVar;
+
+ private Expression existingOutputVar;
+ private Expression nonExistingOutputVar;
+ private Expression existingBadOutputVar;
+
+ public void execute(DelegateExecution execution) throws Exception {
+ msoLogger.debug("Started executing " + getClass().getSimpleName());
+
+ /*********************************************************************/
+ msoLogger.debug("Running String Field Tests");
+ /*********************************************************************/
+
+ String s = getStringField(existingString, execution, "existingString");
+ Assert.assertEquals("Hello World", s);
+
+ try {
+ s = getStringField(nonExistingString, execution, "nonExistingString");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ s = getOptionalStringField(existingString, execution, "existingString");
+ Assert.assertEquals("Hello World", s);
+
+ s = getOptionalStringField(nonExistingString, execution, "nonExistingString");
+ Assert.assertEquals(null, s);
+
+ /*********************************************************************/
+ msoLogger.debug("Running String Expression Tests");
+ /*********************************************************************/
+
+ s = getStringField(existingStringFromVar, execution, "existingStringFromVar");
+ Assert.assertEquals("Jane", s);
+
+ try {
+ s = getStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingStringFromVar");
+ }
+ }
+
+ s = getOptionalStringField(existingStringFromVar, execution, "existingStringFromVar");
+ Assert.assertEquals("Jane", s);
+
+ s = getOptionalStringField(nonExistingStringFromVar, execution, "nonExistingStringFromVar");
+ Assert.assertEquals(null, s);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Integer Field Tests");
+ /*********************************************************************/
+
+ Integer i = getIntegerField(existingInteger, execution, "existingInteger");
+ Assert.assertEquals((Integer) 42, i);
+
+ try {
+ i = getIntegerField(nonExistingInteger, execution, "nonExistingInteger");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ }
+ }
+
+ i = getOptionalIntegerField(existingInteger, execution, "existingInteger");
+ Assert.assertEquals((Integer) 42, i);
+
+ i = getOptionalIntegerField(nonExistingInteger, execution, "nonExistingInteger");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Integer Expression Tests");
+ /*********************************************************************/
+
+ i = getIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
+ Assert.assertEquals((Integer) 25, i);
+
+ try {
+ i = getIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingInteger");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingIntegerFromVar");
+ }
+ }
+
+ i = getOptionalIntegerField(existingIntegerFromVar, execution, "existingIntegerFromVar");
+ Assert.assertEquals((Integer) 25, i);
+
+ i = getOptionalIntegerField(nonExistingIntegerFromVar, execution, "nonExistingIntegerFromVar");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Long Field Tests");
+ /*********************************************************************/
+
+ Long l = getLongField(existingLong, execution, "existingLong");
+ Assert.assertEquals((Long) 123456789L, l);
+
+ try {
+ l = getLongField(nonExistingLong, execution, "nonExistingLong");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ }
+ }
+
+ l = getOptionalLongField(existingLong, execution, "existingLong");
+ Assert.assertEquals((Long) 123456789L, l);
+
+ l = getOptionalLongField(nonExistingLong, execution, "nonExistingLong");
+ Assert.assertEquals(null, l);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Long Expression Tests");
+ /*********************************************************************/
+
+ l = getLongField(existingLongFromVar, execution, "existingLongFromVar");
+ Assert.assertEquals((Long) 1438270117000L, l);
+
+ try {
+ l = getLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLong");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingLongFromVar");
+ }
+ }
+
+ l = getOptionalLongField(existingLongFromVar, execution, "existingLongFromVar");
+ Assert.assertEquals((Long) 1438270117000L, l);
+
+ l = getOptionalLongField(nonExistingLongFromVar, execution, "nonExistingLongFromVar");
+ Assert.assertEquals(null, i);
+
+ /*********************************************************************/
+ msoLogger.debug("Running Output Variable Field Tests");
+ /*********************************************************************/
+
+ String var = getOutputField(existingOutputVar, execution, "existingOutputVar");
+ Assert.assertEquals("goodVariable", var);
+
+ try {
+ var = getOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ var = getOptionalOutputField(existingOutputVar, execution, "existingOutputVar");
+ Assert.assertEquals("goodVariable", var);
+
+ var = getOptionalOutputField(nonExistingOutputVar, execution, "nonExistingOutputVar");
+ Assert.assertEquals(null, var);
+
+ try {
+ var = getOutputField(existingBadOutputVar, execution, "existingBadOutputVar");
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ } catch (Exception e) {
+ if (!(e instanceof BadInjectedFieldException)) {
+ Assert.fail("Expected BadInjectedFieldException for nonExistingString");
+ }
+ }
+
+ msoLogger.debug("Finished executing " + getClass().getSimpleName());
+ }
+ }
}
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
index 57f479f7cb..edaf45848f 100644
--- 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
@@ -23,6 +23,7 @@ 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 {
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
index f29ccc75e0..0fb15f93b9 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/utils/CamundaDBSetup.java
@@ -31,84 +31,84 @@ import org.openecomp.mso.logger.MsoLogger;
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
- private static boolean isDBConfigured = false;
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private CamundaDBSetup() {
- }
-
- public static synchronized void configure() throws SQLException {
- if (isDBConfigured) {
- return;
- }
-
- LOGGER.debug ("Configuring the Camunda H2 database for MSO");
-
- Connection connection = null;
- PreparedStatement stmt = null;
-
- try {
- connection = DriverManager.getConnection(
- "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
-
- stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
- stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
+ private static boolean isDBConfigured = false;
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private CamundaDBSetup() {
+ }
+
+ public static synchronized void configure() throws SQLException {
+ if (isDBConfigured) {
+ return;
+ }
+
+ LOGGER.debug("Configuring the Camunda H2 database for MSO");
+
+ Connection connection = null;
+ PreparedStatement stmt = null;
+
+ try {
+ connection = DriverManager.getConnection(
+ "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
+
+ stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
+ stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob");
// stmt.executeUpdate();
// stmt.close();
// stmt = null;
- stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
+ stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
- stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
+ stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob");
// stmt.executeUpdate();
// stmt.close();
// stmt = null;
- stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
- stmt.executeUpdate();
- stmt.close();
- stmt = null;
-
- connection.close();
- connection = null;
-
- isDBConfigured = true;
- } catch (SQLException e) {
- LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName());
- LOGGER.debug("SQLException :",e);
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
-
- if (connection != null) {
- try {
- connection.close();
- } catch (Exception e) {
- LOGGER.debug("Exception :",e);
- }
- }
- }
- }
+ stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
+ stmt.executeUpdate();
+ stmt.close();
+ stmt = null;
+
+ connection.close();
+ connection = null;
+
+ isDBConfigured = true;
+ } catch (SQLException e) {
+ LOGGER.debug("CamundaDBSetup caught " + e.getClass().getSimpleName());
+ LOGGER.debug("SQLException :", e);
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :", e);
+ }
+ }
+ }
+ }
} \ No newline at end of file