Package com.orientechnologies.orient.test.domain.base

Examples of com.orientechnologies.orient.test.domain.base.Satellite


  @Test(dependsOnMethods = "testEnumListWithCustomTypes")
  public void childUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    Satellite sat = database.newInstance(Satellite.class);
    p.setName("Earth");
    p.setDistanceSun(1000);
    sat.setDiameter(50);
    p.addSatellite(sat);
    database.save(p);
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    Assert.assertEquals(sat.getDiameter(), 50);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    sat.setDiameter(500);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    Assert.assertEquals(sat.getDiameter(), 500);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    database.close();
  }
View Full Code Here


  @Test(dependsOnMethods = "childUpdateTest")
  public void childNLevelUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    Planet near = database.newInstance(Planet.class);
    Satellite sat = database.newInstance(Satellite.class);
    Satellite satNear = database.newInstance(Satellite.class);
    sat.setDiameter(50);
    sat.setNear(near);
    satNear.setDiameter(10);
    near.addSatellite(satNear);
    p.addSatellite(sat);
    database.save(p);
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    near = sat.getNear();
    satNear = near.getSatellites().get(0);
    Assert.assertEquals(satNear.getDiameter(), 10);
    satNear.setDiameter(100);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    near = sat.getNear();
    satNear = near.getSatellites().get(0);
    Assert.assertEquals(satNear.getDiameter(), 100);
    database.close();
  }
View Full Code Here

  public void childMapUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    p.setName("Earth");
    p.setDistanceSun(1000);
    Satellite sat = database.newInstance(Satellite.class);
    sat.setDiameter(50);
    sat.setName("Moon");
    p.addSatelliteMap(sat);
    database.save(p);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellitesMap().get("Moon");
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    Assert.assertEquals(sat.getDiameter(), 50);
    sat.setDiameter(500);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellitesMap().get("Moon");
    Assert.assertEquals(sat.getDiameter(), 500);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    database.close();
  }
View Full Code Here

    jupiter.setName("Jupiter");
    jupiter.setDistanceSun(3000);
    Planet mercury = database.newInstance(Planet.class);
    mercury.setName("Mercury");
    mercury.setDistanceSun(5000);
    Satellite jupiterMoon = database.newInstance(Satellite.class);
    Satellite mercuryMoon = database.newInstance(Satellite.class);
    jupiterMoon.setDiameter(50);
    jupiterMoon.setNear(mercury);
    jupiterMoon.setName("JupiterMoon");
    mercuryMoon.setDiameter(10);
    mercuryMoon.setName("MercuryMoon");
    mercury.addSatelliteMap(mercuryMoon);
    jupiter.addSatelliteMap(jupiterMoon);
    database.save(jupiter);
    ORID rid = database.getIdentity(jupiter);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    jupiter = database.load(rid);
    jupiterMoon = jupiter.getSatellitesMap().get("JupiterMoon");
    mercury = jupiterMoon.getNear();
    mercuryMoon = mercury.getSatellitesMap().get("MercuryMoon");
    Assert.assertEquals(mercuryMoon.getDiameter(), 10);
    Assert.assertEquals(mercuryMoon.getName(), "MercuryMoon");
    Assert.assertEquals(jupiterMoon.getDiameter(), 50);
    Assert.assertEquals(jupiterMoon.getName(), "JupiterMoon");
    Assert.assertEquals(jupiter.getName(), "Jupiter");
    Assert.assertEquals(jupiter.getDistanceSun(), 3000);
    Assert.assertEquals(mercury.getName(), "Mercury");
    Assert.assertEquals(mercury.getDistanceSun(), 5000);
    mercuryMoon.setDiameter(100);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(jupiter);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    jupiter = database.load(rid);
    jupiterMoon = jupiter.getSatellitesMap().get("JupiterMoon");
    mercury = jupiterMoon.getNear();
    mercuryMoon = mercury.getSatellitesMap().get("MercuryMoon");
    Assert.assertEquals(mercuryMoon.getDiameter(), 100);
    Assert.assertEquals(mercuryMoon.getName(), "MercuryMoon");
    Assert.assertEquals(jupiterMoon.getDiameter(), 50);
    Assert.assertEquals(jupiterMoon.getName(), "JupiterMoon");
    Assert.assertEquals(jupiter.getName(), "Jupiter");
    Assert.assertEquals(jupiter.getDistanceSun(), 3000);
    Assert.assertEquals(mercury.getName(), "Mercury");
