diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 15:25:32 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 15:26:47 +0100 |
commit | 4cfa2e2d98f6877d54da304ef17f096284430908 (patch) | |
tree | c9452d2bf6bb96fae9c1e8e2d8ce8f8d01e69d22 /examples/examples-aadm/src/test/java | |
parent | 0e23f7634e1e1fb31454c516974613335fcea1a4 (diff) |
Sonar/Checkstyle in service/plugins
Sonar and Checkstyle changes in plugins and services, and
knock on changes
Issue-ID: POLICY-1034
Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'examples/examples-aadm/src/test/java')
-rw-r--r-- | examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmDbWrite.java | 2 | ||||
-rw-r--r-- | examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModel.java (renamed from examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModel.java) | 10 | ||||
-rw-r--r-- | examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmModelCreator.java (renamed from examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMModelCreator.java) | 6 | ||||
-rw-r--r-- | examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAadmUseCase.java (renamed from examples/examples-aadm/src/test/java/org/onap/policy/apex/examples/aadm/TestAADMUseCase.java) | 48 |
4 files changed, 35 insertions, 31 deletions
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) { |