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

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


 
  @Test
  public void testMerge() {
    try {
     
      generator1 = new Generator(SEED1, 500, 4096, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
      generator2 = new Generator(SEED2, 500, 2048, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);

      reader1 = new TestData.GeneratorIterator(generator1, INPUT_1_SIZE);
      reader2 = new TestData.GeneratorIterator(generator2, INPUT_2_SIZE);

      // collect expected data
View Full Code Here


 
  @Test
  public void testSortBothMerge() {
    try {
     
      Generator generator1 = new Generator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, INPUT_2_SIZE, 100, 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);
     
      final JoinFunction matcher = new NoOpMatcher();
View Full Code Here

  }
 
  @Test
  public void testBuildFirst() {
    try {
      Generator generator1 = new Generator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, INPUT_2_SIZE, 100, 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);
     
      final JoinFunction matcher = new NoOpMatcher();
View Full Code Here

  }
 
  @Test
  public void testBuildSecond() {
    try {
      Generator generator1 = new Generator(SEED1, INPUT_1_SIZE / 10, 100, KeyMode.RANDOM, ValueMode.RANDOM_LENGTH);
      Generator generator2 = new Generator(SEED2, INPUT_2_SIZE, 100, 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);
     
      final JoinFunction matcher = new NoOpMatcher();
View Full Code Here

 
  @Test
  public void testMerge() {
    try {
     
      final TestData.Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
      final TestData.Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.SORTED, 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<Match>> expectedMatchesMap = matchValues(
        collectData(input1),
        collectData(input2));
     
      final JoinFunction matcher = new MatchRemovingMatcher(expectedMatchesMap);
     
      final Collector<Record> collector = new DiscardingOutputCollector<Record>();
 
      // reset the generators
      generator1.reset();
      generator2.reset();
      input1.reset();
      input2.reset();
 
      // compare with iterator values
      MergeMatchIterator<Record, Record, Record> iterator =
View Full Code Here

    final int INPUT_1_DUPLICATES = 10;
    final int INPUT_2_DUPLICATES = 4000;
    final int DUPLICATE_KEY = 13;
   
    try {
      final TestData.Generator generator1 = new Generator(SEED1, 500, 4096, KeyMode.SORTED, ValueMode.RANDOM_LENGTH);
      final TestData.Generator generator2 = new Generator(SEED2, 500, 2048, KeyMode.SORTED, 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 MergeIterator<Record>(inList1, serializer1, comparator1.duplicate());
      MutableObjectIterator<Record> input2 = new MergeIterator<Record>(inList2, serializer2, comparator2.duplicate());
     
      // collect expected data
      final Map<TestData.Key, Collection<Match>> expectedMatchesMap = matchValues(
        collectData(input1),
        collectData(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

  public void testOverflow() {
   
    int buildSize = 1000;
    int probeSize = 1000;
    try {
      Generator bgen = new Generator(SEED1, 200, 1024, KeyMode.RANDOM, ValueMode.FIX_LENGTH);
      Generator pgen = new Generator(SEED2, 0, 1024, KeyMode.SORTED, ValueMode.FIX_LENGTH);
     
      final TestData.GeneratorIterator buildInput = new TestData.GeneratorIterator(bgen, buildSize);
      final TestData.GeneratorIterator probeInput = new TestData.GeneratorIterator(pgen, probeSize);
      doTest(buildInput,probeInput, bgen, pgen);
    }
View Full Code Here

  public void testDoubleProbeSpilling() {
   
    int buildSize = 1000;
    int probeSize = 1000;
    try {
      Generator bgen = new Generator(SEED1, 0, 1024, KeyMode.SORTED, ValueMode.FIX_LENGTH);
      Generator pgen = new Generator(SEED2, 0, 1024, KeyMode.SORTED, ValueMode.FIX_LENGTH);
     
      final TestData.GeneratorIterator buildInput = new TestData.GeneratorIterator(bgen, buildSize);
      final TestData.GeneratorIterator probeInput = new TestData.GeneratorIterator(pgen, probeSize);
      doTest(buildInput,probeInput, bgen, pgen);
    }
View Full Code Here

  public void testDoubleProbeInMemory() {
   
    int buildSize = 1000;
    int probeSize = 1000;
    try {
      Generator bgen = new Generator(SEED1, 0, 28, KeyMode.SORTED, ValueMode.FIX_LENGTH);
      Generator pgen = new Generator(SEED2, 0, 28, KeyMode.SORTED, ValueMode.FIX_LENGTH);
     
      final TestData.GeneratorIterator buildInput = new TestData.GeneratorIterator(bgen, buildSize);
      final TestData.GeneratorIterator probeInput = new TestData.GeneratorIterator(pgen, probeSize);
     
      doTest(buildInput,probeInput, bgen, pgen);
View Full Code Here


  @Test
  public void testBuildFirst() {
    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
      BuildFirstHashMatchIterator<Record, Record, Record> iterator =
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.