use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTestSchemaFull method testSaveCircularLink.
@Test(dependsOnMethods = "testCityEquality")
public void testSaveCircularLink() {
Profile winston = database.newInstance(Profile.class, "WChurcill", "Winston", "Churcill", null);
winston.setLocation(database.newInstance(Address.class, "Residence", database.newInstance(City.class, database.newInstance(Country.class, "England"), "London"), "unknown"));
Profile nicholas = database.newInstance(Profile.class, "NChurcill", "Nicholas ", "Churcill", winston);
nicholas.setLocation(winston.getLocation());
nicholas.setInvitedBy(winston);
winston.setInvitedBy(nicholas);
database.save(nicholas);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTestSchemaFull 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);
Assert.assertEquals(database.countClass("City"), beginCities + 1);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexRebuildDuringDetachAllNonProxiedObjectDelete.
@Test(dependsOnMethods = "testIndexRebuildDuringNonProxiedObjectDelete")
public void testIndexRebuildDuringDetachAllNonProxiedObjectDelete() {
Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
profile = database.save(profile);
OIndexManager idxManager = database.getMetadata().getIndexManager();
OIndex<?> nickIndex = idxManager.getIndex("Profile.nick");
Assert.assertTrue(nickIndex.contains("NonProxiedObjectToDelete"));
final Profile loadedProfile = database.load(new ORecordId(profile.getId()));
database.delete(database.detachAll(loadedProfile, true));
Assert.assertFalse(nickIndex.contains("NonProxiedObjectToDelete"));
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method populateIndexDocuments.
public void populateIndexDocuments() {
for (int i = 0; i <= 5; i++) {
final Profile profile = new Profile("ZZZJayLongNickIndex" + i, "NickIndex" + i, "NolteIndex" + i, null);
database.save(profile);
}
for (int i = 0; i <= 5; i++) {
final Profile profile = new Profile("00" + i, "NickIndex" + i, "NolteIndex" + i, null);
database.save(profile);
}
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexSize.
@Test(dependsOnMethods = "testDuplicatedIndexOnUnique")
public void testIndexSize() {
List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where nick is not null")).execute();
int profileSize = result.size();
database.getMetadata().getIndexManager().reload();
Assert.assertEquals(database.getMetadata().getIndexManager().getIndex("Profile.nick").getSize(), profileSize);
for (int i = 0; i < 10; i++) {
Profile profile = new Profile("Yay-" + i, "Jay", "Miner", null);
database.save(profile);
profileSize++;
Assert.assertNotNull(database.getMetadata().getIndexManager().getIndex("Profile.nick").get("Yay-" + i));
}
}
Aggregations