Search in sources :

Example 1 with Pizza

use of org.neo4j.ogm.domain.pizza.Pizza in project neo4j-ogm by neo4j.

the class MergeWithPrimaryIndexTests method newNodeUsesGraphIdWhenPrimaryIndexNotPresent.

@Test
public void newNodeUsesGraphIdWhenPrimaryIndexNotPresent() {
    Pizza pizza = new Pizza("Plain");
    assertThat(pizza.getId()).isNull();
    Compiler compiler = mapAndCompile(pizza);
    assertThat(compiler.hasStatementsDependentOnNewNodes()).isFalse();
    assertThat(compiler.createNodesStatements().get(0).getStatement()).isEqualTo("UNWIND $rows as row CREATE (n:`Pizza`) SET n=row.props RETURN row.nodeRef as ref, ID(n) as id, $type as type");
}
Also used : Pizza(org.neo4j.ogm.domain.pizza.Pizza) Compiler(org.neo4j.ogm.cypher.compiler.Compiler) Test(org.junit.Test)

Example 2 with Pizza

use of org.neo4j.ogm.domain.pizza.Pizza in project neo4j-ogm by neo4j.

the class EntityUtilsTest method shouldCollateStaticAndRuntimeLabels.

@Test
public void shouldCollateStaticAndRuntimeLabels() throws Exception {
    Pizza pizza = new Pizza();
    List<String> labels = new ArrayList<>();
    labels.add("Delicious");
    labels.add("Hot");
    labels.add("Spicy");
    pizza.setLabels(labels);
    Collection<String> collatedLabels = EntityUtils.labels(pizza, metaData);
    assertThat(collatedLabels).isNotNull();
    assertThat(collatedLabels).containsOnly("Delicious", "Hot", "Spicy", "Pizza");
}
Also used : Pizza(org.neo4j.ogm.domain.pizza.Pizza) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Pizza (org.neo4j.ogm.domain.pizza.Pizza)2 ArrayList (java.util.ArrayList)1 Compiler (org.neo4j.ogm.cypher.compiler.Compiler)1