Search in sources :

Example 6 with Company

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);
}
Also used : Company(com.orientechnologies.orient.test.domain.business.Company) Test(org.testng.annotations.Test)

Example 7 with Company

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);
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account) Company(com.orientechnologies.orient.test.domain.business.Company) Test(org.testng.annotations.Test)

Example 8 with Company

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);
    }
}
Also used : Company(com.orientechnologies.orient.test.domain.business.Company) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) Test(org.testng.annotations.Test)

Aggregations

Company (com.orientechnologies.orient.test.domain.business.Company)8 Test (org.testng.annotations.Test)8 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)2 Account (com.orientechnologies.orient.test.domain.business.Account)2 Address (com.orientechnologies.orient.test.domain.business.Address)2 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)1