diff options
author | Wojciech Sliwka <wojciech.sliwka@nokia.com> | 2019-04-23 08:39:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-23 08:39:41 +0000 |
commit | e45ae0f52dc8bf623419c3c7399340b8121f4db6 (patch) | |
tree | daa9c6d5659702ee9579dc8b57b3a4bfd9dd6e68 /vid-app-common/src/test/java/org | |
parent | 73e90ce42013fbd2ee87477a2cd8c72eb234df3d (diff) | |
parent | f3d868d103e9d3a41bc1e8bea443271745d5abcf (diff) |
Merge "Sonar fix too many method param"
Diffstat (limited to 'vid-app-common/src/test/java/org')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/asdc/rest/SdcRestClientITTest.java | 64 | ||||
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java | 3 |
2 files changed, 36 insertions, 31 deletions
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(); } |