Package net.tomp2p.storage

Examples of net.tomp2p.storage.DataBuffer.bytes()


    byte[] oldValue = "ZurichGenevaLuganoAAA".getBytes();
    byte[] newValue = "AzurichGenevaLuganoAbbLuganoAAA".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }
 
  @Test
  public void testGetReconstructedValueStatic1() throws IOException, NoSuchAlgorithmException {
    // oldValue and newValue are set manually
View Full Code Here


    byte[] oldValue = "ZurichGenevaLuganoAA".getBytes();
    byte[] newValue = "AzurichGenevaLuganoAbbLuganoAAA".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }
 
  @Test
  public void testGetReconstructedValueStatic2() throws IOException, NoSuchAlgorithmException {
    // oldValue and newValue are set manually
View Full Code Here

    byte[] oldValue = "ZurichGenevaLuganoAAA".getBytes();
    byte[] newValue = "AzurichGenevaLuganoAbbLuganoAA".getBytes();
    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }

  @Test
  public void testGetReconstructedValueStatic3() throws IOException, NoSuchAlgorithmException {
    // oldValue and newValue are set manually
View Full Code Here

    List<Checksum> checksums = RSync.checksums(oldValue, size);
    List<Instruction> instructions = RSync.instructions(newValue, checksums, size);

    Assert.assertEquals(4, instructions.size());
    DataBuffer reconstructedValue = RSync.reconstruct(oldValue, instructions, size);
    Assert.assertArrayEquals(newValue, reconstructedValue.bytes());
  }

  @Test
  public void testGetReconstructedValueDynamic() throws IOException {
    for (int i = 0; i < 1000; i++) {
View Full Code Here

    System.out.println("checksums(" + checksums.size() + "): " + checksums);
    System.out.println("instructions(" + instructions.size() + "): " + instructions);

    DataBuffer reconstructedValue = RSync.reconstruct(oldValue.getBytes(), instructions, size);

    Assert.assertArrayEquals(newValue.getBytes(), reconstructedValue.bytes());
  }

  @Test
  public void testInfoMessageSAME() throws IOException, InterruptedException {
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.