View Full Code Here

  @Test(dependsOnMethods = "testEnumListWithCustomTypes")
  public void childUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    Satellite sat = database.newInstance(Satellite.class);
    p.setName("Earth");
    p.setDistanceSun(1000);
    sat.setDiameter(50);
    p.addSatellite(sat);
    database.save(p);
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    Assert.assertEquals(sat.getDiameter(), 50);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    sat.setDiameter(500);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    Assert.assertEquals(sat.getDiameter(), 500);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    database.close();
  }
View Full Code Here

  @Test(dependsOnMethods = "childUpdateTest")
  public void childNLevelUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    Planet near = database.newInstance(Planet.class);
    Satellite sat = database.newInstance(Satellite.class);
    Satellite satNear = database.newInstance(Satellite.class);
    sat.setDiameter(50);
    sat.setNear(near);
    satNear.setDiameter(10);
    near.addSatellite(satNear);
    p.addSatellite(sat);
    database.save(p);
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    near = sat.getNear();
    satNear = near.getSatellites().get(0);
    Assert.assertEquals(satNear.getDiameter(), 10);
    satNear.setDiameter(100);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellites().get(0);
    near = sat.getNear();
    satNear = near.getSatellites().get(0);
    Assert.assertEquals(satNear.getDiameter(), 100);
    database.close();
  }
View Full Code Here

  public void childMapUpdateTest() {
    OObjectDatabaseTx database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    Planet p = database.newInstance(Planet.class);
    p.setName("Earth");
    p.setDistanceSun(1000);
    Satellite sat = database.newInstance(Satellite.class);
    sat.setDiameter(50);
    sat.setName("Moon");
    p.addSatelliteMap(sat);
    database.save(p);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    ORID rid = database.getIdentity(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellitesMap().get("Moon");
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    Assert.assertEquals(sat.getDiameter(), 50);
    sat.setDiameter(500);
    database.save(p);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.load(rid);
    sat = p.getSatellitesMap().get("Moon");
    Assert.assertEquals(sat.getDiameter(), 500);
    Assert.assertEquals(p.getDistanceSun(), 1000);
    Assert.assertEquals(p.getName(), "Earth");
    database.close();
  }
View Full Code Here

    jupiter.setName("Jupiter");
    jupiter.setDistanceSun(3000);
    Planet mercury = database.newInstance(Planet.class);
    mercury.setName("Mercury");
    mercury.setDistanceSun(5000);
    Satellite jupiterMoon = database.newInstance(Satellite.class);
    Satellite mercuryMoon = database.newInstance(Satellite.class);
    jupiterMoon.setDiameter(50);
    jupiterMoon.setNear(mercury);
    jupiterMoon.setName("JupiterMoon");
    mercuryMoon.setDiameter(10);
    mercuryMoon.setName("MercuryMoon");
    mercury.addSatelliteMap(mercuryMoon);
    jupiter.addSatelliteMap(jupiterMoon);
    database.save(jupiter);
    ORID rid = database.getIdentity(jupiter);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    jupiter = database.load(rid);
    jupiterMoon = jupiter.getSatellitesMap().get("JupiterMoon");
    mercury = jupiterMoon.getNear();
    mercuryMoon = mercury.getSatellitesMap().get("MercuryMoon");
    Assert.assertEquals(mercuryMoon.getDiameter(), 10);
    Assert.assertEquals(mercuryMoon.getName(), "MercuryMoon");
    Assert.assertEquals(jupiterMoon.getDiameter(), 50);
    Assert.assertEquals(jupiterMoon.getName(), "JupiterMoon");
    Assert.assertEquals(jupiter.getName(), "Jupiter");
    Assert.assertEquals(jupiter.getDistanceSun(), 3000);
    Assert.assertEquals(mercury.getName(), "Mercury");
    Assert.assertEquals(mercury.getDistanceSun(), 5000);
    mercuryMoon.setDiameter(100);
    // p.addSatellite(new Satellite("Moon", 70));
    // db.save(sat);
    database.save(jupiter);
    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    jupiter = database.load(rid);
    jupiterMoon = jupiter.getSatellitesMap().get("JupiterMoon");
    mercury = jupiterMoon.getNear();
    mercuryMoon = mercury.getSatellitesMap().get("MercuryMoon");
    Assert.assertEquals(mercuryMoon.getDiameter(), 100);
    Assert.assertEquals(mercuryMoon.getName(), "MercuryMoon");
    Assert.assertEquals(jupiterMoon.getDiameter(), 50);
    Assert.assertEquals(jupiterMoon.getName(), "JupiterMoon");
    Assert.assertEquals(jupiter.getName(), "Jupiter");
    Assert.assertEquals(jupiter.getDistanceSun(), 3000);
    Assert.assertEquals(mercury.getName(), "Mercury");
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.test.domain.base.Satellite

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.