diff options
author | 2022-02-03 12:01:57 +0000 | |
---|---|---|
committer | 2022-02-03 12:02:01 +0000 | |
commit | de18be8467912348ea73c7f5557397bab9ba86b3 (patch) | |
tree | 0dc1ea0d7e6612aace7bc42225a86fa32192ef25 /model/basic-model/src/test/java/org | |
parent | 47847dc47c42325ed416d59b1f6b9087733db92f (diff) |
Remove direct DB Load/Save from apex-pdp
This review is part of a series of reviews to move the apex-pdp state
machine model to use the base model types in policy models.
Persistence of policies for apex-pdp is now implemented in PAP and API.
The historic direct load and save functionality for APEX policy state
machine models to and from databases is no longer used and no longer
supported.
This revmoves the DAO code from apex-pdp and the associated handling
and test code.
The next review will remove the JPA annotations.
Subsequent reviews will mvoe the mdoel across to use the policy models
base model types.
Issue-ID: POLICY-1820
Change-Id: Iabf034b40a413d32fe62091fe3446f52ec30d3af
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/basic-model/src/test/java/org')
4 files changed, 41 insertions, 389 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java index d066d674c..0c7edee28 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfoTest.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2021 Nordix Foundation. + * Modifications Copyright (C) 2019-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,10 +65,11 @@ public class AxKeyInfoTest { assertEquals(testKeyInfo, testKeyInfo); // NOSONAR assertEquals(testKeyInfo, clonedReferenceKey); assertNotNull(testKeyInfo); - assertNotEquals(testKeyInfo, (Object) new AxArtifactKey()); + Object differentKeyType = new AxArtifactKey(); + assertNotEquals(testKeyInfo, differentKeyType); assertNotEquals(testKeyInfo, new AxKeyInfo(new AxArtifactKey())); assertNotEquals(testKeyInfo, new AxKeyInfo(key, UUID.randomUUID(), "Some Description")); - assertNotEquals(testKeyInfo, new AxKeyInfo(key, uuid, "Some Description")); + assertEquals(testKeyInfo, new AxKeyInfo(key, uuid, "Some Other Description")); assertEquals(testKeyInfo, new AxKeyInfo(key, uuid, "Key Description")); assertEquals(0, testKeyInfo.compareTo(testKeyInfo)); diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/DaoMiscTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/DaoMiscTest.java deleted file mode 100644 index 6f9bef83d..000000000 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/DaoMiscTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.model.basicmodel.dao; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.Properties; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; -import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String; - -public class DaoMiscTest { - - @Test - public void testUuid2StringMopUp() { - final Uuid2String uuid2String = new Uuid2String(); - assertEquals("", uuid2String.convertToDatabaseColumn(null)); - } - - @Test - public void testCDataConditionerMopUp() { - assertNull(CDataConditioner.clean(null)); - } - - @Test - public void testDaoFactory() { - final DaoParameters daoParameters = new DaoParameters(); - - daoParameters.setPluginClass("somewhere.over.the.rainbow"); - assertThatThrownBy(() -> new ApexDaoFactory().createApexDao(daoParameters)) - .hasMessage("Apex DAO class not found for DAO plugin \"somewhere.over.the.rainbow\""); - daoParameters.setPluginClass("java.lang.String"); - assertThatThrownBy(() -> new ApexDaoFactory().createApexDao(daoParameters)) - .hasMessage("Specified Apex DAO plugin class \"java.lang.String\" " - + "does not implement the ApexDao interface"); - } - - @Test - public void testDaoParameters() { - final DaoParameters pars = new DaoParameters(); - pars.setJdbcProperties(new Properties()); - assertEquals(0, pars.getJdbcProperties().size()); - - pars.setJdbcProperty("name", "Dorothy"); - assertEquals("Dorothy", pars.getJdbcProperty("name")); - - pars.setPersistenceUnit("Kansas"); - assertEquals("Kansas", pars.getPersistenceUnit()); - - pars.setPluginClass("somewhere.over.the.rainbow"); - assertEquals("somewhere.over.the.rainbow", pars.getPluginClass()); - - assertEquals("DAOParameters [pluginClass=somewhere.over.the.rainbow, " - + "persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]", pars.toString()); - } -} diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java deleted file mode 100644 index e584085c3..000000000 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java +++ /dev/null @@ -1,262 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. - * ================================================================================ - * 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========================================================= - */ - -package org.onap.policy.apex.model.basicmodel.dao; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.UUID; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.concepts.DummyEntity; - -/** - * JUnit test class. - */ -public class EntityTest { - private ApexDao apexDao; - - @Test - public void testEntityTestSanity() throws ApexException { - final DaoParameters daoParameters = new DaoParameters(); - - apexDao = new ApexDaoFactory().createApexDao(daoParameters); - - assertThatThrownBy(() -> apexDao.init(null)) - .hasMessage("Apex persistence unit parameter not set"); - assertThatThrownBy(() -> apexDao.init(daoParameters)) - .hasMessage("Apex persistence unit parameter not set"); - daoParameters.setPluginClass("somewhere.over.the.rainbow"); - daoParameters.setPersistenceUnit("Dorothy"); - assertThatThrownBy(() -> apexDao.init(daoParameters)) - .hasMessage("Creation of Apex persistence unit \"Dorothy\" failed"); - assertThatThrownBy(() -> apexDao.create(new AxArtifactKey())) - .hasMessage("Apex DAO has not been initialized"); - apexDao.close(); - } - - @Test - public void testEntityTestAllOpsJpa() throws ApexException { - final DaoParameters daoParameters = new DaoParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DaoTest"); - - apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); - - testAllOps(); - apexDao.close(); - } - - @Test - public void testEntityTestBadVals() throws ApexException { - final DaoParameters daoParameters = new DaoParameters(); - assertNotNull(daoParameters); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - assertEquals("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao", daoParameters.getPluginClass()); - daoParameters.setPersistenceUnit("DaoTest"); - assertEquals("DaoTest", daoParameters.getPersistenceUnit()); - - apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); - - final AxArtifactKey nullKey = null; - final AxReferenceKey nullRefKey = null; - final List<AxArtifactKey> nullKeyList = null; - final List<AxArtifactKey> emptyKeyList = new ArrayList<>(); - final List<AxReferenceKey> nullRKeyList = null; - final List<AxReferenceKey> emptyRKeyList = new ArrayList<>(); - - apexDao.create(nullKey); - apexDao.createCollection(nullKeyList); - apexDao.createCollection(emptyKeyList); - - apexDao.delete(nullKey); - apexDao.deleteCollection(nullKeyList); - apexDao.deleteCollection(emptyKeyList); - apexDao.delete(AxArtifactKey.class, nullKey); - apexDao.delete(AxReferenceKey.class, nullRefKey); - apexDao.deleteByArtifactKey(AxArtifactKey.class, nullKeyList); - apexDao.deleteByArtifactKey(AxArtifactKey.class, emptyKeyList); - apexDao.deleteByReferenceKey(AxReferenceKey.class, nullRKeyList); - apexDao.deleteByReferenceKey(AxReferenceKey.class, emptyRKeyList); - - apexDao.get(null, nullKey); - apexDao.get(null, nullRefKey); - apexDao.getAll(null); - apexDao.getAll(null, nullKey); - apexDao.getArtifact(null, nullKey); - apexDao.getArtifact(AxArtifactKey.class, nullKey); - apexDao.getArtifact(null, nullRefKey); - apexDao.getArtifact(AxReferenceKey.class, nullRefKey); - apexDao.size(null); - - apexDao.close(); - } - - private void testAllOps() { - final AxArtifactKey aKey0 = new AxArtifactKey("A-KEY0", "0.0.1"); - final AxArtifactKey aKey1 = new AxArtifactKey("A-KEY1", "0.0.1"); - final AxArtifactKey aKey2 = new AxArtifactKey("A-KEY2", "0.0.1"); - final AxKeyInfo keyInfo0 = new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), - "key description 0"); - final AxKeyInfo keyInfo1 = new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), - "key description 1"); - final AxKeyInfo keyInfo2 = new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), - "key description 2"); - - apexDao.create(keyInfo0); - - final AxKeyInfo keyInfoBack0 = apexDao.get(AxKeyInfo.class, aKey0); - assertEquals(keyInfo0, keyInfoBack0); - - final AxKeyInfo keyInfoBackNull = apexDao.get(AxKeyInfo.class, AxArtifactKey.getNullKey()); - assertNull(keyInfoBackNull); - - final AxKeyInfo keyInfoBack1 = apexDao.getArtifact(AxKeyInfo.class, aKey0); - assertEquals(keyInfoBack0, keyInfoBack1); - - final AxKeyInfo keyInfoBack2 = apexDao.getArtifact(AxKeyInfo.class, new AxArtifactKey("A-KEY3", "0.0.1")); - assertNull(keyInfoBack2); - - final Set<AxKeyInfo> keyInfoSetIn = new TreeSet<AxKeyInfo>(); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo2); - - apexDao.createCollection(keyInfoSetIn); - - Set<AxKeyInfo> keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - - keyInfoSetIn.add(keyInfo0); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.delete(keyInfo1); - keyInfoSetIn.remove(keyInfo1); - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.deleteCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(0, keyInfoSetOut.size()); - - keyInfoSetIn.add(keyInfo0); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo0); - apexDao.createCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.delete(AxKeyInfo.class, aKey0); - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(2, keyInfoSetOut.size()); - assertEquals(2, apexDao.size(AxKeyInfo.class)); - - final Set<AxArtifactKey> keySetIn = new TreeSet<AxArtifactKey>(); - keySetIn.add(aKey1); - keySetIn.add(aKey2); - - final int deletedCount = apexDao.deleteByArtifactKey(AxKeyInfo.class, keySetIn); - assertEquals(2, deletedCount); - - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(0, keyInfoSetOut.size()); - - keyInfoSetIn.add(keyInfo0); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo0); - apexDao.createCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class)); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.deleteAll(AxKeyInfo.class); - assertEquals(0, apexDao.size(AxKeyInfo.class)); - - final AxArtifactKey owner0Key = new AxArtifactKey("Owner0", "0.0.1"); - final AxArtifactKey owner1Key = new AxArtifactKey("Owner1", "0.0.1"); - final AxArtifactKey owner2Key = new AxArtifactKey("Owner2", "0.0.1"); - final AxArtifactKey owner3Key = new AxArtifactKey("Owner3", "0.0.1"); - final AxArtifactKey owner4Key = new AxArtifactKey("Owner4", "0.0.1"); - final AxArtifactKey owner5Key = new AxArtifactKey("Owner5", "0.0.1"); - - apexDao.create(new DummyEntity(new AxReferenceKey(owner0Key, "Entity0"), 100.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner0Key, "Entity1"), 101.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner0Key, "Entity2"), 102.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner0Key, "Entity3"), 103.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner0Key, "Entity4"), 104.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner1Key, "Entity5"), 105.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner1Key, "Entity6"), 106.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner1Key, "Entity7"), 107.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner2Key, "Entity8"), 108.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner2Key, "Entity9"), 109.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner3Key, "EntityA"), 110.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner4Key, "EntityB"), 111.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner5Key, "EntityC"), 112.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner5Key, "EntityD"), 113.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner5Key, "EntityE"), 114.0)); - apexDao.create(new DummyEntity(new AxReferenceKey(owner5Key, "EntityF"), 115.0)); - - TreeSet<DummyEntity> testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class)); - assertEquals(16, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner0Key)); - assertEquals(5, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner1Key)); - assertEquals(3, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner2Key)); - assertEquals(2, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner3Key)); - assertEquals(1, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner4Key)); - assertEquals(1, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet<DummyEntity>(apexDao.getAll(DummyEntity.class, owner5Key)); - assertEquals(4, testEntitySetOut.size()); - - assertNotNull(apexDao.get(DummyEntity.class, new AxReferenceKey(owner0Key, "Entity0"))); - assertNotNull(apexDao.getArtifact(DummyEntity.class, new AxReferenceKey(owner0Key, "Entity0"))); - assertNull(apexDao.get(DummyEntity.class, new AxReferenceKey(owner0Key, "Entity1000"))); - assertNull(apexDao.getArtifact(DummyEntity.class, new AxReferenceKey(owner0Key, "Entity1000"))); - apexDao.delete(DummyEntity.class, new AxReferenceKey(owner0Key, "Entity0")); - - final Set<AxReferenceKey> rKeySetIn = new TreeSet<AxReferenceKey>(); - rKeySetIn.add(new AxReferenceKey(owner4Key, "EntityB")); - rKeySetIn.add(new AxReferenceKey(owner5Key, "EntityD")); - - final int deletedRCount = apexDao.deleteByReferenceKey(DummyEntity.class, rKeySetIn); - assertEquals(2, deletedRCount); - - apexDao.update(new DummyEntity(new AxReferenceKey(owner5Key, "EntityF"), 120.0)); - } -} diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java index 1c21b6c33..bb9776fc7 100644 --- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java +++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/SupportApexBasicModelTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. + * Modifications Copyright (C) 2020-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,10 +28,45 @@ import org.junit.Before; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxModel; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; public class SupportApexBasicModelTest { + // As there are no real concepts in a basic model, this is as near to a valid model as we can get + private static final String VALID_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" + + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; + + private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" + + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" + + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; + + private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:OBSERVATION:description is blank\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:" + + "(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n" + + "********************************"; + + private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" + + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." + + "AxModel:INVALID:key information not found for key " + + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + "********************************"; + TestApexModel<AxModel> testApexModel; /** @@ -83,49 +118,4 @@ public class SupportApexBasicModelTest { public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } - - @Test - public void testModelWriteReadJpa() throws Exception { - final DaoParameters daoParameters = new DaoParameters(); - daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); - daoParameters.setPersistenceUnit("DaoTest"); - - testApexModel.testApexModelWriteReadJpa(daoParameters); - } - - // As there are no real concepts in a basic model, this is as near to a valid model as we can get - private static final String VALID_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; - - private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n" - + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" - + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts" - + ".AxModel:WARNING:key not found for key information entry\n" + "********************************"; - - private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxKeyInfo:OBSERVATION:description is blank\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:" - + "(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n" - + "********************************"; - - private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n" - + "AxArtifactKey:(name=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts." - + "AxModel:INVALID:key information not found for key " - + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + "********************************"; } |