Search in sources :

Example 1 with LoadByTypeDelegate

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

the class StrictQueryingTest method shouldUseOnlyOneLabelForAllStandardEntities.

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

Example 2 with LoadByTypeDelegate

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

the class StrictQueryingTest method shouldUseOnlyOneLabelForAllRelationshipEntities.

// GH-651
@Test
public void shouldUseOnlyOneLabelForAllRelationshipEntities() {
    LoadByTypeDelegate delegate = new LoadByTypeDelegate(neo4jSession);
    delegate.loadAll(SomeRelationshipEntity.class);
    ArgumentCaptor<GraphRowListModelRequest> argumentCaptor = ArgumentCaptor.forClass(GraphRowListModelRequest.class);
    verify(request).execute(argumentCaptor.capture());
    assertThat(argumentCaptor.getValue().getStatement()).startsWith("MATCH ()-[r0:`SOME_RELATIONSHIP`]-()");
}
Also used : GraphRowListModelRequest(org.neo4j.ogm.request.GraphRowListModelRequest) LoadByTypeDelegate(org.neo4j.ogm.session.delegates.LoadByTypeDelegate) Test(org.junit.Test)

Example 3 with LoadByTypeDelegate

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

the class StrictQueryingTest method shouldUseAllLabelsForAllEntitiesInInheritanceScenario.

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

Aggregations

Test (org.junit.Test)3 LoadByTypeDelegate (org.neo4j.ogm.session.delegates.LoadByTypeDelegate)3 GraphModelRequest (org.neo4j.ogm.request.GraphModelRequest)2 GraphRowListModelRequest (org.neo4j.ogm.request.GraphRowListModelRequest)1