Package com.orientechnologies.orient.test.domain.business

Examples of com.orientechnologies.orient.test.domain.business.Country


    database.open("admin", "admin");

    final long beginProfiles = database.countClusterElements("Profile");
    beginCities = database.countClusterElements("City");

    Country italy = new Country("Italy");

    Profile garibaldi = new Profile("GGaribaldi", "Giuseppe", "Garibaldi", null);
    garibaldi.setLocation(new Address("Residence", new City(italy, "Rome"), "Piazza Navona, 1"));

    Profile bonaparte = new Profile("NBonaparte", "Napoleone", "Bonaparte", garibaldi);
View Full Code Here


  }

  @Test(dependsOnMethods = "testCityEquality")
  public void testSaveCircularLink() {
    Profile winston = new Profile("WChurcill", "Winston", "Churcill", null);
    winston.setLocation(new Address("Residence", new City(new Country("England"), "London"), "unknown"));

    Profile nicholas = new Profile("NChurcill", "Nicholas ", "Churcill", winston);
    nicholas.setLocation(winston.getLocation());

    nicholas.setInvitedBy(winston);
View Full Code Here

  @Test(dependsOnMethods = "testQueryCircular")
  public void testSaveMultiCircular() {
    startRecordNumber = database.countClusterElements("Profile");

    Profile bObama = new Profile("ThePresident", "Barack", "Obama", null);
    bObama.setLocation(new Address("Residence", new City(new Country("Hawaii"), "Honolulu"), "unknown"));
    bObama.addFollower(new Profile("PresidentSon1", "Malia Ann", "Obama", bObama));
    bObama.addFollower(new Profile("PresidentSon2", "Natasha", "Obama", bObama));

    database.save(bObama);
  }
View Full Code Here

    Account a;
    for (Object o : database.browseCluster("Account")) {
      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);
View Full Code Here

    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");

    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);
View Full Code Here

  }

  @Test(dependsOnMethods = "testInsertCommit")
  public void testInsertRollback() {
    String initialCountryName = "insertRollback";
    Country country = new Country(initialCountryName);

    long initCount = database.countClass(Country.class);

    database.begin();
    database.save(country);
    database.rollback();

    Assert.assertEquals(database.countClass(Country.class), initCount);
    Assert.assertNull(country.getId());
    Assert.assertNull(country.getVersion());
  }
View Full Code Here

  }

  @Test(dependsOnMethods = "testInsertRollback")
  public void testUpdateCommit() {
    String initialCountryName = "updateCommit";
    Country country = new Country(initialCountryName);

    database.save(country);
    Assert.assertNotNull(country.getId());
    Assert.assertNotNull(country.getVersion());

    Integer initVersion = (Integer) country.getVersion();

    database.begin();
    Country loaded = (Country) database.load((ORecordId) country.getId());
    Assert.assertEquals(loaded, country);
    String newName = "ShouldBeChanged";
    loaded.setName(newName);
    database.save(loaded);
    database.commit();

    loaded = (Country) database.load((ORecordId) country.getId());
    Assert.assertTrue(loaded.equals(country));
    Assert.assertEquals(loaded.getId(), country.getId());
    Assert.assertEquals(loaded.getVersion(), new Integer(initVersion + 1));
    Assert.assertEquals(loaded.getName(), newName);
  }
View Full Code Here

  }

  @Test(dependsOnMethods = "testUpdateCommit")
  public void testUpdateRollback() {
    String initialCountryName = "updateRollback";
    Country country = new Country(initialCountryName);

    database.save(country);
    Assert.assertNotNull(country.getId());
    Assert.assertNotNull(country.getVersion());

    Integer initVersion = (Integer) country.getVersion();

    database.begin();
    Country loaded = (Country) database.load((ORecordId) country.getId());
    Assert.assertEquals(loaded, country);
    String newName = "ShouldNotBeChanged";
    loaded.setName(newName);
    database.save(loaded);
    database.rollback();

    loaded = (Country) database.load((ORecordId) country.getId());
    Assert.assertNotSame(loaded, country);
    Assert.assertEquals(loaded.getVersion(), initVersion);
    Assert.assertEquals(loaded.getName(), initialCountryName);
  }
View Full Code Here

  }

  @Test(dependsOnMethods = "testUpdateRollback")
  public void testDeleteCommit() {
    String initialCountryName = "deleteCommit";
    Country Country = new Country(initialCountryName);

    long initCount = database.countClass(Country.class);

    database.save(Country);

    Assert.assertEquals(database.countClass(Country.class), initCount + 1);

    database.begin();
    database.delete(Country);
    database.commit();

    Assert.assertEquals(database.countClass(Country.class), initCount);
    Country found = (Country) database.load((ORecordId) Country.getId());
    Assert.assertNull(found);
  }
View Full Code Here

  }

  @Test(dependsOnMethods = "testDeleteCommit")
  public void testDeleteRollback() {
    String initialCountryName = "deleteRollback";
    Country country = new Country(initialCountryName);

    long initCount = database.countClass(Country.class);

    database.save(country);

    Assert.assertEquals(database.countClass(Country.class), initCount + 1);

    database.begin();
    database.delete(country);
    database.rollback();

    Assert.assertEquals(database.countClass(Country.class), initCount + 1);
    Country found = (Country) database.load((ORecordId) country.getId());
    Assert.assertNotNull(found);
    Assert.assertEquals(found.getName(), country.getName());
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.test.domain.business.Country

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.