Skip to content

Commit

Permalink
Merge branch 'master' into deprecation-annotation-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dondonz committed Jan 10, 2024
2 parents 3c811c5 + 6b61b31 commit 420b9eb
Show file tree
Hide file tree
Showing 15 changed files with 520 additions and 633 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies {
testImplementation 'org.reactivestreams:reactive-streams-tck:' + reactiveStreamsVersion
testImplementation "io.reactivex.rxjava2:rxjava:2.2.21"

testImplementation 'org.testng:testng:7.8.0' // use for reactive streams test inheritance
testImplementation 'org.testng:testng:7.9.0' // use for reactive streams test inheritance

testImplementation 'org.openjdk.jmh:jmh-core:1.37'
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Large diffs are not rendered by default.

This file was deleted.

6 changes: 5 additions & 1 deletion src/test/groovy/example/http/ExecutionResultJSONTesting.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ private void testGson(HttpServletResponse response, Object er) throws IOExceptio
private ExecutionResult createER() {
List<GraphQLError> errors = new ArrayList<>();

errors.add(new ValidationError(ValidationErrorType.UnknownType, mkLocations(), "Test ValidationError")); // Retain as there is no alternative constructor for ValidationError
errors.add(ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.UnknownType)
.sourceLocations(mkLocations())
.description("Test ValidationError")
.build());
errors.add(new MissingRootTypeException("Mutations are not supported.", null));
errors.add(new InvalidSyntaxError(mkLocations(), "Not good syntax m'kay"));
errors.add(new NonNullableFieldWasNullError(new NonNullableFieldWasNullException(mkExecutionInfo(), mkPath())));
Expand Down
18 changes: 15 additions & 3 deletions src/test/groovy/graphql/ErrorsTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,21 @@ class ErrorsTest extends Specification {
def "ValidationError equals and hashcode works"() {
expect:

def same1 = new ValidationError(ValidationErrorType.BadValueForDefaultArg, [src(15, 34), src(23, 567)], "bad ju ju")
def same2 = new ValidationError(ValidationErrorType.BadValueForDefaultArg, [src(15, 34), src(23, 567)], "bad ju ju")
def different1 = new ValidationError(ValidationErrorType.FieldsConflict, [src(15, 34), src(23, 567)], "bad ju ju")
def same1 = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.BadValueForDefaultArg)
.sourceLocations([src(15, 34), src(23, 567)])
.description("bad ju ju")
.build()
def same2 = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.BadValueForDefaultArg)
.sourceLocations([src(15, 34), src(23, 567)])
.description("bad ju ju")
.build()
def different1 = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.FieldsConflict)
.sourceLocations([src(15, 34), src(23, 567)])
.description("bad ju ju")
.build()

commonAssert(same1, same2, different1)
}
Expand Down
6 changes: 5 additions & 1 deletion src/test/groovy/graphql/GraphQLErrorTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ class GraphQLErrorTest extends Specification {
where:

gError | expectedMap
new ValidationError(ValidationErrorType.UnknownType, mkLocations(), "Test ValidationError") |
ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.UnknownType)
.sourceLocations(mkLocations())
.description("Test ValidationError")
.build() |
[
locations: [[line: 666, column: 999], [line: 333, column: 0]],
message : "Test ValidationError",
Expand Down
6 changes: 5 additions & 1 deletion src/test/groovy/graphql/GraphqlErrorHelperTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ class GraphqlErrorHelperTest extends Specification {

def "can turn error classifications into extensions"() {

def validationErr = new ValidationError(ValidationErrorType.InvalidFragmentType, new SourceLocation(6, 9), "Things are not valid")
def validationErr = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.InvalidFragmentType)
.sourceLocation(new SourceLocation(6, 9))
.description("Things are not valid")
.build()

when:
def specMap = GraphqlErrorHelper.toSpecification(validationErr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import spock.lang.Specification

class DataFetcherResultTest extends Specification {

def error1 = new ValidationError(ValidationErrorType.DuplicateOperationName)
def error1 = ValidationError.newValidationError().validationErrorType(ValidationErrorType.DuplicateOperationName).build()
def error2 = new InvalidSyntaxError([], "Boo")

def "basic building"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExecutionStrategyExceptionHandlingEquivalenceTest extends Specification {

@Override
InstrumentationContext<Object> beginFieldFetch(InstrumentationFieldFetchParameters parameters, InstrumentationState state) {
throw new AbortExecutionException([new ValidationError(ValidationErrorType.UnknownType)]) // Retain as there is no alternative constructor for ValidationError
throw new AbortExecutionException([ValidationError.newValidationError().validationErrorType(ValidationErrorType.UnknownType).build()])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PreparsedDocumentEntryTest extends Specification {
def "Ensure a non-null errors returns"() {
given:
def errors = [new InvalidSyntaxError(new SourceLocation(0, 0), "bang"),
new ValidationError(ValidationErrorType.InvalidSyntax)]
ValidationError.newValidationError().validationErrorType(ValidationErrorType.InvalidSyntax).build()]

when:
def docEntry = new PreparsedDocumentEntry(errors)
Expand Down
12 changes: 10 additions & 2 deletions src/test/groovy/graphql/language/SerialisationTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ class SerialisationTest extends Specification {

when:
GraphQLError syntaxError1 = new InvalidSyntaxError(srcLoc(1, 1), "Bad Syntax 1")
GraphQLError validationError2 = new ValidationError(ValidationErrorType.FieldUndefined, srcLoc(2, 2), "Bad Query 2")
GraphQLError validationError2 = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.FieldUndefined)
.sourceLocation(srcLoc(2, 2))
.description("Bad Query 2")
.build()
def originalEntry = new PreparsedDocumentEntry([syntaxError1, validationError2])

PreparsedDocumentEntry newEntry = serialisedDownAndBack(originalEntry)
Expand Down Expand Up @@ -146,7 +150,11 @@ class SerialisationTest extends Specification {

Document originalDoc = TestUtil.parseQuery(query)
GraphQLError syntaxError1 = new InvalidSyntaxError(srcLoc(1, 1), "Bad Syntax 1")
GraphQLError validationError2 = new ValidationError(ValidationErrorType.FieldUndefined, srcLoc(2, 2), "Bad Query 2")
GraphQLError validationError2 = ValidationError.newValidationError()
.validationErrorType(ValidationErrorType.FieldUndefined)
.sourceLocation(srcLoc(2, 2))
.description("Bad Query 2")
.build()
def originalEntry = new PreparsedDocumentEntry(originalDoc, [syntaxError1, validationError2])
def originalAst = AstPrinter.printAst(originalEntry.getDocument())
PreparsedDocumentEntry newEntry = serialisedDownAndBack(originalEntry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class ExecutableNormalizedFieldTest extends Specification {
"""
Document document = TestUtil.parseQuery(query)

ExecutableNormalizedOperationFactory normalizedOperationFactory = new ExecutableNormalizedOperationFactory()
def normalizedOperation = normalizedOperationFactory.createExecutableNormalizedOperation(graphQLSchema, document, null, CoercedVariables.emptyVariables())
def normalizedOperation = ExecutableNormalizedOperationFactory.createExecutableNormalizedOperation(graphQLSchema, document, null, CoercedVariables.emptyVariables())

def pets = normalizedOperation.getTopLevelFields()[0]
def allChildren = pets.getChildren()
Expand Down
Loading

0 comments on commit 420b9eb

Please sign in to comment.