public static final int TEMPLATE_SPACE = 125;
public static final int TEMPLATE_CALL_SPACE = 127;
@Test
public void testCycle() throws ParseException, MalformedURLException {
User user = new User();
SocketChannelPooledConnectionFactory connectionFactory = new SocketChannelPooledConnectionFactory("localhost", 33313, 1, 10);
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) {
}
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;
}