summaryrefslogtreecommitdiffstats
path: root/examples/examples-adaptive/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-adaptive/src/test')
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java15
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java15
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java15
-rw-r--r--examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java15
-rw-r--r--examples/examples-adaptive/src/test/resources/META-INF/persistence.xml6
5 files changed, 2 insertions, 64 deletions
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java
index 885704497..3004bccb3 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionDbWriteTest.java
@@ -20,11 +20,6 @@
package org.onap.policy.apex.examples.adaptive;
-import java.io.File;
-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;
@@ -32,7 +27,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class AnomalyDetectionDbWriteTest {
- private Connection connection;
TestApexModel<AxPolicyModel> testApexModel;
/**
@@ -41,18 +35,9 @@ public class AnomalyDetectionDbWriteTest {
*/
@Before
public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAnomalyDetectionModelCreator());
}
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
@Test
public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java
index 552ca2f37..5a36d4070 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AnomalyDetectionModelTest.java
@@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.adaptive;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-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;
@@ -35,7 +30,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class AnomalyDetectionModelTest {
- private Connection connection;
TestApexModel<AxPolicyModel> testApexModel;
/**
@@ -44,18 +38,9 @@ public class AnomalyDetectionModelTest {
*/
@Before
public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAnomalyDetectionModelCreator());
}
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
@Test
public void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java
index 828a56133..b72514f49 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnDbWriteTest.java
@@ -20,11 +20,6 @@
package org.onap.policy.apex.examples.adaptive;
-import java.io.File;
-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;
@@ -32,7 +27,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class AutoLearnDbWriteTest {
- private Connection connection;
TestApexModel<AxPolicyModel> testApexModel;
/**
@@ -41,18 +35,9 @@ public class AutoLearnDbWriteTest {
*/
@Before
public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAutoLearnModelCreator());
}
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
@Test
public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java
index f4cddc580..1823f9871 100644
--- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java
+++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/AutoLearnModelTest.java
@@ -22,11 +22,6 @@ package org.onap.policy.apex.examples.adaptive;
import static org.junit.Assert.assertTrue;
-import java.io.File;
-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;
@@ -35,7 +30,6 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class AutoLearnModelTest {
- private Connection connection;
TestApexModel<AxPolicyModel> testApexModel;
/**
@@ -44,18 +38,9 @@ public class AutoLearnModelTest {
*/
@Before
public void setup() throws Exception {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
- connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
-
testApexModel = new TestApexModel<>(AxPolicyModel.class, new TestAutoLearnModelCreator());
}
- @After
- public void teardown() throws Exception {
- connection.close();
- new File("derby.log").delete();
- }
-
@Test
public void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
diff --git a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml b/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml
index 4dcd879b6..1e70abc6d 100644
--- a/examples/examples-adaptive/src/test/resources/META-INF/persistence.xml
+++ b/examples/examples-adaptive/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" />