aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-executor-test/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-04-16 11:20:08 +0000
committerliamfallon <liam.fallon@est.tech>2019-04-16 11:20:08 +0000
commit3cb682fa71a1749fb99a47d7c8ede2b8984e2c07 (patch)
tree08aa6b83f985cfefcb0618d146b2e77428110055 /testsuites/integration/integration-executor-test/src/test/java
parent2ba499f11094cfd1321e59789869a0c475406b58 (diff)
Fix Security and Unit Test DB issues
This review removes more links to the Zookeeper version 3.5.4-beta with Zookeeper version 3.4.14. It also replaces the Derby in-memory database with the H2 in memory database for unit tests. Issue-ID: POLICY-1540 Change-Id: Ic44f2e866644114b7c0cf66aac7e528017b8206b Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'testsuites/integration/integration-executor-test/src/test/java')
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java22
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java24
2 files changed, 11 insertions, 35 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();
}
-
+
}