This is an automated email from the ASF dual-hosted git repository.

aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new 62c70aa  openstack: added nova server and swift tests #1943
62c70aa is described below

commit 62c70aabb2ce804a91f367a94e01af491b03b1d9
Author: aldettinger <aldettin...@gmail.com>
AuthorDate: Thu Apr 1 20:08:47 2021 +0200

    openstack: added nova server and swift tests #1943
---
 .../openstack/it/OpenstackNovaServerResource.java  | 122 +++++++++++++++++++++
 .../component/openstack/it/OpenstackResource.java  |  65 -----------
 .../it/OpenstackSwiftContainerResource.java        |  79 +++++++++++++
 .../openstack/it/OpenstackSwiftObjectResource.java |  69 ++++++++++++
 ...stackTest.java => OpenstackNovaServerTest.java} |  31 ++++--
 ...kTest.java => OpenstackSwiftContainerTest.java} |  21 ++--
 ...tackTest.java => OpenstackSwiftObjectTest.java} |  22 ++--
 .../mappings/keystone/authv3_project.json          |   2 +-
 .../mappings/nova/servers/server_create.json       |  18 +++
 .../nova/servers/server_snapshot_create.json       |  17 +++
 .../mappings/nova/servers/server_wrong_id_get.json |  18 +++
 .../resources/mappings/nova/servers/servers.json   |  22 ++++
 .../swift/containers/container_metadata_get.json   |  18 +++
 .../mappings/swift/containers/containers.json      |  22 ++++
 .../mappings/swift/objects/object_get.json         |  19 ++++
 15 files changed, 440 insertions(+), 105 deletions(-)

diff --git 
a/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerResource.java
 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerResource.java
