Search in sources :

Example 6 with Range

use of org.jgroups.util.Range in project JGroups by belaban.

the class MessageTest method testComputeFragOffsets3.

public void testComputeFragOffsets3() {
    byte[] buf = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    java.util.List<Range> retval = Util.computeFragOffsets(buf, 100);
    System.out.println("list is " + retval);
    Assert.assertEquals(1, retval.size());
    Range r = retval.get(0);
    Assert.assertEquals(0, r.low);
    Assert.assertEquals(10, r.high);
}
Also used : Range(org.jgroups.util.Range)

Example 7 with Range

use of org.jgroups.util.Range in project JGroups by belaban.

the class MessageTest method testComputeFragOffsets.

public void testComputeFragOffsets() {
    byte[] buf = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    java.util.List<Range> retval = Util.computeFragOffsets(buf, 4);
    System.out.println("list is " + retval);
    Assert.assertEquals(3, retval.size());
    Range r = retval.get(0);
    Assert.assertEquals(0, r.low);
    Assert.assertEquals(4, r.high);
    r = retval.get(1);
    Assert.assertEquals(4, r.low);
    Assert.assertEquals(4, r.high);
    r = retval.get(2);
    Assert.assertEquals(8, r.low);
    Assert.assertEquals(2, r.high);
}
Also used : Range(org.jgroups.util.Range)

Aggregations

Range (org.jgroups.util.Range)7 Address (org.jgroups.Address)2 Message (org.jgroups.Message)2 BytesMessage (org.jgroups.BytesMessage)1 FragmentedMessage (org.jgroups.FragmentedMessage)1