use of org.neo4j.ogm.domain.social.Individual in project neo4j-ogm by neo4j.
the class SocialRelationshipsIntegrationTest method saveUnmarkedSavesOutgoingRelationship.
// DATAGRAPH-594
@Test
public void saveUnmarkedSavesOutgoingRelationship() {
Individual individualA = new Individual();
individualA.setName("A");
Individual individualB = new Individual();
individualB.setName("B");
individualA.setFriends(Collections.singletonList(individualB));
session.save(individualA);
session.clear();
assertThat(session.query("MATCH (a:Individual {name:'A', age: 0, code:0, bankBalance:0.0})," + "(b:Individual {name:'B', age:0, code:0, bankBalance:0.0}) WHERE (a)-[:FRIENDS]->(b) " + "return a,b", emptyMap()).queryResults()).hasSize(1);
}
use of org.neo4j.ogm.domain.social.Individual in project neo4j-ogm by neo4j.
the class EntityFactoryTest method shouldConstructObjectOfParticularTypeUsingItsDefaultZeroArgConstructor.
@Test
public void shouldConstructObjectOfParticularTypeUsingItsDefaultZeroArgConstructor() {
NodeModel personNodeModel = new NodeModel(-1L);
personNodeModel.setLabels(new String[] { "Individual" });
Individual sheila = this.entityFactory.newObject(personNodeModel);
assertThat(sheila).isNotNull();
}
use of org.neo4j.ogm.domain.social.Individual in project neo4j-ogm by neo4j.
the class EntityFactoryTest method shouldConstructObjectIfExplicitlyGivenClassToInstantiate.
@Test
public void shouldConstructObjectIfExplicitlyGivenClassToInstantiate() {
Individual instance = this.entityFactory.newObject(Individual.class, new HashMap<>());
assertThat(instance).as("The resultant instance shouldn't be null").isNotNull();
}
use of org.neo4j.ogm.domain.social.Individual in project neo4j-ogm by neo4j.
the class EntityFactoryTest method shouldHandleMultipleLabelsSafely.
@Test
public void shouldHandleMultipleLabelsSafely() {
NodeModel personNodeModel = new NodeModel(-1L);
personNodeModel.setLabels(new String[] { "Female", "Individual", "Lass" });
Individual ourLass = this.entityFactory.newObject(personNodeModel);
assertThat(ourLass).isNotNull();
}
use of org.neo4j.ogm.domain.social.Individual in project neo4j-ogm by neo4j.
the class ArraysMappingTest method shouldDeserializeByteArrays.
@Test
public void shouldDeserializeByteArrays() {
long id = (long) session.query("CREATE (i:Individual {age:42, bankBalance: 23, code:6, primitiveByteArray:'AQIDBAU='}) return id(i) as id", Collections.emptyMap()).queryResults().iterator().next().get("id");
session.clear();
Session freshSession = sessionFactory.openSession();
Individual loadedIndividual = freshSession.load(Individual.class, id);
assertThat(loadedIndividual.getPrimitiveByteArray()).isEqualTo(new byte[] { 1, 2, 3, 4, 5 });
}
Aggregations