aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-09-28 15:26:42 +0200
committerS�bastien Determe <sebastien.determe@intl.att.com>2020-09-30 12:55:25 +0000
commitb6d7a6d192eddc0c52497603023e47f10599c2ae (patch)
tree96714e3e0b16b1a89f91cd98e084869902744357 /src/test/java/org/onap
parent1defa8a586f67b2cae78abc029d282dfe762d2b7 (diff)
Remove legacy operational Policy
As it has been removed from policy engine, legacy operational policy code must be removed as well Issue-ID: CLAMP-948 Signed-off-by: sebdet <sebastien.determe@intl.att.com> (cherry picked from commit f01d3e8377fa4e5a9c1b129fe446575d132f91c2) Change-Id: I4a7f6741417abd55f2568bd8e39ce7c9d753dd37
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java11
-rw-r--r--src/test/java/org/onap/clamp/loop/PolicyComponentTest.java6
-rw-r--r--src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java61
3 files changed, 4 insertions, 74 deletions
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index 86bc8c07e..aa8054c47 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.transaction.Transactional;
-
import org.apache.commons.lang3.RandomStringUtils;
import org.json.JSONException;
import org.junit.Assert;
@@ -43,7 +42,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.onap.clamp.clds.Application;
-import org.onap.clamp.clds.config.LegacyOperationalPolicyController;
import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
@@ -75,7 +73,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
-@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller", "legacy-operational-policy"})
+@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
public class CsarInstallerItCase {
private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
@@ -166,13 +164,6 @@ public class CsarInstallerItCase {
@Test
@Transactional
- public void testPolicyModelAddedAtStartup() {
- assertThat(policyModelsRepository.findByPolicyModelType(
- LegacyOperationalPolicyController.OPERATIONAL_POLICY_LEGACY).get(0)).isNotNull();
- }
-
- @Test
- @Transactional
public void testGetPolicyModelYaml() throws IOException, SdcToscaParserException, CsarHandlerException {
INotificationData notificationData = Mockito.mock(INotificationData.class);
IArtifactInfo serviceArtifacts = Mockito.mock(IArtifactInfo.class);
diff --git a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
index 6a646e3e1..4d2bfe280 100644
--- a/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
+++ b/src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
@@ -23,7 +23,6 @@
package org.onap.clamp.loop;
-import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.io.IOException;
@@ -31,7 +30,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.junit.Test;
import org.mockito.Mockito;
-import org.onap.clamp.clds.config.LegacyOperationalPolicyController;
import org.onap.clamp.clds.util.ResourceFileUtils;
import org.onap.clamp.loop.components.external.ExternalComponentState;
import org.onap.clamp.loop.components.external.PolicyComponent;
@@ -40,6 +38,8 @@ import org.onap.clamp.loop.template.PolicyModel;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
+import static org.assertj.core.api.Assertions.assertThat;
+
public class PolicyComponentTest {
/**
@@ -267,7 +267,7 @@ public class PolicyComponentTest {
new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), null, "pdpGroup2", "pdpSubgroup1");
loopTest.addMicroServicePolicy(microServicePolicy2);
- PolicyModel policyModel2 = new PolicyModel(LegacyOperationalPolicyController.OPERATIONAL_POLICY_LEGACY, null,
+ PolicyModel policyModel2 = new PolicyModel("onap.policies.monitoring.test2", null,
"1.0.0");
OperationalPolicy opPolicy =
new OperationalPolicy("opPolicy", new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class),
diff --git a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java b/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
deleted file mode 100644
index 36f000720..000000000
--- a/src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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.clamp.policy.microservice;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import java.io.IOException;
-
-import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtils;
-import org.onap.clamp.loop.template.PolicyModel;
-import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
-import org.onap.clamp.policy.operational.OperationalPolicy;
-
-public class OperationalPolicyPayloadTest {
-
- @Test
- public void testOperationalPolicyLegacyPayloadConstruction() throws IOException {
- JsonObject jsonConfig = new GsonBuilder().create().fromJson(
- ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", jsonConfig, null,
- new PolicyModel("onap.policies.controlloop.Operational.legacy", "", "1.0.0", "test"), null, null, null);
-
- assertThat(policy.createPolicyPayloadYaml())
- .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.yaml"));
-
- assertThat(policy.createPolicyPayload())
- .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.json"));
- }
-
- @Test
- public void testLegacyOperationalPolicyPayloadConstruction() throws IOException {
- JsonObject jsonConfig = new GsonBuilder().create().fromJson(
- ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
- assertThat(LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(jsonConfig.get("operational_policy")))
- .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
- }
-}