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

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


  @Test
  public void testDuplicatedIndexOnUnique() {
    database.open("admin", "admin");

    Profile jayMiner = new Profile("Jay", "Jay", "Miner", null);
    database.save(jayMiner);

    Profile jacobMiner = new Profile("Jay", "Jacob", "Miner", null);

    try {
      database.save(jacobMiner);

      // IT SHOULD GIVE ERROR ON DUPLICATED KEY
View Full Code Here


    final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where nick = 'Jay'"))
        .execute();

    Assert.assertFalse(result.isEmpty());

    Profile record;
    for (int i = 0; i < result.size(); ++i) {
      record = result.get(i);

      OrientTest.printRecord(i, record);

      Assert.assertTrue(record.getName().toString().equalsIgnoreCase("Jay"));
    }

    database.close();
  }
View Full Code Here

  @Test(dependsOnMethods = "testChangeOfIndexToNotUnique")
  public void testDuplicatedIndexOnNotUnique() {
    database.open("admin", "admin");

    Profile nickNolte = new Profile("Jay", "Nick", "Nolte", null);
    database.save(nickNolte);

    database.close();
  }
View Full Code Here

  public void createLinked() {
    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);

    Assert.assertEquals(database.countClass("Profile"), profiles + 3);
View Full Code Here

    final List<Profile> result = database.query(new OSQLSynchQuery<Profile>(
        "select from Profile where location.city.country.name = 'Spain'"));

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

    Profile profile;
    for (int i = 0; i < result.size(); ++i) {
      profile = result.get(i);

      Assert.assertEquals(profile.getLocation().getCity().getCountry().getName(), "Spain");
    }

    database.close();
  }
View Full Code Here

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

    Profile profile = (Profile) database.browseClass("Profile").next();

    final OSQLSynchQuery<Profile> query = new OSQLSynchQuery<Profile>("select from Profile where @rid = ?");
    List<Profile> result = database.query(query, new ORecordId(profile.getId()));

    Assert.assertEquals(result.size(), 1);

    database.close();
  }
View Full Code Here

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

    Profile profile = (Profile) database.browseClass("Profile").next();

    OSQLSynchQuery<Profile> query = new OSQLSynchQuery<Profile>("select from Profile where @rid = ?");
    List<Profile> result = database.query(query, profile.getId());

    Assert.assertEquals(result.size(), 1);

    // TEST WITHOUT # AS PREFIX
    query = new OSQLSynchQuery<Profile>("select from Profile where @rid = ?");
    result = database.query(query, profile.getId().substring(1));

    Assert.assertEquals(result.size(), 1);

    database.close();
  }
View Full Code Here

    params.put("surname", "Obama");

    List<Profile> result = database.query(query, params);
    Assert.assertTrue(result.size() != 0);

    Profile obama = result.get(0);

    result = database.query(new OSQLSynchQuery<Profile>("select from Profile where followings contains ( @Rid = :who )"), obama);
    Assert.assertTrue(result.size() != 0);

    database.close();
View Full Code Here

  @Test
  public void testDuplicatedIndexOnUnique() {
    database.open("admin", "admin");

    Profile jayMiner = new Profile("Jay", "Jay", "Miner", null);
    database.save(jayMiner);

    Profile jacobMiner = new Profile("Jay", "Jacob", "Miner", null);

    try {
      database.save(jacobMiner);

      // IT SHOULD GIVE ERROR ON DUPLICATED KEY
View Full Code Here

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

    final List<Profile> result = database.command(new OSQLSynchQuery<Profile>("select * from Profile where nick = 'Jay'"))
        .execute();

    Profile record;
    for (int i = 0; i < result.size(); ++i) {
      record = result.get(i);

      OrientTest.printRecord(i, record);

      Assert.assertTrue(record.getName().toString().equalsIgnoreCase("Jay"));
    }

    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.