diff options
author | Rob Daugherty <rd472p@att.com> | 2018-03-09 15:02:18 -0500 |
---|---|---|
committer | Rob Daugherty <rd472p@att.com> | 2018-03-09 15:08:14 -0500 |
commit | 96b5a685d0c3afddb632e4a68ca7483f933b55dc (patch) | |
tree | 246399de05a3d429bf45ef1e5af2b9b0218d99f3 /bpmn/MSOCoreBPMN/src | |
parent | 4475278c81668109b2b37a1d2720d8f2910641c4 (diff) |
Revert Reduce log noise/warnings
This reverts commit 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e.
It is seriously impeding our ability complete the promised merge of AT&T
1802 code.
While I'm all for coding standards, if we are serious about using spaces
instead of tabs, then I think we need to (1) agree with the community when
this will happen, (2) do consistently in all files, and (3) enforce it.
Change-Id: Ib9b996f6b6c7d81ac9ac95d58b0c7d8cc39675ff
Issue-ID: SO-368
Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOCoreBPMN/src')
5 files changed, 337 insertions, 339 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 861ea0a749..58f1ae264d 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,7 +46,6 @@ 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 80871db00d..506dba2552 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")); - - 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")); - } + @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")); - @Test(expected = IllegalArgumentException.class) - public void testPropertyFileDoesNotExists_NotIntheList() throws IOException { - PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); - propertyConfiguration.getProperties("badfile.properties"); - Assert.fail("Expected IllegalArgumentException"); - } + Map<String, String> newProperties = PropertyConfigurationSetup.createBpmnProperties(); + newProperties.put("newKey", "newValue"); + PropertyConfigurationSetup.addProperties(newProperties, 10000); - @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"); - } + // 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"); + } } 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 17580c03a5..2d204c338a 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 edaf45848f..57f479f7cb 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,7 +23,6 @@ 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 0fb15f93b9..f29ccc75e0 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 |