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

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


    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);

    database.close();
View Full Code Here


    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain");

    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);
    }

    database.close();
  }
View Full Code Here

  @Test(dependsOnMethods = "afterDeserializationCall")
  public void update() {
    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");

    int i = 0;
    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);

      i++;
    }
View Full Code Here

  @Test(dependsOnMethods = "update")
  public void testUpdate() {
    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");

    int i = 0;
    Account a;
    for (OObjectIteratorCluster<Account> iterator = database.browseCluster("Account"); iterator.hasNext();) {
      a = iterator.next();

      if (i % 2 == 0)
        Assert.assertEquals(a.getAddresses().get(0).getCity().getCountry().getName(), "Spain");
      else
        Assert.assertEquals(a.getAddresses().get(0).getCity().getCountry().getName(), "Italy");

      Assert.assertEquals(a.getSalary(), i + 500.1f);

      i++;
    }

    database.close();
View Full Code Here

    final List<Account> result = database.query(new OSQLSynchQuery<ODocument>("select * from Account where salary = 500.10"));

    Assert.assertTrue(result.size() > 0);

    Account account;
    for (int i = 0; i < result.size(); ++i) {
      account = result.get(i);

      Assert.assertEquals(account.getSalary(), 500.10f);
    }

    database.close();
  }
View Full Code Here

  public void testEmbeddedBinary() {
    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");
    database.getMetadata().getSchema().reload();

    Account a = new Account(0, "Chris", "Martin");
    a.setThumbnail(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
    database.save(a);
    database.close();

    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");
    Account aa = (Account) database.load((ORID) a.getRid());
    Assert.assertNotNull(a.getThumbnail());
    byte[] b = aa.getThumbnail();
    for (int i = 0; i < 10; ++i)
      Assert.assertEquals(b[i], i);

    Assert.assertNotNull(aa.getPhoto());
    b = aa.getPhoto();
    for (int i = 0; i < 10; ++i)
      Assert.assertEquals(b[i], i);

    database.close();
  }
View Full Code Here

    database.begin(TXTYPE.NOTX);
  }

  @Override
  public void cycle() {
    account = new Account((int) data.getCyclesDone(), "Luca", "Garulli");
    account.setBirthDate(date);
    account.setSalary(3000f + data.getCyclesDone());

    database.save(account);
View Full Code Here

    Country austria = new Country("Austria");
    City graz = new City(austria, "Graz");
    database.save(graz);

    account = new Account();
    database.save(account);

    profile = new Profile();
    database.save(profile);
  }
View Full Code Here

    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");
    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain");

    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);
    }

    database.close();
  }
View Full Code Here

  @Test(dependsOnMethods = "afterDeserializationCall")
  public void update() {
    database = ODatabaseObjectPool.global().acquire(url, "admin", "admin");

    int i = 0;
    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);

      i++;
    }
View Full Code Here

TOP

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

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.