use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class CharterPortaalFondsFacetDescriptionTest method filterChecksIfTheVertexContainsTheRightFondsAndFondsNaam.
@Test
public void filterChecksIfTheVertexContainsTheRightFondsAndFondsNaam() {
// fonds is unique, but two fondsen could have the same name.
Graph graph = newGraph().withVertex(v -> v.withTimId("id1").withProperty(FONDS, "fonds").withProperty(FONDS_NAAM, "fondsNaam")).withVertex(v -> v.withProperty(FONDS, "fonds1").withProperty(FONDS_NAAM, "fondsNaam")).build();
CharterPortaalFondsFacetDescription instance = new CharterPortaalFondsFacetDescription(FACET_NAME, Mockito.mock(PropertyParser.class));
GraphTraversal<Vertex, Vertex> traversal = graph.traversal().V();
instance.filter(traversal, Lists.newArrayList(new ListFacetValue("facetName", Lists.newArrayList("fondsNaam (fonds)"))));
List<Vertex> actual = traversal.toList();
assertThat(actual, contains(likeVertex().withTimId("id1")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class DatableRangeFacetDescriptionTest method filterIncludesTheVerticesWhereOnlyTheEndFallsInTheRange.
@Test
public void filterIncludesTheVerticesWhereOnlyTheEndFallsInTheRange() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY_NAME, asSerializedDatable("2000/2015"))).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY_NAME, asSerializedDatable("0015-01"))).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).build().traversal().V();
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20140101L, 20160224L));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class DatableRangeFacetDescriptionTest method filterAddsAFilterIgnoresLastFourNumbers.
@Test
public void filterAddsAFilterIgnoresLastFourNumbers() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY_NAME, asSerializedDatable("2015-01-01"))).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY_NAME, asSerializedDatable("1000-03-02"))).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY_NAME, asSerializedDatable("2100-03-02"))).build().traversal().V();
List<FacetValue> facets = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20151001L, 20160101L));
instance.filter(traversal, facets);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class DatableRangeFacetDescriptionTest method filterIncludesTheVerticesWhereOnlyTheStartFallsInTheRange.
@Test
public void filterIncludesTheVerticesWhereOnlyTheStartFallsInTheRange() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY_NAME, asSerializedDatable("2015/2020"))).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY_NAME, asSerializedDatable("0015-01"))).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).build().traversal().V();
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20140101L, 20160101L));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class DatableRangeFacetDescriptionTest method filterAddsAFilterThatIgnoresInvalidDatables.
@Test
public void filterAddsAFilterThatIgnoresInvalidDatables() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY_NAME, asSerializedDatable("2015-01-01"))).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY_NAME, asSerializedDatable("invalidDatable"))).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY_NAME, asSerializedDatable("2100-03-02"))).build().traversal().V();
List<FacetValue> facets = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20151001L, 20160101L));
instance.filter(traversal, facets);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
Aggregations