use of com.orientechnologies.orient.test.domain.business.Company in project orientdb by orientechnologies.
the class CRUDObjectInheritanceTest method deleteFirst.
@Test(dependsOnMethods = "queryPerSuperType")
public void deleteFirst() {
startRecordNumber = database.countClass("Company");
// DELETE ALL THE RECORD IN THE CLUSTER
OObjectIteratorClass<Company> companyClusterIterator = database.browseClass("Company");
for (Company obj : companyClusterIterator) {
if (obj.getId() == 1) {
database.delete(obj);
break;
}
}
Assert.assertEquals(database.countClass("Company"), startRecordNumber - 1);
}
use of com.orientechnologies.orient.test.domain.business.Company in project orientdb by orientechnologies.
the class CRUDObjectInheritanceTest method queryByBaseType.
@Test(dependsOnMethods = "testCreate")
public void queryByBaseType() {
final List<Account> result = database.query(new OSQLSynchQuery<Account>("select from Company where name.length() > 0"));
Assert.assertTrue(result.size() > 0);
Assert.assertEquals(result.size(), TOT_RECORDS);
int companyRecords = 0;
Account account;
for (int i = 0; i < result.size(); ++i) {
account = result.get(i);
if (account instanceof Company)
companyRecords++;
Assert.assertNotSame(account.getName().length(), 0);
}
Assert.assertEquals(companyRecords, TOT_RECORDS);
}
use of com.orientechnologies.orient.test.domain.business.Company in project orientdb by orientechnologies.
the class CRUDObjectInheritanceTestSchemaFull method queryPerSuperType.
@Test(dependsOnMethods = "queryByBaseType")
public void queryPerSuperType() {
database.setAutomaticSchemaGeneration(true);
final List<Company> result = database.query(new OSQLSynchQuery<ODocument>("select * from Company where name.length() > 0"));
Assert.assertTrue(result.size() == TOT_RECORDS);
Company account;
for (int i = 0; i < result.size(); ++i) {
account = result.get(i);
Assert.assertNotSame(account.getName().length(), 0);
}
}
Aggregations