Package org.jclouds.openstack.marconi.v1.features

Examples of org.jclouds.openstack.marconi.v1.features.QueueApiMockTest


      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);
         boolean success = queueApi.exists("jclouds-test");

         assertTrue(success);

         assertEquals(server.getRequestCount(), 2);
View Full Code Here


      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(404));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);
         boolean success = queueApi.exists("jclouds-blerg");

         assertFalse(success);

         assertEquals(server.getRequestCount(), 2);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         List<Queue> queues = queueApi.list(false).concat().toList();

         assertTrue(queues.isEmpty());
View Full Code Here

      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"queues\": [{\"href\": \"/v1/queues/jclouds-test\", \"name\": \"jclouds-test\"}], \"links\": [{\"href\": \"/v1/queues?detailed=false&marker=jclouds-test\", \"rel\": \"next\"}]}"));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         List<Queue> queues = queueApi.list(false).concat().toList();

         assertEquals(queues.size(), 1);
         assertEquals(Iterables.getOnlyElement(queues).getName(), "jclouds-test");
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(404));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         FluentIterable<Queue> queues = queueApi.list(false).concat();

         assertTrue(queues.isEmpty(), "Expecting empty queues but was " + queues.toString());
      }
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(404));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         Queues queues = queueApi.list(ListQueuesOptions.NONE);

         assertTrue(queues.isEmpty(), "Expecting empty queues but was " + queues.toString());
      }
View Full Code Here

      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"queues\": [{\"href\": \"/v1/queues/jclouds-test-1\", \"name\": \"jclouds-test-1\"}, {\"href\": \"/v1/queues/jclouds-test-10\", \"name\": \"jclouds-test-10\"}, {\"href\": \"/v1/queues/jclouds-test-11\", \"name\": \"jclouds-test-11\"}, {\"href\": \"/v1/queues/jclouds-test-12\", \"name\": \"jclouds-test-12\"}, {\"href\": \"/v1/queues/jclouds-test-2\", \"name\": \"jclouds-test-2\"}, {\"href\": \"/v1/queues/jclouds-test-3\", \"name\": \"jclouds-test-3\"}, {\"href\": \"/v1/queues/jclouds-test-4\", \"name\": \"jclouds-test-4\"}, {\"href\": \"/v1/queues/jclouds-test-5\", \"name\": \"jclouds-test-5\"}, {\"href\": \"/v1/queues/jclouds-test-6\", \"name\": \"jclouds-test-6\"}, {\"href\": \"/v1/queues/jclouds-test-7\", \"name\": \"jclouds-test-7\"}], \"links\": [{\"href\": \"/v1/queues?detailed=false&marker=jclouds-test-7\", \"rel\": \"next\"}]}"));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"queues\": [{\"href\": \"/v1/queues/jclouds-test-8\", \"name\": \"jclouds-test-8\"}, {\"href\": \"/v1/queues/jclouds-test-9\", \"name\": \"jclouds-test-9\"}], \"links\": [{\"href\": \"/v1/queues?marker=jclouds-test-9&detailed=false\", \"rel\": \"next\"}]}"));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         List<Queue> queues = queueApi.list(false).concat().toList();

         assertEquals(queues.size(), 12);
View Full Code Here

      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"queues\": [{\"href\": \"/v1/queues/jclouds-test-1\", \"name\": \"jclouds-test-1\"}, {\"href\": \"/v1/queues/jclouds-test-10\", \"name\": \"jclouds-test-10\"}, {\"href\": \"/v1/queues/jclouds-test-11\", \"name\": \"jclouds-test-11\"}, {\"href\": \"/v1/queues/jclouds-test-12\", \"name\": \"jclouds-test-12\"}, {\"href\": \"/v1/queues/jclouds-test-2\", \"name\": \"jclouds-test-2\"}, {\"href\": \"/v1/queues/jclouds-test-3\", \"name\": \"jclouds-test-3\"}], \"links\": [{\"href\": \"/v1/queues?marker=jclouds-test-3&limit=6\", \"rel\": \"next\"}]}"));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"queues\": [{\"href\": \"/v1/queues/jclouds-test-4\", \"name\": \"jclouds-test-4\"}, {\"href\": \"/v1/queues/jclouds-test-5\", \"name\": \"jclouds-test-5\"}, {\"href\": \"/v1/queues/jclouds-test-6\", \"name\": \"jclouds-test-6\"}, {\"href\": \"/v1/queues/jclouds-test-7\", \"name\": \"jclouds-test-7\"}, {\"href\": \"/v1/queues/jclouds-test-8\", \"name\": \"jclouds-test-8\"}, {\"href\": \"/v1/queues/jclouds-test-9\", \"name\": \"jclouds-test-9\"}], \"links\": [{\"href\": \"/v1/queues?marker=jclouds-test-9&limit=6\", \"rel\": \"next\"}]}"));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);

         Queues queues = queueApi.list(limit(6));

         while (queues.nextMarker().isPresent()) {
            assertEquals(queues.size(), 6);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);
         Map<String, String> metadata = ImmutableMap.of("key1", "value1");
         boolean success = queueApi.setMetadata("jclouds-test", metadata);

         assertTrue(success);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"key1\":\"value1\"}"));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         QueueApi queueApi = api.getQueueApiForZoneAndClient("DFW", CLIENT_ID);
         Map<String, String> metadata = queueApi.getMetadata("jclouds-test");

         assertEquals(metadata.get("key1"), "value1");

         assertEquals(server.getRequestCount(), 2);
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.marconi.v1.features.QueueApiMockTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.