Package org.jclouds.openstack.marconi.v1.domain

Examples of org.jclouds.openstack.marconi.v1.domain.Message$Builder


      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

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"messages\":{\"claimed\":0,\"total\":0,\"free\":0}}"));

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

         assertEquals(stats.getMessagesStats().getClaimed(), 0);
         assertEquals(stats.getMessagesStats().getFree(), 0);
         assertEquals(stats.getMessagesStats().getTotal(), 0);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(200).setBody("{\"messages\": {\"claimed\": 0, \"oldest\": {\"age\": 0, \"href\": \"/v1/queues/jclouds-test/messages/526558b3f4919b655feba3a7\", \"created\": \"2013-10-21T16:39:15Z\"}, \"total\": 4, \"newest\": {\"age\": 0, \"href\": \"/v1/queues/jclouds-test/messages/526558b33ac24e663fc545e7\", \"created\": \"2013-10-21T16:39:15Z\"}, \"free\": 4}}"));

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

         assertEquals(stats.getMessagesStats().getClaimed(), 0);
         assertEquals(stats.getMessagesStats().getFree(), 4);
         assertEquals(stats.getMessagesStats().getTotal(), 4);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(201).setBody("{\"partial\": false, \"resources\": [\"/v1/queues/jclouds-test/messages/526550ecef913e655ff84db8\"]}"));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

         String json1 = "{\"event\":{\"name\":\"Edmonton Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage createMessage1 = CreateMessage.builder().ttl(120).body(json1).build();
         List<CreateMessage> createMessages = ImmutableList.of(createMessage1);
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(201).setBody("{\"partial\": false, \"resources\": [\"/v1/queues/jclouds-test/messages/5265540ef4919b655da1760a\", \"/v1/queues/jclouds-test/messages/5265540ef4919b655da1760b\", \"/v1/queues/jclouds-test/messages/5265540ef4919b655da1760c\"]}"));

      try {
         MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

         String json1 = "{\"event\":{\"name\":\"Austin Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage createMessage1 = CreateMessage.builder().ttl(120).body(json1).build();
         String json2 = "{\"event\":{\"name\":\"SF Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage createMessage2 = CreateMessage.builder().ttl(120).body(json2).build();
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");
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");

         MessageStream messageStream = messageApi.stream();

         assertTrue(Iterables.isEmpty(messageStream));
         assertFalse(messageStream.nextMarker().isPresent());
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.marconi.v1.domain.Message$Builder

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.