This is an automated email from the ASF dual-hosted git repository.

andysch pushed a commit to branch issue/SLING-10900-201
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-graphql-core.git


The following commit(s) were added to refs/heads/issue/SLING-10900-201 by this 
push:
     new 443dd4d  Fixed some issue with the tests and cleanup
443dd4d is described below

commit 443dd4de969c387bdf028df8b446d82ccdda2299
Author: Andreas Schaefer <[email protected]>
AuthorDate: Mon Mar 27 11:00:05 2023 -0700

    Fixed some issue with the tests and cleanup
---
 pom.xml                                            |  2 +-
 .../graphql/core/engine/SelectedFieldWrapper.java  | 24 ----------------------
 .../graphql/core/engine/SelectionSetWrapper.java   |  8 --------
 .../engine/DefaultQueryExecutorLoggingTest.java    | 10 ++-------
 .../core/engine/DefaultQueryExecutorTest.java      |  2 --
 5 files changed, 3 insertions(+), 43 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7e65538..a0e2395 100644
--- a/pom.xml
+++ b/pom.xml
@@ -128,7 +128,7 @@
     <dependency>
       <groupId>com.graphql-java</groupId>
       <artifactId>java-dataloader</artifactId>
-      <version>3.2.4</version>
+      <version>3.2.0</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
diff --git 
a/src/main/java/org/apache/sling/graphql/core/engine/SelectedFieldWrapper.java 
b/src/main/java/org/apache/sling/graphql/core/engine/SelectedFieldWrapper.java
index 381092c..8b50e9e 100644
--- 
a/src/main/java/org/apache/sling/graphql/core/engine/SelectedFieldWrapper.java
+++ 
b/src/main/java/org/apache/sling/graphql/core/engine/SelectedFieldWrapper.java
@@ -44,30 +44,6 @@ public class SelectedFieldWrapper implements SelectedField {
     private Map<String, SelectedField> subFieldMap = new HashMap<>();
     private List<SelectedField> subFields;
 
-    //TODO: old 15.0 code -> remove when done with upgrade
-    @Deprecated
-    public SelectedFieldWrapper(Selection selection) {
-        SelectionSet selectionSet = null;
-        if (selection instanceof InlineFragment) {
-            InlineFragment inline = (InlineFragment) selection;
-            this.name = inline.getTypeCondition().getName();
-            this.isInline = true;
-            selectionSet = inline.getSelectionSet();
-        }
-        if (selection instanceof Field) {
-            Field subField = (Field) selection;
-            this.name = subField.getName();
-            selectionSet = subField.getSelectionSet();
-        }
-        if (selectionSet != null) {
-            selectionSet.getSelections().forEach(s -> {
-                SelectedFieldWrapper wrappedField = new 
SelectedFieldWrapper(s);
-                subFieldMap.put(wrappedField.getName(), wrappedField);
-            });
-        }
-        subFields = subFieldMap.values().stream().collect(Collectors.toList());
-    }
-
     public SelectedFieldWrapper(graphql.schema.SelectedField selectedField) {
         this.name = selectedField.getName();
         this.objectTypeBNames = selectedField.getObjectTypeNames();
diff --git 
a/src/main/java/org/apache/sling/graphql/core/engine/SelectionSetWrapper.java 
b/src/main/java/org/apache/sling/graphql/core/engine/SelectionSetWrapper.java
index a753659..0a97453 100644
--- 
a/src/main/java/org/apache/sling/graphql/core/engine/SelectionSetWrapper.java
+++ 
b/src/main/java/org/apache/sling/graphql/core/engine/SelectionSetWrapper.java
@@ -41,14 +41,6 @@ public class SelectionSetWrapper implements SelectionSet {
 
     public SelectionSetWrapper(@Nullable DataFetchingFieldSelectionSet 
selectionSet) {
         if (selectionSet != null) {
-// TODO: old 15.0 version code -> remove it when done with the upgrade
-//            selectionSet.get().getSubFields().forEach((k, v) -> {
-//                SelectedFieldWrapper selectedField = new 
SelectedFieldWrapper(v.getSingleField());
-//                fieldsMap.put(k, selectedField);
-//                if (!k.contains("/")) {
-//                    fields.add(selectedField);
-//                }
-//            });
             selectionSet.getImmediateFields().forEach(sf -> {
                 String name = sf.getName();
                 SelectedFieldWrapper selectedField = new 
SelectedFieldWrapper(sf);
diff --git 
a/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorLoggingTest.java
 
b/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorLoggingTest.java
index 6254f53..a0a74fd 100644
--- 
a/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorLoggingTest.java
+++ 
b/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorLoggingTest.java
@@ -75,6 +75,7 @@ public class DefaultQueryExecutorLoggingTest extends 
ResourceQueryTestBase {
     }
 
     private void assertQuerySyntaxError(String ... selectors) {
+// This does not work anymore because the error message is based on the query 
string
 //        final String invalidQuery = "INVALID " + UUID.randomUUID();
         final String invalidQuery = "INVALID " + 
"4ecae67c-13c5-432e-b36c-7a29d35118c1";
         queryJSON(invalidQuery, selectors);
@@ -83,14 +84,7 @@ public class DefaultQueryExecutorLoggingTest extends 
ResourceQueryTestBase {
             "Query failed for Resource " + resource.getPath(),
             "query=" + invalidQuery,
             "Errors:Error: type=InvalidSyntax",
-// 15.0
-//            "message=Invalid Syntax : offending token 'INVALID' at line 1 
column 1",
-// 17.4
-//            "message=Invalid Syntax : token recognition error at: '4ec' at 
line 1 column 9",
-// 20.0
-//            "message=Invalid syntax with ANTLR error 'token recognition 
error at: '4ec'' at line 1 column 9",
-// 20.0 Master branch 2/15/23
-                "message=Invalid syntax with offending token 'INVALID' at line 
1 column 1",
+            "message=Invalid syntax with ANTLR error 'token recognition error 
at: '4ec'' at line 1 column 9",
             String.format("selectors=%s", Arrays.toString(selectors))
         );
     }
diff --git 
a/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java
 
b/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java
index 6af79a8..e6fdf95 100644
--- 
a/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java
+++ 
b/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java
@@ -165,8 +165,6 @@ public class DefaultQueryExecutorTest extends 
ResourceQueryTestBase {
         ValidationResult result = queryExecutor.validate(stmt, 
Collections.emptyMap(), resource, new String[] {});
         assertFalse(result.isValid());
         String errors = String.join("\n", result.getErrors());
-// 15.0 & 17.4
-//        assertTrue("Wrong response, found errors: '" + errors + "'", 
errors.contains("Error: type=ValidationError; message=Validation error of type 
FieldUndefined: Field 'currentRsrc' in type 'Query' is undefined @ 
'currentRsrc'; location=1,3;"));
         assertTrue("Wrong response, found errors: '" + errors + "'", 
errors.contains("Error: type=ValidationError; message=Validation error 
(FieldUndefined@[currentRsrc]) : Field 'currentRsrc' in type 'Query' is 
undefined; location=1,3;"));
     }
 

Reply via email to