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

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


      }
    }
  }

  public void testIndexMapUpdateItemInTxRollback() throws Exception {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    database.begin();
    Mapper loadedMapper = (Mapper) database.load(new ORecordId(mapper.getId()));
    loadedMapper.getIntMap().put("key2", 40);
    loadedMapper = database.save(loadedMapper);
    database.rollback();

    final List<ODocument> resultByKey = database.command(new OCommandSQL("select key, rid from index:mapIndexTestKey")).execute();
View Full Code Here


      }
    }
  }

  public void testIndexMapRemoveItem() {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);
    map.put("key3", 30);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    database.command(new OCommandSQL("UPDATE " + mapper.getId() + " remove intMap = 'key2'")).execute();

    final List<ODocument> resultByKey = database.command(new OCommandSQL("select key, rid from index:mapIndexTestKey")).execute();

    Assert.assertNotNull(resultByKey);
    Assert.assertEquals(resultByKey.size(), 2);
View Full Code Here

      }
    }
  }

  public void testIndexMapRemoveItemInTx() throws Exception {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);
    map.put("key3", 30);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    try {
      database.begin();
      Mapper loadedMapper = (Mapper) database.load(new ORecordId(mapper.getId()));
      loadedMapper.getIntMap().remove("key2");
      loadedMapper = database.save(loadedMapper);
      database.commit();
    } catch (Exception e) {
      database.rollback();
      throw e;
View Full Code Here

      }
    }
  }

  public void testIndexMapRemoveItemInTxRollback() throws Exception {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);
    map.put("key3", 30);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    database.begin();
    Mapper loadedMapper = (Mapper) database.load(new ORecordId(mapper.getId()));
    loadedMapper.getIntMap().remove("key2");
    loadedMapper = database.save(loadedMapper);
    database.rollback();

    final List<ODocument> resultByKey = database.command(new OCommandSQL("select key, rid from index:mapIndexTestKey")).execute();
View Full Code Here

      }
    }
  }

  public void testIndexMapRemove() {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);

    mapper.setIntMap(map);
    mapper = database.save(mapper);
    database.delete(mapper);

    final List<ODocument> resultByKey = database.command(new OCommandSQL("select key, rid from index:mapIndexTestKey")).execute();
View Full Code Here

    Assert.assertNotNull(resultByValue);
    Assert.assertEquals(resultByValue.size(), 0);
  }

  public void testIndexMapRemoveInTx() throws Exception {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    try {
      database.begin();
      database.delete(mapper);
View Full Code Here

    Assert.assertNotNull(resultByValue);
    Assert.assertEquals(resultByValue.size(), 0);
  }

  public void testIndexMapRemoveInTxRollback() throws Exception {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    database.begin();
    database.delete(mapper);
    database.rollback();
View Full Code Here

      }
    }
  }

  public void testIndexMapSQL() {
    Mapper mapper = new Mapper();
    Map<String, Integer> map = new HashMap<String, Integer>();

    map.put("key1", 10);
    map.put("key2", 20);

    mapper.setIntMap(map);
    mapper = database.save(mapper);

    final List<Mapper> resultByKey = database.query(new OSQLSynchQuery<Mapper>("select * from Mapper where intMap containskey ?"),
        "key1");
    Assert.assertNotNull(resultByKey);
View Full Code Here

TOP

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

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.