aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java18
-rw-r--r--src/test/java/org/onap/clamp/clds/model/DcaeEventTest.java74
-rw-r--r--src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java148
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java3
-rw-r--r--src/test/java/org/onap/clamp/loop/DcaeComponentTest.java93
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java244
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java6
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java13
-rw-r--r--src/test/javascript/propertyController.test.js12
-rwxr-xr-xsrc/test/resources/http-cache/third_party_proxy.py94
-rw-r--r--src/test/resources/https/https-test.properties1
-rw-r--r--src/test/resources/logback.xml2
13 files changed, 416 insertions, 294 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
index 8ebd627ba..d34042038 100644
--- a/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
@@ -55,10 +55,10 @@ public class CldsReferencePropertiesItCase {
*/
@Test
public void testGetStringValue() {
- assertEquals(refProp.getStringValue("policy.onap.name"), "DCAE");
- assertEquals(refProp.getStringValue("policy.ms.policyNamePrefix", ""), "Config_MS_");
- assertEquals(refProp.getStringValue("policy.ms.policyNamePrefix", "testos"), "Config_MS_");
- assertEquals(refProp.getStringValue("policy.ms", "policyNamePrefix"), "Config_MS_");
+ assertEquals("DCAE", refProp.getStringValue("policy.onap.name"));
+ assertEquals("Config_MS_", refProp.getStringValue("policy.ms.policyNamePrefix", ""));
+ assertEquals("Config_MS_", refProp.getStringValue("policy.ms.policyNamePrefix", "testos"));
+ assertEquals("Config_MS_", refProp.getStringValue("policy.ms", "policyNamePrefix"));
assertNull(refProp.getStringValue("does.not.exist"));
}
@@ -70,7 +70,7 @@ public class CldsReferencePropertiesItCase {
//then
assertNotNull(root);
assertTrue(root.isJsonObject());
- assertEquals(root.getAsJsonObject().get("DC1").getAsString(), "Data Center 1");
+ assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
}
@Test
@@ -81,7 +81,7 @@ public class CldsReferencePropertiesItCase {
//then
assertNotNull(root);
assertTrue(root.isJsonObject());
- assertEquals(root.getAsJsonObject().get("DC1").getAsString(), "Data Center 1");
+ assertEquals("Data Center 1", root.getAsJsonObject().get("DC1").getAsString());
}
@Test
@@ -113,9 +113,9 @@ public class CldsReferencePropertiesItCase {
@Test
public void testGetStringList() {
List<String> profileList = refProp.getStringList("policy.pdpUrl1", ",");
- assertTrue(profileList.size() == 3);
+ assertEquals(3, profileList.size());
assertTrue(profileList.get(0).trim().startsWith("http://localhost:"));
- assertTrue(profileList.get(1).trim().equals("testpdp"));
- assertTrue(profileList.get(2).trim().equals("alpha123"));
+ assertEquals("testpdp", profileList.get(1).trim());
+ assertEquals("alpha123", profileList.get(2).trim());
}
}
diff --git a/src/test/java/org/onap/clamp/clds/model/DcaeEventTest.java b/src/test/java/org/onap/clamp/clds/model/DcaeEventTest.java
new file mode 100644
index 000000000..315e656d7
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/model/DcaeEventTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 Samsung. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.model;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import javax.ws.rs.BadRequestException;
+import java.util.Arrays;
+
+public class DcaeEventTest {
+
+ @Test
+ public void testGetCldsActionId() {
+ //given
+ DcaeEvent dcaeEvent = new DcaeEvent();
+ dcaeEvent.setEvent(DcaeEvent.EVENT_CREATED);
+ dcaeEvent.setResourceUUID("1");
+ dcaeEvent.setServiceUUID("2");
+
+ //when
+ String cldsAction = dcaeEvent.getCldsActionCd();
+ dcaeEvent.setInstances(Arrays.asList(new CldsModelInstance()));
+ //then
+ assertEquals(CldsEvent.ACTION_CREATE, cldsAction);
+
+ //when
+ dcaeEvent.setEvent(DcaeEvent.EVENT_DEPLOYMENT);
+ //then
+ assertEquals(CldsEvent.ACTION_DEPLOY, dcaeEvent.getCldsActionCd());
+
+ //when
+ dcaeEvent.setInstances(null);
+ //then
+ assertEquals(CldsEvent.ACTION_DEPLOY, dcaeEvent.getCldsActionCd());
+
+ //when
+ dcaeEvent.setEvent(DcaeEvent.EVENT_UNDEPLOYMENT);
+ //then
+ assertEquals(CldsEvent.ACTION_UNDEPLOY, dcaeEvent.getCldsActionCd());
+
+ }
+
+ @Test(expected = BadRequestException.class)
+ public void shouldReturnBadRequestException() {
+ //given
+ DcaeEvent dcaeEvent = new DcaeEvent();
+ dcaeEvent.setResourceUUID("1");
+ dcaeEvent.setServiceUUID("2");
+ //when
+ dcaeEvent.setEvent("BadEvent");
+ //then
+ dcaeEvent.getCldsActionCd();
+ }
+}
diff --git a/src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java b/src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java
new file mode 100644
index 000000000..7e2da4d1e
--- /dev/null
+++ b/src/test/java/org/onap/clamp/clds/util/LoggingUtilsTest.java
@@ -0,0 +1,148 @@
+/*-
+* ============LICENSE_START=======================================================
+* ONAP CLAMP
+* Copyright (C) 2019 Samsung. All rights reserved.
+* ================================================================================
+* 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
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END============================================
+* ===================================================================
+*
+*/
+
+package org.onap.clamp.clds.util;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.servlet.http.HttpServletRequest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.slf4j.MDC;
+import org.slf4j.event.Level;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserDetails;
+
+/**
+ * Test Logging Utils.
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class LoggingUtilsTest {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(LoggingUtilsTest.class);
+
+ private static final String SERVICE_NAME = "LogginUtilsTest: Test Entering method";
+
+ private LoggingUtils util;
+
+ @Before
+ public void setup() {
+ this.util = new LoggingUtils(logger);
+ }
+
+ @Test
+ public void testEnteringLoggingUtils() {
+ // given
+ final String userName = "test";
+
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+
+ UserDetails userDetails = Mockito.mock(UserDetails.class);
+ Mockito.when(userDetails.getUsername()).thenReturn(userName);
+
+ Authentication localAuth = Mockito.mock(Authentication.class);
+ Mockito.when(localAuth.getPrincipal()).thenReturn(userDetails);
+
+ SecurityContext securityContext = Mockito.mock(SecurityContext.class);
+ Mockito.when(securityContext.getAuthentication()).thenReturn(localAuth);
+ SecurityContextHolder.setContext(securityContext);
+
+ // when
+ util.entering(request, SERVICE_NAME);
+
+ // then
+ String[] keys = { ONAPLogConstants.MDCs.PARTNER_NAME,
+ ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ONAPLogConstants.MDCs.REQUEST_ID,
+ ONAPLogConstants.MDCs.INVOCATION_ID,
+ ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS,
+ ONAPLogConstants.MDCs.SERVER_FQDN,
+ ONAPLogConstants.MDCs.INSTANCE_UUID,
+ ONAPLogConstants.MDCs.SERVICE_NAME
+ };
+ Map<String, String> mdc = MDC.getMDCAdapter().getCopyOfContextMap();
+
+ assertTrue(checkMapKeys(mdc, keys));
+ assertEquals(userName,
+ mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ }
+
+ @Test
+ public void testExistingLoggingUtils() {
+ // given
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+
+ // when
+ util.exiting("200", SERVICE_NAME, Level.INFO, ONAPLogConstants.ResponseStatus.COMPLETED);
+
+ // then
+ Map<String, String> mdc = MDC.getMDCAdapter().getCopyOfContextMap();
+ assertNull(mdc);
+ }
+
+ @Test
+ public void testInvokeTestUtils() {
+ // given
+ final String targetEntity = "LoggingUtilsTest";
+ final String targetServiceName = "testInvokeTestUtils";
+ HttpsURLConnection secureConnection = Mockito.mock(HttpsURLConnection.class);
+
+ // when
+ secureConnection = util.invokeHttps(secureConnection, targetEntity, targetServiceName);
+
+ // then
+ assertNotNull(secureConnection);
+ String[] keys = {ONAPLogConstants.MDCs.TARGET_ENTITY,
+ ONAPLogConstants.MDCs.TARGET_SERVICE_NAME,
+ ONAPLogConstants.MDCs.INVOCATIONID_OUT,
+ ONAPLogConstants.MDCs.INVOKE_TIMESTAMP
+ };
+ Map<String, String> mdc = MDC.getMDCAdapter().getCopyOfContextMap();
+
+ assertTrue(checkMapKeys(mdc, keys));
+ assertEquals(targetEntity, mdc.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
+ assertEquals(targetServiceName, mdc.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME));
+ }
+
+ private boolean checkMapKeys(Map map, String[] keys) {
+ return Arrays.stream(keys).allMatch(key -> map.get(key) != null);
+ }
+}
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index d451b0670..773332ddd 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -223,7 +223,8 @@ public class CsarInstallerItCase {
@Test(expected = SdcArtifactInstallerException.class)
@Transactional
- public void shouldThrowSdcArtifactInstallerException() throws SdcArtifactInstallerException, SdcToscaParserException, IOException, InterruptedException, PolicyModelException {
+ public void shouldThrowSdcArtifactInstallerException() throws SdcArtifactInstallerException,
+ SdcToscaParserException, IOException, InterruptedException, PolicyModelException {
String generatedName = RandomStringUtils.randomAlphanumeric(5);
CsarHandler csarHandler = buildFakeCsarHandler(generatedName);
Mockito.when(csarHandler.getMapOfBlueprints()).thenThrow(IOException.class);
diff --git a/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
new file mode 100644
index 000000000..0a3c1e167
--- /dev/null
+++ b/src/test/java/org/onap/clamp/loop/DcaeComponentTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.loop;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+
+import java.io.IOException;
+import java.util.HashSet;
+
+import org.junit.Test;
+import org.onap.clamp.clds.model.dcae.DcaeOperationStatusResponse;
+import org.onap.clamp.loop.components.external.DcaeComponent;
+import org.onap.clamp.policy.microservice.MicroServicePolicy;
+
+public class DcaeComponentTest {
+
+ private Loop createTestLoop() {
+ String yaml = "imports:\n" + " - \"http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\"\n"
+ + "node_templates:\n" + " docker_service_host:\n" + " type: dcae.nodes.SelectedDockerHost";
+
+ Loop loopTest = new Loop("ControlLoopTest", yaml, "<xml></xml>");
+ loopTest.setGlobalPropertiesJson(
+ new Gson().fromJson("{\"dcaeDeployParameters\":" + "{\"policy_id\": \"name\"}}", JsonObject.class));
+ loopTest.setLastComputedState(LoopState.DESIGN);
+ loopTest.setDcaeDeploymentId("123456789");
+ loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
+ loopTest.setDcaeBlueprintId("UUID-blueprint");
+
+ MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", "",
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", true,
+ new Gson().fromJson("{\"configtype\":\"json\"}", JsonObject.class), new HashSet<>());
+ microServicePolicy.setProperties(new Gson().fromJson("{\"param1\":\"value1\"}", JsonObject.class));
+
+ loopTest.addMicroServicePolicy(microServicePolicy);
+ return loopTest;
+ }
+
+ @Test
+ public void convertDcaeResponseTest() throws IOException {
+ String dcaeFakeResponse = "{'requestId':'testId','operationType':'install','status':'state','error':'errorMessage', 'links':{'self':'selfUrl','uninstall':'uninstallUrl'}}";
+ DcaeOperationStatusResponse responseObject = DcaeComponent.convertDcaeResponse(dcaeFakeResponse);
+ assertThat(responseObject.getRequestId()).isEqualTo("testId");
+ assertThat(responseObject.getOperationType()).isEqualTo("install");
+ assertThat(responseObject.getStatus()).isEqualTo("state");
+ assertThat(responseObject.getError()).isEqualTo("errorMessage");
+ assertThat(responseObject.getLinks()).isNotNull();
+ assertThat(responseObject.getLinks().getSelf()).isEqualTo("selfUrl");
+ assertThat(responseObject.getLinks().getUninstall()).isEqualTo("uninstallUrl");
+
+ assertThat(responseObject.getLinks().getStatus()).isNull();
+ }
+
+ @Test
+ public void testGetDeployPayload() throws IOException {
+ Loop loop = this.createTestLoop();
+ String deploymentPayload = DcaeComponent.getDeployPayload(loop);
+ String expectedPayload = "{\"serviceTypeId\":\"UUID-blueprint\",\"inputs\":{\"policy_id\":\"name\"}}";
+ assertThat(deploymentPayload).isEqualTo(expectedPayload);
+ }
+
+ @Test
+ public void testGetUndeployPayload() throws IOException {
+ Loop loop = this.createTestLoop();
+ String unDeploymentPayload = DcaeComponent.getUndeployPayload(loop);
+ String expectedPayload = "{\"serviceTypeId\":\"UUID-blueprint\"}";
+ assertThat(unDeploymentPayload).isEqualTo(expectedPayload);
+ }
+
+}
diff --git a/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java
deleted file mode 100644
index a2c97e0c0..000000000
--- a/src/test/java/org/onap/clamp/loop/LoopOperationTestItCase.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2019 Nokia Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.clamp.loop;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-
-import java.io.IOException;
-import java.util.HashSet;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.json.simple.parser.ParseException;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.onap.clamp.clds.Application;
-import org.onap.clamp.loop.LoopOperation.TempLoopState;
-import org.onap.clamp.policy.microservice.MicroServicePolicy;
-import org.onap.clamp.policy.operational.OperationalPolicy;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = Application.class)
-public class LoopOperationTestItCase {
-
- private Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
- @Autowired
- LoopService loopService;
-
- private Loop createTestLoop() {
- String yaml = "imports:\n" + " - \"http://www.getcloudify.org/spec/cloudify/3.4/types.yaml\"\n"
- + "node_templates:\n" + " docker_service_host:\n" + " type: dcae.nodes.SelectedDockerHost";
-
- Loop loopTest = new Loop("ControlLoopTest", yaml, "<xml></xml>");
- loopTest.setGlobalPropertiesJson(
- new Gson().fromJson("{\"dcaeDeployParameters\":" + "{\"policy_id\": \"name\"}}", JsonObject.class));
- loopTest.setLastComputedState(LoopState.DESIGN);
- loopTest.setDcaeDeploymentId("123456789");
- loopTest.setDcaeDeploymentStatusUrl("http4://localhost:8085");
- loopTest.setDcaeBlueprintId("UUID-blueprint");
-
- MicroServicePolicy microServicePolicy = new MicroServicePolicy("configPolicyTest", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", true,
- gson.fromJson("{\"configtype\":\"json\"}", JsonObject.class), new HashSet<>());
- microServicePolicy.setProperties(new Gson().fromJson("{\"param1\":\"value1\"}", JsonObject.class));
-
- loopTest.addMicroServicePolicy(microServicePolicy);
- return loopTest;
- }
-
- @Test
- public void testAnalysePolicyResponse() {
- LoopOperation loopOp = new LoopOperation(loopService);
- String status1 = loopOp.analysePolicyResponse(200);
- String status2 = loopOp.analysePolicyResponse(404);
- String status3 = loopOp.analysePolicyResponse(500);
- String status4 = loopOp.analysePolicyResponse(503);
-
- // then
- assertThat(status1).isEqualTo("SUBMITTED");
- assertThat(status2).isEqualTo("NOT_SUBMITTED");
- assertThat(status3).isEqualTo("IN_ERROR");
- assertThat(status4).isEqualTo("IN_ERROR");
- }
-
- @Test
- public void testGetOperationalPolicyName() {
- LoopOperation loopOp = new LoopOperation(loopService);
- Loop loop = this.createTestLoop();
- String opName1 = loopOp.getOperationalPolicyName(loop);
- assertThat(opName1).isNull();
-
- OperationalPolicy opPolicy1 = new OperationalPolicy("OperationalPolicyTest1", null,
- gson.fromJson("{\"type\":\"Operational\"}", JsonObject.class));
- loop.addOperationalPolicy(opPolicy1);
- String opName2 = loopOp.getOperationalPolicyName(loop);
- assertThat(opName2).isEqualTo("OperationalPolicyTest1");
- }
-
- @Test
- public void testAnalyseDcaeResponse() throws ParseException {
- LoopOperation loopOp = new LoopOperation(loopService);
- String dcaeStatus1 = loopOp.analyseDcaeResponse(null, null);
- assertThat(dcaeStatus1).isEqualTo("NOT_DEPLOYED");
-
- String dcaeStatus2 = loopOp.analyseDcaeResponse(null, 500);
- assertThat(dcaeStatus2).isEqualTo("IN_ERROR");
-
- String dcaeStatus3 = loopOp.analyseDcaeResponse(null, 404);
- assertThat(dcaeStatus3).isEqualTo("NOT_DEPLOYED");
-
- Exchange camelExchange = Mockito.mock(Exchange.class);
- Message mockMessage = Mockito.mock(Message.class);
- Mockito.when(camelExchange.getIn()).thenReturn(mockMessage);
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"install\",\"status\":\"succeeded\"}");
- String dcaeStatus4 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus4).isEqualTo("DEPLOYED");
-
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"install\",\"status\":\"processing\"}");
- String dcaeStatus5 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus5).isEqualTo("PROCESSING");
-
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"install\",\"status\":\"failed\"}");
- String dcaeStatus6 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus6).isEqualTo("IN_ERROR");
-
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"succeeded\"}");
- String dcaeStatus7 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus7).isEqualTo("NOT_DEPLOYED");
-
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"processing\"}");
- String dcaeStatus8 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus8).isEqualTo("PROCESSING");
-
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"operationType\":\"uninstall\",\"status\":\"failed\"}");
- String dcaeStatus9 = loopOp.analyseDcaeResponse(camelExchange, 200);
- assertThat(dcaeStatus9).isEqualTo("IN_ERROR");
- }
-
- @Test
- public void testUpdateLoopStatus() {
- LoopOperation loopOp = new LoopOperation(loopService);
- Loop loop = this.createTestLoop();
- loopService.saveOrUpdateLoop(loop);
- LoopState newState1 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.DEPLOYED);
- LoopState dbState1 = loopService.getLoop(loop.getName()).getLastComputedState();
- assertThat(newState1).isEqualTo(LoopState.DEPLOYED);
- assertThat(dbState1).isEqualTo(LoopState.DEPLOYED);
-
- LoopState newState2 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.NOT_DEPLOYED);
- LoopState dbState2 = loopService.getLoop(loop.getName()).getLastComputedState();
- assertThat(newState2).isEqualTo(LoopState.SUBMITTED);
- assertThat(dbState2).isEqualTo(LoopState.SUBMITTED);
-
- LoopState newState3 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.PROCESSING);
- assertThat(newState3).isEqualTo(LoopState.WAITING);
-
- LoopState newState4 = loopOp.updateLoopStatus(loop, TempLoopState.SUBMITTED, TempLoopState.IN_ERROR);
- assertThat(newState4).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState5 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.DEPLOYED);
- assertThat(newState5).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState6 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.PROCESSING);
- assertThat(newState6).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState7 = loopOp.updateLoopStatus(loop, TempLoopState.NOT_SUBMITTED, TempLoopState.NOT_DEPLOYED);
- assertThat(newState7).isEqualTo(LoopState.DESIGN);
-
- LoopState newState8 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.DEPLOYED);
- assertThat(newState8).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState9 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.NOT_DEPLOYED);
- assertThat(newState9).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState10 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.PROCESSING);
- assertThat(newState10).isEqualTo(LoopState.IN_ERROR);
-
- LoopState newState11 = loopOp.updateLoopStatus(loop, TempLoopState.IN_ERROR, TempLoopState.IN_ERROR);
- assertThat(newState11).isEqualTo(LoopState.IN_ERROR);
- }
-
- @Test
- public void testUpdateLoopInfo() throws ParseException {
- Loop loop = this.createTestLoop();
- loopService.saveOrUpdateLoop(loop);
-
- Exchange camelExchange = Mockito.mock(Exchange.class);
- Message mockMessage = Mockito.mock(Message.class);
- Mockito.when(camelExchange.getIn()).thenReturn(mockMessage);
- Mockito.when(mockMessage.getBody(String.class))
- .thenReturn("{\"links\":{\"status\":\"http://testhost/dcae-operationstatus\",\"test2\":\"test2\"}}");
-
- LoopOperation loopOp = new LoopOperation(loopService);
- loopOp.updateLoopInfo(camelExchange, loop, "testNewId");
-
- Loop newLoop = loopService.getLoop(loop.getName());
- String newDeployId = newLoop.getDcaeDeploymentId();
- String newDeploymentStatusUrl = newLoop.getDcaeDeploymentStatusUrl();
-
- assertThat(newDeployId).isEqualTo("testNewId");
- assertThat(newDeploymentStatusUrl).isEqualTo("http4://testhost/dcae-operationstatus");
- }
-
- @Test
- public void testGetDeploymentId() {
- Loop loop = this.createTestLoop();
- LoopOperation loopOp = new LoopOperation(loopService);
- String deploymentId1 = loopOp.getDeploymentId(loop);
- assertThat(deploymentId1).isEqualTo("123456789");
-
- loop.setDcaeDeploymentId(null);
- String deploymentId2 = loopOp.getDeploymentId(loop);
- assertThat(deploymentId2).startsWith("CLAMP_");
-
- loop.setDcaeDeploymentId("");
- String deploymentId3 = loopOp.getDeploymentId(loop);
- assertThat(deploymentId3).startsWith("CLAMP_");
- assertThat(deploymentId3).isNotEqualTo(deploymentId2);
- }
-
- @Test
- public void testGetDeployPayload() throws IOException {
- Loop loop = this.createTestLoop();
- LoopOperation loopOp = new LoopOperation(loopService);
- String deploymentPayload = loopOp.getDeployPayload(loop);
-
- String expectedPayload = "{\"serviceTypeId\":\"UUID-blueprint\",\"inputs\":{\"policy_id\":\"name\"}}";
- assertThat(deploymentPayload).isEqualTo(expectedPayload);
- }
-} \ No newline at end of file
diff --git a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
index 1a3e3e3d3..78e0d2e3d 100644
--- a/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopRepositoriesItCase.java
@@ -94,7 +94,7 @@ public class LoopRepositoriesItCase {
}
private LoopLog getLoopLog(LogType type, String message, Loop loop) {
- return new LoopLog(message, type, loop);
+ return new LoopLog(message, type, "CLAMP", loop);
}
@Test
@@ -118,7 +118,7 @@ public class LoopRepositoriesItCase {
// Now set the ID in the previous model so that we can compare the objects
loopLog.setId(((LoopLog) loopInDb.getLoopLogs().toArray()[0]).getId());
- assertThat(loopInDb).isEqualToComparingFieldByField(loopTest);
+ assertThat(loopInDb).isEqualToIgnoringGivenFields(loopTest, "components");
assertThat(loopRepository.existsById(loopTest.getName())).isEqualTo(true);
assertThat(operationalPolicyService.isExisting(opPolicy.getName())).isEqualTo(true);
assertThat(microServicePolicyService.isExisting(microServicePolicy.getName())).isEqualTo(true);
@@ -126,7 +126,7 @@ public class LoopRepositoriesItCase {
// Now attempt to read from database
Loop loopInDbRetrieved = loopRepository.findById(loopTest.getName()).get();
- assertThat(loopInDbRetrieved).isEqualToComparingFieldByField(loopTest);
+ assertThat(loopInDbRetrieved).isEqualToIgnoringGivenFields(loopTest, "components");
assertThat((LoopLog) loopInDbRetrieved.getLoopLogs().toArray()[0]).isEqualToComparingFieldByField(loopLog);
assertThat((OperationalPolicy) loopInDbRetrieved.getOperationalPolicies().toArray()[0])
.isEqualToComparingFieldByField(opPolicy);
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index c4254ec8c..8add1a7be 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -296,7 +296,7 @@ public class LoopServiceTestItCase {
saveTestLoopToDb();
// Add log
Loop loop = loopsRepository.findById(EXAMPLE_LOOP_NAME).orElse(null);
- loop.addLog(new LoopLog("test", LogType.INFO, loop));
+ loop.addLog(new LoopLog("test", LogType.INFO, "CLAMP", loop));
loop = loopService.saveOrUpdateLoop(loop);
// Add op policy
OperationalPolicy operationalPolicy = new OperationalPolicy("opPolicy", null,
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 144d34aa1..c9350c610 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -38,6 +38,7 @@ import java.util.Random;
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.log.LogType;
import org.onap.clamp.loop.log.LoopLog;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
@@ -73,7 +74,7 @@ public class LoopToJsonTest {
}
private LoopLog getLoopLog(LogType type, String message, Loop loop) {
- LoopLog log = new LoopLog(message, type, loop);
+ LoopLog log = new LoopLog(message, type, "CLAMP", loop);
log.setId(Long.valueOf(new Random().nextInt()));
return log;
}
@@ -97,8 +98,12 @@ public class LoopToJsonTest {
System.out.println(jsonSerialized);
Loop loopTestDeserialized = JsonUtils.GSON_JPA_MODEL.fromJson(jsonSerialized, Loop.class);
assertNotNull(loopTestDeserialized);
- assertThat(loopTestDeserialized).isEqualToIgnoringGivenFields(loopTest, "svgRepresentation", "blueprint");
-
+ assertThat(loopTestDeserialized).isEqualToIgnoringGivenFields(loopTest, "svgRepresentation", "blueprint",
+ "components");
+ assertThat(loopTestDeserialized.getComponent("DCAE").getState())
+ .isEqualToComparingFieldByField(loopTest.getComponent("DCAE").getState());
+ assertThat(loopTestDeserialized.getComponent("POLICY").getState())
+ .isEqualToComparingFieldByField(loopTest.getComponent("POLICY").getState());
// svg and blueprint not exposed so wont be deserialized
assertThat(loopTestDeserialized.getBlueprint()).isEqualTo(null);
assertThat(loopTestDeserialized.getSvgRepresentation()).isEqualTo(null);
@@ -123,6 +128,6 @@ public class LoopToJsonTest {
loopTest.addMicroServicePolicy(microServicePolicy);
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json"),
- loopTest.createPoliciesPayloadPdpGroup(), false);
+ PolicyComponent.createPoliciesPayloadPdpGroup(loopTest), false);
}
}
diff --git a/src/test/javascript/propertyController.test.js b/src/test/javascript/propertyController.test.js
index fbbc6beca..e71999669 100644
--- a/src/test/javascript/propertyController.test.js
+++ b/src/test/javascript/propertyController.test.js
@@ -30,16 +30,4 @@ describe('Property controller tests', function() {
test('getMsUINotExist', () => {
expect(propertyController.getMsUI("test")).toEqual(null);
});
-
- test('getLastUpdatedStatus', () => {
- expect(propertyController.getLastUpdatedStatus()).toEqual('DESIGN');
- });
-
- test('getDeploymentID', () => {
- expect(propertyController.getDeploymentID()).toEqual('testId');
- });
-
- test('getDeploymentStatusURL', () => {
- expect(propertyController.getDeploymentStatusURL()).toEqual('testUrl');
- });
}); \ No newline at end of file
diff --git a/src/test/resources/http-cache/third_party_proxy.py b/src/test/resources/http-cache/third_party_proxy.py
index 0db977bb4..0381ab18f 100755
--- a/src/test/resources/http-cache/third_party_proxy.py
+++ b/src/test/resources/http-cache/third_party_proxy.py
@@ -127,10 +127,10 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
return True
- elif self.path.startswith("/dcae-operationstatus") and http_type == "GET":
+ elif self.path.startswith("/dcae-operationstatus/install") and http_type == "GET":
if not _file_available:
- print "self.path start with /dcae-operationstatus, generating response json..."
- jsonGenerated = "{\"operationType\": \"operationType1\", \"status\": \"succeeded\"}"
+ print "self.path start with /dcae-operationstatus/install, generating response json..."
+ jsonGenerated = "{\"operationType\": \"install\", \"status\": \"succeeded\"}"
print "jsonGenerated: " + jsonGenerated
try:
@@ -145,24 +145,29 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
return True
- elif self.path.startswith("/sdc/v1/catalog/services/") and http_type == "POST":
+ elif self.path.startswith("/dcae-operationstatus/uninstall") and http_type == "GET":
if not _file_available:
- print "self.path start with /sdc/v1/catalog/services/, generating response json..."
- jsondata = json.loads(self.data_string)
- jsonGenerated = "{\"artifactName\":\"" + jsondata['artifactName'] + "\",\"artifactType\":\"" + jsondata['artifactType'] + "\",\"artifactURL\":\"" + self.path + "\",\"artifactDescription\":\"" + jsondata['description'] + "\",\"artifactChecksum\":\"ZjJlMjVmMWE2M2M1OTM2MDZlODlmNTVmZmYzNjViYzM=\",\"artifactUUID\":\"" + str(uuid.uuid4()) + "\",\"artifactVersion\":\"1\"}"
+ print "self.path start with /dcae-operationstatus/uninstall, generating response json..."
+ jsonGenerated = "{\"operationType\": \"uninstall\", \"status\": \"succeeded\"}"
print "jsonGenerated: " + jsonGenerated
- os.makedirs(cached_file_folder, 0777)
+ try:
+ os.makedirs(cached_file_folder, 0777)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ print(cached_file_folder+" already exists")
+
with open(cached_file_header, 'w') as f:
f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
- return True;
- elif self.path.startswith("/dcae-deployments/") and (http_type == "PUT" or http_type == "DELETE"):
+ return True
+ elif self.path.startswith("/sdc/v1/catalog/services/") and http_type == "POST":
if not _file_available:
- print "self.path start with /dcae-deployments/, generating response json..."
- #jsondata = json.loads(self.data_string)
- jsonGenerated = "{\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus\",\"test2\":\"test2\"}}"
+ print "self.path start with /sdc/v1/catalog/services/, generating response json..."
+ jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"artifactName\":\"" + jsondata['artifactName'] + "\",\"artifactType\":\"" + jsondata['artifactType'] + "\",\"artifactURL\":\"" + self.path + "\",\"artifactDescription\":\"" + jsondata['description'] + "\",\"artifactChecksum\":\"ZjJlMjVmMWE2M2M1OTM2MDZlODlmNTVmZmYzNjViYzM=\",\"artifactUUID\":\"" + str(uuid.uuid4()) + "\",\"artifactVersion\":\"1\"}"
print "jsonGenerated: " + jsonGenerated
os.makedirs(cached_file_folder, 0777)
@@ -171,6 +176,30 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w') as f:
f.write(jsonGenerated)
return True
+ elif self.path.startswith("/dcae-deployments/") and http_type == "PUT":
+ print "self.path start with /dcae-deployments/ DEPLOY, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"operationType\":\"install\",\"status\":\"processing\",\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus/install\"}}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(jsonGenerated)
+ return True
+ elif self.path.startswith("/dcae-deployments/") and http_type == "DELETE":
+ print "self.path start with /dcae-deployments/ UNDEPLOY, generating response json..."
+ #jsondata = json.loads(self.data_string)
+ jsonGenerated = "{\"operationType\":\"uninstall\",\"status\":\"processing\",\"links\":{\"status\":\"http:\/\/" + PROXY_ADDRESS + "\/dcae-operationstatus/uninstall\"}}"
+ print "jsonGenerated: " + jsonGenerated
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len(jsonGenerated)) + "\", \"Content-Type\": \"application/json\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(jsonGenerated)
+ return True
elif (self.path.startswith("/pdp/api/") and (http_type == "PUT" or http_type == "DELETE")) or (self.path.startswith("/pdp/api/policyEngineImport") and http_type == "POST"):
print "self.path start with /pdp/api/, copying body to response ..."
if not os.path.exists(cached_file_folder):
@@ -180,7 +209,7 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
- elif self.path.startswith("/policy/api/v1/policyTypes/") and http_type == "POST":
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "POST":
print "self.path start with POST new policy API /pdp/api/, copying body to response ..."
if not os.path.exists(cached_file_folder):
os.makedirs(cached_file_folder, 0777)
@@ -189,8 +218,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
- elif self.path.startswith("/policy/api/v1/policyTypes/") and http_type == "DELETE":
- print "self.path start with DELETE new policy API /policy/api/v1/policyTypes/ ..."
+ elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "DELETE":
+ print "self.path start with DELETE new policy API /policy/api/v1/policytypes/ ..."
if not os.path.exists(cached_file_folder):
os.makedirs(cached_file_folder, 0777)
@@ -199,6 +228,15 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(cached_file_content, 'w+') as f:
f.write(self.data_string)
return True
+ elif self.path.startswith("/policy/pap/v1/pdps/policies") and http_type == "POST":
+ print "self.path start with POST new policy API /policy/pap/v1/pdps/ ..."
+ if not os.path.exists(cached_file_folder):
+ os.makedirs(cached_file_folder, 0777)
+ with open(cached_file_header, 'w+') as f:
+ f.write("{\"Content-Length\": \"" + str(len("")) + "\", \"Content-Type\": \""+str("")+"\"}")
+ with open(cached_file_content, 'w+') as f:
+ f.write(self.data_string)
+ return True
elif self.path.startswith("/policy/api/v1/policytypes/") and http_type == "GET":
print "self.path start with /policy/api/v1/policytypes/, generating response json..."
jsonGenerated = "{\"policyTypeId\": \"onap.policies.controlloop.operational\",\"policyTypeVersion\": \"1.0.0\",\"policyId\": \"OPERATIONAL_z711F_v1_0_ResourceInstanceName1_tca\"}"
@@ -241,7 +279,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
if not HOST:
self.send_response(404)
- return "404 Not found"
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
url = '%s%s' % (HOST, self.path)
response = requests.get(url, auth=AUTH, headers=HEADERS, stream=True)
@@ -254,6 +294,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
print('Status code : %s' % (response.status_code,))
print('Content : %s' % (response.content,))
self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
return response.content
else:
print("Request for data currently present in cache: %s" % (cached_file_folder,))
@@ -292,7 +334,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
if not HOST:
self.send_response(404)
- return "404 Not found"
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
print("Request for data currently not present in cache: %s" % (cached_file_folder,))
@@ -308,6 +352,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
print('Status code : %s' % (response.status_code,))
print('Content : %s' % (response.content,))
self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
return response.content
else:
print("Request for data present in cache: %s" % (cached_file_folder,))
@@ -339,7 +385,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
if not _file_available:
if not HOST:
self.send_response(404)
- return "404 Not found"
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
print("Request for data currently not present in cache: %s" % (cached_file_folder,))
@@ -355,6 +403,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
print('Status code : %s' % (response.status_code,))
print('Content : %s' % (response.content,))
self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
return response.content
else:
print("Request for data present in cache: %s" % (cached_file_folder,))
@@ -389,7 +439,9 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
if not _file_available:
if not HOST:
self.send_response(404)
- return "404 Not found"
+ self.end_headers()
+ self.wfile.write('404 Not found, no remote HOST specified on the emulator !!!')
+ return "404 Not found, no remote HOST specified on the emulator !!!"
print("Request for data currently not present in cache: %s" % (cached_file_folder,))
@@ -405,6 +457,8 @@ class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
print('Status code : %s' % (response.status_code,))
print('Content : %s' % (response.content,))
self.send_response(response.status_code)
+ self.end_headers()
+ self.wfile.write('404 Not found, nothing found on the remote server !!!')
return response.content
else:
print("Request for data present in cache: %s" % (cached_file_folder,))
diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties
index 7614e1770..0be9e298a 100644
--- a/src/test/resources/https/https-test.properties
+++ b/src/test/resources/https/https-test.properties
@@ -30,6 +30,7 @@ server.port=${clamp.it.tests.https}
server.ssl.key-store=classpath:https/keystore-test.jks
server.ssl.key-store-password=testpass
server.ssl.key-password=testpass
+server.ssl.key-store-type=JKS
### In order to be user friendly when HTTPS is enabled,
### you can add another HTTP port that will be automatically redirected to HTTPS
diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
new file mode 100644
index 000000000..07e587855
--- /dev/null
+++ b/src/test/resources/logback.xml
@@ -0,0 +1,2 @@
+<!-- Empty Configuration to prevent creating log files by Units Tests (e.g LoggingUtilsTest) ! -->
+<configuration />