Search in sources :

Example 21 with Country

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

the class CRUDObjectPhysicalTest method update.

@Test(dependsOnMethods = "mapEnumAndInternalObjects")
public void update() {
    int i = 0;
    Account a;
    for (Object o : database.browseClass("Account").setFetchPlan("*:1")) {
        a = (Account) o;
        if (i % 2 == 0)
            a.getAddresses().set(0, new Address("work", new City(new Country("Spain"), "Madrid"), "Plaza central"));
        a.setSalary(i + 500.10f);
        database.save(a);
        i++;
    }
}
Also used : Account(com.orientechnologies.orient.test.domain.business.Account) Address(com.orientechnologies.orient.test.domain.business.Address) Country(com.orientechnologies.orient.test.domain.business.Country) City(com.orientechnologies.orient.test.domain.business.City) Test(org.testng.annotations.Test)

Example 22 with Country

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

the class CRUDObjectPhysicalTest method createLinked.

@Test(dependsOnMethods = "testUpdate")
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)

Aggregations

Country (com.orientechnologies.orient.test.domain.business.Country)22 Test (org.testng.annotations.Test)22 EnumTest (com.orientechnologies.orient.test.domain.base.EnumTest)16 ORecordId (com.orientechnologies.orient.core.id.ORecordId)6 Address (com.orientechnologies.orient.test.domain.business.Address)6 City (com.orientechnologies.orient.test.domain.business.City)6 Profile (com.orientechnologies.orient.test.domain.whiz.Profile)6 Account (com.orientechnologies.orient.test.domain.business.Account)4 ORID (com.orientechnologies.orient.core.id.ORID)2 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)1