use of jakarta.nosql.query.InsertQuery in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method shouldReturnParserQuery12.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (name = \"Diana\") 10 nanosecond" })
public void shouldReturnParserQuery12(String query) {
InsertQuery insertQuery = checkInsertFromStart(query);
checkTTL(insertQuery, Duration.ofNanos(10L));
}
use of jakarta.nosql.query.InsertQuery in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method shouldReturnParserQuery.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (name = \"Diana\")" })
public void shouldReturnParserQuery(String query) {
InsertQuery insertQuery = checkInsertFromStart(query);
List<Condition> conditions = insertQuery.getConditions();
assertEquals(1, conditions.size());
Condition condition = conditions.get(0);
assertEquals("name", condition.getName());
assertEquals(Operator.EQUALS, condition.getOperator());
QueryValue<?> value = condition.getValue();
assertTrue(value instanceof StringQueryValue);
assertEquals("Diana", StringQueryValue.class.cast(value).get());
assertFalse(insertQuery.getTtl().isPresent());
}
use of jakarta.nosql.query.InsertQuery in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method shouldReturnParserQuery2.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (stamina = 32.23)" })
public void shouldReturnParserQuery2(String query) {
InsertQuery insertQuery = checkInsertFromStart(query);
List<Condition> conditions = insertQuery.getConditions();
assertEquals(1, conditions.size());
Condition condition = conditions.get(0);
assertEquals("stamina", condition.getName());
assertEquals(Operator.EQUALS, condition.getOperator());
QueryValue<?> value = condition.getValue();
assertTrue(value instanceof NumberQueryValue);
assertEquals(32.23, NumberQueryValue.class.cast(value).get());
assertFalse(insertQuery.getTtl().isPresent());
}
use of jakarta.nosql.query.InsertQuery in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method shouldReturnParserQuery1.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "insert God (age = 30)" })
public void shouldReturnParserQuery1(String query) {
InsertQuery insertQuery = checkInsertFromStart(query);
List<Condition> conditions = insertQuery.getConditions();
assertEquals(1, conditions.size());
Condition condition = conditions.get(0);
assertEquals("age", condition.getName());
assertEquals(Operator.EQUALS, condition.getOperator());
QueryValue<?> value = condition.getValue();
assertTrue(value instanceof NumberQueryValue);
assertEquals(30L, NumberQueryValue.class.cast(value).get());
assertFalse(insertQuery.getTtl().isPresent());
}
use of jakarta.nosql.query.InsertQuery in project jnosql-diana by eclipse.
the class InsertQueryProviderTest method checkInsertFromStart.
private InsertQuery checkInsertFromStart(String query) {
InsertQuery insertQuery = insertQueryProvider.apply(query);
assertEquals("God", insertQuery.getEntity());
return insertQuery;
}
Aggregations