Search in sources :

Example 6 with Account

use of com.orientechnologies.orient.test.domain.business.Account in project orientdb by orientechnologies.

the class CRUDObjectInheritanceTestSchemaFull method queryByBaseType.

@Test(dependsOnMethods = "testCreate")
public void queryByBaseType() {
    database.setAutomaticSchemaGeneration(true);
    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() - startRecordNumber, 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 7 with Account

use of com.orientechnologies.orient.test.domain.business.Account in project orientdb by orientechnologies.

the class CRUDObjectPhysicalTest method create.

@Test
public void create() {
    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");
    startRecordNumber = database.countClass("Account");
    Account account;
    for (long i = startRecordNumber; i < startRecordNumber + TOT_RECORDS; ++i) {
        account = new Account((int) i, "Bill", "Gates");
        account.setBirthDate(new Date());
        account.setSalary(i + 300.10f);
        account.getAddresses().add(new Address("Residence", rome, "Piazza Navona, 1"));
        database.save(account);
    }
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account) Address(com.orientechnologies.orient.test.domain.business.Address) Test(org.testng.annotations.Test)

Example 8 with Account

use of com.orientechnologies.orient.test.domain.business.Account in project orientdb by orientechnologies.

the class ObjectDetachingTest 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);
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account) Country(com.orientechnologies.orient.test.domain.business.Country) City(com.orientechnologies.orient.test.domain.business.City) Profile(com.orientechnologies.orient.test.domain.whiz.Profile) Test(org.testng.annotations.Test) EnumTest(com.orientechnologies.orient.test.domain.base.EnumTest)

Example 9 with Account

use of com.orientechnologies.orient.test.domain.business.Account 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);
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account) Country(com.orientechnologies.orient.test.domain.business.Country) City(com.orientechnologies.orient.test.domain.business.City) Profile(com.orientechnologies.orient.test.domain.whiz.Profile) Test(org.testng.annotations.Test) EnumTest(com.orientechnologies.orient.test.domain.base.EnumTest)

Example 10 with Account

use of com.orientechnologies.orient.test.domain.business.Account in project orientdb by orientechnologies.

the class LocalCreateObjectSpeedTest method cycle.

@Override
public void cycle() {
    account = new Account((int) data.getCyclesDone(), "Luca", "Garulli");
    account.setBirthDate(date);
    account.setSalary(3000f + data.getCyclesDone());
    database.save(account);
    if (data.getCyclesDone() == data.getCycles() - 1)
        database.commit();
    account = null;
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account)

Aggregations

Account (com.orientechnologies.orient.test.domain.business.Account)23 Test (org.testng.annotations.Test)21 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)5 Address (com.orientechnologies.orient.test.domain.business.Address)5 City (com.orientechnologies.orient.test.domain.business.City)4 Country (com.orientechnologies.orient.test.domain.business.Country)4 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 ORID (com.orientechnologies.orient.core.id.ORID)2 EnumTest (com.orientechnologies.orient.test.domain.base.EnumTest)2 Company (com.orientechnologies.orient.test.domain.business.Company)2 Profile (com.orientechnologies.orient.test.domain.whiz.Profile)2 DatabaseAbstractTest (com.orientechnologies.DatabaseAbstractTest)1 OObjectDatabaseTx (com.orientechnologies.orient.object.db.OObjectDatabaseTx)1 ArrayList (java.util.ArrayList)1