diff options
Diffstat (limited to 'testsuites/integration/integration-executor-test/src')
3 files changed, 13 insertions, 39 deletions
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java index e863a990a..426db8328 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java @@ -5,15 +5,15 @@ * 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -23,7 +23,6 @@ package org.onap.policy.apex.testsuites.integration.executor.handling; import java.sql.Connection; import java.sql.DriverManager; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; @@ -35,7 +34,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * The Class TestApexSamplePolicyDbWrite. */ public class TestApexSamplePolicyDbWrite { - private Connection connection; TestApexModel<AxPolicyModel> testApexModel; /** @@ -45,23 +43,11 @@ public class TestApexSamplePolicyDbWrite { */ @Before public void setup() throws Exception { - connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - final TestApexSamplePolicyModelCreator apexPolicyModelCreator = new TestApexSamplePolicyModelCreator("MVEL"); testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator); } /** - * Teardown. - * - * @throws Exception the exception - */ - @After - public void teardown() throws Exception { - connection.close(); - } - - /** * Test model write read jpa. * * @throws Exception the exception @@ -72,6 +58,8 @@ public class TestApexSamplePolicyDbWrite { DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); DaoParameters.setPersistenceUnit("SampleModelTest"); + Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb"); testApexModel.testApexModelWriteReadJpa(DaoParameters); + connection.close(); } } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java index 1e7daad03..a5800956d 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java @@ -5,15 +5,15 @@ * 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. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; import java.sql.Connection; import java.sql.DriverManager; -import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; @@ -39,7 +38,6 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; */ public class TestApexSamplePolicyModel { private static final String VALID_MODEL_STRING = "***validation of model successful***"; - private Connection connection; private TestApexModel<AxPolicyModel> testApexModel; /** @@ -49,23 +47,11 @@ public class TestApexSamplePolicyModel { */ @Before public void setup() throws Exception { - connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestApexSamplePolicyModelCreator("MVEL")); } /** - * Teardown. - * - * @throws Exception the exception - */ - @After - public void teardown() throws Exception { - connection.close(); - } - - /** * Test model valid. * * @throws Exception the exception @@ -107,8 +93,10 @@ public class TestApexSamplePolicyModel { DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); DaoParameters.setPersistenceUnit("SampleModelTest"); + Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb"); testApexModel.testApexModelWriteReadJpa(DaoParameters); + connection.close(); } - + } diff --git a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml index 40773a4d4..b2d6a96ed 100644 --- a/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml +++ b/testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml @@ -57,10 +57,8 @@ <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class> <properties> - <property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" /> - <property name="javax.persistence.target-database" value="Derby" /> - <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" /> - + <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" /> + <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> <property name="eclipselink.ddl-generation" value="drop-and-create-tables" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.logging.level" value="INFO" /> |