Search in sources :

Example 11 with KeyValueEntity

use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.

the class DefaultKeyValueTemplateTest method shouldInsertTTL.

@Test
public void shouldInsertTTL() {
    Duration duration = Duration.ofSeconds(2L);
    User user = new User(KEY, "otavio", 27);
    subject.insert(user, duration);
    Mockito.verify(manager).put(captor.capture(), Mockito.eq(duration));
    KeyValueEntity entity = captor.getValue();
    assertEquals(KEY, entity.getKey());
    assertEquals(user, entity.getValue());
}
Also used : User(jakarta.nosql.tck.entities.User) Duration(java.time.Duration) KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Example 12 with KeyValueEntity

use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana by eclipse.

the class DefaultKeyValueTemplateTest method shouldInsert.

@Test
public void shouldInsert() {
    User user = new User(KEY, "otavio", 27);
    subject.insert(user);
    Mockito.verify(manager).put(captor.capture());
    KeyValueEntity entity = captor.getValue();
    assertEquals(KEY, entity.getKey());
    assertEquals(user, entity.getValue());
}
Also used : User(jakarta.nosql.tck.entities.User) KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Example 13 with KeyValueEntity

use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.

the class MemcachedBucketManagerTest method shouldMultiGet.

@Test
public void shouldMultiGet() {
    User user = new User("otavio");
    KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
    keyValueEntityManager.put(keyValue);
    assertNotNull(keyValueEntityManager.get("otavio"));
}
Also used : User(org.eclipse.jnosql.communication.memcached.keyvalue.model.User) KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Example 14 with KeyValueEntity

use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.

the class RedisBucketManagerTest method shouldMultiGet.

@Test
public void shouldMultiGet() {
    User user = new User("otavio");
    KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
    keyValueEntityManager.put(keyValue);
    assertNotNull(keyValueEntityManager.get("otavio"));
}
Also used : KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Example 15 with KeyValueEntity

use of jakarta.nosql.keyvalue.KeyValueEntity in project jnosql-diana-driver by eclipse.

the class ArangoDBKeyValueEntityManagerTest method shouldMultiGet.

@Test
public void shouldMultiGet() {
    User user = new User("otavio");
    KeyValueEntity keyValue = KeyValueEntity.of("otavio", Value.of(user));
    keyValueEntityManager.put(keyValue);
    assertNotNull(keyValueEntityManager.get("otavio"));
}
Also used : KeyValueEntity(jakarta.nosql.keyvalue.KeyValueEntity) Test(org.junit.jupiter.api.Test)

Aggregations

KeyValueEntity (jakarta.nosql.keyvalue.KeyValueEntity)38 Test (org.junit.jupiter.api.Test)31 User (jakarta.nosql.tck.entities.User)11 Duration (java.time.Duration)7 Value (jakarta.nosql.Value)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 ValueSource (org.junit.jupiter.params.provider.ValueSource)6 TypeReference (jakarta.nosql.TypeReference)3 KeyValuePreparedStatement (jakarta.nosql.keyvalue.KeyValuePreparedStatement)3 Params (jakarta.nosql.Params)2 QueryException (jakarta.nosql.QueryException)1 KeyValueEntityPostPersist (jakarta.nosql.mapping.keyvalue.KeyValueEntityPostPersist)1 KeyValueEntityPrePersist (jakarta.nosql.mapping.keyvalue.KeyValueEntityPrePersist)1 PutQuery (jakarta.nosql.query.PutQuery)1 Car (jakarta.nosql.tck.entities.Car)1 Person (jakarta.nosql.tck.entities.Person)1 User (org.eclipse.jnosql.communication.hazelcast.keyvalue.model.User)1 User (org.eclipse.jnosql.communication.infinispan.keyvalue.model.User)1 User (org.eclipse.jnosql.communication.memcached.keyvalue.model.User)1