Examples of StreamCursor


Examples of com.youtube.vitess.vtgate.cursor.StreamCursor

    }
    if (response.getSession() != null) {
      session = response.getSession();
    }
    if (query.isStreaming()) {
      return new StreamCursor(response.getResult(), client);
    }
    return new CursorImpl(response.getResult());
  }
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

   public void testNoFinalCRLF() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
     
      while(!consumer.isFinished()) {
         consumer.consume(cursor);
     
      assertEquals(consumer.getBody().getContent(), SOURCE);
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

   public void testNoFinalCRLSWithDribble() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 1);
     
      while(!consumer.isFinished()) {
         consumer.consume(dribble);
     
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

   public void testNoFinalCRLSWithDribble3() throws Exception {
      byte[] data = SOURCE.getBytes("UTF-8");
      byte[] boundary = "mxvercagiykxaqsdvrfabfhfpaseejrg".getBytes("UTF-8");
      Allocator allocator = new ArrayAllocator();
      FileUploadConsumer consumer = new FileUploadConsumer(allocator, boundary, data.length);     
      Cursor cursor = new StreamCursor(data);
      DribbleCursor dribble = new DribbleCursor(cursor, 3);
     
      while(!consumer.isFinished()) {
         consumer.consume(dribble);
     
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

   public void setUp() {
      boundary = new BoundaryConsumer(new ArrayAllocator(), BOUNDARY);
   }
  
   public void testBoundary() throws Exception {
      StreamCursor cursor = new StreamCursor(new ByteArrayInputStream(NORMAL));
     
      while(!boundary.isFinished()) {
         boundary.consume(cursor);
      }
      assertEquals(cursor.read(), 'X');
      assertEquals(cursor.read(), 'Y');
      assertTrue(boundary.isFinished());
      assertFalse(boundary.isEnd());
      assertFalse(cursor.isReady());
   }
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

      assertFalse(boundary.isEnd());
      assertFalse(cursor.isReady());
   }
  
   public void testTerminal() throws Exception {
      StreamCursor cursor = new StreamCursor(new ByteArrayInputStream(TERMINAL));
     
      while(!boundary.isFinished()) {
         boundary.consume(cursor);
      }
      assertEquals(cursor.read(), 'X');
      assertEquals(cursor.read(), 'Y');
      assertTrue(boundary.isFinished());
      assertTrue(boundary.isEnd());
      assertFalse(cursor.isReady());
   }
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

      assertTrue(boundary.isEnd());
      assertFalse(cursor.isReady());
   }
  
   public void testDribble() throws Exception {
      DribbleCursor cursor = new DribbleCursor(new StreamCursor(new ByteArrayInputStream(TERMINAL)), 3);
     
      while(!boundary.isFinished()) {
         boundary.consume(cursor);
      }  
      assertEquals(cursor.read(), 'X');
      assertEquals(cursor.read(), 'Y');
      assertTrue(boundary.isFinished());
      assertTrue(boundary.isEnd());
      assertFalse(cursor.isReady());
     
      boundary.clear();
     
      cursor = new DribbleCursor(new StreamCursor(new ByteArrayInputStream(TERMINAL)), 1);
     
      while(!boundary.isFinished()) {
         boundary.consume(cursor);
      }  
      assertEquals(cursor.read(), 'X');
View Full Code Here

Examples of org.simpleframework.http.core.StreamCursor

   public void setUp() throws IOException {
      header = new SegmentConsumer();
   }
  
   public void testHeader() throws Exception
      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

Examples of org.simpleframework.http.core.StreamCursor

      assertEquals(header.getContentType().getSecondary(), "x-www-form-urlencoded");
      assertEquals(header.getTransferEncoding(), "chunked");     
   }
  
   public void testEmptyHeader() throws Exception
      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

Examples of org.simpleframework.http.core.StreamCursor

      assertEquals(header.getContentType().getPrimary(), null);
      assertEquals(header.getContentType().getSecondary(), null);  
   }
  
   public void testDribble() throws Exception
      Cursor cursor = new DribbleCursor(new StreamCursor(SOURCE), 1);
     
      while(!header.isFinished()) {
         header.consume(cursor);
      }     
      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.