Package org.simpleframework.transport

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


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


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

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

      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("\r\n");
     
      consumer.consume(cursor);
     
      assertEquals(cursor.ready(), -1);
      assertTrue(consumer.isFinished())
   }
  
   public void testTokenConsumerException() throws IOException {
      Allocator allocator = new ArrayAllocator();
View Full Code Here

      assertEquals(list.get(2).getContentType().getSecondary(), "plain");
      assertEquals(list.get(2).getHeader("Content-Disposition"), "form-data; name='pics'; filename='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(cursor.ready(), -1);       
   }    

}
View Full Code Here

      assertEquals(list.get(3).getContentType().getSecondary(), "plain");
      assertEquals(list.get(3).getHeader("Content-Disposition"), "file; name=\"pics\"; filename=\"file4.txt\"");
      assertEquals(list.get(3).getName(), "pics");
      assertEquals(list.get(3).getFileName(), "file4.txt");
      assertEquals(list.get(3).isFile(), true);
      assertEquals(cursor.ready(), -1);
   }

   public void stop() throws IOException {}   
}
View Full Code Here

      TokenConsumer consumer = new TokenConsumer(allocator, "\r\n".getBytes());
      Cursor cursor = new StreamCursor("\r\n");
     
      consumer.consume(cursor);
     
      assertEquals(cursor.ready(), -1);
      assertTrue(consumer.isFinished())
   }
  
   public void testTokenConsumerException() throws IOException {
      Allocator allocator = new ArrayAllocator();
View Full Code Here

      Cursor cursor = sender.getCursor();
     
      while(!validator.isFinished()) {
         validator.consume(cursor);
      }
      assertEquals(cursor.ready(), -1);
      assertTrue(monitor.isReady());
   }
}
View Full Code Here

      assertEquals(list.get(3).getName(), "file4");
      assertEquals(list.get(3).getFileName(), "file4.txt");
      assertEquals(list.get(3).isFile(), true);
      assertEquals(list.get(3).getContent(), "example contents of file4.txt ...");
      assertEquals(request.getForm().getPart("file4").getContent(), "example contents of file4.txt ...");
      assertEquals(cursor.ready(), -1);    
      assertEquals(request.getContent(), BODY);     
   }
  
   public static class MockChannel implements Channel {
     
View Full Code Here

      assertEquals(list.get(2).getContentType().getSecondary(), "plain");
      assertEquals(list.get(2).getHeader("Content-Disposition"), "form-data; name='pics'; filename='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(cursor.ready(), -1);       
   }    

}
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.