Search in sources :

Example 1 with FONDS

use of nl.knaw.huygens.timbuctoo.search.description.facet.CharterPortaalFondsFacetDescription.FONDS 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")));
}
Also used : FONDS_NAAM(nl.knaw.huygens.timbuctoo.search.description.facet.CharterPortaalFondsFacetDescription.FONDS_NAAM) MockVertexBuilder.vertex(nl.knaw.huygens.timbuctoo.search.MockVertexBuilder.vertex) Graph(org.apache.tinkerpop.gremlin.structure.Graph) Test(org.junit.Test) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) GraphTraversal(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal) ListFacetValue(nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.ListFacetValue) PropertyParser(nl.knaw.huygens.timbuctoo.search.description.PropertyParser) Mockito(org.mockito.Mockito) List(java.util.List) Lists(com.google.common.collect.Lists) Matchers.contains(org.hamcrest.Matchers.contains) VertexMatcher.likeVertex(nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex) FONDS(nl.knaw.huygens.timbuctoo.search.description.facet.CharterPortaalFondsFacetDescription.FONDS) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestGraphBuilder.newGraph(nl.knaw.huygens.timbuctoo.util.TestGraphBuilder.newGraph) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) VertexMatcher.likeVertex(nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex) Graph(org.apache.tinkerpop.gremlin.structure.Graph) TestGraphBuilder.newGraph(nl.knaw.huygens.timbuctoo.util.TestGraphBuilder.newGraph) ListFacetValue(nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.ListFacetValue) PropertyParser(nl.knaw.huygens.timbuctoo.search.description.PropertyParser) Test(org.junit.Test)

Aggregations

Lists (com.google.common.collect.Lists)1 List (java.util.List)1 MockVertexBuilder.vertex (nl.knaw.huygens.timbuctoo.search.MockVertexBuilder.vertex)1 PropertyParser (nl.knaw.huygens.timbuctoo.search.description.PropertyParser)1 FONDS (nl.knaw.huygens.timbuctoo.search.description.facet.CharterPortaalFondsFacetDescription.FONDS)1 FONDS_NAAM (nl.knaw.huygens.timbuctoo.search.description.facet.CharterPortaalFondsFacetDescription.FONDS_NAAM)1 ListFacetValue (nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.ListFacetValue)1 TestGraphBuilder.newGraph (nl.knaw.huygens.timbuctoo.util.TestGraphBuilder.newGraph)1 VertexMatcher.likeVertex (nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex)1 GraphTraversal (org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal)1 Graph (org.apache.tinkerpop.gremlin.structure.Graph)1 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Matchers.contains (org.hamcrest.Matchers.contains)1 Test (org.junit.Test)1 Mockito (org.mockito.Mockito)1