use of jakarta.nosql.query.PutQuery in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery1.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {12, \"Hunt\"}\n" })
public void shouldReturnParserQuery1(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof NumberQueryValue);
assertEquals(12L, NumberQueryValue.class.cast(key).get());
assertTrue(value instanceof StringQueryValue);
assertEquals("Hunt", StringQueryValue.class.cast(value).get());
assertFalse(ttl.isPresent());
}
use of jakarta.nosql.query.PutQuery in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery7.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {@name, @value, 10 nanosecond}\n" })
public void shouldReturnParserQuery7(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof ParamQueryValue);
assertEquals("name", ParamQueryValue.class.cast(key).get());
assertTrue(value instanceof ParamQueryValue);
assertEquals("value", ParamQueryValue.class.cast(value).get());
assertTrue(ttl.isPresent());
assertEquals(Duration.ofNanos(10L), ttl.get());
}
use of jakarta.nosql.query.PutQuery in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery3.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {@name, @value, 10 hour}\n" })
public void shouldReturnParserQuery3(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof ParamQueryValue);
assertEquals("name", ParamQueryValue.class.cast(key).get());
assertTrue(value instanceof ParamQueryValue);
assertEquals("value", ParamQueryValue.class.cast(value).get());
assertTrue(ttl.isPresent());
assertEquals(Duration.ofHours(10L), ttl.get());
}
use of jakarta.nosql.query.PutQuery in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery4.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {@name, @value, 10 minute}\n" })
public void shouldReturnParserQuery4(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof ParamQueryValue);
assertEquals("name", ParamQueryValue.class.cast(key).get());
assertTrue(value instanceof ParamQueryValue);
assertEquals("value", ParamQueryValue.class.cast(value).get());
assertTrue(ttl.isPresent());
assertEquals(Duration.ofMinutes(10L), ttl.get());
}
use of jakarta.nosql.query.PutQuery in project jnosql-diana by eclipse.
the class PutProviderTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "put {12, 12.12}\n" })
public void shouldReturnParserQuery2(String query) {
PutQuery putQuery = provider.apply(query);
QueryValue<?> key = putQuery.getKey();
QueryValue<?> value = putQuery.getValue();
Optional<Duration> ttl = putQuery.getTtl();
assertTrue(key instanceof NumberQueryValue);
assertEquals(12L, NumberQueryValue.class.cast(key).get());
assertTrue(value instanceof NumberQueryValue);
assertEquals(12.12, NumberQueryValue.class.cast(value).get());
assertFalse(ttl.isPresent());
}
Aggregations