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

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


      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);
         assertFalse(stats.getMessagesStats().getOldest().isPresent());
         assertFalse(stats.getMessagesStats().getNewest().isPresent());

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


      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);
         assertTrue(stats.getMessagesStats().getOldest().isPresent());
         assertTrue(stats.getMessagesStats().getOldest().get().getCreated().before(new Date()));
         assertEquals(stats.getMessagesStats().getOldest().get().getAge(), 0);
         assertEquals(stats.getMessagesStats().getOldest().get().getId(), "526558b3f4919b655feba3a7");
         assertTrue(stats.getMessagesStats().getNewest().isPresent());
         assertTrue(stats.getMessagesStats().getNewest().get().getCreated().before(new Date()));
         assertEquals(stats.getMessagesStats().getNewest().get().getAge(), 0);
         assertEquals(stats.getMessagesStats().getNewest().get().getId(), "526558b33ac24e663fc545e7");

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

      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());
      }
      finally {
         server.shutdown();
      }
   }
View Full Code Here

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

            for (Queue queue : queues) {
               assertNotNull(queue.getName());
               assertFalse(queue.getMetadata().isPresent());
            }

            queues = queueApi.list(queues.nextListQueuesOptions());
         }

         assertEquals(server.getRequestCount(), 4);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues?limit=6 HTTP/1.1");
View Full Code Here

   @Test(dependsOnMethods = { "listManyPagesOfQueues" })
   public void listManyPagesOfQueuesManually() throws Exception {
      for (String zoneId : zones) {
         QueueApi queueApi = api.getQueueApiForZoneAndClient(zoneId, CLIENT_ID);

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

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

            for (Queue queue : queues) {
               assertNotNull(queue.getName());
               assertFalse(queue.getMetadata().isPresent());
            }

            queues = queueApi.list(queues.nextListQueuesOptions());
         }
      }
   }
View Full Code Here

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

            for (Queue queue: queues) {
               assertNotNull(queue.getName());
               assertFalse(queue.getMetadata().isPresent());
            }

            queues = queueApi.list(queues.nextListQueuesOptions());
         }

         assertEquals(server.getRequestCount(), 4);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues?limit=6 HTTP/1.1");
View Full Code Here

      this.json = checkNotNull(json, "json");
   }

   @Override
   public Message apply(HttpResponse response) {
      MessageWithHref messagesWithHref = json.apply(response);

      return TO_MESSAGE.apply(messagesWithHref);
   }
View Full Code Here

      this.json = checkNotNull(json, "json");
   }

   @Override
   public Message apply(HttpResponse response) {
      MessageWithHref messagesWithHref = json.apply(response);

      return TO_MESSAGE.apply(messagesWithHref);
   }
View Full Code Here

         this.api = checkNotNull(api, "api");
      }

      public PaginatedCollection<Queue> apply(Object input) {
         PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
         ListQueuesOptions listQueuesOptions = queryParameters(paginationOptions.buildQueryParameters());

         return api.list(listQueuesOptions);
      }
View Full Code Here

         this.api = checkNotNull(api, "api");
      }

      public PaginatedCollection<Queue> apply(Object input) {
         PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
         ListQueuesOptions listQueuesOptions = queryParameters(paginationOptions.buildQueryParameters());

         return api.list(listQueuesOptions);
      }
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.