Package org.tarantool.facade

Examples of org.tarantool.facade.TarantoolTemplate.save()


    Mapping<User> mapping = new Mapping<User>(User.class, TEMPLATE_SPACE, "id", "phone", "point", "iq", "height", "lifeFormId", "salary", "birthday",
        "name", "sign", "male");

    TarantoolTemplate template = new TarantoolTemplate(connectionFactory);
    template.addMapping(mapping);
    assertNotNull(template.save(user).insertOrReplaceAndGet());
    try {
      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {
View Full Code Here


    TarantoolTemplate template = new TarantoolTemplate(connectionFactory);
    template.addMapping(mapping);
    assertNotNull(template.save(user).insertOrReplaceAndGet());
    try {
      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {

    }
    assertEquals(1, template.save(user).replace());
View Full Code Here

      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {

    }
    assertEquals(1, template.save(user).replace());
    assertNotNull(template.find(User.class, 0, "id").condition(user.getId()).list());
    assertEquals(user.getPhone() + 1L, template.update(User.class, user.getId()).add("phone", 1).updateAndGet().getPhone());

    connectionFactory.free();
    return;
View Full Code Here

  @Test
  public void testCycle2() throws ParseException, MalformedURLException {
    User user = new User();
    SocketChannelPooledConnectionFactory connectionFactory = new SocketChannelPooledConnectionFactory("localhost", 33313, 1, 10);
    TarantoolTemplate template = new TarantoolTemplate(connectionFactory);
    assertNotNull(template.save(user).insertOrReplaceAndGet());
    try {
      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {
View Full Code Here

    User user = new User();
    SocketChannelPooledConnectionFactory connectionFactory = new SocketChannelPooledConnectionFactory("localhost", 33313, 1, 10);
    TarantoolTemplate template = new TarantoolTemplate(connectionFactory);
    assertNotNull(template.save(user).insertOrReplaceAndGet());
    try {
      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {

    }
    assertEquals(1, template.save(user).replace());
View Full Code Here

      template.save(user).insert();
      fail();
    } catch (TarantoolException ignored) {

    }
    assertEquals(1, template.save(user).replace());
    assertNotNull(template.find(User.class, 0, "id").condition(user.getId()).list());
    assertNotNull(template.find(User.class, 1).condition(user.getName()).one());
    assertEquals(user.getPhone() + 1L, template.update(User.class, user.getId()).add("phone", 1).updateAndGet().getPhone());

    connectionFactory.free();
View Full Code Here

    }
    User user = new User();
    tpl.delete(User.class, user.getId()).delete();
    assertNull(tpl.find(User.class, 0, "id").condition(123).one());

    assertEquals(1, tpl.save(user).insertOrReplace());
    try {
      tpl.save(user).insert();
      fail();
    } catch (TarantoolException e) {
View Full Code Here

    tpl.delete(User.class, user.getId()).delete();
    assertNull(tpl.find(User.class, 0, "id").condition(123).one());

    assertEquals(1, tpl.save(user).insertOrReplace());
    try {
      tpl.save(user).insert();
      fail();
    } catch (TarantoolException e) {

    }
    user.setBirthday(new Date((user.getBirthday().getTime() / 1000L) * 1000L));
 
View Full Code Here

      fail();
    } catch (TarantoolException e) {

    }
    user.setBirthday(new Date((user.getBirthday().getTime() / 1000L) * 1000L));
    assertTrue(user.equals(tpl.save(user).replaceAndGet()));

    assertNotNull(tpl.find(User.class, 1, "name").condition(user.getName()).one());
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.