You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/04/01 16:19:42 UTC
[camel-quarkus] 02/02: rebase master and delete test conditions
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 67a6da574f862d4868bccd775ff5b1923fbdcfe2
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Mon Mar 29 20:40:55 2021 +0200
rebase master and delete test conditions
---
.../pages/reference/extensions/digitalocean.adoc | 4 +-
.../reference/components/digitalocean.adoc | 2 +-
.../deployment/DigitaloceanProcessor.java | 1 -
extensions/digitalocean/runtime/pom.xml | 2 +-
.../WireMockTestResourceLifecycleManager.java | 12 +-
integration-tests/digitalocean/pom.xml | 2 +-
.../digitalocean/it/DigitaloceanResource.java | 43 ++-----
.../digitalocean/it/DigitaloceanRoute.java | 9 +-
.../digitalocean/it/DigitaloceanTest.java | 134 +++++++++------------
.../digitalocean/it/DigitaloceanTestResource.java | 7 ++
.../test/resources/mappings/actionsDroplet.json | 2 +-
.../test/resources/mappings/backupsDroplet.json | 2 +-
...ateMultipleDroplets.json => createDroplet.json} | 4 +-
.../src/test/resources/mappings/deleteDroplet.json | 2 +-
.../src/test/resources/mappings/dropletAction.json | 2 +-
.../src/test/resources/mappings/getDroplet.json | 2 +-
.../test/resources/mappings/kernelsDroplet.json | 28 -----
.../test/resources/mappings/neighborsDroplet.json | 2 +-
.../test/resources/mappings/snapshotsDroplet.json | 2 +-
19 files changed, 98 insertions(+), 164 deletions(-)
diff --git a/docs/modules/ROOT/pages/reference/extensions/digitalocean.adoc b/docs/modules/ROOT/pages/reference/extensions/digitalocean.adoc
index 60aa2ba..5c85f31 100644
--- a/docs/modules/ROOT/pages/reference/extensions/digitalocean.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/digitalocean.adoc
@@ -7,10 +7,10 @@
:cq-description: Manage Droplets and resources within the DigitalOcean cloud.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: 1.8.0
+:cq-native-since: 1.9.0
[.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.8.0##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.9.0##
Manage Droplets and resources within the DigitalOcean cloud.
diff --git a/docs/modules/ROOT/partials/reference/components/digitalocean.adoc b/docs/modules/ROOT/partials/reference/components/digitalocean.adoc
index 705f406..450a92d 100644
--- a/docs/modules/ROOT/partials/reference/components/digitalocean.adoc
+++ b/docs/modules/ROOT/partials/reference/components/digitalocean.adoc
@@ -6,7 +6,7 @@
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
-:cq-native-since: 1.8.0
+:cq-native-since: 1.9.0
:cq-camel-part-name: digitalocean
:cq-camel-part-title: DigitalOcean
:cq-camel-part-description: Manage Droplets and resources within the DigitalOcean cloud.
diff --git a/extensions/digitalocean/deployment/src/main/java/org/apache/camel/quarkus/component/digitalocean/deployment/DigitaloceanProcessor.java b/extensions/digitalocean/deployment/src/main/java/org/apache/camel/quarkus/component/digitalocean/deployment/DigitaloceanProcessor.java
index 0c07ac8..0a3694f 100644
--- a/extensions/digitalocean/deployment/src/main/java/org/apache/camel/quarkus/component/digitalocean/deployment/DigitaloceanProcessor.java
+++ b/extensions/digitalocean/deployment/src/main/java/org/apache/camel/quarkus/component/digitalocean/deployment/DigitaloceanProcessor.java
@@ -46,7 +46,6 @@ class DigitaloceanProcessor {
String[] dtos = index.getKnownClasses().stream().map(ci -> ci.name().toString())
.filter(n -> n.startsWith("com.myjeeva.digitalocean.pojo")
|| n.startsWith("com.myjeeva.digitalocean.common"))
- .sorted()
.toArray(String[]::new);
return new ReflectiveClassBuildItem(true, true, dtos);
diff --git a/extensions/digitalocean/runtime/pom.xml b/extensions/digitalocean/runtime/pom.xml
index 857fc61..279224e 100644
--- a/extensions/digitalocean/runtime/pom.xml
+++ b/extensions/digitalocean/runtime/pom.xml
@@ -32,7 +32,7 @@
<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
- <camel.quarkus.nativeSince>1.8.0</camel.quarkus.nativeSince>
+ <camel.quarkus.nativeSince>1.9.0</camel.quarkus.nativeSince>
</properties>
<dependencyManagement>
diff --git a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
index 951d45f..cdf47b7 100644
--- a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
+++ b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java
@@ -68,11 +68,14 @@ public abstract class WireMockTestResourceLifecycleManager implements QuarkusTes
}
}
- String wireMockUrl = "http://localhost:" + this.server.port();
+ String wireMockUrl = "http://localhost:" + server.port();
LOG.infof("WireMock started on %s", wireMockUrl);
properties.put("wiremock.url", wireMockUrl);
- String httpsUrl = "https://localhost:" + this.server.httpsPort();
- properties.put("wiremock.url.ssl", httpsUrl);
+
+ // if https enabled
+ if (server.getOptions().httpsSettings().enabled()) {
+ properties.put("wiremock.url.ssl", "https://localhost:" + server.httpsPort());
+ }
}
return properties;
@@ -219,9 +222,6 @@ public abstract class WireMockTestResourceLifecycleManager implements QuarkusTes
// Read mapping resources from the classpath in playback mode
configuration.fileSource(new CamelQuarkusFileSource());
}
-
- // add an SSL port
- configuration.dynamicHttpsPort();
return new WireMockServer(configuration);
}
diff --git a/integration-tests/digitalocean/pom.xml b/integration-tests/digitalocean/pom.xml
index 0e7c521..c6eb41e 100644
--- a/integration-tests/digitalocean/pom.xml
+++ b/integration-tests/digitalocean/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-tests</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.9.0-SNAPSHOT</version>
</parent>
<artifactId>camel-quarkus-integration-test-digitalocean</artifactId>
diff --git a/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanResource.java b/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanResource.java
index bb8f69b..6ba0357 100644
--- a/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanResource.java
+++ b/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanResource.java
@@ -16,12 +16,10 @@
*/
package org.apache.camel.quarkus.component.digitalocean.it;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@@ -36,7 +34,6 @@ import javax.ws.rs.core.Response;
import com.myjeeva.digitalocean.pojo.Action;
import com.myjeeva.digitalocean.pojo.Backup;
import com.myjeeva.digitalocean.pojo.Droplet;
-import com.myjeeva.digitalocean.pojo.Kernel;
import com.myjeeva.digitalocean.pojo.Snapshot;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.digitalocean.constants.DigitalOceanHeaders;
@@ -51,6 +48,7 @@ public class DigitaloceanResource {
private static final String REGION_FRANKFURT = "fra1";
private static final String DROPLET_SIZE_1_GB = "s-1vcpu-1gb";
private static final String DROPLET_IMAGE = "ubuntu-20-04-x64";
+ private static final List<String> DROPLET_TAGS = Arrays.asList("tag1", "tag2");
@Inject
ProducerTemplate producerTemplate;
@@ -59,31 +57,25 @@ public class DigitaloceanResource {
@Path("{name}")
public int createDroplet(@PathParam("name") String name) {
LOG.infof("creating a droplet with name %s", name);
- Map<String, Object> headers = getCreateHeaders();
- headers.put(DigitalOceanHeaders.NAME, name);
+ Map<String, Object> headers = createHeaders(name);
Droplet droplet = producerTemplate.requestBodyAndHeaders("direct:droplet", null, headers, Droplet.class);
return droplet.getId();
}
- @PUT
- public List<Integer> createDroplet(List<String> names) {
- LOG.infof("creating a droplet with names %s", names);
- Map<String, Object> headers = getCreateHeaders();
- headers.put(DigitalOceanHeaders.NAMES, names);
- List<Droplet> droplets = producerTemplate.requestBodyAndHeaders("direct:droplet", null, headers, List.class);
- return droplets.stream().map(droplet -> droplet.getId()).collect(Collectors.toList());
- }
-
- private Map<String, Object> getCreateHeaders() {
+ /**
+ * Creates the headers for operation `Create a Droplet`
+ *
+ * @param name
+ * @return
+ */
+ private Map<String, Object> createHeaders(String name) {
Map<String, Object> headers = new HashMap<>();
headers.put(DigitalOceanHeaders.OPERATION, DigitalOceanOperations.create);
headers.put(DigitalOceanHeaders.REGION, REGION_FRANKFURT);
headers.put(DigitalOceanHeaders.DROPLET_SIZE, DROPLET_SIZE_1_GB);
headers.put(DigitalOceanHeaders.DROPLET_IMAGE, DROPLET_IMAGE);
- Collection<String> tags = new ArrayList<>();
- tags.add("tag1");
- tags.add("tag2");
- headers.put(DigitalOceanHeaders.DROPLET_TAGS, tags);
+ headers.put(DigitalOceanHeaders.DROPLET_TAGS, DROPLET_TAGS);
+ headers.put(DigitalOceanHeaders.NAME, name);
return headers;
}
@@ -120,17 +112,6 @@ public class DigitaloceanResource {
return actions;
}
- @GET
- @Path("kernels/{id}")
- public List<Kernel> getKernels(@PathParam("id") int id) {
- LOG.infof("getting kernels's droplet with id %s", id);
- Map<String, Object> headers = new HashMap<>();
- headers.put(DigitalOceanHeaders.OPERATION, DigitalOceanOperations.listKernels);
- headers.put(DigitalOceanHeaders.ID, id);
- List<Kernel> kernels = producerTemplate.requestBodyAndHeaders("direct:droplet", null, headers, List.class);
- return kernels;
- }
-
@POST
@Path("snapshot/{id}")
public Action snapshotDroplet(@PathParam("id") int id, String snapshotName) {
diff --git a/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanRoute.java b/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanRoute.java
index 9724f0d..29b1fa3 100644
--- a/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanRoute.java
+++ b/integration-tests/digitalocean/src/main/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanRoute.java
@@ -40,13 +40,10 @@ public class DigitaloceanRoute extends RouteBuilder {
@ApplicationScoped
@Unremovable
@Named("digitalOceanClient")
- DigitalOceanClient intiDigitalOceanClient(MockApiService mockApiService) {
+ DigitalOceanClient initDigitalOceanClient(MockApiService mockApiService) {
final String wireMockUrl = System.getProperty("wiremock.url.ssl");
if (wireMockUrl != null) {
- DigitalOceanClient digitalOceanClient = mockApiService.createDigitalOceanClient(wireMockUrl, oAuthToken);
- digitalOceanClient.setAuthToken(oAuthToken);
- digitalOceanClient.setApiVersion("V2");
- return digitalOceanClient;
+ return mockApiService.createDigitalOceanClient(wireMockUrl, oAuthToken);
}
return new DigitalOceanClient(oAuthToken);
}
@@ -54,7 +51,7 @@ public class DigitaloceanRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:droplet")
- .to(String.format("digitalocean:droplets?oAuthToken=%s&digitalOceanClient=#digitalOceanClient", oAuthToken));
+ .toF("digitalocean:droplets?oAuthToken=%s&digitalOceanClient=#digitalOceanClient", oAuthToken);
}
}
diff --git a/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTest.java b/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTest.java
index a956b62..c401351 100644
--- a/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTest.java
+++ b/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTest.java
@@ -28,15 +28,12 @@ import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import org.apache.camel.quarkus.test.wiremock.MockServer;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
-import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import static io.restassured.RestAssured.given;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.Matchers.hasKey;
-import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -47,114 +44,110 @@ class DigitaloceanTest {
@MockServer
WireMockServer server;
- @Test
- @DisabledIfEnvironmentVariable(named = "DIGITALOCEAN_AUTH_TOKEN", matches = ".+")
- public void testIfMock() {
- testDroplets(5, TimeUnit.SECONDS, false);
+ static long timeout = 5;
+ static TimeUnit timeoutUnit = TimeUnit.SECONDS;
+
+ @BeforeAll
+ public static void initTimeoutUnit() {
+ // add timeout if not using MockServer
+ // when using a Digitalocean Key, it takes at least 2 minutes to create a droplet or snapshot
+ String key = System.getenv("DIGITALOCEAN_AUTH_TOKEN");
+ if (key != null) {
+ timeoutUnit = TimeUnit.MINUTES;
+ }
}
@Test
- @EnabledIfEnvironmentVariable(named = "DIGITALOCEAN_AUTH_TOKEN", matches = ".+")
- public void testIfOAuth() {
- testDroplets(10, TimeUnit.MINUTES, true);
- }
-
- public void testDroplets(long timeout, TimeUnit timeOutUnit, boolean waitPowerOff) {
+ void testDroplets() {
// insert multiple droplets
- List<String> names = Arrays.asList("droplet1");
- List<Integer> otherIds = RestAssured.given().contentType(ContentType.JSON).body(names).put("/digitalocean/droplet")
- .then().extract().body().as(List.class);
- assertNotNull(otherIds);
- assertEquals(1, otherIds.size());
- Integer dropletId1 = otherIds.get(0);
+ Integer dropletId = RestAssured.given().contentType(ContentType.JSON).put("/digitalocean/droplet/droplet1")
+ .then().extract().body().as(Integer.class);
+ assertNotNull(dropletId);
// get the droplet by dropletId1 until its status is active and ready
// it takes time only if using a oAuthToken from Digitalocean
- waitActiveDroplet(dropletId1, timeout, timeOutUnit);
+ waitActiveDroplet(dropletId);
// action : enable backups
given()
.contentType(ContentType.JSON)
- .get("/digitalocean/droplet/backups/enable/" + dropletId1)
+ .get("/digitalocean/droplet/backups/enable/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1))
+ .body("resourceId", equalTo(dropletId))
.body("type", equalTo("ENABLE_BACKUPS"));
// action : power off, before taking a snapshot
given()
.contentType(ContentType.JSON)
- .get("/digitalocean/droplet/off/" + dropletId1)
+ .get("/digitalocean/droplet/off/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
+ .body("resourceId", equalTo(dropletId));
// take a snapshot
given()
.contentType(ContentType.JSON)
.body("snapshot1")
- .post("/digitalocean/droplet/snapshot/" + dropletId1)
+ .post("/digitalocean/droplet/snapshot/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
-
- // action : get and wait for the snapshot
- waitForSnapshot(dropletId1, timeout, timeOutUnit);
+ .body("resourceId", equalTo(dropletId));
// action : disable backups
given()
.when()
- .get("/digitalocean/droplet/backups/disable/" + dropletId1)
+ .get("/digitalocean/droplet/backups/disable/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
+ .body("resourceId", equalTo(dropletId));
// wait for Droplet to be active
- waitActiveDroplet(dropletId1, timeout, timeOutUnit);
+ waitActiveDroplet(dropletId);
// action : power on
given()
.contentType(ContentType.JSON)
- .get("/digitalocean/droplet/on/" + dropletId1)
+ .get("/digitalocean/droplet/on/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
+ .body("resourceId", equalTo(dropletId));
// Reboot droplet
given()
.contentType(ContentType.JSON)
- .get("/digitalocean/droplet/reboot/" + dropletId1)
+ .get("/digitalocean/droplet/reboot/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
-
- // wait for Droplet to be active
- waitActiveDroplet(dropletId1, timeout, timeOutUnit);
+ .body("resourceId", equalTo(dropletId));
// enable Ipv6
given()
.contentType(ContentType.JSON)
- .get("/digitalocean/droplet/ipv6/" + dropletId1)
+ .get("/digitalocean/droplet/ipv6/" + dropletId)
.then()
- .body("resourceId", equalTo(dropletId1));
+ .body("resourceId", equalTo(dropletId));
// getting the droplet actions
- List<Map> actions = RestAssured.given().contentType(ContentType.JSON).body(names)
- .get("/digitalocean/droplet/actions/" + dropletId1)
+ List<Map> actions = RestAssured.given().contentType(ContentType.JSON)
+ .get("/digitalocean/droplet/actions/" + dropletId)
.then().extract().body().as(List.class);
assertActions(actions);
- // delete the droplet
+ // test neigbors
+ testNeighbors(dropletId);
+
+ // delete the droplet with id droplet 1
given()
.when()
- .delete("/digitalocean/droplet/" + dropletId1)
+ .delete("/digitalocean/droplet/" + dropletId)
.then()
.statusCode(202);
+
}
/**
- * Gets the snapshots and waits until the snapshot is created in Digitalocean. It may take 2 to 3 minutes. For tests
- * with Wiremock, no need to wait
+ * Gets the snapshots and waits until the snapshot is created in Digitalocean.
*
- * @param dropletId1
+ * @param dropletId
*/
- private void waitForSnapshot(Integer dropletId1, long timeout, TimeUnit timeOutUnit) {
- await().atMost(timeout, timeOutUnit).until(() -> {
- String path = "/digitalocean/droplet/snapshots/" + dropletId1;
+ private void waitForSnapshot(Integer dropletId) {
+ await().atMost(this.timeout, this.timeoutUnit).until(() -> {
+ String path = "/digitalocean/droplet/snapshots/" + dropletId;
List<Map> result = given().when().get(path).then().extract().as(List.class);
// Look for the snapshot
Optional optional = result.stream()
@@ -165,23 +158,22 @@ class DigitaloceanTest {
}
/**
- * Gets the droplet and waits until the droplet is Active in Digitalocean. It may take 2 to 3 minutes. For tests with
- * Wiremock, the response is always Active
+ * Gets the droplet and waits until the droplet is Active in Digitalocean.
*
- * @param dropletId1
+ * @param dropletId
*/
- private void waitActiveDroplet(Integer dropletId1, long timeout, TimeUnit timeOutUnit) {
- await().atMost(timeout, timeOutUnit).until(() -> {
- String path = "/digitalocean/droplet/" + dropletId1;
+ private void waitActiveDroplet(Integer dropletId) {
+ await().atMost(this.timeout, this.timeoutUnit).until(() -> {
+ String path = "/digitalocean/droplet/" + dropletId;
Map droplet = given()
.contentType(ContentType.JSON).get(path).then().extract().as(Map.class);
- return droplet != null && dropletId1.equals(droplet.get("id")) && "ACTIVE".equals(droplet.get("status"));
+ return droplet != null && dropletId.equals(droplet.get("id")) && "ACTIVE".equals(droplet.get("status"));
});
}
/**
* Assert all the actions
- *
+ *
* @param actions
*/
private void assertActions(List<Map> actions) {
@@ -196,7 +188,7 @@ class DigitaloceanTest {
/**
* assert a single action
- *
+ *
* @param actions
* @param actionType
*/
@@ -207,25 +199,11 @@ class DigitaloceanTest {
assertTrue(optional.isPresent());
}
- @Test
- @DisabledIfEnvironmentVariable(named = "DIGITALOCEAN_AUTH_TOKEN", matches = ".+")
- void testGetKernels() {
- // only for mock back-end server
- given()
- .when()
- .get("/digitalocean/droplet/kernels/3164494")
- .then()
- .body("[0]", hasKey("id"));
- }
-
- @Test
- @DisabledIfEnvironmentVariable(named = "DIGITALOCEAN_AUTH_TOKEN", matches = ".+")
- void testNeighbors() {
- // only for mock back-end server
+ void testNeighbors(int dropletId) {
given()
.when()
- .get("/digitalocean/droplet/neighbors/3164494")
+ .get("/digitalocean/droplet/neighbors/" + dropletId)
.then()
- .body("[0].id", equalTo(3164495));
+ .statusCode(200);
}
}
diff --git a/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTestResource.java b/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTestResource.java
index 2beb182..1d08000 100644
--- a/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTestResource.java
+++ b/integration-tests/digitalocean/src/test/java/org/apache/camel/quarkus/component/digitalocean/it/DigitaloceanTestResource.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.quarkus.component.digitalocean.it;
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
public class DigitaloceanTestResource extends WireMockTestResourceLifecycleManager {
@@ -31,4 +32,10 @@ public class DigitaloceanTestResource extends WireMockTestResourceLifecycleManag
protected boolean isMockingEnabled() {
return !envVarsPresent(DIGITALOCEAN_AUTH_TOKEN);
}
+
+ @Override
+ protected void customizeWiremockConfiguration(WireMockConfiguration config) {
+ // add an SSL port
+ config.dynamicHttpsPort();
+ }
}
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/actionsDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/actionsDroplet.json
index d034a5c..d620504 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/actionsDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/actionsDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ed",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494/actions?page=1&per_page=25",
+ "url": "/v2/droplets/3164494/actions?page=1&per_page=25",
"method": "GET"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/backupsDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/backupsDroplet.json
index ae8cb7b..20f5acb 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/backupsDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/backupsDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ed",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494/backups?page=1&per_page=25",
+ "url": "/v2/droplets/3164494/backups?page=1&per_page=25",
"method": "GET"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/createMultipleDroplets.json b/integration-tests/digitalocean/src/test/resources/mappings/createDroplet.json
similarity index 54%
rename from integration-tests/digitalocean/src/test/resources/mappings/createMultipleDroplets.json
rename to integration-tests/digitalocean/src/test/resources/mappings/createDroplet.json
index 3ae8ae1..cdf5c64 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/createMultipleDroplets.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/createDroplet.json
@@ -2,12 +2,12 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6eb",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets",
+ "url": "/v2/droplets",
"method": "POST"
},
"response": {
"status": 200,
- "body" : "{\"droplets\":[{\"id\":3164494,\"name\":\"sub-01.example.com\",\"memory\":1024,\"vcpus\":1,\"disk\":25,\"locked\":false,\"status\":\"new\",\"kernel\":{\"id\":2233,\"name\":\"Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic\",\"version\":\"3.13.0-37-generic\"},\"created_at\":\"2014-11-14T16:36:31Z\",\"features\":[\"virtio\"],\"backup_ids\":[],\"snapshot_ids\":[],\"image\":{},\"volume_ids\":[],\"size\":{},\"size_slug\":\"s-1vcpu-1gb\",\"networks\":{},\"region\":{},\"tags\":[\"web\" [...]
+ "body": "{\"droplet\":{\"id\":3164494,\"name\":\"example.com\",\"memory\":1024,\"vcpus\":1,\"disk\":25,\"locked\":true,\"status\":\"new\",\"kernel\":{\"id\":2233,\"name\":\"Ubuntu 14.04 x64 vmlinuz-3.13.0-37-generic\",\"version\":\"3.13.0-37-generic\"},\"created_at\":\"2014-11-14T16:36:31Z\",\"features\":[\"virtio\"],\"backup_ids\":[],\"snapshot_ids\":[],\"image\":{},\"volume_ids\":[],\"size\":{},\"size_slug\":\"s-1vcpu-1gb\",\"networks\":{},\"region\":{},\"tags\":[\"web\"]},\"links\ [...]
"headers": {
"Content-Type": "application/json; charset=UTF-8",
"Date": "Tue, 03 Nov 2020 09:39:11 GMT",
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/deleteDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/deleteDroplet.json
index b2945a1..140863e 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/deleteDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/deleteDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ea",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494",
+ "url": "/v2/droplets/3164494",
"method": "DELETE"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/dropletAction.json b/integration-tests/digitalocean/src/test/resources/mappings/dropletAction.json
index 6f48d61..920fa1e 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/dropletAction.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/dropletAction.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ed",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494/actions",
+ "url": "/v2/droplets/3164494/actions",
"method": "POST"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/getDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/getDroplet.json
index 1f68025..37e4745 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/getDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/getDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ec",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494?per_page=25",
+ "url": "/v2/droplets/3164494?per_page=25",
"method": "GET"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/kernelsDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/kernelsDroplet.json
deleted file mode 100644
index 4fd9950..0000000
--- a/integration-tests/digitalocean/src/test/resources/mappings/kernelsDroplet.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "id": "09aa79df-8a19-41df-8655-e414d390d6ed",
- "name": "digitalocean_api_json",
- "request": {
- "url": "/V2/droplets/3164494/kernels?page=1&per_page=25",
- "method": "GET"
- },
- "response": {
- "status": 200,
- "body" : "{\"kernels\":[{\"id\":231,\"name\":\"DO-recovery-static-fsck\",\"version\":\"3.8.0-25-generic\"}],\"links\":{\"pages\":{\"last\":\"https:\/\/api.digitalocean.com\/v2\/droplets\/3164494\/kernels?page=124&per_page=1\",\"next\":\"https:\/\/api.digitalocean.com\/v2\/droplets\/3164494\/kernels?page=2&per_page=1\"}},\"meta\":{\"total\":124}}",
- "headers": {
- "Content-Type": "application/json; charset=UTF-8",
- "Date": "Tue, 03 Nov 2020 09:39:11 GMT",
- "Pragma": "no-cache",
- "Expires": "Fri, 01 Jan 1990 00:00:00 GMT",
- "Cache-Control": "no-cache, must-revalidate",
- "Vary": "Accept-Language",
- "Server": "mafe",
- "X-XSS-Protection": "0",
- "X-Frame-Options": "SAMEORIGIN",
- "Server-Timing": "gfet4t7; dur=263",
- "Alt-Svc": "h3-Q050=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
- }
- },
- "uuid": "09aa79df-8a19-41df-8655-e414d390d6ed",
- "persistent": true,
- "insertionIndex": 2
-}
\ No newline at end of file
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/neighborsDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/neighborsDroplet.json
index 816399b..5cc1ca3 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/neighborsDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/neighborsDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ed",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494/neighbors?page=1&per_page=25",
+ "url": "/v2/droplets/3164494/neighbors?page=1&per_page=25",
"method": "GET"
},
"response": {
diff --git a/integration-tests/digitalocean/src/test/resources/mappings/snapshotsDroplet.json b/integration-tests/digitalocean/src/test/resources/mappings/snapshotsDroplet.json
index 98c57f5..2a35eab 100644
--- a/integration-tests/digitalocean/src/test/resources/mappings/snapshotsDroplet.json
+++ b/integration-tests/digitalocean/src/test/resources/mappings/snapshotsDroplet.json
@@ -2,7 +2,7 @@
"id": "09aa79df-8a19-41df-8655-e414d390d6ed",
"name": "digitalocean_api_json",
"request": {
- "url": "/V2/droplets/3164494/snapshots?page=1&per_page=25",
+ "url": "/v2/droplets/3164494/snapshots?page=1&per_page=25",
"method": "GET"
},
"response": {