diff options
author | liamfallon <liam.fallon@est.tech> | 2019-04-16 11:20:08 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-04-16 11:20:08 +0000 |
commit | 3cb682fa71a1749fb99a47d7c8ede2b8984e2c07 (patch) | |
tree | 08aa6b83f985cfefcb0618d146b2e77428110055 /model/policy-model | |
parent | 2ba499f11094cfd1321e59789869a0c475406b58 (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 'model/policy-model')
-rw-r--r-- | model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java | 23 | ||||
-rw-r--r-- | model/policy-model/src/test/resources/META-INF/persistence.xml | 6 |
2 files changed, 6 insertions, 23 deletions
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java index 7a240e18b..a521272ae 100644 --- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java +++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.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,11 +23,6 @@ package org.onap.policy.apex.model.policymodel.handling; import static org.junit.Assert.assertEquals; 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; @@ -36,28 +31,18 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; public class ApexPolicyModelTest { - private Connection connection; TestApexModel<AxPolicyModel> testApexModel; /** * Set up the policy model tests. - * + * * @throws Exception on setup errors */ @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>(AxPolicyModel.class, new SupportApexPolicyModelCreator()); } - @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/model/policy-model/src/test/resources/META-INF/persistence.xml b/model/policy-model/src/test/resources/META-INF/persistence.xml index cd9a420d0..0eee729a1 100644 --- a/model/policy-model/src/test/resources/META-INF/persistence.xml +++ b/model/policy-model/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" /> |