diff options
author | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2022-02-28 17:10:36 +0000 |
---|---|---|
committer | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2022-03-02 12:12:49 +0000 |
commit | 7ec767641505f52cd8ecf8b9a76fa35afe32635e (patch) | |
tree | 90dde20bbe7d13b2ee253a7b21ea1cb18f94194e /plugins/reception-plugins/src | |
parent | ee04ffd34d67563f1b33a4fbb1eb17e948725d0f (diff) |
Rename ControlLoop to AutomationCompsition
Issue-ID: POLICY-3938
Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech>
Change-Id: I63188fa9bc5d634d3aeb7e2d7051c4d67b5a202c
Diffstat (limited to 'plugins/reception-plugins/src')
9 files changed, 54 insertions, 52 deletions
diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsar.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsar.java index 96db632c..7bfcb0f9 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsar.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsar.java @@ -38,13 +38,13 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** - * This class extracts controlloop information from a CSAR file. + * This class extracts acm information from a CSAR file. * * @author Sirisha Manchikanti (sirisha.manchikanti@est.tech) */ -public class ControlLoopDecoderFileInCsar implements PolicyDecoder<Csar, ToscaEntity> { +public class AutomationCompositionDecoderFileInCsar implements PolicyDecoder<Csar, ToscaEntity> { - private ControlLoopDecoderFileInCsarParameterGroup decoderParameters; + private AutomationCompositionDecoderFileInCsarParameterGroup decoderParameters; private static final String NODE_TYPES = "nodes.yml"; private static final String DATA_TYPES = "data.yml"; @@ -69,7 +69,7 @@ public class ControlLoopDecoderFileInCsar implements PolicyDecoder<Csar, ToscaEn */ @Override public Collection<ToscaEntity> decode(final Csar csar) throws PolicyDecodingException { - final Collection<ToscaEntity> controlLoopList = new ArrayList<>(); + final Collection<ToscaEntity> automationCompositionList = new ArrayList<>(); ToscaServiceTemplate nodeTypes = null; ToscaServiceTemplate dataTypes = null; @@ -94,24 +94,24 @@ public class ControlLoopDecoderFileInCsar implements PolicyDecoder<Csar, ToscaEn dataTypes = ReceptionUtil.decodeFile(zipFile, entry); } - if (entryName.contains(decoderParameters.getControlLoopType())) { + if (entryName.contains(decoderParameters.getAutomationCompositionType())) { ReceptionUtil.validateZipEntry(entryName, csar.getCsarFilePath(), entry.getSize()); - final ToscaServiceTemplate controlLoop = ReceptionUtil.decodeFile(zipFile, entry); - if (null != controlLoop.getToscaTopologyTemplate()) { + final ToscaServiceTemplate automationComposition = ReceptionUtil.decodeFile(zipFile, entry); + if (null != automationComposition.getToscaTopologyTemplate()) { if (null != nodeTypes) { - controlLoop.setNodeTypes(nodeTypes.getNodeTypes()); + automationComposition.setNodeTypes(nodeTypes.getNodeTypes()); } if (null != dataTypes) { - controlLoop.setDataTypes(dataTypes.getDataTypes()); + automationComposition.setDataTypes(dataTypes.getDataTypes()); } - controlLoopList.add(controlLoop); + automationCompositionList.add(automationComposition); } } } } catch (final IOException | CoderException exp) { - throw new PolicyDecodingException("Failed decoding the controlloop", exp); + throw new PolicyDecodingException("Failed decoding the acm", exp); } - return controlLoopList; + return automationCompositionList; } } diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarParameterGroup.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroup.java index 358b1f87..a3efaa28 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarParameterGroup.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroup.java @@ -27,18 +27,18 @@ import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.distribution.reception.parameters.PolicyDecoderConfigurationParameterGroup; /** - * Holds the parameters for the{@link ControlLoopDecoderFileInCsar}. + * Holds the parameters for the{@link AutomationCompositionDecoderFileInCsar}. * * @author Sirisha Manchikanti (sirisha.manchikanti@est.tech) */ @Getter @NotNull @NotBlank -public class ControlLoopDecoderFileInCsarParameterGroup extends PolicyDecoderConfigurationParameterGroup { +public class AutomationCompositionDecoderFileInCsarParameterGroup extends PolicyDecoderConfigurationParameterGroup { - private String controlLoopType; + private String automationCompositionType; - public ControlLoopDecoderFileInCsarParameterGroup() { - super(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName()); + public AutomationCompositionDecoderFileInCsarParameterGroup() { + super(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName()); } } diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarParameterGroupTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java index 16f80096..ea844e4e 100644 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarParameterGroupTest.java +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarParameterGroupTest.java @@ -28,39 +28,40 @@ import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.distribution.reception.handling.sdc.CommonTestData; /** - * Class to perform unit test of {@link ControlLoopDecoderFileInCsarParameterGroup}. + * Class to perform unit test of {@link AutomationCompositionDecoderFileInCsarParameterGroup}. * * @author Sirisha Manchikanti (sirisha.manchikanti@est.tech) */ -public class ControlLoopDecoderFileInCsarParameterGroupTest { +public class AutomationCompositionDecoderFileInCsarParameterGroupTest { @Test public void testValidParameters() { - final ControlLoopDecoderFileInCsarParameterGroup configurationParameters = CommonTestData - .getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarControlLoopDecoderParameters.json", - ControlLoopDecoderFileInCsarParameterGroup.class); + final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData + .getPolicyDecoderParameters( + "src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json", + AutomationCompositionDecoderFileInCsarParameterGroup.class); - assertEquals(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName(), + assertEquals(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName(), configurationParameters.getName()); - assertEquals("controlloop", configurationParameters.getControlLoopType()); + assertEquals("acm", configurationParameters.getAutomationCompositionType()); assertEquals(ValidationStatus.CLEAN, configurationParameters.validate().getStatus()); } @Test public void testInvalidParameters() { - final ControlLoopDecoderFileInCsarParameterGroup configurationParameters = + final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData.getPolicyDecoderParameters( - "src/test/resources/parameters/FileInCsarControlLoopDecoderParametersInvalid.json", - ControlLoopDecoderFileInCsarParameterGroup.class); + "src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParametersInvalid.json", + AutomationCompositionDecoderFileInCsarParameterGroup.class); assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus()); } @Test public void testEmptyParameters() { - final ControlLoopDecoderFileInCsarParameterGroup configurationParameters = + final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData.getPolicyDecoderParameters("src/test/resources/parameters/EmptyParameters.json", - ControlLoopDecoderFileInCsarParameterGroup.class); + AutomationCompositionDecoderFileInCsarParameterGroup.class); assertEquals(ValidationStatus.INVALID, configurationParameters.validate().getStatus()); } diff --git a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarTest.java b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java index e452a7ce..80c520a4 100644 --- a/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/ControlLoopDecoderFileInCsarTest.java +++ b/plugins/reception-plugins/src/test/java/org/onap/policy/distribution/reception/decoding/policy/file/AutomationCompositionDecoderFileInCsarTest.java @@ -39,22 +39,23 @@ import org.onap.policy.distribution.reception.handling.sdc.CommonTestData; import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity; /** - * Class to perform unit test of {@link ControlLoopDecoderFileInCsar}. + * Class to perform unit test of {@link AutomationCompositionDecoderFileInCsar}. * * @author Sirisha Manchikanti (sirisha.manchikanti@est.tech) */ @RunWith(MockitoJUnitRunner.class) -public class ControlLoopDecoderFileInCsarTest { +public class AutomationCompositionDecoderFileInCsarTest { /** * Set up. */ @BeforeClass public static void setUp() { - final ControlLoopDecoderFileInCsarParameterGroup configurationParameters = CommonTestData - .getPolicyDecoderParameters("src/test/resources/parameters/FileInCsarControlLoopDecoderParameters.json", - ControlLoopDecoderFileInCsarParameterGroup.class); - configurationParameters.setName(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName()); + final AutomationCompositionDecoderFileInCsarParameterGroup configurationParameters = CommonTestData + .getPolicyDecoderParameters( + "src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json", + AutomationCompositionDecoderFileInCsarParameterGroup.class); + configurationParameters.setName(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName()); ParameterService.register(configurationParameters); } @@ -63,34 +64,34 @@ public class ControlLoopDecoderFileInCsarTest { */ @AfterClass public static void tearDown() { - ParameterService.deregister(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName()); + ParameterService.deregister(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName()); } @Test - public void testDecodeControlLoop() throws PolicyDecodingException { + public void testDecodeAutomationComposition() throws PolicyDecodingException { - final ControlLoopDecoderFileInCsar decoder = new ControlLoopDecoderFileInCsar(); - decoder.configure(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName()); + final AutomationCompositionDecoderFileInCsar decoder = new AutomationCompositionDecoderFileInCsar(); + decoder.configure(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName()); - final File file = new File("src/test/resources/service-Sampleservice-controlloop.csar"); + final File file = new File("src/test/resources/service-Sampleservice-acm.csar"); final Csar csar = new Csar(file.getAbsolutePath()); assertTrue(decoder.canHandle(csar)); - final Collection<ToscaEntity> controlLoopHolders = decoder.decode(csar); - assertEquals(1, controlLoopHolders.size()); + final Collection<ToscaEntity> automationCompositionHolders = decoder.decode(csar); + assertEquals(1, automationCompositionHolders.size()); } @Test - public void testDecodeControlLoopZipError() { + public void testDecodeAutomationCompositionZipError() { - final ControlLoopDecoderFileInCsar decoder = new ControlLoopDecoderFileInCsar(); - decoder.configure(ControlLoopDecoderFileInCsarParameterGroup.class.getSimpleName()); + final AutomationCompositionDecoderFileInCsar decoder = new AutomationCompositionDecoderFileInCsar(); + decoder.configure(AutomationCompositionDecoderFileInCsarParameterGroup.class.getSimpleName()); final File file = new File("unknown.csar"); final Csar csar = new Csar(file.getAbsolutePath()); assertTrue(decoder.canHandle(csar)); assertThatThrownBy(() -> decoder.decode(csar)).isInstanceOf(PolicyDecodingException.class) - .hasMessageContaining("Failed decoding the controlloop"); + .hasMessageContaining("Failed decoding the acm"); } } diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json new file mode 100644 index 00000000..672a6677 --- /dev/null +++ b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParameters.json @@ -0,0 +1,3 @@ +{ + "automationCompositionType": "acm" +} diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParametersInvalid.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParametersInvalid.json new file mode 100644 index 00000000..ef58553a --- /dev/null +++ b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarAutomationCompositionDecoderParametersInvalid.json @@ -0,0 +1,3 @@ +{ + "acm": "" +} diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParameters.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParameters.json deleted file mode 100644 index ca112388..00000000 --- a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParameters.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "controlLoopType": "controlloop" -} diff --git a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParametersInvalid.json b/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParametersInvalid.json deleted file mode 100644 index 9d33896e..00000000 --- a/plugins/reception-plugins/src/test/resources/parameters/FileInCsarControlLoopDecoderParametersInvalid.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "controlLoop": "" -} diff --git a/plugins/reception-plugins/src/test/resources/service-Sampleservice-controlloop.csar b/plugins/reception-plugins/src/test/resources/service-Sampleservice-acm.csar Binary files differindex 03e29366..226ab158 100644 --- a/plugins/reception-plugins/src/test/resources/service-Sampleservice-controlloop.csar +++ b/plugins/reception-plugins/src/test/resources/service-Sampleservice-acm.csar |