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

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


    final int INPUT_1_DUPLICATES = 10;
    final int INPUT_2_DUPLICATES = 2000;
    final int DUPLICATE_KEY = 13;
   
    try {
      Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
     
      final TestData.GeneratorIterator gen1Iter = new TestData.GeneratorIterator(generator1, INPUT_1_SIZE);
      final TestData.GeneratorIterator gen2Iter = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      final TestData.ConstantValueIterator const1Iter = new TestData.ConstantValueIterator(DUPLICATE_KEY, "LEFT String for Duplicate Keys", INPUT_1_DUPLICATES);
      final TestData.ConstantValueIterator const2Iter = new TestData.ConstantValueIterator(DUPLICATE_KEY, "RIGHT String for Duplicate Keys", INPUT_2_DUPLICATES);
     
      final List<MutableObjectIterator<Record>> inList1 = new ArrayList<MutableObjectIterator<Record>>();
      inList1.add(gen1Iter);
      inList1.add(const1Iter);
     
      final List<MutableObjectIterator<Record>> inList2 = new ArrayList<MutableObjectIterator<Record>>();
      inList2.add(gen2Iter);
      inList2.add(const2Iter);
     
      MutableObjectIterator<Record> input1 = new UnionIterator<Record>(inList1);
      MutableObjectIterator<Record> input2 = new UnionIterator<Record>(inList2);
     
     
      // collect expected data
      final Map<TestData.Key, Collection<RecordMatch>> expectedMatchesMap = matchRecordValues(
        collectRecordData(input1),
        collectRecordData(input2));
     
      // re-create the whole thing for actual processing
     
      // reset the generators and iterators
      generator1.reset();
      generator2.reset();
      const1Iter.reset();
      const2Iter.reset();
      gen1Iter.reset();
      gen2Iter.reset();
     
View Full Code Here


  }
 
  @Test
  public void testBuildSecond() {
    try {
      Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
     
      final TestData.GeneratorIterator input1 = new TestData.GeneratorIterator(generator1, INPUT_1_SIZE);
      final TestData.GeneratorIterator input2 = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      // collect expected data
      final Map<TestData.Key, Collection<RecordMatch>> expectedMatchesMap = matchRecordValues(
        collectRecordData(input1),
        collectRecordData(input2));
     
      final JoinFunction matcher = new RecordMatchRemovingJoin(expectedMatchesMap);
      final Collector<Record> collector = new DiscardingOutputCollector<Record>();
 
      // reset the generators
      generator1.reset();
      generator2.reset();
      input1.reset();
      input2.reset();
 
      // compare with iterator values     
      BuildSecondHashMatchIterator<Record, Record, Record> iterator =
View Full Code Here

    final int INPUT_1_DUPLICATES = 10;
    final int INPUT_2_DUPLICATES = 2000;
    final int DUPLICATE_KEY = 13;
   
    try {
      Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
     
      final TestData.GeneratorIterator gen1Iter = new TestData.GeneratorIterator(generator1, INPUT_1_SIZE);
      final TestData.GeneratorIterator gen2Iter = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      final TestData.ConstantValueIterator const1Iter = new TestData.ConstantValueIterator(DUPLICATE_KEY, "LEFT String for Duplicate Keys", INPUT_1_DUPLICATES);
      final TestData.ConstantValueIterator const2Iter = new TestData.ConstantValueIterator(DUPLICATE_KEY, "RIGHT String for Duplicate Keys", INPUT_2_DUPLICATES);
     
      final List<MutableObjectIterator<Record>> inList1 = new ArrayList<MutableObjectIterator<Record>>();
      inList1.add(gen1Iter);
      inList1.add(const1Iter);
     
      final List<MutableObjectIterator<Record>> inList2 = new ArrayList<MutableObjectIterator<Record>>();
      inList2.add(gen2Iter);
      inList2.add(const2Iter);
     
      MutableObjectIterator<Record> input1 = new UnionIterator<Record>(inList1);
      MutableObjectIterator<Record> input2 = new UnionIterator<Record>(inList2);
     
     
      // collect expected data
      final Map<TestData.Key, Collection<RecordMatch>> expectedMatchesMap = matchRecordValues(
        collectRecordData(input1),
        collectRecordData(input2));
     
      // re-create the whole thing for actual processing
     
      // reset the generators and iterators
      generator1.reset();
      generator2.reset();
      const1Iter.reset();
      const2Iter.reset();
      gen1Iter.reset();
      gen2Iter.reset();
     
View Full Code Here

  @Test
  public void testBuildFirstWithMixedDataTypes() {
    try {
      MutableObjectIterator<IntPair> input1 = new UniformIntPairGenerator(500, 40, false);
     
      final Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      final TestData.GeneratorIterator input2 = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      // collect expected data
      final Map<TestData.Key, Collection<RecordIntPairMatch>> expectedMatchesMap = matchRecordIntPairValues(
        collectIntPairData(input1),
        collectRecordData(input2));
     
      final GenericJoiner<IntPair, Record, Record> matcher = new RecordIntPairMatchRemovingMatcher(expectedMatchesMap);
      final Collector<Record> collector = new DiscardingOutputCollector<Record>();
 
      // reset the generators
      input1 = new UniformIntPairGenerator(500, 40, false);
      generator2.reset();
      input2.reset();
 
      // compare with iterator values
      BuildSecondHashMatchIterator<IntPair, Record, Record> iterator =
          new BuildSecondHashMatchIterator<IntPair, Record, Record>(
View Full Code Here

  @Test
  public void testBuildSecondWithMixedDataTypes() {
    try {
      MutableObjectIterator<IntPair> input1 = new UniformIntPairGenerator(500, 40, false);
     
      final Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      final TestData.GeneratorIterator input2 = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);
     
      // collect expected data
      final Map<TestData.Key, Collection<RecordIntPairMatch>> expectedMatchesMap = matchRecordIntPairValues(
        collectIntPairData(input1),
        collectRecordData(input2));
     
      final GenericJoiner<IntPair, Record, Record> matcher = new RecordIntPairMatchRemovingMatcher(expectedMatchesMap);
      final Collector<Record> collector = new DiscardingOutputCollector<Record>();
 
      // reset the generators
      input1 = new UniformIntPairGenerator(500, 40, false);
      generator2.reset();
      input2.reset();
 
      // compare with iterator values
      BuildFirstHashMatchIterator<IntPair, Record, Record> iterator =
          new BuildFirstHashMatchIterator<IntPair, Record, Record>(
View Full Code Here

TOP

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

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.