summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-04-07 10:10:45 +0200
committersebdet <sebastien.determe@intl.att.com>2021-04-15 17:49:58 +0200
commit1f2d62dd48694fa78041572a200b3e5d04bd268e (patch)
tree58989ac6875277998b07d97be9883a039ee970b4 /src/test/java
parent58e7987439bca70cdd2715863a020b76baa8ac1c (diff)
Update dependencies
Update dependencies to remove some issues reported by Nexus-IQ. Issue-ID: POLICY-3169 Issue-ID: POLICY-3120 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ia8939f0c85ac4087c3fc2c71b66914d6c7178347
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java10
-rw-r--r--src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java20
-rw-r--r--src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java41
-rw-r--r--src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java4
4 files changed, 26 insertions, 49 deletions
diff --git a/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java b/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java
index 51c4c078a..622fd5999 100644
--- a/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java
+++ b/src/test/java/org/onap/policy/clamp/flow/FlowLogOperationTest.java
@@ -1,9 +1,11 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP CLAMP
+ * ONAP POLICY-CLAMP
* ================================================================================
* Copyright (C) 2019 Samsung. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2021 AT&T
+ * ================================================================================
* 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
@@ -28,7 +30,7 @@ import static org.mockito.Mockito.mock;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultExchange;
+import org.apache.camel.support.DefaultExchange;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.clamp.clds.util.LoggingUtils;
@@ -43,7 +45,7 @@ public class FlowLogOperationTest {
private FlowLogOperation flowLogOperation = new FlowLogOperation();
@Test
- public void testStratLog() {
+ public void testStartLog() {
// given
LoggingUtils loggingUtils = mock(LoggingUtils.class);
ReflectionTestUtils.setField(flowLogOperation, "util", loggingUtils);
@@ -65,7 +67,7 @@ public class FlowLogOperationTest {
public void testInvokeLog() {
// given
final String mockEntity = "mockEntity";
- final String mockServiceName = "mockSerivceName";
+ final String mockServiceName = "mockServiceName";
MDCAdapter mdcAdapter = MDC.getMDCAdapter();
// when
flowLogOperation.invokeLog(mockEntity, mockServiceName);
diff --git a/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java
index 5b67f1f3a..b0abf832b 100644
--- a/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/policy/clamp/loop/CsarInstallerItCase.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP CLAMP
+ * ONAP POLICY-CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Modifications copyright (c) 2019 Nokia
@@ -98,9 +98,9 @@ public class CsarInstallerItCase {
@Qualifier("csarInstaller")
private CsarInstaller csarInstaller;
- private BlueprintArtifact buildFakeBuildprintArtifact(String instanceName, String invariantResourceUuid,
- String blueprintFilePath, String artifactName,
- String invariantServiceUuid) throws IOException {
+ private BlueprintArtifact buildFakeBlueprintArtifact(String instanceName, String invariantResourceUuid,
+ String blueprintFilePath, String artifactName,
+ String invariantServiceUuid) throws IOException {
IResourceInstance resource = Mockito.mock(IResourceInstance.class);
Mockito.when(resource.getResourceInstanceName()).thenReturn(instanceName);
Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid);
@@ -127,7 +127,7 @@ public class CsarInstallerItCase {
Map<String, BlueprintArtifact> blueprintMap = new HashMap<>();
Mockito.when(csarHandler.getMapOfBlueprints()).thenReturn(blueprintMap);
// Create fake blueprint artifact 1 on resource1
- BlueprintArtifact blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1,
+ BlueprintArtifact blueprintArtifact = buildFakeBlueprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1,
INVARIANT_RESOURCE1_UUID, "example/sdc/blueprint-dcae/tca-bad-policy.yaml", "tca-bad-policy.yaml",
INVARIANT_SERVICE_UUID);
listResources.add(blueprintArtifact.getResourceAttached());
@@ -167,25 +167,25 @@ public class CsarInstallerItCase {
Map<String, BlueprintArtifact> blueprintMap = new HashMap<>();
Mockito.when(csarHandler.getMapOfBlueprints()).thenReturn(blueprintMap);
// Create fake blueprint artifact 1 on resource1
- BlueprintArtifact blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1,
+ BlueprintArtifact blueprintArtifact = buildFakeBlueprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1,
INVARIANT_RESOURCE1_UUID, "example/sdc/blueprint-dcae/tca.yaml", "tca.yaml", INVARIANT_SERVICE_UUID);
listResources.add(blueprintArtifact.getResourceAttached());
blueprintMap.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact);
// Create fake blueprint artifact 2 on resource2
- blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE2, INVARIANT_RESOURCE2_UUID,
+ blueprintArtifact = buildFakeBlueprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE2, INVARIANT_RESOURCE2_UUID,
"example/sdc/blueprint-dcae/tca_2.yaml", "tca_2.yaml", INVARIANT_SERVICE_UUID);
listResources.add(blueprintArtifact.getResourceAttached());
blueprintMap.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact);
// Create fake blueprint artifact 3 on resource 1 so that it's possible to
// test multiple CL deployment per Service/vnf
- blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1, INVARIANT_RESOURCE1_UUID,
+ blueprintArtifact = buildFakeBlueprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1, INVARIANT_RESOURCE1_UUID,
"example/sdc/blueprint-dcae/tca_3.yaml", "tca_3.yaml", INVARIANT_SERVICE_UUID);
blueprintMap.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact);
// Create fake blueprint artifact 3 on resource 1 so that it's possible to
// test multiple CL deployment per Service/vnf
- blueprintArtifact = buildFakeBuildprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1, INVARIANT_RESOURCE1_UUID,
+ blueprintArtifact = buildFakeBlueprintArtifact(RESOURCE_INSTANCE_NAME_RESOURCE1, INVARIANT_RESOURCE1_UUID,
"example/sdc/blueprint-dcae/tca-guilin.yaml", "tca-guilin.yaml", INVARIANT_SERVICE_UUID);
blueprintMap.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact);
diff --git a/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java
index c94937031..c95725457 100644
--- a/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java
+++ b/src/test/java/org/onap/policy/clamp/loop/DcaeComponentTest.java
@@ -1,8 +1,8 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP CLAMP
+ * ONAP POLICY-CLAMP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,6 +36,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.policy.clamp.clds.model.dcae.DcaeInventoryResponse;
import org.onap.policy.clamp.clds.model.dcae.DcaeOperationStatusResponse;
+import org.onap.policy.clamp.clds.util.ResourceFileUtils;
import org.onap.policy.clamp.loop.components.external.DcaeComponent;
import org.onap.policy.clamp.loop.components.external.ExternalComponentState;
import org.onap.policy.clamp.loop.template.LoopTemplate;
@@ -52,7 +53,7 @@ public class DcaeComponentTest {
JsonObject.class));
loopTest.setLastComputedState(LoopState.DESIGN);
loopTest.setDcaeDeploymentId("123456789");
- loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
+ loopTest.setDcaeDeploymentStatusUrl("http://localhost:8085");
MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", new PolicyModel("policy1",
"tosca_definitions_version: tosca_simple_yaml_1_0_0", "1.0.0"), true,
@@ -175,36 +176,10 @@ public class DcaeComponentTest {
*/
@Test
public void convertToDcaeInventoryResponseTest() throws IOException, ParseException {
- String dcaeFakeResponse = "{\n" + " \"links\": {\n" + " \"previousLink\": {\n"
- + " \"title\": \"string\",\n" + " \"rel\": \"string\",\n" + " \"uri\": \"string\",\n"
- + " \"uriBuilder\": {},\n" + " \"rels\": [\n" + " \"string\"\n" + " ],\n"
- + " \"params\": {\n" + " \"additionalProp1\": \"string\",\n"
- + " \"additionalProp2\": \"string\",\n" + " \"additionalProp3\": \"string\"\n"
- + " },\n" + " \"type\": \"string\"\n" + " },\n" + " \"nextLink\": {\n"
- + " \"title\": \"string\",\n" + " \"rel\": \"string\",\n" + " \"uri\": \"string\",\n"
- + " \"uriBuilder\": {},\n" + " \"rels\": [\n" + " \"string\"\n" + " ],\n"
- + " \"params\": {\n" + " \"additionalProp1\": \"string\",\n"
- + " \"additionalProp2\": \"string\",\n" + " \"additionalProp3\": \"string\"\n"
- + " },\n" + " \"type\": \"string\"\n" + " }\n" + " },\n" + " \"totalCount\": 0,\n"
- + " \"items\": [\n" + " {\n" + " \"owner\": \"testOwner\",\n"
- + " \"application\": \"testApplication\",\n" + " \"component\": \"testComponent\",\n"
- + " \"typeName\": \"testTypeName\",\n" + " \"typeVersion\": 0,\n"
- + " \"blueprintTemplate\": \"testBlueprintTemplate\",\n" + " \"serviceIds\": [\n"
- + " \"serviceId1\", \"serviceId2\"\n" + " ],\n" + " \"vnfTypes\": [\n"
- + " \"vnfType1\", \"vnfType2\"\n" + " ],\n" + " \"serviceLocations\": [\n"
- + " \"serviceLocation1\", \"serviceLocation2\"\n" + " ],\n"
- + " \"asdcServiceId\": \"testAsdcServiceId\",\n"
- + " \"asdcResourceId\": \"testAsdcResourceId\",\n"
- + " \"asdcServiceURL\": \"testAsdcServiceURL\",\n" + " \"typeId\": \"testTypeId\",\n"
- + " \"selfLink\": {\n" + " \"title\": \"selfLinkTitle\",\n"
- + " \"rel\": \"selfLinkRel\",\n" + " \"uri\": \"selfLinkUri\",\n"
- + " \"uriBuilder\": {},\n" + " \"rels\": [\n" + " \"string\"\n" + " ],\n"
- + " \"params\": {\n" + " \"additionalProp1\": \"string\",\n"
- + " \"additionalProp2\": \"string\",\n" + " \"additionalProp3\": \"string\"\n"
- + " },\n" + " \"type\": \"string\"\n" + " },\n"
- + " \"created\": \"2020-01-22T09:38:15.436Z\",\n"
- + " \"deactivated\": \"2020-01-22T09:38:15.437Z\"\n" + " }\n" + " ]\n" + "}";
- List<DcaeInventoryResponse> responseObject = DcaeComponent.convertToDcaeInventoryResponse(dcaeFakeResponse);
+
+ List<DcaeInventoryResponse> responseObject = DcaeComponent
+ .convertToDcaeInventoryResponse(
+ ResourceFileUtils.getResourceAsString("example/dcae/inventory-response.json"));
assertThat(responseObject.get(0).getAsdcResourceId()).isEqualTo("testAsdcResourceId");
assertThat(responseObject.get(0).getAsdcServiceId()).isEqualTo("testAsdcServiceId");
assertThat(responseObject.get(0).getTypeName()).isEqualTo("testTypeName");
diff --git a/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java
index 010c4978a..74092727c 100644
--- a/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/policy/clamp/loop/LoopServiceTestItCase.java
@@ -355,10 +355,10 @@ public class LoopServiceTestItCase {
saveTestLoopToDb();
Loop loop = loopService.getLoop(EXAMPLE_LOOP_NAME);
loopService.updateDcaeDeploymentFields(loop, "CLAMP_c5ce429a-f570-48c5-a7ea-53bed8f86f85",
- "https4://deployment-handler.onap:8443");
+ "https://deployment-handler.onap:8443");
loop = loopService.getLoop(EXAMPLE_LOOP_NAME);
assertThat(loop.getDcaeDeploymentId()).isEqualTo("CLAMP_c5ce429a-f570-48c5-a7ea-53bed8f86f85");
- assertThat(loop.getDcaeDeploymentStatusUrl()).isEqualTo("https4://deployment-handler.onap:8443");
+ assertThat(loop.getDcaeDeploymentStatusUrl()).isEqualTo("https://deployment-handler.onap:8443");
}
@Test