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

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


    super.afterMethod();
  }

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

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

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

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

    Assert.assertNotNull(resultByKey);
View Full Code Here


  }

  public void testIndexMapInTx() throws Exception {
    try {
      database.begin();
      final Mapper mapper = new Mapper();
      Map<String, Integer> map = new HashMap<String, Integer>();

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

      mapper.setIntMap(map);
      database.save(mapper);
      database.commit();
    } catch (Exception e) {
      database.rollback();
      throw e;
View Full Code Here

      }
    }
  }

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

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

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

    final Map<String, Integer> mapTwo = new HashMap<String, Integer>();

    mapTwo.put("key3", 30);
    mapTwo.put("key2", 20);

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

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

    Assert.assertNotNull(resultByKey);
View Full Code Here

      }
    }
  }

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

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

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

    database.begin();
    try {
      final Map<String, Integer> mapTwo = new HashMap<String, Integer>();

      mapTwo.put("key3", 30);
      mapTwo.put("key2", 20);

      mapper.setIntMap(mapTwo);
      mapper = database.save(mapper);
      database.commit();
    } catch (Exception e) {
      database.rollback();
      throw e;
View Full Code Here

      }
    }
  }

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

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

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

    database.begin();
    final Map<String, Integer> mapTwo = new HashMap<String, Integer>();

    mapTwo.put("key3", 30);
    mapTwo.put("key2", 20);

    mapper.setIntMap(mapTwo);
    mapper = database.save(mapper);
    database.rollback();

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

      }
    }
  }

  public void testIndexMapAddItem() {
    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.command(new OCommandSQL("UPDATE " + mapper.getId() + " put intMap = 'key3', 30")).execute();

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

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

      }
    }
  }

  public void testIndexMapAddItemTx() 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();
      Mapper loadedMapper = (Mapper) database.load(new ORecordId(mapper.getId()));
      loadedMapper.getIntMap().put("key3", 30);
      loadedMapper = database.save(loadedMapper);
      database.commit();
    } catch (Exception e) {
      database.rollback();
      throw e;
View Full Code Here

      }
    }
  }

  public void testIndexMapAddItemTxRollback() 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("key3", 30);
    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 testIndexMapUpdateItem() {
    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.command(new OCommandSQL("UPDATE " + mapper.getId() + " put intMap = 'key2', 40")).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 testIndexMapUpdateItemInTx() 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();
      Mapper loadedMapper = (Mapper) database.load(new ORecordId(mapper.getId()));
      loadedMapper.getIntMap().put("key2", 40);
      loadedMapper = database.save(loadedMapper);
      database.commit();
    } catch (Exception e) {
      database.rollback();
      throw e;
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.