diff options
Diffstat (limited to 'examples')
39 files changed, 386 insertions, 270 deletions
diff --git a/examples/examples-aadm/pom.xml b/examples/examples-aadm/pom.xml index 272aee8fd..0dd91dcde 100644 --- a/examples/examples-aadm/pom.xml +++ b/examples/examples-aadm/pom.xml @@ -80,7 +80,7 @@ <argument>-classpath</argument> <!-- automatically creates the classpath using all project dependencies, also adding the project build directory --> <classpath /> - <argument>org.onap.policy.apex.examples.aadm.model.AADMDomainModelSaver</argument> + <argument>org.onap.policy.apex.examples.aadm.model.AadmDomainModelSaver</argument> <argument>${project.build.directory}/classes/examples/models/AADM</argument> </arguments> </configuration> diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java index 1f3cf5185..70af74ab9 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ENodeBStatus.java @@ -56,7 +56,7 @@ public class ENodeBStatus implements Serializable { * * @return the number of Denial Of Service incidents on the eNodeB */ - public long getDOSCount() { + public long getDosCount() { return dosCount; } @@ -65,7 +65,7 @@ public class ENodeBStatus implements Serializable { * * @param incomingDosCount the number of Denial Of Service incidents on the eNodeB */ - public void setDOSCount(final long incomingDosCount) { + public void setDosCount(final long incomingDosCount) { this.dosCount = incomingDosCount; } @@ -74,7 +74,7 @@ public class ENodeBStatus implements Serializable { * * @return the long */ - public long incrementDOSCount() { + public long incrementDosCount() { return ++dosCount; } @@ -83,7 +83,7 @@ public class ENodeBStatus implements Serializable { * * @return the long */ - public long decrementDOSCount() { + public long decrementDosCount() { return --dosCount; } diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java index 8f89d4c15..4b7def097 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IMSIStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/ImsiStatus.java @@ -25,7 +25,7 @@ import java.io.Serializable; /** * The Class IMSIStatus holds the status of an IMSI in the AADM domain. */ -public class IMSIStatus implements Serializable { +public class ImsiStatus implements Serializable { private static final long serialVersionUID = 2852523814242234172L; private static final long TIME_NOT_SET = 0; @@ -43,7 +43,7 @@ public class IMSIStatus implements Serializable { * * @param imsi the IMSI value */ - public IMSIStatus(final String imsi) { + public ImsiStatus(final String imsi) { this.imsi = imsi; } @@ -52,7 +52,7 @@ public class IMSIStatus implements Serializable { * * @return the IMSI value */ - public String getIMSI() { + public String getImsi() { return imsi; } @@ -97,17 +97,17 @@ public class IMSIStatus implements Serializable { * * @return theeNodeB ID to which the IMSI is attached */ - public String getENodeBID() { + public String getENodeBId() { return enodeBId; } /** * Sets the eNodeB ID to which the IMSI is attached. * - * @param incomingENodeBID the eNodeB ID to which the IMSI is attached + * @param incomingENodeBId the eNodeB ID to which the IMSI is attached */ - public void setENodeBID(final String incomingENodeBID) { - this.enodeBId = incomingENodeBID; + public void setENodeBId(final String incomingENodeBId) { + this.enodeBId = incomingENodeBId; } /** @@ -115,7 +115,7 @@ public class IMSIStatus implements Serializable { * * @return true, if eNodeB ID to which the IMSI is attached is set */ - public boolean checkSetENodeBID() { + public boolean checkSetENodeBId() { return (enodeBId != null); } diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java index fc3780f17..689865b16 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IPAddressStatus.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/concepts/IpAddressStatus.java @@ -25,7 +25,7 @@ import java.io.Serializable; /** * The Class IPAddressStatus holds the status of an IP address in the AADM domain. */ -public class IPAddressStatus implements Serializable { +public class IpAddressStatus implements Serializable { private static final long serialVersionUID = -7402022458317593252L; private final String ipAddress; @@ -37,7 +37,7 @@ public class IPAddressStatus implements Serializable { * * @param ipAddress the ip address */ - public IPAddressStatus(final String ipAddress) { + public IpAddressStatus(final String ipAddress) { this.ipAddress = ipAddress; } @@ -46,7 +46,7 @@ public class IPAddressStatus implements Serializable { * * @return the IP address */ - public String getIPAddress() { + public String getIpAddress() { return ipAddress; } @@ -55,7 +55,7 @@ public class IPAddressStatus implements Serializable { * * @return the imsi */ - public String getIMSI() { + public String getImsi() { return imsi; } @@ -64,7 +64,7 @@ public class IPAddressStatus implements Serializable { * * @param incomingImsi the imsi */ - public void setIMSI(final String incomingImsi) { + public void setImsi(final String incomingImsi) { this.imsi = incomingImsi; } @@ -73,7 +73,7 @@ public class IPAddressStatus implements Serializable { * * @return true, if check set IMSI */ - public boolean checkSetIMSI() { + public boolean checkSetImsi() { return (imsi != null); } } diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java index 9a2d50626..376643211 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelFactory.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java @@ -49,20 +49,20 @@ import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; /** * The Class AADMDomainModelFactory. */ -public class AADMDomainModelFactory { +public class AadmDomainModelFactory { /** * Gets the AADM policy model. * * @return the AADM policy model */ // CHECKSTYLE:OFF: checkstyle - public AxPolicyModel getAADMPolicyModel() { + public AxPolicyModel getAadmPolicyModel() { // CHECKSTYLE:ON: checkstyle // Data types for event parameters final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema ueIPAddress = + final AxContextSchema ueIpAddress = new AxContextSchema(new AxArtifactKey("UEIPAddress", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema nwIPAddress = + final AxContextSchema nwIpAddress = new AxContextSchema(new AxArtifactKey("NWIPAddress", "0.0.1"), "Java", "java.lang.String"); final AxContextSchema dosFlag = new AxContextSchema(new AxArtifactKey("DOSFlag", "0.0.1"), "Java", "java.lang.Boolean"); @@ -72,7 +72,7 @@ public class AADMDomainModelFactory { new AxContextSchema(new AxArtifactKey("ApplicationName", "0.0.1"), "Java", "java.lang.String"); final AxContextSchema protocolGroup = new AxContextSchema(new AxArtifactKey("ProtocolGroup", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema eNodeBID = + final AxContextSchema eNodeBId = new AxContextSchema(new AxArtifactKey("ENodeBID", "0.0.1"), "Java", "java.lang.Long"); final AxContextSchema httpHostClass = new AxContextSchema(new AxArtifactKey("HttpHostClass", "0.0.1"), "Java", "java.lang.String"); @@ -113,13 +113,13 @@ public class AADMDomainModelFactory { final AxContextSchemas aadmContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); - aadmContextSchemas.getSchemasMap().put(ueIPAddress.getKey(), ueIPAddress); - aadmContextSchemas.getSchemasMap().put(nwIPAddress.getKey(), nwIPAddress); + aadmContextSchemas.getSchemasMap().put(ueIpAddress.getKey(), ueIpAddress); + aadmContextSchemas.getSchemasMap().put(nwIpAddress.getKey(), nwIpAddress); aadmContextSchemas.getSchemasMap().put(dosFlag.getKey(), dosFlag); aadmContextSchemas.getSchemasMap().put(roundTripTime.getKey(), roundTripTime); aadmContextSchemas.getSchemasMap().put(applicationName.getKey(), applicationName); aadmContextSchemas.getSchemasMap().put(protocolGroup.getKey(), protocolGroup); - aadmContextSchemas.getSchemasMap().put(eNodeBID.getKey(), eNodeBID); + aadmContextSchemas.getSchemasMap().put(eNodeBId.getKey(), eNodeBId); aadmContextSchemas.getSchemasMap().put(httpHostClass.getKey(), httpHostClass); aadmContextSchemas.getSchemasMap().put(tcpOnFlag.getKey(), tcpOnFlag); aadmContextSchemas.getSchemasMap().put(probeOnFlag.getKey(), probeOnFlag); @@ -146,11 +146,11 @@ public class AADMDomainModelFactory { aadmEvent.getParameterMap().put("IMSI", new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); aadmEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); aadmEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); aadmEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); aadmEvent.getParameterMap().put("DoS", new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", new AxField( @@ -168,9 +168,9 @@ public class AADMDomainModelFactory { aadmEvent.getParameterMap().put("TCP_ON", new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); aadmEvent.getParameterMap().put("SGW_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIpAddress.getKey())); aadmEvent.getParameterMap().put("UE_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIpAddress.getKey())); aadmEvent.getParameterMap().put("SERVICE_REQUEST_COUNT", new AxField( new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); aadmEvent.getParameterMap().put("ATTACH_COUNT", @@ -192,11 +192,11 @@ public class AADMDomainModelFactory { aadmXStreamActEvent.getParameterMap().put("IMSI", new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); aadmXStreamActEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); aadmXStreamActEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); aadmXStreamActEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); aadmXStreamActEvent.getParameterMap().put("ACTTASK", new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ACTTASK"), actionTask.getKey())); aadmXStreamActEvent.getParameterMap().put("PROBE_ON", @@ -216,22 +216,22 @@ public class AADMDomainModelFactory { aadmXStreamActEvent.getParameterMap().put("THRESHOLD", new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "THRESHOLD"), threshold.getKey())); - final AxEvent vMMEEvent = + final AxEvent vMmeEvent = new AxEvent(new AxArtifactKey("VMMEEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - vMMEEvent.setSource("External"); - vMMEEvent.setTarget("Apex"); - vMMEEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI"), imsi.getKey())); - vMMEEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); - vMMEEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); - vMMEEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); - vMMEEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "PROFILE"), profile.getKey())); - vMMEEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(vMMEEvent.getKey(), "THRESHOLD"), threshold.getKey())); + vMmeEvent.setSource("External"); + vMmeEvent.setTarget("Apex"); + vMmeEvent.getParameterMap().put("IMSI", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI"), imsi.getKey())); + vMmeEvent.getParameterMap().put("ENODEB_ID", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); + vMmeEvent.getParameterMap().put("IMSI_IP", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); + vMmeEvent.getParameterMap().put("NW_IP", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + vMmeEvent.getParameterMap().put("PROFILE", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "PROFILE"), profile.getKey())); + vMmeEvent.getParameterMap().put("THRESHOLD", + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "THRESHOLD"), threshold.getKey())); final AxEvent sapcEvent = new AxEvent(new AxArtifactKey("SAPCEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); @@ -240,11 +240,11 @@ public class AADMDomainModelFactory { sapcEvent.getParameterMap().put("IMSI", new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); sapcEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBID.getKey())); + new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); sapcEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); sapcEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); sapcEvent.getParameterMap().put("PROFILE", new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROFILE"), profile.getKey())); sapcEvent.getParameterMap().put("THRESHOLD", @@ -270,9 +270,9 @@ public class AADMDomainModelFactory { sapcBlacklistSubscriberEvent.getParameterMap().put("BLACKLIST_ON", new AxField( new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI_IP", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIPAddress.getKey())); + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); sapcBlacklistSubscriberEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIPAddress.getKey())); + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); sapcBlacklistSubscriberEvent.getParameterMap().put("PROBE_ON", new AxField( new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); sapcBlacklistSubscriberEvent.getParameterMap().put("TCP_ON", @@ -296,7 +296,7 @@ public class AADMDomainModelFactory { final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", "0.0.1")); aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); - aadmEvents.getEventMap().put(vMMEEvent.getKey(), vMMEEvent); + aadmEvents.getEventMap().put(vMmeEvent.getKey(), vMmeEvent); aadmEvents.getEventMap().put(sapcEvent.getKey(), sapcEvent); aadmEvents.getEventMap().put(sapcBlacklistSubscriberEvent.getKey(), sapcBlacklistSubscriberEvent); aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); @@ -305,9 +305,9 @@ public class AADMDomainModelFactory { final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", "0.0.1"), "Java", "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", "0.0.1"), "Java", - "org.onap.policy.apex.examples.aadm.concepts.IMSIStatus"); + "org.onap.policy.apex.examples.aadm.concepts.ImsiStatus"); final AxContextSchema ipAddressStatus = new AxContextSchema(new AxArtifactKey("IPAddressStatus", "0.0.1"), - "Java", "org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus"); + "Java", "org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus"); aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); aadmContextSchemas.getSchemasMap().put(imsiStatus.getKey(), imsiStatus); aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); @@ -371,32 +371,32 @@ public class AADMDomainModelFactory { aadmDoSProvenActTask .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - final AxTask vMMEMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); - vMMEMatchTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEMatchTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMEMatchTask.setTaskLogic(new AxTaskLogic(vMMEMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + final AxTask vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); + vMmeMatchTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeMatchTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); - final AxTask vMMEEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); - vMMEEstablishTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEEstablishTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); + vMmeEstablishTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeEstablishTask.duplicateOutputFields(vMmeEvent.getParameterMap()); logicReader.setDefaultLogic("Default_TaskLogic"); - vMMEEstablishTask.setTaskLogic(new AxTaskLogic(vMMEEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeEstablishTask.setTaskLogic(new AxTaskLogic(vMmeEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); - final AxTask vMMEDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); - vMMEDecideTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEDecideTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMEDecideTask.setTaskLogic(new AxTaskLogic(vMMEDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + final AxTask vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); + vMmeDecideTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeDecideTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); - final AxTask vMMENoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); - vMMENoActTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMENoActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); - vMMENoActTask.setTaskLogic(new AxTaskLogic(vMMENoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); + vMmeNoActTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeNoActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); + vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); - final AxTask vMMEActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); - vMMEActTask.duplicateInputFields(vMMEEvent.getParameterMap()); - vMMEActTask.duplicateOutputFields(vMMEEvent.getParameterMap()); + final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); + vMmeActTask.duplicateInputFields(vMmeEvent.getParameterMap()); + vMmeActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); logicReader.setDefaultLogic(null); - vMMEActTask.setTaskLogic(new AxTaskLogic(vMMEActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), "TaskLogic", "MVEL", logicReader)); final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", "0.0.1")); sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); @@ -453,11 +453,11 @@ public class AADMDomainModelFactory { aadmTasks.getTaskMap().put(aadmDoSSuggestionActTask.getKey(), aadmDoSSuggestionActTask); aadmTasks.getTaskMap().put(aadmNoActTask.getKey(), aadmNoActTask); aadmTasks.getTaskMap().put(aadmDoSProvenActTask.getKey(), aadmDoSProvenActTask); - aadmTasks.getTaskMap().put(vMMEMatchTask.getKey(), vMMEMatchTask); - aadmTasks.getTaskMap().put(vMMEEstablishTask.getKey(), vMMEEstablishTask); - aadmTasks.getTaskMap().put(vMMEDecideTask.getKey(), vMMEDecideTask); - aadmTasks.getTaskMap().put(vMMENoActTask.getKey(), vMMENoActTask); - aadmTasks.getTaskMap().put(vMMEActTask.getKey(), vMMEActTask); + aadmTasks.getTaskMap().put(vMmeMatchTask.getKey(), vMmeMatchTask); + aadmTasks.getTaskMap().put(vMmeEstablishTask.getKey(), vMmeEstablishTask); + aadmTasks.getTaskMap().put(vMmeDecideTask.getKey(), vMmeDecideTask); + aadmTasks.getTaskMap().put(vMmeNoActTask.getKey(), vMmeNoActTask); + aadmTasks.getTaskMap().put(vMmeActTask.getKey(), vMmeActTask); aadmTasks.getTaskMap().put(sapcMatchTask.getKey(), sapcMatchTask); aadmTasks.getTaskMap().put(sapcEstablishTask.getKey(), sapcEstablishTask); aadmTasks.getTaskMap().put(sapcDecideTask.getKey(), sapcDecideTask); @@ -535,53 +535,53 @@ public class AADMDomainModelFactory { aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); - final AxPolicy vMMEPolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); - vMMEPolicy.setTemplate("MEDA"); - - final AxState vMMEActState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Act")); - vMMEActState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEAct2Out = - new AxStateOutput(vMMEActState.getKey(), AxReferenceKey.getNullKey(), vMMEEvent.getKey()); - vMMEActState.getStateOutputs().put(vMMEAct2Out.getKey().getLocalName(), vMMEAct2Out); - vMMEActState.setDefaultTask(vMMEActTask.getKey()); - vMMEActState.getTaskReferences().put(vMMEActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), - vMMEActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); - vMMEActState.getTaskReferences().put(vMMENoActTask.getKey(), new AxStateTaskReference(vMMEActState.getKey(), - vMMENoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEAct2Out.getKey())); - - final AxState vMMEDecideState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Decide")); - vMMEDecideState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEDec2Act = - new AxStateOutput(vMMEDecideState.getKey(), vMMEActState.getKey(), vMMEEvent.getKey()); - vMMEDecideState.getStateOutputs().put(vMMEDec2Act.getKey().getLocalName(), vMMEDec2Act); - vMMEDecideState.setDefaultTask(vMMEDecideTask.getKey()); - vMMEDecideState.getTaskReferences().put(vMMEDecideTask.getKey(), new AxStateTaskReference( - vMMEDecideState.getKey(), vMMEDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEDec2Act.getKey())); - - final AxState vMMEEstablishState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Establish")); - vMMEEstablishState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEEst2Dec = - new AxStateOutput(vMMEEstablishState.getKey(), vMMEDecideState.getKey(), vMMEEvent.getKey()); - vMMEEstablishState.getStateOutputs().put(vMMEEst2Dec.getKey().getLocalName(), vMMEEst2Dec); - vMMEEstablishState.setDefaultTask(vMMEEstablishTask.getKey()); - vMMEEstablishState.getTaskReferences().put(vMMEEstablishTask.getKey(), - new AxStateTaskReference(vMMEEstablishState.getKey(), vMMEEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, vMMEEst2Dec.getKey())); - - final AxState vMMEMatchState = new AxState(new AxReferenceKey(vMMEPolicy.getKey(), "Match")); - vMMEMatchState.setTrigger(vMMEEvent.getKey()); - final AxStateOutput vMMEMat2Est = - new AxStateOutput(vMMEMatchState.getKey(), vMMEEstablishState.getKey(), vMMEEvent.getKey()); - vMMEMatchState.getStateOutputs().put(vMMEMat2Est.getKey().getLocalName(), vMMEMat2Est); - vMMEMatchState.setDefaultTask(vMMEMatchTask.getKey()); - vMMEMatchState.getTaskReferences().put(vMMEMatchTask.getKey(), new AxStateTaskReference(vMMEMatchState.getKey(), - vMMEMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMMEMat2Est.getKey())); - - vMMEPolicy.setFirstState(vMMEMatchState.getKey().getLocalName()); - vMMEPolicy.getStateMap().put(vMMEMatchState.getKey().getLocalName(), vMMEMatchState); - vMMEPolicy.getStateMap().put(vMMEEstablishState.getKey().getLocalName(), vMMEEstablishState); - vMMEPolicy.getStateMap().put(vMMEDecideState.getKey().getLocalName(), vMMEDecideState); - vMMEPolicy.getStateMap().put(vMMEActState.getKey().getLocalName(), vMMEActState); + final AxPolicy vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); + vMmePolicy.setTemplate("MEDA"); + + final AxState vMmeActState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Act")); + vMmeActState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeAct2Out = + new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), vMmeEvent.getKey()); + vMmeActState.getStateOutputs().put(vMmeAct2Out.getKey().getLocalName(), vMmeAct2Out); + vMmeActState.setDefaultTask(vMmeActTask.getKey()); + vMmeActState.getTaskReferences().put(vMmeActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), + vMmeActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + vMmeActState.getTaskReferences().put(vMmeNoActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), + vMmeNoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + + final AxState vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Decide")); + vMmeDecideState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeDec2Act = + new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), vMmeEvent.getKey()); + vMmeDecideState.getStateOutputs().put(vMmeDec2Act.getKey().getLocalName(), vMmeDec2Act); + vMmeDecideState.setDefaultTask(vMmeDecideTask.getKey()); + vMmeDecideState.getTaskReferences().put(vMmeDecideTask.getKey(), new AxStateTaskReference( + vMmeDecideState.getKey(), vMmeDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeDec2Act.getKey())); + + final AxState vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Establish")); + vMmeEstablishState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeEst2Dec = + new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), vMmeEvent.getKey()); + vMmeEstablishState.getStateOutputs().put(vMmeEst2Dec.getKey().getLocalName(), vMmeEst2Dec); + vMmeEstablishState.setDefaultTask(vMmeEstablishTask.getKey()); + vMmeEstablishState.getTaskReferences().put(vMmeEstablishTask.getKey(), + new AxStateTaskReference(vMmeEstablishState.getKey(), vMmeEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, vMmeEst2Dec.getKey())); + + final AxState vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Match")); + vMmeMatchState.setTrigger(vMmeEvent.getKey()); + final AxStateOutput vMmeMat2Est = + new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), vMmeEvent.getKey()); + vMmeMatchState.getStateOutputs().put(vMmeMat2Est.getKey().getLocalName(), vMmeMat2Est); + vMmeMatchState.setDefaultTask(vMmeMatchTask.getKey()); + vMmeMatchState.getTaskReferences().put(vMmeMatchTask.getKey(), new AxStateTaskReference(vMmeMatchState.getKey(), + vMmeMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeMat2Est.getKey())); + + vMmePolicy.setFirstState(vMmeMatchState.getKey().getLocalName()); + vMmePolicy.getStateMap().put(vMmeMatchState.getKey().getLocalName(), vMmeMatchState); + vMmePolicy.getStateMap().put(vMmeEstablishState.getKey().getLocalName(), vMmeEstablishState); + vMmePolicy.getStateMap().put(vMmeDecideState.getKey().getLocalName(), vMmeDecideState); + vMmePolicy.getStateMap().put(vMmeActState.getKey().getLocalName(), vMmeActState); final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", "0.0.1")); sapcPolicy.setTemplate("MEDA"); @@ -680,7 +680,7 @@ public class AADMDomainModelFactory { final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", "0.0.1")); aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); - aadmPolicies.getPolicyMap().put(vMMEPolicy.getKey(), vMMEPolicy); + aadmPolicies.getPolicyMap().put(vMmePolicy.getKey(), vMmePolicy); aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java index a25a0e983..5a3afd901 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AADMDomainModelSaver.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java @@ -29,11 +29,11 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public final class AADMDomainModelSaver { +public final class AadmDomainModelSaver { /** * Private default constructor to prevent subclassing. */ - private AADMDomainModelSaver() {} + private AadmDomainModelSaver() {} /** * Write the AADM model to args[0]. @@ -43,12 +43,12 @@ public final class AADMDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - System.err.println("usage: " + AADMDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + System.err.println("usage: " + AadmDomainModelSaver.class.getCanonicalName() + " modelDirectory"); return; } // Save Java model - final AxPolicyModel aadmPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); + final AxPolicyModel aadmPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel(); final ApexModelSaver<AxPolicyModel> aadmModelSaver = new ApexModelSaver<>(AxPolicyModel.class, aadmPolicyModel, args[0]); aadmModelSaver.apexModelWriteJson(); diff --git a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json index c43f41353..427dea352 100644 --- a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json +++ b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" } } } diff --git a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json index 294da2483..3658b09a2 100644 --- a/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json +++ b/examples/examples-aadm/src/main/resources/examples/config/AADM/Stdin2StdoutXmlEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" } } } @@ -24,7 +24,7 @@ }, "eventProtocolParameters": { "eventProtocol": "XML", - "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters" + "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XmlEventProtocolParameters" } } }, @@ -38,7 +38,7 @@ }, "eventProtocolParameters": { "eventProtocol": "XML", - "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XMLEventProtocolParameters" + "parameterClassName": "org.onap.policy.apex.plugins.event.protocol.xml.XmlEventProtocolParameters" } } } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel index 078841792..225a0da4d 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -44,10 +44,10 @@ else{ outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); eNodeBStatus.setBeingProbed(false); leaveProbingOn = false; @@ -62,14 +62,14 @@ if (!leaveProbingOn) { outFields["TCP_ON"] = false; } -eNodeBStatus.decrementDOSCount(); -logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDOSCount()); +eNodeBStatus.decrementDosCount(); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount is " + eNodeBStatus.getDosCount()); imsiStatus.setAnomalous(false); -logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); +logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous()); -getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getIMSI(), imsiStatus); +getContextAlbum("IMSIStatusAlbum") .put(imsiStatus.getImsi(), imsiStatus); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); outFields["THRESHOLD"] = 0; diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel index d04f9425e..63ac8d0ba 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -42,16 +42,16 @@ else { outFields["NW_IP"] = inFields["SGW_IP_ADDRESS"]; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); logger.debug(eNodeBStatus); -if (imsiStatus.getENodeBID() != null && !imsiStatus.getENodeBID().equals(inFields["ENODEB_ID"]) || inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { +if (imsiStatus.getENodeBId() != null && !imsiStatus.getENodeBId().equals(inFields["ENODEB_ID"]) || inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] == null) { // if user moved enodeB remove him from previous one - if (imsiStatus.getENodeBID() != null) { - eNodeBStatus.decrementDOSCount(); + if (imsiStatus.getENodeBId() != null) { + eNodeBStatus.decrementDosCount(); } // if user became non anomalous return action @@ -79,20 +79,20 @@ if (imsiStatus.getENodeBID() != null && !imsiStatus.getENodeBID().equals(inField imsiStatus.setAnomalous(true); imsiStatus.setAnomolousTime(System.currentTimeMillis()); -imsiStatus.setENodeBID(inFields["ENODEB_ID"]); -getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); -logger.debug(imsiStatus.getENodeBID() + ": enodeb added to imsi ip added " + outFields["IMSI_IP"]); +imsiStatus.setENodeBId(inFields["ENODEB_ID"]); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); +logger.debug(imsiStatus.getENodeBId() + ": enodeb added to imsi ip added " + outFields["IMSI_IP"]); -ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID()); +ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId()); if (eNodeBStatus == null) { - eNodeBStatus = new ENodeBStatus(imsiStatus.getENodeBID()); + eNodeBStatus = new ENodeBStatus(imsiStatus.getENodeBId()); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); - logger.debug("new eNodeB added " + getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBID())); + logger.debug("new eNodeB added " + getContextAlbum("ENodeBStatusAlbum").get(imsiStatus.getENodeBId())); } -eNodeBStatus.incrementDOSCount(); +eNodeBStatus.incrementDosCount(); getContextAlbum("ENodeBStatusAlbum").put(eNodeBStatus.getENodeB(), eNodeBStatus); -logger.debug(eNodeBStatus.getENodeB() + ": dosCount incremented to " + eNodeBStatus.getDOSCount()); +logger.debug(eNodeBStatus.getENodeB() + ": dosCount incremented to " + eNodeBStatus.getDosCount()); outFields["PROBE_ON"] = true; outFields["TCP_ON"] = true; diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel index bb38034af..24ad9bb0a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel @@ -18,8 +18,8 @@ * ============LICENSE_END========================================================= */ import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.concepts.IPAddressStatus; -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -46,22 +46,22 @@ if (eNodeBID == null ) { return false; } -IPAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress); +IpAddressStatus ipAddressStatus = getContextAlbum("IPAddressStatusAlbum").get(ipAddress); if (ipAddressStatus == null) { - ipAddressStatus = new IPAddressStatus(ipAddress); - ipAddressStatus.setIMSI(imsi); - getContextAlbum("IPAddressStatusAlbum").put(ipAddressStatus.getIPAddress(), ipAddressStatus); + ipAddressStatus = new IpAddressStatus(ipAddress); + ipAddressStatus.setImsi(imsi); + getContextAlbum("IPAddressStatusAlbum").put(ipAddressStatus.getIpAddress(), ipAddressStatus); logger.debug("added new IP address " + getContextAlbum("IPAddressStatusAlbum").get(ipAddress)); } else { logger.debug("found IP address " + ipAddressStatus); } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)imsi); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)imsi); if (imsiStatus == null) { - imsiStatus = new IMSIStatus(imsi); - imsiStatus.setENodeBID(eNodeBID); - getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + imsiStatus = new ImsiStatus(imsi); + imsiStatus.setENodeBId(eNodeBID); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); logger.debug("added new IMSI " + imsi + " to IMSI status map") } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel index 2d0d45bdf..9c71db50a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; logger.debug(subject.id + ":" + subject.stateName + " execution logic"); @@ -25,7 +25,7 @@ logger.debug(inFields); logger.debug("inFields[SERVICE_REQUEST_COUNT]=" + inFields["SERVICE_REQUEST_COUNT"]); -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); if (imsiStatus.getBlockingCount() > 1) { subject.getTaskKey("AADMNoActTask").copyTo(selectedTask); @@ -33,7 +33,7 @@ if (imsiStatus.getBlockingCount() > 1) { return false; } -logger.debug("imsi: " + imsiStatus.getIMSI() + " anamalous " + imsiStatus.getAnomalous()); +logger.debug("imsi: " + imsiStatus.getImsi() + " anamalous " + imsiStatus.getAnomalous()); // check if this is second iteration if (inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] != null && inFields["TCP_UE_SIDE_AVG_THROUGHPUT"] > 100 && imsiStatus.getAnomalous()) { @@ -49,7 +49,7 @@ ENodeBStatus eNodeBStatus = getContextAlbum("ENodeBStatusAlbum").get((String)inF if (inFields["SERVICE_REQUEST_COUNT"] != null && inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] != null && inFields["SERVICE_REQUEST_COUNT"] > inFields["AVG_SUBSCRIBER_SERVICE_REQUEST"] && - eNodeBStatus != null && eNodeBStatus.getDOSCount() > 100 && + eNodeBStatus != null && eNodeBStatus.getDosCount() > 100 && inFields["NUM_SUBSCRIBERS"] != null && inFields["NUM_SUBSCRIBERS"] > 100) { logger.debug("inside NUM_SUBSCRIBERS"); subject.getTaskKey("AADMDoSProvenActTask").copyTo(selectedTask); diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel index 115ac5477..6a2c598b0 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel @@ -17,15 +17,15 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); -for (IMSIStatus imsiStatus : getContextAlbum("IMSIStatusAlbum").values()) { +for (ImsiStatus imsiStatus : getContextAlbum("IMSIStatusAlbum").values()) { if ((System.currentTimeMillis() - imsiStatus.getBlacklistedTime()) > 180000) { imsiStatus.setBlacklistedTime(0); - getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); + getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); } } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel index 7ceaa2abe..b0c6c3158 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ -import org.onap.policy.apex.examples.aadm.concepts.IMSIStatus; +import org.onap.policy.apex.examples.aadm.concepts.ImsiStatus; logger.debug(subject.id + ":" + subject.taskName + " execution logic"); logger.debug(inFields); @@ -38,7 +38,7 @@ if (outFields["IMSI"] == 0 && inFields["IMSI_IP"] != null && inFields["IMSI_IP"] return true; } -IMSIStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); +ImsiStatus imsiStatus = getContextAlbum("IMSIStatusAlbum").get((String)inFields["IMSI"]); logger.debug(imsiStatus); if (imsiStatus.getBlockingCount() > 1) { @@ -62,8 +62,8 @@ if (imsiStatus.getBlockingCount() > 0 && imsiStatus.getBlacklistedTime() != 0) { imsiStatus.incrementBlockingCount(); imsiStatus.setBlacklistedTime(System.currentTimeMillis()); -logger.debug("Bocking count for IMSI: " + imsiStatus.getIMSI() + " is: " + imsiStatus.getBlockingCount()); -getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getIMSI(), imsiStatus); +logger.debug("Bocking count for IMSI: " + imsiStatus.getImsi() + " is: " + imsiStatus.getBlockingCount()); +getContextAlbum("IMSIStatusAlbum").put(imsiStatus.getImsi(), imsiStatus); outFields["PROFILE"] = "ServiceA"; outFields["BLACKLIST_ON"] = true; diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmDbWrite.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmDbWrite.java index b67bb6245..bbcbaab03 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmDbWrite.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmDbWrite.java @@ -44,7 +44,7 @@ public class TestAadmDbWrite { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestAADMModelCreator()); + testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestAadmModelCreator()); } @After diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModel.java index ba992b522..1ac1e9829 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModel.java @@ -34,7 +34,7 @@ import org.onap.policy.apex.model.basicmodel.dao.DaoParameters; import org.onap.policy.apex.model.basicmodel.test.TestApexModel; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; -public class TestAADMModel { +public class TestAadmModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; @@ -47,7 +47,7 @@ public class TestAADMModel { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestAADMModelCreator()); + testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestAadmModelCreator()); } @After @@ -63,17 +63,17 @@ public class TestAADMModel { } @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel.testApexModelWriteReadXml(); } @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel.testApexModelWriteReadJson(); } @Test - public void testModelWriteReadJPA() throws Exception { + public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao"); DaoParameters.setPersistenceUnit("AADMModelTest"); diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModelCreator.java index 421a45a15..7f34bff59 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModelCreator.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.examples.aadm; -import org.onap.policy.apex.examples.aadm.model.AADMDomainModelFactory; +import org.onap.policy.apex.examples.aadm.model.AadmDomainModelFactory; import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -28,11 +28,11 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * This class implements Interface TestApexModelCreator to support AADM model. * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class TestAADMModelCreator implements TestApexModelCreator<AxPolicyModel> { +public class TestAadmModelCreator implements TestApexModelCreator<AxPolicyModel> { @Override public AxPolicyModel getModel() { - return new AADMDomainModelFactory().getAADMPolicyModel(); + return new AadmDomainModelFactory().getAadmPolicyModel(); } @Override diff --git a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmUseCase.java index 21f240ba8..579bf3484 100644 --- a/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java +++ b/examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmUseCase.java @@ -39,23 +39,24 @@ import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus; -import org.onap.policy.apex.examples.aadm.model.AADMDomainModelFactory; +import org.onap.policy.apex.examples.aadm.model.AadmDomainModelFactory; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; -import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; +// TODO: Auto-generated Javadoc /** * This class tests AADM use case. * @author Sergey Sachkov (sergey.sachkov@ericsson.com) * */ -public class TestAADMUseCase { - private static final XLogger logger = XLoggerFactory.getXLogger(TestAADMUseCase.class); +public class TestAadmUseCase { + private static final XLogger logger = XLoggerFactory.getXLogger(TestAadmUseCase.class); private SchemaParameters schemaParameters; private ContextParameters contextParameters; @@ -86,10 +87,13 @@ public class TestAADMUseCase { ParameterService.register(contextParameters.getPersistorParameters()); engineParameters = new EngineParameters(); - engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); ParameterService.register(engineParameters); } + /** + * After test. + */ @After public void afterTest() { ParameterService.deregister(engineParameters); @@ -110,8 +114,8 @@ public class TestAADMUseCase { * @throws IOException Signals that an I/O exception has occurred. */ @Test - public void testAADMCase() throws ApexException, InterruptedException, IOException { - final AxPolicyModel apexPolicyModel = new AADMDomainModelFactory().getAADMPolicyModel(); + public void testAadmCase() throws ApexException, InterruptedException, IOException { + final AxPolicyModel apexPolicyModel = new AadmDomainModelFactory().getAadmPolicyModel(); assertNotNull(apexPolicyModel); final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1"); @@ -159,7 +163,7 @@ public class TestAADMUseCase { final ContextAlbum eNodeBStatusAlbum = apexEngine.getInternalContext().get("ENodeBStatusAlbum"); final ENodeBStatus eNodeBStatus = (ENodeBStatus) eNodeBStatusAlbum.get("123"); - eNodeBStatus.setDOSCount(101); + eNodeBStatus.setDosCount(101); eNodeBStatusAlbum.put(eNodeBStatus.getENodeB(), eNodeBStatus); logger.info("Sending too many connections trigger "); @@ -194,10 +198,10 @@ public class TestAADMUseCase { // only one imsi was sent to process, so stop probe and tcp assertTrue(!(boolean) result.get("TCP_ON")); assertTrue(!(boolean) result.get("PROBE_ON")); - assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); - ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(99); + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99); // getting number of connections send it to policy, expecting probe action logger.info("Sending too many connections trigger "); @@ -230,9 +234,9 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("probe")); assertTrue((boolean) result.get("TCP_ON")); assertTrue((boolean) result.get("PROBE_ON")); - assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); - ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(99); + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(99); // tcp correlation return positive dos logger.info("Receiving action event with {} action", result.get("ACTTASK")); @@ -265,10 +269,10 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("act")); assertTrue(!(boolean) result.get("TCP_ON")); assertTrue(!(boolean) result.get("PROBE_ON")); - assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(98, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); - ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(101); + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(101); // user moving enodeB logger.info("Sending too many connections trigger "); @@ -302,7 +306,7 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("act")); assertTrue(!(boolean) result.get("TCP_ON")); assertTrue(!(boolean) result.get("PROBE_ON")); - assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(100, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); logger.info("Sending too many connections trigger "); @@ -335,12 +339,12 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("probe")); assertTrue((boolean) result.get("TCP_ON")); assertTrue((boolean) result.get("PROBE_ON")); - assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); - assertEquals(1, ((ENodeBStatus) eNodeBStatusAlbum.get("124")).getDOSCount()); + assertEquals(99, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); + assertEquals(1, ((ENodeBStatus) eNodeBStatusAlbum.get("124")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); // End of user moving enodeB - ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDOSCount(101); + ((ENodeBStatus) eNodeBStatusAlbum.get("123")).setDosCount(101); // user becomes non anomalous logger.info("Sending too many connections trigger "); @@ -373,7 +377,7 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("probe")); assertTrue((boolean) result.get("TCP_ON")); assertTrue((boolean) result.get("PROBE_ON")); - assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); logger.info("Sending too many connections trigger "); @@ -406,7 +410,7 @@ public class TestAADMUseCase { assertTrue(result.get("ACTTASK").equals("probe")); assertTrue((boolean) result.get("TCP_ON")); assertTrue((boolean) result.get("PROBE_ON")); - assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDOSCount()); + assertEquals(102, ((ENodeBStatus) eNodeBStatusAlbum.get("123")).getDosCount()); logger.info("Receiving action event with {} action", result.get("ACTTASK")); // End of user becomes non anomalous apexEngine.handleEvent(result); @@ -436,12 +440,12 @@ public class TestAADMUseCase { * Test vpn cleardown. */ @After - public void testAADMCleardown() {} + public void testAadmCleardown() {} /** * Gets the trigger event. * - * @param apexModel the apex model + * @param apexPolicyModel the apex policy model * @return the trigger event */ private AxEvent getTriggerEvent(final AxPolicyModel apexPolicyModel) { diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java index 4b66eb116..cb7e3c824 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionTslUseCase.java @@ -44,7 +44,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters; -import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -66,6 +66,9 @@ public class TestAnomalyDetectionTslUseCase { private ContextParameters contextParameters; private EngineParameters engineParameters; + /** + * Before test. + */ @Before public void beforeTest() { schemaParameters = new SchemaParameters(); @@ -88,11 +91,14 @@ public class TestAnomalyDetectionTslUseCase { ParameterService.register(contextParameters.getPersistorParameters()); engineParameters = new EngineParameters(); - engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); ParameterService.register(engineParameters); } + /** + * After test. + */ @After public void afterTest() { ParameterService.deregister(engineParameters); @@ -105,6 +111,13 @@ public class TestAnomalyDetectionTslUseCase { ParameterService.deregister(schemaParameters); } + /** + * Test anomaly detection tsl. + * + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ @Test // once through the long running test below public void testAnomalyDetectionTsl() throws ApexException, InterruptedException, IOException { @@ -170,7 +183,7 @@ public class TestAnomalyDetectionTslUseCase { final AxArtifactKey key = new AxArtifactKey("AnomalyTSLApexEngine", "0.0.1"); final EngineParameters parameters = new EngineParameters(); - parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); @@ -205,6 +218,14 @@ public class TestAnomalyDetectionTslUseCase { Thread.sleep(1000); } + /** + * The main method. + * + * @param args the arguments + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ public static void main(final String[] args) throws ApexException, InterruptedException, IOException { new TestAnomalyDetectionTslUseCase().testAnomalyDetectionTslmain(); } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java index 632ae623e..3052c31a7 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnTslUseCase.java @@ -44,11 +44,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.plugins.executor.java.JavaExecutorParameters; -import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; import org.onap.policy.common.parameters.ParameterService; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; +// TODO: Auto-generated Javadoc /** * Test Auto learning in TSL. * @@ -64,6 +65,9 @@ public class TestAutoLearnTslUseCase { private ContextParameters contextParameters; private EngineParameters engineParameters; + /** + * Before test. + */ @Before public void beforeTest() { schemaParameters = new SchemaParameters(); @@ -86,11 +90,14 @@ public class TestAutoLearnTslUseCase { ParameterService.register(contextParameters.getPersistorParameters()); engineParameters = new EngineParameters(); - engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); engineParameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); ParameterService.register(engineParameters); } + /** + * After test. + */ @After public void afterTest() { ParameterService.deregister(engineParameters); @@ -103,6 +110,13 @@ public class TestAutoLearnTslUseCase { ParameterService.deregister(schemaParameters); } + /** + * Test auto learn tsl. + * + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ @Test // once through the long running test below public void testAutoLearnTsl() throws ApexException, InterruptedException, IOException { @@ -167,7 +181,7 @@ public class TestAutoLearnTslUseCase { final AxArtifactKey key = new AxArtifactKey("AADMApexEngine", "0.0.1"); final EngineParameters parameters = new EngineParameters(); - parameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + parameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); parameters.getExecutorParameterMap().put("JAVA", new JavaExecutorParameters()); final ApexEngine apexEngine1 = new ApexEngineFactory().createApexEngine(key); @@ -228,6 +242,14 @@ public class TestAutoLearnTslUseCase { } + /** + * The main method. + * + * @param args the arguments + * @throws ApexException the apex exception + * @throws InterruptedException the interrupted exception + * @throws IOException Signals that an I/O exception has occurred. + */ public static void main(final String[] args) throws ApexException, InterruptedException, IOException { new TestAutoLearnTslUseCase().testAutoLearnTslMain(); } diff --git a/examples/examples-decisionmaker/pom.xml b/examples/examples-decisionmaker/pom.xml index 4bbbc775e..280e6bfd1 100644 --- a/examples/examples-decisionmaker/pom.xml +++ b/examples/examples-decisionmaker/pom.xml @@ -57,7 +57,7 @@ <goal>java</goal> </goals> <configuration> - <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass> <classpathScope>compile</classpathScope> <arguments> <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> diff --git a/examples/examples-myfirstpolicy/pom.xml b/examples/examples-myfirstpolicy/pom.xml index cc56d0b1f..7aa4f5bdf 100644 --- a/examples/examples-myfirstpolicy/pom.xml +++ b/examples/examples-myfirstpolicy/pom.xml @@ -97,7 +97,7 @@ <!-- automatically creates the classpath using all project dependencies, also adding the project build directory --> <classpath /> - <argument>org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelSaver</argument> + <argument>org.onap.policy.apex.examples.myfirstpolicy.model.MfpDomainModelSaver</argument> <argument>${project.build.directory}/classes/examples/models/MyFirstPolicy</argument> </arguments> </configuration> diff --git a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelFactory.java index 5e5bb913d..f81a22ee9 100644 --- a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelFactory.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelFactory.java @@ -30,7 +30,7 @@ import org.onap.policy.common.utils.resources.ResourceUtils; * * @author John Keeney (john.keeney@ericsson.com) */ -public class MFPDomainModelFactory { +public class MfpDomainModelFactory { private static final String MFP1PATH = "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.json"; private static final String MFP1_ALT_PATH = "examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json"; @@ -41,13 +41,13 @@ public class MFPDomainModelFactory { * * @return the MyFirstPolicy#1 policy model */ - public AxPolicyModel getMFP1PolicyModel() { + public AxPolicyModel getMfp1PolicyModel() { java.util.TimeZone.getTimeZone("gmt"); try { final ApexModelReader<AxPolicyModel> reader = new ApexModelReader<>(AxPolicyModel.class); - return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP1PATH)); + return reader.read(ResourceUtils.getResourceAsString(MfpDomainModelFactory.MFP1PATH)); } catch (final Exception e) { - throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MFPDomainModelFactory.MFP1PATH, + throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MfpDomainModelFactory.MFP1PATH, e); } } @@ -57,14 +57,14 @@ public class MFPDomainModelFactory { * * @return the MyFirstPolicy#1 policy model */ - public AxPolicyModel getMFP1AltPolicyModel() { + public AxPolicyModel getMfp1AltPolicyModel() { java.util.TimeZone.getTimeZone("gmt"); try { final ApexModelReader<AxPolicyModel> reader = new ApexModelReader<>(AxPolicyModel.class); - return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP1_ALT_PATH)); + return reader.read(ResourceUtils.getResourceAsString(MfpDomainModelFactory.MFP1_ALT_PATH)); } catch (final Exception e) { throw new ApexRuntimeException( - "Failed to build MyFirstPolicy_ALT from path: " + MFPDomainModelFactory.MFP1_ALT_PATH, e); + "Failed to build MyFirstPolicy_ALT from path: " + MfpDomainModelFactory.MFP1_ALT_PATH, e); } } @@ -73,12 +73,12 @@ public class MFPDomainModelFactory { * * @return the MyFirstPolicy#1 policy model */ - public AxPolicyModel getMFP2PolicyModel() { + public AxPolicyModel getMfp2PolicyModel() { try { final ApexModelReader<AxPolicyModel> reader = new ApexModelReader<>(AxPolicyModel.class); - return reader.read(ResourceUtils.getResourceAsString(MFPDomainModelFactory.MFP2PATH)); + return reader.read(ResourceUtils.getResourceAsString(MfpDomainModelFactory.MFP2PATH)); } catch (final Exception e) { - throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MFPDomainModelFactory.MFP2PATH, + throw new ApexRuntimeException("Failed to build MyFirstPolicy from path: " + MfpDomainModelFactory.MFP2PATH, e); } } diff --git a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java index fb47f6cf9..5122390a8 100644 --- a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MFPDomainModelSaver.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java @@ -29,10 +29,10 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author John Keeney (john.keeney@ericsson.com) */ -public final class MFPDomainModelSaver { +public final class MfpDomainModelSaver { /** Private constructor to prevent instantiation. */ - private MFPDomainModelSaver() {} + private MfpDomainModelSaver() {} /** * Write the MyFirstPolicy model to args[0]. @@ -42,18 +42,18 @@ public final class MFPDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - System.err.println("usage: " + MFPDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + System.err.println("usage: " + MfpDomainModelSaver.class.getCanonicalName() + " modelDirectory"); return; } // Save Java model - AxPolicyModel mfpPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + AxPolicyModel mfpPolicyModel = new MfpDomainModelFactory().getMfp1PolicyModel(); ApexModelSaver<AxPolicyModel> mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/1/"); mfpModelSaver.apexModelWriteJson(); mfpModelSaver.apexModelWriteXml(); - mfpPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + mfpPolicyModel = new MfpDomainModelFactory().getMfp2PolicyModel(); mfpModelSaver = new ApexModelSaver<>(AxPolicyModel.class, mfpPolicyModel, args[0] + "/2/"); mfpModelSaver.apexModelWriteJson(); mfpModelSaver.apexModelWriteXml(); diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigFile2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigFile2StdoutJsonEvent.json index fc81cd6a6..d8d53f8c9 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigFile2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigFile2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigStdin2StdoutJsonEvent.json index 27bd0a6a9..338e1df99 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigStdin2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigStdin2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigWs2WsServerJsonEvent.json index c4cf72171..9d438a4ec 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigWs2WsServerJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/1/MyFirstPolicyConfigWs2WsServerJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" @@ -21,7 +21,7 @@ "aProducer": { "carrierTechnologyParameters": { "carrierTechnology": "WEBSOCKET", - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters", "parameters": { "wsClient": false, "port": 4000 @@ -36,7 +36,7 @@ "aConsumer": { "carrierTechnologyParameters": { "carrierTechnology": "WEBSOCKET", - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters", "parameters": { "wsClient": false, "port": 3000 diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigFile2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigFile2StdoutJsonEvent.json index be8ae938a..d4dba4446 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigFile2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigFile2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigStdin2StdoutJsonEvent.json index 56e79b2f3..0853a9850 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigStdin2StdoutJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigStdin2StdoutJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigWs2WsServerJsonEvent.json index 65612b6db..cd621e694 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigWs2WsServerJsonEvent.json +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/2/MyFirstPolicyConfigWs2WsServerJsonEvent.json @@ -9,7 +9,7 @@ "engineParameters": { "executorParameters": { "MVEL": { - "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters" + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" }, "JAVASCRIPT": { "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" @@ -21,7 +21,7 @@ "aProducer": { "carrierTechnologyParameters": { "carrierTechnology": "WEBSOCKET", - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters", "parameters": { "wsClient": false, "port": 4000 @@ -36,7 +36,7 @@ "aConsumer": { "carrierTechnologyParameters": { "carrierTechnology": "WEBSOCKET", - "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WEBSOCKETCarrierTechnologyParameters", + "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters", "parameters": { "wsClient": false, "port": 3000 diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpLogic.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpLogic.java index 651bd9280..e425088ff 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpLogic.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpLogic.java @@ -30,7 +30,7 @@ import java.util.Map.Entry; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.examples.myfirstpolicy.model.MfpDomainModelFactory; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.policymodel.concepts.AxPolicy; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -59,7 +59,7 @@ public class TestMfpLogic { */ @Test public void testMfp1TaskLogic() { - final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + final AxPolicyModel apexPolicyModel = new MfpDomainModelFactory().getMfp1PolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); @@ -85,7 +85,7 @@ public class TestMfpLogic { */ @Test public void testMfp1AltTaskLogic() { - final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1AltPolicyModel(); + final AxPolicyModel apexPolicyModel = new MfpDomainModelFactory().getMfp1AltPolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); @@ -110,7 +110,7 @@ public class TestMfpLogic { */ @Test public void testMfp2TaskLogic() { - final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + final AxPolicyModel apexPolicyModel = new MfpDomainModelFactory().getMfp2PolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCli.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCli.java index 0d6b4737c..a63df03bc 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCli.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCli.java @@ -27,7 +27,7 @@ import java.io.IOException; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain; +import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; import org.onap.policy.apex.model.basicmodel.handling.ApexModelException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -71,8 +71,8 @@ public class TestMfpModelCli { { "-c", "src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex", "-l", tempLogFile2.getAbsolutePath(), "-o", tempModelFile2.getAbsolutePath() }; - new ApexCLIEditorMain(testApexModel1CliArgs); - new ApexCLIEditorMain(testApexModel2CliArgs); + new ApexCommandLineEditorMain(testApexModel1CliArgs); + new ApexCommandLineEditorMain(testApexModel2CliArgs); final ApexModelReader<AxPolicyModel> reader = new ApexModelReader<>(AxPolicyModel.class); AxPolicyModel generatedmodel = reader.read(TextFileUtils.getTextFileAsString(tempModelFile1.getAbsolutePath())); diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCreator.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCreator.java index ebbdac7c2..d77405d9e 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCreator.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModelCreator.java @@ -20,7 +20,7 @@ package org.onap.policy.apex.examples.myfirstpolicy; -import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.examples.myfirstpolicy.model.MfpDomainModelFactory; import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -83,7 +83,7 @@ public abstract class TestMfpModelCreator implements TestApexModelCreator<AxPoli */ @Override public AxPolicyModel getModel() { - return new MFPDomainModelFactory().getMFP1PolicyModel(); + return new MfpDomainModelFactory().getMfp1PolicyModel(); } } @@ -99,7 +99,7 @@ public abstract class TestMfpModelCreator implements TestApexModelCreator<AxPoli */ @Override public AxPolicyModel getModel() { - return new MFPDomainModelFactory().getMFP2PolicyModel(); + return new MfpDomainModelFactory().getMfp2PolicyModel(); } } diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java index ec5d9e0c9..8c95c9fec 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpUseCase.java @@ -43,14 +43,14 @@ import org.onap.policy.apex.core.engine.EngineParameters; import org.onap.policy.apex.core.engine.engine.impl.ApexEngineFactory; import org.onap.policy.apex.core.engine.engine.impl.ApexEngineImpl; import org.onap.policy.apex.core.engine.event.EnEvent; -import org.onap.policy.apex.examples.myfirstpolicy.model.MFPDomainModelFactory; +import org.onap.policy.apex.examples.myfirstpolicy.model.MfpDomainModelFactory; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.eventmodel.concepts.AxEvent; import org.onap.policy.apex.model.eventmodel.concepts.AxField; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters; -import org.onap.policy.apex.plugins.executor.mvel.MVELExecutorParameters; +import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters; import org.onap.policy.common.parameters.ParameterService; import org.onap.policy.common.utils.resources.ResourceUtils; @@ -75,6 +75,9 @@ public class TestMfpUseCase { private static SchemaParameters schemaParameters; private static EngineParameters engineParameters; + /** + * Before test. + */ @BeforeClass public static void beforeTest() { schemaParameters = new SchemaParameters(); @@ -97,11 +100,14 @@ public class TestMfpUseCase { ParameterService.register(contextParameters.getPersistorParameters()); engineParameters = new EngineParameters(); - engineParameters.getExecutorParameterMap().put("MVEL", new MVELExecutorParameters()); + engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters()); engineParameters.getExecutorParameterMap().put("JAVASCRIPT", new JavascriptExecutorParameters()); ParameterService.register(engineParameters); } + /** + * After test. + */ @AfterClass public static void afterTest() { ParameterService.deregister(engineParameters); @@ -123,7 +129,7 @@ public class TestMfpUseCase { */ @Test public void testMfp1Case() throws ApexException, InterruptedException, IOException { - final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); + final AxPolicyModel apexPolicyModel = new MfpDomainModelFactory().getMfp1PolicyModel(); assertNotNull(apexPolicyModel); final TestSaleAuthListener listener = new TestSaleAuthListener("Test"); @@ -171,7 +177,7 @@ public class TestMfpUseCase { */ @Test public void testMfp2Case() throws ApexException, InterruptedException, IOException { - final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); + final AxPolicyModel apexPolicyModel = new MfpDomainModelFactory().getMfp2PolicyModel(); assertNotNull(apexPolicyModel); final TestSaleAuthListener listener = new TestSaleAuthListener("Test"); diff --git a/examples/examples-onap-vcpe/pom.xml b/examples/examples-onap-vcpe/pom.xml index 3080416b2..b0562b9f9 100644 --- a/examples/examples-onap-vcpe/pom.xml +++ b/examples/examples-onap-vcpe/pom.xml @@ -83,7 +83,7 @@ <goal>java</goal> </goals> <configuration> - <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass> <classpathScope>compile</classpathScope> <arguments> <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSim.java index f6ae332a8..369e6172c 100644 --- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSim.java +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSim.java @@ -27,12 +27,18 @@ import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.server.ResourceConfig; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; -public class AAIAndGuardSim { +/** + * The Class AaiAndGuardSim. + */ +public class AaiAndGuardSim { private static final String BASE_URI = "http://localhost:54321/AAIAndGuardSim"; private HttpServer server; - public AAIAndGuardSim() { - final ResourceConfig rc = new ResourceConfig(AAIAndGuardSimEndpoint.class); + /** + * Instantiates a new aai and guard sim. + */ + public AaiAndGuardSim() { + final ResourceConfig rc = new ResourceConfig(AaiAndGuardSimEndpoint.class); server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc); while (!server.isStarted()) { @@ -40,12 +46,23 @@ public class AAIAndGuardSim { } } + /** + * Tear down. + * + * @throws Exception the exception + */ public void tearDown() throws Exception { server.shutdown(); } + /** + * The main method. + * + * @param args the arguments + * @throws Exception the exception + */ public static void main(final String[] args) throws Exception { - final AAIAndGuardSim sim = new AAIAndGuardSim(); + final AaiAndGuardSim sim = new AaiAndGuardSim(); while (true) { try { diff --git a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpoint.java index 6c7f7db19..e36ef4d11 100644 --- a/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AAIAndGuardSimEndpoint.java +++ b/examples/examples-onap-vcpe/src/test/java/org/onap/policy/apex/domains/onap/vcpe/AaiAndGuardSimEndpoint.java @@ -34,15 +34,22 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.core.Response; - +/** + * The Class AaiAndGuardSimEndpoint. + */ @Path("/sim") -public class AAIAndGuardSimEndpoint { +public class AaiAndGuardSimEndpoint { private static int postMessagesReceived = 0; private static int putMessagesReceived = 0; private static int statMessagesReceived = 0; private static int getMessagesReceived = 0; + /** + * Service get stats. + * + * @return the response + */ @Path("/pdp/api/Stats") @GET public Response serviceGetStats() { @@ -51,6 +58,12 @@ public class AAIAndGuardSimEndpoint { + ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); } + /** + * Service guard post request. + * + * @param jsonString the json string + * @return the response + */ @Path("/pdp/api/getDecision") @POST public Response serviceGuardPostRequest(final String jsonString) { @@ -65,6 +78,11 @@ public class AAIAndGuardSimEndpoint { } } + /** + * Service get event. + * + * @return the response + */ @Path("/event/GetEvent") @GET public Response serviceGetEvent() { @@ -83,18 +101,34 @@ public class AAIAndGuardSimEndpoint { return Response.status(200).entity(eventString).build(); } + /** + * Service get empty event. + * + * @return the response + */ @Path("/event/GetEmptyEvent") @GET public Response serviceGetEmptyEvent() { return Response.status(200).build(); } + /** + * Service get event bad response. + * + * @return the response + */ @Path("/event/GetEventBadResponse") @GET public Response serviceGetEventBadResponse() { return Response.status(400).build(); } + /** + * Service post request. + * + * @param jsonString the json string + * @return the response + */ @Path("/event/PostEvent") @POST public Response servicePostRequest(final String jsonString) { @@ -112,12 +146,24 @@ public class AAIAndGuardSimEndpoint { + ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build(); } + /** + * Service post request bad response. + * + * @param jsonString the json string + * @return the response + */ @Path("/event/PostEventBadResponse") @POST public Response servicePostRequestBadResponse(final String jsonString) { return Response.status(400).build(); } + /** + * Service put request. + * + * @param jsonString the json string + * @return the response + */ @Path("/event/PutEvent") @PUT public Response servicePutRequest(final String jsonString) { diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelFactory.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelFactory.java index 001886370..fa8903b62 100644 --- a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelFactory.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelFactory.java @@ -22,7 +22,7 @@ package org.onap.policy.apex.examples.pcvs.model; import java.io.File; -import org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain; +import org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain; import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; @@ -54,7 +54,7 @@ public class PcvsDomainModelFactory { new String[] {"-c", "src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex", "-wd", workingDirectory, "-o", full}; - final ApexCLIEditorMain cliEditor = new ApexCLIEditorMain(args); + final ApexCommandLineEditorMain cliEditor = new ApexCommandLineEditorMain(args); if (cliEditor.getErrorCount() > 0) { throw new ApexRuntimeException( "Apex CLI editor execution failed with " + cliEditor.getErrorCount() + " errors"); diff --git a/examples/examples-periodic/pom.xml b/examples/examples-periodic/pom.xml index 8894e71d7..fb8d43661 100644 --- a/examples/examples-periodic/pom.xml +++ b/examples/examples-periodic/pom.xml @@ -57,7 +57,7 @@ <goal>java</goal> </goals> <configuration> - <mainClass>org.onap.policy.apex.auth.clieditor.ApexCLIEditorMain</mainClass> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass> <classpathScope>compile</classpathScope> <arguments> <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> |