From de18be8467912348ea73c7f5557397bab9ba86b3 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 3 Feb 2022 12:01:57 +0000 Subject: 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 --- .../apex/model/basicmodel/concepts/AxKeyInfo.java | 14 +- .../policy/apex/model/basicmodel/dao/ApexDao.java | 206 --------- .../apex/model/basicmodel/dao/ApexDaoFactory.java | 70 --- .../apex/model/basicmodel/dao/DaoParameters.java | 123 ----- .../dao/converters/CDataConditioner.java | 83 ---- .../basicmodel/dao/converters/Uuid2String.java | 73 --- .../basicmodel/dao/converters/package-info.java | 28 -- .../model/basicmodel/dao/impl/DefaultApexDao.java | 497 --------------------- .../model/basicmodel/dao/impl/package-info.java | 27 -- .../apex/model/basicmodel/dao/package-info.java | 29 -- .../apex/model/basicmodel/test/TestApexModel.java | 27 +- .../model/basicmodel/concepts/AxKeyInfoTest.java | 7 +- .../apex/model/basicmodel/dao/DaoMiscTest.java | 77 ---- .../apex/model/basicmodel/dao/EntityTest.java | 262 ----------- .../handling/SupportApexBasicModelTest.java | 84 ++-- .../src/test/resources/META-INF/persistence.xml | 43 -- 16 files changed, 44 insertions(+), 1606 deletions(-) delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java delete mode 100644 model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java delete mode 100644 model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/DaoMiscTest.java delete mode 100644 model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java delete mode 100644 model/basic-model/src/test/resources/META-INF/persistence.xml (limited to 'model/basic-model/src') diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java index 7e92faddf..2e788a3d5 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.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. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,7 +26,6 @@ import java.util.List; import java.util.Random; import java.util.UUID; import javax.persistence.Column; -import javax.persistence.Convert; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Table; @@ -35,11 +34,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; -import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner; -import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String; import org.onap.policy.common.utils.validation.Assertions; /** @@ -74,14 +70,10 @@ public class AxKeyInfo extends AxConcept { private AxArtifactKey key; @Column(name = "uuid") - @Convert(converter = Uuid2String.class) - @XmlJavaTypeAdapter(value = Uuid2String.class) @XmlElement(name = "UUID", required = true) private UUID uuid; @Column(name = "description", length = MAX_DESCRIPTION_LENGTH_8192) - @Convert(converter = CDataConditioner.class) - @XmlJavaTypeAdapter(value = CDataConditioner.class) @XmlElement(required = true) private String description; @@ -299,9 +291,7 @@ public class AxKeyInfo extends AxConcept { if (!uuid.equals(other.uuid)) { return false; } - final String thisdesc = CDataConditioner.clean(description); - final String otherdesc = CDataConditioner.clean(other.description); - return thisdesc.equals(otherdesc); + return description.equals(description); } /** diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java deleted file mode 100644 index b84646038..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDao.java +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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 java.util.Collection; -import java.util.List; -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.AxConcept; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; - -/** - * The Interface ApexDao describes the DAO interface for reading and writing Apex {@link AxConcept} concepts to and from - * databases using JDBC. - * - * @author Sergey Sachkov - * @author liam.fallon@ericsson.com - */ -public interface ApexDao { - - /** - * Initialize the Apex DAO with the given parameters. - * - * @param daoParameters parameters to use to access the database - * @throws ApexException on initialization errors - */ - void init(DaoParameters daoParameters) throws ApexException; - - /** - * Close the Apex DAO. - */ - void close(); - - /** - * Creates an Apex concept on the database. - * - * @param the type of the object to create, a subclass of {@link AxConcept} - * @param obj the object to create - */ - void create(T obj); - - /** - * Delete an Apex concept on the database. - * - * @param the type of the object to delete, a subclass of {@link AxConcept} - * @param obj the object to delete - */ - void delete(T obj); - - /** - * Delete an Apex concept on the database. - * - * @param the type of the object to delete, a subclass of {@link AxConcept} - * @param someClass the class of the object to delete, a subclass of {@link AxConcept} - * @param key the key of the object to delete - */ - void delete(Class someClass, AxArtifactKey key); - - /** - * Delete an Apex concept on the database. - * - * @param the type of the object to delete, a subclass of {@link AxConcept} - * @param someClass the class of the object to delete, a subclass of {@link AxConcept} - * @param key the key of the object to delete - */ - void delete(Class someClass, AxReferenceKey key); - - /** - * Create a collection of objects in the database. - * - * @param the type of the object to create, a subclass of {@link AxConcept} - * @param objs the objects to create - */ - void createCollection(Collection objs); - - /** - * Delete a collection of objects in the database. - * - * @param the type of the objects to delete, a subclass of {@link AxConcept} - * @param objs the objects to delete - */ - void deleteCollection(Collection objs); - - /** - * Delete a collection of objects in the database referred to by artifact key. - * - * @param the type of the objects to delete, a subclass of {@link AxConcept} - * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} - * @param keys the keys of the objects to delete - * @return the number of objects deleted - */ - int deleteByArtifactKey(Class someClass, Collection keys); - - /** - * Delete a collection of objects in the database referred to by reference key. - * - * @param the type of the objects to delete, a subclass of {@link AxConcept} - * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} - * @param keys the keys of the objects to delete - * @return the number of objects deleted - */ - int deleteByReferenceKey(Class someClass, Collection keys); - - /** - * Delete all objects of a given class in the database. - * - * @param the type of the objects to delete, a subclass of {@link AxConcept} - * @param someClass the class of the objects to delete, a subclass of {@link AxConcept} - */ - void deleteAll(Class someClass); - - /** - * Get an object from the database, referred to by artifact key. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param someClass the class of the object to get, a subclass of {@link AxConcept} - * @param key the key of the object to get - * @return the object that was retrieved from the database - */ - T get(Class someClass, AxArtifactKey key); - - /** - * Get an object from the database, referred to by reference key. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param someClass the class of the object to get, a subclass of {@link AxConcept} - * @param key the key of the object to get - * @return the object that was retrieved from the database or null if the object was not retrieved - */ - T get(Class someClass, AxReferenceKey key); - - /** - * Get all the objects in the database of a given type. - * - * @param the type of the objects to get, a subclass of {@link AxConcept} - * @param someClass the class of the objects to get, a subclass of {@link AxConcept} - * @return the objects or null if no objects were retrieved - */ - List getAll(Class someClass); - - /** - * Get all the objects in the database of the given type with the given parent artifact key. - * - * @param the type of the objects to get, a subclass of {@link AxConcept} - * @param someClass the class of the objects to get, a subclass of {@link AxConcept} - * @param parentKey the parent key of the concepts to get - * @return the all - */ - List getAll(Class someClass, AxArtifactKey parentKey); - - /** - * Get a concept from the database with the given artifact key. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param someClass the class of the object to get, a subclass of {@link AxConcept} - * @param artifactId the artifact key of the concept to get - * @return the concept that matches the key or null if the concept is not retrieved - */ - T getArtifact(Class someClass, AxArtifactKey artifactId); - - /** - * Get a concept from the database with the given reference key. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param someClass the class of the object to get, a subclass of {@link AxConcept} - * @param artifactId the artifact key of the concept to get - * @return the concept that matches the key or null if the concept is not retrieved - */ - T getArtifact(Class someClass, AxReferenceKey artifactId); - - /** - * Get the number of instances of a concept that exist in the database. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param someClass the class of the object to get, a subclass of {@link AxConcept} - * @return the number of instances of the concept in the database - */ - long size(Class someClass); - - /** - * Update a concept in the database. - * - * @param the type of the object to get, a subclass of {@link AxConcept} - * @param obj the object to update - * @return the updated object - */ - T update(T obj); -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java deleted file mode 100644 index fad3b08b9..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-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 org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.common.utils.validation.Assertions; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * This factory class returns an Apex DAO for the configured persistence mechanism. The factory uses the plugin class - * specified in {@link DaoParameters} to instantiate a DAO instance. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ApexDaoFactory { - // Get a reference to the logger - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexDaoFactory.class); - - /** - * Return an Apex DAO for the required APEX DAO plugin class. - * - * @param daoParameters parameters to use to read the database configuration information - * @return the Apex DAO - * @throws ApexException on invalid JPA plugins - */ - public ApexDao createApexDao(final DaoParameters daoParameters) throws ApexException { - Assertions.argumentOfClassNotNull(daoParameters, ApexException.class, - "Parameter \"daoParameters\" may not be null"); - - // Get the class for the DAO using reflection - Object apexDaoObject = null; - try { - apexDaoObject = Class.forName(daoParameters.getPluginClass()).getDeclaredConstructor().newInstance(); - } catch (final Exception e) { - LOGGER.error("Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e); - throw new ApexException( - "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e); - } - - // Check the class is an Apex DAO - if (!(apexDaoObject instanceof ApexDao)) { - LOGGER.error("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() - + "\" does not implement the ApexDao interface"); - throw new ApexException("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass() - + "\" does not implement the ApexDao interface"); - } - - return (ApexDao) apexDaoObject; - } -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java deleted file mode 100644 index c575bd7c0..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/DaoParameters.java +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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 java.util.Properties; - -/** - * This class is a POJO that holds properties for Apex DAOs. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class DaoParameters { - /** The default Apex DAO plugin class. */ - public static final String DEFAULT_PLUGIN_CLASS = "org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"; - - private String pluginClass = DEFAULT_PLUGIN_CLASS; - private String persistenceUnit; - - private Properties jdbcProperties = new Properties(); - - /** - * Gets the DAO plugin class, this is the DAO class to use and it must implement the {@link ApexDao} interface. - * - * @return the DAO plugin class - */ - public String getPluginClass() { - return pluginClass; - } - - /** - * Sets the DAO plugin class, a class that implements the {@link ApexDao} interface. - * - * @param daoPluginClass the DAO plugin class - */ - public void setPluginClass(final String daoPluginClass) { - pluginClass = daoPluginClass; - } - - /** - * Gets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The - * persistence unit must defined in the {@code META-INF/persistence.xml} resource file - * - * @return the persistence unit to use for JDBC access - */ - public String getPersistenceUnit() { - return persistenceUnit; - } - - /** - * Sets the persistence unit for the DAO. The persistence unit defines the JDBC properties the DAO will use. The - * persistence unit must defined in the {@code META-INF/persistence.xml} resource file - * - * @param daoPersistenceUnit the persistence unit to use for JDBC access - */ - public void setPersistenceUnit(final String daoPersistenceUnit) { - persistenceUnit = daoPersistenceUnit; - } - - /** - * Gets the JDBC properties. - * - * @return the JDBC properties - */ - public Properties getJdbcProperties() { - return jdbcProperties; - } - - /** - * Sets the JDBC properties. - * - * @param jdbcProperties the JDBC properties - */ - public void setJdbcProperties(final Properties jdbcProperties) { - this.jdbcProperties = jdbcProperties; - } - - /** - * Gets a single JDBC property. - * - * @param key the key of the property - * @return the JDBC property - */ - public String getJdbcProperty(final String key) { - return jdbcProperties.getProperty(key); - } - - /** - * Sets a single JDBC property. - * - * @param key the key of the property - * @param value the value of the JDBC property - */ - public void setJdbcProperty(final String key, final String value) { - jdbcProperties.setProperty(key, value); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "DAOParameters [pluginClass=" + pluginClass + ", persistenceUnit=" + persistenceUnit - + ", jdbcProperties=" + jdbcProperties + "]"; - } -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java deleted file mode 100644 index 460714683..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/CDataConditioner.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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.converters; - -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -/** - * The Class CDATAConditioner converts a CDATA String to and from database format by removing spaces at the ends of - * lines and platform-specific new line endings. - * - * @author John Keeney (John.Keeney@ericsson.com) - */ -@Converter -public class CDataConditioner extends XmlAdapter implements AttributeConverter { - - private static final String NL = "\n"; - - /** - * {@inheritDoc}. - */ - @Override - public String convertToDatabaseColumn(final String raw) { - return clean(raw); - } - - /** - * {@inheritDoc}. - */ - @Override - public String convertToEntityAttribute(final String db) { - return clean(db); - } - - /** - * {@inheritDoc}. - */ - @Override - public String unmarshal(final String value) throws Exception { - return this.convertToEntityAttribute(value); - } - - /** - * {@inheritDoc}. - */ - @Override - public String marshal(final String value) throws Exception { - return this.convertToDatabaseColumn(value); - } - - /** - * Clean. - * - * @param in the in - * @return the string - */ - public static final String clean(final String in) { - if (in == null) { - return null; - } else { - return in.replaceAll("\\s+$", "").replaceAll("\\r?\\n", NL); - } - } -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java deleted file mode 100644 index f5fffdb00..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/Uuid2String.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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.converters; - -import java.util.UUID; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -/** - * The Class UUIDConverter converts a UUID to and from database format. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -@Converter -public class Uuid2String extends XmlAdapter implements AttributeConverter { - - /** - * {@inheritDoc}. - */ - @Override - public String convertToDatabaseColumn(final UUID uuid) { - String returnString; - if (uuid == null) { - returnString = ""; - } else { - returnString = uuid.toString(); - } - return returnString; - } - - /** - * {@inheritDoc}. - */ - @Override - public UUID convertToEntityAttribute(final String uuidString) { - return UUID.fromString(uuidString); - } - - /** - * {@inheritDoc}. - */ - @Override - public UUID unmarshal(final String value) throws Exception { - return this.convertToEntityAttribute(value); - } - - /** - * {@inheritDoc}. - */ - @Override - public String marshal(final UUID value) throws Exception { - return this.convertToDatabaseColumn(value); - } -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java deleted file mode 100644 index f1e9a3ba7..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/converters/package-info.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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========================================================= - */ - -/** - * Contains converters used by APEX EclipseLink marshaling and unmarshaling of - * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} instances to and from files and databases. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.model.basicmodel.dao.converters; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java deleted file mode 100644 index 738d15ed3..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java +++ /dev/null @@ -1,497 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.impl; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; -import org.onap.policy.apex.model.basicmodel.concepts.ApexException; -import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; -import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; -import org.onap.policy.apex.model.basicmodel.dao.ApexDao; -import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class DefaultApexDao is an JPA implementation of the {@link ApexDao} class for Apex concepts ({@link AxConcept}). - * It uses the default JPA implementation in the javax {@link Persistence} class. - * - * - * @author Sergey Sachkov (sergey.sachkov@ericsson.com) - */ -public class DefaultApexDao implements ApexDao { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(DefaultApexDao.class); - - private static final String COL_LOCALNAME = "local_name"; - private static final String COL_PARENT_VERSION = "parent_version"; - private static final String COL_PARENT_NAME = "parent_name"; - private static final String COL_VERSION = "key_version"; - private static final String COL_NAME = "key_name"; - - private static final String SELECT_C_FROM = "SELECT c FROM "; - private static final String AND_C_KEY_LOCAL_NAME = " AND c.key.localName=:" + COL_LOCALNAME; - private static final String AND_C_KEY_PARENT_KEY_VERSION = " AND c.key.parentKeyVersion=:" + COL_PARENT_VERSION; - private static final String C_WHERE_C_KEY_PARENT_KEY_NAME = " c WHERE c.key.parentKeyName=:" + COL_PARENT_NAME; - private static final String AND_C_KEY_VERSION = " AND c.key.version=:" + COL_VERSION; - private static final String C_WHERE_C_KEY_NAME = " c WHERE c.key.name=:" + COL_NAME; - private static final String DELETE_FROM = "DELETE FROM "; - - // Entity manager for JPA - private EntityManagerFactory emf = null; - - /** - * {@inheritDoc}. - */ - @Override - public void init(final DaoParameters daoParameters) throws ApexException { - if (daoParameters == null || daoParameters.getPersistenceUnit() == null) { - LOGGER.error("Apex persistence unit parameter not set"); - throw new ApexException("Apex persistence unit parameter not set"); - } - - LOGGER.debug("Creating Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" . . ."); - try { - emf = Persistence.createEntityManagerFactory(daoParameters.getPersistenceUnit(), - daoParameters.getJdbcProperties()); - } catch (final Exception e) { - LOGGER.warn("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e); - throw new ApexException( - "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e); - } - LOGGER.debug("Created Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\""); - } - - /** - * Gets the entity manager for this DAO. - * - * @return the entity manager - */ - protected final synchronized EntityManager getEntityManager() { - if (emf == null) { - LOGGER.warn("Apex DAO has not been initialized"); - throw new ApexRuntimeException("Apex DAO has not been initialized"); - } - - return emf.createEntityManager(); - } - - /** - * {@inheritDoc}. - */ - @Override - public final void close() { - if (emf != null) { - emf.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void create(final T obj) { - if (obj == null) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - mg.merge(obj); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void delete(final T obj) { - if (obj == null) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - mg.remove(mg.contains(obj) ? obj : mg.merge(obj)); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void delete(final Class someClass, final AxArtifactKey key) { - if (key == null) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + AND_C_KEY_VERSION, someClass) - .setParameter(COL_NAME, key.getName()) - .setParameter(COL_VERSION, key.getVersion()) - .executeUpdate(); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void delete(final Class someClass, final AxReferenceKey key) { - if (key == null) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + AND_C_KEY_PARENT_KEY_VERSION - + AND_C_KEY_LOCAL_NAME, someClass) - .setParameter(COL_PARENT_NAME, key.getParentKeyName()) - .setParameter(COL_PARENT_VERSION, key.getParentKeyVersion()) - .setParameter(COL_LOCALNAME, key.getLocalName()) - .executeUpdate(); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void createCollection(final Collection objs) { - if (objs == null || objs.isEmpty()) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - for (final T t : objs) { - mg.merge(t); - } - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public void deleteCollection(final Collection objs) { - if (objs == null || objs.isEmpty()) { - return; - } - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - for (final T t : objs) { - mg.remove(mg.contains(t) ? t : mg.merge(t)); - } - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public int deleteByArtifactKey(final Class someClass, - final Collection keys) { - if (keys == null || keys.isEmpty()) { - return 0; - } - int deletedCount = 0; - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - for (final AxArtifactKey key : keys) { - deletedCount += mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME - + AND_C_KEY_VERSION, someClass) - .setParameter(COL_NAME, key.getName()) - .setParameter(COL_VERSION, key.getVersion()) - .executeUpdate(); - } - mg.getTransaction().commit(); - } finally { - mg.close(); - } - return deletedCount; - } - - /** - * {@inheritDoc}. - */ - @Override - public int deleteByReferenceKey(final Class someClass, - final Collection keys) { - if (keys == null || keys.isEmpty()) { - return 0; - } - int deletedCount = 0; - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - for (final AxReferenceKey key : keys) { - deletedCount += - mg.createQuery( - DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + AND_C_KEY_PARENT_KEY_VERSION + AND_C_KEY_LOCAL_NAME, someClass) - .setParameter(COL_PARENT_NAME, key.getParentKeyName()) - .setParameter(COL_PARENT_VERSION, key.getParentKeyVersion()) - .setParameter(COL_LOCALNAME, key.getLocalName()) - .executeUpdate(); - } - mg.getTransaction().commit(); - } finally { - mg.close(); - } - return deletedCount; - } - - /** - * {@inheritDoc}. - */ - @Override - public void deleteAll(final Class someClass) { - final EntityManager mg = getEntityManager(); - try { - mg.getTransaction().begin(); - mg.createQuery(DELETE_FROM + someClass.getSimpleName() + " c ", someClass).executeUpdate(); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public T get(final Class someClass, final AxArtifactKey key) { - if (someClass == null) { - return null; - } - final EntityManager mg = getEntityManager(); - try { - final T t = mg.find(someClass, key); - if (t != null) { - // This clone is created to force the JPA DAO to recurse down through the object - try { - final T clonedT = someClass.getDeclaredConstructor().newInstance(); - t.copyTo(clonedT); - return clonedT; - } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e); - return null; - } - } else { - return null; - } - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public T get(final Class someClass, final AxReferenceKey key) { - if (someClass == null) { - return null; - } - final EntityManager mg = getEntityManager(); - try { - final T t = mg.find(someClass, key); - if (t != null) { - try { - final T clonedT = someClass.getDeclaredConstructor().newInstance(); - t.copyTo(clonedT); - return clonedT; - } catch (final Exception e) { - LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e); - return null; - } - } else { - return null; - } - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public List getAll(final Class someClass) { - if (someClass == null) { - return Collections.emptyList(); - } - final EntityManager mg = getEntityManager(); - try { - return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + " c", someClass).getResultList(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public List getAll(final Class someClass, final AxArtifactKey parentKey) { - if (someClass == null) { - return Collections.emptyList(); - } - final EntityManager mg = getEntityManager(); - try { - return mg - .createQuery( - SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + AND_C_KEY_PARENT_KEY_VERSION, someClass) - .setParameter(COL_PARENT_NAME, parentKey.getName()) - .setParameter(COL_PARENT_VERSION, parentKey.getVersion()) - .getResultList(); - } finally { - mg.close(); - } - } - - /** - * {@inheritDoc}. - */ - @Override - public T getArtifact(final Class someClass, final AxArtifactKey key) { - if (someClass == null || key == null) { - return null; - } - final EntityManager mg = getEntityManager(); - List ret; - try { - ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME - + AND_C_KEY_VERSION, someClass) - .setParameter(COL_NAME, key.getName()) - .setParameter(COL_VERSION, key.getVersion()) - .getResultList(); - } finally { - mg.close(); - } - if (ret == null || ret.isEmpty()) { - return null; - } - if (ret.size() > 1) { - throw new IllegalArgumentException("More than one result was returned for search for " + someClass - + " with key " + key.getId() + ": " + ret); - } - return ret.get(0); - } - - /** - * {@inheritDoc}. - */ - @Override - public T getArtifact(final Class someClass, final AxReferenceKey key) { - if (someClass == null || key == null) { - return null; - } - final EntityManager mg = getEntityManager(); - List ret; - try { - ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME - + AND_C_KEY_PARENT_KEY_VERSION + AND_C_KEY_LOCAL_NAME, someClass) - .setParameter(COL_PARENT_NAME, key.getParentKeyName()) - .setParameter(COL_PARENT_VERSION, key.getParentKeyVersion()) - .setParameter(COL_LOCALNAME, key.getLocalName()) - .getResultList(); - } finally { - mg.close(); - } - if (ret == null || ret.isEmpty()) { - return null; - } - if (ret.size() > 1) { - throw new IllegalArgumentException("More than one result was returned for search for " + someClass - + " with key " + key.getId() + ": " + ret); - } - return ret.get(0); - } - - /** - * {@inheritDoc}. - */ - @Override - public T update(final T obj) { - final EntityManager mg = getEntityManager(); - T ret; - try { - mg.getTransaction().begin(); - ret = mg.merge(obj); - mg.flush(); - mg.getTransaction().commit(); - } finally { - mg.close(); - } - return ret; - } - - /** - * {@inheritDoc}. - */ - @Override - public long size(final Class someClass) { - if (someClass == null) { - return 0; - } - final EntityManager mg = getEntityManager(); - long size = 0; - try { - size = mg.createQuery("SELECT COUNT(c) FROM " + someClass.getSimpleName() + " c", Long.class) - .getSingleResult(); - } finally { - mg.close(); - } - return size; - } -} diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java deleted file mode 100644 index 5d585c247..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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========================================================= - */ - -/** - * Contains a default DAO implementation for APEX {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} - * classes that uses javax persistence. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -package org.onap.policy.apex.model.basicmodel.dao.impl; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java deleted file mode 100644 index 505e4023a..000000000 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/package-info.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * ================================================================================ - * 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========================================================= - */ - -/** - * Defines and implements the Data Access Object (DAO) that allows Apex - * {@link org.onap.policy.apex.model.basicmodel.concepts.AxConcept} concepts to be read from and written to databases - * over JDBC. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.model.basicmodel.dao; diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java index 36ce4e438..5dbf69492 100644 --- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/test/TestApexModel.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021-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. @@ -27,8 +27,6 @@ import java.io.File; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; 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.ApexDaoFactory; -import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter; @@ -173,29 +171,6 @@ public class TestApexModel { LOGGER.debug("ran testApexModelWriteReadJSON"); } - /** - * Test write and read of an Apex model to database using JPA. - * - * @param daoParameters the DAO parameters to use for JPA/JDBC - * @throws ApexException thrown on errors writing or reading the model to database - */ - public final void testApexModelWriteReadJpa(final DaoParameters daoParameters) throws ApexException { - LOGGER.debug("running testApexModelWriteReadJPA . . ."); - - final var model = modelCreator.getModel(); - - final var apexDao = new ApexDaoFactory().createApexDao(daoParameters); - apexDao.init(daoParameters); - - apexDao.create(model); - final var dbJpaModel = apexDao.get(rootModelClass, model.getKey()); - apexDao.close(); - - checkModelEquality(model, dbJpaModel, "test model does not equal model written and read using generic JPA"); - - LOGGER.debug("ran testApexModelWriteReadJPA"); - } - /** * Test that an Apex model is valid. * 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 nullKeyList = null; - final List emptyKeyList = new ArrayList<>(); - final List nullRKeyList = null; - final List 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 keyInfoSetIn = new TreeSet(); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo2); - - apexDao.createCollection(keyInfoSetIn); - - Set keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - - keyInfoSetIn.add(keyInfo0); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.delete(keyInfo1); - keyInfoSetIn.remove(keyInfo1); - keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.deleteCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - assertEquals(0, keyInfoSetOut.size()); - - keyInfoSetIn.add(keyInfo0); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo0); - apexDao.createCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - assertEquals(keyInfoSetIn, keyInfoSetOut); - - apexDao.delete(AxKeyInfo.class, aKey0); - keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - assertEquals(2, keyInfoSetOut.size()); - assertEquals(2, apexDao.size(AxKeyInfo.class)); - - final Set keySetIn = new TreeSet(); - keySetIn.add(aKey1); - keySetIn.add(aKey2); - - final int deletedCount = apexDao.deleteByArtifactKey(AxKeyInfo.class, keySetIn); - assertEquals(2, deletedCount); - - keyInfoSetOut = new TreeSet(apexDao.getAll(AxKeyInfo.class)); - assertEquals(0, keyInfoSetOut.size()); - - keyInfoSetIn.add(keyInfo0); - keyInfoSetIn.add(keyInfo1); - keyInfoSetIn.add(keyInfo0); - apexDao.createCollection(keyInfoSetIn); - keyInfoSetOut = new TreeSet(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 testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class)); - assertEquals(16, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class, owner0Key)); - assertEquals(5, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class, owner1Key)); - assertEquals(3, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class, owner2Key)); - assertEquals(2, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class, owner3Key)); - assertEquals(1, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(apexDao.getAll(DummyEntity.class, owner4Key)); - assertEquals(1, testEntitySetOut.size()); - - testEntitySetOut = new TreeSet(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 rKeySetIn = new TreeSet(); - 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 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" + "********************************"; } diff --git a/model/basic-model/src/test/resources/META-INF/persistence.xml b/model/basic-model/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 01a8989bb..000000000 --- a/model/basic-model/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - org.eclipse.persistence.jpa.PersistenceProvider - - org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner - org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String - org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey - org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey - org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo - org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation - org.onap.policy.apex.model.basicmodel.concepts.AxModel - org.onap.policy.apex.model.basicmodel.concepts.DummyEntity - - - - - - - - - - -- cgit 1.2.3-korg