* 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=========================================================
*/
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;
*/
public class TestApexSamplePolicyModel {
private static final String VALID_MODEL_STRING = "***validation of model successful***";
- private Connection connection;
private TestApexModel<AxPolicyModel> testApexModel;
/**
*/
@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.
*
@Test
public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
- DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName());
+ DaoParameters.setPluginClass(DefaultApexDao.class.getName());
DaoParameters.setPersistenceUnit("SampleModelTest");
+ Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb");
testApexModel.testApexModelWriteReadJpa(DaoParameters);
+ connection.close();
}
-
+
}