diff options
author | xg353y <xg353y@intl.att.com> | 2019-03-22 15:43:15 +0100 |
---|---|---|
committer | xg353y <xg353y@intl.att.com> | 2019-03-25 10:12:36 +0100 |
commit | bb393ee2f520254b6fa47d282108790eeda95725 (patch) | |
tree | 9ac54202eae5938e056fa5fe199408e2de2f63d8 /src/test | |
parent | 937c480aac2d675e70c94908febddb42aefc8dcc (diff) |
Rework deploy/undeploy UI
Rework the deploy/undeploy Ui based on the new data model.
Issue-ID: CLAMP-334
Change-Id: I03d591bea81cb050e12031782dfa383656f1a32c
Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java | 27 | ||||
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java (renamed from src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java) | 26 | ||||
-rw-r--r-- | src/test/javascript/propertyController.test.js | 4 |
3 files changed, 29 insertions, 28 deletions
diff --git a/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java b/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java index 1b01f544b..caab61f18 100644 --- a/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java +++ b/src/test/java/org/onap/clamp/clds/client/DcaeDispatcherServicesTest.java @@ -36,6 +36,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.onap.clamp.clds.config.ClampProperties; +import org.onap.clamp.util.HttpConnectionManager; @@ -55,7 +56,7 @@ public class DcaeDispatcherServicesTest { private ClampProperties clampProperties; @Mock - DcaeHttpConnectionManager dcaeHttpConnectionManager; + HttpConnectionManager httpConnectionManager; @InjectMocks DcaeDispatcherServices dcaeDispatcherServices; @@ -84,7 +85,7 @@ public class DcaeDispatcherServicesTest { @Test public void shouldReturnDcaeOperationSataus() throws IOException { //given - Mockito.when(dcaeHttpConnectionManager.doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null)) + Mockito.when(httpConnectionManager.doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE")) .thenReturn(STATUS_RESPONSE_PROCESSING); //when String operationStatus = dcaeDispatcherServices.getOperationStatus(DEPLOYMENT_STATUS_URL); @@ -96,24 +97,24 @@ public class DcaeDispatcherServicesTest { @Test public void shouldTryMultipleTimesWhenProcessing() throws IOException, InterruptedException { //given - Mockito.when(dcaeHttpConnectionManager.doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", - null, null)) + Mockito.when(httpConnectionManager.doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", + null, null, "DCAE")) .thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_ACTIVE); //when String operationStatus = dcaeDispatcherServices.getOperationStatusWithRetry(DEPLOYMENT_STATUS_URL); //then Assertions.assertThat(operationStatus).isEqualTo("succeeded"); - Mockito.verify(dcaeHttpConnectionManager, Mockito.times(3)) - .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null); + Mockito.verify(httpConnectionManager, Mockito.times(3)) + .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE"); } @Test public void shouldTryOnlyAsManyTimesAsConfigured() throws IOException, InterruptedException { //given - Mockito.when(dcaeHttpConnectionManager - .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null)) + Mockito.when(httpConnectionManager + .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE")) .thenReturn(STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING, STATUS_RESPONSE_PROCESSING); //when @@ -121,8 +122,8 @@ public class DcaeDispatcherServicesTest { //then Assertions.assertThat(operationStatus).isEqualTo("processing"); - Mockito.verify(dcaeHttpConnectionManager, Mockito.times(3)) - .doDcaeHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null); + Mockito.verify(httpConnectionManager, Mockito.times(3)) + .doGeneralHttpQuery(DEPLOYMENT_STATUS_URL, "GET", null, null, "DCAE"); } @@ -134,12 +135,12 @@ public class DcaeDispatcherServicesTest { Mockito.when(clampProperties.getJsonTemplate("dcae.deployment.template")) .thenReturn(new JsonObject()); - Mockito.when(dcaeHttpConnectionManager - .doDcaeHttpQuery(DCAE_URL + Mockito.when(httpConnectionManager + .doGeneralHttpQuery(DCAE_URL + "/dcae-deployments/closedLoop_152367c8-b172-47b3-9e58-c53add75d869_deploymentId", "PUT", "{\"serviceTypeId\":\"e2ba40f7-bf42-41e7-acd7-48fd07586d90\",\"inputs\":{}}", - "application/json")) + "application/json", "DCAE")) .thenReturn(DEPLOY_RESPONSE_STRING); JsonObject blueprintInputJson = new JsonObject(); diff --git a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java b/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java index 8e03153a2..42e9c7f63 100644 --- a/src/test/java/org/onap/clamp/clds/it/DcaeHttpConnectionManagerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/HttpConnectionManagerItCase.java @@ -45,7 +45,7 @@ import javax.ws.rs.BadRequestException; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.clamp.clds.client.DcaeHttpConnectionManager; +import org.onap.clamp.util.HttpConnectionManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; @@ -59,7 +59,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.DEFINED_PORT) @TestPropertySource(locations = "classpath:https/https-test.properties") -public class DcaeHttpConnectionManagerItCase { +public class HttpConnectionManagerItCase { @Value("${server.port}") private String httpsPort; @@ -67,7 +67,7 @@ public class DcaeHttpConnectionManagerItCase { private String httpPort; @Autowired - DcaeHttpConnectionManager dcaeHttpConnectionManager; + HttpConnectionManager httpConnectionManager; private static TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @@ -109,8 +109,8 @@ public class DcaeHttpConnectionManagerItCase { @Test public void testHttpGet() throws Exception { - String response = dcaeHttpConnectionManager - .doDcaeHttpQuery("http://localhost:" + this.httpPort + "/designer/index.html", "GET", null, null); + String response = httpConnectionManager + .doGeneralHttpQuery("http://localhost:" + this.httpPort + "/designer/index.html", "GET", null, null, "DCAE"); assertNotNull(response); // Should be a redirection so 302, so empty assertTrue(response.isEmpty()); @@ -118,8 +118,8 @@ public class DcaeHttpConnectionManagerItCase { @Test public void testHttpsGet() throws Exception { - String response = dcaeHttpConnectionManager - .doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null); + String response = httpConnectionManager + .doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index.html", "GET", null, null, "DCAE"); assertNotNull(response); // Should contain something assertTrue(!response.isEmpty()); @@ -127,22 +127,22 @@ public class DcaeHttpConnectionManagerItCase { @Test(expected = BadRequestException.class) public void testHttpsGet404() throws IOException { - dcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", - "GET", null, null); + httpConnectionManager.doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", + "GET", null, null, "DCAE"); fail("Should have raised an BadRequestException"); } @Test(expected = BadRequestException.class) public void testHttpsPost404() throws IOException { - dcaeHttpConnectionManager.doDcaeHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", - "POST", "", "application/json"); + httpConnectionManager.doGeneralHttpQuery("https://localhost:" + this.httpsPort + "/designer/index1.html", + "POST", "", "application/json", "DCAE"); fail("Should have raised an BadRequestException"); } @Test(expected = BadRequestException.class) public void testHttpException() throws IOException { - dcaeHttpConnectionManager.doDcaeHttpQuery("http://localhost:" + this.httpsPort + "/designer/index.html", "GET", - null, null); + httpConnectionManager.doGeneralHttpQuery("http://localhost:" + this.httpsPort + "/designer/index.html", "GET", + null, null, "DCAE"); fail("Should have raised an BadRequestException"); } } diff --git a/src/test/javascript/propertyController.test.js b/src/test/javascript/propertyController.test.js index 6cb779145..fbbc6beca 100644 --- a/src/test/javascript/propertyController.test.js +++ b/src/test/javascript/propertyController.test.js @@ -31,8 +31,8 @@ describe('Property controller tests', function() { expect(propertyController.getMsUI("test")).toEqual(null); }); - test('getStatus', () => { - expect(propertyController.getStatus()).toEqual('DESIGN'); + test('getLastUpdatedStatus', () => { + expect(propertyController.getLastUpdatedStatus()).toEqual('DESIGN'); }); test('getDeploymentID', () => { |