Package com.microsoft.windowsazure.services.queue.models

Examples of com.microsoft.windowsazure.services.queue.models.ListQueuesResult$Queue


public class QueueTest
{
   public static void main( String args[] )
   {
      Queue queue = new Queue()

      // use enqueue method
      queue.enqueue( -1 );
      queue.print();
      queue.enqueue( 0 );
      queue.print();
      queue.enqueue( 1 );
      queue.print();
      queue.enqueue( 5 );
      queue.print();

      // remove objects from queue
      try
      {
         Object removedObject = null;

         while ( true )
         {
            removedObject = queue.dequeue(); // use dequeue method
            System.out.printf( "%s dequeued\n", removedObject );
            queue.print();
         } // end while
      } // end try
      catch ( EmptyListException emptyListException )
      {
         emptyListException.printStackTrace();
View Full Code Here


    }

    private static Set<String> listQueues(QueueContract service, String prefix)
            throws Exception {
        HashSet<String> result = new HashSet<String>();
        ListQueuesResult list = service.listQueues(new ListQueuesOptions()
                .setPrefix(prefix));
        for (Queue item : list.getQueues()) {
            result.add(item.getName());
        }
        return result;
    }
View Full Code Here

    @Test
    public void listQueuesWorks() throws Exception {
        // Arrange

        // Act
        ListQueuesResult result = service.listQueues();

        // Assert
        assertNotNull(result);
        assertNotNull(result.getQueues());
        assertNotNull(result.getAccountName());
        assertNull(result.getMarker());
        assertEquals(0, result.getMaxResults());
        assertTrue(testQueues.length <= result.getQueues().size());
    }
View Full Code Here

    @Test
    public void listQueuesWithOptionsWorks() throws Exception {
        // Arrange

        // Act
        ListQueuesResult result = service.listQueues(new ListQueuesOptions()
                .setMaxResults(3).setPrefix(testQueuesPrefix));
        ListQueuesResult result2 = service.listQueues(new ListQueuesOptions()
                .setMarker(result.getNextMarker()).setPrefix(testQueuesPrefix)
                .setIncludeMetadata(true));

        // Assert
        assertNotNull(result);
        assertNotNull(result.getQueues());
        assertEquals(3, result.getQueues().size());
        assertEquals(3, result.getMaxResults());
        assertNotNull(result.getAccountName());
        assertNull(result.getMarker());
        assertNotNull(result.getQueues().get(0));
        assertNotNull(result.getQueues().get(0).getMetadata());
        assertNotNull(result.getQueues().get(0).getName());
        assertNotNull(result.getQueues().get(0).getUrl());

        assertNotNull(result2);
        assertNotNull(result2.getQueues());
        assertTrue(testQueues.length - 3 <= result2.getQueues().size());
        assertEquals(0, result2.getMaxResults());
        assertNotNull(result2.getAccountName());
        assertEquals(result.getNextMarker(), result2.getMarker());
        assertNotNull(result2.getQueues().get(0));
        assertNotNull(result2.getQueues().get(0).getMetadata());
        assertNotNull(result2.getQueues().get(0).getName());
        assertNotNull(result2.getQueues().get(0).getUrl());
    }
View Full Code Here

        }
    }

    private static void removeAllTestQueues() {
        try {
            ListQueuesResult listQueueResult = queueService.listQueues();
            for (Queue queue : listQueueResult.getQueues()) {
                try {
                    queueService.deleteQueue(queue.getName());
                } catch (Exception e) {
                    // e.printStackTrace();
                }
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.services.queue.models.ListQueuesResult$Queue

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.