diff options
author | dhebeha <dhebeha.mj71@wipro.com> | 2020-09-08 13:02:32 +0530 |
---|---|---|
committer | dhebeha <dhebeha.mj71@wipro.com> | 2020-09-15 22:11:14 +0530 |
commit | 8882e23eedce9e9236e1d979b2056b62dd974d91 (patch) | |
tree | ff7bce29e94a814c340df73607b9d0da59a1329a /components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models | |
parent | 2c6ad52e8d0e29b8037776fff035f031558cc4b0 (diff) |
Add support to consume, process pm message from DB
- Add support for analysing pm data
- Add support to trigger closed loop
- Add support for configDb Interface Implementation
- Add support for Intelligent slicing
Issue-ID: DCAEGEN2-2255
Signed-off-by: dhebeha <dhebeha.mj71@wipro.com>
Change-Id: I185dbb6da45ae6ee74f0a090e2d604914163588b
Diffstat (limited to 'components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models')
5 files changed, 383 insertions, 0 deletions
diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigPolicyTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigPolicyTest.java new file mode 100644 index 00000000..2b137e3a --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigPolicyTest.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ + + +package org.onap.slice.analysis.ms.models; + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + + +public class ConfigPolicyTest { + + @Test + public void configPolicyTest() { + ConfigPolicy configPolicy = ConfigPolicy.getInstance(); + Map<String, Object> config = new HashMap<String, Object>(); + config.put("policyName", "pcims_policy"); + configPolicy.setConfig(config); + assertEquals(config, configPolicy.getConfig()); + } +} diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigurationTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigurationTest.java new file mode 100644 index 00000000..eb492800 --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ConfigurationTest.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ + + +package org.onap.slice.analysis.ms.models; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + + +public class ConfigurationTest { + Configuration configuration = Configuration.getInstance(); + + @Test + public void configurationTest() { + + List<String> list = new ArrayList<String>(); + list.add("server"); + Map<String, Object> subscribes = new HashMap<>(); + + configuration.setStreamsSubscribes(subscribes); + configuration.setStreamsPublishes(subscribes); + configuration.setDmaapServers(list); + configuration.setCg("cg"); + configuration.setCid("cid"); + configuration.setAafPassword("password"); + configuration.setAafUsername("user"); + configuration.setPgHost("pg"); + configuration.setPgPort(5432); + configuration.setPgPassword("password"); + configuration.setPgUsername("user"); + configuration.setPollingInterval(30); + configuration.setPollingTimeout(100); + configuration.setConfigDbService("sdnrService"); + + assertEquals("cg", configuration.getCg()); + assertEquals("cid", configuration.getCid()); + assertEquals("user", configuration.getAafUsername()); + assertEquals("password", configuration.getAafPassword()); + assertEquals("user", configuration.getPgUsername()); + assertEquals("password", configuration.getPgPassword()); + assertEquals("pg", configuration.getPgHost()); + assertEquals(5432, configuration.getPgPort()); + assertEquals(30, configuration.getPollingInterval()); + assertEquals(100, configuration.getPollingTimeout()); + assertEquals("sdnrService", configuration.getConfigDbService()); + assertEquals(list, configuration.getDmaapServers()); + } +} diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ModelsTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ModelsTest.java new file mode 100644 index 00000000..582abdce --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/ModelsTest.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ + +package org.onap.slice.analysis.ms.models; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.EqualsAndHashCodeMatchRule; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class ModelsTest { + + @Test + public void testGetterSetterSubCounter() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(SubCounter.class); + Validator validator = ValidatorBuilder + .create() + .with(new SetterMustExistRule()) + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new EqualsAndHashCodeMatchRule()) + .build(); + validator.validate(pojoclass); + } + + @Test + public void testGetterSetterMeasurementObject() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasurementObject.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterCellCUList() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(CellCUList.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterCUModel() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(CUModel.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterConfigData() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(ConfigData.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMLOutputModel() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MLOutputModel.class); + validateMd(pojoclass); + } + + public void validateMd(PojoClass pojoclass) { + Validator validator = ValidatorBuilder + .create() + .with(new SetterMustExistRule()) + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoclass); + } +} diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/pmnotification/PmModelsTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/pmnotification/PmModelsTest.java new file mode 100644 index 00000000..8954ae9b --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/pmnotification/PmModelsTest.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ + +package org.onap.slice.analysis.ms.models.pmnotification; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class PmModelsTest { + @Test + public void testGetterSetterCommonEventHeader() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(CommonEventHeader.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterEvent() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(Event.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasDataCollection() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasDataCollection.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasInfoId() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasInfoId.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasInfoList() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasInfoList.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasResult() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasResult.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasTypes() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasTypes.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterMeasValuesList() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(MeasValuesList.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterPerf3gppFields() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(Perf3gppFields.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterPmNotification() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(PmNotification.class); + validateMd(pojoclass); + } + + public void validateMd(PojoClass pojoclass) { + Validator validator = ValidatorBuilder + .create() + .with(new SetterMustExistRule()) + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoclass); + } +} diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/policy/PolicyModelsTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/policy/PolicyModelsTest.java new file mode 100644 index 00000000..958a1f83 --- /dev/null +++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/models/policy/PolicyModelsTest.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START======================================================= + * slice-analysis-ms + * ================================================================================ + * Copyright (C) 2020 Wipro Limited. + * ============================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + *******************************************************************************/ +package org.onap.slice.analysis.ms.models.policy; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class PolicyModelsTest { + @Test + public void testGetterSetterPayload() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(Payload.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterAAI() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(AAI.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterOnsetMessage() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(OnsetMessage.class); + validateMd(pojoclass); + } + + @Test + public void testGetterSetterAdditionalProperties() { + PojoClass pojoclass = PojoClassFactory.getPojoClass(AdditionalProperties.class); + validateMd(pojoclass); + } + + public void validateMd(PojoClass pojoclass) { + Validator validator = ValidatorBuilder + .create() + .with(new SetterMustExistRule()) + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoclass); + } +} |