aboutsummaryrefslogtreecommitdiffstats
path: root/cloudify-client/src/test/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'cloudify-client/src/test/java/org/openecomp')
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/BeanMultiTest.java63
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTest.java103
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTokenProviderTest.java56
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/connector/http/HttpClientConnectorTest.java251
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java147
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java148
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/ExecutionsResourceTest.java170
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java98
8 files changed, 0 insertions, 1036 deletions
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/BeanMultiTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/BeanMultiTest.java
deleted file mode 100644
index 5eaa27f11f..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/BeanMultiTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 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.openecomp.mso.cloudify;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.openpojo.reflection.PojoClass;
-import com.openpojo.reflection.PojoClassFilter;
-import com.openpojo.reflection.filters.FilterEnum;
-import com.openpojo.reflection.impl.PojoClassFactory;
-import com.openpojo.validation.Validator;
-import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.GetterMustExistRule;
-import com.openpojo.validation.rule.impl.SetterMustExistRule;
-import com.openpojo.validation.test.impl.GetterTester;
-import com.openpojo.validation.test.impl.SetterTester;
-
-public class BeanMultiTest {
-
- Validator validator;
- PojoClassFilter enumFilter;
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- @Before
- public void setup(){
- enumFilter = new FilterEnum();
- validator = ValidatorBuilder.create()
- .with(new SetterMustExistRule(),
- new GetterMustExistRule())
- .with(new SetterTester(),
- new GetterTester())
- .build();
- }
- @Test
- public void validateBeansMsoApihandlerBeans() {
- validator.validate("org.openecomp.mso.cloudify.v3.model",enumFilter);
- }
-
- private static class FilterTestClasses implements PojoClassFilter {
- public boolean include(PojoClass pojoClass) {
- return !pojoClass.getSourcePath().contains("/src/test/java");
- }
- }
-} \ No newline at end of file
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTest.java
deleted file mode 100644
index 1836bc5d6e..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.base.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openecomp.mso.cloudify.v3.model.Execution;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class CloudifyClientTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void clientCreate(){
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- CloudifyClient cc = new CloudifyClient("http://localhost:"+port);
- cc.setToken("token");
- CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
- Execution x = crx.execute();
- assertEquals("123", x.getId());
- }
-
- @Test
- public void clientCreateWithBadConnector(){
- thrown.expect(CloudifyResponseException.class);
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- CloudifyClientConnector ccc = new CloudifyClientConnector(){
- @Override
- public <T> CloudifyResponse request(CloudifyRequest<T> request) {
- throw new CloudifyResponseException("test case", 401);
- }};
- CloudifyClient cc = new CloudifyClient("http://localhost:"+port, ccc);
-// cc.setToken("token");
- CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
- Execution x = crx.execute();
- }
-
- @Test
- public void clientCreateWithBadConnectorAndToken(){
- thrown.expect(CloudifyResponseException.class);
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- CloudifyClientConnector ccc = new CloudifyClientConnector(){
- @Override
- public <T> CloudifyResponse request(CloudifyRequest<T> request) {
- throw new CloudifyResponseException("test case", 401);
- }};
- CloudifyClient cc = new CloudifyClient("http://localhost:"+port, ccc);
- cc.setToken("token");
- CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
- Execution x = crx.execute();
- }
-
- @Test
- public void clientCreateWithTenant(){
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("{\"id\": \"123\"}").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- CloudifyClient cc = new CloudifyClient("http://localhost:"+port, "other_tenant");
- cc.setToken("token");
- cc.property("property", "value");
- CloudifyRequest<Execution> crx = cc.get("/testUrl", Execution.class);
- Execution x = crx.execute();
- assertEquals("123", x.getId());
- }
-
-}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTokenProviderTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTokenProviderTest.java
deleted file mode 100644
index c28b6b91aa..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/base/client/CloudifyClientTokenProviderTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.base.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class CloudifyClientTokenProviderTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void createTokenProvider() {
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("{\"role\": \"user\", \"value\": \"tokenVal\"}").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
-
- CloudifyClientTokenProvider cctp = new CloudifyClientTokenProvider("http://localhost:"+port+"/testUrl", "user", "pswd");
- String token = cctp.getToken();
- assertEquals("tokenVal", token);
- token = cctp.getToken();
- assertEquals("tokenVal", token);
- cctp.expireToken();
- }
-}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/connector/http/HttpClientConnectorTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/connector/http/HttpClientConnectorTest.java
deleted file mode 100644
index 72d2de6e9d..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/connector/http/HttpClientConnectorTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 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.openecomp.mso.cloudify.connector.http;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-
-import com.github.tomakehurst.wiremock.http.Fault;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.verify;
-import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.deleteRequestedFor;
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.assertEquals;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
-import org.openecomp.mso.cloudify.base.client.CloudifyConnectException;
-import org.openecomp.mso.cloudify.base.client.CloudifyRequest;
-import org.openecomp.mso.cloudify.base.client.CloudifyResponseException;
-import org.openecomp.mso.cloudify.base.client.Entity;
-import org.openecomp.mso.cloudify.base.client.HttpMethod;
-import org.openecomp.mso.cloudify.v3.model.Deployment;
-
-public class HttpClientConnectorTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void sunnyDay_POST(){
- wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- Deployment deployment = new Deployment();
- deployment.setId("id");
- request.entity(deployment, "application/json");
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.header("Content-Type","application/json");
- request.method(HttpMethod.POST);
- conector.request(request);
- verify(postRequestedFor(urlEqualTo("/testUrl")));
- }
-
-
- @Test
- public void sunnyDay_GET(){
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.GET);
- conector.request(request);
- verify(getRequestedFor(urlEqualTo("/testUrl")));
- }
-
- @Test
- public void sunnyDay_PUT(){
- wireMockRule.stubFor(put(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.PUT);
- conector.request(request);
- verify(putRequestedFor(urlEqualTo("/testUrl")));
- }
-
-
- @Test
- public void sunnyDay_DELETE(){
- wireMockRule.stubFor(delete(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.DELETE);
- conector.request(request);
- verify(deleteRequestedFor(urlEqualTo("/testUrl")));
- }
-
-
- @Test
- public void rainyDay_PATCH(){
- thrown.expect(HttpClientException.class);
- thrown.expectMessage("Unrecognized HTTP Method: PATCH");
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:123123/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.PATCH);
- conector.request(request);
-
- }
-
- @Test
- public void rainyDayRunTimeException(){
- wireMockRule.stubFor(post(urlEqualTo("/503")).willReturn(
- aResponse().withStatus(503).withHeader("Content-Type", "text/plain").withBody("failure")));
- thrown.expect(RuntimeException.class);
- thrown.expectMessage("Unexpected client exception");
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:123123/503");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.POST);
- conector.request(request);
-
- }
-
- @Test
- public void rainyDayBadUri() {
- wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- thrown.expect(HttpClientException.class);
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- Deployment deployment = new Deployment();
- deployment.setId("id");
- request.entity(deployment, "application/json");
- request.endpoint("(@#$@(#*$&asfasdf");
- request.setBasicAuthentication("USER","PASSWORD");
- request.header("Content-Type","application/json");
- request.method(HttpMethod.POST);
- conector.request(request);
- }
-
- @Test
- public void sunnyDayWithJsonEntity_POST(){
- wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
-
- Deployment deployment = new Deployment();
- deployment.setId("id");
-
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>(null, HttpMethod.POST, "/", Entity.json(deployment), null);
-
- request.endpoint("http://localhost:"+port);
- request.path("testUrl");
- request.header("Content-Type","application/json");
- request.header("Content-Type", null);
-
- request.returnType(Deployment.class);
- assertEquals(Deployment.class, request.returnType());
-
- Entity<Deployment> t = request.json(deployment);
- assertEquals(t.getEntity().getId(), "id");
-
- request.queryParam("test", "one").queryParam("test", "two");
-
- conector.request(request);
-
- verify(postRequestedFor(urlEqualTo("/testUrl?test=two")));
- }
-
- @Test
- public void sunnyDayWithStreamEntity_POST() {
- wireMockRule.stubFor(post(urlPathEqualTo("/testUrl")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody("TEST").withStatus(HttpStatus.SC_OK)));
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
-
- InputStream is = new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8));
-
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>(null, HttpMethod.POST, "/testUrl", Entity.stream(is), null);
-
- request.endpoint("http://localhost:"+port);
- request.setBasicAuthentication("USER","PASSWORD");
- request.header("Content-Type","application/json");
-
- conector.request(request);
- verify(postRequestedFor(urlEqualTo("/testUrl")));
- }
-
- @Test
- public void rainyDayGarbageData(){
- wireMockRule.stubFor(get(urlPathEqualTo("/testUrl")).willReturn(
- aResponse().withFault(Fault.RANDOM_DATA_THEN_CLOSE)));
- thrown.expect(CloudifyConnectException.class);
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.GET);
- conector.request(request);
- }
-
- @Test
- public void rainyDayEmptyResponse(){
- thrown.expect(HttpClientException.class);
- int port = wireMockRule.port();
- HttpClientConnector conector = new HttpClientConnector();
- CloudifyRequest<Deployment> request = new CloudifyRequest<Deployment>();
- request.endpoint("http://localhost:"+port+"/testUrl");
- request.setBasicAuthentication("USER","PASSWORD");
- request.method(HttpMethod.GET);
- conector.request(request); // gets down to "Get here on an error response (4XX-5XX)", then tries to throw a CloudifyResponseException, which calls getEntity, which tries to parse an HTML error page as a JSON, which causes the HttpClientException.
- }
-
-
-} \ No newline at end of file
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
deleted file mode 100644
index 5e443a5c69..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.v3.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.DeleteBlueprint;
-import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.GetBlueprint;
-import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.ListBlueprints;
-import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.UploadBlueprint;
-import org.openecomp.mso.cloudify.v3.model.Blueprint;
-import org.openecomp.mso.cloudify.v3.model.Blueprints;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class BlueprintsResourceTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void cloudifyClientBlueprintFromStream() {
- wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"id\": \"123\"}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- InputStream is = new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8));
- UploadBlueprint ub = br.uploadFromStream("123", "blueprint.json", is);
- Blueprint b = ub.execute();
- assertEquals("123", b.getId());
- }
-
- @Test
- public void cloudifyClientBlueprintFromUrl() {
- wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"id\": \"123\"}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- UploadBlueprint ub = br.uploadFromUrl("123", "blueprint.json", "http://localhost:"+port+"/blueprint");
- Blueprint b = ub.execute();
- assertEquals("123", b.getId());
- }
-
- @Test
- public void cloudifyClientBlueprintDelete() {
- wireMockRule.stubFor(delete(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"id\": \"123\"}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- DeleteBlueprint db = br.deleteById("123");
- Blueprint b = db.execute();
- assertEquals("123", b.getId());
- }
-
- @Test
- public void cloudifyClientBlueprintList() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"items\": [{\"id\": \"123\"}]}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- ListBlueprints lb = br.list();
- Blueprints b = lb.execute();
- assertEquals("123", b.getItems().get(0).getId());
- }
-
- @Test
- public void cloudifyClientBlueprintGetById() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"id\": \"123\"}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- GetBlueprint gb = br.getById("123");
- Blueprint b = gb.execute();
- assertEquals("123", b.getId());
- }
-
- @Test
- public void cloudifyClientBlueprintGetMetadataById() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"id\": \"123\"}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- BlueprintsResource br = c.blueprints();
- GetBlueprint gb = br.getMetadataById("123");
- Blueprint b = gb.execute();
- assertEquals("123", b.getId());
- }
-
-
-}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java
deleted file mode 100644
index f4741b9b08..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.v3.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.CreateDeployment;
-import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.DeleteDeployment;
-import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeployment;
-import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeploymentOutputs;
-import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.ListDeployments;
-import org.openecomp.mso.cloudify.v3.model.CreateDeploymentParams;
-import org.openecomp.mso.cloudify.v3.model.Deployment;
-import org.openecomp.mso.cloudify.v3.model.Deployments;
-import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class DeploymentsResourceTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void cloudifyDeploymentsCreate() {
- wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- DeploymentsResource br = c.deployments();
-
- CreateDeploymentParams cdp = new CreateDeploymentParams();
- cdp.setBlueprintId("123");
- Map<String, Object> inputs = new HashMap<String, Object>();
- cdp.setInputs(inputs);
- CreateDeployment cd = br.create("123", cdp);
- Deployment d = cd.execute();
- assertEquals("123", d.getId());
- }
-
- @Test
- public void cloudifyDeploymentsList() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"items\": {\"id\": \"123\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- DeploymentsResource br = c.deployments();
- ListDeployments ld = br.list();
- Deployments d = ld.execute();
- assertEquals("123", d.getItems().get(0).getId());
- }
-
- @Test
- public void cloudifyDeploymentsGet() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- DeploymentsResource br = c.deployments();
- GetDeployment gd = br.byId("123");
- Deployment d = gd.execute();
- assertEquals("123", d.getId());
- }
-
- @Test
- public void cloudifyDeploymentsGetOutputs() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"deployment_id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- DeploymentsResource br = c.deployments();
- GetDeploymentOutputs gdo = br.outputsById("123");
- DeploymentOutputs d = gdo.execute();
- assertEquals("123", d.getDeploymentId());
-
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("test", "answer");
- assertEquals("answer", d.getMapValue(map, "test", String.class));
-
- Integer i = d.getMapValue(map, "nil", Integer.class);
- assertNull( i );
-
- i = d.getMapValue(map, "test", Integer.class);
- assertNull( i );
- }
-
- @Test
- public void cloudifyDeploymentsDelete() {
- wireMockRule.stubFor(delete(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- DeploymentsResource br = c.deployments();
- DeleteDeployment cd = br.deleteByName("name");
- Deployment d = cd.execute();
- assertEquals("123", d.getId());
- }
-
-}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/ExecutionsResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/ExecutionsResourceTest.java
deleted file mode 100644
index 93f5473159..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/ExecutionsResourceTest.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.v3.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openecomp.mso.cloudify.connector.http.HttpClientException;
-import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.CancelExecution;
-import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.GetExecution;
-import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.ListExecutions;
-import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.StartExecution;
-import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.UpdateExecution;
-import org.openecomp.mso.cloudify.v3.model.CancelExecutionParams;
-import org.openecomp.mso.cloudify.v3.model.Execution;
-import org.openecomp.mso.cloudify.v3.model.Executions;
-import org.openecomp.mso.cloudify.v3.model.StartExecutionParams;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class ExecutionsResourceTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void cloudifyClientExecutions() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"items\": [{ \"id\": \"345\" }, { \"id\": \"123\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
- ListExecutions lx = xr.list();
- Executions x = lx.execute();
- assertEquals("123", x.getItems().get(1).getId());
- }
-
- @Test
- public void cloudifyClientExecutionsSorted() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"items\": [{ \"id\": \"123\" }, { \"id\": \"345\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
- ListExecutions lx = xr.listSorted("id");
- Executions x = lx.execute();
- assertEquals("345", x.getItems().get(1).getId());
- }
-
- @Test
- public void cloudifyClientExecutionsFilter() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{\"items\": [{ \"id\": \"121\" }, { \"id\": \"123\" }], \"metadata\": {\"pagination\": {\"total\": 100, \"offset\": 0, \"size\": 25}}}")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
- ListExecutions lx = xr.listFiltered("a=b", "id");
- Executions x = lx.execute();
- assertEquals("123", x.getItems().get(1).getId());
- }
-
- @Test
- public void cloudifyClientExecutionById() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
- GetExecution gx = xr.byId("123");
- Execution x = gx.execute();
- assertEquals("123", x.getId());
- }
-
- @Test
- public void cloudifyClientStartExecution() {
- wireMockRule.stubFor(post(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
-
- StartExecutionParams params = new StartExecutionParams();
- StartExecution sx = xr.start(params);
- Execution x = sx.execute();
- assertEquals("123", x.getId());
- }
-
- @Test
- public void cloudifyClientUpdateExecution() {
- thrown.expect(HttpClientException.class);
- thrown.expectMessage("Unrecognized HTTP Method: PATCH");
-
- wireMockRule.stubFor(patch(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
-
- UpdateExecution ux = xr.updateStatus("123", "good");
- Execution x = ux.execute();
- assertEquals("123", x.getId());
- }
-
- @Test
- public void cloudifyClientCancelExecution() {
- wireMockRule.stubFor(post(urlPathEqualTo("/api/v3/executions")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"id\": \"123\" }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- ExecutionsResource xr = c.executions();
-
- CancelExecutionParams params = new CancelExecutionParams();
- CancelExecution cx = xr.cancel("123", params);
- Execution x = cx.execute();
- assertEquals("123", x.getId());
- }
-
-
-
-}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java
deleted file mode 100644
index 66616e9c8a..0000000000
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.openecomp.mso.cloudify.v3.client;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.patch;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.openecomp.mso.cloudify.connector.http.HttpClientException;
-import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.GetNodeInstance;
-import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.ListNodeInstances;
-import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.UpdateNodeInstance;
-import org.openecomp.mso.cloudify.v3.model.NodeInstance;
-import org.openecomp.mso.cloudify.v3.model.NodeInstances;
-import org.openecomp.mso.cloudify.v3.model.UpdateNodeInstanceParams;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-public class NodeInstancesResourceTest {
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void nodeInstanceGet() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/node-instances/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"node_instance\": { \"id\": \"123\" } }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- NodeInstancesResource nir = c.nodeInstances();
- GetNodeInstance gni = nir.byId("123");
- NodeInstance ni = gni.execute();
- assertEquals("123", ni.getId());
- }
-
- @Test
- public void nodeInstanceList() {
- wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/node-instances")).willReturn(aResponse().withHeader("Content-Type", "application/json")
-// .withBody(" { \"items\": [ { \"node_instance\": { \"id\": \"123\" } } ] } ")
- .withBody(" { \"items\": [ { \"id\": \"123\" } ] } ")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- NodeInstancesResource nir = c.nodeInstances();
- ListNodeInstances lni = nir.list();
- NodeInstances ni = lni.execute();
- assertEquals("123", ni.getItems().get(0).getId());
- }
-
- @Test
- public void nodeInstanceUpdate() {
- wireMockRule.stubFor(patch(urlPathEqualTo("/api/v3/node-instances/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody("{ \"node_instance\": { \"id\": \"123\" } }")
- .withStatus(HttpStatus.SC_OK)));
-
- int port = wireMockRule.port();
-
- Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
- NodeInstancesResource nir = c.nodeInstances();
- UpdateNodeInstanceParams params = new UpdateNodeInstanceParams();
-
- UpdateNodeInstance uni = nir.update("123", params);
- thrown.expect(HttpClientException.class); /// ???????
- NodeInstance ni = uni.execute();
- }
-}