Code example for ByteArrayOutputStream

Methods: toString

0
  { 
    Checkpoint cp = Checkpoint.createOnlineConsumptionCheckpoint(1234L);
    cp.setWindowOffset(5677);
    cp.setPrevScn(1233L);
 
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    cp.serialize(baos);
    //System.out.println("Serialized String="+ baos.toString()); 
    Checkpoint newCp = new Checkpoint(baos.toString());
    Assert.assertTrue(newCp.assertCheckpoint());
    assertEquals(cp, newCp);
    Assert.assertEquals(cp.hashCode(), newCp.hashCode());
  } 
 
  @Test 
  public void testLargeOffsets() throws JsonParseException, JsonMappingException, IOException 
  { 
	    Checkpoint cp = new Checkpoint();
	    cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
	    cp.setWindowScn(1234L);
	    cp.setWindowOffset(Long.MAX_VALUE-1);