new file mode 100644
index 0000000..ae2faa9
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerResource.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.quarkus.component.openstack.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.openstack.common.OpenstackConstants;
+import org.apache.camel.component.openstack.nova.NovaConstants;
+import org.jboss.logging.Logger;
+import org.openstack4j.api.Builders;
+import org.openstack4j.api.exceptions.ServerResponseException;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.compute.Server.Status;
+import org.openstack4j.model.compute.ServerCreate;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+@Path("/openstack/nova/servers/")
+@ApplicationScoped
+public class OpenstackNovaServerResource {
+
+    private static final Logger LOG = 
Logger.getLogger(OpenstackNovaServerResource.class);
+
+    private static final String URI_FORMAT = 
"openstack-nova://{{camel.openstack.test.host-url}}?username=user&password=secret&project=project&operation=%s&subsystem="
+            + NovaConstants.NOVA_SUBSYSTEM_SERVERS;
+
+    private final String SERVER_NAME = "server-test-1";
+    private final String SERVER_ID = "e565cbdb-8e74-4044-ba6e-0155500b2c46";
+    private final String SERVER_WRONG_ID = 
"05184ba3-00ba-4fbc-b7a2-03b62b884931";
+    private final String SERVER_SNAPSHOT_NAME = "server-snapshot";
+    private final String SERVER_SNAPSHOT_ID = 
"72f759b3-2576-4bf0-9ac9-7cb4a5b9d541";
+
+    @Inject
+    ProducerTemplate template;
+
+    @Path("/createShouldSucceed")
+    @POST
+    public void createShouldSucceed() {
+        LOG.debug("Calling OpenstackNovaServerResource.createShouldSucceed()");
+
+        ServerCreate in = Builders.server().name(SERVER_NAME).build();
+
+        String uri = String.format(URI_FORMAT, OpenstackConstants.CREATE);
+        Server out = template.requestBody(uri, in, Server.class);
+
+        assertNotNull(out);
+        assertEquals(SERVER_NAME, out.getName());
+    }
+
+    @Path("/createSnapshotShouldSucceed")
+    @POST
+    public void createSnapshotShouldSucceed() {
+        LOG.debug("Calling 
OpenstackNovaServerResource.createSnapshotShouldSucceed()");
+
+        Map<String, Object> headers = new HashMap<String, Object>();
+        headers.put(OpenstackConstants.ID, SERVER_ID);
+        headers.put(OpenstackConstants.NAME, SERVER_SNAPSHOT_NAME);
+
+        String uri = String.format(URI_FORMAT, NovaConstants.CREATE_SNAPSHOT);
+        String out = template.requestBodyAndHeaders(uri, null, headers, 
String.class);
+
+        assertEquals(SERVER_SNAPSHOT_ID, out);
+    }
+
+    @Path("/getWrongIdShouldThrow")
+    @POST
+    public void getWrongIdShouldThrow() {
+        LOG.debug("Calling 
OpenstackNovaServerResource.getWrongIdShouldThrow()");
+
+        String uri = String.format(URI_FORMAT, OpenstackConstants.GET);
+
+        try {
+            template.requestBodyAndHeader(uri, null, OpenstackConstants.ID, 
SERVER_WRONG_ID, Server.class);
+            fail("Getting nova server with wrong id should throw");
+        } catch (Exception ex) {
+            assertTrue(ex instanceof CamelExecutionException);
+            assertTrue(((CamelExecutionException) ex).getCause() instanceof 
ServerResponseException);
+        }
+    }
+
+    @Path("/getAllShouldSucceed")
+    @POST
+    public void getAllShouldSucceed() {
+        LOG.debug("Calling OpenstackNovaServerResource.getAllShouldSucceed()");
+
+        String uri = String.format(URI_FORMAT, OpenstackConstants.GET_ALL);
+        Server[] servers = template.requestBody(uri, null, Server[].class);
+
+        assertNotNull(servers);
+        assertEquals(1, servers.length);
+        assertEquals(1, 
servers[0].getAddresses().getAddresses("private").size());
+        assertEquals("192.168.0.3", 
servers[0].getAddresses().getAddresses("private").get(0).getAddr());
+        assertEquals(Status.ACTIVE, servers[0].getStatus());
+        assertEquals("new-server-test", servers[0].getName());
+    }
+
+}
diff --git 
a/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackResource.java
 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackResource.java
deleted file mode 100644
index 4e661db..0000000
--- 
a/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackResource.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-package org.apache.camel.quarkus.component.openstack.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/openstack")
-@ApplicationScoped
-public class OpenstackResource {
-
-    private static final Logger LOG = 
Logger.getLogger(OpenstackResource.class);
-
-    private static final String COMPONENT_OPENSTACK_NOVA = "openstack-nova";
-    private static final String COMPONENT_OPENSTACK_SWIFT = "openstack-swift";
-
-    @Inject
-    CamelContext context;
-
-    @Path("/load/component/openstack-nova")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentOpenstackNova() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_OPENSTACK_NOVA) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_OPENSTACK_NOVA);
-        return Response.status(500, COMPONENT_OPENSTACK_NOVA + " could not be 
loaded from the Camel context").build();
-    }
-
-    @Path("/load/component/openstack-swift")
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response loadComponentOpenstackSwift() throws Exception {
-        /* This is an autogenerated test */
-        if (context.getComponent(COMPONENT_OPENSTACK_SWIFT) != null) {
-            return Response.ok().build();
-        }
-        LOG.warnf("Could not load [%s] from the Camel context", 
COMPONENT_OPENSTACK_SWIFT);
-        return Response.status(500, COMPONENT_OPENSTACK_SWIFT + " could not be 
loaded from the Camel context").build();
-    }
-}
diff --git 
a/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerResource.java
 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerResource.java
new file mode 100644
index 0000000..18947d7
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerResource.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.quarkus.component.openstack.it;
+
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.openstack.common.OpenstackConstants;
+import org.apache.camel.component.openstack.swift.SwiftConstants;
+import org.jboss.logging.Logger;
+import org.openstack4j.model.storage.object.SwiftContainer;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+@Path("/openstack/swift/containers/")
+@ApplicationScoped
+public class OpenstackSwiftContainerResource {
+
+    private static final Logger LOG = 
Logger.getLogger(OpenstackSwiftContainerResource.class);
+
+    private static final String URI_FORMAT = 
"openstack-swift://{{camel.openstack.test.host-url}}?username=user&password=secret&project=project&operation=%s&subsystem="
+            + SwiftConstants.SWIFT_SUBSYSTEM_CONTAINERS;
+
+    private static final String CONTAINER_NAME = "myContainer";
+    private static final String NAME_BOOK = "Book";
+    private static final String NAME_YEAR = "Year";
+
+    @Inject
+    ProducerTemplate template;
+
+    @Path("/getAllShouldSucceed")
+    @POST
+    public void getAllShouldSucceed() {
+        LOG.debug("Calling 
OpenstackSwiftContainerResource.getAllShouldSucceed()");
+
+        String uri = String.format(URI_FORMAT, OpenstackConstants.GET_ALL);
+        SwiftContainer[] containers = template.requestBody(uri, null, 
SwiftContainer[].class);
+
+        assertNotNull(containers);
+        assertEquals(2, containers.length);
+        assertEquals(100, containers[0].getTotalSize());
+        assertEquals("Test", containers[0].getName());
+        assertEquals("marktwain", containers[1].getName());
+    }
+
+    @Path("/getMetadataShouldSucceed")
+    @POST
+    public void getMetadataShouldSucceed() {
+        LOG.debug("Calling 
OpenstackSwiftContainerResource.getMetadataShouldSucceed()");
+
+        String uri = String.format(URI_FORMAT, SwiftConstants.GET_METADATA);
+        Map<?, ?> metadata = template.requestBodyAndHeader(uri, null, 
SwiftConstants.CONTAINER_NAME, CONTAINER_NAME, Map.class);
+
+        assertNotNull(metadata);
+        assertEquals("2000", metadata.get(NAME_YEAR));
+        assertEquals("TestBook", metadata.get(NAME_BOOK));
+    }
+
+}
diff --git 
a/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectResource.java
 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectResource.java
new file mode 100644
index 0000000..918737f
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/main/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectResource.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.camel.quarkus.component.openstack.it;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.openstack.common.OpenstackConstants;
+import org.apache.camel.component.openstack.swift.SwiftConstants;
+import org.jboss.logging.Logger;
+import org.openstack4j.model.storage.object.SwiftObject;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@Path("/openstack/swift/objects/")
+@ApplicationScoped
+public class OpenstackSwiftObjectResource {
+
+    private static final Logger LOG = 
Logger.getLogger(OpenstackSwiftObjectResource.class);
+
+    private static final String URI_FORMAT = 
"openstack-swift://{{camel.openstack.test.host-url}}?username=user&password=secret&project=project&operation=%s&subsystem="
+            + SwiftConstants.SWIFT_SUBSYSTEM_OBJECTS;
+
+    private static final String OBJECT_CONTAINER_NAME = "test-container";
+    private static final String OBJECT_NAME = "test-file";
+
+    @Inject
+    ProducerTemplate template;
+
+    @Path("/getShouldSucceed")
+    @POST
+    public void getShouldSucceed() {
+        LOG.debug("Calling OpenstackSwiftObjectResource.getShouldSucceed()");
+
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(SwiftConstants.CONTAINER_NAME, OBJECT_CONTAINER_NAME);
+        headers.put(SwiftConstants.OBJECT_NAME, OBJECT_NAME);
+
+        String uri = String.format(URI_FORMAT, OpenstackConstants.GET);
+        SwiftObject swiftObject = template.requestBodyAndHeaders(uri, null, 
headers, SwiftObject.class);
+
+        assertEquals(OBJECT_CONTAINER_NAME, swiftObject.getContainerName());
+        assertEquals(OBJECT_NAME, swiftObject.getName());
+        assertEquals(15, swiftObject.getSizeInBytes());
+        assertEquals("application/json", swiftObject.getMimeType());
+        assertEquals("12345678901234567890", swiftObject.getETag());
+    }
+
+}
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerTest.java
similarity index 57%
copy from 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
copy to 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerTest.java
index 1a425d7..8b6ced1 100644
--- 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
+++ 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackNovaServerTest.java
@@ -16,27 +16,34 @@
  */
 package org.apache.camel.quarkus.component.openstack.it;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
 import org.junit.jupiter.api.Test;
 
+import static io.restassured.RestAssured.post;
+
 @QuarkusTest
-class OpenstackTest {
+@QuarkusTestResource(OpenStackTestResource.class)
+class OpenstackNovaServerTest {
+
+    @Test
+    public void createShouldSucceed() {
+        
post("/openstack/nova/servers/createShouldSucceed").then().statusCode(204);
+    }
+
+    @Test
+    public void createSnapshotShouldSucceed() {
+        
post("/openstack/nova/servers/createSnapshotShouldSucceed").then().statusCode(204);
+    }
 
     @Test
-    public void loadComponentOpenstackNova() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-nova")
-                .then()
-                .statusCode(200);
+    public void getWrongIdShouldThrow() {
+        
post("/openstack/nova/servers/getWrongIdShouldThrow").then().statusCode(204);
     }
 
     @Test
-    public void loadComponentOpenstackSwift() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-swift")
-                .then()
-                .statusCode(200);
+    public void getAllShouldSucceed() {
+        
post("/openstack/nova/servers/getAllShouldSucceed").then().statusCode(204);
     }
 
 }
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerTest.java
similarity index 66%
copy from 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
copy to 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerTest.java
index 1a425d7..85e0943 100644
--- 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
+++ 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftContainerTest.java
@@ -16,27 +16,24 @@
  */
 package org.apache.camel.quarkus.component.openstack.it;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
 import org.junit.jupiter.api.Test;
 
+import static io.restassured.RestAssured.post;
+
 @QuarkusTest
-class OpenstackTest {
+@QuarkusTestResource(OpenStackTestResource.class)
+class OpenstackSwiftContainerTest {
 
     @Test
-    public void loadComponentOpenstackNova() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-nova")
-                .then()
-                .statusCode(200);
+    public void getAllShouldSucceed() {
+        
post("/openstack/swift/containers/getAllShouldSucceed").then().statusCode(204);
     }
 
     @Test
-    public void loadComponentOpenstackSwift() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-swift")
-                .then()
-                .statusCode(200);
+    public void getMetadataShouldSucceed() {
+        
post("/openstack/swift/containers/getMetadataShouldSucceed").then().statusCode(204);
     }
 
 }
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectTest.java
similarity index 65%
rename from 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
rename to 
extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectTest.java
index 1a425d7..8f2331a 100644
--- 
a/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackTest.java
+++ 
b/extensions-jvm/openstack/integration-test/src/test/java/org/apache/camel/quarkus/component/openstack/it/OpenstackSwiftObjectTest.java
@@ -16,27 +16,19 @@
  */
 package org.apache.camel.quarkus.component.openstack.it;
 
+import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
 import org.junit.jupiter.api.Test;
 
-@QuarkusTest
-class OpenstackTest {
+import static io.restassured.RestAssured.post;
 
-    @Test
-    public void loadComponentOpenstackNova() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-nova")
-                .then()
-                .statusCode(200);
-    }
+@QuarkusTest
+@QuarkusTestResource(OpenStackTestResource.class)
+class OpenstackSwiftObjectTest {
 
     @Test
-    public void loadComponentOpenstackSwift() {
-        /* A simple autogenerated test */
-        RestAssured.get("/openstack/load/component/openstack-swift")
-                .then()
-                .statusCode(200);
+    public void getShouldSucceed() {
+        
post("/openstack/swift/objects/getShouldSucceed").then().statusCode(204);
     }
 
 }
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/keystone/authv3_project.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/keystone/authv3_project.json
index 8518aad..369d708 100644
--- 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/keystone/authv3_project.json
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/keystone/authv3_project.json
@@ -7,7 +7,7 @@
   },
   "response" : {
     "status" : 201,
-    "body" : 
"{\"token\":{\"methods\":[\"password\"],\"roles\":[{\"id\":\"6ead57f8ae124996af8b0beb72ff1007\",\"name\":\"admin\"}],\"expires_at\":\"2015-08-26T14:14:10.309926Z\",\"project\":{\"domain\":{\"id\":\"default\",\"name\":\"Default\"},\"id\":\"123ac695d4db400a9001b91bb3b8aa46\",\"name\":\"admin\"},\"catalog\":[{\"endpoints\":[{\"region_id\":\"RegionOne\",\"url\":\"{{request.baseUrl}}\",\"region\":\"RegionOne\",\"interface\":\"public\",\"id\":\"6e82c8912d3f49a09df51035681d564c\"},
 [...]
+    "body" : 
"{\"token\":{\"methods\":[\"password\"],\"roles\":[{\"id\":\"6ead57f8ae124996af8b0beb72ff1007\",\"name\":\"admin\"}],\"expires_at\":\"2015-08-26T14:14:10.309926Z\",\"project\":{\"domain\":{\"id\":\"default\",\"name\":\"Default\"},\"id\":\"123ac695d4db400a9001b91bb3b8aa46\",\"name\":\"admin\"},\"catalog\":[{\"endpoints\":[{\"region_id\":\"RegionOne\",\"url\":\"{{request.baseUrl}}\",\"region\":\"RegionOne\",\"interface\":\"public\",\"id\":\"6e82c8912d3f49a09df51035681d564c\"},
 [...]
     "transformers": ["response-template"],
     "headers" : {
       "Content-Type" : "application/json; charset=UTF-8",
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_create.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_create.json
new file mode 100644
index 0000000..3b65802
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_create.json
@@ -0,0 +1,18 @@
+{
+  "id" : "8cf6f5d4-0dcf-46e4-b40b-b076c8b8ca6d",
+  "name" : "server_create.json",
+  "request" : {
+    "url" : "/v2/123ac695d4db400a9001b91bb3b8aa46/servers",
+    "method" : "POST"
+  },
+  "response" : {
+    "body" : 
"{\"server\":{\"name\":\"server-test-1\",\"imageRef\":\"b5660a6e-4b46-4be3-9707-6b47221b454f\",\"flavorRef\":\"2\",\"max_count\":1,\"min_count\":1,\"networks\":[{\"uuid\":\"d32019d3-bc6e-4319-9c1d-6722fc136a22\"}],\"security_groups\":[{\"name\":\"default\"},{\"name\":\"another-secgroup-name\"}]}}",
+    "headers" : {
+      "Content-Type" : "application/json; charset=UTF-8"
+    },
+    "status" : 201
+  },
+  "uuid" : "8cf6f5d4-0dcf-46e4-b40b-b076c8b8ca6d",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_snapshot_create.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_snapshot_create.json
new file mode 100644
index 0000000..9c43254
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_snapshot_create.json
@@ -0,0 +1,17 @@
+{
+  "id" : "505c6364-5e64-4924-b088-9e28c58e7715",
+  "name" : "server_snapshot_create.json",
+  "request" : {
+    "url" : 
"/v2/123ac695d4db400a9001b91bb3b8aa46/servers/e565cbdb-8e74-4044-ba6e-0155500b2c46/action",
+    "method" : "POST"
+  },
+  "response" : {
+    "headers" : {
+      "location" : 
"http://127.0.0.1:9292/images/72f759b3-2576-4bf0-9ac9-7cb4a5b9d541";
+    },
+    "status" : 202
+  },
+  "uuid" : "505c6364-5e64-4924-b088-9e28c58e7715",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_wrong_id_get.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_wrong_id_get.json
new file mode 100644
index 0000000..6e0e874
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/server_wrong_id_get.json
@@ -0,0 +1,18 @@
+{
+  "id" : "fdf3d230-fab3-402f-98a0-394506bb8502",
+  "name" : "server_wrong_id_get.json.json",
+  "request" : {
+    "url" : 
"/v2/123ac695d4db400a9001b91bb3b8aa46/servers/05184ba3-00ba-4fbc-b7a2-03b62b884931",
+    "method" : "GET"
+  },
+  "response" : {
+    "body" : "{\"computeFault\":{\"message\":\"The server has either erred or 
is incapable of performing the requested operation.\",\"code\":500}}",
+    "headers" : {
+      "Content-Type" : "application/json; charset=UTF-8"
+    },
+    "status" : 500
+  },
+  "uuid" : "fdf3d230-fab3-402f-98a0-394506bb8502",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/servers.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/servers.json
new file mode 100644
index 0000000..8001210
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/nova/servers/servers.json
@@ -0,0 +1,22 @@
+{
+  "id" : "b5c808b7-c7fb-46c4-b05e-2f05e1e8c74d",
+  "name" : "servers.json",
+  "request" : {
+    "url" : "/v2/123ac695d4db400a9001b91bb3b8aa46/servers/detail",
+    "method" : "GET"
+  },
+  "response" : {
+    "body" : 
"{\"servers\":[{\"accessIPv4\":\"\",\"accessIPv6\":\"\",\"addresses\":{\"private\":[{\"addr\":\"192.168.0.3\",\"version\":4}]},\"created\":\"2012-09-07T16:56:37Z\",\"flavor\":{\"id\":\"1\",\"links\":[{\"href\":\"http://openstack.example.com/openstack/flavors/1\",\"rel\":\"bookmark\"}]},\"hostId\":\"16d193736a5cfdb60c697ca27ad071d6126fa13baeb670fc9d10645e\",\"id\":\"05184ba3-00ba-4fbc-b7a2-03b62b884931\",\"image\":{\"id\":\"70a599e0-31e7-49b7-b260-868f441e862b\",\"links\":[{\
 [...]
+    "headers" : {
+        "Content-Type": "application/json",
+        "Date": "Wed, 16 Mar 2016 15:01:58 GMT",
+        "Server": "Apache/2.4.7 (Ubuntu)",
+        "Vary": "X-Auth-Token",
+        "x-openstack-request-id": "req-a20cfd3c-5d67-40f7-9aa4-5fdf47951e5e"
+    },
+    "status" : 200
+  },
+  "uuid" : "b5c808b7-c7fb-46c4-b05e-2f05e1e8c74d",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/container_metadata_get.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/container_metadata_get.json
new file mode 100644
index 0000000..a041372
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/container_metadata_get.json
@@ -0,0 +1,18 @@
+{
+  "id" : "69b9a27f-0346-4230-b2c2-45cfd4d17139",
+  "name" : "container_metadata_get.json",
+  "request" : {
+    "url" : "/12345321ae80457abc3728fa1e6feb78/myContainer",
+    "method" : "HEAD"
+  },
+  "response" : {
+    "status" : 204,
+    "headers" : {
+        "X-Container-Meta-Year": "2000",
+        "X-Container-Meta-Book": "TestBook"
+    }
+  },
+  "uuid" : "69b9a27f-0346-4230-b2c2-45cfd4d17139",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/containers.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/containers.json
new file mode 100644
index 0000000..c29f12a
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/containers/containers.json
@@ -0,0 +1,22 @@
+{
+  "id" : "f4cf104c-a8b7-41a8-b571-d53d7391f9c2",
+  "name" : "containers.json",
+  "request" : {
+    "url" : "/12345321ae80457abc3728fa1e6feb78/?format=json",
+    "method" : "GET"
+  },
+  "response" : {
+    "body" : 
"[{\"count\":2,\"bytes\":100,\"name\":\"Test\"},{\"count\":1,\"bytes\":14,\"name\":\"marktwain\"}]",
+    "headers" : {
+        "Content-Type": "application/json",
+        "Date": "Wed, 16 Mar 2016 15:01:58 GMT",
+        "Server": "Apache/2.4.7 (Ubuntu)",
+        "Vary": "X-Auth-Token",
+        "x-openstack-request-id": "req-9b8d6e0d-8d2c-4ebc-b26b-7c0de628723a"
+    },
+    "status" : 200
+  },
+  "uuid" : "f4cf104c-a8b7-41a8-b571-d53d7391f9c2",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file
diff --git 
a/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/objects/object_get.json
 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/objects/object_get.json
new file mode 100644
index 0000000..d17a2a8
--- /dev/null
+++ 
b/extensions-jvm/openstack/integration-test/src/test/resources/mappings/swift/objects/object_get.json
@@ -0,0 +1,19 @@
+{
+  "id" : "cc8dbfce-477c-4119-a388-5ecfcd642336",
+  "name" : "object_get.json",
+  "request" : {
+    "url" : "/12345321ae80457abc3728fa1e6feb78/test-container/test-file",
+    "method" : "HEAD"
+  },
+  "response" : {
+    "headers" : {
+      "Content-Length" : "15",
+      "Content-Type" : "application/json",
+      "ETag" : "12345678901234567890"
+    },
+    "status" : 200
+  },
+  "uuid" : "cc8dbfce-477c-4119-a388-5ecfcd642336",
+  "persistent" : true,
+  "insertionIndex" : 1
+}
\ No newline at end of file

Reply via email to