Package org.simpleframework.transport

Examples of org.simpleframework.transport.Cursor.ready()


     
         while(!header.isFinished()) {
            header.consume(cursor);
         }
        
         assertEquals(cursor.ready(), -1);
         assertEquals(header.getPath().getPath(), path);    
      }
      System.err.printf("%s time=%s%n", path, (System.currentTimeMillis() - start));
   }
  
View Full Code Here


     
         while(!header.isFinished()) {
            header.consume(cursor);
         }
        
         assertEquals(cursor.ready(), -1);
         assertEquals(header.getTarget(), "/index.html");
         assertEquals(header.getMethod(), "POST");
         assertEquals(header.getMajor(), 1);
         assertEquals(header.getMinor(), 0);
         assertEquals(header.getValue("Content-Length"), "42");
View Full Code Here

      Cursor cursor = new DribbleCursor(new StreamCursor(SOURCE_1), 1);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getTarget(), "/index.html");
      assertEquals(header.getMethod(), "POST");
      assertEquals(header.getMajor(), 1);
      assertEquals(header.getMinor(), 0);
      assertEquals(header.getValue("Content-Length"), "42");
View Full Code Here

      assertEquals(list.size(), 1);
      assertEquals(list.get(0).getContentType().getPrimary(), "text");
      assertEquals(list.get(0).getContentType().getSecondary(), "plain");
      assertEquals(list.get(0).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file1.txt'");
      assertEquals(list.get(0).getContent(), "example contents of file1.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(consumer.getContent(), SIMPLE);
   }
  
   public void testNormal() throws Exception {
      PartList list = new PartList();
View Full Code Here

      assertEquals(list.get(1).getContent(), "example contents of file2.txt");
      assertEquals(list.get(2).getContentType().getPrimary(), "text");
      assertEquals(list.get(2).getContentType().getSecondary(), "plain");
      assertEquals(list.get(2).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file3.txt'");
      assertEquals(list.get(2).getContent(), "example contents of file3.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(consumer.getContent(), NORMAL);
   }
  
   public void testMixed() throws Exception {
      PartList list = new PartList();
View Full Code Here

      assertEquals(list.get(2).getContent(), "example contents of file3.txt ...");
      assertEquals(list.get(3).getContentType().getPrimary(), "text");
      assertEquals(list.get(3).getContentType().getSecondary(), "plain");
      assertEquals(list.get(3).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file4.txt'");
      assertEquals(list.get(3).getContent(), "example contents of file4.txt ...");
      assertEquals(cursor.ready(), -1);          
      assertEquals(consumer.getContent(), MIXED);
   }
  
   public void testDribble() throws Exception {
      PartList list = new PartList();
View Full Code Here

      assertEquals(list.get(1).getContent(), "example contents of file2.txt");
      assertEquals(list.get(2).getContentType().getPrimary(), "text");
      assertEquals(list.get(2).getContentType().getSecondary(), "plain");
      assertEquals(list.get(2).getHeader("Content-Disposition"), "form-data; name='pics'; filename='file3.txt'");
      assertEquals(list.get(2).getContent(), "example contents of file3.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(consumer.getContent(), NORMAL);
   }
  
   public static void main(String[] list) throws Exception {
      new PartListConsumerTest().testMixed();
View Full Code Here

      Cursor cursor = new StreamCursor(SOURCE);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Pragma"), null);
      assertEquals(header.getValue("User-Agent"), "");
      assertEquals(header.getValue("Content-Length"), "42");
      assertEquals(header.getValue("Content-Type"), "application/x-www-form-urlencoded");
      assertEquals(header.getValue("Host"), "some.host.com");
View Full Code Here

      Cursor cursor = new StreamCursor(EMPTY);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Accept-Language"), "");
      assertEquals(header.getValue("Content-Length"), "");
      assertEquals(header.getValue("Content-Type"), "");
      assertEquals(header.getValue("Content-Disposition"), "");
      assertEquals(header.getValue("Transfer-Encoding"), "");
View Full Code Here

      Cursor cursor = new DribbleCursor(new StreamCursor(SOURCE), 1);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      assertEquals(cursor.ready(), -1);
      assertEquals(header.getValue("Content-Length"), "42");
      assertEquals(header.getValue("Content-Type"), "application/x-www-form-urlencoded");
      assertEquals(header.getValue("Host"), "some.host.com");
      assertEquals(header.getValues("Accept").size(), 4);
      assertEquals(header.getValues("Accept").get(0), "image/gif");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.