use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DocumentQueryDeleteParserTest method shouldDeleteByNameLike.
@Test
public void shouldDeleteByNameLike() {
DocumentDeleteQuery query = parser.parse("deleteByNameLike", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.LIKE, query.getCondition().get().getCondition());
assertEquals(Document.of("name", "name"), query.getCondition().get().getDocument());
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DocumentQueryDeleteParserTest method shouldDeleteByNameOrAge.
@Test
public void shouldDeleteByNameOrAge() {
DocumentDeleteQuery query = parser.parse("deleteByNameOrAge", new Object[] { "name", 10 }, classRepresentation, converters);
DocumentCondition condition = query.getCondition().get();
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.OR, condition.getCondition());
List<DocumentCondition> conditions = condition.getDocument().get(new TypeReference<List<DocumentCondition>>() {
});
DocumentCondition condition1 = conditions.get(0);
assertEquals(Condition.EQUALS, condition1.getCondition());
assertEquals(Document.of("name", "name"), condition1.getDocument());
DocumentCondition condition2 = conditions.get(1);
assertEquals(Condition.EQUALS, condition2.getCondition());
assertEquals(Document.of("age", 10), condition2.getDocument());
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DocumentQueryDeleteParserTest method shouldDeleteByAgeGreaterThanEqual.
@Test
public void shouldDeleteByAgeGreaterThanEqual() {
DocumentDeleteQuery query = parser.parse("deleteByAgeGreaterThanEqual", new Object[] { 10 }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.GREATER_EQUALS_THAN, query.getCondition().get().getCondition());
assertEquals(Document.of("age", 10), query.getCondition().get().getDocument());
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DocumentQueryDeleteParserTest method shouldDeleteByNameAndAAgeBetween.
@Test
public void shouldDeleteByNameAndAAgeBetween() {
DocumentDeleteQuery query = parser.parse("deleteByNameAndAgeBetween", new Object[] { "name", 10, 11 }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
DocumentCondition condition = query.getCondition().get();
assertEquals(Condition.AND, condition.getCondition());
List<DocumentCondition> conditions = condition.getDocument().get(new TypeReference<List<DocumentCondition>>() {
});
DocumentCondition condition1 = conditions.get(0);
assertEquals(Condition.EQUALS, condition1.getCondition());
assertEquals(Document.of("name", "name"), condition1.getDocument());
DocumentCondition condition2 = conditions.get(1);
assertEquals(Condition.BETWEEN, condition2.getCondition());
assertEquals(Document.of("age", Arrays.asList(10, 11)), condition2.getDocument());
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DocumentQueryDeleteParserTest method shouldDeleteByName.
@Test
public void shouldDeleteByName() {
DocumentDeleteQuery query = parser.parse("deleteByName", new Object[] { "name" }, classRepresentation, converters);
assertEquals("Person", query.getDocumentCollection());
assertEquals(Condition.EQUALS, query.getCondition().get().getCondition());
assertEquals(Document.of("name", "name"), query.getCondition().get().getDocument());
}
Aggregations