Search in sources :

Example 1 with Address

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

the class CRUDObjectPhysicalTestSchemaFull method create.

@Test
public void create() {
    createBasicTestSchema();
    database.setAutomaticSchemaGeneration(true);
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.business");
    if (url.startsWith(OEngineRemote.NAME)) {
        database.getMetadata().reload();
    }
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.base");
    if (url.startsWith(OEngineRemote.NAME)) {
        database.getMetadata().reload();
    }
    database.setAutomaticSchemaGeneration(false);
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.whiz");
    if (url.startsWith(OEngineRemote.NAME)) {
        database.getMetadata().reload();
    }
    startRecordNumber = database.countClusterElements("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 2 with Address

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

the class CRUDObjectInheritanceTest method create.

@Test
public void create() {
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.business");
    database.command(new OCommandSQL("delete from Company")).execute();
    startRecordNumber = database.countClass("Company");
    Company company;
    for (long i = startRecordNumber; i < startRecordNumber + TOT_RECORDS; ++i) {
        company = database.newInstance(Company.class, (int) i, "Microsoft" + i);
        company.setEmployees((int) (100000 + i));
        company.getAddresses().add(new Address("Headquarter", redmond, "WA 98073-9717"));
        database.save(company);
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) Company(com.orientechnologies.orient.test.domain.business.Company) Address(com.orientechnologies.orient.test.domain.business.Address) Test(org.testng.annotations.Test)

Example 3 with Address

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

the class CRUDObjectPhysicalTestSchemaFull method createLinked.

@Test(dependsOnMethods = "testSaveMultiCircular")
public void createLinked() {
    long profiles = database.countClass("Profile");
    Profile neo = new Profile("Neo").setValue("test").setLocation(new Address("residence", new City(new Country("Spain"), "Madrid"), "Rio de Castilla"));
    neo.addFollowing(new Profile("Morpheus"));
    neo.addFollowing(new Profile("Trinity"));
    database.save(neo);
    Assert.assertEquals(database.countClass("Profile"), profiles + 3);
}
Also used : Address(com.orientechnologies.orient.test.domain.business.Address) 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)

Example 4 with Address

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

the class CRUDObjectInheritanceTestSchemaFull method create.

@Test
public void create() {
    database.getMetadata().getSchema().reload();
    database.getMetadata().getSchema().synchronizeSchema();
    database.setAutomaticSchemaGeneration(true);
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.business");
    if (url.startsWith(OEngineRemote.NAME)) {
        database.getMetadata().reload();
    }
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.base");
    if (url.startsWith(OEngineRemote.NAME)) {
        database.getMetadata().reload();
    }
    startRecordNumber = database.countClass("Company");
    Company company;
    for (long i = startRecordNumber; i < startRecordNumber + TOT_RECORDS; ++i) {
        company = database.newInstance(Company.class, (int) i, "Microsoft" + i);
        company.setEmployees((int) (100000 + i));
        company.getAddresses().add(new Address("Headquarter", redmond, "WA 98073-9717"));
        database.save(company);
    }
}
Also used : Company(com.orientechnologies.orient.test.domain.business.Company) Address(com.orientechnologies.orient.test.domain.business.Address) Test(org.testng.annotations.Test)

Example 5 with Address

use of com.orientechnologies.orient.test.domain.business.Address 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)

Aggregations

Address (com.orientechnologies.orient.test.domain.business.Address)11 Test (org.testng.annotations.Test)10 City (com.orientechnologies.orient.test.domain.business.City)6 Account (com.orientechnologies.orient.test.domain.business.Account)5 Country (com.orientechnologies.orient.test.domain.business.Country)4 Profile (com.orientechnologies.orient.test.domain.whiz.Profile)4 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)3 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)2 Company (com.orientechnologies.orient.test.domain.business.Company)2 DatabaseAbstractTest (com.orientechnologies.DatabaseAbstractTest)1 OObjectDatabaseTx (com.orientechnologies.orient.object.db.OObjectDatabaseTx)1 EnumTest (com.orientechnologies.orient.test.domain.base.EnumTest)1 ArrayList (java.util.ArrayList)1