Package eu.stratosphere.pact.runtime.test.util.TestData

Examples of eu.stratosphere.pact.runtime.test.util.TestData.Key


    int i = 0;
    while (i < num) {
      generator.next(record);
      readTarget = sorter.getRecord(readTarget, i++);
     
      Key rk = readTarget.getField(0, Key.class);
      Key gk = record.getField(0, Key.class);
     
      Value rv = readTarget.getField(1, Value.class);
      Value gv = record.getField(1, Value.class);
     
      Assert.assertEquals("The re-read key is wrong", gk, rk);
View Full Code Here


    Record readTarget = new Record();
   
    while ((readTarget = iter.next(readTarget)) != null) {
      generator.next(record);
     
      Key rk = readTarget.getField(0, Key.class);
      Key gk = record.getField(0, Key.class);
     
      Value rv = readTarget.getField(1, Value.class);
      Value gv = record.getField(1, Value.class);
     
      Assert.assertEquals("The re-read key is wrong", gk, rk);
View Full Code Here

    int i = 0;
    while (i < num) {
      generator.next(record);
      readTarget = sorter.getRecord(readTarget, i++);
     
      Key rk = readTarget.getField(0, Key.class);
      Key gk = record.getField(0, Key.class);
     
      Value rv = readTarget.getField(1, Value.class);
      Value gv = record.getField(1, Value.class);
     
      Assert.assertEquals("The re-read key is wrong", gk, rk);
View Full Code Here

    int i = num - 1;
    while (i >= 0) {
      generator.next(record);
      readTarget = sorter.getRecord(readTarget, i--);
     
      Key rk = readTarget.getField(0, Key.class);
      Key gk = record.getField(0, Key.class);
     
      Value rv = readTarget.getField(1, Value.class);
      Value gv = record.getField(1, Value.class);
     
      Assert.assertEquals("The re-read key is wrong", gk, rk);
View Full Code Here

    qs.sort(sorter);
   
    MutableObjectIterator<Record> iter = sorter.getIterator();
    Record readTarget = new Record();
   
    Key current = new Key();
    Key last = new Key();
   
    iter.next(readTarget);
    readTarget.getFieldInto(0, last);
   
    while ((readTarget = iter.next(readTarget)) != null) {
      readTarget.getFieldInto(0, current);
     
      final int cmp = last.compareTo(current);
      if (cmp > 0) {
        Assert.fail("Next key is not larger or equal to previous key.");
      }
     
      Key tmp = current;
      current = last;
      last = tmp;
    }
   
    // release the memory occupied by the buffers
View Full Code Here

 
  private MutableObjectIterator<Record> newIterator(final int[] keys, final String[] values)
  {
    return new MutableObjectIterator<Record>()
    {
      private Key key = new Key();
      private Value value = new Value();
     
      private int current = 0;

      @Override
      public Record next(Record reuse)
      {
        if (current < keys.length) {
          key.setKey(keys[current]);
          value.setValue(values[current]);
          current++;
          reuse.setField(0, key);
          reuse.setField(1, value);
          return reuse;
View Full Code Here

    MutableObjectIterator<Record> iterator = new MergeIterator<Record>(iterators, this.serializer, this.comparator);

    // check expected order
    Record rec1 = new Record();
    Record rec2 = new Record();
    final Key k1 = new Key();
    final Key k2 = new Key();
   
    int pos = 1;
   
    Assert.assertTrue((rec1 = iterator.next(rec1)) != null);
    Assert.assertEquals(expected[0], rec1.getField(0, TestData.Key.class).getKey());
   
    while ((rec2 = iterator.next(rec2)) != null) {
      k1.setKey(rec1.getField(0, TestData.Key.class).getKey());
      k2.setKey(rec2.getField(0, TestData.Key.class).getKey());
     
      Assert.assertTrue(comparator.compare(k1, k2) <= 0);
      Assert.assertEquals(expected[pos++], k2.getKey());
     
      Record tmp = rec1;
      rec1 = rec2;
      rec2 = tmp;
    }
View Full Code Here

    int elementsFound = 1;
    // check expected order
    Record rec1 = new Record();
    Record rec2 = new Record();
    final Key k1 = new Key();
    final Key k2 = new Key();
   
    Assert.assertTrue((rec1 = iterator.next(rec1)) != null);
    while ((rec2 = iterator.next(rec2)) != null) {
      elementsFound++;
      k1.setKey(rec1.getField(0, TestData.Key.class).getKey());
      k2.setKey(rec2.getField(0, TestData.Key.class).getKey());
      Assert.assertTrue(comparator.compare(k1, k2) <= 0);
     
      Record tmp = rec1;
      rec1 = rec2;
      rec2 = tmp;
View Full Code Here

    Record rec2 = new Record();
   
    Assert.assertTrue((rec1 = iterator.next(rec1)) != null);
    while ((rec2 = iterator.next(rec2)) != null)
    {
      final Key k1 = new Key();
      final Key k2 = new Key();
      k1.setKey(rec1.getField(0, TestData.Key.class).getKey());
      k2.setKey(rec2.getField(0, TestData.Key.class).getKey());
     
      if (comparator.compare(k1, k2) > 0) {
        violationFound = true;
        break;
      }
View Full Code Here

    final Record readRec = new Record();
    for (int i = 0; i < NUM_PAIRS_SHORT; i++) {
      generator.next(rec);
      readRec.read(inView);
     
      Key k1 = rec.getField(0, Key.class);
      Value v1 = rec.getField(1, Value.class);
     
      Key k2 = readRec.getField(0, Key.class);
      Value v2 = readRec.getField(1, Value.class);
     
      Assert.assertTrue("The re-generated and the read record do not match.", k1.equals(k2) && v1.equals(v2));
    }
   
View Full Code Here

TOP

Related Classes of eu.stratosphere.pact.runtime.test.util.TestData.Key

Copyright © 2018 www.massapicom. 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.