Search in sources :

Example 1 with LoadByIdsDelegate

use of org.neo4j.ogm.session.delegates.LoadByIdsDelegate in project neo4j-ogm by neo4j.

the class StrictQueryingTest method shouldUseOnlyOneLabelForStandardEntity.

// GH-651
@Test
public void shouldUseOnlyOneLabelForStandardEntity() {
    LoadByIdsDelegate delegate = new LoadByIdsDelegate(neo4jSession);
    delegate.loadAll(SomeEntity.class, Arrays.asList(1L, 2L));
    ArgumentCaptor<GraphModelRequest> argumentCaptor = ArgumentCaptor.forClass(GraphModelRequest.class);
    verify(request).execute(argumentCaptor.capture());
    assertThat(argumentCaptor.getValue().getStatement()).isEqualTo("MATCH (n:`SomeEntity`) WHERE ID(n) IN $ids WITH n MATCH p=(n)-[*0..1]-(m) RETURN p");
}
Also used : GraphModelRequest(org.neo4j.ogm.request.GraphModelRequest) LoadByIdsDelegate(org.neo4j.ogm.session.delegates.LoadByIdsDelegate) Test(org.junit.Test)

Example 2 with LoadByIdsDelegate

use of org.neo4j.ogm.session.delegates.LoadByIdsDelegate in project neo4j-ogm by neo4j.

the class StrictQueryingTest method shouldUseOnlyOneLabelForRelationshipEntities.

// GH-651
@Test
public void shouldUseOnlyOneLabelForRelationshipEntities() {
    LoadByIdsDelegate delegate = new LoadByIdsDelegate(neo4jSession);
    delegate.loadAll(SomeRelationshipEntity.class, Arrays.asList(1L, 2L));
    ArgumentCaptor<GraphModelRequest> argumentCaptor = ArgumentCaptor.forClass(GraphModelRequest.class);
    verify(request).execute(argumentCaptor.capture());
    assertThat(argumentCaptor.getValue().getStatement()).startsWith("MATCH ()-[r0:`SOME_RELATIONSHIP`]-() WHERE ID(r0) IN $ids");
}
Also used : GraphModelRequest(org.neo4j.ogm.request.GraphModelRequest) LoadByIdsDelegate(org.neo4j.ogm.session.delegates.LoadByIdsDelegate) Test(org.junit.Test)

Example 3 with LoadByIdsDelegate

use of org.neo4j.ogm.session.delegates.LoadByIdsDelegate in project neo4j-ogm by neo4j.

the class StrictQueryingTest method shouldUseAllLabelsInInheritanceScenario.

// GH-651
@Test
public void shouldUseAllLabelsInInheritanceScenario() {
    LoadByIdsDelegate delegate = new LoadByIdsDelegate(neo4jSession);
    delegate.loadAll(PersistentCategory.class, Collections.singletonList("abc"));
    ArgumentCaptor<GraphModelRequest> argumentCaptor = ArgumentCaptor.forClass(GraphModelRequest.class);
    verify(request).execute(argumentCaptor.capture());
    assertThat(argumentCaptor.getValue().getStatement()).isEqualTo("MATCH (n:`Category`:`Entity`) WHERE n.`uuid` IN $ids WITH n MATCH p=(n)-[*0..1]-(m) RETURN p");
}
Also used : GraphModelRequest(org.neo4j.ogm.request.GraphModelRequest) LoadByIdsDelegate(org.neo4j.ogm.session.delegates.LoadByIdsDelegate) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 GraphModelRequest (org.neo4j.ogm.request.GraphModelRequest)3 LoadByIdsDelegate (org.neo4j.ogm.session.delegates.LoadByIdsDelegate)3