diff options
23 files changed, 190 insertions, 167 deletions
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 13fbb1eca..1f3cf5185 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 @@ -28,7 +28,7 @@ import java.io.Serializable; public class ENodeBStatus implements Serializable { private static final long serialVersionUID = 2852523814242234172L; - private final String eNodeB; + private final String enodeB; private long dosCount = 0; private boolean beingProbed = false; @@ -36,10 +36,10 @@ public class ENodeBStatus implements Serializable { /** * The Constructor initiates the status of the eNodeB. * - * @param eNodeB the e node B + * @param enodeB the eNodeB */ - public ENodeBStatus(final String eNodeB) { - this.eNodeB = eNodeB; + public ENodeBStatus(final String enodeB) { + this.enodeB = enodeB; } /** @@ -48,7 +48,7 @@ public class ENodeBStatus implements Serializable { * @return the eNodeB name */ public String getENodeB() { - return eNodeB; + return enodeB; } /** 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 f59e982b0..8f89d4c15 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 @@ -34,7 +34,7 @@ public class IMSIStatus implements Serializable { private boolean anomalous = false; private long anomalousTime = TIME_NOT_SET; - private String eNodeBID; + private String enodeBId; private long blackListedTime = TIME_NOT_SET; private long blockingCount = 0; @@ -98,7 +98,7 @@ public class IMSIStatus implements Serializable { * @return theeNodeB ID to which the IMSI is attached */ public String getENodeBID() { - return eNodeBID; + return enodeBId; } /** @@ -107,7 +107,7 @@ public class IMSIStatus implements Serializable { * @param incomingENodeBID the eNodeB ID to which the IMSI is attached */ public void setENodeBID(final String incomingENodeBID) { - this.eNodeBID = incomingENodeBID; + this.enodeBId = incomingENodeBID; } /** @@ -116,7 +116,7 @@ public class IMSIStatus implements Serializable { * @return true, if eNodeB ID to which the IMSI is attached is set */ public boolean checkSetENodeBID() { - return (eNodeBID != null); + return (enodeBId != null); } /** 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 7a453ae24..ba992b522 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 @@ -38,6 +38,10 @@ public class TestAADMModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the AADM model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); 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 9aa2095c7..421a45a15 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 @@ -25,6 +25,7 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; 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> { 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 f7ce2fdf0..5ff70d1af 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 @@ -50,7 +50,9 @@ import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; /** - * User: Sergey Sachkov Date: 13/10/15 + * 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); @@ -59,15 +61,18 @@ public class TestAADMUseCase { private ContextParameters contextParameters; private EngineParameters engineParameters; + /** + * Test AADM use case setup. + */ @Before public void beforeTest() { schemaParameters = new SchemaParameters(); - + schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); ParameterService.register(schemaParameters); - + contextParameters = new ContextParameters(); contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME); 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 dd6a5eb77..b67bb6245 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 @@ -31,10 +31,14 @@ 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 TestAADMDBWrite { +public class TestAadmDbWrite { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the Apex AADM model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -50,7 +54,7 @@ public class TestAADMDBWrite { } @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-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java index a044ad14b..2a654c38e 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java @@ -47,15 +47,18 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { /** * A map to hold the Anomaly degree/levels/probabilities required for each task.<br> - * If there is no task defined for a calculated anomaly-degree, then the default task is used.<br> - * The map use (LinkedHashMap) is an insertion-ordered map, so the first interval matching a query is used. + * If there is no task defined for a calculated anomaly-degree, then the default task is + * used.<br> + * The map use (LinkedHashMap) is an insertion-ordered map, so the first interval matching a + * query is used. */ // CHECKSTYLE:OFF: checkstyle:magicNumber private static final Map<double[], String> TASK_INTERVALS = new LinkedHashMap<>(); + static { - TASK_INTERVALS.put(new double[] { 0.0, 0.1 }, null); // null will mean default task - TASK_INTERVALS.put(new double[] { 0.25, 0.5 }, "AnomalyDetectionDecideTask1"); - TASK_INTERVALS.put(new double[] { 0.5, 1.01 }, "AnomalyDetectionDecideTask2"); + TASK_INTERVALS.put(new double[] {0.0, 0.1}, null); // null will mean default task + TASK_INTERVALS.put(new double[] {0.25, 0.5}, "AnomalyDetectionDecideTask1"); + TASK_INTERVALS.put(new double[] {0.5, 1.01}, "AnomalyDetectionDecideTask2"); } // CHECKSTYLE:ON: checkstyle:magicNumber @@ -74,8 +77,8 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { logger.debug(executor.inFields.toString()); final double now = (Double) (executor.inFields.get("MonitoredValue")); final Integer iteration = (Integer) (executor.inFields.get("Iteration")); - final double[] vals = this.forecastingAndAnomaly(now); // double[forecastedValue, AnomalyScore, - // AnomalyProbability] + // get the double[forecastedValue, AnomalyScore, AnomalyProbability] + final double[] vals = this.forecastingAndAnomaly(now); final double anomalyness = vals[2]; String task = null; for (final Map.Entry<double[], String> i : TASK_INTERVALS.entrySet()) { @@ -103,8 +106,8 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { * Anomaly detection and forecast. * * @param value The current value - * @return Null if the function can not be executed correctly, otherwise double[forecastedValue, AnomalyScore, - * AnomalyProbability] + * @return Null if the function can not be executed correctly, otherwise double[forecastedValue, + * AnomalyScore, AnomalyProbability] */ public double[] forecastingAndAnomaly(final double value) { try { @@ -167,7 +170,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { double anomalyProbability = 0.0; if (anomalyDetection.getAnomalyScores().size() > 30) { // 0.5 - anomalyProbability = gStatsTest(anomalyDetection.getAnomalyScores(), ANOMALY_SENSITIVITY); + anomalyProbability = getStatsTest(anomalyDetection.getAnomalyScores(), ANOMALY_SENSITIVITY); } // CHECKSTYLE:ON: checkstyle:magicNumber @@ -178,16 +181,16 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { return null; } - return new double[] { forecastedValue, anomalyScore, anomalyProbability }; + return new double[] {forecastedValue, anomalyScore, anomalyProbability}; } /** - * Is the passed value inside the interval, i.e. (value<interval[1] && value>=interval[0]) + * Is the passed value inside the interval, i.e. (value < interval[1] && value>=interval[0]). * * @param value The value to check * @param interval A 2 element double array describing an interval - * @return true if the value is between interval[0] (inclusive) and interval[1] (exclusive), i.e. (value<interval[1] - * && value>=interval[0]). Otherwise false; + * @return true if the value is between interval[0] (inclusive) and interval[1] (exclusive), + * i.e. (value < interval[1] && value>=interval[0]). Otherwise false; */ private static boolean checkInterval(final double value, final double[] interval) { if (interval == null || interval.length != 2) { @@ -203,100 +206,89 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { * * @param values the values * @param significanceLevel the significance level - * @return the double + * @return the anomaly probability */ - private static double gStatsTest(final List<Double> values, final double significanceLevel) { + private static double getStatsTest(final List<Double> values, final double significanceLevel) { if (isAllEqual(values)) { return 0.0; } // the targeted value or the last value final double currentV = values.get(values.size() - 1); - Double[] lValuesCopy = values.toArray(new Double[values.size()]); - Arrays.sort(lValuesCopy); // takes ~40% of method time - // if(logger.isDebugEnabled()){ - // logger.debug("values:" + Arrays.toString(lValuesCopy)); - // } + Double[] lvaluesCopy = values.toArray(new Double[values.size()]); + Arrays.sort(lvaluesCopy); // takes ~40% of method time // get mean - double mean = getMean(lValuesCopy); - // get the test value: v - double v = getV(lValuesCopy, mean, true); + double mean = getMean(lvaluesCopy); + // get the test value: val + double val = getV(lvaluesCopy, mean, true); // get the p value for the test value - double pValue = getPValue(lValuesCopy, v, mean); // takes approx 25% of method time - // if(logger.isDebugEnabled()){ - // logger.debug("pValue:" + pValue); - // } + double pvalue = getPValue(lvaluesCopy, val, mean); // takes approx 25% of method time // check the critical level - while (pValue < significanceLevel) { // takes approx 20% of method time + while (pvalue < significanceLevel) { // takes approx 20% of method time // the score value as the anomaly probability - final double score = (significanceLevel - pValue) / significanceLevel; - if (Double.compare(v, currentV) == 0) { + final double score = (significanceLevel - pvalue) / significanceLevel; + if (Double.compare(val, currentV) == 0) { return score; } // do the critical check again for the left values - lValuesCopy = removevalue(lValuesCopy, v); - if (isAllEqual(lValuesCopy)) { + lvaluesCopy = removevalue(lvaluesCopy, val); + if (isAllEqual(lvaluesCopy)) { return 0.0; } - // if(logger.isDebugEnabled()){ - // logger.debug("left values:" + Arrays.toString(lValuesCopy)); - // } - mean = getMean(lValuesCopy); - v = getV(lValuesCopy, mean, true); - pValue = getPValue(lValuesCopy, v, mean); + + mean = getMean(lvaluesCopy); + val = getV(lvaluesCopy, mean, true); + pvalue = getPValue(lvaluesCopy, val, mean); } return 0.0; } /** - * get the test value based on mean from sorted values. + * Get the test value based on mean from sorted values. * - * @param lValues the l values + * @param lvalues the l values * @param mean the mean * @param maxValueOnly : only the max extreme value will be tested * @return the value to be tested */ - private static double getV(final Double[] lValues, final double mean, final boolean maxValueOnly) { - double v = lValues[lValues.length - 1]; + private static double getV(final Double[] lvalues, final double mean, final boolean maxValueOnly) { + double val = lvalues[lvalues.length - 1]; // max value as the extreme value if (maxValueOnly) { - return v; + return val; } // check the extreme side - if ((v - mean) < (mean - lValues[0])) { - v = lValues[0]; + if ((val - mean) < (mean - lvalues[0])) { + val = lvalues[0]; } - return v; + return val; } /** * calculate the P value for the t distribution. * - * @param lValues the l values - * @param v the v + * @param lvalues the l values + * @param val the value * @param mean the mean * @return the p value */ - private static double getPValue(final Double[] lValues, final double v, final double mean) { + private static double getPValue(final Double[] lvalues, final double val, final double mean) { // calculate z value - final double z = FastMath.abs(v - mean) / getStdDev(lValues, mean); - // logger.debug("z: " + z); + final double z = FastMath.abs(val - mean) / getStdDev(lvalues, mean); // calculate T - final double n = lValues.length; + final double n = lvalues.length; final double s = (z * z * n * (2.0 - n)) / (z * z * n - (n - 1.0) * (n - 1.0)); final double t = FastMath.sqrt(s); - // logger.debug("t:" + t); // default p value = 0 - double pValue = 0.0; + double pvalue = 0.0; if (!Double.isNaN(t)) { // t distribution with n-2 degrees of freedom final TDistribution tDist = new TDistribution(n - 2); - pValue = n * (1.0 - tDist.cumulativeProbability(t)); - // set max pValue = 1 - pValue = pValue > 1.0 ? 1.0 : pValue; + pvalue = n * (1.0 - tDist.cumulativeProbability(t)); + // set max pvalue = 1 + pvalue = pvalue > 1.0 ? 1.0 : pvalue; } - // logger.debug("value: "+ v + " , pValue: " + pValue); - return pValue; + return pvalue; } /* @@ -318,52 +310,52 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { } /** - * Remove the first occurence of the value v from the array. + * Remove the first occurrence of the value val from the array. * - * @param lValues the l values - * @param v the v + * @param lvalues the l values + * @param val the value * @return the double[] */ - private static Double[] removevalue(final Double[] lValues, final double v) { - for (int i = 0; i < lValues.length; i++) { - if (Double.compare(lValues[i], v) == 0) { - final Double[] ret = new Double[lValues.length - 1]; - System.arraycopy(lValues, 0, ret, 0, i); - System.arraycopy(lValues, i + 1, ret, i, lValues.length - i - 1); + private static Double[] removevalue(final Double[] lvalues, final double val) { + for (int i = 0; i < lvalues.length; i++) { + if (Double.compare(lvalues[i], val) == 0) { + final Double[] ret = new Double[lvalues.length - 1]; + System.arraycopy(lvalues, 0, ret, 0, i); + System.arraycopy(lvalues, i + 1, ret, i, lvalues.length - i - 1); return ret; } } - return lValues; + return lvalues; } /** * get mean value of double list. * - * @param lValues the l values + * @param lvalues the l values * @return the mean */ - private static double getMean(final Double[] lValues) { + private static double getMean(final Double[] lvalues) { double sum = 0.0; - for (final double d : lValues) { + for (final double d : lvalues) { sum += d; } - return sum / lValues.length; + return sum / lvalues.length; } /** * get standard deviation of double list. * - * @param lValues the l values + * @param lvalues the l values * @param mean the mean * @return stddev */ - private static double getStdDev(final Double[] lValues, final double mean) { + private static double getStdDev(final Double[] lvalues, final double mean) { double temp = 0.0; - for (final double d : lValues) { + for (final double d : lvalues) { temp += (mean - d) * (mean - d); } - return FastMath.sqrt(temp / lValues.length); + return FastMath.sqrt(temp / lvalues.length); } /** @@ -383,12 +375,12 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { /** * return true if all values are equal. * - * @param lValues the l values + * @param lvalues the l values * @return true, if checks if is all equal */ - private static boolean isAllEqual(final List<Double> lValues) { - final double first = lValues.get(0); - for (final Double d : lValues) { + private static boolean isAllEqual(final List<Double> lvalues) { + final double first = lvalues.get(0); + for (final Double d : lvalues) { if (Double.compare(d, first) != 0) { return false; } @@ -399,12 +391,12 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { /** * return true if all values are equal. * - * @param lValues the l values + * @param lvalues the l values * @return true, if checks if is all equal */ - private static boolean isAllEqual(final Double[] lValues) { - final double first = lValues[0]; - for (final Double d : lValues) { + private static boolean isAllEqual(final Double[] lvalues) { + final double first = lvalues[0]; + for (final Double d : lvalues) { if (Double.compare(d, first) != 0) { return false; } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDbWrite.java index 9affa7876..8f54bf12f 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionDbWrite.java @@ -31,10 +31,14 @@ 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 TestAnomalyDetectionDBWrite { +public class TestAnomalyDetectionDbWrite { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the Apex anomaly detection model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -50,11 +54,10 @@ public class TestAnomalyDetectionDBWrite { } @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("AdaptiveModelsTest"); - testApexModel.testApexModelWriteReadJpa(DaoParameters); } } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java index 3782f2d88..9e631ef2e 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModel.java @@ -38,6 +38,10 @@ public class TestAnomalyDetectionModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the Apex anomaly detection model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -59,17 +63,17 @@ public class TestAnomalyDetectionModel { } @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("AdaptiveModelsTest"); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java index 2b50d69ab..439452cec 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAnomalyDetectionModelCreator.java @@ -25,6 +25,7 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** + * The class TestAnomalyDetectionModelCreator. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestAnomalyDetectionModelCreator implements TestApexModelCreator<AxPolicyModel> { 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 3d3fad973..1925a53f5 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 @@ -56,8 +56,8 @@ import org.slf4j.ext.XLoggerFactory; * * @author John Keeney (John.Keeney@ericsson.com) */ -public class TestAnomalyDetectionTSLUseCase { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAnomalyDetectionTSLUseCase.class); +public class TestAnomalyDetectionTslUseCase { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAnomalyDetectionTslUseCase.class); private static final int MAXITERATIONS = 3660; private static final Random RAND = new Random(System.currentTimeMillis()); @@ -107,7 +107,7 @@ public class TestAnomalyDetectionTSLUseCase { @Test // once through the long running test below - public void TestAnomalyDetectionTSL() throws ApexException, InterruptedException, IOException { + public void testAnomalyDetectionTsl() throws ApexException, InterruptedException, IOException { final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); assertNotNull(apexPolicyModel); @@ -156,10 +156,10 @@ public class TestAnomalyDetectionTSLUseCase { // Test is disabled by default. uncomment below, or execute using the main() method // @Test // EG Dos command: apex-core.engine> mvn - // -Dtest=org.onap.policy.apex.core.engine.ml.TestAnomalyDetectionTSLUseCase test | findstr /L /C:"Apex [main] DEBUG + // -Dtest=org.onap.policy.apex.core.engine.ml.TestAnomalyDetectionTslUseCase test | findstr /L /C:"Apex [main] DEBUG // c.e.a.e.TaskSelectionExecutionLogging - // TestAnomalyDetectionTSL_Policy0000DecideStateTaskSelectionLogic.getTask():" - public void TestAnomalyDetectionTSL_main() throws ApexException, InterruptedException, IOException { + public void testAnomalyDetectionTslmain() throws ApexException, InterruptedException, IOException { final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); assertNotNull(apexPolicyModel); @@ -206,6 +206,6 @@ public class TestAnomalyDetectionTSLUseCase { } public static void main(final String[] args) throws ApexException, InterruptedException, IOException { - new TestAnomalyDetectionTSLUseCase().TestAnomalyDetectionTSL_main(); + new TestAnomalyDetectionTslUseCase().testAnomalyDetectionTslmain(); } } diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDbWrite.java index e096105d9..d4c1ab193 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDBWrite.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnDbWrite.java @@ -31,10 +31,14 @@ 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 TestAutoLearnDBWrite { +public class TestAutoLearnDbWrite { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the Apex AutoLearn model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -50,7 +54,7 @@ public class TestAutoLearnDBWrite { } @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("AdaptiveModelsTest"); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java index beb7a9c80..9bf7ce57a 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModel.java @@ -38,6 +38,10 @@ public class TestAutoLearnModel { private Connection connection; TestApexModel<AxPolicyModel> testApexModel; + /** + * Sets up embedded Derby database and the Apex AutoLearn model for the tests. + * @throws Exception exception to be thrown while setting up the database connection + */ @Before public void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); @@ -59,17 +63,17 @@ public class TestAutoLearnModel { } @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("AdaptiveModelsTest"); diff --git a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java index 11f1991bf..35d049dc7 100644 --- a/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java +++ b/examples/examples-adaptive/src/test/java/org/onap/policy/apex/examples/adaptive/TestAutoLearnModelCreator.java @@ -25,6 +25,7 @@ import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** + * The class TestAutoLearnModelCreator. * @author Liam Fallon (liam.fallon@ericsson.com) */ public class TestAutoLearnModelCreator implements TestApexModelCreator<AxPolicyModel> { 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 723b56653..ce9a07e16 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 @@ -54,8 +54,8 @@ import org.slf4j.ext.XLoggerFactory; * * @author John Keeney (John.Keeney@ericsson.com) */ -public class TestAutoLearnTSLUseCase { - private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAutoLearnTSLUseCase.class); +public class TestAutoLearnTslUseCase { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestAutoLearnTslUseCase.class); private static final int MAXITERATIONS = 1000; private static final Random rand = new Random(System.currentTimeMillis()); @@ -105,7 +105,7 @@ public class TestAutoLearnTSLUseCase { @Test // once through the long running test below - public void TestAutoLearnTSL() throws ApexException, InterruptedException, IOException { + public void testAutoLearnTsl() throws ApexException, InterruptedException, IOException { final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); assertNotNull(apexPolicyModel); @@ -153,9 +153,9 @@ public class TestAutoLearnTSLUseCase { * @throws IOException Signals that an I/O exception has occurred. */ // @Test - public void TestAutoLearnTSL_main() throws ApexException, InterruptedException, IOException { + public void testAutoLearnTslMain() throws ApexException, InterruptedException, IOException { - final double WANT = 50.0; + final double dwant = 50.0; final double toleranceTileJump = 3.0; final AxPolicyModel apexPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); @@ -179,10 +179,10 @@ public class TestAutoLearnTSLUseCase { final EnEvent triggerEvent = apexEngine1.createEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1")); assertNotNull(triggerEvent); - final double MIN = -100; - final double MAX = 100; + final double dmin = -100; + final double dmax = 100; - double rval = (((rand.nextGaussian() + 1) / 2) * (MAX - MIN)) + MIN; + double rval = (((rand.nextGaussian() + 1) / 2) * (dmax - dmin)) + dmin; triggerEvent.put("MonitoredValue", rval); triggerEvent.put("LastMonitoredValue", 0); @@ -207,13 +207,13 @@ public class TestAutoLearnTSLUseCase { avcount = Math.min((avcount + 1), 20); // maintain average of only the last 20 values avval = ((avval * (avcount - 1)) + val) / (avcount); - distance = Math.abs(WANT - avval); + distance = Math.abs(dwant - avval); if (distance < toleranceTileJump) { - rval = (((rand.nextGaussian() + 1) / 2) * (MAX - MIN)) + MIN; + rval = (((rand.nextGaussian() + 1) / 2) * (dmax - dmin)) + dmin; val = rval; triggerEvent.put("MonitoredValue", val); LOGGER.info("Iteration " + iteration + ": Average " + avval + " has become closer (" + distance - + ") than " + toleranceTileJump + " to " + WANT + " so reseting val:\t\t\t\t\t\t\t\t" + val); + + ") than " + toleranceTileJump + " to " + dwant + " so reseting val:\t\t\t\t\t\t\t\t" + val); avval = 0; avcount = 0; } @@ -229,6 +229,6 @@ public class TestAutoLearnTSLUseCase { } public static void main(final String[] args) throws ApexException, InterruptedException, IOException { - new TestAutoLearnTSLUseCase().TestAutoLearnTSL_main(); + new TestAutoLearnTslUseCase().testAutoLearnTslMain(); } } 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 697a3d99a..651bd9280 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 @@ -39,9 +39,9 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; import org.onap.policy.common.utils.resources.ResourceUtils; /** - * The Class TestMFPLogic. + * The Class TestMfpLogic. */ -public class TestMFPLogic { +public class TestMfpLogic { private static final Map<String, String> LOGICEXTENSIONS = new LinkedHashMap<>(); @@ -49,7 +49,7 @@ public class TestMFPLogic { * Test setup. */ @BeforeClass - public static void testMFPUseCaseSetup() { + public static void testMfpUseCaseSetup() { LOGICEXTENSIONS.put("MVEL", "mvel"); LOGICEXTENSIONS.put("JAVASCRIPT", "js"); } @@ -58,12 +58,12 @@ public class TestMFPLogic { * Check logic for MyFirstPolicy#1. */ @Test - public void testMFP1TaskLogic() { + public void testMfp1TaskLogic() { final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); - logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTslLogics(apexPolicyModel)); logics.putAll(getTaskLogics(apexPolicyModel)); for (final Entry<String, String> logicvalue : logics.entrySet()) { @@ -84,12 +84,12 @@ public class TestMFPLogic { * Check logic for MyFirstPolicyAlt#1. */ @Test - public void testMFP1AltTaskLogic() { + public void testMfp1AltTaskLogic() { final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1AltPolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); - logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTslLogics(apexPolicyModel)); logics.putAll(getTaskLogics(apexPolicyModel)); for (final Entry<String, String> logicvalue : logics.entrySet()) { @@ -109,12 +109,12 @@ public class TestMFPLogic { * Check logic for MyFirstPolicy2. */ @Test - public void testMFP2TaskLogic() { + public void testMfp2TaskLogic() { final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); assertNotNull(apexPolicyModel); final Map<String, String> logics = new LinkedHashMap<>(); - logics.putAll(getTSLLogics(apexPolicyModel)); + logics.putAll(getTslLogics(apexPolicyModel)); logics.putAll(getTaskLogics(apexPolicyModel)); for (final Entry<String, String> logicvalue : logics.entrySet()) { @@ -136,7 +136,7 @@ public class TestMFPLogic { * @param apexPolicyModel the apex policy model * @return the TSL logics */ - private Map<String, String> getTSLLogics(final AxPolicyModel apexPolicyModel) { + private Map<String, String> getTslLogics(final AxPolicyModel apexPolicyModel) { final Map<String, String> ret = new LinkedHashMap<>(); for (final Entry<AxArtifactKey, AxPolicy> policyentry : apexPolicyModel.getPolicies().getPolicyMap() .entrySet()) { diff --git a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModel.java index 64ff5b1ab..808da4866 100644 --- a/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMFPModel.java +++ b/examples/examples-myfirstpolicy/src/test/java/org/onap/policy/apex/examples/myfirstpolicy/TestMfpModel.java @@ -38,7 +38,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author John Keeney (john.keeney@ericsson.com) */ -public class TestMFPModel { +public class TestMfpModel { private static Connection connection; private static TestApexModel<AxPolicyModel> testApexModel1; @@ -53,8 +53,8 @@ public class TestMFPModel { public static void setup() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true"); - testApexModel1 = new TestApexModel<>(AxPolicyModel.class, new TestMFPModelCreator.TestMFP1ModelCreator()); - testApexModel2 = new TestApexModel<>(AxPolicyModel.class, new TestMFPModelCreator.TestMFP2ModelCreator()); + testApexModel1 = new TestApexModel<>(AxPolicyModel.class, new TestMfpModelCreator.TestMfp1ModelCreator()); + testApexModel2 = new TestApexModel<>(AxPolicyModel.class, new TestMfpModelCreator.TestMfp2ModelCreator()); } /** @@ -88,7 +88,7 @@ public class TestMFPModel { * @throws Exception if there is an error */ @Test - public void testModelWriteReadXML() throws Exception { + public void testModelWriteReadXml() throws Exception { testApexModel1.testApexModelWriteReadXml(); testApexModel2.testApexModelWriteReadXml(); } @@ -99,7 +99,7 @@ public class TestMFPModel { * @throws Exception if there is an error */ @Test - public void testModelWriteReadJSON() throws Exception { + public void testModelWriteReadJson() throws Exception { testApexModel1.testApexModelWriteReadJson(); testApexModel2.testApexModelWriteReadJson(); } 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 fe9d3a205..0d6b4737c 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 @@ -36,7 +36,7 @@ import org.onap.policy.apex.model.utilities.TextFileUtils; /** * Test MyFirstPolicyModel CLI. */ -public class TestMFPModelCLI { +public class TestMfpModelCli { private static AxPolicyModel testApexModel1; private static AxPolicyModel testApexModel2; @@ -47,8 +47,8 @@ public class TestMFPModelCLI { */ @BeforeClass public static void setup() throws Exception { - testApexModel1 = new TestMFPModelCreator.TestMFP1ModelCreator().getModel(); - testApexModel2 = new TestMFPModelCreator.TestMFP2ModelCreator().getModel(); + testApexModel1 = new TestMfpModelCreator.TestMfp1ModelCreator().getModel(); + testApexModel2 = new TestMfpModelCreator.TestMfp2ModelCreator().getModel(); } /** @@ -58,17 +58,17 @@ public class TestMFPModelCLI { * @throws ApexModelException ifd there is an Apex Error */ @Test - public void testCLIPolicy() throws IOException, ApexModelException { + public void testCliPolicy() throws IOException, ApexModelException { final File tempLogFile1 = File.createTempFile("TestMyFirstPolicy1CLI", ".log"); final File tempModelFile1 = File.createTempFile("TestMyFirstPolicy1CLI", ".json"); final File tempLogFile2 = File.createTempFile("TestMyFirstPolicy2CLI", ".log"); final File tempModelFile2 = File.createTempFile("TestMyFirstPolicy2CLI", ".json"); final String[] testApexModel1CliArgs = - { "-c", "src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex", "-l", + { "-c", "src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.apex", "-l", tempLogFile1.getAbsolutePath(), "-o", tempModelFile1.getAbsolutePath() }; final String[] testApexModel2CliArgs = - { "-c", "src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex", "-l", + { "-c", "src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex", "-l", tempLogFile2.getAbsolutePath(), "-o", tempModelFile2.getAbsolutePath() }; new ApexCLIEditorMain(testApexModel1CliArgs); 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 2f51f2851..ebbdac7c2 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 @@ -29,7 +29,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * * @author John Keeney (John.Keeney@ericsson.com) */ -public abstract class TestMFPModelCreator implements TestApexModelCreator<AxPolicyModel> { +public abstract class TestMfpModelCreator implements TestApexModelCreator<AxPolicyModel> { /* * (non-Javadoc) @@ -74,7 +74,7 @@ public abstract class TestMFPModelCreator implements TestApexModelCreator<AxPoli /** * Create the MyFirstPolicyModel #1. */ - public static class TestMFP1ModelCreator extends TestMFPModelCreator { + public static class TestMfp1ModelCreator extends TestMfpModelCreator { /* * (non-Javadoc) @@ -90,7 +90,7 @@ public abstract class TestMFPModelCreator implements TestApexModelCreator<AxPoli /** * Create the MyFirstPolicyModel#2. */ - public static class TestMFP2ModelCreator extends TestMFPModelCreator { + public static class TestMfp2ModelCreator extends TestMfpModelCreator { /* * (non-Javadoc) 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 1068a5398..0d6328286 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 @@ -57,7 +57,7 @@ import org.onap.policy.common.utils.resources.ResourceUtils; /** * Test MyFirstPolicy Use Case. */ -public class TestMFPUseCase { +public class TestMfpUseCase { // CHECKSTYLE:OFF: MagicNumber private static ApexEngineImpl apexEngine; @@ -66,7 +66,7 @@ public class TestMFPUseCase { * Test MFP use case setup. */ @BeforeClass - public static void testMFPUseCaseSetup() { + public static void testMfpUseCaseSetup() { final AxArtifactKey key = new AxArtifactKey("MyFirstPolicyApexEngine", "0.0.1"); apexEngine = (ApexEngineImpl) new ApexEngineFactory().createApexEngine(key); } @@ -122,7 +122,7 @@ public class TestMFPUseCase { * @throws IOException Signals that an I/O exception has occurred. */ @Test - public void testMFP1Case() throws ApexException, InterruptedException, IOException { + public void testMfp1Case() throws ApexException, InterruptedException, IOException { final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP1PolicyModel(); assertNotNull(apexPolicyModel); @@ -170,7 +170,7 @@ public class TestMFPUseCase { * @throws IOException Signals that an I/O exception has occurred. */ @Test - public void testMFP2Case() throws ApexException, InterruptedException, IOException { + public void testMfp2Case() throws ApexException, InterruptedException, IOException { final AxPolicyModel apexPolicyModel = new MFPDomainModelFactory().getMFP2PolicyModel(); assertNotNull(apexPolicyModel); diff --git a/examples/examples-pcvs/pom.xml b/examples/examples-pcvs/pom.xml index 074e8944c..2ac770287 100644 --- a/examples/examples-pcvs/pom.xml +++ b/examples/examples-pcvs/pom.xml @@ -97,7 +97,7 @@ <arguments> <argument>-classpath</argument> <classpath /> - <argument>org.onap.policy.apex.examples.pcvs.model.PCVSDomainModelSaver</argument> + <argument>org.onap.policy.apex.examples.pcvs.model.PcvsDomainModelSaver</argument> <argument>${project.basedir}</argument> <argument>${project.build.directory}/classes/examples/models/pcvs/</argument> </arguments> 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 bc9eca88e..001886370 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 @@ -33,7 +33,7 @@ import org.onap.policy.common.utils.resources.ResourceUtils; * * @author Sven van der Meer (sven.van.der.meer@ericsson.com) */ -public class PCVSDomainModelFactory { +public class PcvsDomainModelFactory { /** * Generates the PCVS VPN-SLA policy model from CLI commands and creates an APEX model. @@ -42,7 +42,7 @@ public class PCVSDomainModelFactory { * * @return the PCVS VPN-SLA policy model */ - public AxPolicyModel getPCVVpnSlaSPolicyModel(final String workingDirectory) { + public AxPolicyModel getPcvsVpnSlaSPolicyModel(final String workingDirectory) { final String path = "target/model-gen/pcvs/vpnsla"; final String file = "policy.json"; final String full = path + "/" + file; @@ -51,8 +51,8 @@ public class PCVSDomainModelFactory { pathFile.mkdirs(); final String[] args = - new String[] { "-c", "src/main/resources/org/onap/policy/apex/examples/pcvs/vpnsla/vpnsla.apex", "-wd", - workingDirectory, "-o", full }; + 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); if (cliEditor.getErrorCount() > 0) { diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java index 65e84a4ea..42d3d659b 100644 --- a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PCVSDomainModelSaver.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java @@ -25,14 +25,14 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; /** - * The Class PCVSDomainModelSaver. + * The Class PcvsDomainModelSaver. * * @author Sven van der Meer (sven.van.der.meer@ericsson.com) */ -public final class PCVSDomainModelSaver { +public final class PcvsDomainModelSaver { /** Private constructor to prevent instantiation. */ - private PCVSDomainModelSaver() {} + private PcvsDomainModelSaver() {} /** * Write all PCVS models to args[0]. @@ -43,11 +43,11 @@ public final class PCVSDomainModelSaver { public static void main(final String[] args) throws ApexException { if (args.length != 2) { System.err.println( - "usage: " + PCVSDomainModelSaver.class.getCanonicalName() + " workingDirectory modelDirectory"); + "usage: " + PcvsDomainModelSaver.class.getCanonicalName() + " workingDirectory modelDirectory"); return; } - final AxPolicyModel pcvsPolicyModel = new PCVSDomainModelFactory().getPCVVpnSlaSPolicyModel(args[0]); + final AxPolicyModel pcvsPolicyModel = new PcvsDomainModelFactory().getPcvsVpnSlaSPolicyModel(args[0]); final ApexModelSaver<AxPolicyModel> pcvsModelSaver = new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, args[1] + "vpnsla/"); pcvsModelSaver.apexModelWriteJson(); |