use of org.neo4j.ogm.domain.gh824.City in project kripton by xcesco.
the class TestFeatureRuntime2 method testRuntime.
@Test
public void testRuntime() {
BindAppDataSource ds = BindAppDataSource.getInstance();
ds.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindAppDaoFactory daoFactory) {
DaoCityImpl dao = daoFactory.getDaoCity();
long id1;
long id2;
City bean1 = new City();
bean1.name = "city1";
id1 = dao.insert(bean1);
City bean2 = new City();
bean2.name = "city2";
id2 = dao.insert(bean2);
long[] params = { id1, id2 };
assertTrue(dao.selectAll(params).size() == 2);
return TransactionResult.COMMIT;
}
});
}
use of org.neo4j.ogm.domain.gh824.City in project neo4j-ogm by neo4j.
the class DeepNestQueryingOfRelationshipEntitiesIntegrationTest method createData.
@Before
public void createData() {
sessionFactory.openSession().purgeDatabase();
Address a1 = new Address();
a1.setCode("0001");
Address a2 = new Address();
a2.setCode("0002");
City aachen = new City("Aachen");
City koeln = new City("Köln");
a2.setCity(aachen);
User u1 = new User("U1");
u1.setAddress(a1);
User u2 = new User("Mr. User");
u2.setAddress(a1);
User u3 = new User();
u3.setAddress(a2);
UserGroup ug1 = new UserGroup();
ug1.setCity(aachen);
ug1.setName("EuregJUG");
UserGroup ug2 = new UserGroup();
ug2.setCity(koeln);
ug2.setName("JUG Köln");
List<GroupMember> members = Arrays.asList(new GroupMember(u1, ug1), new GroupMember(u2, ug2), new GroupMember(u3, ug2));
Session session = sessionFactory.openSession();
members.forEach(session::save);
}
use of org.neo4j.ogm.domain.gh824.City in project neo4j-ogm by neo4j.
the class DeepNestQueryingOfRelationshipEntitiesIntegrationTest method nPlus1PathSegmentsShouldWork.
@Test
public void nPlus1PathSegmentsShouldWork() {
Filter filter = new Filter("name", ComparisonOperator.EQUALS, "Aachen");
filter.setOwnerEntityType(GroupMember.class);
filter.setNestedPath(new Filter.NestedPathSegment("user", User.class), new Filter.NestedPathSegment("address", Address.class), new Filter.NestedPathSegment("city", City.class));
Collection<GroupMember> members = sessionFactory.openSession().loadAll(GroupMember.class, filter);
assertThat(members).hasSize(1);
}
use of org.neo4j.ogm.domain.gh824.City in project neo4j-ogm by neo4j.
the class DeepNestQueryingOfRelationshipEntitiesIntegrationTest method nPathSegmentsShouldWorkFromBothEnds.
@Test
public void nPathSegmentsShouldWorkFromBothEnds() {
Filter outgoing = new Filter("code", ComparisonOperator.EQUALS, "0001");
outgoing.setOwnerEntityType(GroupMember.class);
outgoing.setNestedPath(new Filter.NestedPathSegment("user", User.class), new Filter.NestedPathSegment("address", Address.class));
Filter incoming = new Filter("name", ComparisonOperator.EQUALS, "Aachen");
incoming.setOwnerEntityType(GroupMember.class);
incoming.setNestedPath(new Filter.NestedPathSegment("group", UserGroup.class), new Filter.NestedPathSegment("city", City.class));
Collection<GroupMember> members = sessionFactory.openSession().loadAll(GroupMember.class, outgoing.and(incoming));
assertThat(members).hasSize(1);
}
use of org.neo4j.ogm.domain.gh824.City in project kripton by xcesco.
the class TestFeatureRuntime1 method testRuntime.
@Test
public void testRuntime() {
BindAppDataSource.getInstance().execute((BindAppDaoFactory daoFactory) -> {
DaoCityImpl dao = daoFactory.getDaoCity();
long id1;
long id2;
City bean1 = new City();
bean1.name = "city1";
id1 = dao.insert(bean1);
City bean2 = new City();
bean2.name = "city2";
id2 = dao.insert(bean2);
ArrayList<Long> params = new ArrayList<Long>();
params.add(id1);
params.add(id2);
assertTrue(dao.selectAll2(params).size() == 2);
return TransactionResult.COMMIT;
});
}
Aggregations