-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(#317): add tests for testing large query in GQL and REST APIs
- Loading branch information
1 parent
351ebbe
commit 87c2c19
Showing
5 changed files
with
644 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...lApi/graphql/api/catalog/dataApi/CatalogGraphQLQueryTranslationVerifyingFunctionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* | ||
* _ _ ____ ____ | ||
* _____ _(_) |_ __ _| _ \| __ ) | ||
* / _ \ \ / / | __/ _` | | | | _ \ | ||
* | __/\ V /| | || (_| | |_| | |_) | | ||
* \___| \_/ |_|\__\__,_|____/|____/ | ||
* | ||
* Copyright (c) 2024 | ||
* | ||
* Licensed under the Business Source License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/FgForrest/evitaDB/blob/master/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.evitadb.externalApi.graphql.api.catalog.dataApi; | ||
|
||
import io.evitadb.core.Evita; | ||
import io.evitadb.test.annotation.UseDataSet; | ||
import io.evitadb.test.tester.GraphQLTester; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static io.evitadb.externalApi.graphql.api.testSuite.TestDataGenerator.GRAPHQL_THOUSAND_PRODUCTS; | ||
import static org.hamcrest.Matchers.nullValue; | ||
|
||
/** | ||
* Tests the widest possible range of constraints and variants of evitaDB query through GraphQL API. It tests if | ||
* the query can be successfully parsed and converted into evitaDB API. It doesn't test if it returns correct data, that's | ||
* what other tests are for. | ||
* | ||
* @author Lukáš Hornych, FG Forrest a.s. (c) 2024 | ||
*/ | ||
public class CatalogGraphQLQueryTranslationVerifyingFunctionTest extends CatalogGraphQLDataEndpointFunctionalTest { | ||
|
||
@Test | ||
@UseDataSet(GRAPHQL_THOUSAND_PRODUCTS) | ||
@DisplayName("Should accept and process large query") | ||
void shouldAcceptAndProcessLargeQuery(Evita evita) throws IOException { | ||
new GraphQLTester("https://demo.evitadb.io:5555/gql").test("evita") | ||
.document(readFromClasspath("testData/CatalogGraphQLQueryTranslationVerifyingFunctionTest_query.graphql")) | ||
.executeAndExpectOkAndThen() | ||
.body(ERRORS_PATH, nullValue()); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...ernalApi/rest/api/catalog/dataApi/CatalogRestQueryTranslationVerifyingFunctionalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* | ||
* _ _ ____ ____ | ||
* _____ _(_) |_ __ _| _ \| __ ) | ||
* / _ \ \ / / | __/ _` | | | | _ \ | ||
* | __/\ V /| | || (_| | |_| | |_) | | ||
* \___| \_/ |_|\__\__,_|____/|____/ | ||
* | ||
* Copyright (c) 2023-2024 | ||
* | ||
* Licensed under the Business Source License, Version 1.1 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/FgForrest/evitaDB/blob/master/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.evitadb.externalApi.rest.api.catalog.dataApi; | ||
|
||
import io.evitadb.core.Evita; | ||
import io.evitadb.test.annotation.UseDataSet; | ||
import io.evitadb.test.tester.RestTester; | ||
import io.evitadb.test.tester.RestTester.Request; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static io.evitadb.externalApi.rest.api.testSuite.TestDataGenerator.REST_THOUSAND_PRODUCTS; | ||
|
||
/** | ||
* Tests the widest possible range of constraints and variants of evitaDB query through REST API. It tests if | ||
* the query can be successfully parsed and converted into evitaDB API. It doesn't test if it returns correct data, that's | ||
* what other tests are for. | ||
* | ||
* @author Lukáš Hornych, FG Forrest a.s. (c) 2024 | ||
*/ | ||
class CatalogRestQueryTranslationVerifyingFunctionalTest extends CatalogRestDataEndpointFunctionalTest { | ||
|
||
@Test | ||
@UseDataSet(REST_THOUSAND_PRODUCTS) | ||
@DisplayName("Should accept and process large query") | ||
void shouldAcceptAndProcessLargeQuery(Evita evita) throws IOException { | ||
new RestTester("https://demo.evitadb.io:5555/rest").test("evita") | ||
.urlPathSuffix("/Product/query") | ||
.httpMethod(Request.METHOD_POST) | ||
.requestBody(readFromClasspath("testData/CatalogRestQueryTranslationVerifyingFunctionalTest_query.json")) | ||
.executeAndExpectOkAndThen(); | ||
} | ||
} |
Oops, something went wrong.