aboutsummaryrefslogtreecommitdiffstats
path: root/model/engine-model
diff options
context:
space:
mode:
Diffstat (limited to 'model/engine-model')
-rw-r--r--model/engine-model/pom.xml29
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java32
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineState.java9
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java42
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/package-info.java16
-rw-r--r--model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java45
-rw-r--r--model/engine-model/src/test/resources/META-INF/persistence.xml69
7 files changed, 27 insertions, 215 deletions
diff --git a/model/engine-model/pom.xml b/model/engine-model/pom.xml
index 7a1b485f8..9db1b2053 100644
--- a/model/engine-model/pom.xml
+++ b/model/engine-model/pom.xml
@@ -2,6 +2,7 @@
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
Modifications Copyright (C) 2022 Bell Canada.
+ Modifications Copyright (C) 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.
@@ -41,30 +42,4 @@
<artifactId>simpleclient</artifactId>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-xml-schema</id>
- <phase>process-classes</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <mainClass>org.onap.policy.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
- <classpathScope>compile</classpathScope>
- <arguments>
- <argument>org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel</argument>
- <argument>${project.build.directory}/model/xml/apex-engine-model.xsd</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project> \ No newline at end of file
+</project>
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java
index 23310b219..1a590a411 100644
--- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java
+++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 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");
@@ -24,16 +24,6 @@ package org.onap.policy.apex.model.enginemodel.concepts;
import java.text.SimpleDateFormat;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Enumerated;
-import javax.persistence.JoinColumn;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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 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.AxKey;
@@ -58,32 +48,12 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Validation checks that the current state {@link AxEngineState} is defined and that the time stamp
* is set on the engine model.
*/
-@Entity
-@Table(name = "AxEngineModel")
-@XmlRootElement(name = "apexEngineModel", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxEngineModel", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"timestamp", "state", "stats"})
-
public class AxEngineModel extends AxContextModel {
private static final long serialVersionUID = 6381235864606564046L;
private static final int HASH_CODE_PRIME = 32;
- @Column(name = "timestamp")
private long timestamp;
-
- @Enumerated
- @Column(name = "state")
- @XmlElement(required = true)
private AxEngineState state;
-
- @JoinColumn(name = "statsParentKeyName", referencedColumnName = "parentKeyName", updatable = false,
- insertable = false)
- @JoinColumn(name = "statsParentKeyVersion", referencedColumnName = "parentKeyVersion", updatable = false,
- insertable = false)
- @JoinColumn(name = "statsParentLocalName ", referencedColumnName = "parentLocalName", updatable = false,
- insertable = false)
- @JoinColumn(name = "statsLocalName", referencedColumnName = "localName", updatable = false, insertable = false)
private AxEngineStats stats;
/**
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineState.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineState.java
index 63c8706d2..24c564b96 100644
--- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineState.java
+++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineState.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 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.
@@ -21,18 +22,12 @@
package org.onap.policy.apex.model.enginemodel.concepts;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
/**
* This enumeration indicates the execution state of an Apex engine.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxEngineState", namespace = "http://www.onap.org/policy/apex-pdp")
public enum AxEngineState {
/** The state of the engine is not known. */
UNDEFINED(0),
@@ -54,4 +49,4 @@ public enum AxEngineState {
public int getStateIdentifier() {
return stateIdentifier;
}
-} \ No newline at end of file
+}
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
index 685aa0d1c..1420d1e0d 100644
--- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
+++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* Modifications Copyright (C) 2022 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,16 +26,6 @@ import io.prometheus.client.Gauge;
import io.prometheus.client.Histogram;
import java.text.SimpleDateFormat;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.xml.bind.annotation.XmlAccessType;
-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 lombok.Getter;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
@@ -53,13 +43,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* engine, and the time stamp of the last engine start are recorded.
*/
-@Entity
-@Table(name = "AxEngineStats")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexEngineStats", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxEngineStats", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "timeStamp",
- "eventCount", "lastExecutionTime", "averageExecutionTime", "upTime", "lastStart"})
public class AxEngineStats extends AxConcept {
private static final long serialVersionUID = -6981129081962785368L;
private static final int HASH_CODE_PRIME = 32;
@@ -81,36 +64,15 @@ public class AxEngineStats extends AxConcept {
.name("engine_last_execution_time").labelNames(ENGINE_INSTANCE_ID)
.help("Time taken to execute the last APEX policy in seconds.").register();
- @EmbeddedId
- @XmlElement(name = "key", required = true)
private AxReferenceKey key;
-
- @Column
- @XmlElement(required = true)
private long timeStamp;
-
- @Column
- @XmlElement(required = true)
private long eventCount;
-
- @Column
- @XmlElement(required = true)
private long lastExecutionTime;
-
- @Column
- @XmlElement(required = true)
private double averageExecutionTime;
-
- @Column
- @XmlElement(required = true)
private long upTime;
- @Transient
@Getter
private transient long lastEnterTime;
-
- @Column
- @XmlElement(required = true)
private long lastStart;
/**
@@ -568,4 +530,4 @@ public class AxEngineStats extends AxConcept {
return Long.compare(lastStart, other.lastStart);
}
-} \ No newline at end of file
+}
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/package-info.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/package-info.java
index ea47c6993..4557af7db 100644
--- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/package-info.java
+++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/package-info.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 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.
* 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=========================================================
*/
@@ -21,14 +22,7 @@
/**
* Contains the concepts required to receive state information and statistcs from running APEX
* engines.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
- xmlns = {@XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "")})
-
package org.onap.policy.apex.model.enginemodel.concepts;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java
index 063424b3d..e7fdd2d93 100644
--- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java
+++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/handling/ApexEngineModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 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.
@@ -26,11 +26,24 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
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;
import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel;
public class ApexEngineModelTest {
+ private static final String VALID_MODEL_STRING = "***validation of model successful***";
+
+ private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
+ + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
+ + "AxEngineModel - state is UNDEFINED\n" + "********************************";
+
+ private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
+ + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
+ + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
+ + "AxEngineModel - timestamp is not set\n" + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
+ + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
+ + "AxEngineModel - state is UNDEFINED\n" + "********************************";
+
TestApexModel<AxEngineModel> testApexModel;
/**
@@ -62,35 +75,7 @@ public class ApexEngineModelTest {
}
@Test
- public void testModelWriteReadXml() throws Exception {
- testApexModel.testApexModelWriteReadXml();
- }
-
- @Test
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);
- }
-
- private static final String VALID_MODEL_STRING = "***validation of model successful***";
-
- private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
- + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
- + "AxEngineModel - state is UNDEFINED\n" + "********************************";
-
- private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
- + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
- + "AxEngineModel - timestamp is not set\n" + "AxArtifactKey:(name=AnEngine,version=0.0.1):"
- + "org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel:INVALID:"
- + "AxEngineModel - state is UNDEFINED\n" + "********************************";
}
diff --git a/model/engine-model/src/test/resources/META-INF/persistence.xml b/model/engine-model/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index 42048d85d..000000000
--- a/model/engine-model/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============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=========================================================
--->
-
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class>
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxInputField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxOutputField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvent</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvents</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTask</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTasks</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateOutput</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxState</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicy</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicies</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
- <class>org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel</class>
- <class>org.onap.policy.apex.model.enginemodel.concepts.AxEngineStats</class>
-
- <properties>
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- <property name="eclipselink.logging.level" value="INFO" />
- </properties>
- </persistence-unit>
-</persistence>