summaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-executor-test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-04-16 13:32:48 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-16 13:32:48 +0000
commitad9e9c590b5aadbd5f95fb6f93718f7922762cf1 (patch)
tree514aa3ccc88c6b4fea236e57450ff2d2f8d56b8c /testsuites/integration/integration-executor-test
parent00ee73f723560c825818eab41a4d3db9785627d4 (diff)
parent3cb682fa71a1749fb99a47d7c8ede2b8984e2c07 (diff)
Merge "Fix Security and Unit Test DB issues"
Diffstat (limited to 'testsuites/integration/integration-executor-test')
-rw-r--r--testsuites/integration/integration-executor-test/pom.xml12
-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
-rw-r--r--testsuites/integration/integration-executor-test/src/test/resources/META-INF/persistence.xml6
4 files changed, 13 insertions, 51 deletions
diff --git a/testsuites/integration/integration-executor-test/pom.xml b/testsuites/integration/integration-executor-test/pom.xml
index 1a106eeeb..f50b84460 100644
--- a/testsuites/integration/integration-executor-test/pom.xml
+++ b/testsuites/integration/integration-executor-test/pom.xml
@@ -38,12 +38,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.onap.policy.apex-pdp.context</groupId>
- <artifactId>context-test-utils</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
<artifactId>integration-common</artifactId>
<version>${project.version}</version>
@@ -78,12 +72,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${version.derby}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<profiles>
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" />