summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java13
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java64
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java3
3 files changed, 45 insertions, 35 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
index c331b3252..076c46284 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/OperationalEnvironmentTest.java
@@ -56,10 +56,15 @@ public class OperationalEnvironmentTest {
RelationshipList relationshipList = new RelationshipList();
relationshipList.relationship = new ArrayList<>();
- OperationalEnvironment operationalEnvironment = new OperationalEnvironment("testId",
- "testEnvName", "testEnvType",
- "testEnvStatus", "testTenant", "testWorkload",
- "testResource", relationshipList);
+ OperationalEnvironment operationalEnvironment =
+ new OperationalEnvironment.OperationalEnvironmentBuilder()
+ .setOperationalEnvironmentId("testId")
+ .setOperationalEnvironmentName("testEnvName")
+ .setOperationalEnvironmentType("testEnvType")
+ .setOperationalEnvironmentStatus("testEnvStatus")
+ .setTenantContext("testTenant").setWorkloadContext("testWorkload")
+ .setResourceVersion("testResource").setRelationshipList(relationshipList)
+ .createOperationalEnvironment();
assertThat(operationalEnvironment.getOperationalEnvironmentId()).isEqualTo("testId");
assertThat(operationalEnvironment.getWorkloadContext()).isEqualTo("testWorkload");
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java
index 12a327af8..126f30067 100644
--- a/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java
@@ -20,8 +20,25 @@
package org.onap.vid.asdc.rest;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.xebialabs.restito.semantics.Call;
+import static com.xebialabs.restito.semantics.Action.ok;
+import static com.xebialabs.restito.semantics.Action.stringContent;
+import static org.apache.http.client.config.RequestConfig.custom;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.matchesPattern;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.assertTrue;
+import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID;
+import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.security.GeneralSecurityException;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.UUID;
+import javax.net.ssl.SSLContext;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
@@ -38,27 +55,8 @@ import org.onap.vid.asdc.AsdcCatalogException;
import org.onap.vid.asdc.beans.Service;
import org.onap.vid.client.SyncRestClient;
import org.onap.vid.testUtils.StubServerUtil;
-
-import javax.net.ssl.SSLContext;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.security.GeneralSecurityException;
-import java.util.Collections;
-import java.util.Optional;
-import java.util.UUID;
-
-import static com.xebialabs.restito.semantics.Action.ok;
-import static com.xebialabs.restito.semantics.Action.stringContent;
-import static org.apache.http.client.config.RequestConfig.custom;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasItems;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.matchesPattern;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
-import static org.junit.Assert.assertTrue;
-import static org.onap.vid.client.SyncRestClientInterface.HEADERS.X_ECOMP_INSTANCE_ID;
-import static org.onap.vid.utils.Logging.REQUEST_ID_HEADER_KEY;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.xebialabs.restito.semantics.Call;
public class SdcRestClientITTest {
@@ -124,15 +122,23 @@ public class SdcRestClientITTest {
assertTrue(first.isPresent());
- assertThat(first.get().getHeaders().keySet(), hasItems(X_ECOMP_INSTANCE_ID.toLowerCase(), REQUEST_ID_HEADER_KEY.toLowerCase()));
- assertThat(first.get().getHeaders().get(REQUEST_ID_HEADER_KEY.toLowerCase()).get(0), matchesPattern(UUID_REGEX));
+ assertThat(first.get().getHeaders().keySet(),
+ hasItems(X_ECOMP_INSTANCE_ID.toLowerCase(), REQUEST_ID_HEADER_KEY.toLowerCase()));
+ assertThat(first.get().getHeaders().get(REQUEST_ID_HEADER_KEY.toLowerCase()).get(0),
+ matchesPattern(UUID_REGEX));
}
private Service getExpectedService(String stringId) {
- return new Service(stringId, stringId,
- "sampleCategory", "sampleVersion",
- "sampleName", "sampleDistStatus",
- "sampleToscaUrl", Service.LifecycleState.CERTIFIED, Collections.emptyList(), Collections.emptyList());
+ return new Service.ServiceBuilder().setUuid(stringId)
+ .setInvariantUUID(stringId)
+ .setCategory("sampleCategory")
+ .setVersion("sampleVersion")
+ .setName( "sampleName")
+ .setDistributionStatus("sampleDistStatus")
+ .setToscaModelURL("sampleToscaUrl")
+ .setLifecycleState(Service.LifecycleState.CERTIFIED)
+ .setArtifacts(Collections.emptyList())
+ .setResources(Collections.emptyList()).build();
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
index 2c6963147..39d3cddc7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
@@ -35,7 +35,6 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.vid.asdc.AsdcCatalogException;
import org.onap.vid.asdc.beans.SecureServices;
import org.onap.vid.asdc.beans.Service;
-import org.onap.vid.asdc.beans.ServiceBuilder;
import org.onap.vid.model.*;
import org.onap.vid.model.PombaInstance.PombaRequest;
import org.onap.vid.model.PombaInstance.ServiceInstance;
@@ -171,7 +170,7 @@ public class VidControllerTest {
}
private Service createService(String uuid, int i) {
- return new ServiceBuilder().setUuid(uuid).setInvariantUUID("invariantUUID" + i)
+ return new Service.ServiceBuilder().setUuid(uuid).setInvariantUUID("invariantUUID" + i)
.setCategory("category" + i).setVersion("version" + i).setName("name" + i)
.setDistributionStatus("distStatus" + i).setToscaModelURL("toscaModelUrl" + i).build();
}