use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTest method testSaveMultiCircular.
@Test(dependsOnMethods = "testQueryCircular")
public void testSaveMultiCircular() {
startRecordNumber = database.countClass("Profile");
Profile bObama = database.newInstance(Profile.class, "ThePresident", "Barack", "Obama", null);
bObama.setLocation(database.newInstance(Address.class, "Residence", database.newInstance(City.class, database.newInstance(Country.class, "Hawaii"), "Honolulu"), "unknown"));
bObama.addFollower(database.newInstance(Profile.class, "PresidentSon1", "Malia Ann", "Obama", bObama));
bObama.addFollower(database.newInstance(Profile.class, "PresidentSon2", "Natasha", "Obama", bObama));
database.save(bObama);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectDetachingTestSchemaFull method createAnnotatedObjects.
@Test
public void createAnnotatedObjects() {
database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.business");
database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.whiz");
database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.base");
Country austria = new Country("Austria");
City graz = new City(austria, "Graz");
graz = database.save(graz);
account = new Account();
account = database.save(account);
profile = new Profile();
profile = database.save(profile);
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTestSchemaFull method testCityEquality.
@Test(dependsOnMethods = "testPersonSaving")
public void testCityEquality() {
List<Profile> resultset = database.query(new OSQLSynchQuery<Object>("select from profile where location.city.name = 'Rome'"));
Assert.assertEquals(resultset.size(), 2);
Profile p1 = resultset.get(0);
Profile p2 = resultset.get(1);
Assert.assertNotSame(p1, p2);
Assert.assertSame(OObjectEntitySerializer.getDocument((Proxy) p1.getLocation().getCity()), OObjectEntitySerializer.getDocument((Proxy) p2.getLocation().getCity()));
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class ObjectTreeTestSchemaFull method iteratorShouldTerminate.
@Test
public void iteratorShouldTerminate() {
OObjectDatabaseTx db = OObjectDatabasePool.global().acquire(url, "admin", "admin");
try {
db.getEntityManager().registerEntityClass(Profile.class);
db.begin();
Profile person = new Profile();
person.setNick("Guy1");
person.setName("Guy");
person.setSurname("Ritchie");
person = db.save(person);
db.commit();
db.begin();
db.delete(person);
db.commit();
db.begin();
Profile person2 = new Profile();
person2.setNick("Guy2");
person2.setName("Guy");
person2.setSurname("Brush");
person2 = db.save(person2);
OObjectIteratorClass<Profile> it = db.browseClass(Profile.class);
while (it.hasNext()) {
System.out.println(it.next());
}
db.commit();
} finally {
db.close();
}
}
use of com.orientechnologies.orient.test.domain.whiz.Profile in project orientdb by orientechnologies.
the class IndexTest method testIndexInComplexSelectTwo.
@Test(dependsOnMethods = "populateIndexDocuments")
public void testIndexInComplexSelectTwo() {
if (database.getStorage() instanceof OStorageProxy) {
return;
}
final boolean oldRecording = Orient.instance().getProfiler().isRecording();
if (!oldRecording) {
Orient.instance().getProfiler().startRecording();
}
long indexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
if (indexQueries < 0) {
indexQueries = 0;
}
final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where " + "((name = 'Giuseppe' OR name <> 'Napoleone')" + " AND (nick is not null AND (name = 'Giuseppe' OR name <> 'Napoleone') AND (nick >= 'ZZZJayLongNickIndex3' OR nick >= 'ZZZJayLongNickIndex4')))")).execute();
if (!oldRecording) {
Orient.instance().getProfiler().stopRecording();
}
final List<String> expectedNicks = new ArrayList<String>(Arrays.asList("ZZZJayLongNickIndex3", "ZZZJayLongNickIndex4", "ZZZJayLongNickIndex5"));
Assert.assertEquals(result.size(), 3);
for (Profile profile : result) {
expectedNicks.remove(profile.getNick());
}
Assert.assertEquals(expectedNicks.size(), 0);
long newIndexQueries = Orient.instance().getProfiler().getCounter("db.demo.query.indexUsed");
Assert.assertEquals(newIndexQueries, indexQueries);
}
Aggregations