diff options
Diffstat (limited to 'asdc-controller')
9 files changed, 30 insertions, 49 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 8276826456..5710905660 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -102,10 +102,9 @@ public class ASDCConfiguration implements IConfiguration { this.asdcControllerName = asdcControllerName; } - @Override public java.lang.Boolean isUseHttpsWithDmaap() { - return false; + return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithDmaap", true); } @Override diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index f131b73175..f5215e9f1f 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -149,6 +149,8 @@ public class BpmnInstaller { .setField("Content-Disposition", String.format("form-data; name=\"%s\"; filename=\"%s\"; size=%d", bpmnFileName, bpmnFileName, bytesToSend.length)) .build()) .build(); + + IOUtils.closeQuietly(bpmnFileStream); return requestEntity; } diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml index ef2bb0a932..1b21d8b571 100644 --- a/asdc-controller/src/main/resources/application-local.yaml +++ b/asdc-controller/src/main/resources/application-local.yaml @@ -78,6 +78,7 @@ mso: pollingInterval: 30 pollingTimeout: 30 relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL + useHttpsWithDmaap: true activateServerTLSAuth: false keyStorePassword: keyStorePath: 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 diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml index 119e677246..caaa5dd3b4 100644 --- a/asdc-controller/src/test/resources/application-test.yaml +++ b/asdc-controller/src/test/resources/application-test.yaml @@ -80,6 +80,7 @@ mso: pollingInterval: 30 pollingTimeout: 30 relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL + useHttpsWithDmaap: true activateServerTLSAuth: false keyStorePassword: keyStorePath: diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 0372887f15..a84b02db63 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -935,6 +935,7 @@ CREATE TABLE `infra_active_requests` ( `CONFIGURATION_NAME` varchar(200) DEFAULT NULL, `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, + `REQUEST_URL` varchar(500) DEFAULT NULL, PRIMARY KEY (`REQUEST_ID`), UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; @@ -984,6 +985,7 @@ CREATE TABLE `archived_infra_requests` ( `CONFIGURATION_NAME` varchar(200) DEFAULT NULL, `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, + `REQUEST_URL` varchar(500) DEFAULT NULL, PRIMARY KEY (`REQUEST_ID`), UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d72h` (`CLIENT_REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |