Examples of StringWrapper


Examples of org.apache.crunch.test.StringWrapper

    AvroFileReaderFactory<StringWrapper> genericReader = createFileReaderFactory(Avros.reflects(StringWrapper.class));
    Iterator<StringWrapper> recordIterator = genericReader.read(FileSystem.getLocal(new Configuration()), new Path(
        this.avroFile.getAbsolutePath()));

    StringWrapper stringWrapper = recordIterator.next();

    assertEquals("stringvalue", stringWrapper.getValue());
    assertFalse(recordIterator.hasNext());
  }
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

  private StringWrapper stringWrapper;
  private PType ptype;

  @Before
  public void setUp() {
    stringWrapper = new StringWrapper("test");
    ptype = spy(Avros.reflects(StringWrapper.class));
  }
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

public class MapDeepCopierTest {

  @Test
  public void testDeepCopy() {
    StringWrapper stringWrapper = new StringWrapper("value");
    String key = "key";
    Map<String, StringWrapper> map = Maps.newHashMap();
    map.put(key, stringWrapper);

    MapDeepCopier<StringWrapper> deepCopier = new MapDeepCopier<StringWrapper>(
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

    public Pair<StringWrapper, Person> map(String input) {
      Person person = new Person();
      person.name = input;
      person.age = 42;
      person.siblingnames = Lists.<CharSequence> newArrayList();
      return Pair.of(new StringWrapper(input), person);
    }
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

  }

  @Test
  public void testJoin() {

    StringWrapper key = new StringWrapper();
    StringWrapper leftValue = new StringWrapper();
    key.setValue("left-only");
    leftValue.setValue("left-only-left");
    joinFn.join(key, 0, createValuePairList(leftValue, null), emitter);

    key.setValue("both");
    leftValue.setValue("both-left");
    joinFn.join(key, 0, createValuePairList(leftValue, null), emitter);
    joinFn.join(key, 1, createValuePairList(null, "both-right"), emitter);

    key.setValue("right-only");
    joinFn.join(key, 1, createValuePairList(null, "right-only-right"), emitter);
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

    PCollection<StringWrapper> stringWrapperCollection = pipeline.readTextFile(tmpDir.copyResourceFileName("set1.txt"))
        .parallelDo(new MapFn<String, StringWrapper>() {

          @Override
          public StringWrapper map(String input) {
            StringWrapper stringWrapper = new StringWrapper();
            stringWrapper.setValue(input);
            return stringWrapper;
          }
        }, Avros.reflects(StringWrapper.class));

    List<StringWrapper> stringWrappers = Lists.newArrayList(stringWrapperCollection.materialize());

    pipeline.done();

    assertEquals(Lists.newArrayList(new StringWrapper("b"), new StringWrapper("c"), new StringWrapper("a"),
        new StringWrapper("e")), stringWrappers);

  }
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

        Person person = new Person();
        person.name = input;
        person.age = 42;
        person.siblingnames = Lists.<CharSequence> newArrayList(input);

        return Pair.of(new StringWrapper(input), person);
      }
    }, Avros.pairs(Avros.reflects(StringWrapper.class), Avros.records(Person.class)));

    PCollection<Pair<String, Long>> countCollection = Aggregate.count(hybridPairCollection).parallelDo(
        new MapFn<Pair<Pair<StringWrapper, Person>, Long>, Pair<String, Long>>() {
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

        Avros.reflects(StringWrapper.class)));

    List<StringWrapper> recordList = Lists.newArrayList(stringValueCollection.materialize());

    assertEquals(1, recordList.size());
    StringWrapper stringWrapper = recordList.get(0);
    assertEquals("stringvalue", stringWrapper.getValue());
  }
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

  }

  @Test
  public void testPairOutputMapFn_VerifyNoObjectReuse() {
    StringWrapper stringWrapper = new StringWrapper("Test");

    Pair<Integer, StringWrapper> pair = Pair.of(1, stringWrapper);

    AvroType<Pair<Integer, StringWrapper>> pairType = Avros.pairs(Avros.ints(), Avros.reflects(StringWrapper.class));
View Full Code Here

Examples of org.apache.crunch.test.StringWrapper

        Avros.reflects(StringWrapper.class)));

    List<StringWrapper> recordList = Lists.newArrayList(stringValueCollection.materialize());

    assertEquals(1, recordList.size());
    StringWrapper stringWrapper = recordList.get(0);
    assertEquals("stringvalue", stringWrapper.getValue());
  }
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.