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

Examples of org.jclouds.openstack.marconi.v1.domain.Aged


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

         MessageStream messageStream = messageApi.stream();

         while (messageStream.nextMarker().isPresent()) {
            assertEquals(Iterables.size(messageStream), 6);

            messageStream = messageApi.stream(messageStream.nextStreamOptions());
         }

         assertFalse(messageStream.nextMarker().isPresent());

         assertEquals(server.getRequestCount(), 3);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages?marker=4512 HTTP/1.1");
View Full Code Here


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

         MessageStream messageStream = messageApi.stream(limit(2));

         while (messageStream.nextMarker().isPresent()) {
            assertEquals(Iterables.size(messageStream), 2);

            messageStream = messageApi.stream(messageStream.nextStreamOptions());
         }

         assertFalse(messageStream.nextMarker().isPresent());

         assertEquals(server.getRequestCount(), 5);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages?limit=2 HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages?marker=4508&limit=2 HTTP/1.1");
View Full Code Here

   @Test(dependsOnMethods = { "createQueues" })
   public void streamZeroPagesOfMessages() throws Exception {
      for (String zoneId : zones) {
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

         MessageStream messageStream = messageApi.stream(echo(true));

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

   @Test(dependsOnMethods = { "createMessage" })
   public void streamOnePageOfMessages() throws Exception {
      for (String zoneId : zones) {
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

         MessageStream messageStream = messageApi.stream(echo(true));

         while(messageStream.nextMarker().isPresent()) {
            assertEquals(Iterables.size(messageStream), 1);

            messageStream = messageApi.stream(messageStream.nextStreamOptions());
         }

         assertFalse(messageStream.nextMarker().isPresent());
      }
   }
View Full Code Here

   public void streamManyPagesOfMessages() throws Exception {
      for (String zoneId : zones) {
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");
         messageIds.put(zoneId, new ArrayList<String>());

         MessageStream messageStream = messageApi.stream(echo(true).limit(2));

         while(messageStream.nextMarker().isPresent()) {
            assertEquals(Iterables.size(messageStream), 2);

            for (Message message: messageStream) {
               messageIds.get(zoneId).add(message.getId());
            }

            messageStream = messageApi.stream(messageStream.nextStreamOptions());
         }

         assertFalse(messageStream.nextMarker().isPresent());
      }
   }
View Full Code Here

         CreateMessage message2 = CreateMessage.builder().ttl(86400).body(json2).build();
         String json3 = "{\"event\":{\"name\":\"HK Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage message3 = CreateMessage.builder().ttl(86400).body(json3).build();
         List<CreateMessage> messages = ImmutableList.of(message1, message2, message3);

         MessagesCreated messagesCreated = messageApi.create(messages);

         assertNotNull(messagesCreated);
         assertEquals(messagesCreated.getMessageIds().size(), 3);
      }
   }
View Full Code Here

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

         MessagesCreated messagesCreated = messageApi.create(message);

         assertNotNull(messagesCreated);
         assertEquals(messagesCreated.getMessageIds().size(), 1);
      }
   }
View Full Code Here

         CreateMessage message2 = CreateMessage.builder().ttl(120).body(json2).build();
         String json3 = "{\"event\":{\"name\":\"HK Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage message3 = CreateMessage.builder().ttl(120).body(json3).build();
         List<CreateMessage> messages = ImmutableList.of(message1, message2, message3);

         MessagesCreated messagesCreated = messageApi.create(messages);

         assertNotNull(messagesCreated);
         assertEquals(messagesCreated.getMessageIds().size(), 3);
      }
   }
View Full Code Here

         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);

         MessagesCreated messagesCreated = messageApi.create(createMessages);

         assertNotNull(messagesCreated);
         assertEquals(messagesCreated.getMessageIds().size(), 1);
         assertEquals(messagesCreated.getMessageIds().get(0), "526550ecef913e655ff84db8");

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "POST /v1/123123/queues/jclouds-test/messages HTTP/1.1");
      }
View Full Code Here

         CreateMessage createMessage2 = CreateMessage.builder().ttl(120).body(json2).build();
         String json3 = "{\"event\":{\"name\":\"HK Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage createMessage3 = CreateMessage.builder().ttl(120).body(json3).build();
         List<CreateMessage> createMessages = ImmutableList.of(createMessage1, createMessage2, createMessage3);

         MessagesCreated messagesCreated = messageApi.create(createMessages);

         assertNotNull(messagesCreated);
         assertEquals(messagesCreated.getMessageIds().size(), 3);
         assertTrue(messagesCreated.getMessageIds().contains("5265540ef4919b655da1760a"));
         assertTrue(messagesCreated.getMessageIds().contains("5265540ef4919b655da1760b"));
         assertTrue(messagesCreated.getMessageIds().contains("5265540ef4919b655da1760c"));

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "POST /v1/123123/queues/jclouds-test/messages HTTP/1.1");
      }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.marconi.v1.domain.Aged

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.