Package com.orientechnologies.orient.test.domain.whiz

Examples of com.orientechnologies.orient.test.domain.whiz.Profile


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

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

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


    OObjectDatabaseTx db = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    try {
      db.getEntityManager().registerEntityClass(Profile.class);

      db.begin();
      Profile person = new Profile();
      person.setNick("Guy1");
      person.setName("Guy");
      person.setSurname("Ritchie");
      person = db.save(person);
      db.commit();

      db.begin();
      db.delete(person);
      db.commit();

      db.begin();
      Profile person2 = new Profile();
      person2.setNick("Guy2");
      person2.setName("Guy");
      person2.setSurname("Brush");
      person2 = db.save(person2);
      OObjectIteratorClass<Profile> it = db.browseClass(Profile.class);
      while (it.hasNext()) {
        System.out.println(it.next());
      }
View Full Code Here

    database.getEntityManager().registerEntityClasses("com.orientechnologies.orient.test.domain.base");
  }

  @Test(dependsOnMethods = "testRegisterHook")
  public void testHookCallsCreate() {
    p = new Profile("HookTxTest");

    expectedHookState = 0;

    // TEST HOOKS ON CREATE
    Assert.assertEquals(callbackCount, 0);
View Full Code Here

    graz = database.save(graz);

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

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

    // Create the address without country
    Address anAddress = new Address("Godewaersvelde");
    anAddress = database.save(anAddress);
    Address realAddress = database.detachAll(anAddress, true);
    // Create the person
    Profile aPerson = new Profile("Jack", "Jack", "Black", null);
    aPerson.setLocation(realAddress);
    aPerson = database.save(aPerson);
    // Update the address by another way (another process for example)
    City aCity = new City("Paris");
    aCity = database.save(aCity);
    String command = "update " + anAddress.getId() + " set city = " + database.getIdentity(aCity);
    database.command(new OCommandSQL(command)).execute();
    realAddress = database.reload(anAddress, true);
    Assert.assertNotNull(realAddress.getCity());
    // At this point, in OrientDB Studio everything is fine
    // The address has the good country @rid, with version +1
    // Now reload and detachAll the person
    Profile newPerson = database.reload(aPerson, "*:-1", true);
    Profile finalPerson = database.detachAll(newPerson, true);
    // But with the reload, the country is null
    Assert.assertNotNull(finalPerson.getLocation().getCity()); // out = null
    // Same problem with query and detachAll
    String query = "select from Profile where name = 'Jack' and surname = 'Black'";
    newPerson = (Profile) database.query(new OSQLSynchQuery<Object>(query), new Object[0]).get(0);
    finalPerson = database.detachAll(newPerson, true);
    Assert.assertNotNull(finalPerson.getLocation().getCity()); // out = null
    // Close db
  }
View Full Code Here

    // Close db
  }

  @Test(dependsOnMethods = "testReloadAndDetachAll")
  public void testObjectSerialization() {
    Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
    profile = database.save(profile);
    ODocument originalDoc = database.getRecordByUserObject(profile, false);
    // DETACH TEST
    ODocument serializedDoc = database.getRecordByUserObject(database.detach(profile, true), false);
    Assert.assertTrue(originalDoc.equals(serializedDoc));
View Full Code Here

    graz = database.save(graz);

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

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

    // Create the address without country
    Address anAddress = new Address("Godewaersvelde");
    anAddress = database.save(anAddress);
    Address realAddress = database.detachAll(anAddress, true);
    // Create the person
    Profile aPerson = new Profile("Jack", "Jack", "Black", null);
    aPerson.setLocation(realAddress);
    aPerson = database.save(aPerson);
    // Update the address by another way (another process for example)
    City aCity = new City("Paris");
    aCity = database.save(aCity);
    String command = "update " + anAddress.getId() + " set city = " + database.getIdentity(aCity);
    database.command(new OCommandSQL(command)).execute();
    realAddress = database.reload(anAddress, true);
    Assert.assertNotNull(realAddress.getCity());
    // At this point, in OrientDB Studio everything is fine
    // The address has the good country @rid, with version +1
    // Now reload and detachAll the person
    Profile newPerson = database.reload(aPerson, "*:-1", true);
    Profile finalPerson = database.detachAll(newPerson, true);
    // But with the reload, the country is null
    Assert.assertNotNull(finalPerson.getLocation().getCity()); // out = null
    // Same problem with query and detachAll
    String query = "select from Profile where name = 'Jack' and surname = 'Black'";
    newPerson = (Profile) database.query(new OSQLSynchQuery<Object>(query), new Object[0]).get(0);
    finalPerson = database.detachAll(newPerson, true);
    Assert.assertNotNull(finalPerson.getLocation().getCity()); // out = null
    // Close db
  }
View Full Code Here

    Assert.assertNotNull(finalPerson.getLocation().getCity()); // out = null
    // Close db
  }

  public void testObjectSerialization() {
    Profile profile = new Profile("NonProxiedObjectToDelete", "NonProxiedObjectToDelete", "NonProxiedObjectToDelete", null);
    profile = database.save(profile);
    ODocument originalDoc = database.getRecordByUserObject(profile, false);
    // DETACH TEST
    ODocument serializedDoc = database.getRecordByUserObject(database.detach(profile, true), false);
    Assert.assertTrue(originalDoc.equals(serializedDoc));
View Full Code Here

  public void testSaveMultiCircular() {
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    try {
      startRecordNumber = database.countClusterElements("Profile");

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

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

TOP

Related Classes of com.orientechnologies.orient.test.domain.whiz.Profile

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.