use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTest method testQueryCircular.
@Test(dependsOnMethods = "testSaveCircularLink")
public void testQueryCircular() {
List<Profile> result = database.query(new OSQLSynchQuery<ODocument>("select * from Profile"));
Profile parent;
for (Profile r : result) {
System.out.println(r.getNick());
parent = r.getInvitedBy();
if (parent != null)
System.out.println("- parent: " + parent.getName() + " " + parent.getSurname());
}
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectDetachingTest method testObjectSerialization.
public void testObjectSerialization() {
Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
profile = database.save(profile);
ODocument originalDoc = database.getRecordByUserObject(profile, false);
// DETACH TEST
ODocument serializedDoc = database.getRecordByUserObject(database.detach(profile, true), false);
Assert.assertTrue(originalDoc.equals(serializedDoc));
Assert.assertTrue(originalDoc.hasSameContentOf(serializedDoc));
// DETACH ALL TEST
serializedDoc = database.getRecordByUserObject(database.detachAll(profile, true), false);
Assert.assertTrue(originalDoc.equals(serializedDoc));
Assert.assertTrue(originalDoc.hasSameContentOf(serializedDoc));
database.delete(profile);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTest method testPersonSaving.
@Test
public void testPersonSaving() {
final long beginProfiles = database.countClass("Profile");
beginCities = database.countClass("City");
Country italy = database.newInstance(Country.class, "Italy");
Profile garibaldi = database.newInstance(Profile.class, "GGaribaldi", "Giuseppe", "Garibaldi", null);
garibaldi.setLocation(database.newInstance(Address.class, "Residence", database.newInstance(City.class, italy, "Rome"), "Piazza Navona, 1"));
Profile bonaparte = database.newInstance(Profile.class, "NBonaparte", "Napoleone", "Bonaparte", garibaldi);
bonaparte.setLocation(database.newInstance(Address.class, "Residence", garibaldi.getLocation().getCity(), "Piazza di Spagna, 111"));
database.save(bonaparte);
Assert.assertEquals(database.countClass("Profile"), beginProfiles + 2);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTestSchemaFull method testQueryCircular.
@Test(dependsOnMethods = "testSaveCircularLink")
public void testQueryCircular() {
List<Profile> result = database.query(new OSQLSynchQuery<ODocument>("select * from Profile"));
Profile parent;
for (Profile r : result) {
// System.out.println(r.getNick());
parent = r.getInvitedBy();
if (parent != null)
System.out.println("- parent: " + parent.getName() + " " + parent.getSurname());
}
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectDetachingTestSchemaFull method testObjectSerialization.
@Test(dependsOnMethods = "testReloadAndDetachAll")
public void testObjectSerialization() {
Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
profile = database.save(profile);
ODocument originalDoc = database.getRecordByUserObject(profile, false);
// DETACH TEST
ODocument serializedDoc = database.getRecordByUserObject(database.detach(profile, true), false);
Assert.assertTrue(originalDoc.equals(serializedDoc));
Assert.assertTrue(originalDoc.hasSameContentOf(serializedDoc));
// DETACH ALL TEST
serializedDoc = database.getRecordByUserObject(database.detachAll(profile, true), false);
Assert.assertTrue(originalDoc.equals(serializedDoc));
Assert.assertTrue(originalDoc.hasSameContentOf(serializedDoc));
database.delete(profile);
}
Aggregations