Skip to content

Commit

Permalink
added test in all int tests, new round of refactoring of int tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Senic committed Mar 30, 2023
1 parent 0202362 commit 771d9ae
Show file tree
Hide file tree
Showing 9 changed files with 600 additions and 410 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
import io.restassured.http.ContentType;
import io.stargate.sgv2.api.common.config.constants.HttpConstants;
import io.stargate.sgv2.jsonapi.testresource.DseTestResource;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;

@QuarkusIntegrationTest
@QuarkusTestResource(DseTestResource.class)
public class CountIntegrationTest extends CollectionResourceBaseIntegrationTest {
@Nested
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class Count {

@Test
Expand Down Expand Up @@ -116,8 +113,7 @@ private void insert(String json) {
}

@Test
@Order(2)
public void countNoFilter() {
public void noFilter() {
String json =
"""
{
Expand All @@ -139,8 +135,30 @@ public void countNoFilter() {
}

@Test
@Order(2)
public void countByColumn() {
public void emptyOptionsAllowed() {
String json =
"""
{
"countDocuments": {
"options": {}
}
}
""";

given()
.header(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME, getAuthToken())
.contentType(ContentType.JSON)
.body(json)
.when()
.post(CollectionResource.BASE_PATH, keyspaceId.asInternal(), collectionName)
.then()
.statusCode(200)
.body("status.count", is(5))
.body("errors", is(nullValue()));
}

@Test
public void byColumn() {
String json =
"""
{
Expand All @@ -164,8 +182,7 @@ public void countByColumn() {
}

@Test
@Order(2)
public void countWithEqComparisonOperator() {
public void withEqComparisonOperator() {
String json =
"""
{
Expand All @@ -189,8 +206,7 @@ public void countWithEqComparisonOperator() {
}

@Test
@Order(2)
public void countWithEqSubDoc() {
public void withEqSubDoc() {
String json =
"""
{
Expand All @@ -214,8 +230,7 @@ public void countWithEqSubDoc() {
}

@Test
@Order(2)
public void countWithEqSubDocWithIndex() {
public void withEqSubDocWithIndex() {
String json =
"""
{
Expand All @@ -239,8 +254,7 @@ public void countWithEqSubDocWithIndex() {
}

@Test
@Order(2)
public void countWithEqArrayElement() {
public void withEqArrayElement() {
String json =
"""
{
Expand All @@ -264,8 +278,7 @@ public void countWithEqArrayElement() {
}

@Test
@Order(2)
public void countWithExistFalseOperator() {
public void withExistFalseOperator() {
String json =
"""
{
Expand All @@ -287,8 +300,7 @@ public void countWithExistFalseOperator() {
}

@Test
@Order(2)
public void countWithExistOperator() {
public void withExistOperator() {
String json =
"""
{
Expand All @@ -312,8 +324,7 @@ public void countWithExistOperator() {
}

@Test
@Order(2)
public void countWithAllOperator() {
public void withAllOperator() {
String json =
"""
{
Expand All @@ -337,8 +348,7 @@ public void countWithAllOperator() {
}

@Test
@Order(2)
public void countWithAllOperatorLongerString() {
public void withAllOperatorLongerString() {
String json =
"""
{
Expand All @@ -362,8 +372,7 @@ public void countWithAllOperatorLongerString() {
}

@Test
@Order(2)
public void countWithAllOperatorMixedAFormatArray() {
public void withAllOperatorMixedAFormatArray() {
String json =
"""
{
Expand All @@ -387,8 +396,7 @@ public void countWithAllOperatorMixedAFormatArray() {
}

@Test
@Order(2)
public void countWithAllOperatorNoMatch() {
public void withAllOperatorNoMatch() {
String json =
"""
{
Expand All @@ -412,8 +420,7 @@ public void countWithAllOperatorNoMatch() {
}

@Test
@Order(2)
public void countWithEqSubDocumentShortcut() {
public void withEqSubDocumentShortcut() {
String json =
"""
{
Expand All @@ -437,8 +444,7 @@ public void countWithEqSubDocumentShortcut() {
}

@Test
@Order(2)
public void countWithEqSubDocument() {
public void withEqSubDocument() {
String json =
"""
{
Expand All @@ -462,8 +468,7 @@ public void countWithEqSubDocument() {
}

@Test
@Order(2)
public void countWithEqSubDocumentOrderChangeNoMatch() {
public void withEqSubDocumentOrderChangeNoMatch() {
String json =
"""
{
Expand All @@ -487,8 +492,7 @@ public void countWithEqSubDocumentOrderChangeNoMatch() {
}

@Test
@Order(2)
public void countWithEqSubDocumentNoMatch() {
public void withEqSubDocumentNoMatch() {
String json =
"""
{
Expand All @@ -512,8 +516,7 @@ public void countWithEqSubDocumentNoMatch() {
}

@Test
@Order(2)
public void countWithSizeOperator() {
public void withSizeOperator() {
String json =
"""
{
Expand All @@ -537,8 +540,7 @@ public void countWithSizeOperator() {
}

@Test
@Order(2)
public void countWithSizeOperatorNoMatch() {
public void withSizeOperatorNoMatch() {
String json =
"""
{
Expand All @@ -562,8 +564,7 @@ public void countWithSizeOperatorNoMatch() {
}

@Test
@Order(2)
public void countWithEqOperatorArray() {
public void withEqOperatorArray() {
String json =
"""
{
Expand All @@ -587,8 +588,7 @@ public void countWithEqOperatorArray() {
}

@Test
@Order(2)
public void countWithEqOperatorNestedArray() {
public void withEqOperatorNestedArray() {
String json =
"""
{
Expand All @@ -612,8 +612,7 @@ public void countWithEqOperatorNestedArray() {
}

@Test
@Order(2)
public void countWithEqOperatorArrayNoMatch() {
public void withEqOperatorArrayNoMatch() {
String json =
"""
{
Expand All @@ -637,8 +636,7 @@ public void countWithEqOperatorArrayNoMatch() {
}

@Test
@Order(2)
public void countWithEqOperatorNestedArrayNoMatch() {
public void withEqOperatorNestedArrayNoMatch() {
String json =
"""
{
Expand All @@ -662,8 +660,7 @@ public void countWithEqOperatorNestedArrayNoMatch() {
}

@Test
@Order(2)
public void countWithNEComparisonOperator() {
public void withNEComparisonOperator() {
String json =
"""
{
Expand All @@ -685,8 +682,7 @@ public void countWithNEComparisonOperator() {
}

@Test
@Order(2)
public void countByBooleanColumn() {
public void byBooleanColumn() {
String json =
"""
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void insert(int countOfDocument) {
}

@Test
public void deleteManyById() {
public void byId() {
insert(2);
String json =
"""
Expand Down Expand Up @@ -129,7 +129,34 @@ public void deleteManyById() {
}

@Test
public void deleteManyByColumn() {
public void emptyOptionsAllowed() {
insert(2);
String json =
"""
{
"deleteMany": {
"filter" : {"_id" : "doc1"},
"options": {}
}
}
""";

given()
.header(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME, getAuthToken())
.contentType(ContentType.JSON)
.body(json)
.when()
.post(CollectionResource.BASE_PATH, keyspaceId.asInternal(), collectionName)
.then()
.statusCode(200)
.body("status.deletedCount", is(1))
.body("status.moreData", is(nullValue()))
.body("data", is(nullValue()))
.body("errors", is(nullValue()));
}

@Test
public void byColumn() {
insert(5);
String json =
"""
Expand Down Expand Up @@ -177,7 +204,7 @@ public void deleteManyByColumn() {
}

@Test
public void deleteManyNoFilter() {
public void noFilter() {
insert(20);
String json =
"""
Expand Down Expand Up @@ -222,7 +249,7 @@ public void deleteManyNoFilter() {
}

@Test
public void deleteManyNoFilterMoreDataFlag() {
public void noFilterMoreDataFlag() {
insert(25);
String json =
"""
Expand Down Expand Up @@ -278,9 +305,9 @@ public void concurrentDeletes() throws Exception {
String document =
"""
{
"_id": "concurrent-%s"
}
""";
"_id": "concurrent-%s"
}
""";
for (int i = 0; i < totalDocuments; i++) {
insertDoc(document.formatted(i));
}
Expand Down
Loading

0 comments on commit 771d9ae

Please sign in to comment.