Search in sources :

Example 1 with LoadOneDelegate

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

the class StrictQueryingTest method shouldUseOnlyOneLabelForOneRelationshipEntity.

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

Example 2 with LoadOneDelegate

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

the class StrictQueryingTest method shouldUseOnlyOneLabelForOneStandardEntity.

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

Example 3 with LoadOneDelegate

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

the class StrictQueryingTest method shouldUseAllLabelsForOneEntityInInheritanceScenario.

// GH-651
@Test
public void shouldUseAllLabelsForOneEntityInInheritanceScenario() {
    LoadOneDelegate delegate = new LoadOneDelegate(neo4jSession);
    delegate.load(PersistentCategory.class, "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` = $id WITH n MATCH p=(n)-[*0..1]-(m) RETURN p");
}
Also used : GraphModelRequest(org.neo4j.ogm.request.GraphModelRequest) LoadOneDelegate(org.neo4j.ogm.session.delegates.LoadOneDelegate) Test(org.junit.Test)

Aggregations

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