use of uk.gov.gchq.gaffer.data.generator.CsvGenerator in project gaffer-doc by gchq.
the class CsvGeneratorExample method elementsToCsv.
public void elementsToCsv() {
// ---------------------------------------------------------
final CsvGenerator function = new CsvGenerator.Builder().group("Group Label").vertex("Vertex Label").source("Source Label").property("count", "Count Label").constant("A Constant", "Some constant value").quoted(false).build();
// ---------------------------------------------------------
runExample(function, null, Lists.newArrayList(new Entity.Builder().group("Foo").vertex("vertex1").property("count", 1).build(), new Entity.Builder().group("Foo").vertex("vertex2").build(), new Edge.Builder().group("Bar").source("source1").dest("dest1").property("count", 1).build(), new Edge.Builder().group("Bar").source("source1").dest("dest1").build()));
}
use of uk.gov.gchq.gaffer.data.generator.CsvGenerator in project gaffer-doc by gchq.
the class CsvGeneratorExample method elementsToQuotedCsv.
public void elementsToQuotedCsv() {
// ---------------------------------------------------------
final CsvGenerator function = new CsvGenerator.Builder().group("Group Label").vertex("Vertex Label").source("Source Label").property("count", "Count Label").constant("A Constant", "Some constant value").quoted(true).build();
// ---------------------------------------------------------
runExample(function, null, Lists.newArrayList(new Entity.Builder().group("Foo").vertex("vertex1").property("count", 1).build(), new Entity.Builder().group("Foo").vertex("vertex2").build(), new Edge.Builder().group("Bar").source("source1").dest("dest1").property("count", 1).build(), new Edge.Builder().group("Bar").source("source1").dest("dest1").build()));
}
use of uk.gov.gchq.gaffer.data.generator.CsvGenerator in project Gaffer by gchq.
the class ToCsvTest method shouldShallowCloneOperation.
@Test
@Override
public void shouldShallowCloneOperation() {
// Given
final Entity input = new Entity(TestGroups.ENTITY);
final CsvGenerator generator = new CsvGenerator.Builder().group("group").build();
final ToCsv toCsv = new ToCsv.Builder().generator(generator).input(input).includeHeader(false).build();
// When
final ToCsv clone = toCsv.shallowClone();
// Then
assertNotSame(toCsv, clone);
assertThat(clone.getInput().iterator().next()).isEqualTo(input);
assertEquals(generator, clone.getElementGenerator());
assertFalse(clone.isIncludeHeader());
}
use of uk.gov.gchq.gaffer.data.generator.CsvGenerator in project Gaffer by gchq.
the class ToCsvTest method builderShouldCreatePopulatedOperation.
@Test
@Override
public void builderShouldCreatePopulatedOperation() {
// Given
final Entity input = new Entity(TestGroups.ENTITY);
final CsvGenerator generator = new CsvGenerator.Builder().group("group").build();
final ToCsv toCsv = new ToCsv.Builder().generator(generator).input(input).includeHeader(false).build();
// Then
assertThat(toCsv.getInput()).hasSize(1);
assertFalse(toCsv.isIncludeHeader());
assertEquals(generator, toCsv.getElementGenerator());
}
Aggregations