diff options
Diffstat (limited to 'asdc-controller/src/test/java/org')
4 files changed, 23 insertions, 47 deletions
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java index ce8b664bda..16bd97b409 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java @@ -52,7 +52,8 @@ public class ASDCConfigurationTest extends BaseTest { assertTrue(config.getPollingInterval() == 30); assertTrue(config.getPollingTimeout() == 30); assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size()); - assertTrue(config.getWatchDogTimeout() == 1); + assertTrue(config.getWatchDogTimeout() == 1); + assertTrue(config.isUseHttpsWithDmaap() == true); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 4eabcdd946..546c4e2458 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -27,73 +27,40 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; import java.util.Set; import javax.transaction.Transactional; import javax.ws.rs.core.Response; -import org.junit.Ignore; +import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; import org.mockito.Spy; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; -import org.onap.so.db.catalog.beans.CollectionResource; -import org.onap.so.db.catalog.beans.CollectionResourceCustomization; -import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.ConfigurationResource; -import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; -import org.onap.so.db.catalog.beans.InstanceGroup; -import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; -import org.onap.so.db.catalog.beans.NetworkResource; -import org.onap.so.db.catalog.beans.NetworkResourceCustomization; -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.ServiceProxyResource; -import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; -import org.onap.so.db.catalog.beans.ServiceRecipe; -import org.onap.so.db.catalog.beans.ToscaCsar; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; -import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; -import org.onap.so.db.catalog.data.repository.CollectionResourceInstanceGroupCustomizationRepository; -import org.onap.so.db.catalog.data.repository.CollectionResourceRepository; -import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository; -import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; -import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; -import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; public class ASDCRestInterfaceTest extends BaseTest { - //ASDC Controller writes to this path - static { - System.setProperty("mso.config.path", "src/test/resources/"); - } - @Autowired private AllottedResourceRepository allottedRepo; @@ -116,6 +83,16 @@ public class ASDCRestInterfaceTest extends BaseTest { @LocalServerPort private int port; + + @Rule + public TemporaryFolder folder= new TemporaryFolder(); + + + @Before + public void setUp() { + //ASDC Controller writes to this path + System.setProperty("mso.config.path", folder.getRoot().toString()); + } @Test @Transactional diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java index 6f07f44e2b..db797cff29 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java @@ -55,7 +55,7 @@ public class ASDCConfigurationTest extends BaseTest { @Test public void isUseHttpsWithDmaapTest() { - assertFalse(config.isUseHttpsWithDmaap()); + assertTrue(config.isUseHttpsWithDmaap()); } @Test diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java index 535434db32..5d35ea30f1 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java @@ -21,7 +21,7 @@ package org.onap.so.asdc.installer.bpmn; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -41,15 +41,11 @@ import org.apache.http.message.BasicHttpResponse; import org.apache.http.message.BasicStatusLine; import org.junit.Before; import org.junit.Test; -import org.onap.so.asdc.BaseTest; -import org.onap.so.asdc.installer.bpmn.BpmnInstaller; -import org.springframework.beans.factory.annotation.Autowired; @Transactional -public class BpmnInstallerTest extends BaseTest { +public class BpmnInstallerTest { - @Autowired - private BpmnInstaller bpmnInstaller; + private BpmnInstaller bpmnInstaller = new BpmnInstaller(); @Before public void init() throws Exception { @@ -65,7 +61,9 @@ public class BpmnInstallerTest extends BaseTest { File mimeMultipartBody = new File(mimeMultipartBodyFilePath); InputStream expectedContent = new FileInputStream(mimeMultipartBody); - assertThat(IOUtils.contentEquals(expectedContent, entity.getContent())); + assertThat(IOUtils.contentEquals(expectedContent, entity.getContent())); + + IOUtils.closeQuietly(expectedContent); } @Test |