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

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


   public void createMessages() throws Exception {
      for (String zoneId : zones) {
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");

         String json1 = "{\"event\":{\"name\":\"Austin Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         CreateMessage message1 = CreateMessage.builder().ttl(120).body(json1).build();
         String json2 = "{\"event\":{\"name\":\"SF Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}";
         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);
View Full Code Here


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

         Message message = messageApi.get(getLast(messageIds.get(zoneId)));

         assertNotNull(message.getId());
         assertNotNull(message.getBody());
      }
   }
View Full Code Here

   public void deleteMessagesByClaimId() throws Exception {
      for (String zoneId : zones) {
         UUID clientId = UUID.fromString("3381af92-2b9e-11e3-b191-71861300734c");
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");
         ClaimApi claimApi = api.getClaimApiForZoneAndClientAndQueue(zoneId, clientId, "jclouds-test");
         Message message = getOnlyElement(claimApi.claim(300, 100, 1));

         boolean success = messageApi.deleteByClaim(message.getId(), message.getClaimId().get());

         assertTrue(success);
      }
   }
View Full Code Here

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

         Message message = messageApi.get("5292b30cef913e6d026f4dec");

         assertEquals(message.getId(), "5292b30cef913e6d026f4dec");
         assertEquals(message.getBody(), "{\"event\":{\"name\":\"Edmonton Java User Group\",\"attendees\":[\"bob\",\"jim\",\"sally\"]}}");
         assertEquals(message.getAge(), 266);
         assertEquals(message.getTTL(), 86400);

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

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

         Message message = messageApi.get(getLast(messageIds.get(zoneId)));

         assertNotNull(message.getId());
         assertNotNull(message.getBody());
      }
   }
View Full Code Here

   public void deleteMessagesByClaimId() throws Exception {
      for (String zoneId : zones) {
         UUID clientId = UUID.fromString("3381af92-2b9e-11e3-b191-71861300734c");
         MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue(zoneId, CLIENT_ID, "jclouds-test");
         ClaimApi claimApi = api.getClaimApiForZoneAndClientAndQueue(zoneId, clientId, "jclouds-test");
         Message message = getOnlyElement(claimApi.claim(300, 100, 1));

         boolean success = messageApi.deleteByClaim(message.getId(), message.getClaimId().get());

         assertTrue(success);
      }
   }
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

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

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /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.