diff --git a/.github/ISSUE_TEMPLATE/01-compatible-certification-request.md b/.github/ISSUE_TEMPLATE/01-compatible-certification-request.md new file mode 100644 index 00000000..00c5387c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01-compatible-certification-request.md @@ -0,0 +1,27 @@ +--- +[Implementation Name]: Compatible Certification Request +about: Start a request for a compatible certification +title: 'MicroProfile GraphQL [Version] Compatible Certification Request' +labels: 'Certification :trophy:' +assignees: '' + +--- + +- [ ] Organization Name ("Organization") and, if applicable, URL:
+ // Add here +- [ ] Product Name, Version and download URL (if applicable):
+ // Add here +- [ ] Specification Name, Version and download URL:
+ // Add here +- [ ] (Optional) TCK Version, digital SHA-256 fingerprint and download URL:
+ // Add here +- [ ] Public URL of TCK Results Summary:
+ // Add here +- [ ] Any Additional Specification Certification Requirements:
+ // Add here +- [ ] Java runtime used to run the implementation:
+ // Add here +- [ ] Summary of the information for the certification environment, operating system, cloud, ...:
+ // Add here +- [ ] By checking this box I acknowledge that the Organization I represent accepts the terms of the [EFTL](https://www.eclipse.org/legal/tck.php). +- [ ] By checking this box I attest that all TCK requirements have been met, including any compatibility rules. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..b76b8957 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f62eec21..af53760a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,13 +12,14 @@ jobs: name: build with jdk ${{matrix.java}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 name: checkout - - uses: actions/setup-java@v1.3.0 + - uses: actions/setup-java@v2 name: set up jdk ${{matrix.java}} with: + distribution: 'adopt' java-version: ${{matrix.java}} - name: build with maven - run: mvn -B verify --file pom.xml + run: mvn -B verify javadoc:javadoc --file pom.xml diff --git a/.gitignore b/.gitignore index 0c9d7dba..e45783cc 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,18 @@ .idea .DS_Store **/*.iml +/api/target/ +/client/target/ +/client/api/target/ +/client/spec/target/ +/client/tck/target/ +/full/target/ +/full/api/target/ +/full/tck/target/ +/full/spec/target/ +/server/target/ +/server/api/target/ +/server/spec/target/ +/server/tck/target/ +/spec/target/ +/tck/target/ \ No newline at end of file diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index 15eead2a..43a8f1b4 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -25,9 +25,9 @@ Do you want to contribute to this project? Here is what you can do: ** Make sure you have signed the https://www.eclipse.org/legal/ECA.php[Eclipse Contributor Agreement] * https://github.com/eclipse/microprofile-graphql/issues[Create or fix an issue]. * https://gitter.im/eclipse/microprofile-graphql[Join us on Gitter to discuss this project]. -* Join our https://calendar.google.com/calendar/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com[weekly meeting] on Fridays at https://www.timeanddate.com/time/map/[15h30 GMT]. +* Join our https://calendar.google.com/calendar/embed?src=gbnbc373ga40n0tvbl88nkc3r4%40group.calendar.google.com[weekly meeting] on Fridays at https://www.timeanddate.com/time/map/[14h30 GMT]. ** https://docs.google.com/document/d/1gb3jirFGrJwDZSbrtnFPVTNjPNe3Y0dUYfm-HkU1c3U/edit#heading=h.xpx6vfxuho2d[Minutes and Agenda]. -** https://ibm.webex.com/meet/andymc[Meeting room]. +** https://bluejeans.com/27833906895[Meeting room]. * Join the discussions on the https://groups.google.com/forum/#!forum/microprofile[MicroProfile Google Group] * https://microprofile.io/blog/[Contribute a blog post]. diff --git a/README.asciidoc b/README.asciidoc index a6a519c2..9dc35570 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -22,20 +22,28 @@ image:https://badges.gitter.im/eclipse/microprofile-graphql.svg[link="https://gi = Microprofile GraphQL Specification -Read the https://download.eclipse.org/microprofile/microprofile-graphql-1.0/microprofile-graphql.html[MicroProfile GraphQL 1.0] Specification +Read the https://download.eclipse.org/microprofile/microprofile-graphql-1.1.0/microprofile-graphql-spec-1.1.0.html[MicroProfile GraphQL 1.1.0] Specification -== Generating the API and JavaDoc +== Structure -Just enter `mvn clean install` at the command line. Maven will generate the following artifacts. +This project consist of 3 parts: -API Jar:: -The jar containing the api interfaces and classes in `/api/target` +* link:server/README.asciidoc[Server] - The server-side of MicroProfile GraphQL. +* link:client/README.asciidoc[Client] - The client-side of MicroProfile GraphQL. +* link:full/README.asciidoc[Full] - The combination of Server and Client. -Specification:: -The PDF and HTML will be generated in `spec/target/generated-docs/` +Implementations can decide to implement only the Server, or only the Client, or both. -TCK:: -The TCK that can be used to test your implementation +== Use this in your project to depend on both the server and client API: + +[source,xml,numbered] +---- + + org.eclipse.microprofile.graphql + microprofile-graphql-api + 1.0.3 + +---- == About GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data. @@ -74,6 +82,18 @@ MicroProfile is the optimal place to host that standard as it is open, ideally s This specification will focus on making it easy for developers to create a GraphQL Service/Endpoint and publish it as an API. Where the data comes from (NoSQL, Relational DB, another service, etc.) is not the concern of this Proposed Specification. +== Implementations + +* SmallRye GraphQL - https://github.com/smallrye/smallrye-graphql (standalone implementation) +* Open Liberty 20.0.0.6 - https://openliberty.io/blog/2020/06/05/graphql-open-liberty-20006.html +* Quarkus 1.5 - https://quarkus.io/blog/quarkus-1-5-final-released/ +* Wildfly - https://www.wildfly.org/news/2020/08/13/Introducing-the-WildFly-GraphQL-feature-pack/ +* Helidon 2.2.0 - https://medium.com/helidon/microprofile-graphql-support-now-available-in-helidon-mp-dbc7bc0b4af + +== Acknowledgements + +This API and specification would not be possible without the enormous assistance from the https://github.com/leangen/graphql-spqr[GraphQL SPQR project]. + == Contributing Do you want to contribute to this project? link:CONTRIBUTING.adoc[Find out how you can help here]. diff --git a/client/README.asciidoc b/client/README.asciidoc new file mode 100644 index 00000000..9d42485f --- /dev/null +++ b/client/README.asciidoc @@ -0,0 +1,44 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += Microprofile GraphQL Client Specification + +== Generating the API and JavaDoc + +Just enter `mvn clean install` at the command line. Maven will generate the following artifacts. + +API Jar:: +The jar containing the api interfaces and classes in `/api/target` + +Specification:: +The PDF and HTML will be generated in `spec/target/generated-docs/` + +TCK:: +The TCK that can be used to test your implementation + +== Use this in your project + +[source,xml,numbered] +---- + + org.eclipse.microprofile.graphql + microprofile-graphql-client-api + 1.0.1 + +---- \ No newline at end of file diff --git a/client/api/pom.xml b/client/api/pom.xml new file mode 100644 index 00000000..a2f93465 --- /dev/null +++ b/client/api/pom.xml @@ -0,0 +1,125 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-client + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-client-api + MicroProfile GraphQL Client :: API + Client-side code-first GraphQL APIs for MicroProfile :: API + + + + + jakarta.json + jakarta.json-api + provided + + + + + + + maven-resources-plugin + 3.2.0 + + + copy-resources + validate + + copy-resources + + + ${basedir}/target/apidocs/doc-files/ + true + + + src/main/javadoc/licenses/${revremark}/ + true + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + false + true + true + none + ${project.name} + ${project.name} +
${project.name} v${project.version}]]>
+ + + Use is subject to license terms. + ]]> + + + + implSpec + a + Implementation Specification: + + +
+ + + attach-javadocs + + jar + + + +
+ + + biz.aQute.bnd + bnd-maven-plugin + + + + bnd-process + + + + + + org.apache.maven.plugins + maven-jar-plugin + + org.eclipse.microprofile.graphql.client + MicroProfile GraphQL Client bundle + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + +
+
+
\ No newline at end of file diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/GraphQLError.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/GraphQLError.java new file mode 100644 index 00000000..99ad267d --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/GraphQLError.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client; + +import java.util.List; +import java.util.Map; + +public interface GraphQLError { + + /** + * Textual description of the error, supplied by the service. + */ + String getMessage(); + + /** + * List of locations in the request that correspond to this error. Each location is a map that + * should contain the `line` and `column` items. + */ + List> getLocations(); + + /** + * The path to the response field where the error arose. This is represented as an array, where each item is either + * a string (when it represents a field), or an integer (when it represents an index). + */ + Object[] getPath(); + + /** + * Contents of the `extensions` field. This is used by GraphQL services to pass extra information about the error. + */ + Map getExtensions(); + + /** + * Any other fields beyond message, locations, path and extensions. These are discouraged by the spec, + * but if a GraphQL service adds them, they will appear in this map. + */ + Map getOtherFields(); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Request.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Request.java new file mode 100644 index 00000000..fea9a528 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Request.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client; + +import java.util.Map; + +public interface Request { + String getDocument(); + + Map getVariables(); + + void setVariables(Map variables); + + Object getVariable(String key); + + Request setVariable(String key, Object value); + + Request resetVariables(); + + String toJson(); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Response.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Response.java new file mode 100644 index 00000000..14dd906a --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/Response.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client; + +import javax.json.JsonObject; +import java.util.List; +import java.util.Map; + +public interface Response { + + /** + * The 'data' object contained in the response. + * Can be JsonValue.NULL if the response contains an empty field, or `null` if the response + * does not contain this field at all. + */ + JsonObject getData(); + + /** + * List of errors contained in this response. + */ + List getErrors(); + + /** + * Transform the contents of the `rootField` from this response into a list of objects + * of the requested type. + */ + List getList(Class dataType, String rootField); + + /** + * Transform the contents of the `rootField` from this response into an object + * of the requested type. + */ + T getObject(Class dataType, String rootField); + + /** + * If this response contains any data, this returns `true`; `false` otherwise. + */ + boolean hasData(); + + /** + * If this response contains at least one error, this returns `true`; `false` otherwise. + */ + boolean hasError(); + + /** + * Get transport-specific metadata that came from the server with this response. + */ + Map> getTransportMeta(); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Argument.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Argument.java new file mode 100644 index 00000000..89893a78 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Argument.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static java.util.Arrays.asList; +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface Argument extends Buildable { + /* + Static factory methods + */ + static List args(Argument... args) { + return asList(args); + } + + // (name, raw value) + static Argument arg(String name, Object value) { + Argument argument = getNewInstanceOf(Argument.class); + + argument.setName(name); + argument.setValue(value); + + return argument; + } + + // (name, inputObject) + static Argument arg(String name, InputObject inputObject) { + Argument argument = getNewInstanceOf(Argument.class); + + argument.setName(name); + argument.setValue(inputObject); + + return argument; + } + + // (name, variable) + static Argument arg(String name, Variable var) { + Argument argument = getNewInstanceOf(Argument.class); + + argument.setName(name); + argument.setValue(var); + + return argument; + } + + /* + Getter/Setter + */ + String getName(); + + void setName(String name1); + + Object getValue(); + + void setValue(Object value); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Buildable.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Buildable.java new file mode 100644 index 00000000..eb2fb88b --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Buildable.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import org.eclipse.microprofile.graphql.client.core.exceptions.BuildException; + +public interface Buildable { + String build() throws BuildException; +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Document.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Document.java new file mode 100644 index 00000000..7e08cbb0 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Document.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static java.util.Arrays.asList; +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface Document extends Buildable { + + /* + Static factory methods + */ + static Document document(FragmentOrOperation... operations) { + Document document = getNewInstanceOf(Document.class); + + document.setOperations(asList(operations)); + + return document; + } + + /* + Getter/Setter + */ + List getOperations(); + + void setOperations(List operations); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Enum.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Enum.java new file mode 100644 index 00000000..6a5eff54 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Enum.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface Enum extends Buildable { + /* + Static factory methods + */ + static Enum gqlEnum(String value) { + Enum gqlEnum = getNewInstanceOf(Enum.class); + + gqlEnum.setValue(value); + + return gqlEnum; + } + + /* + Getter/Setter + */ + String getValue(); + + void setValue(String value); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Field.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Field.java new file mode 100644 index 00000000..f98f1318 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Field.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface Field extends FieldOrFragment { + /* + Static factory methods + */ + static List fields(Field... fields) { + return asList(fields); + } + + // (name) + static Field field(String name) { + Field field = getNewInstanceOf(Field.class); + + field.setName(name); + field.setArguments(emptyList()); + field.setFields(emptyList()); + + return field; + } + + // (name, subfields) + static Field field(String name, FieldOrFragment... fields) { + Field field = getNewInstanceOf(Field.class); + + field.setName(name); + field.setArguments(emptyList()); + field.setFields(asList(fields)); + + return field; + } + + // (name, args) + static Field field(String name, Argument... args) { + Field field = getNewInstanceOf(Field.class); + + field.setName(name); + field.setArguments(asList(args)); + field.setFields(emptyList()); + + return field; + } + + // (name, args, subfields) + static Field field(String name, List args, Field... fields) { + Field field = getNewInstanceOf(Field.class); + + field.setName(name); + field.setArguments(args); + field.setFields(asList(fields)); + + return field; + } + + /* + Getter/Setter + */ + String getName(); + + void setName(String name); + + List getArguments(); + + void setArguments(List arguments); + + List getFields(); + + void setFields(List fields); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FieldOrFragment.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FieldOrFragment.java new file mode 100644 index 00000000..6136b4d9 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FieldOrFragment.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +/** + * Represents one of these nodes in a GraphQL document: + * - regular field (name), for example "color" + * - reference to a named fragment, for example "...comparisonFields" + * - an inline fragment, for example ("... on Person { name } ") + */ +public interface FieldOrFragment extends Buildable { +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Fragment.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Fragment.java new file mode 100644 index 00000000..65007467 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Fragment.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; +import static java.util.Arrays.asList; + +/** + * Represents a named fragment definition in a GraphQL document. Such definition consists of a name, + * target type, and a set of fields. + */ +public interface Fragment extends FragmentOrOperation { + /* + * Static factory methods + */ + static List fragments(Fragment... fragments) { + return asList(fragments); + } + + static FragmentBuilder fragment(String name) { + return new FragmentBuilder(name); + } + + /* + * Getter/Setter + */ + String getName(); + + void setName(String name); + + String getTargetType(); + + void setTargetType(String name); + + List getFields(); + + void setFields(List fields); + + class FragmentBuilder { + + private String name; + + private String targetType; + + private List fields; + + FragmentBuilder(String name) { + this.name = name; + } + + public Fragment on(String targetType, FieldOrFragment... fields) { + this.targetType = targetType; + this.fields = asList(fields); + return build(); + } + + Fragment build() { + Fragment fragment = getNewInstanceOf(Fragment.class); + fragment.setName(name); + fragment.setTargetType(targetType); + fragment.setFields(fields); + return fragment; + } + } +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentOrOperation.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentOrOperation.java new file mode 100644 index 00000000..c067307c --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentOrOperation.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +/** + * Represents a node in a GraphQL document that can contain either an operation (query/mutation/subscription), + * or a definition of a named fragment. On the top level, a GraphQL document basically consists of a list + * of these nodes. + */ +public interface FragmentOrOperation extends Buildable { +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentReference.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentReference.java new file mode 100644 index 00000000..87afb761 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/FragmentReference.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +/** + * Represents a reference to a named fragment. + */ +public interface FragmentReference extends FieldOrFragment { + + /** + * Create a fragment reference by specifying the name of the target fragment. + * In the resulting document, this will appear as `...FRAGMENTNAME` + */ + static FragmentReference fragmentRef(String name) { + FragmentReference ref = getNewInstanceOf(FragmentReference.class); + ref.setName(name); + return ref; + } + + /** + * Create a fragment reference by providing a built instance of a named fragment. + * This will actually only use the name of the fragment - in the resulting document, + * this will appear as `...FRAGMENTNAME` + */ + static FragmentReference fragmentRef(Fragment fragment) { + FragmentReference ref = getNewInstanceOf(FragmentReference.class); + ref.setName(fragment.getName()); + return ref; + } + + String getName(); + + void setName(String name); + +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InlineFragment.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InlineFragment.java new file mode 100644 index 00000000..0c8745e1 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InlineFragment.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; +import static java.util.Arrays.asList; + +/** + * Represents an inline fragment in a GraphQL document. This can be used + * anywhere where a field is expected (thus it implements `FieldOrFragment`). + */ +public interface InlineFragment extends FieldOrFragment { + + static InlineFragment on(String type, FieldOrFragment... fields) { + InlineFragment fragment = getNewInstanceOf(InlineFragment.class); + + fragment.setType(type); + fragment.setFields(asList(fields)); + + return fragment; + } + + String getType(); + + void setType(String name); + + List getFields(); + + void setFields(List fields); + +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObject.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObject.java new file mode 100644 index 00000000..eeb266e7 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObject.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; +import static java.util.Arrays.asList; + +public interface InputObject extends Buildable { + /* + Static factory methods + */ + static InputObject inputObject(InputObjectField... inputObjectFields) { + InputObject inputObject = getNewInstanceOf(InputObject.class); + + inputObject.setInputObjectFields(asList(inputObjectFields)); + + return inputObject; + } + + /* + Getter/Setter + */ + List getInputObjectFields(); + void setInputObjectFields(List inputObjectFields); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObjectField.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObjectField.java new file mode 100644 index 00000000..0021c1ea --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/InputObjectField.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface InputObjectField extends Buildable { + + /* + Static factory methods + */ + // (name, value) + static InputObjectField prop(String name, Object value) { + InputObjectField inputObjectField = getNewInstanceOf(InputObjectField.class); + + inputObjectField.setName(name); + inputObjectField.setValue(value); + + return inputObjectField; + } + + // (name, variable) + static InputObjectField prop(String name, Variable var) { + InputObjectField inputObjectField = getNewInstanceOf(InputObjectField.class); + + inputObjectField.setName(name); + inputObjectField.setValue(var); + + return inputObjectField; + } + + /* + Getter/Setter + */ + String getName(); + + void setName(String name); + + Object getValue(); + + void setValue(Object value); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Operation.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Operation.java new file mode 100644 index 00000000..ec923958 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Operation.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; + +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; +import static java.util.Arrays.asList; +import static java.util.Collections.emptyList; + +public interface Operation extends FragmentOrOperation { + /* + Helpers + */ + static List operations(Operation... operations) { + return asList(operations); + } + + // (fields) + static Operation operation(FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(QUERY); + operation.setName(""); + operation.setVariables(emptyList()); + operation.setFields(asList(fields)); + + return operation; + } + + // (vars, fields) + static Operation operation(List vars, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(QUERY); + operation.setName(""); + operation.setVariables(vars); + operation.setFields(asList(fields)); + + return operation; + } + + // (type, fields) + static Operation operation(OperationType type, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(type); + operation.setName(""); + operation.setVariables(emptyList()); + operation.setFields(asList(fields)); + + return operation; + } + + // (type, vars, fields) + static Operation operation(OperationType type, List vars, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(type); + operation.setName(""); + operation.setVariables(vars); + operation.setFields(asList(fields)); + + return operation; + } + + // (name, fields) + static Operation operation(String name, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(QUERY); + operation.setName(name); + operation.setVariables(emptyList()); + operation.setFields(asList(fields)); + + return operation; + } + + // (type, name, fields) + static Operation operation(OperationType type, String name, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(type); + operation.setName(name); + operation.setVariables(emptyList()); + operation.setFields(asList(fields)); + + return operation; + } + + // (name, vars, fields) + static Operation operation(String name, List vars, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(QUERY); + operation.setName(name); + operation.setVariables(vars); + operation.setFields(asList(fields)); + + return operation; + } + + // (type, name, vars, fields) + static Operation operation(OperationType type, String name, List vars, FieldOrFragment... fields) { + Operation operation = getNewInstanceOf(Operation.class); + + operation.setType(type); + operation.setName(name); + operation.setVariables(vars); + operation.setFields(asList(fields)); + + return operation; + } + + /* + * Getter/Setter + */ + OperationType getType(); + + void setType(OperationType type); + + String getName(); + + void setName(String name); + + List getVariables(); + + void setVariables(List vars); + + List getFields(); + + void setFields(List fields); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/OperationType.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/OperationType.java new file mode 100644 index 00000000..435c1faf --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/OperationType.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +public enum OperationType { + QUERY, + MUTATION +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/ScalarType.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/ScalarType.java new file mode 100644 index 00000000..0ec49e3d --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/ScalarType.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +public enum ScalarType { + GQL_INT("Int"), + GQL_FLOAT("Float"), + GQL_STRING("String"), + GQL_BOOL("Boolean"), + GQL_ID("ID"); + + private String type; + + ScalarType(String type) { + this.type = type; + } + + public String toString() { + return type; + } +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Variable.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Variable.java new file mode 100644 index 00000000..20862f36 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/Variable.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import java.util.List; +import java.util.Optional; + +import static org.eclipse.microprofile.graphql.client.core.VariableType.varType; +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; +import static java.util.Arrays.asList; + +public interface Variable extends Buildable { + /* + * Helpers + */ + static List vars(Variable... vars) { + return asList(vars); + } + + // (name, scalarType) + static Variable var(String name, ScalarType scalarType) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType(scalarType)); + var.setDefaultValue(Optional.empty()); + + return var; + } + + // (name, scalarType, defaultValue) + static Variable var(String name, ScalarType scalarType, Object defaultValue) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType(scalarType)); + var.setDefaultValue(Optional.of(defaultValue)); + + return var; + } + + // (name, objectType) + static Variable var(String name, String objectTypeName) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType(objectTypeName)); + var.setDefaultValue(Optional.empty()); + + return var; + } + + // (name, objectType, defaultValue) + static Variable var(String name, String objectTypeName, Object defaultValue) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType(objectTypeName)); + var.setDefaultValue(Optional.of(defaultValue)); + + return var; + } + + // (name, variableType) + static Variable var(String name, VariableType varType) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType); + var.setDefaultValue(Optional.empty()); + + return var; + } + + // (name, variableType, defaultValue) + static Variable var(String name, VariableType varType, Object defaultValue) { + Variable var = getNewInstanceOf(Variable.class); + + var.setName(name); + var.setType(varType); + var.setDefaultValue(Optional.of(defaultValue)); + + return var; + } + + /* + Getter/Setter + */ + String getName(); + + void setName(String name); + + VariableType getType(); + + void setType(VariableType value); + + Optional getDefaultValue(); + + void setDefaultValue(Optional value); +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/VariableType.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/VariableType.java new file mode 100644 index 00000000..a79be170 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/VariableType.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core; + +import static org.eclipse.microprofile.graphql.client.core.utils.ServiceUtils.getNewInstanceOf; + +public interface VariableType extends Buildable { + + /* + * Static factory methods + */ + // (objectTypeName) + static VariableType varType(String objectTypeName) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName(objectTypeName); + varType.setNonNull(false); + varType.setChild(null); + + return varType; + } + + // (scalarType) + static VariableType varType(ScalarType scalarType) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName(scalarType.toString()); + varType.setNonNull(false); + varType.setChild(null); + + return varType; + } + + // nonNull(scalarType) + static VariableType nonNull(ScalarType scalarType) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName(scalarType.toString()); + varType.setNonNull(true); + varType.setChild(null); + + return varType; + } + + // nonNull(objectTypeName) + static VariableType nonNull(String objectTypeName) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName(objectTypeName); + varType.setNonNull(true); + varType.setChild(null); + + return varType; + } + + // nonNull(varType) + static VariableType nonNull(VariableType varType) { + varType.setNonNull(true); + return varType; + } + + // list(scalarType) + static VariableType list(ScalarType scalarType) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName("list(" + scalarType.toString() + ")"); + varType.setNonNull(false); + varType.setChild(varType(scalarType)); + + return varType; + } + + // list(typeName) + static VariableType list(String objectTypeName) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName("list(" + objectTypeName + ")"); + varType.setNonNull(false); + varType.setChild(varType(objectTypeName)); + + return varType; + } + + // list(variableType) + static VariableType list(VariableType childVarType) { + VariableType varType = getNewInstanceOf(VariableType.class); + + varType.setName("list(" + childVarType.getName() + ")"); + varType.setNonNull(false); + varType.setChild(childVarType); + + return varType; + } + + /* + Getter/Setter + */ + String getName(); + + void setName(String name); + + boolean isNonNull(); + + void setNonNull(boolean nonNull); + + VariableType getChild(); + + void setChild(VariableType child); + + default boolean isList() { + return getChild() != null; + } +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/exceptions/BuildException.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/exceptions/BuildException.java new file mode 100644 index 00000000..3d72f9e6 --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/exceptions/BuildException.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core.exceptions; + +public class BuildException extends RuntimeException { + public BuildException(String msg) { + super(msg); + } +} diff --git a/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/utils/ServiceUtils.java b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/utils/ServiceUtils.java new file mode 100644 index 00000000..c05180db --- /dev/null +++ b/client/api/src/main/java/org/eclipse/microprofile/graphql/client/core/utils/ServiceUtils.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.core.utils; + +import java.util.ServiceLoader; + +public class ServiceUtils { + // TODO: check if 0 or >1 instance found. Throw exception if either. + public static T getNewInstanceOf(Class clazz) { + ServiceLoader sl = ServiceLoader.load(clazz); + T t = sl.iterator().next(); + + return t; + } + + private ServiceUtils() { + // HideUtilityClassConstructor + } +} diff --git a/client/api/src/main/javadoc/licenses/Draft/license.html b/client/api/src/main/javadoc/licenses/Draft/license.html new file mode 100644 index 00000000..994b5f85 --- /dev/null +++ b/client/api/src/main/javadoc/licenses/Draft/license.html @@ -0,0 +1,27 @@ + + +Apache License - Version 2 + + +

Apache License - Version 2

+

+Copyright (c) ${inceptionYear}-${currentYear} Contributors to the Eclipse Foundation +

+

+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +

+

+ + http://www.apache.org/licenses/LICENSE-2.0 +

+

+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. +

+ + \ No newline at end of file diff --git a/client/api/src/main/javadoc/licenses/Final/license.html b/client/api/src/main/javadoc/licenses/Final/license.html new file mode 100644 index 00000000..be52b4f2 --- /dev/null +++ b/client/api/src/main/javadoc/licenses/Final/license.html @@ -0,0 +1,72 @@ + + +Eclipse Foundation Specification License - v1.0 + + +

Eclipse Foundation Specification License - v1.0

+

By using and/or copying this document, or the Eclipse Foundation + document from which this statement is linked, you (the licensee) agree + that you have read, understood, and will comply with the following + terms and conditions:

+ +

Permission to copy, and distribute the contents of this document, or + the Eclipse Foundation document from which this statement is linked, in + any medium for any purpose and without fee or royalty is hereby + granted, provided that you include the following on ALL copies of the + document, or portions thereof, that you use:

+ +
    +
  • link or URL to the original Eclipse Foundation document.
  • +
  • All existing copyright notices, or if one does not exist, a notice + (hypertext is preferred, but a textual representation is permitted) + of the form: "Copyright © [$date-of-document] + “Eclipse Foundation, Inc. <<url to this license>> + " +
  • +
+ +

Inclusion of the full text of this NOTICE must be provided. We + request that authorship attribution be provided in any software, + documents, or other items or products that you create pursuant to the + implementation of the contents of this document, or any portion + thereof.

+ +

No right to create modifications or derivatives of Eclipse Foundation + documents is granted pursuant to this license, except anyone may + prepare and distribute derivative works and portions of this document + in software that implements the specification, in supporting materials + accompanying such software, and in documentation of such software, + PROVIDED that all such works include the notice below. HOWEVER, the + publication of derivative works of this document for use as a technical + specification is expressly prohibited.

+ +

The notice is:

+ +

"Copyright © [$date-of-document] Eclipse Foundation. This software or + document includes material copied from or derived from [title and URI + of the Eclipse Foundation specification document]."

+ +

Disclaimers

+ +

THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT + HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE + SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS + WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR + OTHER RIGHTS.

+ +

THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE + FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT + OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE + CONTENTS THEREOF.

+ +

The name and trademarks of the copyright holders or the Eclipse + Foundation may NOT be used in advertising or publicity pertaining to + this document or its contents without specific, written prior + permission. Title to copyright in this document will at all times + remain with copyright holders.

+ + + diff --git a/client/pom.xml b/client/pom.xml new file mode 100644 index 00000000..36831c95 --- /dev/null +++ b/client/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-parent + 2.0-SNAPSHOT + ../ + + + MicroProfile GraphQL Client + + Client-side code-first API for developing GraphQL services in MicroProfile + microprofile-graphql-client + pom + + + + 1.8 + 1.8 + UTF-8 + UTF-8 + + + + spec + api + tck + + \ No newline at end of file diff --git a/client/spec/pom.xml b/client/spec/pom.xml new file mode 100644 index 00000000..aedd497e --- /dev/null +++ b/client/spec/pom.xml @@ -0,0 +1,183 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-client + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-client-spec + pom + + MicroProfile GraphQL Client :: Specification + Client-side code-first GraphQL APIs for MicroProfile :: Specification + + + ${project.build.directory}/generated-docs/${project.build.finalName}.pdf + ${project.build.directory}/generated-docs/${project.build.finalName}.html + + + + + + ${project.groupId} + microprofile-graphql-client-api + ${project.version} + + + + + jakarta.json + jakarta.json-api + 1.1.6 + provided + + + + + clean package + + + org.asciidoctor + asciidoctor-maven-plugin + + + org.asciidoctor + asciidoctorj-diagram + 2.2.3 + + + + + asciidoctor-diagram + + + + + + + + generate-pdf-doc + generate-resources + + process-asciidoc + + + ${spec.pdf} + pdf + + + + output-html + generate-resources + + process-asciidoc + + + ${spec.html} + html5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${spec.pdf} + pdf + + + ${spec.html} + html + + + + + + + + + + \ No newline at end of file diff --git a/client/spec/src/main/asciidoc/client.asciidoc b/client/spec/src/main/asciidoc/client.asciidoc new file mode 100644 index 00000000..d54a2a6f --- /dev/null +++ b/client/spec/src/main/asciidoc/client.asciidoc @@ -0,0 +1,23 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL Client + +include::dynamic_client.asciidoc[] +include::typesafe_client.asciidoc[] diff --git a/client/spec/src/main/asciidoc/dynamic_client.asciidoc b/client/spec/src/main/asciidoc/dynamic_client.asciidoc new file mode 100644 index 00000000..51b57483 --- /dev/null +++ b/client/spec/src/main/asciidoc/dynamic_client.asciidoc @@ -0,0 +1,362 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL Dynamic Client + +== Rationale + +MicroProfile GraphQL 1.0 has been focused on the server-side enabling to develop and expose GraphQL endpoints. The purpose of this specification is to define a so-called "dynamic" client API. + +"Dynamic" means close to the GraphQL specification semantic and structure. We can compare it with what JAX-RS client API is for REST. + +A "type-safe" client API, similar to MicroProfile RestClient, should also be proposed in another document. + +== Goals + +. *Provides full control over the MicroProfile GraphQL capabilities*: operations, arguments, variables, input types, scalars, interface, partial results, errors ... +. *Consistency with MicroProfile GraphQL server* annotations (DateFormat, NumberFormat ...) and capabilities +. *Consistency with MicroProfile*: +* No dependency outside MicroProfile core +* Configuration exclusively based on MicroProfile Config +* Support of JSON-B format directives + + +== Non goals + +. *Transport layer support*: the GraphQL specification is independent of transport layer. +We propose to stay aligned with this, leaving the final implementation free to use any client network library (JAX-RS, Apache HTTPClient ...). +. *Serialization of custom Java classes to build requests* +. *Deserialization of responses into custom Java classes* + +== Java 8 support + +Java 8 is still widely used in the industry and we propose to stick to it for a broader adoption. + +== GraphQL components support +**** +*bold*: fully supported components. + +*_italic bold_*: partially supported components. + +blank: not yet supported components. +**** + +* *_Document_* +** *_Operation definition_* +*** *_Operation type_* +**** *Query* +**** *Mutation* +**** Subscription +*** *Name* +*** *_Variable definitions_* +**** *Type* +**** *Default value* +**** Directives +*** Directives +*** *_Selection set_* +**** *_Field_* +***** Alias +***** *Name* +***** *Arguments* +****** *Variable* +****** *Int value* +****** *Float value* +****** *String value* +****** *Boolean value* +****** *Null value* +****** *Enum value* +****** *List value* +****** *Object value* +***** Directives +**** Fragment spread +**** Inline fragment +** Fragment definition +** TypeSystem definition +** TypeSystem extension + +== Next steps + +To be studied for next releases: + +* Fragments, subscriptions and directives +* Reactive API +* https://spec.graphql.org/draft/#sec-Document[Multiple operations inside a GraphQL document] + +== API + +include::../resources/generated/api_core_class_diagram.asciidoc[] + +**** +IMPORTANT: *Static factory methods over constructors* + +In order to make writing of GraphQL requests in Java as close as possible to the original GraphQL's philosophy, *static factory methods* are the recommended way to use the API (those are the underlined methods in the diagram above). +**** + +== Writing a GraphQL document + +Instead of describing each GraphQL components as it is already done in the https://spec.graphql.org/draft/[GraphQL specification], we will simply show multiple usecases of the API. + +Samples are inspired by https://github.com/graphql/graphql-js/[graphql-js] tests suite. + +=== Basic Queries +.GraphQL +[source,graphql,numbered] +---- +query HeroNameQuery { + hero { + name + } +} +---- +.Java +[source,java,numbered] +---- +Document gqlDoc = document( + operation("HeroNameQuery", + field("hero", + field("name"))) +); +---- + +''' + +.GraphQL +[source,graphql,numbered] +---- +query HeroNameAndFriendsQuery { + hero { + id + name + friends { + name + } + } +} +---- +.Java +[source,java,numbered] +---- +Document gqlDoc = document( + operation("HeroNameAndFriendsQuery", + field("hero", + field("id"), + field("name"), + field("friends", + field("name")))) +); +---- + +=== Nested Queries +.GraphQL +[source,graphql,numbered] +---- +query NestedQuery { + hero { + name + friends { + name + appearsIn + friends { + name + } + } + } +} +---- +.Java +[source,java,numbered] +---- +Document gqlDoc = document( + operation("NestedQuery", + field("hero", + field("name"), + field("friends", + field("name"), + field("appearsIn"), + field("friends", + field("name"))))) +); +---- + +=== Queries with arguments +.GraphQL +[source,graphql,numbered] +---- +query FetchLukeAndC3POQuery { + human(id: "1000") { + name + } + droid(id: "2000") { + name + } +} +---- +.Java +[source,java,numbered] +---- +Document gqlDoc = document( + operation("FetchLukeAndC3POQuery", + field("human", args(arg("id", "1000")), + field("name")), + field("droid", args(arg("id", "2000")), + field("name"))) +); +---- + +=== Queries with variables +.GraphQL +[source,graphql,numbered] +---- +query FetchSomeIDQuery($someId: String!) { + human(id: $someId) { + name + } +} +---- +.Java +[source,java,numbered] +---- +Variable someId = var("someId", nonNull(GQL_STRING)); + +Document gqlDoc = document( + operation("FetchSomeIDQuery", vars(someId), + field("human", args(arg("id", someId)), + field("name")) +); +---- + +== Sending a GraphQL document + +Once a GraphQL document has been prepared, it can be run against a server. +This specification proposes two abstractions for that: + +. **Request**: prepare a GraphQL request execution with the possibility to set variables. + +. **Response**: a holder for a GraphQL response including data and errors (if any). + +=== Client API +include::../resources/generated/api_client_class_diagram.asciidoc[] + +==== Request +===== Initialization + +A Request object is initialised with a GraphQL document: +[source,Java] +---- +Document gqlDoc = document( + operation("HeroNameQuery", + field("hero", + field("name")))); + +Request request = new DynaQLRequest(gqlDoc.build()); +---- +===== Setting variables +Optional GraphQL variables can be provided fluently: +[source,Java] +---- +Request request = new DynaQLRequest(document) + .setVariable("surname", "Mike") + .setVariable("personId", 1001); +---- +In order to make it reuseable for other executions, variables can also be reset: +[source,Java] +---- +request + .resetVariables() + .setVariable("surname", "John") + .setVariable("personId", 2002); +---- +With this approach, a _Request_ object is immutable regarding the GraphQL document to send and mutable regarding the variables. +It is the responsibility of the caller to ensure the consistency between the request and the variables. + +Once initialized with a document and optional variables, a _Request_ object can be sent to a GraphQL server. As mentioned in the "non-goal" paragraph, this specification is deliberatly transport agnostic. It is the responsibility of the implementation to propose a transport layer. + +For instance: + +* JAX-RS in a Jakarta EE or MicroProfile container. +* raw HTTP using a library such as Apache HTTP client. + +You can lookup https://github.com/worldline/dynaql/[DynaQL] for an implementation of both. + +==== Response + +Response is a holder both for data and errors with some handy capabilities to retrieve the data directly as POJOs. + +**** +NOTE: *Partial results* + +In GraphQL you can have _partial results_, meaning you can get data for some fields and errors for some others in the same response. +**** + +===== Getting errors +We can check if there is any error and access each of them: +[source, Java] +---- +if (response.hasError()) { + log.warn("GraphQL error:"); + graphQLResponse.getErrors().forEach(e -> log.warning(e.toString())); +} +---- + +The getErrors() method returns a list of _Error_ objects. +In accordance with the specification, an _Error_ is made of: + +* a message +* a list of locations +* an array of path +* a map of extensions + +It is the responsibility of the client to decide how to deal with GraphQL errors. + +==== Getting data +The hasData method enables to check if there is any data: +[source, Java] +---- +if (response.hasData()) + log.info("Data inside"); +---- + +Data can be obtained in 2 ways: + +* *as a generic JsonObject*: using the getData method. +* *as a POJO* (or a list of them): using the getObject (or getList) method. In that case, it is necessary to provide the expected data rootfield to be retrieved. + +For instance, with a UserProfile application class: +[source, Java] +---- +// Get the data as a generic JsonObject +JsonObject data = response.getData(); + +// Turn it into a UserProfile object +JsonObject myData = data.getJsonObject("profile"); +Jsonb jsonb = JsonbBuilder.create(); +UserProfile userProfile = jsonb.fromJson(myData.toString(), Profile.class); + +// OR + +// Directly get a UserProfile object from response +UserProfile userProfile = response.getObject(Profile.class, "profile"); +---- + +In the same way, the getList method enables to get a list of objects: +[source,Java] +---- +// Get a list of Person from a response +List people = response.getList(Person.class, "people"); +---- diff --git a/spec/src/main/asciidoc/microprofile-graphql.asciidoc b/client/spec/src/main/asciidoc/index.asciidoc similarity index 79% rename from spec/src/main/asciidoc/microprofile-graphql.asciidoc rename to client/spec/src/main/asciidoc/index.asciidoc index 99c01737..3e2ac55b 100644 --- a/spec/src/main/asciidoc/microprofile-graphql.asciidoc +++ b/client/spec/src/main/asciidoc/index.asciidoc @@ -17,31 +17,24 @@ // limitations under the License. // -= MicroProfile GraphQL += MicroProfile GraphQL Client :authors: Jean-Francois James, Phillip Krüger, Andy McCright, Jean-Baptiste Roux, Bojan Tomic, Adam Anderson :email: microprofile@googlegroups.com :version-label!: :sectanchors: :doctype: book -:license: Apache License v2.0 +:license: Eclipse Foundation Specification License v1.0 :source-highlighter: coderay +:sectnums: :toc: left :toclevels: 4 :sectnumlevels: 4 ifdef::backend-pdf[] :pagenums: +:numbered: endif::[] +include::license-efsl.asciidoc[] -include::license-alv2.asciidoc[] +include::client.asciidoc[] -== MicroProfile GraphQL -include::intro.asciidoc[] - -include::entities.asciidoc[] - -include::components.asciidoc[] - -include::errorhandling.asciidoc[] - -include::release_notes.asciidoc[] diff --git a/spec/src/main/asciidoc/license-alv2.asciidoc b/client/spec/src/main/asciidoc/license-alv2.asciidoc similarity index 100% rename from spec/src/main/asciidoc/license-alv2.asciidoc rename to client/spec/src/main/asciidoc/license-alv2.asciidoc diff --git a/client/spec/src/main/asciidoc/license-efsl.asciidoc b/client/spec/src/main/asciidoc/license-efsl.asciidoc new file mode 100644 index 00000000..85993af3 --- /dev/null +++ b/client/spec/src/main/asciidoc/license-efsl.asciidoc @@ -0,0 +1,73 @@ +[subs="normal"] +.... +Specification: {doctitle} +Version: {revnumber} +Status: {revremark} +Release: {revdate} +.... + +== Copyright + +Copyright (c) {inceptionYear}, {currentYear} Eclipse Foundation. + +=== Eclipse Foundation Specification License + +By using and/or copying this document, or the Eclipse Foundation +document from which this statement is linked, you (the licensee) agree +that you have read, understood, and will comply with the following +terms and conditions: + +Permission to copy, and distribute the contents of this document, or +the Eclipse Foundation document from which this statement is linked, in +any medium for any purpose and without fee or royalty is hereby +granted, provided that you include the following on ALL copies of the +document, or portions thereof, that you use: + +* link or URL to the original Eclipse Foundation document. +* All existing copyright notices, or if one does not exist, a notice + (hypertext is preferred, but a textual representation is permitted) + of the form: "Copyright (c) [$date-of-document] + Eclipse Foundation, Inc. \<>" + +Inclusion of the full text of this NOTICE must be provided. We +request that authorship attribution be provided in any software, +documents, or other items or products that you create pursuant to the +implementation of the contents of this document, or any portion +thereof. + +No right to create modifications or derivatives of Eclipse Foundation +documents is granted pursuant to this license, except anyone may +prepare and distribute derivative works and portions of this document +in software that implements the specification, in supporting materials +accompanying such software, and in documentation of such software, +PROVIDED that all such works include the notice below. HOWEVER, the +publication of derivative works of this document for use as a technical +specification is expressly prohibited. + +The notice is: + +"Copyright (c) [$date-of-document] Eclipse Foundation. This software or +document includes material copied from or derived from [title and URI +of the Eclipse Foundation specification document]." + +==== Disclaimers + +THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT +HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR +WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE +SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS +WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR +OTHER RIGHTS. + +THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE +FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT +OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE +CONTENTS THEREOF. + +The name and trademarks of the copyright holders or the Eclipse +Foundation may NOT be used in advertising or publicity pertaining to +this document or its contents without specific, written prior +permission. Title to copyright in this document will at all times +remain with copyright holders. diff --git a/client/spec/src/main/asciidoc/release_notes.asciidoc b/client/spec/src/main/asciidoc/release_notes.asciidoc new file mode 100644 index 00000000..c260357b --- /dev/null +++ b/client/spec/src/main/asciidoc/release_notes.asciidoc @@ -0,0 +1,23 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// You may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// Contributors: +// Jean-Francois James, Phillip Krüger, Andy McCright, Jean-Baptiste Roux, Bojan Tomic, Adam Anderson + + +[[release_notes_11]] +== Release Notes for MicroProfile GraphQL Client 1.1 diff --git a/client/spec/src/main/asciidoc/typesafe_client.asciidoc b/client/spec/src/main/asciidoc/typesafe_client.asciidoc new file mode 100644 index 00000000..c8bc35ad --- /dev/null +++ b/client/spec/src/main/asciidoc/typesafe_client.asciidoc @@ -0,0 +1,33 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL Typesafe Client + +== Rationale + +TODO + +== Goals + +TODO + +== Non goals + +TODO + diff --git a/spec/src/main/resources/META-INF/LICENSE b/client/spec/src/main/resources/META-INF/LICENSE similarity index 100% rename from spec/src/main/resources/META-INF/LICENSE rename to client/spec/src/main/resources/META-INF/LICENSE diff --git a/spec/src/main/resources/META-INF/NOTICE b/client/spec/src/main/resources/META-INF/NOTICE similarity index 100% rename from spec/src/main/resources/META-INF/NOTICE rename to client/spec/src/main/resources/META-INF/NOTICE diff --git a/client/spec/src/main/resources/generated/api_client_class_diagram.asciidoc b/client/spec/src/main/resources/generated/api_client_class_diagram.asciidoc new file mode 100644 index 00000000..c6cce054 --- /dev/null +++ b/client/spec/src/main/resources/generated/api_client_class_diagram.asciidoc @@ -0,0 +1,40 @@ +[plantuml,api_client_class_diagram,png] +---- +@startuml +top to bottom direction + +interface Error { + {method} {abstract} +getExtensions () : Map + {method} {abstract} +getLocations () : List + {method} {abstract} +getMessage () : String + {method} {abstract} +getPath () : Object[] +} + + +interface Request { + {method} {abstract} +getDocument () : String + {method} {abstract} +getVariable ( String ) : Object + {method} {abstract} +getVariables () : Map + {method} {abstract} +resetVariables () : Request + {method} {abstract} +setVariable ( String , Object ) : Request + {method} {abstract} +setVariables ( Map ) : void + {method} {abstract} +toJson () : String +} + + +interface Response { + {method} {abstract} +getData () : JsonObject + {method} {abstract} +getErrors () : List + {method} {abstract} +getList ( Class , String ) : List + {method} {abstract} +getObject ( Class , String ) : Object + {method} {abstract} +hasData () : boolean + {method} {abstract} +hasError () : boolean +} + + + + + + +@enduml +---- \ No newline at end of file diff --git a/client/spec/src/main/resources/generated/api_core_class_diagram.asciidoc b/client/spec/src/main/resources/generated/api_core_class_diagram.asciidoc new file mode 100644 index 00000000..fac9a19c --- /dev/null +++ b/client/spec/src/main/resources/generated/api_core_class_diagram.asciidoc @@ -0,0 +1,155 @@ +[plantuml,api_core_class_diagram,png] +---- +@startuml +left to right direction + +interface Argument { + {method} {static} +arg ( String , InputObject ) : Argument + {method} {static} +arg ( String , Object ) : Argument + {method} {static} +arg ( String , Variable ) : Argument + {method} {static} +args ( Argument[] ) : List + {method} {abstract} +getName () : String + {method} {abstract} +getValue () : Object + {method} {abstract} +setName ( String ) : void + {method} {abstract} +setValue ( Object ) : void +} + + +interface Buildable { + {method} {abstract} +build () : String +} + + +interface Document { + {method} {static} +document ( Operation[] ) : Document + {method} {abstract} +getOperations () : List + {method} {abstract} +setOperations ( List ) : void +} + + +interface Enum { + {method} {abstract} +getValue () : String + {method} {static} +gqlEnum ( String ) : Enum + {method} {abstract} +setValue ( String ) : void +} + + +interface Field { + {method} {static} +field ( String ) : Field + {method} {static} +field ( String , Argument[] ) : Field + {method} {static} +field ( String , Field[] ) : Field + {method} {static} +field ( String , List , Field[] ) : Field + {method} {static} +fields ( Field[] ) : List + {method} {abstract} +getArguments () : List + {method} {abstract} +getFields () : List + {method} {abstract} +getName () : String + {method} {abstract} +setArguments ( List ) : void + {method} {abstract} +setFields ( List ) : void + {method} {abstract} +setName ( String ) : void +} + + +interface InputObject { + {method} {abstract} +getInputObjectFields () : List + {method} {static} +inputObject ( InputObjectField[] ) : InputObject + {method} {abstract} +setInputObjectFields ( List ) : void +} + + +interface InputObjectField { + {method} {abstract} +getName () : String + {method} {abstract} +getValue () : Object + {method} {static} +prop ( String , Object ) : InputObjectField + {method} {static} +prop ( String , Variable ) : InputObjectField + {method} {abstract} +setName ( String ) : void + {method} {abstract} +setValue ( Object ) : void +} + + +interface Operation { + {method} {abstract} +getFields () : List + {method} {abstract} +getName () : String + {method} {abstract} +getType () : OperationType + {method} {abstract} +getVariables () : List + {method} {static} +operation ( Field[] ) : Operation + {method} {static} +operation ( List , Field[] ) : Operation + {method} {static} +operation ( OperationType , Field[] ) : Operation + {method} {static} +operation ( String , Field[] ) : Operation + {method} {static} +operation ( OperationType , List , Field[] ) : Operation + {method} {static} +operation ( OperationType , String , Field[] ) : Operation + {method} {static} +operation ( String , List , Field[] ) : Operation + {method} {static} +operation ( OperationType , String , List , Field[] ) : Operation + {method} {static} +operations ( Operation[] ) : List + {method} {abstract} +setFields ( List ) : void + {method} {abstract} +setName ( String ) : void + {method} {abstract} +setType ( OperationType ) : void + {method} {abstract} +setVariables ( List ) : void +} + + +enum OperationType { + {field} +MUTATION + {field} +QUERY +} + + +enum ScalarType { + {field} +Boolean + {field} +Float + {field} +ID + {field} +Int + {field} +String +} + + +interface Variable { + {method} {abstract} +getDefaultValue () : Optional + {method} {abstract} +getName () : String + {method} {abstract} +getType () : VariableType + {method} {abstract} +setDefaultValue ( Optional ) : void + {method} {abstract} +setName ( String ) : void + {method} {abstract} +setType ( VariableType ) : void + {method} {static} +var ( String , ScalarType ) : Variable + {method} {static} +var ( String , String ) : Variable + {method} {static} +var ( String , VariableType ) : Variable + {method} {static} +var ( String , ScalarType , Object ) : Variable + {method} {static} +var ( String , String , Object ) : Variable + {method} {static} +var ( String , VariableType , Object ) : Variable + {method} {static} +vars ( Variable[] ) : List +} + + +interface VariableType { + {method} {abstract} +getChild () : VariableType + {method} {abstract} +getName () : String + {method} +isList () : boolean + {method} {abstract} +isNonNull () : boolean + {method} {static} +list ( ScalarType ) : VariableType + {method} {static} +list ( String ) : VariableType + {method} {static} +list ( VariableType ) : VariableType + {method} {static} +nonNull ( ScalarType ) : VariableType + {method} {static} +nonNull ( String ) : VariableType + {method} {static} +nonNull ( VariableType ) : VariableType + {method} {abstract} +setChild ( VariableType ) : void + {method} {abstract} +setName ( String ) : void + {method} {abstract} +setNonNull ( boolean ) : void + {method} {static} +varType ( ScalarType ) : VariableType + {method} {static} +varType ( String ) : VariableType +} + + + + +Argument ..|> Buildable +Document ..|> Buildable +Enum ..|> Buildable +Field ..|> Buildable +InputObject ..|> Buildable +InputObjectField ..|> Buildable +Operation ..|> Buildable +Variable ..|> Buildable +VariableType ..|> Buildable + + +@enduml +---- \ No newline at end of file diff --git a/client/tck/pom.xml b/client/tck/pom.xml new file mode 100644 index 00000000..3a21cc64 --- /dev/null +++ b/client/tck/pom.xml @@ -0,0 +1,132 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-client + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-client-tck + MicroProfile GraphQL Client :: TCK + Client-side code-first GraphQL APIs for MicroProfile :: TCK + + + + 5.8.2 + 18.2 + + + + + + ${project.groupId} + microprofile-graphql-client-api + ${project.version} + provided + + + + + org.junit.jupiter + junit-jupiter + ${junit.jupiter.version} + + + com.graphql-java + graphql-java + ${graphql-java.version} + + + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + copy-licenses + validate + + copy-resources + + + ${basedir}/target/classes/META-INF/ + true + + + src/main/licenses/${revremark}/ + true + + + + + + + + + + + + + eclipse-jarsigner + + + + org.eclipse.cbi.maven.plugins + eclipse-jarsigner-plugin + + + + sign + + + + + + + + + \ No newline at end of file diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ArraysTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ArraysTest.java new file mode 100644 index 00000000..daab071e --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ArraysTest.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.URISyntaxException; + +import static org.eclipse.microprofile.graphql.client.core.Argument.arg; +import static org.eclipse.microprofile.graphql.client.core.Argument.args; +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.InputObject.inputObject; +import static org.eclipse.microprofile.graphql.client.core.InputObjectField.prop; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; + +public class ArraysTest { + + @Test + public void arraysTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/arrays.graphql"); + + Document document = document( + operation(QUERY, "arrayHolderQuery", + field("arrayHolder", + args( + arg("arrayHolder", inputObject( + prop("boolPrimitiveArray", new boolean[]{true, false, true}), + prop("boolObjectArray", new Boolean[]{true, false, true}), + + prop("bytePrimitiveArray", new byte[]{0, 2, 3}), + prop("byteObjectArray", new Byte[]{0, 2, 3}), + + prop("shortPrimitiveArray", new short[]{78, 789, 645}), + prop("shortObjectArray", new Short[]{78, 789, 645}), + + prop("intPrimitiveArray", new int[]{78, 65, 12354}), + prop("intObjectArray", new Integer[]{78, 65, 12354}), + + prop("longPrimitiveArray", new long[]{789L, 947894L, 1874448L}), + prop("longObjectArray", new Long[]{789L, 947894L, 1874448L}), + + prop("floatPrimitiveArray", new float[]{1567.654f, 8765f, 123789456.1851f}), + prop("floatObjectArray", new Float[]{1567.654f, 8765f, 123789456.1851f}), + + prop("doublePrimitiveArray", new double[]{789.3242d, 1815d, 98765421.654897d}), + prop("doubleObjectArray", new Double[]{789.3242d, 1815d, 98765421.654897d}), + + prop("bigIntegerArray", new BigInteger[]{BigInteger.ZERO, BigInteger.ONE, BigInteger.TEN}), + prop("bigDecimalArray", new BigDecimal[]{BigDecimal.ZERO, BigDecimal.ONE, BigDecimal.TEN}), + + prop("charPrimitiveArray", new char[]{'f', 'o', 'o'}), + prop("charObjectArray", new Character[]{'f', 'o', 'o'}), + + prop("stringArray", new String[]{"foo", "bar", "baz"}) + ))), + field("boolPrimitiveArray"), + field("boolObjectArray"), + + field("bytePrimitiveArray"), + field("byteObjectArray"), + + field("shortPrimitiveArray"), + field("shortObjectArray"), + + field("intPrimitiveArray"), + field("intObjectArray"), + + field("longPrimitiveArray"), + field("longObjectArray"), + + field("floatPrimitiveArray"), + field("floatObjectArray"), + + field("doublePrimitiveArray"), + field("doubleObjectArray"), + + field("bigIntegerArray"), + field("bigDecimalArray"), + + field("charPrimitiveArray"), + field("charObjectArray"), + + field("stringArray") + ) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FieldsTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FieldsTest.java new file mode 100644 index 00000000..b4b4ea08 --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FieldsTest.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.URISyntaxException; + +import static org.eclipse.microprofile.graphql.client.core.Argument.arg; +import static org.eclipse.microprofile.graphql.client.core.Argument.args; +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; + +public class FieldsTest { + + @Test + public void fieldsTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/fields.graphql"); + + Document document = document( + operation(QUERY, + field("noArgNoSubField"), + field("noArgWithSubField", + field("bool"), + field("string"), + field("double") + ), + field("withArgNoSubField", arg("anInt", 42)), + field("withArgWithSubField", args( + arg("aString", "world"), + arg("aDouble", 78.12d), + arg("aBool", false)), + field("bool"), + field("string"), + field("double") + )) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FragmentsTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FragmentsTest.java new file mode 100644 index 00000000..1fd730fd --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/FragmentsTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.Fragment.fragment; +import static org.eclipse.microprofile.graphql.client.core.FragmentReference.fragmentRef; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; + +public class FragmentsTest { + + @Test + public void fragmentTest() { + String expectedRequest = Utils.getResourceFileContent("core/fragments.graphql"); + + Document document = document( + operation(QUERY, + field("people", + fragmentRef("sensitiveFields"))), + fragment("sensitiveFields").on("Person", + field("age"), + field("religion"))); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/InlineFragmentsTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/InlineFragmentsTest.java new file mode 100644 index 00000000..a6517115 --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/InlineFragmentsTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.InlineFragment.on; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; + +public class InlineFragmentsTest { + + @Test + public void inlineFragmentTest() { + String expectedRequest = Utils.getResourceFileContent("core/inlinefragments.graphql"); + + Document document = document( + operation(QUERY, + field("regularField"), + on("Type1", + field("type1Field1"), + field("type1Field2")), + on("Type2", + field("type2Field")))); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/NestedObjectsTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/NestedObjectsTest.java new file mode 100644 index 00000000..20312d5c --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/NestedObjectsTest.java @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.core.InputObject; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.ArrayList; + +import static org.eclipse.microprofile.graphql.client.core.Argument.arg; +import static org.eclipse.microprofile.graphql.client.core.Argument.args; +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.InputObject.inputObject; +import static org.eclipse.microprofile.graphql.client.core.InputObjectField.prop; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.MUTATION; + +public class NestedObjectsTest { + + @Test + public void nestedObjectsTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/nestedObjects.graphql"); + + InputObject baseObject0 = inputObject( + prop("level", 0), + prop("name", "level 0"), + prop("levelLineage", new byte[]{}), + prop("nestedObjectLineage", new InputObject[]{}) + ); + InputObject baseObject1 = inputObject( + prop("level", 1), + prop("name", "level 1"), + prop("levelLineage", new byte[]{0}), + prop("nestedObjectLineage", new InputObject[]{baseObject0}) + ); + InputObject baseObject2 = inputObject( + prop("level", 2), + prop("name", "level 2"), + prop("levelLineage", new byte[]{0, 1}), + prop("nestedObjectLineage", new InputObject[]{baseObject0, baseObject1}) + ); + InputObject baseObject3 = inputObject( + prop("level", 3), + prop("name", "level 3"), + prop("levelLineage", new byte[]{0, 1, 2}), + prop("nestedObjectLineage", new InputObject[]{baseObject0, baseObject1, baseObject2}) + ); + + /* + We use cloning hereafter to avoid circular references. + */ + InputObject object3 = inputObject(); + object3.setInputObjectFields(new ArrayList<>(baseObject3.getInputObjectFields())); + object3.getInputObjectFields().add(prop("nestedObject", null)); + + InputObject object2 = inputObject(); + object2.setInputObjectFields(new ArrayList<>(baseObject2.getInputObjectFields())); + object2.getInputObjectFields().add(prop("nestedObject", object3)); + + InputObject object1 = inputObject(); + object1.setInputObjectFields(new ArrayList<>(baseObject1.getInputObjectFields())); + object1.getInputObjectFields().add(prop("nestedObject", object2)); + + InputObject object0 = inputObject(); + object0.setInputObjectFields(new ArrayList<>(baseObject0.getInputObjectFields())); + object0.getInputObjectFields().add(prop("nestedObject", object1)); + + Document document = document( + operation(MUTATION, "nestedObjects", + field("nestedObjectHolder", args( + arg("nestedObjectHolder", object0)), + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))), + field("nestedObject", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))), + field("nestedObject", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))), + field("nestedObject", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))), + field("nestedObject", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))), + field("nestedObject", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"), + field("nestedObjectLineage", + field("level"), + field("name"), + field("levelLineage"))))))))))))); + + String generatedRequest = document.build(); + //System.out.println(generatedRequest); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ScalarsTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ScalarsTest.java new file mode 100644 index 00000000..a13e5215 --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/ScalarsTest.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.net.URISyntaxException; + +import static org.eclipse.microprofile.graphql.client.core.Argument.arg; +import static org.eclipse.microprofile.graphql.client.core.Argument.args; +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.InputObject.inputObject; +import static org.eclipse.microprofile.graphql.client.core.InputObjectField.prop; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.MUTATION; + +public class ScalarsTest { + + @Test + public void scalarsTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/scalars.graphql"); + + Document document = document( + operation(MUTATION, "scalarHolderMutation", + field("scalarHolder", + args( + arg("scalarHolder", inputObject( + prop("booleanPrimitive", false), + prop("booleanObject", Boolean.valueOf(true)), + + prop("bytePrimitive", Byte.MIN_VALUE), + prop("byteObject", Byte.valueOf(Byte.MAX_VALUE)), + + prop("shortPrimitive", Short.MIN_VALUE), + prop("shortObject", Short.valueOf(Short.MAX_VALUE)), + + prop("intPrimitive", Integer.MIN_VALUE + 1), + prop("intObject", Integer.valueOf(Integer.MAX_VALUE)), + + prop("longPrimitive", Long.MIN_VALUE), + prop("longObject", Long.valueOf(Long.MAX_VALUE)), + + prop("floatPrimitive", Float.MIN_VALUE), + prop("floatObject", Float.valueOf(Float.MAX_VALUE)), + + prop("doublePrimitive", Double.MIN_VALUE), + prop("doubleObject", Double.valueOf(Double.MAX_VALUE)), + + prop("bigInteger", BigInteger.TEN), + prop("bigDecimal", BigDecimal.TEN), + + prop("charPrimitive", 'a'), + prop("charObject", Character.valueOf('Z')), + + prop("stringObject", "Hello World !") + ))), + field("booleanPrimitive"), + field("booleanObject"), + + field("bytePrimitive"), + field("byteObject"), + + field("shortPrimitive"), + field("shortObject"), + + field("intPrimitive"), + field("intObject"), + + field("longPrimitive"), + field("longObject"), + + field("floatPrimitive"), + field("floatObject"), + + field("doublePrimitive"), + field("doubleObject"), + + field("bigInteger"), + field("bigDecimal"), + + field("charPrimitive"), + field("charObject"), + + field("stringObject") + ) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/VariablesTest.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/VariablesTest.java new file mode 100644 index 00000000..55cfb12e --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/core/VariablesTest.java @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.core; + + +import org.eclipse.microprofile.graphql.client.core.Document; +import org.eclipse.microprofile.graphql.client.core.Variable; +import org.eclipse.microprofile.graphql.client.tck.helper.AssertGraphQL; +import org.eclipse.microprofile.graphql.client.tck.helper.Utils; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.URISyntaxException; + +import static org.eclipse.microprofile.graphql.client.core.Argument.arg; +import static org.eclipse.microprofile.graphql.client.core.Argument.args; +import static org.eclipse.microprofile.graphql.client.core.Document.document; +import static org.eclipse.microprofile.graphql.client.core.Field.field; +import static org.eclipse.microprofile.graphql.client.core.InputObject.inputObject; +import static org.eclipse.microprofile.graphql.client.core.InputObjectField.prop; +import static org.eclipse.microprofile.graphql.client.core.Operation.operation; +import static org.eclipse.microprofile.graphql.client.core.OperationType.MUTATION; +import static org.eclipse.microprofile.graphql.client.core.OperationType.QUERY; +import static org.eclipse.microprofile.graphql.client.core.ScalarType.GQL_BOOL; +import static org.eclipse.microprofile.graphql.client.core.ScalarType.GQL_FLOAT; +import static org.eclipse.microprofile.graphql.client.core.ScalarType.GQL_ID; +import static org.eclipse.microprofile.graphql.client.core.ScalarType.GQL_INT; +import static org.eclipse.microprofile.graphql.client.core.ScalarType.GQL_STRING; +import static org.eclipse.microprofile.graphql.client.core.Variable.var; +import static org.eclipse.microprofile.graphql.client.core.Variable.vars; +import static org.eclipse.microprofile.graphql.client.core.VariableType.list; +import static org.eclipse.microprofile.graphql.client.core.VariableType.nonNull; + +public class VariablesTest { + + @Test + public void variablesDefaultValueTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/variablesDefaultValue.graphql"); + + Variable varName = var("name", GQL_STRING, "Lee Byron"); + + Document document = document( + operation(QUERY, + vars(varName), + field("helloYou", arg("name", varName)) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } + + @Test + public void variablesFlatTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/variablesFlat.graphql"); + + Variable varBool = var("varBool", nonNull(GQL_BOOL)); + Variable varDouble = var("varDouble", nonNull(GQL_FLOAT)); + Variable varString = var("varString", nonNull(GQL_STRING)); + + Document document = document( + operation(QUERY, + vars( + varBool, + varDouble, + varString + ), + field("withArgWithSubField", args( + arg("aString", varString), + arg("aDouble", varDouble), + arg("aBool", varBool) + ), + field("bool"), + field("double"), + field("string") + ) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } + + @Test + public void variablesInInputObjectTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/variablesInInputObject.graphql"); + + Variable varBool = var("varBool", nonNull(GQL_BOOL)); + Variable varInt = var("varInt", nonNull(GQL_INT)); + Variable varFloat = var("varFloat", nonNull(GQL_FLOAT)); + Variable varString = var("varString", nonNull(GQL_STRING)); + Variable varID = var("varID", GQL_ID); + + Document document = document( + operation(QUERY, + vars( + varBool, + varInt, + varFloat, + varString, + varID + ), + field("basicScalarHolder", args( + arg("basicScalarHolder", inputObject( + prop("bool", varBool), + prop("int", varInt), + prop("float", varFloat), + prop("string", varString), + prop("iD", varID) + ))), + field("bool"), + field("int"), + field("float"), + field("string"), + field("iD") + ) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } + + @Test + public void variablesArraysTest() throws IOException, URISyntaxException { + String expectedRequest = Utils.getResourceFileContent("core/variablesArrays.graphql"); + + Variable varInt1 = var("varInt_1", list(GQL_INT)); + Variable varInt1bang = var("varInt_1_bang", nonNull(list(GQL_INT))); + Variable varIntbang1 = var("varInt_bang_1", list(nonNull(GQL_INT))); + Variable varInt12 = var("varInt_1_2", list(list(GQL_INT))); + Variable varInt123 = var("varInt_1_2_3", list(list(list(GQL_INT)))); + Variable varInt1bang23bang = var("varInt_1_bang_2_3_bang", + nonNull(list( + list( + nonNull(list(GQL_INT)))))); + Variable varIntbang1bang2bang3bang = var("varInt_bang_1_bang_2_bang_3_bang", + nonNull(list( + nonNull(list( + nonNull(list( + nonNull(GQL_INT)))))))); + + /* To use for e2e tests + { + "varInt_1": [12, 34, 567, 89], + "varInt_1_2": null, + "varInt_1_2_3": [[[1, null], [3, 4]], null, [[7], null]], + "varInt_1_bang": [null], + "varInt_bang_1": null, + "varInt_1_bang_2_3_bang": [[[null, 2], [null, 4]], [[5, 6]], null], + "varInt_bang_1_bang_2_bang_3_bang": [[[1, 2], [3, 4]], [[5, 6], [7], [8, 9]]] + } + */ + + Document document = document( + operation(MUTATION, + vars( + varInt1, + varInt12, + varInt123, + varInt1bang, + varIntbang1, + varInt1bang23bang, + varIntbang1bang2bang3bang + ), + field("nestedArraysHolder", args( + arg("nestedArraysHolder", inputObject( + prop("int_1", varInt1), + prop("int_1_2", varInt12), + prop("int_1_2_3", varInt123), + prop("int_1_bang", varInt1bang), + prop("int_bang_1", varIntbang1), + prop("int_1_bang_2_3_bang", varInt1bang23bang), + prop("int_bang_1_bang_2_bang_3_bang", varIntbang1bang2bang3bang) + ))), + field("int_1"), + field("int_1_2"), + field("int_1_2_3"), + field("int_1_bang"), + field("int_1_bang_2_3_bang"), + field("int_bang_1"), + field("int_bang_1_bang_2_bang_3_bang") + ) + ) + ); + + String generatedRequest = document.build(); + AssertGraphQL.assertEquivalentGraphQLRequest(expectedRequest, generatedRequest); + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/AssertGraphQL.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/AssertGraphQL.java new file mode 100644 index 00000000..d7b07314 --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/AssertGraphQL.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.helper; + +import graphql.parser.InvalidSyntaxException; +import graphql.parser.Parser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class AssertGraphQL { + public static void assertEquivalentGraphQLRequest(String expectedRequest, String actualRequest) { + validateRequest(expectedRequest); + validateRequest(actualRequest); + + /* + Once requests have been deemed syntactically correct, we can remove some tokens + to actually be able to compare them without taking into account insignificant differences. + */ + expectedRequest = unformatRequest(expectedRequest); + actualRequest = unformatRequest(actualRequest); + + assertEquals(expectedRequest, actualRequest); + } + + private static void validateRequest(String request) { + Parser parser = new Parser(); + try { + parser.parseDocument(request); + } catch (InvalidSyntaxException e) { + System.err.println(request); + throw (e); + } + } + + private static String unformatRequest(String request) { + return request + .trim() + .replaceAll("\\s+", "") + .replaceAll(System.getProperty("line.separator"), "") + .replaceAll(",", ""); + } + + private AssertGraphQL() { + // HideUtilityClassConstructor + } +} diff --git a/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/Utils.java b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/Utils.java new file mode 100644 index 00000000..b1720019 --- /dev/null +++ b/client/tck/src/main/java/org/eclipse/microprofile/graphql/client/tck/helper/Utils.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.client.tck.helper; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.stream.Collectors; + +public class Utils { + + public static String getResourceFileContent(String resourceName) { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + InputStream in =classLoader.getResourceAsStream(resourceName); + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + String content = reader.lines().collect(Collectors.joining("\n")); + + return content; + } + + private Utils() { + // HideUtilityClassConstructor + } +} diff --git a/client/tck/src/main/licenses/Draft/LICENSE b/client/tck/src/main/licenses/Draft/LICENSE new file mode 100644 index 00000000..5c304d1a --- /dev/null +++ b/client/tck/src/main/licenses/Draft/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + 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. diff --git a/client/tck/src/main/licenses/Final/LICENSE b/client/tck/src/main/licenses/Final/LICENSE new file mode 100644 index 00000000..c858c0ad --- /dev/null +++ b/client/tck/src/main/licenses/Final/LICENSE @@ -0,0 +1,83 @@ +Eclipse Foundation Technology Compatibility Kit License - v 1.0 + +Copyright (c) 2018, Eclipse Foundation, Inc. and its licensors. + +Redistribution and use in binary form is permitted provided that the +following conditions are met: + +1. Use of the Technology Compatibility Kit accompanying this license + (the "TCK") and its documentation is permitted solely for the + purpose of testing compatibility of an implementation (the + "Product") of a specification (the "Specification") made available + by the Eclipse Foundation, Inc. ("Eclipse"). + +2. Only those modifications expressly permitted by the TCK and its + documentation are permitted. Except in these limited circumstances, + no modifications to the TCK are permitted under this license. + +3. A Product will be deemed to be "compatible" with the Specification + if it fully and completely meets and satisfies all requirements of + the TCK. + +4. Before any claim of compatibility (or any similar claim suggesting + compatibility) is made based on the TCK, the testing party must: + + a. use the TCK to demonstrate that the Product fully and + completely meets and satisfies all requirements of the TCK; + + b. make TCK test results showing full and complete satisfaction of + all requirements of the TCK publicly available on the testing + party's website and send a link to such test results to Eclipse + at [tck@eclipse.org](mailto:tck@eclipse.org); and + + c. comply with any requirements stated in the Specification with + regard to subsetting, supersetting, modifying or extending the + Specification in any Product claimed to be compatible with the + Specification. + +5. The test results must be continuously available and the link must + be live for at least as long as the Product is available in the + marketplace. + +6. The TCK may not be used as a basis for any statements of partial + compatibility. The TCK may only be used as a basis for true, + factual statements of full compatibility of Products that fully + meet and satisfy all requirements of the TCK. + +7. A determination that a Product is compatible with the TCK does not, + in itself, give rise to the right to use any name, mark, logo + associated with the TCK, Eclipse, or Eclipse's contributors or + licensors. + +8. Upon the request of Eclipse, a tester will retract any statements + of compatibility (or any similar claim suggesting compatibility) + which Eclipse reasonably determines to be false or misleading or in + violation of the terms of this license. + +9. Redistribution of the TCK must be under this Eclipse Foundation + Technology Compatibility Kit License and must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +10. Neither the name, trademarks or logos of Eclipse, nor the names, + trademarks or logos of its contributors or licensors may be used to + endorse or promote products tested with this software without + specific prior written permission. + +11. The source code for the TCK accompanying this license is available + from Eclipse. + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED ON +AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER +EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR +CONDITIONS OF TITLE, NON- INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR +A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY APPLICABLE LAW, +NEITHER THE COPYRIGHT OWNER OR ANY CONTRIBUTORS SHALL HAVE ANY +LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/client/tck/src/main/resources/core/arrays.graphql b/client/tck/src/main/resources/core/arrays.graphql new file mode 100644 index 00000000..4b306d72 --- /dev/null +++ b/client/tck/src/main/resources/core/arrays.graphql @@ -0,0 +1,61 @@ +query arrayHolderQuery { + arrayHolder(arrayHolder:{ + boolPrimitiveArray: [true, false, true], + boolObjectArray: [true, false, true], + + bytePrimitiveArray: [0, 2, 3], + byteObjectArray: [0, 2, 3], + + shortPrimitiveArray: [78, 789, 645], + shortObjectArray: [78, 789, 645], + + intPrimitiveArray: [78, 65, 12354], + intObjectArray: [78, 65, 12354], + + longPrimitiveArray: [789, 947894, 1874448], + longObjectArray: [789, 947894, 1874448], + + floatPrimitiveArray: [1567.654, 8765.0, 1.23789456E8], + floatObjectArray: [1567.654, 8765.0, 1.23789456E8], + + doublePrimitiveArray: [789.3242, 1815.0, 9.8765421654897E7], + doubleObjectArray: [789.3242, 1815.0, 9.8765421654897E7], + + bigIntegerArray: [0, 1, 10] + bigDecimalArray: [0, 1, 10] + + charPrimitiveArray: ["f", "o", "o"], + charObjectArray: ["f", "o", "o"], + + stringArray: ["foo", "bar", "baz"], + }) { + boolPrimitiveArray + boolObjectArray + + bytePrimitiveArray + byteObjectArray + + shortPrimitiveArray + shortObjectArray + + intPrimitiveArray + intObjectArray + + longPrimitiveArray + longObjectArray + + floatPrimitiveArray + floatObjectArray + + doublePrimitiveArray + doubleObjectArray + + bigIntegerArray + bigDecimalArray + + charPrimitiveArray + charObjectArray + + stringArray + } +} \ No newline at end of file diff --git a/client/tck/src/main/resources/core/dates.graphql b/client/tck/src/main/resources/core/dates.graphql new file mode 100644 index 00000000..d3d04b63 --- /dev/null +++ b/client/tck/src/main/resources/core/dates.graphql @@ -0,0 +1,19 @@ +mutation scalarHolderMutation { + scalarHolder (scalarHolder: { + dateObject: "2019-10-23" + anotherDateObject: "2019-10-23" + timeObject: "11:46:34.263" + anotherTimeObject: "11:46:34.263" + dateTimeObject: "2019-10-23T11:46:34.263" + anotherDateTimeObject: "2019-10-23T11:46:34.263" + }) { + dateObject + anotherDateObject + + timeObject + anotherTimeObject + + dateTimeObject + anotherDateTimeObject + } +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/javaError/output.json b/client/tck/src/main/resources/core/enums.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/javaError/output.json rename to client/tck/src/main/resources/core/enums.graphql diff --git a/client/tck/src/main/resources/core/fields.graphql b/client/tck/src/main/resources/core/fields.graphql new file mode 100644 index 00000000..c1e29788 --- /dev/null +++ b/client/tck/src/main/resources/core/fields.graphql @@ -0,0 +1,14 @@ +query { + noArgNoSubField + noArgWithSubField { + bool + string + double + } + withArgNoSubField(anInt: 42) + withArgWithSubField(aString: "world", aDouble: 78.12, aBool: false) { + bool + string + double + } +} diff --git a/client/tck/src/main/resources/core/fragments.graphql b/client/tck/src/main/resources/core/fragments.graphql new file mode 100644 index 00000000..072f3dfc --- /dev/null +++ b/client/tck/src/main/resources/core/fragments.graphql @@ -0,0 +1,10 @@ +query { + people { + ...sensitiveFields + } +} + +fragment sensitiveFields on Person { + age + religion +} diff --git a/client/tck/src/main/resources/core/inlinefragments.graphql b/client/tck/src/main/resources/core/inlinefragments.graphql new file mode 100644 index 00000000..d9d8ace9 --- /dev/null +++ b/client/tck/src/main/resources/core/inlinefragments.graphql @@ -0,0 +1,10 @@ +query { + regularField + ... on Type1 { + type1Field1 + type1Field2 + } + ... on Type2 { + type2Field + } +} diff --git a/client/tck/src/main/resources/core/nestedObjects.graphql b/client/tck/src/main/resources/core/nestedObjects.graphql new file mode 100644 index 00000000..8cab00f7 --- /dev/null +++ b/client/tck/src/main/resources/core/nestedObjects.graphql @@ -0,0 +1,231 @@ +mutation nestedObjects { + nestedObjectHolder(nestedObjectHolder:{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + nestedObject: { + level: 1, + name: "level 1", + levelLineage: [0], + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + }] + nestedObject: { + level: 2, + name: "level 2", + levelLineage: [0, 1] + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + },{ + level: 1, + name: "level 1", + levelLineage: [0], + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + }] + }] + nestedObject: { + level: 3, + name: "level 3", + levelLineage: [0, 1, 2] + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + }, { + level: 1, + name: "level 1", + levelLineage: [0], + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + }] + }, { + level: 2, + name: "level 2", + levelLineage: [0, 1] + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + },{ + level: 1, + name: "level 1", + levelLineage: [0], + nestedObjectLineage: [{ + level: 0, + name: "level 0", + levelLineage: [], + nestedObjectLineage: [] + }] + }] + }] + nestedObject: null + } + } + } + }) { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + nestedObject { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + nestedObject { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + nestedObject { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + nestedObject { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + nestedObject { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + nestedObjectLineage { + level + name + levelLineage + } + } + } + } + } + } + } + } + } + } +} diff --git a/client/tck/src/main/resources/core/scalars.graphql b/client/tck/src/main/resources/core/scalars.graphql new file mode 100644 index 00000000..78c76be3 --- /dev/null +++ b/client/tck/src/main/resources/core/scalars.graphql @@ -0,0 +1,61 @@ +mutation scalarHolderMutation { + scalarHolder (scalarHolder: { + booleanPrimitive: false + booleanObject: true + + bytePrimitive: -128 + byteObject: 127 + + shortPrimitive: -32768 + shortObject: 32767 + + intPrimitive: -2147483647 + intObject: 2147483647 + + longPrimitive: -9223372036854775808 + longObject: 9223372036854775807 + + floatPrimitive: 1.4E-45 + floatObject: 3.4028235E38 + + doublePrimitive: 4.9E-324 + doubleObject: 1.7976931348623157E308 + + bigInteger: 10 + bigDecimal: 10 + + charPrimitive: "a" + charObject: "Z" + + stringObject: "Hello World !" + }) { + booleanPrimitive + booleanObject + + bytePrimitive + byteObject + + shortPrimitive + shortObject + + intPrimitive + intObject + + longPrimitive + longObject + + floatPrimitive + floatObject + + doublePrimitive + doubleObject + + bigInteger + bigDecimal + + charPrimitive + charObject + + stringObject + } +} \ No newline at end of file diff --git a/client/tck/src/main/resources/core/variablesArrays.graphql b/client/tck/src/main/resources/core/variablesArrays.graphql new file mode 100644 index 00000000..4ff97b90 --- /dev/null +++ b/client/tck/src/main/resources/core/variablesArrays.graphql @@ -0,0 +1,27 @@ +mutation ( + $varInt_1: [Int], + $varInt_1_2: [[Int]], + $varInt_1_2_3: [[[Int]]], + $varInt_1_bang: [Int]!, + $varInt_bang_1: [Int!], + $varInt_1_bang_2_3_bang: [[[Int]!]]!, + $varInt_bang_1_bang_2_bang_3_bang: [[[Int!]!]!]! +) { + nestedArraysHolder(nestedArraysHolder:{ + int_1: $varInt_1 + int_1_2: $varInt_1_2 + int_1_2_3: $varInt_1_2_3 + int_1_bang: $varInt_1_bang + int_bang_1: $varInt_bang_1 + int_1_bang_2_3_bang: $varInt_1_bang_2_3_bang + int_bang_1_bang_2_bang_3_bang: $varInt_bang_1_bang_2_bang_3_bang + }) { + int_1 + int_1_2 + int_1_2_3 + int_1_bang + int_1_bang_2_3_bang + int_bang_1 + int_bang_1_bang_2_bang_3_bang + } +} \ No newline at end of file diff --git a/client/tck/src/main/resources/core/variablesDefaultValue.graphql b/client/tck/src/main/resources/core/variablesDefaultValue.graphql new file mode 100644 index 00000000..85df7b33 --- /dev/null +++ b/client/tck/src/main/resources/core/variablesDefaultValue.graphql @@ -0,0 +1,3 @@ +query ($name: String = "Lee Byron") { + helloYou(name: $name) +} \ No newline at end of file diff --git a/client/tck/src/main/resources/core/variablesFlat.graphql b/client/tck/src/main/resources/core/variablesFlat.graphql new file mode 100644 index 00000000..cc67b77d --- /dev/null +++ b/client/tck/src/main/resources/core/variablesFlat.graphql @@ -0,0 +1,7 @@ +query ($varBool: Boolean!, $varDouble: Float!, $varString: String!) { + withArgWithSubField(aString: $varString, aDouble: $varDouble, aBool: $varBool) { + bool + double + string + } +} diff --git a/client/tck/src/main/resources/core/variablesInInputObject.graphql b/client/tck/src/main/resources/core/variablesInInputObject.graphql new file mode 100644 index 00000000..13ca5c8c --- /dev/null +++ b/client/tck/src/main/resources/core/variablesInInputObject.graphql @@ -0,0 +1,15 @@ +query ($varBool: Boolean! $varInt: Int! $varFloat: Float! $varString: String! $varID: ID) { + basicScalarHolder(basicScalarHolder:{ + bool: $varBool + int: $varInt + float: $varFloat + string: $varString + iD: $varID + }) { + bool + int + float + string + iD + } +} \ No newline at end of file diff --git a/full/README.asciidoc b/full/README.asciidoc new file mode 100644 index 00000000..61953d5e --- /dev/null +++ b/full/README.asciidoc @@ -0,0 +1,44 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += Microprofile GraphQL Full Specification + +== Generating the API and JavaDoc + +Just enter `mvn clean install` at the command line. Maven will generate the following artifacts. + +API Jar:: +The jar containing the api interfaces and classes in `/api/target` + +Specification:: +The PDF and HTML will be generated in `spec/target/generated-docs/` + +TCK:: +The TCK that can be used to test your implementation + +== Use this in your project + +[source,xml,numbered] +---- + + org.eclipse.microprofile.graphql + microprofile-graphql-api + 1.0.1 + +---- \ No newline at end of file diff --git a/full/api/pom.xml b/full/api/pom.xml new file mode 100644 index 00000000..766bac5f --- /dev/null +++ b/full/api/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-full + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-api + MicroProfile GraphQL Full :: API + Code-first GraphQL APIs for MicroProfile :: API + + + + ${project.groupId} + microprofile-graphql-server-api + ${project.version} + + + ${project.groupId} + microprofile-graphql-client-api + ${project.version} + + + \ No newline at end of file diff --git a/full/pom.xml b/full/pom.xml new file mode 100644 index 00000000..f6dcf32b --- /dev/null +++ b/full/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-parent + 2.0-SNAPSHOT + ../ + + + MicroProfile GraphQL Full + + Code-first API for developing GraphQL services in MicroProfile + microprofile-graphql-full + pom + + + spec + api + tck + + \ No newline at end of file diff --git a/spec/pom.xml b/full/spec/pom.xml similarity index 56% rename from spec/pom.xml rename to full/spec/pom.xml index 445a09f0..60990ead 100644 --- a/spec/pom.xml +++ b/full/spec/pom.xml @@ -18,25 +18,20 @@ 4.0.0 org.eclipse.microprofile.graphql - microprofile-graphql-parent - 1.1-SNAPSHOT + microprofile-graphql-full + 2.0-SNAPSHOT ../ - + microprofile-graphql-spec pom - MicroProfile GraphQL :: Specification + MicroProfile GraphQL Full :: Specification Code-first GraphQL APIs for MicroProfile :: Specification - 1.6.0 - 1.5.0 - - Apache License v 2.0 - MMMM dd, yyyy - ${maven.build.timestamp} - + ${project.build.directory}/generated-docs/${project.build.finalName}.pdf + ${project.build.directory}/generated-docs/${project.build.finalName}.html @@ -46,25 +41,7 @@ org.asciidoctor asciidoctor-maven-plugin - ${asciidoctor-maven.version} - - - src/main/asciidoc - microprofile-graphql.asciidoc - coderay - true - - ${license} - - - - - org.asciidoctor - asciidoctorj-pdf - ${asciidoctorj-pdf.version} - - generate-pdf-doc @@ -73,12 +50,8 @@ process-asciidoc + ${spec.pdf} pdf - - ${project.version} - ${revremark} - ${revisiondate} - @@ -88,12 +61,8 @@ process-asciidoc + ${spec.html} html5 - - ${project.version} - ${revremark} - ${revisiondate} - @@ -102,6 +71,4 @@ - - - + \ No newline at end of file diff --git a/full/spec/src/main/asciidoc/index.asciidoc b/full/spec/src/main/asciidoc/index.asciidoc new file mode 100644 index 00000000..f39a61a9 --- /dev/null +++ b/full/spec/src/main/asciidoc/index.asciidoc @@ -0,0 +1,42 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL +:authors: Jean-Francois James, Phillip Krüger, Andy McCright, Jean-Baptiste Roux, Bojan Tomic, Adam Anderson +:email: microprofile@googlegroups.com +:version-label!: +:sectanchors: +:doctype: book +:license: Eclipse Foundation Specification License v1.0 +:source-highlighter: coderay +:sectnums: +:toc: left +:toclevels: 4 +:sectnumlevels: 4 +ifdef::backend-pdf[] +:pagenums: +:numbered: +:serverdir: ../../../../../server/spec/src/main/asciidoc +:clientdir: ../../../../../client/spec/src/main/asciidoc +endif::[] + +include::license-efsl.asciidoc[] + +include::{serverdir}/server.asciidoc[] +include::{clientdir}/client.asciidoc[] \ No newline at end of file diff --git a/full/spec/src/main/asciidoc/license-alv2.asciidoc b/full/spec/src/main/asciidoc/license-alv2.asciidoc new file mode 100644 index 00000000..47793817 --- /dev/null +++ b/full/spec/src/main/asciidoc/license-alv2.asciidoc @@ -0,0 +1,42 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + +[subs="normal"] +.... + +Specification: {doctitle} + +Version: {revnumber} + +Status: {revremark} + +Release: {revdate} + +Copyright (c) 2020 Contributors to the Eclipse Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +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. + +.... diff --git a/full/spec/src/main/asciidoc/license-efsl.asciidoc b/full/spec/src/main/asciidoc/license-efsl.asciidoc new file mode 100644 index 00000000..85993af3 --- /dev/null +++ b/full/spec/src/main/asciidoc/license-efsl.asciidoc @@ -0,0 +1,73 @@ +[subs="normal"] +.... +Specification: {doctitle} +Version: {revnumber} +Status: {revremark} +Release: {revdate} +.... + +== Copyright + +Copyright (c) {inceptionYear}, {currentYear} Eclipse Foundation. + +=== Eclipse Foundation Specification License + +By using and/or copying this document, or the Eclipse Foundation +document from which this statement is linked, you (the licensee) agree +that you have read, understood, and will comply with the following +terms and conditions: + +Permission to copy, and distribute the contents of this document, or +the Eclipse Foundation document from which this statement is linked, in +any medium for any purpose and without fee or royalty is hereby +granted, provided that you include the following on ALL copies of the +document, or portions thereof, that you use: + +* link or URL to the original Eclipse Foundation document. +* All existing copyright notices, or if one does not exist, a notice + (hypertext is preferred, but a textual representation is permitted) + of the form: "Copyright (c) [$date-of-document] + Eclipse Foundation, Inc. \<>" + +Inclusion of the full text of this NOTICE must be provided. We +request that authorship attribution be provided in any software, +documents, or other items or products that you create pursuant to the +implementation of the contents of this document, or any portion +thereof. + +No right to create modifications or derivatives of Eclipse Foundation +documents is granted pursuant to this license, except anyone may +prepare and distribute derivative works and portions of this document +in software that implements the specification, in supporting materials +accompanying such software, and in documentation of such software, +PROVIDED that all such works include the notice below. HOWEVER, the +publication of derivative works of this document for use as a technical +specification is expressly prohibited. + +The notice is: + +"Copyright (c) [$date-of-document] Eclipse Foundation. This software or +document includes material copied from or derived from [title and URI +of the Eclipse Foundation specification document]." + +==== Disclaimers + +THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT +HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR +WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE +SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS +WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR +OTHER RIGHTS. + +THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE +FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT +OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE +CONTENTS THEREOF. + +The name and trademarks of the copyright holders or the Eclipse +Foundation may NOT be used in advertising or publicity pertaining to +this document or its contents without specific, written prior +permission. Title to copyright in this document will at all times +remain with copyright holders. diff --git a/full/spec/src/main/resources/META-INF/LICENSE b/full/spec/src/main/resources/META-INF/LICENSE new file mode 100644 index 00000000..fe731048 --- /dev/null +++ b/full/spec/src/main/resources/META-INF/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Contributors to the Eclipse Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + 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. diff --git a/full/spec/src/main/resources/META-INF/NOTICE b/full/spec/src/main/resources/META-INF/NOTICE new file mode 100644 index 00000000..37dc70ad --- /dev/null +++ b/full/spec/src/main/resources/META-INF/NOTICE @@ -0,0 +1,13 @@ +========================================================================= +== NOTICE file corresponding to section 4(d) of the Apache License, == +== Version 2.0, in this case for Microprofile GraphQL == +========================================================================= + +SPDXVersion: SPDX-2.1 +PackageName: Eclipse Microprofile +PackageHomePage: http://www.eclipse.org/microprofile +PackageLicenseDeclared: Apache-2.0 + +PackageCopyrightText: +J. Andrew McCright j.andrew.mccright@gmail.com + diff --git a/full/tck/pom.xml b/full/tck/pom.xml new file mode 100644 index 00000000..355e518d --- /dev/null +++ b/full/tck/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-full + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-tck + MicroProfile GraphQL Full :: TCK + Code-first GraphQL APIs for MicroProfile :: TCK + + + + ${project.groupId} + microprofile-graphql-server-tck + ${project.version} + + + ${project.groupId} + microprofile-graphql-client-tck + ${project.version} + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index efa3badc..82f71add 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.microprofile.graphql microprofile-graphql-parent - 1.1-SNAPSHOT + 2.0-SNAPSHOT MicroProfile GraphQL @@ -32,12 +32,26 @@ 1.8 1.8 + + 4.1 2.0.2 - - 7.0.0 + 1.1.6 + 1.0.2 + + + 7.5 1.6.0.Final + 3.10.1 + + 2.2.2 + 2.1.4 + MMMM dd, yyyy + ${maven.build.timestamp} Draft + 2019 + + Eclipse Foundation Specification License v1.0 @@ -90,26 +104,22 @@ - spec - api - tck + server + client + full + - jakarta.enterprise - jakarta.enterprise.cdi-api - ${cdi-api.version} - provided - - - jakarta.el - jakarta.el-api - - + org.eclipse.microprofile + microprofile + ${microprofile.platform} + import + pom - + org.testng @@ -155,7 +165,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + 3.2.2 org.apache.maven.plugins @@ -165,16 +175,79 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.1.1 + 3.3.2 org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.0.1 + + biz.aQute.bnd + bnd-maven-plugin + 6.3.1 + + + org.asciidoctor + asciidoctor-maven-plugin + ${asciidoctor-maven.version} + + + src/main/asciidoc + index.asciidoc + coderay + true + + ${license} + ${project.version} + ${revremark} + ${revisiondate} + ${currentYear} + ${inceptionYear} + + + + ${project.version} + ${revremark} + ${revisiondate} + + + + + + org.asciidoctor + asciidoctorj-pdf + ${asciidoctorj-pdf.version} + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 8 + + + + attach-javadocs + + jar + + + + org.apache.maven.plugins maven-checkstyle-plugin @@ -272,7 +345,7 @@ org.apache.rat apache-rat-plugin - 0.13 + 0.14 rat-check @@ -283,7 +356,10 @@ - bnd.bnd + .travis.yml.* + **/bnd.bnd + **/target/ + *.log .checkstyle .factorypath @@ -291,6 +367,11 @@ src/test/resources/*/*.json *.drawio .vscode/* + nb**.xml + **/bin/ + **/*.iml + **/*.idea + **/*.ipr **/*.json **/*.graphql **/*.properties @@ -299,10 +380,33 @@ **/.classpath **/.project **/.github/** + **/resources/generated/** + **/license.html + **/license-efsl.adoc + **/license-efsl.asciidoc + **/LICENSE* + + org.codehaus.mojo + build-helper-maven-plugin + + + timestamp-property + + timestamp-property + + validate + + currentYear + yyyy + + + + + @@ -313,7 +417,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.8 + 1.6.13 true https://oss.sonatype.org/ @@ -348,6 +452,7 @@ org.apache.maven.plugins maven-gpg-plugin + 3.0.1 sign-artifacts diff --git a/server/README.asciidoc b/server/README.asciidoc new file mode 100644 index 00000000..b9b1a0e1 --- /dev/null +++ b/server/README.asciidoc @@ -0,0 +1,44 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += Microprofile GraphQL Server Specification + +== Generating the API and JavaDoc + +Just enter `mvn clean install` at the command line. Maven will generate the following artifacts. + +API Jar:: +The jar containing the api interfaces and classes in `/api/target` + +Specification:: +The PDF and HTML will be generated in `spec/target/generated-docs/` + +TCK:: +The TCK that can be used to test your implementation + +== Use this in your project + +[source,xml,numbered] +---- + + org.eclipse.microprofile.graphql + microprofile-graphql-server-api + 1.0.1 + +---- \ No newline at end of file diff --git a/api/.gitignore b/server/api/.gitignore similarity index 100% rename from api/.gitignore rename to server/api/.gitignore diff --git a/api/bnd.bnd b/server/api/bnd.bnd similarity index 100% rename from api/bnd.bnd rename to server/api/bnd.bnd diff --git a/api/pom.xml b/server/api/pom.xml similarity index 59% rename from api/pom.xml rename to server/api/pom.xml index 6aac9619..9f94ea3a 100644 --- a/api/pom.xml +++ b/server/api/pom.xml @@ -16,23 +16,22 @@ --> 4.0.0 - org.eclipse.microprofile.graphql - microprofile-graphql-parent - 1.1-SNAPSHOT + microprofile-graphql-server + 2.0-SNAPSHOT ../ - microprofile-graphql-api - MicroProfile GraphQL :: API - Code-first GraphQL APIs for MicroProfile :: API + microprofile-graphql-server-api + MicroProfile GraphQL Server :: API + Server-side code-first GraphQL APIs for MicroProfile :: API org.osgi org.osgi.annotation.versioning - 1.1.0 + 1.1.2 provided @@ -44,9 +43,56 @@ + + maven-resources-plugin + 3.2.0 + + + copy-resources + validate + + copy-resources + + + ${basedir}/target/apidocs/doc-files/ + true + + + src/main/javadoc/licenses/${revremark}/ + true + + + + + + + org.apache.maven.plugins maven-javadoc-plugin + + false + true + true + none + ${project.name} + ${project.name} +
${project.name} v${project.version}]]>
+ + + Use is subject to license terms. + ]]> + + + + implSpec + a + Implementation Specification: + + +
attach-javadocs @@ -56,11 +102,10 @@
- + biz.aQute.bnd bnd-maven-plugin - 4.3.1 @@ -103,5 +148,4 @@
- - + \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java similarity index 82% rename from api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java index f764808d..1c7a890f 100644 --- a/api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java +++ b/server/api/src/main/java/org/eclipse/microprofile/graphql/ConfigKey.java @@ -22,6 +22,12 @@ */ public interface ConfigKey { public static final String DEFAULT_ERROR_MESSAGE = "mp.graphql.defaultErrorMessage"; + + @Deprecated public static final String EXCEPTION_BLACK_LIST = "mp.graphql.exceptionsBlackList"; + public static final String EXCEPTION_HIDE_ERROR_MESSAGE_LIST = "mp.graphql.hideErrorMessage"; + + @Deprecated public static final String EXCEPTION_WHITE_LIST = "mp.graphql.exceptionsWhiteList"; + public static final String EXCEPTION_SHOW_ERROR_MESSAGE_LIST = "mp.graphql.showErrorMessage"; } \ No newline at end of file diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/DateFormat.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/DateFormat.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/DateFormat.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/DateFormat.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/DefaultValue.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/DefaultValue.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/DefaultValue.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/DefaultValue.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Description.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Description.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/Description.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Description.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Enum.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Enum.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/Enum.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Enum.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLApi.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLApi.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/GraphQLApi.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLApi.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLException.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLException.java similarity index 100% rename from api/src/main/java/org/eclipse/microprofile/graphql/GraphQLException.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/GraphQLException.java diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Id.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Id.java similarity index 78% rename from api/src/main/java/org/eclipse/microprofile/graphql/Id.java rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Id.java index 6c550f76..0272b085 100644 --- a/api/src/main/java/org/eclipse/microprofile/graphql/Id.java +++ b/server/api/src/main/java/org/eclipse/microprofile/graphql/Id.java @@ -24,11 +24,12 @@ /** * Marks a field as a ID Scalar Type. *
- * Note that this annotation may only be placed on String fields/getters/setters/parameters. A deployment - * error should result if it is placed on a field/getter/setter/parameter of a different type. - * + * Note that this annotation may only be placed on String, numerical primitive {@code long} and {@code int}, + * their object equivalents ({@link Long}, {@link Integer}), and {@link java.util.UUID} fields/getters/setters/parameters. + * A deployment error should result if it is placed on a field/getter/setter/parameter of a different type. + * *

- * For example, a user might annotate a method's parameter as such: + * For example, a user might annotate a field as such: *
  * public class Person {
  *      {@literal @}Id
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Ignore.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Ignore.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Ignore.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Ignore.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Input.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Input.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Input.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Input.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Interface.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Interface.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Interface.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Interface.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Mutation.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Mutation.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Mutation.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Mutation.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Name.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Name.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Name.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Name.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java
similarity index 98%
rename from api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java
index 111a4146..fce3f158 100644
--- a/api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java
+++ b/server/api/src/main/java/org/eclipse/microprofile/graphql/NonNull.java
@@ -64,7 +64,7 @@
  * a DefaultValue annotation.
  */
 @Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.FIELD})
+@Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
 @Documented
 public @interface NonNull {
-}
\ No newline at end of file
+}
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/NumberFormat.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/NumberFormat.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/NumberFormat.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/NumberFormat.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Query.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Query.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Query.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Query.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Source.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Source.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Source.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Source.java
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/Type.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Type.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/Type.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/Type.java
diff --git a/server/api/src/main/java/org/eclipse/microprofile/graphql/Union.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/Union.java
new file mode 100644
index 00000000..e762f1e3
--- /dev/null
+++ b/server/api/src/main/java/org/eclipse/microprofile/graphql/Union.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2020 Contributors to the Eclipse Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 org.eclipse.microprofile.graphql;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface Union {
+
+  String value() default "";
+}
diff --git a/api/src/main/java/org/eclipse/microprofile/graphql/package-info.java b/server/api/src/main/java/org/eclipse/microprofile/graphql/package-info.java
similarity index 100%
rename from api/src/main/java/org/eclipse/microprofile/graphql/package-info.java
rename to server/api/src/main/java/org/eclipse/microprofile/graphql/package-info.java
diff --git a/server/api/src/main/javadoc/licenses/Draft/license.html b/server/api/src/main/javadoc/licenses/Draft/license.html
new file mode 100644
index 00000000..994b5f85
--- /dev/null
+++ b/server/api/src/main/javadoc/licenses/Draft/license.html
@@ -0,0 +1,27 @@
+
+
+Apache License - Version 2
+
+
+

Apache License - Version 2

+

+Copyright (c) ${inceptionYear}-${currentYear} Contributors to the Eclipse Foundation +

+

+Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +

+

+ + http://www.apache.org/licenses/LICENSE-2.0 +

+

+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. +

+ + \ No newline at end of file diff --git a/server/api/src/main/javadoc/licenses/Final/license.html b/server/api/src/main/javadoc/licenses/Final/license.html new file mode 100644 index 00000000..be52b4f2 --- /dev/null +++ b/server/api/src/main/javadoc/licenses/Final/license.html @@ -0,0 +1,72 @@ + + +Eclipse Foundation Specification License - v1.0 + + +

Eclipse Foundation Specification License - v1.0

+

By using and/or copying this document, or the Eclipse Foundation + document from which this statement is linked, you (the licensee) agree + that you have read, understood, and will comply with the following + terms and conditions:

+ +

Permission to copy, and distribute the contents of this document, or + the Eclipse Foundation document from which this statement is linked, in + any medium for any purpose and without fee or royalty is hereby + granted, provided that you include the following on ALL copies of the + document, or portions thereof, that you use:

+ +
    +
  • link or URL to the original Eclipse Foundation document.
  • +
  • All existing copyright notices, or if one does not exist, a notice + (hypertext is preferred, but a textual representation is permitted) + of the form: "Copyright © [$date-of-document] + “Eclipse Foundation, Inc. <<url to this license>> + " +
  • +
+ +

Inclusion of the full text of this NOTICE must be provided. We + request that authorship attribution be provided in any software, + documents, or other items or products that you create pursuant to the + implementation of the contents of this document, or any portion + thereof.

+ +

No right to create modifications or derivatives of Eclipse Foundation + documents is granted pursuant to this license, except anyone may + prepare and distribute derivative works and portions of this document + in software that implements the specification, in supporting materials + accompanying such software, and in documentation of such software, + PROVIDED that all such works include the notice below. HOWEVER, the + publication of derivative works of this document for use as a technical + specification is expressly prohibited.

+ +

The notice is:

+ +

"Copyright © [$date-of-document] Eclipse Foundation. This software or + document includes material copied from or derived from [title and URI + of the Eclipse Foundation specification document]."

+ +

Disclaimers

+ +

THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT + HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR + WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, + NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE + SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS + WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR + OTHER RIGHTS.

+ +

THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE + FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT + OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE + CONTENTS THEREOF.

+ +

The name and trademarks of the copyright holders or the Eclipse + Foundation may NOT be used in advertising or publicity pertaining to + this document or its contents without specific, written prior + permission. Title to copyright in this document will at all times + remain with copyright holders.

+ + + diff --git a/api/src/main/resources/META-INF/placeholder.txt b/server/api/src/main/resources/META-INF/placeholder.txt similarity index 100% rename from api/src/main/resources/META-INF/placeholder.txt rename to server/api/src/main/resources/META-INF/placeholder.txt diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/DefaultValueTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/DefaultValueTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/DefaultValueTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/DefaultValueTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/EnumTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/EnumTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/EnumTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/EnumTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/IgnoreTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/IgnoreTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/IgnoreTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/IgnoreTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/InputTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/InputTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/InputTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/InputTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/MutationTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/MutationTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/MutationTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/MutationTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/NameTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/NameTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/NameTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/NameTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/QueryTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/QueryTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/QueryTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/QueryTest.java diff --git a/api/src/test/java/org/eclipse/microprofile/graphql/TypeTest.java b/server/api/src/test/java/org/eclipse/microprofile/graphql/TypeTest.java similarity index 100% rename from api/src/test/java/org/eclipse/microprofile/graphql/TypeTest.java rename to server/api/src/test/java/org/eclipse/microprofile/graphql/TypeTest.java diff --git a/server/pom.xml b/server/pom.xml new file mode 100644 index 00000000..3ba3b0c5 --- /dev/null +++ b/server/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-parent + 2.0-SNAPSHOT + ../ + + + MicroProfile GraphQL Server + + Server-side code-first API for developing GraphQL services in MicroProfile + microprofile-graphql-server + pom + + + spec + api + tck + + \ No newline at end of file diff --git a/spec/.gitignore b/server/spec/.gitignore similarity index 100% rename from spec/.gitignore rename to server/spec/.gitignore diff --git a/server/spec/pom.xml b/server/spec/pom.xml new file mode 100644 index 00000000..7a4cc3c5 --- /dev/null +++ b/server/spec/pom.xml @@ -0,0 +1,99 @@ + + + + 4.0.0 + + org.eclipse.microprofile.graphql + microprofile-graphql-server + 2.0-SNAPSHOT + ../ + + + microprofile-graphql-server-spec + pom + + MicroProfile GraphQL Server :: Specification + Server-side code-first GraphQL APIs for MicroProfile :: Specification + + + ${project.build.directory}/generated-docs/${project.build.finalName}.pdf + ${project.build.directory}/generated-docs/${project.build.finalName}.html + + + + clean package + + + + org.asciidoctor + asciidoctor-maven-plugin + + + + generate-pdf-doc + generate-resources + + process-asciidoc + + + ${spec.pdf} + pdf + + + + output-html + generate-resources + + process-asciidoc + + + ${spec.html} + html5 + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + package + + attach-artifact + + + + + ${spec.pdf} + pdf + + + ${spec.html} + html + + + + + + + + + + \ No newline at end of file diff --git a/spec/src/main/asciidoc/components.asciidoc b/server/spec/src/main/asciidoc/components.asciidoc similarity index 100% rename from spec/src/main/asciidoc/components.asciidoc rename to server/spec/src/main/asciidoc/components.asciidoc diff --git a/spec/src/main/asciidoc/components/arguments.asciidoc b/server/spec/src/main/asciidoc/components/arguments.asciidoc similarity index 100% rename from spec/src/main/asciidoc/components/arguments.asciidoc rename to server/spec/src/main/asciidoc/components/arguments.asciidoc diff --git a/spec/src/main/asciidoc/components/generated_schema.asciidoc b/server/spec/src/main/asciidoc/components/generated_schema.asciidoc similarity index 100% rename from spec/src/main/asciidoc/components/generated_schema.asciidoc rename to server/spec/src/main/asciidoc/components/generated_schema.asciidoc diff --git a/spec/src/main/asciidoc/components/graphqlapi.asciidoc b/server/spec/src/main/asciidoc/components/graphqlapi.asciidoc similarity index 100% rename from spec/src/main/asciidoc/components/graphqlapi.asciidoc rename to server/spec/src/main/asciidoc/components/graphqlapi.asciidoc diff --git a/spec/src/main/asciidoc/components/lifecycle.asciidoc b/server/spec/src/main/asciidoc/components/lifecycle.asciidoc similarity index 100% rename from spec/src/main/asciidoc/components/lifecycle.asciidoc rename to server/spec/src/main/asciidoc/components/lifecycle.asciidoc diff --git a/spec/src/main/asciidoc/components/mutations.asciidoc b/server/spec/src/main/asciidoc/components/mutations.asciidoc similarity index 97% rename from spec/src/main/asciidoc/components/mutations.asciidoc rename to server/spec/src/main/asciidoc/components/mutations.asciidoc index a2c3fefd..ef4728d4 100644 --- a/spec/src/main/asciidoc/components/mutations.asciidoc +++ b/server/spec/src/main/asciidoc/components/mutations.asciidoc @@ -91,7 +91,8 @@ value is used as the mutation name. is used as the mutation name. * if the method is annotated with a `@JsonbProperty` annotation containing a non-empty String for it's value, that String value is used as the mutation name. -* if no other name can be determined, the Java method name is used as the mutation name. (with the set removed if this is a setter) +* if no other name can be determined, the Java method name is used as the mutation name. (with the set removed if the method +name matches the rules for a setter. e.g. `^set[A-Z].*`) Note that it is considered a deployment error if more than one mutation method has the same name with the same arguments. diff --git a/spec/src/main/asciidoc/components/queries.asciidoc b/server/spec/src/main/asciidoc/components/queries.asciidoc similarity index 96% rename from spec/src/main/asciidoc/components/queries.asciidoc rename to server/spec/src/main/asciidoc/components/queries.asciidoc index 2b2cb331..58e0f1a8 100644 --- a/spec/src/main/asciidoc/components/queries.asciidoc +++ b/server/spec/src/main/asciidoc/components/queries.asciidoc @@ -57,7 +57,8 @@ is used as the query name. is used as the query name. * if the method is annotated with a `@JsonbProperty` annotation containing a non-empty String for it's value, that String value is used as the query name. -* if no other name can be determined, the Java method name is used as the query name. (with the get/is removed if this is a getter) +* if no other name can be determined, the Java method name is used as the query name. (with the get/is removed if the method +name matches the rules for a getter. e.g. `^get[A-Z].\*` or `^is[A-Z].*`) Note that it is considered a deployment error if more than one query method has the same name with the same arguments. diff --git a/spec/src/main/asciidoc/entities.asciidoc b/server/spec/src/main/asciidoc/entities.asciidoc similarity index 100% rename from spec/src/main/asciidoc/entities.asciidoc rename to server/spec/src/main/asciidoc/entities.asciidoc diff --git a/spec/src/main/asciidoc/entities/default_values.asciidoc b/server/spec/src/main/asciidoc/entities/default_values.asciidoc similarity index 100% rename from spec/src/main/asciidoc/entities/default_values.asciidoc rename to server/spec/src/main/asciidoc/entities/default_values.asciidoc diff --git a/spec/src/main/asciidoc/entities/description.asciidoc b/server/spec/src/main/asciidoc/entities/description.asciidoc similarity index 89% rename from spec/src/main/asciidoc/entities/description.asciidoc rename to server/spec/src/main/asciidoc/entities/description.asciidoc index 69e6d41c..fff0d1ed 100644 --- a/spec/src/main/asciidoc/entities/description.asciidoc +++ b/server/spec/src/main/asciidoc/entities/description.asciidoc @@ -48,10 +48,10 @@ type Query { Formatting annotations like `@NumberFormat` and `@DateFormat` ( or `@JsonbDateFormat` and `@JsonbNumberFormat` from JsonB) can be used to transform data at runtime (see <>) If no `@Description` annotation is provided for a date or number field, the format string specified in the relative annotation (`@NumberFormat` or `@DateFormat` or `@JsonbDateFormat` or `@JsonbNumberFormat`) -will be used as the field's description, or, for dates only, the default date format in the case there is no `@DateFormat` or `@JsonbDateFormat` annotation. +will be used as the field's description, or, for dates only, the default date format, or just the text `ISO-8601`, in the case there is no `@DateFormat` or `@JsonbDateFormat` annotation. If a `@Description` annotation is provided for a date or number field, the format string specified in the relative annotation (`@NumberFormat` or `@DateFormat` or `@JsonbDateFormat` or `@JsonbNumberFormat`) -will be appended to the given description in brackets `(...)`, or, for dates only, the default date format in the case there is no `@DateFormat` or `@JsonbDateFormat` annotation. +will be appended to the given description in brackets `(...)`, or, for dates only, the default date format, or just the text `ISO-8601`, in the case there is no `@DateFormat` or `@JsonbDateFormat` annotation. Example: @@ -80,10 +80,10 @@ will result in: [source,graphql,numbered] ---- type ScalarHolder { - "yyyy-MM-dd" + "ISO-8601" dateObject: Date - "This is another date (yyyy-MM-dd)" + "This is another date (ISO-8601)" anotherDateObject: Date "This is a formatted date (MM dd yyyy)" diff --git a/spec/src/main/asciidoc/entities/enums.asciidoc b/server/spec/src/main/asciidoc/entities/enums.asciidoc similarity index 100% rename from spec/src/main/asciidoc/entities/enums.asciidoc rename to server/spec/src/main/asciidoc/entities/enums.asciidoc diff --git a/spec/src/main/asciidoc/entities/ignorable_fields.asciidoc b/server/spec/src/main/asciidoc/entities/ignorable_fields.asciidoc similarity index 100% rename from spec/src/main/asciidoc/entities/ignorable_fields.asciidoc rename to server/spec/src/main/asciidoc/entities/ignorable_fields.asciidoc diff --git a/spec/src/main/asciidoc/entities/naming.asciidoc b/server/spec/src/main/asciidoc/entities/naming.asciidoc similarity index 84% rename from spec/src/main/asciidoc/entities/naming.asciidoc rename to server/spec/src/main/asciidoc/entities/naming.asciidoc index a6bfa07b..70b0df8d 100644 --- a/spec/src/main/asciidoc/entities/naming.asciidoc +++ b/server/spec/src/main/asciidoc/entities/naming.asciidoc @@ -24,23 +24,17 @@ For example: .Name Java Code Example [source,java,numbered] ---- -public class Widget { - @Name("widgetName") - private String name; - private double weight; - private int quantity; - //... +public class Person { - @JsonbProperty("shippingWeight") - public double getWeight() { - return weight; - } - //... + @Name("lastName") + private String surname; - @Name("qty") - public void setQuantity(int quantity) { - this.quantity = quantity; - } + @JsonbProperty("firstName") + private String forename; + + private LocalDate birth; + + //... } ---- @@ -49,16 +43,16 @@ That would create a schema like this: .Name Schema Example [source,graphql,numbered] ---- -type Widget { - widgetName: String - quantity: Int! - shippingWeight: Double! +type Person { + lastName: String + firstName: String + birth: Date } -input WidgetInput { - widgetName: String - qty: Int! - weight: Double! +input PersonInput { + lastName: String + firstName: String + birth: Date } ---- @@ -66,18 +60,19 @@ By putting the `@Name` (or `JsonbProperty`) annotation on the `getter` method, r [source,java,numbered] ---- -public class Widget { +public class Person { - private float price; - - @Name("cost") - public float getPrice(){ - return this.price; + private LocalDate birth; + + @Name("birthday") + public LocalDate getBirth() { + return this.birth; } - public void setPrice(float price){ - this.price = price; + public void setBirth(LocalDate birth) { + this.birth = birth; } + } ---- @@ -85,11 +80,11 @@ This would result in a schema that looks something like: [source,graphql,numbered] ---- -type Widget { - cost: Float! +type Person { + birthday: Date } -input WidgetInput { - price: Float! +input PersonInput { + birth: Date } ---- @@ -97,18 +92,19 @@ The input type keeps the default field name. Similarly, when the `@Name` (or `Js [source,java,numbered] ---- -public class Widget { +public class Person { - private float price; - - public float getPrice(){ - return this.price; + private LocalDate birth; + + public LocalDate getBirth() { + return this.birth; } - @Name("cost") - public void setPrice(float price){ - this.price = price; + @Name("birthday") + public void setBirth(LocalDate birth) { + this.birth = birth; } + } ---- @@ -116,11 +112,11 @@ This would result in a schema that looks something like: [source,graphql,numbered] ---- -type Widget { - price: Float! +type Person { + birth: Date } -input WidgetInput { - cost: Float! +input PersonInput { + birthday: Date } ---- @@ -314,4 +310,4 @@ type Query { locationQuery(heroInput: SuperHeroInput): String #... } ----- \ No newline at end of file +---- diff --git a/spec/src/main/asciidoc/entities/non-nullable_fields.asciidoc b/server/spec/src/main/asciidoc/entities/non-nullable_fields.asciidoc similarity index 100% rename from spec/src/main/asciidoc/entities/non-nullable_fields.asciidoc rename to server/spec/src/main/asciidoc/entities/non-nullable_fields.asciidoc diff --git a/spec/src/main/asciidoc/entities/objects.asciidoc b/server/spec/src/main/asciidoc/entities/objects.asciidoc similarity index 76% rename from spec/src/main/asciidoc/entities/objects.asciidoc rename to server/spec/src/main/asciidoc/entities/objects.asciidoc index aa51054a..36b6c867 100644 --- a/spec/src/main/asciidoc/entities/objects.asciidoc +++ b/server/spec/src/main/asciidoc/entities/objects.asciidoc @@ -27,11 +27,12 @@ Optionally it can also: - Be annotated with `@Type` (for return objects) to name the entity, - Be annotated with `@Input` (for input parameter) to name the entity, - Be annotated with `@Interface` (for interfaces) to name the entity, +- Be annotated with `@Union` (for unions) to name the entity, - Be annotated with `@Name` to name the entity. -The name of the `type`, `input` or `interface` will be determined as follows: +The name of the `type`, `input`, `interface`, or `union` will be determined as follows: -- If the value of the `@Type` / `@Input` / `@Interface` annotation is present and not empty, use that as the name, else +- If the value of the `@Type` / `@Input` / `@Interface` / `@Union` annotation is present and not empty, use that as the name, else - If the value of the `@Name` annotation is present and not empty, use that as the name, else - Use the Java class name (without the package prefix). @@ -60,12 +61,13 @@ The `@Type` annotation is used for output entities while the `@Input` annotation Normally these annotations are unnecessary if the type can be serialized and/or deserialized, and if the type is specified in a query or mutation method. These annotations can be used to specify the name of the type in the GraphQL schema; by default, the entity name in the schema will be the same as the simple class name of the entity type for -output types; for input types, the simple class name is used with "Input" appended. Thus, an entity class named +output types; for input types, the simple class name is used with "Input" appended. Thus, an entity class named `com.mypkg.Tree` would create a GraphQL schema type called "Tree" and an input type called "TreeInput". +[[interfaces]] ==== GraphQL interfaces -It is possible for output types to be defined as a Java interfaces. GraphQL interfaces are very similar in +It is possible for output types to be defined as a Java interfaces. GraphQL interfaces are very similar in concept to Java interfaces, in that other types may implement an interface. This allows the GraphQL schema to better align with the Java application's model and allows clients to retrieve the same data (fields) on multiple different entity types. GraphQL interfaces are created with a Java interface type and might be annotated @@ -125,7 +127,81 @@ type Villain implements Character { ===== Limitations -At the moment the spec does not support interfaces on input types. +At the moment the spec does not support interfaces on input types. + +[[unions]] +==== GraphQL unions + +Java doesn't have a direct way to represent a GraphQL union, but one can be modeled well using Java interfaces +containing no defined common fields. GraphQL unions are created with a Java interface type and must be annotated +with `@Union`. The MP GraphQL implementation must then generate a schema where every class in the application +that implements that Java interface must have a type in the schema that is a member of the GraphQL union. For +example: + +[source,java,numbered] +---- +import jdk.jfr.Description;@Union +public interface PowerSource { + +} + +public class Magic implements PowerSource { + + @NonNull + @Description("Can this magic be learned") + private boolean canBeLearned; + + // ... +} + +public class GeneticMutation implements PowerSource { + + @NonNull + @Description("Was this mutation present at birth") + private boolean isPresentAtBirth; + + @Description("The date this mutation occurred") + private LocalDate dateOfMutation; + + // ... +} + +public class ExtremeWealth implements PowerSource { + + @NonNull + @Description("The net worth granting this character powers") + private Float netWorth; + + // ... +} +---- + +This should generate a schema like: + +[source,graphql,numbered] +---- +type Magic { + "Can this magic be learned" + canBeLearned: Boolean! + # ... +} + +type GeneticMutation { + "Was this mutation present at birth" + isPresentAtBirth: Boolean! + + "The date this mutation occurred" + dateOfMutation: String + # ... +} + +type ExtremeWealth { + "The net worth granting this character powers" + netWorth: Float! +} + +union PowerSource = Magic | GeneticMutation | ExtremeWealth +---- [[fields]] ==== Fields @@ -162,7 +238,7 @@ public class MyQueries { } ---- -The above query adds a new field to the `SuperHero` GraphQL entity type, called `currentLocation`. This field is not +The above query adds a new field to the `SuperHero` GraphQL entity type, called `currentLocation`. This field is not part of the `SuperHero` Java class, but _is_ part of the GraphQL entity. This association is made by using the `@Source` annotation. Also note that the `currentLocation` method will only be invoked if the client requests the `currentLocation` field in the query. This is a useful way to prevent looking up data on the server that the client is @@ -187,7 +263,7 @@ You can also choose to expose the method containing the `@Source` annotation as ---- @GraphQLApi public class MyQueries { - + @Query public Location currentLocation(@Source SuperHero hero) { return getLocationForHero(hero.getName()); @@ -216,4 +292,4 @@ include::default_values.asciidoc[] include::ignorable_fields.asciidoc[] -include::non-nullable_fields.asciidoc[] \ No newline at end of file +include::non-nullable_fields.asciidoc[] diff --git a/spec/src/main/asciidoc/entities/scalars.asciidoc b/server/spec/src/main/asciidoc/entities/scalars.asciidoc similarity index 94% rename from spec/src/main/asciidoc/entities/scalars.asciidoc rename to server/spec/src/main/asciidoc/entities/scalars.asciidoc index 3221c455..8e110b88 100644 --- a/spec/src/main/asciidoc/entities/scalars.asciidoc +++ b/server/spec/src/main/asciidoc/entities/scalars.asciidoc @@ -72,7 +72,8 @@ using the `@NumberFormat` or alternatively the JSON-B annotation `@JsonbNumberFo In the case that a property has both `@NumberFormat` and `@JsonbNumberFormat`, the GraphQL annotation (`@NumberFormat`) takes priority. -When formatting is added to a number type, the formatted result will be of type String. +When formatting is added to a number type, the formatted result will be of type String. The type in the schema could be defined as String or another Custom Scalar to +indicate the formatting. Example: [source,java,numbered] @@ -127,7 +128,7 @@ This will format the input and return the formatted result, example when executi ---- ==== Dates -By default the date related scalars (DateTime, Date, and Time) will use an ISO format. +By default the date related scalars (DateTime, Date, and Time) will use an ISO-8601 format. - `yyyy-MM-dd\'T\'HH:mm:ss` for DateTime - `yyyy-MM-dd\'T\'HH:mm:ssZ` for OffsetDateTime @@ -141,6 +142,9 @@ support usage on `TYPE_USE`. In the case that a property has both `@DateFormat` and `@JsonbDateFormat`, the GraphQL annotation (`@DateFormat`) takes priority. +When formatting is added to a date type, the formatted result will be of type String. The type in the schema could be defined as String or another Custom Scalar to +indicate the formatting. + The formatting annotations can also be placed on a `Query` or `Mutation` that returns a date-like object, example: [source,java,numbered] diff --git a/spec/src/main/asciidoc/errorhandling.asciidoc b/server/spec/src/main/asciidoc/errorhandling.asciidoc similarity index 85% rename from spec/src/main/asciidoc/errorhandling.asciidoc rename to server/spec/src/main/asciidoc/errorhandling.asciidoc index cb160b75..92648130 100644 --- a/spec/src/main/asciidoc/errorhandling.asciidoc +++ b/server/spec/src/main/asciidoc/errorhandling.asciidoc @@ -83,7 +83,7 @@ why the client request was invalid. If the client request is valid, then the implementation must invoke the correct query or mutation method in the user application. The user application can indicate that an error has occurred by throwing an exception (checked or -unchecked). When the user application throws and exception, the implementation must send back a response that includes +unchecked). When the user application throws an exception, the implementation must send back a response that includes an error message. ==== Unchecked exceptions @@ -96,31 +96,31 @@ Example: `mp.graphql.defaultErrorMessage=Unexpected failure in the system. Jarvis is working to fix it.` -Users can allow unchecked exception messages to be included (changing the default behavior as described above) by adding the exception class name to a `whitelist`. This is done using MicroProfile Config and setting the `mp.graphql.exceptionsWhiteList` property (comma-separated list) +Users can allow unchecked exception messages to be included (changing the default behavior as described above) by adding the exception class name to a `showErrorMessage` list. This is done using MicroProfile Config and setting the `mp.graphql.showErrorMessage` property with a comma-separated list (formerly `mp.graphql.exceptionsWhiteList` - this property is deprecated and is scheduled for removal in the next major release). Example: -`mp.graphql.exceptionsWhiteList=org.eclipse.microprofile.graphql.tck.apps.superhero.api.WeaknessNotFoundException` +`mp.graphql.showErrorMessage=org.eclipse.microprofile.graphql.tck.apps.superhero.api.WeaknessNotFoundException` -NOTE: By default all unchecked exceptions is on the `blacklist`. +NOTE: By default all unchecked exceptions are on the `hideErrorMessage` list. IMPORTANT: Configurations will indicate all instances of the exception class, transitively. Example: -If you have an exception that extends the above mentioned `WeaknessNotFoundException`, the whitelist will still apply to that specialization. +If you have an exception that extends the above mentioned `WeaknessNotFoundException`, the showErrorMessage list will still apply to that specialization. ==== Checked exceptions By default checked exceptions must include the exception message in the `message` field of the error, and where possible also include the `locations` and `path`. -Implementations must support the ability to 'hide' this message for checked exceptions by allowing users to add them to a `blacklist`. This is done using MicroProfile Config and setting the `mp.graphql.exceptionsBlackList` property (comma-separated list) +Implementations must support the ability to 'hide' this message for checked exceptions by allowing users to add them to the `hideErrorMessage` list. This is done using MicroProfile Config and setting the `mp.graphql.hideErrorMessage` property with a comma-separated list (formerly `mp.graphql.exceptionsBlackList` - this property is deprecated and is scheduled for removal in the next major release). Example: -`mp.graphql.exceptionsBlackList=java.io.IOException,java.util.concurrent.TimeoutException` +`mp.graphql.hideErrorMessage=java.io.IOException,java.util.concurrent.TimeoutException` -NOTE: By default all checked exceptions is on the `whitelist`. +NOTE: By default all checked exceptions is on the `showErrorMessage` list. IMPORTANT: Configurations will indicate all instances of the exception class, transitively. Example: -If you have an exception that extends the above mentioned `IOException`, the blacklist will still apply to any specialization (`MyException extends IOException`) +If you have an exception that extends the above mentioned `IOException`, the hideErrorMessage list will still apply to any specialization (`MyException extends IOException`) === Partial Results diff --git a/server/spec/src/main/asciidoc/index.asciidoc b/server/spec/src/main/asciidoc/index.asciidoc new file mode 100644 index 00000000..77ccc340 --- /dev/null +++ b/server/spec/src/main/asciidoc/index.asciidoc @@ -0,0 +1,39 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL Server +:authors: Jean-Francois James, Phillip Krüger, Andy McCright, Jean-Baptiste Roux, Bojan Tomic, Adam Anderson +:email: microprofile@googlegroups.com +:version-label!: +:sectanchors: +:doctype: book +:license: Eclipse Foundation Specification License v1.0 +:source-highlighter: coderay +:sectnums: +:toc: left +:toclevels: 4 +:sectnumlevels: 4 +ifdef::backend-pdf[] +:pagenums: +:numbered: +endif::[] + +include::license-efsl.asciidoc[] + +include::server.asciidoc[] diff --git a/spec/src/main/asciidoc/intro.asciidoc b/server/spec/src/main/asciidoc/intro.asciidoc similarity index 100% rename from spec/src/main/asciidoc/intro.asciidoc rename to server/spec/src/main/asciidoc/intro.asciidoc diff --git a/server/spec/src/main/asciidoc/license-alv2.asciidoc b/server/spec/src/main/asciidoc/license-alv2.asciidoc new file mode 100644 index 00000000..47793817 --- /dev/null +++ b/server/spec/src/main/asciidoc/license-alv2.asciidoc @@ -0,0 +1,42 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + +[subs="normal"] +.... + +Specification: {doctitle} + +Version: {revnumber} + +Status: {revremark} + +Release: {revdate} + +Copyright (c) 2020 Contributors to the Eclipse Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +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. + +.... diff --git a/server/spec/src/main/asciidoc/license-efsl.asciidoc b/server/spec/src/main/asciidoc/license-efsl.asciidoc new file mode 100644 index 00000000..85993af3 --- /dev/null +++ b/server/spec/src/main/asciidoc/license-efsl.asciidoc @@ -0,0 +1,73 @@ +[subs="normal"] +.... +Specification: {doctitle} +Version: {revnumber} +Status: {revremark} +Release: {revdate} +.... + +== Copyright + +Copyright (c) {inceptionYear}, {currentYear} Eclipse Foundation. + +=== Eclipse Foundation Specification License + +By using and/or copying this document, or the Eclipse Foundation +document from which this statement is linked, you (the licensee) agree +that you have read, understood, and will comply with the following +terms and conditions: + +Permission to copy, and distribute the contents of this document, or +the Eclipse Foundation document from which this statement is linked, in +any medium for any purpose and without fee or royalty is hereby +granted, provided that you include the following on ALL copies of the +document, or portions thereof, that you use: + +* link or URL to the original Eclipse Foundation document. +* All existing copyright notices, or if one does not exist, a notice + (hypertext is preferred, but a textual representation is permitted) + of the form: "Copyright (c) [$date-of-document] + Eclipse Foundation, Inc. \<>" + +Inclusion of the full text of this NOTICE must be provided. We +request that authorship attribution be provided in any software, +documents, or other items or products that you create pursuant to the +implementation of the contents of this document, or any portion +thereof. + +No right to create modifications or derivatives of Eclipse Foundation +documents is granted pursuant to this license, except anyone may +prepare and distribute derivative works and portions of this document +in software that implements the specification, in supporting materials +accompanying such software, and in documentation of such software, +PROVIDED that all such works include the notice below. HOWEVER, the +publication of derivative works of this document for use as a technical +specification is expressly prohibited. + +The notice is: + +"Copyright (c) [$date-of-document] Eclipse Foundation. This software or +document includes material copied from or derived from [title and URI +of the Eclipse Foundation specification document]." + +==== Disclaimers + +THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT +HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR +WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE +SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS +WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR +OTHER RIGHTS. + +THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE +FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT +OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE +CONTENTS THEREOF. + +The name and trademarks of the copyright holders or the Eclipse +Foundation may NOT be used in advertising or publicity pertaining to +this document or its contents without specific, written prior +permission. Title to copyright in this document will at all times +remain with copyright holders. diff --git a/spec/src/main/asciidoc/release_notes.asciidoc b/server/spec/src/main/asciidoc/release_notes.asciidoc similarity index 100% rename from spec/src/main/asciidoc/release_notes.asciidoc rename to server/spec/src/main/asciidoc/release_notes.asciidoc diff --git a/server/spec/src/main/asciidoc/server.asciidoc b/server/spec/src/main/asciidoc/server.asciidoc new file mode 100644 index 00000000..d9e76b87 --- /dev/null +++ b/server/spec/src/main/asciidoc/server.asciidoc @@ -0,0 +1,30 @@ +// +// Copyright (c) 2020 Contributors to the Eclipse Foundation +// +// See the NOTICE file(s) distributed with this work for additional +// information regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// 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. +// + += MicroProfile GraphQL Server + +include::intro.asciidoc[] + +include::entities.asciidoc[] + +include::components.asciidoc[] + +include::errorhandling.asciidoc[] + +include::release_notes.asciidoc[] \ No newline at end of file diff --git a/server/spec/src/main/resources/META-INF/LICENSE b/server/spec/src/main/resources/META-INF/LICENSE new file mode 100644 index 00000000..fe731048 --- /dev/null +++ b/server/spec/src/main/resources/META-INF/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Contributors to the Eclipse Foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + 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. diff --git a/server/spec/src/main/resources/META-INF/NOTICE b/server/spec/src/main/resources/META-INF/NOTICE new file mode 100644 index 00000000..37dc70ad --- /dev/null +++ b/server/spec/src/main/resources/META-INF/NOTICE @@ -0,0 +1,13 @@ +========================================================================= +== NOTICE file corresponding to section 4(d) of the Apache License, == +== Version 2.0, in this case for Microprofile GraphQL == +========================================================================= + +SPDXVersion: SPDX-2.1 +PackageName: Eclipse Microprofile +PackageHomePage: http://www.eclipse.org/microprofile +PackageLicenseDeclared: Apache-2.0 + +PackageCopyrightText: +J. Andrew McCright j.andrew.mccright@gmail.com + diff --git a/tck/.gitignore b/server/tck/.gitignore similarity index 100% rename from tck/.gitignore rename to server/tck/.gitignore diff --git a/tck/README.asciidoc b/server/tck/README.asciidoc similarity index 100% rename from tck/README.asciidoc rename to server/tck/README.asciidoc diff --git a/tck/high-level.drawio b/server/tck/high-level.drawio similarity index 100% rename from tck/high-level.drawio rename to server/tck/high-level.drawio diff --git a/tck/high-level.png b/server/tck/high-level.png similarity index 100% rename from tck/high-level.png rename to server/tck/high-level.png diff --git a/tck/pom.xml b/server/tck/pom.xml similarity index 72% rename from tck/pom.xml rename to server/tck/pom.xml index ea454a06..cdea73bd 100644 --- a/tck/pom.xml +++ b/server/tck/pom.xml @@ -16,33 +16,32 @@ --> 4.0.0 - org.eclipse.microprofile.graphql - microprofile-graphql-parent - 1.1-SNAPSHOT + microprofile-graphql-server + 2.0-SNAPSHOT ../ - - microprofile-graphql-tck - MicroProfile GraphQL :: TCK - Code-first GraphQL APIs for MicroProfile :: TCK + + microprofile-graphql-server-tck + MicroProfile GraphQL Server :: TCK + Server-side code-first GraphQL APIs for MicroProfile :: TCK - 1.1.6 - 1.0.2 - 2.6 - 1.5.0 + 2.11.0 + 1.5.1 + ${project.groupId} - microprofile-graphql-api + microprofile-graphql-server-api ${project.version} provided + jakarta.enterprise jakarta.enterprise.cdi-api @@ -51,45 +50,39 @@ jakarta.json.bind jakarta.json.bind-api - ${jsonb-api.version} provided jakarta.json jakarta.json-api - ${jsonp-api.version} provided + org.jboss.arquillian.testng arquillian-testng-container - org.jboss.arquillian.container arquillian-container-test-spi - org.testng testng compile - org.jboss.shrinkwrap shrinkwrap-api compile - commons-io commons-io ${commons-io.version} - org.skyscreamer jsonassert @@ -109,30 +102,55 @@ + org.apache.maven.plugins - maven-javadoc-plugin + maven-source-plugin - attach-javadocs + attach-sources jar + org.apache.maven.plugins - maven-source-plugin + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 - attach-sources + copy-licenses + validate - jar + copy-resources + + ${basedir}/target/classes/META-INF/ + true + + + src/main/licenses/${revremark}/ + true + + + + @@ -156,5 +174,4 @@ - - + \ No newline at end of file diff --git a/tck/running_the_tck.asciidoc b/server/tck/running_the_tck.asciidoc similarity index 100% rename from tck/running_the_tck.asciidoc rename to server/tck/running_the_tck.asciidoc diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/AnotherUnionMember.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/AnotherUnionMember.java new file mode 100644 index 00000000..f86fde9f --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/AnotherUnionMember.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +/** + * To test the generation of a type, even if it's not used (directly) as a return type. + */ +public class AnotherUnionMember implements BasicUnion { + + private int count = 0; + + public AnotherUnionMember() { + } + + public AnotherUnionMember(int count) { + this.count = count; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysApi.java new file mode 100644 index 00000000..3d100b55 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysApi.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.GraphQLApi; +import org.eclipse.microprofile.graphql.Query; + +@GraphQLApi +public class ArraysApi { + + @Query + public ArraysHolder arraysHolder() { + return new ArraysHolder(); + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysHolder.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysHolder.java new file mode 100644 index 00000000..07f698a6 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ArraysHolder.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import java.time.LocalDate; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.microprofile.graphql.DateFormat; +import org.eclipse.microprofile.graphql.NumberFormat; + +public class ArraysHolder { + + private Integer[] intObject = {1, 2, 3}; + + private List intObjectList = Arrays.asList(intObject); + + private int[] intPrimitive = {1, 2, 3}; + + @NumberFormat(value = "¤00", locale = "en-ZA") + private Integer[] formattedIntObject = intObject; + + @NumberFormat(value = "¤00", locale = "en-ZA") + private List formattedIntObjectList = Arrays.asList(intObject); + + @NumberFormat(value = "¤00", locale = "en-ZA") + private int[] formattedIntPrimitive = intPrimitive; + + private LocalDate[] date = {LocalDate.parse("2006-02-01"), LocalDate.parse("2007-03-02")}; + + private List dateList = Arrays.asList(date); + + @DateFormat(value = "dd.MM.yyyy") + private LocalDate[] formattedDate = date; + + @DateFormat(value = "dd.MM.yyyy") + private List formattedDateList = Arrays.asList(date); + + public Integer[] getIntObject() { + return intObject; + } + + public int[] getIntPrimitive() { + return intPrimitive; + } + + public Integer[] getFormattedIntObject() { + return formattedIntObject; + } + + public int[] getFormattedIntPrimitive() { + return formattedIntPrimitive; + } + + public List getIntObjectList() { + return intObjectList; + } + + public List getFormattedIntObjectList() { + return formattedIntObjectList; + } + + public LocalDate[] getDate() { + return date; + } + + public List getDateList() { + return dateList; + } + + public LocalDate[] getFormattedDate() { + return formattedDate; + } + + public List getFormattedDateList() { + return formattedDateList; + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicEnum.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicEnum.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicEnum.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicEnum.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInput.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInput.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInput.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInput.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInterface.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInterface.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInterface.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicInterface.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicType.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicType.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicType.java diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicUnion.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicUnion.java new file mode 100644 index 00000000..d4c781ec --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/BasicUnion.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.Union; + +/** + * To test the generation of Types even if it's not used (directly) as a return type. + * This is the union that is used directly. + */ +@Union +public interface BasicUnion { + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/CharApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/CharApi.java new file mode 100644 index 00000000..9cdc33fb --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/CharApi.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.GraphQLApi; +import org.eclipse.microprofile.graphql.Query; +import org.eclipse.microprofile.graphql.Source; + +@GraphQLApi +public class CharApi { + + @Query + public CharHolder charHolder() { + return new CharHolder(); + } + + public char charPrimitiveInput(@Source CharHolder charHolder, char c) { + return c; + } + + public char[] charArrayInput(@Source CharHolder charHolder, char[] cs) { + return cs; + } + + public Character charObjectInput(@Source CharHolder charHolder, Character c) { + return c; + } + + /* + * Used to have a "namespace". + */ + public static class CharHolder { + + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/GrandParentType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/GrandParentType.java new file mode 100644 index 00000000..8059fe1e --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/GrandParentType.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.Description; + +public class GrandParentType { + + @Description("Field from grand-parent") + private String grandParentTypeField; + + public String getGrandParentTypeField() { + return grandParentTypeField; + } + + public void setGrandParentTypeField(final String grandParentTypeField) { + this.grandParentTypeField = grandParentTypeField; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/JsonbPerson.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/JsonbPerson.java new file mode 100644 index 00000000..dc6e6930 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/JsonbPerson.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import java.time.LocalDate; + +import javax.json.bind.annotation.JsonbProperty; + +/** + * Type to test {@code @JsonbProperty} on field, getter and setter. + */ +public class JsonbPerson { + + @JsonbProperty("lastName") + private String surname; + + private String forename; + + private LocalDate birth; + + + public JsonbPerson() { + } + + public JsonbPerson(final String surname, final String forename, final LocalDate birth) { + this.surname = surname; + this.forename = forename; + this.birth = birth; + } + + public String getSurname() { + return surname; + } + + public void setSurname(final String surname) { + this.surname = surname; + } + + + @JsonbProperty("firstName") + public String getForename() { + return forename; + } + + public void setForename(final String forename) { + this.forename = forename; + } + + + public LocalDate getBirth() { + return birth; + } + + @JsonbProperty("birthDay") + public void setBirth(final LocalDate birth) { + this.birth = birth; + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ParentType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ParentType.java new file mode 100644 index 00000000..7f40b07b --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ParentType.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + + +import org.eclipse.microprofile.graphql.Description; +import org.eclipse.microprofile.graphql.Name; +import org.eclipse.microprofile.graphql.NonNull; + +public class ParentType extends GrandParentType { + + @Description("Field from parent") + private String parentTypeField; + + @NonNull + @Name("nonNullParentField") + private String nonNullParentTypeField; + + public String getParentTypeField() { + return parentTypeField; + } + + public void setParentTypeField(final String parentTypeField) { + this.parentTypeField = parentTypeField; + } + + public String getNonNullParentTypeField() { + return nonNullParentTypeField; + } + + public void setNonNullParentTypeField(final String nonNullParentTypeField) { + this.nonNullParentTypeField = nonNullParentTypeField; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/Person.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/Person.java new file mode 100644 index 00000000..92f877bd --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/Person.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import java.time.LocalDate; + +import org.eclipse.microprofile.graphql.Name; + +/** + * Type to test {@code @Name} on field, getter and setter. + */ +public class Person { + + @Name("lastName") + private String surname; + + private String forename; + + private LocalDate birth; + + + public Person() { + } + + public Person(final String surname, final String forename, final LocalDate birth) { + this.surname = surname; + this.forename = forename; + this.birth = birth; + } + + public String getSurname() { + return surname; + } + + public void setSurname(final String surname) { + this.surname = surname; + } + + + @Name("firstName") + public String getForename() { + return forename; + } + + public void setForename(final String forename) { + this.forename = forename; + } + + + public LocalDate getBirth() { + return birth; + } + + @Name("birthDay") + public void setBirth(final LocalDate birth) { + this.birth = birth; + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedType.java new file mode 100644 index 00000000..5270d5e2 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedType.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +/** + * Used to test creation of referenced Types. + *

+ * Should not be used directly as input or output type. + */ +public class ReferencedType { + + private String value; + + public String getValue() { + return value; + } + + public void setValue(final String value) { + this.value = value; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedTypeTestApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedTypeTestApi.java new file mode 100644 index 00000000..b8a5d6cf --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencedTypeTestApi.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.GraphQLApi; +import org.eclipse.microprofile.graphql.Mutation; +import org.eclipse.microprofile.graphql.Query; + +@GraphQLApi +public class ReferencedTypeTestApi { + + @Query + public ReferencingType referencingType() { + ReferencedType referencedType = new ReferencedType(); + referencedType.setValue("value"); + ReferencingType referencingType = new ReferencingType(); + referencingType.setReferencedType(referencedType); + referencingType.setNonNullReferencedType(referencedType); + return referencingType; + } + + @Mutation + public ReferencingType addReferencingType(ReferencingType referencingType) { + return referencingType; + } + + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencingType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencingType.java new file mode 100644 index 00000000..2b8ecb9b --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ReferencingType.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.NonNull; + +/** + * Used to test the creation of {@link ReferencedType}. + */ +public class ReferencingType { + + private ReferencedType referencedType; + + @NonNull + private ReferencedType nonNullReferencedType; + + + public ReferencedType getReferencedType() { + return referencedType; + } + + public void setReferencedType(final ReferencedType referencedType) { + this.referencedType = referencedType; + } + + public ReferencedType getNonNullReferencedType() { + return nonNullReferencedType; + } + + public void setNonNullReferencedType(final ReferencedType nonNullReferencedType) { + this.nonNullReferencedType = nonNullReferencedType; + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarHolder.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarHolder.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarHolder.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarHolder.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java similarity index 91% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java index dff3ce58..879f7697 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/ScalarTestApi.java @@ -20,13 +20,16 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; + import javax.json.bind.annotation.JsonbProperty; + import org.eclipse.microprofile.graphql.DateFormat; import org.eclipse.microprofile.graphql.Description; import org.eclipse.microprofile.graphql.GraphQLApi; import org.eclipse.microprofile.graphql.Id; import org.eclipse.microprofile.graphql.Mutation; import org.eclipse.microprofile.graphql.Name; +import org.eclipse.microprofile.graphql.NonNull; import org.eclipse.microprofile.graphql.NumberFormat; import org.eclipse.microprofile.graphql.Query; @@ -40,94 +43,94 @@ public class ScalarTestApi { @Query("testScalarsInPojo") public ScalarHolder getScalarHolder() { ScalarHolder sh = new ScalarHolder(); - + // Short short s = 123; sh.setShortObject(new Short(s)); sh.setFormattedShortObject(new Short(s)); sh.setShortPrimitive(s); - + // Integer int i = 123456789; sh.setIntObject(new Integer(i)); sh.setFormattedIntObject(new Integer(i)); sh.setIntPrimitive(i); - + // Long long l = 123456789L; sh.setLongObject(new Long(l)); sh.setFormattedLongObject(new Long(l)); sh.setLongPrimitive(l); sh.setFormattedLongPrimitive(l); - + // Float float f = 123456.789F; sh.setFloatObject(new Float(f)); sh.setFormattedFloatObject(new Float(f)); sh.setFloatPrimitive(f); - + // Double double d = 123456.789; sh.setDoubleObject(new Double(d)); sh.setFormattedDoubleObject(new Double(d)); sh.setDoublePrimitive(d); - + // Byte byte b = 123; sh.setByteObject(new Byte("123")); sh.setFormattedByteObject(new Byte("123")); sh.setBytePrimitive(b); - + // BigInteger sh.setBigIntegerObject(BigInteger.valueOf(123456789)); sh.setFormattedBigIntegerObject(BigInteger.valueOf(123456789)); - + // BigDecimal sh.setBigDecimalObject(BigDecimal.valueOf(123456.789)); sh.setFormattedBigDecimalObject(BigDecimal.valueOf(123456.789)); - + // Boolean sh.setBooleanObject(Boolean.valueOf(false)); sh.setBooleanPrimitive(false); - + // Character char c = "c".charAt(0); sh.setCharObject(new Character(c)); sh.setCharPrimitive(c); - + // String sh.setStringObject("123456789"); sh.setCharArray("123456789".toCharArray()); - + // LocalDate LocalDate localDate = LocalDate.parse("2019-10-23"); sh.setDateObject(localDate); sh.setAnotherDateObject(localDate); sh.setFormattedDateObject(localDate); - + // LocalTime LocalTime localTime = LocalTime.parse("11:46:34.263"); sh.setTimeObject(localTime); sh.setAnotherTimeObject(localTime); sh.setFormattedTimeObject(localTime); - + // LocalDateTime LocalDateTime localDateTime = LocalDateTime.parse("2019-10-23T11:46:34.263"); sh.setDateTimeObject(localDateTime); sh.setAnotherDateTimeObject(localDateTime); sh.setFormattedDateTimeObject(localDateTime); - + // ID sh.setId("123456789"); - + return sh; } - + @Mutation public ScalarHolder setScalarHolder(ScalarHolder scalarHolder) { return scalarHolder; } - + @Query public short getShortPrimitive(){ return getScalarHolder().getShortPrimitive(); @@ -142,7 +145,7 @@ public Short getShortObject(){ public int intPrimitive(){ return getScalarHolder().getIntPrimitive(); } - + @Query @Name("testIntObject") public Integer intObject(){ @@ -154,7 +157,7 @@ public Integer intObject(){ public long longPrimitive(){ return getScalarHolder().getLongPrimitive(); } - + @Query @Name("testLongObject") public Long longObject(){ @@ -166,7 +169,7 @@ public Long longObject(){ public float floatPrimitive(){ return getScalarHolder().getFloatPrimitive(); } - + @Query @Name("testFloatObject") public Float floatObject(){ @@ -178,7 +181,7 @@ public Float floatObject(){ public double doublePrimitive(){ return getScalarHolder().getDoublePrimitive(); } - + @Query @Name("testDoubleObject") public Double doubleObject(){ @@ -199,7 +202,7 @@ public Boolean isBooleanObject(){ public char charPrimitive(){ return getScalarHolder().getCharPrimitive(); } - + @Query @Name("testCharObject") public Character charObject(){ @@ -233,7 +236,7 @@ public Byte byteObject(){ public BigInteger bigIntegerObject(){ return getScalarHolder().getBigIntegerObject(); } - + @Query @Name("testBigDecimalObject") public BigDecimal bigDecimalObject(){ @@ -245,13 +248,13 @@ public BigDecimal bigDecimalObject(){ public LocalDate dateObject(){ return getScalarHolder().getDateObject(); } - + @Query @Name("testTimeObject") public LocalTime timeObject(){ return getScalarHolder().getTimeObject(); } - + @Query @JsonbProperty("testDateTimeObject") public LocalDateTime dateTimeObject(){ @@ -262,35 +265,59 @@ public LocalDateTime dateTimeObject(){ @Name("testId") public String id(){ return getScalarHolder().getId(); - } + } @Query public BasicInterface basicMessageEcho(@Name("input") BasicInput input) { return new BasicType(input.getMessage()); } - + @Query public String getaway(){ return "Just testing a name that starts with get but is not a getter"; } - + @Mutation public String settlement(){ return "Just testing a name that starts with set but is not a setter"; } - + + @Query + public String testNonNullParameter(@Name("param") @NonNull String param) { + return param; + } + @Query @Description("Testing transformed date as a response") - @DateFormat(value = "dd MMM yyyy") + @DateFormat(value = "dd MMM yyyy", locale = "en-GB") public LocalDate transformedDate(){ String date = "2016-08-16"; return LocalDate.parse(date); } - + @Mutation @Description("Testing transformed number as a response") @NumberFormat(value = "number #", locale = "en-GB") public Integer transformedNumber(Integer input){ return input; } -} \ No newline at end of file + + @Mutation + public Person addPerson(Person person) { + return person; + } + + @Mutation + public JsonbPerson addJsonbPerson(JsonbPerson person) { + return person; + } + + @Query + public BasicUnion basicUnionSelection(@Name("name") String name, @Name("count") Integer count) { + if (name != null) { + return new UnionMember(name); + } + return new AnotherUnionMember(count == null ? 0 : count); + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceTestApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceTestApi.java new file mode 100644 index 00000000..e8e6dbcf --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceTestApi.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +import org.eclipse.microprofile.graphql.DateFormat; +import org.eclipse.microprofile.graphql.DefaultValue; +import org.eclipse.microprofile.graphql.GraphQLApi; +import org.eclipse.microprofile.graphql.Name; +import org.eclipse.microprofile.graphql.NonNull; +import org.eclipse.microprofile.graphql.Query; +import org.eclipse.microprofile.graphql.Source; + +/** + * {@code @Source} testing. + */ +@GraphQLApi +public class SourceTestApi { + + @Query + public SourceType getSource() { + return new SourceType(); + } + + public String stringInput(@Source SourceType source, String input) { + return "Input was: " + input; + } + + public String nonNullStringInput(@Source SourceType source, @NonNull String input) { + return "Input was: " + input; + } + + public String namedStringInput(@Source SourceType source, @Name("in") String input) { + return "Input was: " + input; + } + + public String defaultStringInput(@Source SourceType source, @DefaultValue("Default value") String input) { + return "Input was: " + input; + } + + public String dateInput(@Source SourceType source, @DateFormat(value = "yyyy-MM-dd") LocalDate input) { + return "Input was: " + (input != null ? input.format(DateTimeFormatter.ISO_DATE) : null); + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceType.java new file mode 100644 index 00000000..09556360 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SourceType.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +/** + * Just used as {@code @Source}-object. + */ +public class SourceType { +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubType.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubType.java new file mode 100644 index 00000000..3824e798 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubType.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +/** + * To Test the generation of a Type with supertypes. + */ +public class SubType extends ParentType { + + private String subTypeField; + + public String getSubTypeField() { + return subTypeField; + } + + public void setSubTypeField(final String subTypeField) { + this.subTypeField = subTypeField; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubTypeTestApi.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubTypeTestApi.java new file mode 100644 index 00000000..80ccacd2 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/SubTypeTestApi.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +import org.eclipse.microprofile.graphql.GraphQLApi; +import org.eclipse.microprofile.graphql.Mutation; +import org.eclipse.microprofile.graphql.Query; + +@GraphQLApi +public class SubTypeTestApi { + + @Query + public SubType subType() { + final SubType subType = new SubType(); + subType.setSubTypeField("subTypeField"); + subType.setParentTypeField("parentTypeField"); + subType.setGrandParentTypeField("grandParentTypeField"); + return subType; + } + + @Mutation + public SubType subType(SubType subType) { + return subType; + } + +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/UnionMember.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/UnionMember.java new file mode 100644 index 00000000..360416af --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/basic/api/UnionMember.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.basic.api; + +/** + * To test the generation of a type, even if it's not used (directly) as a return type. + */ +public class UnionMember implements BasicUnion { + + private String name; + + public UnionMember() { + } + + public UnionMember(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java similarity index 93% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java index 65de2726..435eea73 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/CsvIOException.java @@ -18,7 +18,8 @@ import java.io.IOException; /** - * Extending a IOException to test transitive blacklist + * Extending a IOException to test transitive hideErrorMessage list + * * @author Phillip Kruger (phillip.kruger@redhat.com) */ public class CsvIOException extends IOException { diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java similarity index 95% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java index 8d1a0bfb..8db6932b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/FlawNotFoundException.java @@ -16,7 +16,8 @@ package org.eclipse.microprofile.graphql.tck.apps.superhero.api; /** - * To test transitive white list exceptions + * To test transitive showErrorMessage list exceptions + * * @author Phillip Kruger (phillip.kruger@redhat.com) */ public class FlawNotFoundException extends WeaknessNotFoundException { diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java similarity index 98% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java index 77f381d3..c9571442 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/HeroFinder.java @@ -98,31 +98,31 @@ public SuperHero superHero(@Name("name") @Description("Super hero name, not real return Optional.ofNullable(heroDB.getHero(name)).orElseThrow(() -> new UnknownHeroException(name)); } - @Query @Description("Testing the blacklist of Checked Exceptions") + @Query @Description("Testing the hideErrorMessage list of Checked Exceptions") public SuperHero exportToFile(@Name("name") @Description("Super hero name, not real name") String name) throws IOException { LOG.log(Level.INFO, "exportToFile invoked [{0}]", name); throw new IOException("No you can not do this."); } - @Query @Description("Testing the blacklist of transitive Checked Exceptions") + @Query @Description("Testing the hideErrorMessage list of transitive Checked Exceptions") public SuperHero exportToCSVFile(@Name("name") @Description("Super hero name, not real name") String name) throws CsvIOException { LOG.log(Level.INFO, "exportToCSVFile invoked [{0}]", name); throw new CsvIOException("No you can not do this."); } - @Query @Description("Testing the default blacklist for Runtime Exceptions") + @Query @Description("Testing the default hideErrorMessage list for Runtime Exceptions") public SuperHero villian(@Name("name") @Description("Super hero name, not real name") String name) { LOG.log(Level.INFO, "villian invoked [{0}]", name); throw new RuntimeException("SuperHero can not be a villian"); } - @Query @Description("Testing the whitelist for Runtime Exceptions") + @Query @Description("Testing the showErrorMessage list for Runtime Exceptions") public SuperHero weakness(@Name("name") @Description("Super hero name, not real name") String name) { LOG.log(Level.INFO, "weakness invoked [{0}]", name); throw new WeaknessNotFoundException("Superhero has no weakness"); } - @Query @Description("Testing the whitelist for transitive Runtime Exceptions") + @Query @Description("Testing the showErrorMessage list for transitive Runtime Exceptions") public SuperHero findFlaw(@Name("name") @Description("Super hero name, not real name") String name) { LOG.log(Level.INFO, "findFlaw invoked [{0}]", name); throw new FlawNotFoundException("Superhero has no flaw"); diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/SuperHeroLookupException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/SuperHeroLookupException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/SuperHeroLookupException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/SuperHeroLookupException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/WeaknessNotFoundException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/WeaknessNotFoundException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/WeaknessNotFoundException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/api/WeaknessNotFoundException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSidekickException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSidekickException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSidekickException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSidekickException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSuperHeroException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSuperHeroException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSuperHeroException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/DuplicateSuperHeroException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java similarity index 97% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java index 4162dabb..1d6aa4f3 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroDatabase.java @@ -162,9 +162,10 @@ private static String getInitalJson() { "\"realName\":\"Tony Stark\"," + "\"primaryLocation\":\"Los Angeles, CA\"," + "\"superPowers\":[\"wealth\",\"engineering\"]," + + "\"powerSource\":{\"netWorth\":12400000000.00," + "\"teamAffiliations\":[{\"name\":\"Avengers\"}]," + "\"equipment\":[{\"id\": 1001, \"name\": \"Iron Man Suit\", \"powerLevel\": 18, " + - "\"height\": 1.8, \"weight\": 120.7, \"supernatural\": false, \"dateCreated\": \"12 February 1967 at 11:45 in Africa/Johannesburg\"," + + "\"height\": 1.8, \"weight\": 120.7, \"supernatural\": false, \"dateCreated\": \"12 February 1967 at 11:45 in Africa/Johannesburg\"," + "\"dateLastUsed\": \"30 Jan 2020 at 17:55 in zone +0200\" }]," + "\"colorOfCostume\":\"Red\"," + "\"idNumber\":\"ID-12345678\"," + @@ -177,6 +178,7 @@ private static String getInitalJson() { "\"realName\":\"Peter Parker\"," + "\"primaryLocation\":\"New York, NY\"," + "\"superPowers\":[\"Spidey Sense\",\"Wall-Crawling\",\"Super Strength\",\"Web-shooting\"]," + + "\"powerSource\":{\"dateOfEvent\":\"06/18/2016\",\"medicalNotes\":\"Bit by a radioactive spider\"}," + "\"teamAffiliations\":[{\"name\":\"Avengers\"}]," + "\"colorOfCostume\":\"Red\"," + "\"idNumber\":\"ID-78904321\"," + diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroLocator.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroLocator.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroLocator.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/HeroLocator.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/SidekickDatabase.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/SidekickDatabase.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/SidekickDatabase.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/SidekickDatabase.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownHeroException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownHeroException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownHeroException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownHeroException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownSidekickException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownSidekickException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownSidekickException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownSidekickException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownTeamException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownTeamException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownTeamException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/db/UnknownTeamException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Character.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Character.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Character.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Character.java diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/ExtremeWealth.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/ExtremeWealth.java new file mode 100644 index 00000000..45aaadf3 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/ExtremeWealth.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.superhero.model; + +import org.eclipse.microprofile.graphql.Description; +import org.eclipse.microprofile.graphql.NonNull; + +@Description("Extreme amounts of wealth allowing someone to behave like a hero") +public class ExtremeWealth implements PowerSource { + + @NonNull + @Description("The net worth granting this character powers") + private Float netWorth; + + public Float getNetWorth() { + return netWorth; + } + + public void setNetWorth(Float netWorth) { + this.netWorth = netWorth; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/GeneticMutation.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/GeneticMutation.java new file mode 100644 index 00000000..d94fbb43 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/GeneticMutation.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.superhero.model; + +import java.time.LocalDate; +import javax.json.bind.annotation.JsonbDateFormat; +import org.eclipse.microprofile.graphql.Description; +import org.eclipse.microprofile.graphql.NonNull; + +@Description("Something that modifies the DNA of a character to give them powers") +public class GeneticMutation { + + @NonNull + @Description("Was this mutation present at birth") + private boolean isPresentAtBirth = false; + + @Description("The date of the event changing the characters DNA") + @JsonbDateFormat("MM/dd/yyyy") + private LocalDate dateOfMutation; + + public LocalDate getDateOfMutation() { + return dateOfMutation; + } + + public boolean getIsPresentAtBirth() { + return isPresentAtBirth; + } + + public void setDateOfMutation(LocalDate dateOfMutation) { + this.dateOfMutation = dateOfMutation; + } + + public void setIsPresentAtBirth(boolean isPresentAtBirth) { + this.isPresentAtBirth = isPresentAtBirth; + } +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Item.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Item.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Item.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Item.java diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Magic.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Magic.java new file mode 100644 index 00000000..d4fdce71 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Magic.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.superhero.model; + +import org.eclipse.microprofile.graphql.Description; +import org.eclipse.microprofile.graphql.NonNull; + +@Description("A magic source that provides a super hero with powers") +public class Magic implements PowerSource { + + private boolean canBeLearned = false; + + @NonNull + @Description("Can this magic be learned, or must it be given or obtained innately") + public boolean canBeLearned() { + return canBeLearned; + } + + public void setCanBeLearned(boolean canBeLearned) { + this.canBeLearned = canBeLearned; + } +} diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/PowerSource.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/PowerSource.java new file mode 100644 index 00000000..872ef3e5 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/PowerSource.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.apps.superhero.model; + +import org.eclipse.microprofile.graphql.Description; +import org.eclipse.microprofile.graphql.Union; + +@Union +@Description("Anything that created or provides a super hero's power") +public interface PowerSource { + +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Sidekick.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Sidekick.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Sidekick.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Sidekick.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java similarity index 89% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java index bc35542b..33284c20 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/SuperHero.java @@ -39,6 +39,7 @@ public class SuperHero implements Character { private List teamAffiliations; private List<@NonNull String> superPowers; + private PowerSource powerSource; private String primaryLocation; @Description("Super hero name/nickname") private String name; @@ -64,39 +65,41 @@ public class SuperHero implements Character { @JsonbNumberFormat(value = "¤ ###,###.##",locale = "en-US") private Double bankBalance; - + @JsonbNumberFormat(value = "¤ 000.00",locale = "en-US") private BigDecimal netWorth; - + @JsonbNumberFormat(value = "###.## 'ml'", locale = "en-GB") private Float favouriteDrinkSize; - + private List lastKnownCoordinates; - + private List> track; private Set beenThere; - + private ShirtSize sizeOfTShirt; private List importantDates; - + private List kidsAges; - + @DateFormat("dd MMMM yyyy") private LocalDate birthday; - + public SuperHero(){ } - - public SuperHero(List teamAffiliations, - List superPowers, - String primaryLocation, - String name, + + public SuperHero(List teamAffiliations, + List superPowers, + PowerSource powerSource, + String primaryLocation, + String name, String realName) { this.teamAffiliations = teamAffiliations; this.superPowers = superPowers; + this.powerSource = powerSource; this.primaryLocation = primaryLocation; this.name = name; this.realName = realName; @@ -110,6 +113,10 @@ public List getSuperPowers() { return superPowers; } + public PowerSource getPowerSource() { + return powerSource; + } + @Description("Location where you are most likely to find this hero") public String getPrimaryLocation() { return primaryLocation; @@ -261,7 +268,7 @@ public Set getBeenThere() { public void setBeenThere(Set beenThere) { this.beenThere = beenThere; } - + public List<@DateFormat("dd/MM") LocalDate> getImportantDates() { return importantDates; } @@ -287,8 +294,8 @@ public LocalDate getBirthday() { @Name("dateOfBirth") public void setBirthday(LocalDate birthday) { this.birthday = birthday; - } - + } + public enum ShirtSize { S, M, @@ -300,17 +307,18 @@ public enum ShirtSize { @Override public String toString() { - return "SuperHero{" - + ", superPowers=" + superPowers - + ", primaryLocation=" + primaryLocation - + ", name=" + name - + ", realName=" + realName - + ", dateOfLastCheckin=" + dateOfLastCheckin - + ", patrolStartTime=" + patrolStartTime - + ", timeOfLastBattle=" + timeOfLastBattle - + ", costumeColor=" + costumeColor - + ", namesOfKnownEnemies=" + namesOfKnownEnemies - + ", idNumber=" + idNumber + return "SuperHero{" + + ", superPowers=" + superPowers + + ", powerSource=" + powerSource + + ", primaryLocation=" + primaryLocation + + ", name=" + name + + ", realName=" + realName + + ", dateOfLastCheckin=" + dateOfLastCheckin + + ", patrolStartTime=" + patrolStartTime + + ", timeOfLastBattle=" + timeOfLastBattle + + ", costumeColor=" + costumeColor + + ", namesOfKnownEnemies=" + namesOfKnownEnemies + + ", idNumber=" + idNumber + ", sizeOfTShirt=" + sizeOfTShirt + '}'; } } diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Team.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Team.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Team.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Team.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Token.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Token.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Token.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/Token.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/UnknownCharacterException.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/UnknownCharacterException.java similarity index 100% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/UnknownCharacterException.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/apps/superhero/model/UnknownCharacterException.java diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java similarity index 89% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java index 5d7215d3..ce620399 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DeployableUnit.java @@ -58,8 +58,9 @@ private static String getPropertyAsString() throws IOException { private static final Properties PROPERTIES = new Properties(); static { PROPERTIES.put(ConfigKey.DEFAULT_ERROR_MESSAGE, "Unexpected failure in the system. Jarvis is working to fix it."); - PROPERTIES.put(ConfigKey.EXCEPTION_BLACK_LIST, "java.io.IOException,java.util.concurrent.TimeoutException"); - PROPERTIES.put(ConfigKey.EXCEPTION_WHITE_LIST, "org.eclipse.microprofile.graphql.tck.apps.superhero.api.WeaknessNotFoundException"); + PROPERTIES.put(ConfigKey.EXCEPTION_HIDE_ERROR_MESSAGE_LIST, "java.io.IOException,java.util.concurrent.TimeoutException"); + PROPERTIES.put(ConfigKey.EXCEPTION_SHOW_ERROR_MESSAGE_LIST, + "org.eclipse.microprofile.graphql.tck.apps.superhero.api.WeaknessNotFoundException"); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java similarity index 95% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java index 3902b04d..48c237fa 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/DynamicPaths.java @@ -43,7 +43,7 @@ public static DirectoryStream getDataForImplementation() throws IOExceptio public static DirectoryStream getDataForSpecification() throws IOException, URISyntaxException { URL jar = DynamicPaths.class.getProtectionDomain().getCodeSource().getLocation(); Path jarFile = Paths.get(jar.toURI()); - FileSystem fs = FileSystems.newFileSystem(jarFile, null); + FileSystem fs = FileSystems.newFileSystem(jarFile, (ClassLoader)null); return Files.newDirectoryStream(fs.getPath(SPEC)); } } diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java similarity index 56% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java index 5634e3f1..98a35ab7 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/ExecutionDynamicTest.java @@ -26,17 +26,24 @@ import java.io.OutputStream; import java.io.Reader; import java.io.StringReader; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; +import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URI; +import java.net.URISyntaxException; +import java.net.URLEncoder; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.json.Json; import javax.json.JsonArray; import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; import javax.json.JsonPatchBuilder; import javax.json.JsonReader; import org.jboss.shrinkwrap.api.Archive; @@ -52,6 +59,8 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; +import static java.nio.charset.StandardCharsets.UTF_8; + /** * This test runs all test defined in the implementation 'src/test/resources' folder * and all test included here in the archive's /tests folder @@ -62,15 +71,17 @@ public class ExecutionDynamicTest extends Arquillian { private static final String PATH = "graphql"; // Default. TODO: Test when configured - private static final String UTF8 = "utf-8"; private static final String MEDIATYPE_JSON = "application/json"; private static final String HEADER_CONTENT_TYPE = "Content-Type"; private static final String HEADER_ACCEPT = "Accept"; private static final String QUERY = "query"; private static final String VARIABLES = "variables"; + private static final String EQUALS = "="; + private static final String AND = "&"; private static final int CONNECT_TIMEOUT = Integer.getInteger("mp.tck.connect.timeout", 5000); private static final int READ_TIMEOUT = Integer.getInteger("mp.tck.read.timeout", 5000); + private HttpMethod currentHttpMethod = null; private TestData currentTestData = null; private String currentOutput = null; @@ -84,66 +95,118 @@ public static Archive getDeployment() throws Exception { @RunAsClient @Test(dataProvider="specification", dataProviderClass = GraphQLTestDataProvider.class) - public void testSpecification(TestData testData){ - runTest(testData); + public void testSpecificationPOST(TestData testData){ + runTest(testData, HttpMethod.POST); } @RunAsClient @Test(dataProvider="implementation", dataProviderClass = GraphQLTestDataProvider.class) - public void testImplementationSpecific(TestData testData) throws IOException { - runTest(testData); + public void testImplementationSpecificPOST(TestData testData) { + runTest(testData, HttpMethod.POST); } - private void runTest(TestData testData){ + @RunAsClient + @Test(dataProvider="specification", dataProviderClass = GraphQLTestDataProvider.class) + public void testSpecificationGET(TestData testData){ + runTest(testData, HttpMethod.GET); + } + + @RunAsClient + @Test(dataProvider="implementation", dataProviderClass = GraphQLTestDataProvider.class) + public void testImplementationSpecificGET(TestData testData) { + runTest(testData,HttpMethod.GET); + } + + private void runTest(TestData testData, HttpMethod httpMethod){ if(testData!=null && isValidInput(testData.getInput())) { - LOG.info("Running test [" + testData.getName() + "]"); + LOG.info("Running test [" + httpMethod + " :: " + testData.getName() + "]"); this.currentTestData = testData; + this.currentHttpMethod = httpMethod; Map httpHeaders = new HashMap<>(); if(testData.getHttpHeaders()!=null && !testData.getHttpHeaders().isEmpty()){ - for(Map.Entry header:httpHeaders.entrySet()){ - httpHeaders.put(header.getKey(), header.getValue()); + for(String headerName:testData.getHttpHeaders().stringPropertyNames()){ + String value = testData.getHttpHeaders().getProperty(headerName); + LOG.info("setting header " + headerName + " to " + value); + httpHeaders.put(headerName, value); } } - // Prepare if needed - if(isValidInput(testData.getPrepare())){ - postHTTPRequest(testData.getPrepare(),testData.getVariables(),httpHeaders); - } + // loop through each of the input content and pass if at least one passes + boolean success = false; + ArrayList listExceptions = new ArrayList<>(); + for (String input : testData.getInput()) { + try { + // Prepare if needed + if(isValidInput(testData.getPrepare())){ + executeHttpRequest(HttpMethod.POST, testData.getPrepare(),testData.getVariables(),httpHeaders); + } - // Run the actual test and get the response - HttpResponse httpResponse = postHTTPRequest(testData.getInput(),testData.getVariables(),httpHeaders); - if(httpResponse.isSuccessful()){ - this.currentOutput = httpResponse.getContent(); - - // Validate the output structure - validateResponseStructure(); - - // Cleanup if needed - if(isValidInput(testData.getCleanup())){ - postHTTPRequest(testData.getCleanup(),testData.getVariables(),httpHeaders); - } - - // Compare to expected output - try{ - JSONAssert.assertEquals(testData.getFailMessage(),testData.getOutput(), this.currentOutput, testData.beStrict()); - } catch (JSONException ex) { - clearGlobals(); - Assert.fail(ex.getMessage()); + assertTest(input, testData, httpHeaders, httpMethod); + success = true; + break; + } catch (AssertionError ae) { + // don't raise assertion failure as this is checked below + listExceptions.add(ae); } - } else { - Assert.assertEquals(httpResponse.status, testData.getExpectedHttpStatusCode(),httpResponse.getContent()); } - + if (!success){ + Assert.fail(getErrorMessages(listExceptions)); + } }else{ clearGlobals(); LOG.warning("Could not find any tests to run..."); } } + private void assertTest(String input, TestData testData, Map httpHeaders, HttpMethod httpMethod){ + // We can only do Queries over GET + if(testData.isMutation()){ + httpMethod = HttpMethod.POST; + } + + // Run the actual test and get the response + HttpResponse httpResponse = executeHttpRequest(httpMethod, input,testData.getVariables(),httpHeaders); + if(httpResponse.isSuccessful()){ + this.currentOutput = httpResponse.getContent(); + + // Validate the output structure + validateResponseStructure(); + + // Cleanup if needed + if(isValidInput(testData.getCleanup())){ + executeHttpRequest(HttpMethod.POST, testData.getCleanup(),testData.getVariables(),httpHeaders); + } + + boolean success = false; + ArrayList listExceptions = new ArrayList<>(); + + // Compare to expected output and pass if at least one of the output files match + for (String output : testData.getOutput()) { + try { + JSONAssert.assertEquals(testData.getFailMessage(), output, this.currentOutput, testData.beStrict()); + success = true; + break; + } catch (AssertionError ex) { + // don't raise assertion failure as this is checked below + listExceptions.add(ex); + } catch (JSONException je) { + // indicates some sort of JSON formatting exception + Assert.fail(je.getMessage()); + } + } + if (!success) { + Assert.fail(getErrorMessages(listExceptions)); + } + } else { + Assert.assertEquals(httpResponse.status, testData.getExpectedHttpStatusCode(),httpResponse.getContent()); + } + } + @AfterMethod public void tearDown(ITestResult result) { if (result!=null && result.getStatus() == ITestResult.FAILURE) { - PrintUtil.toDisk(this.currentTestData, + PrintUtil.toDisk(this.currentHttpMethod.toString(), + this.currentTestData, this.currentOutput, result.getThrowable()); } @@ -200,21 +263,41 @@ private boolean isValidInput(String input){ return input!=null && !input.isEmpty(); } - private HttpResponse postHTTPRequest(String graphQL, JsonObject variables, Map httpHeaders){ + private boolean isValidInput(Set setInput){ + for (String input : setInput) { + if (!isValidInput(input)) { + return false; + } + } + return true; + } + + private String getErrorMessages(ArrayList listExceptions){ + StringBuilder sb = new StringBuilder(); + listExceptions.forEach(ex -> sb.append(ex.getMessage()).append('\n')); + return sb.toString(); + } + + + private HttpResponse executeHttpRequest(HttpMethod httpMethod, + String graphQL, + JsonObject variables, + Map httpHeaders){ try { - URL url = new URL(this.uri + PATH); + + URL url = getURL(httpMethod,graphQL, variables); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("POST"); // TODO: Also test with GET and query string ? Are we allowing it ? - + connection.setRequestMethod(httpMethod.toString()); setTimeouts(connection); addHeaders(connection,httpHeaders); - connection.setDoOutput(true); - JsonObject body = createRequestBody(graphQL, variables); - - postRequest(connection,body); - + if(httpMethod.POST.equals(httpMethod)){ + JsonObject body = createRequestBody(graphQL, variables); + postRequest(connection,body); + } + int status = connection.getResponseCode(); if(status == 200) { @@ -224,15 +307,15 @@ private HttpResponse postHTTPRequest(String graphQL, JsonObject variables, Map httpHeaders){ // Default headers connection.setRequestProperty(HEADER_CONTENT_TYPE, MEDIATYPE_JSON); // default header. @@ -252,17 +335,38 @@ private void setTimeouts(HttpURLConnection connection){ connection.setReadTimeout(READ_TIMEOUT); } + private URL getURL(HttpMethod httpMethod, + String graphQL, + JsonObject variables) throws MalformedURLException, URISyntaxException, UnsupportedEncodingException{ + URL url = new URL(this.uri + PATH); + + if(HttpMethod.GET.equals(httpMethod)){ + String query = QUERY + EQUALS + URLEncoder.encode(graphQL,"UTF8"); + if(variables!=null && !variables.isEmpty()) { + query = query + AND + VARIABLES + EQUALS + URLEncoder.encode(variables.toString(),"UTF8"); + } + + URI uri = new URI(url.getProtocol(), null, url.getHost(), url.getPort(), url.getPath(), query, null); + url = uri.toURL(); + } + + return url; + } + private JsonObject createRequestBody(String graphQL, JsonObject variables){ - // Create the request - if(variables==null || variables.isEmpty()) { - variables = Json.createObjectBuilder().build(); + JsonObjectBuilder builder = Json.createObjectBuilder(); + if(graphQL!=null && !graphQL.isEmpty()) { + builder.add(QUERY, graphQL); } - return Json.createObjectBuilder().add(QUERY, graphQL).add(VARIABLES, variables).build(); + if(variables!=null && !variables.isEmpty()) { + builder.add(VARIABLES, variables); + } + return builder.build(); } private void postRequest(HttpURLConnection connection,JsonObject body) throws IOException{ try(OutputStream os = connection.getOutputStream()) { - byte[] input = body.toString().getBytes(UTF8); + byte[] input = body.toString().getBytes(UTF_8); os.write(input, 0, input.length); } } @@ -271,7 +375,7 @@ private String getResponse(HttpURLConnection connection) throws IOException{ int status = connection.getResponseCode(); if(status == 200) { // Read the response - try(BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), UTF8))) { + try(BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { @@ -308,4 +412,8 @@ public boolean isSuccessful(){ return status==200; } } + + enum HttpMethod{ + GET,POST + } } diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java similarity index 82% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java index 400d9fc8..1a9eba13 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/SchemaDynamicValidityTest.java @@ -29,7 +29,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import org.eclipse.microprofile.graphql.tck.dynamic.schema.SchemaTestDataProvider; @@ -84,24 +83,39 @@ public void testPartsOfSchema(TestData input) { snippet = getSchemaSnippet(schema, input.getSnippetSearchTerm()); } - Assert.assertTrue(matchAtLeastOneOfTheSnippets(input,snippet), "[" + input.getHeader() + "] " + input.getErrorMessage()); + Assert.assertTrue(matchCondition(input,snippet), "[" + input.getHeader() + "] " + input.getErrorMessage()); } - private boolean matchAtLeastOneOfTheSnippets(TestData input,String snippet){ - List containsAnyOfString = input.getContainsAnyOfString(); - for(String contains:containsAnyOfString){ - if(contains.startsWith("!")){ - contains = contains.substring(1); - if(!snippet.contains(contains)){ - return true; + private boolean matchCondition(TestData input,String snippet){ + + if(input.hasCondition()){ + if(input.getCondition().equals(TestData.Condition.OR)){ + for(String contains:input.getContainsString()){ + if(matchSingle(contains,snippet)){ + return true; + } } - }else{ - if(snippet.contains(contains)){ - return true; + return false; + } else if (input.getCondition().equals(TestData.Condition.AND)){ + for(String contains:input.getContainsString()){ + if(!matchSingle(contains,snippet)){ + return false; + } } + return true; } + } + + return matchSingle(input.getContainsString().get(0), snippet); + } + + private boolean matchSingle(String single,String snippet){ + if(single.startsWith("!")){ + single = single.substring(1); + return !snippet.contains(single); + }else{ + return snippet.contains(single); } - return false; } private void saveSchemaFile(){ @@ -124,7 +138,7 @@ private String getSchemaContent() throws MalformedURLException, ProtocolExceptio connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); - connection.setRequestProperty("Content-Type", "plain/text"); + connection.setRequestProperty("Content-Type", "text/plain"); // Check the response code int responseCode = connection.getResponseCode(); diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java similarity index 68% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java index 8a9571f8..fed03862 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/GraphQLTestDataProvider.java @@ -59,7 +59,10 @@ private GraphQLTestDataProvider(){ @DataProvider(name="specification") public static Object[][] getSpecificationTestData(){ - return getTestData(DataFrom.specification); + if(!disableSpecificationTests()){ + return getTestData(DataFrom.specification); + } + return toObjectArray(Collections.EMPTY_LIST); } @DataProvider(name="implementation") @@ -92,7 +95,7 @@ private static List toListOfTestData(Set testFolders){ if(!testFolder.getFileName().toString().startsWith("META-INF")){// Ignore META-INF try { TestData testData = toTestData(testFolder); - if(!testData.shouldIgnore()){ + if(!testData.shouldIgnore() && testData.getInput().size() > 0){ testDataList.add(testData); } } catch (IOException ioe) { @@ -136,54 +139,56 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) if(!Files.isDirectory(file)){ String filename = file.getFileName().toString(); - switch (filename) { - case "input.graphql": - { - String content = getFileContent(file); - testData.setInput(content); - break; - } - case "httpHeader.properties": - { - Properties properties = new Properties(); - properties.load(Files.newInputStream(file)); - testData.setHttpHeaders(properties); - break; - } - case "output.json": - { - String content = getFileContent(file); - testData.setOutput(content); - break; - } - case "variables.json": - { - String content = getFileContent(file); - testData.setVariables(toJsonObject(content)); - break; - } - case "test.properties": - { - Properties properties = new Properties(); - properties.load(Files.newInputStream(file)); - testData.setProperties(properties); + if (filename.matches("output.*\\.json")){ + // Special case to cater for multiple output*.json files where the + // test will pass on the first file content that matches. + // If no content matches, then the test will fail. + String content = getFileContent(file); + testData.addOutput(content); + } else if (filename.matches("input.*\\.graphql")){ + // Special case to cater for multiple input*.graphql files where the + // test will pass on the first file input content which is successful. + // If no content matches, then the test will fail. + String content = getFileContent(file); + testData.addInput(content); + } else { + switch (filename) { + case "httpHeader.properties": + { + Properties properties = new Properties(); + properties.load(Files.newInputStream(file)); + testData.setHttpHeaders(properties); + break; + } + case "variables.json": + { + String content = getFileContent(file); + testData.setVariables(toJsonObject(content)); + break; + } + case "test.properties": + { + Properties properties = new Properties(); + properties.load(Files.newInputStream(file)); + testData.setProperties(properties); + break; + } + case "cleanup.graphql": + { + String content = getFileContent(file); + testData.setCleanup(content); + break; + } + case "prepare.graphql": + { + String content = getFileContent(file); + testData.setPrepare(content); + break; + } + default: + LOG.log(Level.WARNING, "Ignoring unknown file {0}", filename); break; - } - case "cleanup.graphql": - { - String content = getFileContent(file); - testData.setCleanup(content); - break; - } - case "prepare.graphql": - { - String content = getFileContent(file); - testData.setPrepare(content); - break; - } - default: - LOG.log(Level.WARNING, "Ignoring unknown file {0}", filename); - break; + } } } return FileVisitResult.CONTINUE; @@ -236,4 +241,8 @@ private static JsonObject toJsonObject(String jsonString){ return jsonReader.readObject(); } } + + private static boolean disableSpecificationTests(){ + return Boolean.valueOf(System.getProperty("disableSpecificationTests", "false")); + } } diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java similarity index 65% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java index c41f593e..51ca8d8d 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/PrintUtil.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; -import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -36,6 +35,8 @@ import javax.json.JsonWriterFactory; import javax.json.stream.JsonGenerator; +import static java.nio.charset.StandardCharsets.UTF_8; + /** * Print the Test data to output * @author Phillip Kruger (phillip.kruger@redhat.com) @@ -46,18 +47,18 @@ public class PrintUtil { private PrintUtil(){ } - public static void toDisk(TestData testData, String output, Throwable throwable){ + public static void toDisk(String httpMethod, TestData testData, String output, Throwable throwable){ try{ - String log = toString(testData, output, throwable); - writeTestFile(testData.getName(),log); + String log = toString(httpMethod, testData, output, throwable); + writeTestFile(httpMethod + "_" + testData.getName(),log); } catch (IOException ex) { - LOG.log(Level.SEVERE, "Could not save data to target folder - {0}", ex.getMessage()); + LOG.log(Level.SEVERE, "Could not save " + httpMethod + " data to target folder " + testData.getName(), ex); } } - private static String toString(TestData testData,String output, Throwable throwable){ + private static String toString(String httpMethod, TestData testData, String output, Throwable throwable){ try(StringWriter sw = new StringWriter()){ - sw.write("============= " + testData.getName() + " ============="); + sw.write("============= " + httpMethod + " :: " + testData.getName() + " ============="); sw.write("\n\n"); if(throwable!=null){ sw.write("errorMessage = " + throwable.getMessage()); @@ -65,13 +66,24 @@ private static String toString(TestData testData,String output, Throwable throwa sw.write("errorMessage = "); } sw.write("\n\n"); - sw.write("given input = " + testData.getInput()); + if (testData.getInput().size() == 1) { + sw.write("given input = " + testData.getInput().iterator().next()); + } else { + sw.write("given multiple inputs = \n"); + testData.getInput().stream().forEach(i -> sw.write(i + "\n")); + } sw.write("\n\n"); sw.write("variables input = " + prettyJson(testData.getVariables())); sw.write("\n\n"); sw.write("http headers input = " + testData.getHttpHeaders()); sw.write("\n\n"); - sw.write("expected output = " + prettyJson(testData.getOutput())); + + if (testData.getOutput().size() == 1) { + sw.write("expected output = " + prettyJson(testData.getOutput().iterator().next())); + } else { + sw.write("expected output was either of the following = " + String.join("\nOR\n", testData.getOutput())); + } + sw.write("\n\n"); sw.write("received output = " + prettyJson(output)); sw.write("\n\n"); @@ -81,25 +93,33 @@ private static String toString(TestData testData,String output, Throwable throwa } } - private static void writeTestFile(String testName, String data) throws IOException{ + private static void writeTestFile(String fileName, String data) throws IOException{ if(data!=null && !data.isEmpty()){ - Path file = Paths.get("target" + FS + testName + ".log"); + Path file = Paths.get("target" + FS + fileName + ".log"); Path createFile = Files.createFile(file); - try(BufferedWriter writer = Files.newBufferedWriter(createFile, Charset.forName("UTF-8"))){ + try(BufferedWriter writer = Files.newBufferedWriter(createFile, UTF_8)){ writer.write(data); } } } - private static String prettyJson(String json) { - if(json!=null){ - JsonReader jr = Json.createReader(new StringReader(json)); + private static String prettyJson(String text) { + if (text == null) { + return null; + } + if(isJson(text)) { + JsonReader jr = Json.createReader(new StringReader(text)); JsonObject jobj = jr.readObject(); return prettyJson(jobj); + } else { + return text; } - return null; } - + + private static boolean isJson(String text) { + return text.startsWith("{") || text.startsWith("["); + } + private static String prettyJson(JsonObject jsonObject) { if(jsonObject!=null){ StringWriter sw = new StringWriter(); diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java similarity index 89% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java index ce71bc83..3c3b7e90 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/execution/TestData.java @@ -17,8 +17,10 @@ */ package org.eclipse.microprofile.graphql.tck.dynamic.execution; +import java.util.HashSet; import java.util.Objects; import java.util.Properties; +import java.util.Set; import javax.json.JsonObject; /** @@ -27,9 +29,9 @@ */ public class TestData { private String name; - private String input; + private Set input; private Properties httpHeaders; - private String output; + private Set output; private JsonObject variables; private String prepare; private String cleanup; @@ -41,12 +43,14 @@ public TestData(){ public TestData(String name){ this.name = name; + this.output = new HashSet<>(); + this.input = new HashSet<>(); } public TestData(String name, - String input, + Set input, Properties httpHeaders, - String output, + Set output, JsonObject variables, String prepare, String cleanup, @@ -62,11 +66,15 @@ public TestData(String name, this.properties = properties; } + public boolean isMutation(){ + return input.contains("mutation") || input.contains("Mutation"); + } + public String getName() { return name; } - public String getInput() { + public Set getInput() { return input; } @@ -74,10 +82,14 @@ public Properties getHttpHeaders() { return httpHeaders; } - public String getOutput() { + public Set getOutput() { return output; } + public void addOutput(String output) { + this.output.add(output); + } + public JsonObject getVariables() { return variables; } @@ -98,15 +110,19 @@ public void setName(String name) { this.name = name; } - public void setInput(String input) { + public void setInput(Set input) { this.input = input; } + public void addInput(String input) { + this.input.add(input); + } + public void setHttpHeaders(Properties httpHeaders) { this.httpHeaders = httpHeaders; } - public void setOutput(String output) { + public void setOutput(Set output) { this.output = output; } diff --git a/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParser.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParser.java new file mode 100644 index 00000000..bab0d063 --- /dev/null +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParser.java @@ -0,0 +1,151 @@ +/* + * Copyright 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.dynamic.schema; + +import java.io.IOException; +import java.io.Reader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/** + * Parses the csv-files used for schema validity tests. + * + * Uses {@code |} as separator and {@code ´} as escape character. + * + * @author Yannick Bröker (ybroeker@techfak.uni-bielefeld.de) + */ +public class CsvParser { + + private CsvParser() { + } + + public static List parse(Path testFile) throws IOException { + Reader reader = Files.newBufferedReader(testFile); + + try { + return parse(testFile.getFileName().toString(), reader); + } catch (RuntimeException e) { + throw new RuntimeException("Failed parsing '" + testFile + "'", e); + } + } + + public static List parse(String fileName, Reader reader) throws IOException { + List testData = new ArrayList<>(); + + String currentHeader = ""; + + int partIdx = 0; + String[] parts = new String[4]; + + boolean isHeader = false; + boolean escaped = false; + int last = '\n'; + + StringBuilder stringBuilder = new StringBuilder(); + for (int c = reader.read(); c != -1; c = reader.read()) { + if (c == ESCAPE) { + //start/end of escaping + escaped = !escaped; + if (last == ESCAPE) { + //double-escape + stringBuilder.appendCodePoint(ESCAPE); + last = -1; + continue; + } + } else if (c == HEADER && last == '\n' && !escaped) { + //start of header, can only happen on new line + isHeader = true; + } else { + if ((c == NEWLINE) && !escaped) { + String token = stringBuilder.toString(); + stringBuilder = new StringBuilder(); + //end of header or + if (isHeader) { + //end of header + currentHeader = token; + isHeader = false; + } else if (partIdx == 3) { + parts[partIdx] = token; + testData.add(createTestData(fileName, currentHeader, parts)); + partIdx = 0; + } + } else if (c == SEPARATOR && !escaped && !isHeader) { + parts[partIdx] = stringBuilder.toString(); + stringBuilder = new StringBuilder(); + partIdx++; + } else { + stringBuilder.appendCodePoint(c); + } + } + last = c; + } + + if (partIdx == 3) { + //clean up remaining + parts[partIdx] = stringBuilder.toString(); + testData.add(createTestData(fileName, currentHeader, parts)); + } + + return testData; + } + + private static TestData createTestData(String filename, String header, String[] parts) { + int count = Integer.parseInt(parts[0].trim()); + TestData testData = new TestData(); + testData.setName(filename); + testData.setHeader(header.trim()); + testData.setCount(count); + String snippet = parts[1].trim(); + if (snippet.isEmpty()) { + snippet = null; + } + testData.setSnippetSearchTerm(snippet); + + String containsString = parts[2].trim(); + if (containsString.contains(OR) && containsString.contains(AND)){ + throw new RuntimeException("Test string can not contain both 'OR' and 'AND'"); + } + if (containsString.contains(OR)) { + String[] containsStrings = containsString.split(OR); + for (String oneOf : containsStrings) { + testData.addContainsString(oneOf.trim()); + } + testData.setCondition(TestData.Condition.OR); + } else if (containsString.contains(AND)) { + String[] containsStrings = containsString.split(AND); + for (String oneOf : containsStrings) { + testData.addContainsString(oneOf.trim()); + } + testData.setCondition(TestData.Condition.AND); + } else { + testData.addContainsString(containsString); + } + testData.setErrorMessage("(" + count + ") - " + parts[3].trim()); + + return testData; + } + + private static final char ESCAPE = '´'; + private static final char HEADER = '#'; + private static final char SEPARATOR = '|'; + private static final char NEWLINE = '\n'; + private static final String OR = "'OR'"; + private static final String AND = "'AND'"; +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java similarity index 57% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java index 44478c5e..5f3120b1 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/SchemaTestDataProvider.java @@ -58,15 +58,21 @@ public static Object[][] getSnippetTestData(){ private static List getDataFiles() { List f = new ArrayList<>(); + + // Implementation specific tests try { f.addAll(toListOfPaths(DynamicPaths.getDataForImplementation())); } catch (IOException ex) { LOG.log(Level.INFO, "No implementation specific tests found [{0}]", ex.getMessage()); } - try { - f.addAll(toListOfPaths(DynamicPaths.getDataForSpecification())); - } catch (Exception ex) { - LOG.log(Level.WARNING, "No specification tests found [{0}]", ex.getMessage()); + + // Specification test + if(!disableSpecificationTests()){ + try { + f.addAll(toListOfPaths(DynamicPaths.getDataForSpecification())); + } catch (Exception ex) { + LOG.log(Level.WARNING, "No specification tests found [{0}]", ex.getMessage()); + } } return f; @@ -96,63 +102,12 @@ private static List toListOfTestData(List testFolders){ } private static List toTestData(Path testFile) throws IOException{ - List testDataList = new LinkedList<>(); - List content = Files.readAllLines(testFile); - String currentHeader = ""; - for(String line:content){ - if(validLine(line)){ - String[] parts = line.split(DELIMITER); - if(parts.length==4){ - TestData testData = createTestData(currentHeader,testFile.getFileName().toString(),parts); - testDataList.add(testData); - }else{ - LOG.log(Level.SEVERE, "Could not add test case {0} - {1}", - new Object[]{testFile.getFileName().toString(), "Does not contain 3 parts [" + parts.length +"]"}); - } - }else if (isHeader(line)){ - currentHeader = line.substring(line.indexOf(COMMENT)+1).trim(); - } - } - return testDataList; + return CsvParser.parse(testFile); } - private static TestData createTestData(String header, String filename,String[] parts){ - TestData testData = new TestData(); - testData.setCount(Integer.valueOf(parts[0])); - testData.setHeader(header); - testData.setName(filename); - String count = parts[0].trim(); - String snippet = parts[1].trim(); - if(snippet == null || snippet.isEmpty()){ - snippet = null; - } - testData.setSnippetSearchTerm(snippet); - - String containsString = parts[2].trim(); - if(containsString.contains(OR)){ - String[] containsStrings = containsString.split(OR); - for(String oneOf:containsStrings){ - testData.addContainsString(oneOf.trim()); - } - }else{ - testData.addContainsString(containsString); - } - testData.setErrorMessage("(" + count + ") - " + parts[3].trim()); - - return testData; - } - - private static boolean validLine(String line){ - return !line.isEmpty() && line.trim().contains(PIPE) && !isHeader(line); + private static boolean disableSpecificationTests(){ + return Boolean.valueOf(System.getProperty("disableSpecificationTests", "false")); } - - private static boolean isHeader(String line){ - return line.trim().startsWith(COMMENT); - } - - private static final String PIPE = "|"; - private static final String DELIMITER = "\\" + PIPE; - private static final String COMMENT = "#"; + private static final String FILE_TYPE = ".csv"; - private static final String OR = "'OR'"; -} \ No newline at end of file +} diff --git a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java similarity index 77% rename from tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java rename to server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java index 8ff66fbb..071faf1b 100644 --- a/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java +++ b/server/tck/src/main/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/TestData.java @@ -27,7 +27,8 @@ public class TestData { private String header; private String name; private String snippetSearchTerm; - private List containsAnyOfString = new ArrayList<>(); + private List containsString = new ArrayList<>(); + private Condition condition = null; private String errorMessage; public TestData() { @@ -65,16 +66,12 @@ public void setSnippetSearchTerm(String snippetSearchTerm) { this.snippetSearchTerm = snippetSearchTerm; } - public List getContainsAnyOfString() { - return containsAnyOfString; - } - - public void setContainsAnyOfString(List containsAnyOfString) { - this.containsAnyOfString = containsAnyOfString; + public List getContainsString() { + return containsString; } public void addContainsString(String containsString) { - this.containsAnyOfString.add(containsString); + this.containsString.add(containsString); } public String getErrorMessage() { @@ -85,4 +82,21 @@ public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } + public boolean hasCondition(){ + return this.condition!=null; + } + + public void setCondition(Condition condition){ + this.condition = condition; + } + + public Condition getCondition(){ + return this.condition; + } + + public enum Condition { + AND, + OR + } + } diff --git a/server/tck/src/main/licenses/Draft/LICENSE b/server/tck/src/main/licenses/Draft/LICENSE new file mode 100644 index 00000000..5c304d1a --- /dev/null +++ b/server/tck/src/main/licenses/Draft/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + 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. diff --git a/server/tck/src/main/licenses/Final/LICENSE b/server/tck/src/main/licenses/Final/LICENSE new file mode 100644 index 00000000..c858c0ad --- /dev/null +++ b/server/tck/src/main/licenses/Final/LICENSE @@ -0,0 +1,83 @@ +Eclipse Foundation Technology Compatibility Kit License - v 1.0 + +Copyright (c) 2018, Eclipse Foundation, Inc. and its licensors. + +Redistribution and use in binary form is permitted provided that the +following conditions are met: + +1. Use of the Technology Compatibility Kit accompanying this license + (the "TCK") and its documentation is permitted solely for the + purpose of testing compatibility of an implementation (the + "Product") of a specification (the "Specification") made available + by the Eclipse Foundation, Inc. ("Eclipse"). + +2. Only those modifications expressly permitted by the TCK and its + documentation are permitted. Except in these limited circumstances, + no modifications to the TCK are permitted under this license. + +3. A Product will be deemed to be "compatible" with the Specification + if it fully and completely meets and satisfies all requirements of + the TCK. + +4. Before any claim of compatibility (or any similar claim suggesting + compatibility) is made based on the TCK, the testing party must: + + a. use the TCK to demonstrate that the Product fully and + completely meets and satisfies all requirements of the TCK; + + b. make TCK test results showing full and complete satisfaction of + all requirements of the TCK publicly available on the testing + party's website and send a link to such test results to Eclipse + at [tck@eclipse.org](mailto:tck@eclipse.org); and + + c. comply with any requirements stated in the Specification with + regard to subsetting, supersetting, modifying or extending the + Specification in any Product claimed to be compatible with the + Specification. + +5. The test results must be continuously available and the link must + be live for at least as long as the Product is available in the + marketplace. + +6. The TCK may not be used as a basis for any statements of partial + compatibility. The TCK may only be used as a basis for true, + factual statements of full compatibility of Products that fully + meet and satisfy all requirements of the TCK. + +7. A determination that a Product is compatible with the TCK does not, + in itself, give rise to the right to use any name, mark, logo + associated with the TCK, Eclipse, or Eclipse's contributors or + licensors. + +8. Upon the request of Eclipse, a tester will retract any statements + of compatibility (or any similar claim suggesting compatibility) + which Eclipse reasonably determines to be false or misleading or in + violation of the terms of this license. + +9. Redistribution of the TCK must be under this Eclipse Foundation + Technology Compatibility Kit License and must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + +10. Neither the name, trademarks or logos of Eclipse, nor the names, + trademarks or logos of its contributors or licensors may be used to + endorse or promote products tested with this software without + specific prior written permission. + +11. The source code for the TCK accompanying this license is available + from Eclipse. + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED ON +AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER +EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR +CONDITIONS OF TITLE, NON- INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR +A PARTICULAR PURPOSE. TO THE EXTENT PERMITTED BY APPLICABLE LAW, +NEITHER THE COPYRIGHT OWNER OR ANY CONTRIBUTORS SHALL HAVE ANY +LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. diff --git a/tck/src/main/resources/META-INF/microprofile-config.properties b/server/tck/src/main/resources/META-INF/microprofile-config.properties similarity index 100% rename from tck/src/main/resources/META-INF/microprofile-config.properties rename to server/tck/src/main/resources/META-INF/microprofile-config.properties diff --git a/tck/src/main/resources/tests/addHeroToTeam/cleanup.graphql b/server/tck/src/main/resources/tests/addHeroToTeam/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeam/cleanup.graphql rename to server/tck/src/main/resources/tests/addHeroToTeam/cleanup.graphql diff --git a/tck/src/main/resources/tests/addHeroToTeam/input.graphql b/server/tck/src/main/resources/tests/addHeroToTeam/input.graphql similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeam/input.graphql rename to server/tck/src/main/resources/tests/addHeroToTeam/input.graphql diff --git a/tck/src/main/resources/tests/addHeroToTeam/output.json b/server/tck/src/main/resources/tests/addHeroToTeam/output.json similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeam/output.json rename to server/tck/src/main/resources/tests/addHeroToTeam/output.json diff --git a/tck/src/main/resources/tests/addHeroToTeam/test.properties b/server/tck/src/main/resources/tests/addHeroToTeam/test.properties similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeam/test.properties rename to server/tck/src/main/resources/tests/addHeroToTeam/test.properties diff --git a/tck/src/main/resources/tests/addHeroToTeamWithVariables/cleanup.graphql b/server/tck/src/main/resources/tests/addHeroToTeamWithVariables/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeamWithVariables/cleanup.graphql rename to server/tck/src/main/resources/tests/addHeroToTeamWithVariables/cleanup.graphql diff --git a/tck/src/main/resources/tests/addHeroToTeamWithVariables/input.graphql b/server/tck/src/main/resources/tests/addHeroToTeamWithVariables/input.graphql similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeamWithVariables/input.graphql rename to server/tck/src/main/resources/tests/addHeroToTeamWithVariables/input.graphql diff --git a/tck/src/main/resources/tests/addHeroToTeamWithVariables/output.json b/server/tck/src/main/resources/tests/addHeroToTeamWithVariables/output.json similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeamWithVariables/output.json rename to server/tck/src/main/resources/tests/addHeroToTeamWithVariables/output.json diff --git a/tck/src/main/resources/tests/addHeroToTeamWithVariables/test.properties b/server/tck/src/main/resources/tests/addHeroToTeamWithVariables/test.properties similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeamWithVariables/test.properties rename to server/tck/src/main/resources/tests/addHeroToTeamWithVariables/test.properties diff --git a/tck/src/main/resources/tests/addHeroToTeamWithVariables/variables.json b/server/tck/src/main/resources/tests/addHeroToTeamWithVariables/variables.json similarity index 100% rename from tck/src/main/resources/tests/addHeroToTeamWithVariables/variables.json rename to server/tck/src/main/resources/tests/addHeroToTeamWithVariables/variables.json diff --git a/tck/src/main/resources/tests/addItemToHero/cleanup.graphql b/server/tck/src/main/resources/tests/addItemToHero/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/addItemToHero/cleanup.graphql rename to server/tck/src/main/resources/tests/addItemToHero/cleanup.graphql diff --git a/tck/src/main/resources/tests/addItemToHero/input.graphql b/server/tck/src/main/resources/tests/addItemToHero/input.graphql similarity index 100% rename from tck/src/main/resources/tests/addItemToHero/input.graphql rename to server/tck/src/main/resources/tests/addItemToHero/input.graphql diff --git a/tck/src/main/resources/tests/addItemToHero/output.json b/server/tck/src/main/resources/tests/addItemToHero/output.json similarity index 100% rename from tck/src/main/resources/tests/addItemToHero/output.json rename to server/tck/src/main/resources/tests/addItemToHero/output.json diff --git a/tck/src/main/resources/tests/addItemToHero/test.properties b/server/tck/src/main/resources/tests/addItemToHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/addItemToHero/test.properties rename to server/tck/src/main/resources/tests/addItemToHero/test.properties diff --git a/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/cleanup.graphql b/server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/cleanup.graphql rename to server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/cleanup.graphql diff --git a/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/input.graphql b/server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/input.graphql rename to server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/input.graphql diff --git a/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/output.json b/server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/output.json similarity index 100% rename from tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/output.json rename to server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/output.json diff --git a/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/test.properties b/server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/test.properties rename to server/tck/src/main/resources/tests/addItemToHeroUsingDefaultValue/test.properties diff --git a/tck/src/main/resources/tests/allAvengers/httpHeader.properties b/server/tck/src/main/resources/tests/allAvengers/httpHeader.properties similarity index 100% rename from tck/src/main/resources/tests/allAvengers/httpHeader.properties rename to server/tck/src/main/resources/tests/allAvengers/httpHeader.properties diff --git a/tck/src/main/resources/tests/allAvengers/input.graphql b/server/tck/src/main/resources/tests/allAvengers/input.graphql similarity index 100% rename from tck/src/main/resources/tests/allAvengers/input.graphql rename to server/tck/src/main/resources/tests/allAvengers/input.graphql diff --git a/tck/src/main/resources/tests/allAvengers/output.json b/server/tck/src/main/resources/tests/allAvengers/output.json similarity index 100% rename from tck/src/main/resources/tests/allAvengers/output.json rename to server/tck/src/main/resources/tests/allAvengers/output.json diff --git a/tck/src/main/resources/tests/allAvengers/test.properties b/server/tck/src/main/resources/tests/allAvengers/test.properties similarity index 100% rename from tck/src/main/resources/tests/allAvengers/test.properties rename to server/tck/src/main/resources/tests/allAvengers/test.properties diff --git a/tck/src/main/resources/tests/allAvengersWithVariables/input.graphql b/server/tck/src/main/resources/tests/allAvengersWithVariables/input.graphql similarity index 100% rename from tck/src/main/resources/tests/allAvengersWithVariables/input.graphql rename to server/tck/src/main/resources/tests/allAvengersWithVariables/input.graphql diff --git a/tck/src/main/resources/tests/allAvengersWithVariables/output.json b/server/tck/src/main/resources/tests/allAvengersWithVariables/output.json similarity index 100% rename from tck/src/main/resources/tests/allAvengersWithVariables/output.json rename to server/tck/src/main/resources/tests/allAvengersWithVariables/output.json diff --git a/tck/src/main/resources/tests/allAvengersWithVariables/test.properties b/server/tck/src/main/resources/tests/allAvengersWithVariables/test.properties similarity index 100% rename from tck/src/main/resources/tests/allAvengersWithVariables/test.properties rename to server/tck/src/main/resources/tests/allAvengersWithVariables/test.properties diff --git a/tck/src/main/resources/tests/allAvengersWithVariables/variables.json b/server/tck/src/main/resources/tests/allAvengersWithVariables/variables.json similarity index 100% rename from tck/src/main/resources/tests/allAvengersWithVariables/variables.json rename to server/tck/src/main/resources/tests/allAvengersWithVariables/variables.json diff --git a/tck/src/main/resources/tests/allHeroes/input.graphql b/server/tck/src/main/resources/tests/allHeroes/input.graphql similarity index 100% rename from tck/src/main/resources/tests/allHeroes/input.graphql rename to server/tck/src/main/resources/tests/allHeroes/input.graphql diff --git a/tck/src/main/resources/tests/allHeroes/output.json b/server/tck/src/main/resources/tests/allHeroes/output.json similarity index 100% rename from tck/src/main/resources/tests/allHeroes/output.json rename to server/tck/src/main/resources/tests/allHeroes/output.json diff --git a/tck/src/main/resources/tests/allHeroes/test.properties b/server/tck/src/main/resources/tests/allHeroes/test.properties similarity index 100% rename from tck/src/main/resources/tests/allHeroes/test.properties rename to server/tck/src/main/resources/tests/allHeroes/test.properties diff --git a/tck/src/main/resources/tests/allHeroesInDefaultLocation/input.graphql b/server/tck/src/main/resources/tests/allHeroesInDefaultLocation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/allHeroesInDefaultLocation/input.graphql rename to server/tck/src/main/resources/tests/allHeroesInDefaultLocation/input.graphql diff --git a/tck/src/main/resources/tests/allHeroesInDefaultLocation/output.json b/server/tck/src/main/resources/tests/allHeroesInDefaultLocation/output.json similarity index 100% rename from tck/src/main/resources/tests/allHeroesInDefaultLocation/output.json rename to server/tck/src/main/resources/tests/allHeroesInDefaultLocation/output.json diff --git a/tck/src/main/resources/tests/allHeroesInDefaultLocation/test.properties b/server/tck/src/main/resources/tests/allHeroesInDefaultLocation/test.properties similarity index 100% rename from tck/src/main/resources/tests/allHeroesInDefaultLocation/test.properties rename to server/tck/src/main/resources/tests/allHeroesInDefaultLocation/test.properties diff --git a/tck/src/main/resources/tests/allHeroesWithCurrentLocation/input.graphql b/server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/allHeroesWithCurrentLocation/input.graphql rename to server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/input.graphql diff --git a/tck/src/main/resources/tests/allHeroesWithCurrentLocation/output.json b/server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/output.json similarity index 100% rename from tck/src/main/resources/tests/allHeroesWithCurrentLocation/output.json rename to server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/output.json diff --git a/tck/src/main/resources/tests/allHeroesWithCurrentLocation/test.properties b/server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/test.properties similarity index 100% rename from tck/src/main/resources/tests/allHeroesWithCurrentLocation/test.properties rename to server/tck/src/main/resources/tests/allHeroesWithCurrentLocation/test.properties diff --git a/server/tck/src/main/resources/tests/arrayTypes/input.graphql b/server/tck/src/main/resources/tests/arrayTypes/input.graphql new file mode 100644 index 00000000..f6440842 --- /dev/null +++ b/server/tck/src/main/resources/tests/arrayTypes/input.graphql @@ -0,0 +1,16 @@ +{ + arraysHolder { + intObject + intPrimitive + intObjectList + + formattedIntObject + formattedIntPrimitive + formattedIntObjectList + + date + dateList + formattedDate + formattedDateList + } +} diff --git a/server/tck/src/main/resources/tests/arrayTypes/output.json b/server/tck/src/main/resources/tests/arrayTypes/output.json new file mode 100644 index 00000000..871cab48 --- /dev/null +++ b/server/tck/src/main/resources/tests/arrayTypes/output.json @@ -0,0 +1,40 @@ +{ + "data": { + "arraysHolder": { + "intObject": [ + 1, + 2, + 3 + ], + "intPrimitive": [ + 1, + 2, + 3 + ], + "intObjectList": [ + 1, + 2, + 3 + ], + "formattedIntObject": [ + "R01", + "R02", + "R03" + ], + "formattedIntPrimitive": [ + "R01", + "R02", + "R03" + ], + "formattedIntObjectList": [ + "R01", + "R02", + "R03" + ], + "date": ["2006-02-01", "2007-03-02"], + "dateList": ["2006-02-01", "2007-03-02"], + "formattedDate": ["01.02.2006", "02.03.2007"], + "formattedDateList": ["01.02.2006", "02.03.2007"] + } + } +} diff --git a/server/tck/src/main/resources/tests/arrayTypes/test.properties b/server/tck/src/main/resources/tests/arrayTypes/test.properties new file mode 100644 index 00000000..db74c7f9 --- /dev/null +++ b/server/tck/src/main/resources/tests/arrayTypes/test.properties @@ -0,0 +1,2 @@ +ignore=false +priority=100 diff --git a/tck/src/main/resources/tests/bankbalance/input.graphql b/server/tck/src/main/resources/tests/bankbalance/input.graphql similarity index 100% rename from tck/src/main/resources/tests/bankbalance/input.graphql rename to server/tck/src/main/resources/tests/bankbalance/input.graphql diff --git a/tck/src/main/resources/tests/bankbalance/output.json b/server/tck/src/main/resources/tests/bankbalance/output.json similarity index 100% rename from tck/src/main/resources/tests/bankbalance/output.json rename to server/tck/src/main/resources/tests/bankbalance/output.json diff --git a/tck/src/main/resources/tests/bankbalance/test.properties b/server/tck/src/main/resources/tests/bankbalance/test.properties similarity index 100% rename from tck/src/main/resources/tests/bankbalance/test.properties rename to server/tck/src/main/resources/tests/bankbalance/test.properties diff --git a/tck/src/main/resources/tests/bankbalanceUS/input.graphql b/server/tck/src/main/resources/tests/bankbalanceUS/input.graphql similarity index 100% rename from tck/src/main/resources/tests/bankbalanceUS/input.graphql rename to server/tck/src/main/resources/tests/bankbalanceUS/input.graphql diff --git a/tck/src/main/resources/tests/bankbalanceUS/output.json b/server/tck/src/main/resources/tests/bankbalanceUS/output.json similarity index 100% rename from tck/src/main/resources/tests/bankbalanceUS/output.json rename to server/tck/src/main/resources/tests/bankbalanceUS/output.json diff --git a/tck/src/main/resources/tests/bankbalanceUS/test.properties b/server/tck/src/main/resources/tests/bankbalanceUS/test.properties similarity index 100% rename from tck/src/main/resources/tests/bankbalanceUS/test.properties rename to server/tck/src/main/resources/tests/bankbalanceUS/test.properties diff --git a/tck/src/main/resources/tests/basicScalar/input.graphql b/server/tck/src/main/resources/tests/basicScalar/input.graphql similarity index 100% rename from tck/src/main/resources/tests/basicScalar/input.graphql rename to server/tck/src/main/resources/tests/basicScalar/input.graphql diff --git a/tck/src/main/resources/tests/basicScalar/output.json b/server/tck/src/main/resources/tests/basicScalar/output.json similarity index 97% rename from tck/src/main/resources/tests/basicScalar/output.json rename to server/tck/src/main/resources/tests/basicScalar/output.json index 14534844..1a64790d 100644 --- a/tck/src/main/resources/tests/basicScalar/output.json +++ b/server/tck/src/main/resources/tests/basicScalar/output.json @@ -47,7 +47,6 @@ "anotherTimeObject": "11:46:34.263", "formattedTimeObject": "11:46:34", "dateTimeObject": "2019-10-23T11:46:34.263", - "dateTimeObject": "2019-10-23T11:46:34.263", "anotherDateTimeObject": "2019-10-23T11:46:34.263", "formattedDateTimeObject": "10 23 2019 at 11:46:34", "id": "123456789" diff --git a/server/tck/src/main/resources/tests/basicScalar/output2.json b/server/tck/src/main/resources/tests/basicScalar/output2.json new file mode 100644 index 00000000..d6801bdf --- /dev/null +++ b/server/tck/src/main/resources/tests/basicScalar/output2.json @@ -0,0 +1,55 @@ +{ + "data": { + "testScalarsInPojo": { + "shortPrimitive": 123, + "shortObject": 123, + "formattedShortObject": "R123", + "intPrimitive": 123456789, + "intObject": 123456789, + "formattedIntObject": "123,456,789", + "longPrimitive": 123456789, + "longObject": 123456789, + "formattedLongObject": "123.456.789", + "formattedLongPrimitive": "123.456.789", + "floatPrimitive": 123456.79, + "floatObject": 123456.79, + "formattedFloatObject": "123456.8", + "doublePrimitive": 123456.789, + "doubleObject": 123456.789, + "formattedDoubleObject": "123456.8", + "bytePrimitive": 123, + "byteObject": 123, + "formattedByteObject": "R123", + "bigIntegerObject": 123456789, + "formattedBigIntegerObject": "$123456789", + "bigDecimalObject": 123456.789, + "formattedBigDecimalObject": "123,456.79", + "booleanObject": false, + "booleanPrimitive": false, + "charObject": "c", + "charPrimitive": "c", + "stringObject": "123456789", + "charArray": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9" + ], + "dateObject": "2019-10-23", + "anotherDateObject": "2019-10-23", + "formattedDateObject": "10 23 2019", + "timeObject": "11:46:34", + "anotherTimeObject": "11:46:34", + "formattedTimeObject": "11:46:34", + "dateTimeObject": "2019-10-23T11:46:34", + "anotherDateTimeObject": "2019-10-23T11:46:34", + "formattedDateTimeObject": "10 23 2019 at 11:46:34", + "id": "123456789" + } + } +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/basicScalarDateTransformation/input.graphql b/server/tck/src/main/resources/tests/basicScalarDateTransformation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/basicScalarDateTransformation/input.graphql rename to server/tck/src/main/resources/tests/basicScalarDateTransformation/input.graphql diff --git a/tck/src/main/resources/tests/basicScalarDateTransformation/output.json b/server/tck/src/main/resources/tests/basicScalarDateTransformation/output.json similarity index 100% rename from tck/src/main/resources/tests/basicScalarDateTransformation/output.json rename to server/tck/src/main/resources/tests/basicScalarDateTransformation/output.json diff --git a/tck/src/main/resources/tests/basicScalarMutation/input.graphql b/server/tck/src/main/resources/tests/basicScalarMutation/input.graphql similarity index 93% rename from tck/src/main/resources/tests/basicScalarMutation/input.graphql rename to server/tck/src/main/resources/tests/basicScalarMutation/input.graphql index 624eaf47..c64e06a1 100644 --- a/tck/src/main/resources/tests/basicScalarMutation/input.graphql +++ b/server/tck/src/main/resources/tests/basicScalarMutation/input.graphql @@ -19,8 +19,8 @@ mutation scalarHolderMutation { longObject:12 longPrimitiveId:13 longObjectId:14 - formattedLongPrimitive:15 - formattedLongObject:16 + formattedLongPrimitive:"15" + formattedLongObject:"16" doublePrimitive:17 doubleObject:18 }) { diff --git a/server/tck/src/main/resources/tests/basicScalarMutation/input2.graphql b/server/tck/src/main/resources/tests/basicScalarMutation/input2.graphql new file mode 100644 index 00000000..eac16686 --- /dev/null +++ b/server/tck/src/main/resources/tests/basicScalarMutation/input2.graphql @@ -0,0 +1,51 @@ +mutation scalarHolderMutation { + scalarHolder (arg0:{ + intPrimitive:1 + intObject:2 + shortPrimitive:3 + shortObject:4 + bytePrimitive:5 + byteObject:6 + booleanPrimitive:true + booleanObject:false + intPrimitiveId:7 + integerObjectId:8 + floatPrimitive:9 + floatObject:10 + charPrimitive:"h" + charObject:"e" + charArray:["h","e","l","l","o"] + longPrimitive:11 + longObject:12 + longPrimitiveId:13 + longObjectId:14 + formattedLongPrimitive:"15" + formattedLongObject:"16" + doublePrimitive:17 + doubleObject:18 + }) { + intPrimitive + intObject + shortPrimitive + shortObject + bytePrimitive + byteObject + booleanPrimitive + booleanObject + intPrimitiveId + integerObjectId + floatPrimitive + floatObject + charPrimitive + charObject + charArray + longPrimitive + longObject + longPrimitiveId + longObjectId + formattedLongPrimitive + formattedLongObject + doublePrimitive + doubleObject + } +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/basicScalarMutation/output.json b/server/tck/src/main/resources/tests/basicScalarMutation/output.json similarity index 100% rename from tck/src/main/resources/tests/basicScalarMutation/output.json rename to server/tck/src/main/resources/tests/basicScalarMutation/output.json diff --git a/tck/src/main/resources/tests/basicScalarNumberTransformation/input.graphql b/server/tck/src/main/resources/tests/basicScalarNumberTransformation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/basicScalarNumberTransformation/input.graphql rename to server/tck/src/main/resources/tests/basicScalarNumberTransformation/input.graphql diff --git a/server/tck/src/main/resources/tests/basicScalarNumberTransformation/input2.graphql b/server/tck/src/main/resources/tests/basicScalarNumberTransformation/input2.graphql new file mode 100644 index 00000000..29991894 --- /dev/null +++ b/server/tck/src/main/resources/tests/basicScalarNumberTransformation/input2.graphql @@ -0,0 +1,3 @@ +mutation testTransformedNumber{ + transformedNumber(arg0:345) +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/basicScalarNumberTransformation/output.json b/server/tck/src/main/resources/tests/basicScalarNumberTransformation/output.json similarity index 100% rename from tck/src/main/resources/tests/basicScalarNumberTransformation/output.json rename to server/tck/src/main/resources/tests/basicScalarNumberTransformation/output.json diff --git a/tck/src/main/resources/tests/basicScalarShort/input.graphql b/server/tck/src/main/resources/tests/basicScalarShort/input.graphql similarity index 100% rename from tck/src/main/resources/tests/basicScalarShort/input.graphql rename to server/tck/src/main/resources/tests/basicScalarShort/input.graphql diff --git a/tck/src/main/resources/tests/basicScalarShort/output.json b/server/tck/src/main/resources/tests/basicScalarShort/output.json similarity index 100% rename from tck/src/main/resources/tests/basicScalarShort/output.json rename to server/tck/src/main/resources/tests/basicScalarShort/output.json diff --git a/tck/src/main/resources/tests/basicScalarShortObject/input.graphql b/server/tck/src/main/resources/tests/basicScalarShortObject/input.graphql similarity index 100% rename from tck/src/main/resources/tests/basicScalarShortObject/input.graphql rename to server/tck/src/main/resources/tests/basicScalarShortObject/input.graphql diff --git a/tck/src/main/resources/tests/basicScalarShortObject/output.json b/server/tck/src/main/resources/tests/basicScalarShortObject/output.json similarity index 100% rename from tck/src/main/resources/tests/basicScalarShortObject/output.json rename to server/tck/src/main/resources/tests/basicScalarShortObject/output.json diff --git a/tck/src/main/resources/tests/basicScalarTests.csv b/server/tck/src/main/resources/tests/basicScalarTests.csv similarity index 64% rename from tck/src/main/resources/tests/basicScalarTests.csv rename to server/tck/src/main/resources/tests/basicScalarTests.csv index 92e645c3..3de14394 100644 --- a/tck/src/main/resources/tests/basicScalarTests.csv +++ b/server/tck/src/main/resources/tests/basicScalarTests.csv @@ -1,71 +1,72 @@ # Basic Scalar Types -1| type ScalarHolder | bigDecimalObject: BigDecimal | Expecting a BigDecimal Scalar Type in type ScalarHolder -2| type ScalarHolder | bigIntegerObject: BigInteger | Expecting a BigInteger Scalar Type in type ScalarHolder -3| type ScalarHolder | booleanObject: Boolean | Expecting a Boolean Scalar Type in type ScalarHolder -4| type ScalarHolder | booleanPrimitive: Boolean! | Expecting a non null Boolean Scalar Type in type ScalarHolder -5| type ScalarHolder | byteObject: Int | Expecting a Int Scalar Type (for Byte Java Type) in type ScalarHolder -6| type ScalarHolder | bytePrimitive: Int! | Expecting a non null Int Scalar Type (for byte Java Type) in type ScalarHolder -7| type ScalarHolder | charObject: String | Expecting a String Scalar (for Java Char) Type in type ScalarHolder -8| type ScalarHolder | charPrimitive: String! | Expecting a non null String Scalar (for Java char) Type in type ScalarHolder -9| type ScalarHolder | dateObject: Date | Expecting a Date Scalar Type in type ScalarHolder -10| type ScalarHolder | dateTimeObject: DateTime | Expecting a DateTime Scalar Type in type ScalarHolder -11| type ScalarHolder | doubleObject: Float | Expecting a Float Scalar Type in type ScalarHolder -12| type ScalarHolder | doublePrimitive: Float! | Expecting a non null Float Scalar Type in type ScalarHolder -13| type ScalarHolder | floatObject: Float | Expecting a Float Scalar Type in type ScalarHolder -14| type ScalarHolder | floatPrimitive: Float! | Expecting a non null Float Scalar Type in type ScalarHolder -15| type ScalarHolder | id: ID | Expecting a ID Scalar Type in type ScalarHolder -16| type ScalarHolder | intObject: Int | Expecting a Int Scalar Type in type ScalarHolder -17| type ScalarHolder | intPrimitive: Int! | Expecting a non null Int Scalar Type in type ScalarHolder -18| type ScalarHolder | longObject: BigInteger | Expecting a BigInteger Scalar (for Java Long) Type in type ScalarHolder -19| type ScalarHolder | longPrimitive: BigInteger! | Expecting a non null BigInteger (for Java long) Scalar Type in type ScalarHolder -20| type ScalarHolder | shortObject: Int | Expecting a Int Scalar Type (for Short Java Type) in type ScalarHolder -21| type ScalarHolder | shortPrimitive: Int! | Expecting a non null Int Scalar Type (for short Java Type) in type ScalarHolder -22| type ScalarHolder | stringObject: String | Expecting a String Scalar Type in type ScalarHolder -23| type ScalarHolder | charArray: [String] | Expecting a String Array Scalar (for Java Char[]) Type in type ScalarHolder -24| type ScalarHolder | timeObject: Time | Expecting a Time Scalar Type in type ScalarHolder -25| type Query | testBigDecimalObject: BigDecimal | Expecting a BigDecimal Scalar Type in type Query -26| type Query | testBigIntegerObject: BigInteger | Expecting a BigInteger Scalar Type in type Query -27| type Query | booleanObject: Boolean | Expecting a Boolean Scalar Type in type Query, with the is removed from the name -28| type Query | booleanPrimitive: Boolean! | Expecting a non null Boolean Scalar Type in type Query, with the is removed from the name -29| type Query | testByteObject: Int | Expecting a Int Scalar Type (for Byte Java Type) in type Query -30| type Query | testBytePrimitive: Int! | Expecting a non null Int Scalar Type (for byte Java Type) in type Query -31| type Query | testCharObject: String | Expecting a String Scalar (for Java Char) Type in type Query -32| type Query | testCharPrimitive: String! | Expecting a non null String Scalar (for Java char) Type in type Query -33| type Query | testDateObject: Date | Expecting a Date Scalar Type in type Query -34| type Query | testDateTimeObject: DateTime | Expecting a DateTime Scalar Type in type Query -35| type Query | testDoubleObject: Float | Expecting a Float Scalar Type in type Query -36| type Query | testDoublePrimitive: Float! | Expecting a non null Float Scalar Type in type Query -37| type Query | testFloatObject: Float | Expecting a Float Scalar Type in type Query -38| type Query | testFloatPrimitive: Float! | Expecting a non null Float Scalar Type in type Query -39| type Query | testId: ID | Expecting a ID Scalar Type in type Query -40| type Query | testIntObject: Int | Expecting a Int Scalar Type in type Query -41| type Query | testIntPrimitive: Int! | Expecting a non null Int Scalar Type in type Query -42| type Query | testLongObject: BigInteger | Expecting a BigInteger Scalar (for Java Long) Type in type Query -43| type Query | testLongPrimitive: BigInteger! | Expecting a non null BigInteger Scalar (for Java long) Type in type Query -44| type Query | shortObject: Int | Expecting a Int Scalar Type (for Short Java type) in type Query, with the get removed from the name -45| type Query | shortPrimitive: Int! | Expecting a non null Int Scalar Type (for short Java type) in type Query, with the get removed from the name -46| type Query | testStringObject: String | Expecting a String Scalar Type in type Query -47| type Query | testCharArray: [String] | Expecting a non null Stirng Array (for Java Char[]) Scalar Type in type Query -48| type Query | testTimeObject: Time | Expecting a Time Scalar Type in type Query -49| type Mutation | scalarHolder(arg0: ScalarHolderInput): ScalarHolder 'OR' scalarHolder(scalarHolder: ScalarHolderInput): ScalarHolder | Expecting a Mutation with the set removed from the name, scalarHolder. -50| type ScalarHolder | "HH:mm:ss" | Missing Default Time Format description on Output Type -51| type ScalarHolder | "yyyy-MM-dd" | Missing Default Date Format description on Output Type -52| type ScalarHolder | "yyyy-MM-dd'T'HH:mm:ss" | Missing Default DateTime Format description on Output Type -53| type ScalarHolder | "This is another time (HH:mm:ss)" | Missing Default Time Format description (appended) on Output Type -54| type ScalarHolder | "This is another date (yyyy-MM-dd)" | Missing Default Date Format description (appended) on Output Type -55| type ScalarHolder | "This is another datetime (yyyy-MM-dd'T'HH:mm:ss)" | Missing Default DateTime Format description (appended) on Output Type -56| type ScalarHolder | "This is a formatted time (hh:mm:ss)" | Missing Formatted Time Format description (appended) on Output Type -57| type ScalarHolder | "This is a formatted date (MM dd yyyy)" | Missing Formatted Date Format description (appended) on Output Type -58| type ScalarHolder | "This is a formatted datetime (MM dd yyyy 'at' hh:mm:ss)"| Missing Formatted DateTime Format description (appended) on Output Type -59| type ScalarHolder | "#0.0 en-GB" | Missing Number Format description on Output Type -60| type ScalarHolder | "This is a formatted number (#0.0 en-GB)" | Missing Number Format description (appended) on Output Type -61| type ScalarHolder | longPrimitiveId: ID | Expecting a ID Scalar Type in type ScalarHolder, long -62| type ScalarHolder | intPrimitiveId: ID | Expecting a ID Scalar Type in type ScalarHolder, int -63| type ScalarHolder | longObjectId: ID | Expecting a ID Scalar Type in type ScalarHolder, long -64| type ScalarHolder | integerObjectId: ID | Expecting a ID Scalar Type in type ScalarHolder, Integer -65| type ScalarHolder | uuidId: ID | Expecting a ID Scalar Type in type ScalarHolder, UUID -66| input BasicMessageInput | message: String | Expecting a BasicMessageInput from @Input -67| input BasicMessageInput | countdownPlace: CountDown | Expecting a BasicMessageInput from @Input -68| type BasicMessage | message: String | Expecting a BasicMessage from @Type -69| enum CountDown | THREE | Expecting a CountDown from @Enum -70| interface Basic | message: String | Expecting a String argument called "message" in @Interface("MyInterface") BasicInterface +1| type ScalarHolder | bigDecimalObject: BigDecimal | Expecting a BigDecimal Scalar Type in type ScalarHolder +2| type ScalarHolder | bigIntegerObject: BigInteger | Expecting a BigInteger Scalar Type in type ScalarHolder +3| type ScalarHolder | booleanObject: Boolean | Expecting a Boolean Scalar Type in type ScalarHolder +4| type ScalarHolder | booleanPrimitive: Boolean! | Expecting a non null Boolean Scalar Type in type ScalarHolder +5| type ScalarHolder | byteObject: Int | Expecting a Int Scalar Type (for Byte Java Type) in type ScalarHolder +6| type ScalarHolder | bytePrimitive: Int! | Expecting a non null Int Scalar Type (for byte Java Type) in type ScalarHolder +7| type ScalarHolder | charObject: String | Expecting a String Scalar (for Java Char) Type in type ScalarHolder +8| type ScalarHolder | charPrimitive: String! | Expecting a non null String Scalar (for Java char) Type in type ScalarHolder +9| type ScalarHolder | dateObject: Date | Expecting a Date Scalar Type in type ScalarHolder +10| type ScalarHolder | dateTimeObject: DateTime | Expecting a DateTime Scalar Type in type ScalarHolder +11| type ScalarHolder | doubleObject: Float | Expecting a Float Scalar Type in type ScalarHolder +12| type ScalarHolder | doublePrimitive: Float! | Expecting a non null Float Scalar Type in type ScalarHolder +13| type ScalarHolder | floatObject: Float | Expecting a Float Scalar Type in type ScalarHolder +14| type ScalarHolder | floatPrimitive: Float! | Expecting a non null Float Scalar Type in type ScalarHolder +15| type ScalarHolder | id: ID | Expecting a ID Scalar Type in type ScalarHolder +16| type ScalarHolder | intObject: Int | Expecting a Int Scalar Type in type ScalarHolder +17| type ScalarHolder | intPrimitive: Int! | Expecting a non null Int Scalar Type in type ScalarHolder +18| type ScalarHolder | longObject: BigInteger | Expecting a BigInteger Scalar (for Java Long) Type in type ScalarHolder +19| type ScalarHolder | longPrimitive: BigInteger! | Expecting a non null BigInteger (for Java long) Scalar Type in type ScalarHolder +20| type ScalarHolder | shortObject: Int | Expecting a Int Scalar Type (for Short Java Type) in type ScalarHolder +21| type ScalarHolder | shortPrimitive: Int! | Expecting a non null Int Scalar Type (for short Java Type) in type ScalarHolder +22| type ScalarHolder | stringObject: String | Expecting a String Scalar Type in type ScalarHolder +23| type ScalarHolder | charArray: [String] | Expecting a String Array Scalar (for Java Char[]) Type in type ScalarHolder +24| type ScalarHolder | timeObject: Time | Expecting a Time Scalar Type in type ScalarHolder +25| type Query | testBigDecimalObject: BigDecimal | Expecting a BigDecimal Scalar Type in type Query +26| type Query | testBigIntegerObject: BigInteger | Expecting a BigInteger Scalar Type in type Query +27| type Query | booleanObject: Boolean | Expecting a Boolean Scalar Type in type Query, with the is removed from the name +28| type Query | booleanPrimitive: Boolean! | Expecting a non null Boolean Scalar Type in type Query, with the is removed from the name +29| type Query | testByteObject: Int | Expecting a Int Scalar Type (for Byte Java Type) in type Query +30| type Query | testBytePrimitive: Int! | Expecting a non null Int Scalar Type (for byte Java Type) in type Query +31| type Query | testCharObject: String | Expecting a String Scalar (for Java Char) Type in type Query +32| type Query | testCharPrimitive: String! | Expecting a non null String Scalar (for Java char) Type in type Query +33| type Query | testDateObject: Date | Expecting a Date Scalar Type in type Query +34| type Query | testDateTimeObject: DateTime | Expecting a DateTime Scalar Type in type Query +35| type Query | testDoubleObject: Float | Expecting a Float Scalar Type in type Query +36| type Query | testDoublePrimitive: Float! | Expecting a non null Float Scalar Type in type Query +37| type Query | testFloatObject: Float | Expecting a Float Scalar Type in type Query +38| type Query | testFloatPrimitive: Float! | Expecting a non null Float Scalar Type in type Query +39| type Query | testId: ID | Expecting a ID Scalar Type in type Query +40| type Query | testIntObject: Int | Expecting a Int Scalar Type in type Query +41| type Query | testIntPrimitive: Int! | Expecting a non null Int Scalar Type in type Query +42| type Query | testLongObject: BigInteger | Expecting a BigInteger Scalar (for Java Long) Type in type Query +43| type Query | testLongPrimitive: BigInteger! | Expecting a non null BigInteger Scalar (for Java long) Type in type Query +44| type Query | shortObject: Int | Expecting a Int Scalar Type (for Short Java type) in type Query, with the get removed from the name +45| type Query | shortPrimitive: Int! | Expecting a non null Int Scalar Type (for short Java type) in type Query, with the get removed from the name +46| type Query | testStringObject: String | Expecting a String Scalar Type in type Query +47| type Query | testCharArray: [String] | Expecting a non null Stirng Array (for Java Char[]) Scalar Type in type Query +48| type Query | testTimeObject: Time | Expecting a Time Scalar Type in type Query +49| type Mutation | scalarHolder(arg0: ScalarHolderInput): ScalarHolder 'OR' scalarHolder(scalarHolder: ScalarHolderInput): ScalarHolder | Expecting a Mutation with the set removed from the name, scalarHolder. +50| type ScalarHolder | "HH:mm:ss" 'OR' "ISO-8601" | Missing Default Time Format description on Output Type +51| type ScalarHolder | "yyyy-MM-dd" 'OR' "ISO-8601" | Missing Default Date Format description on Output Type +52| type ScalarHolder | "yyyy-MM-dd'T'HH:mm:ss" 'OR' "ISO-8601" | Missing Default DateTime Format description on Output Type +53| type ScalarHolder | "This is another time (HH:mm:ss)" 'OR' "This is another time (ISO-8601)" | Missing Default Time Format description (appended) on Output Type +54| type ScalarHolder | "This is another date (yyyy-MM-dd)" 'OR' "This is another date (ISO-8601)" | Missing Default Date Format description (appended) on Output Type +55| type ScalarHolder | "This is another datetime (yyyy-MM-dd'T'HH:mm:ss)" 'OR' "This is another datetime (ISO-8601)" | Missing Default DateTime Format description (appended) on Output Type +56| type ScalarHolder | "This is a formatted time (hh:mm:ss)" | Missing Formatted Time Format description (appended) on Output Type +57| type ScalarHolder | "This is a formatted date (MM dd yyyy)" | Missing Formatted Date Format description (appended) on Output Type +58| type ScalarHolder | "This is a formatted datetime (MM dd yyyy 'at' hh:mm:ss)" | Missing Formatted DateTime Format description (appended) on Output Type +59| type ScalarHolder | "#0.0 en-GB" | Missing Number Format description on Output Type +60| type ScalarHolder | "This is a formatted number (#0.0 en-GB)" | Missing Number Format description (appended) on Output Type +61| type ScalarHolder | longPrimitiveId: ID | Expecting a ID Scalar Type in type ScalarHolder, long +62| type ScalarHolder | intPrimitiveId: ID | Expecting a ID Scalar Type in type ScalarHolder, int +63| type ScalarHolder | longObjectId: ID | Expecting a ID Scalar Type in type ScalarHolder, long +64| type ScalarHolder | integerObjectId: ID | Expecting a ID Scalar Type in type ScalarHolder, Integer +65| type ScalarHolder | uuidId: ID | Expecting a ID Scalar Type in type ScalarHolder, UUID +66| input BasicMessageInput | message: String | Expecting a BasicMessageInput from @Input +67| input BasicMessageInput | countdownPlace: CountDown | Expecting a BasicMessageInput from @Input +68| type BasicMessage | message: String | Expecting a BasicMessage from @Type +69| enum CountDown | THREE | Expecting a CountDown from @Enum +70| interface Basic | message: String | Expecting a String argument called "message" in @Interface("MyInterface") BasicInterface +71| type Query | testNonNullParameter(param: String!) | Expecting a non null String parameter diff --git a/tck/src/main/resources/tests/battle/cleanup.graphql b/server/tck/src/main/resources/tests/battle/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/battle/cleanup.graphql rename to server/tck/src/main/resources/tests/battle/cleanup.graphql diff --git a/tck/src/main/resources/tests/battle/input.graphql b/server/tck/src/main/resources/tests/battle/input.graphql similarity index 100% rename from tck/src/main/resources/tests/battle/input.graphql rename to server/tck/src/main/resources/tests/battle/input.graphql diff --git a/tck/src/main/resources/tests/battle/output.json b/server/tck/src/main/resources/tests/battle/output.json similarity index 100% rename from tck/src/main/resources/tests/battle/output.json rename to server/tck/src/main/resources/tests/battle/output.json diff --git a/tck/src/main/resources/tests/battle/test.properties b/server/tck/src/main/resources/tests/battle/test.properties similarity index 100% rename from tck/src/main/resources/tests/battle/test.properties rename to server/tck/src/main/resources/tests/battle/test.properties diff --git a/tck/src/main/resources/tests/battleWithFormat/cleanup.graphql b/server/tck/src/main/resources/tests/battleWithFormat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/battleWithFormat/cleanup.graphql rename to server/tck/src/main/resources/tests/battleWithFormat/cleanup.graphql diff --git a/tck/src/main/resources/tests/battleWithFormat/input.graphql b/server/tck/src/main/resources/tests/battleWithFormat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/battleWithFormat/input.graphql rename to server/tck/src/main/resources/tests/battleWithFormat/input.graphql diff --git a/tck/src/main/resources/tests/battleWithFormat/output.json b/server/tck/src/main/resources/tests/battleWithFormat/output.json similarity index 100% rename from tck/src/main/resources/tests/battleWithFormat/output.json rename to server/tck/src/main/resources/tests/battleWithFormat/output.json diff --git a/tck/src/main/resources/tests/battleWithFormat/test.properties b/server/tck/src/main/resources/tests/battleWithFormat/test.properties similarity index 100% rename from tck/src/main/resources/tests/battleWithFormat/test.properties rename to server/tck/src/main/resources/tests/battleWithFormat/test.properties diff --git a/tck/src/main/resources/tests/beenThere/cleanup.graphql b/server/tck/src/main/resources/tests/beenThere/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/beenThere/cleanup.graphql rename to server/tck/src/main/resources/tests/beenThere/cleanup.graphql diff --git a/tck/src/main/resources/tests/beenThere/input.graphql b/server/tck/src/main/resources/tests/beenThere/input.graphql similarity index 100% rename from tck/src/main/resources/tests/beenThere/input.graphql rename to server/tck/src/main/resources/tests/beenThere/input.graphql diff --git a/tck/src/main/resources/tests/beenThere/output.json b/server/tck/src/main/resources/tests/beenThere/output.json similarity index 100% rename from tck/src/main/resources/tests/beenThere/output.json rename to server/tck/src/main/resources/tests/beenThere/output.json diff --git a/tck/src/main/resources/tests/beenThere/test.properties b/server/tck/src/main/resources/tests/beenThere/test.properties similarity index 100% rename from tck/src/main/resources/tests/beenThere/test.properties rename to server/tck/src/main/resources/tests/beenThere/test.properties diff --git a/tck/src/main/resources/tests/birthday/cleanup.graphql b/server/tck/src/main/resources/tests/birthday/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/birthday/cleanup.graphql rename to server/tck/src/main/resources/tests/birthday/cleanup.graphql diff --git a/tck/src/main/resources/tests/birthday/input.graphql b/server/tck/src/main/resources/tests/birthday/input.graphql similarity index 100% rename from tck/src/main/resources/tests/birthday/input.graphql rename to server/tck/src/main/resources/tests/birthday/input.graphql diff --git a/tck/src/main/resources/tests/birthday/output.json b/server/tck/src/main/resources/tests/birthday/output.json similarity index 100% rename from tck/src/main/resources/tests/birthday/output.json rename to server/tck/src/main/resources/tests/birthday/output.json diff --git a/tck/src/main/resources/tests/birthday/test.properties b/server/tck/src/main/resources/tests/birthday/test.properties similarity index 100% rename from tck/src/main/resources/tests/birthday/test.properties rename to server/tck/src/main/resources/tests/birthday/test.properties diff --git a/tck/src/main/resources/tests/calendarEntries/cleanup.graphql b/server/tck/src/main/resources/tests/calendarEntries/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/calendarEntries/cleanup.graphql rename to server/tck/src/main/resources/tests/calendarEntries/cleanup.graphql diff --git a/tck/src/main/resources/tests/calendarEntries/input.graphql b/server/tck/src/main/resources/tests/calendarEntries/input.graphql similarity index 100% rename from tck/src/main/resources/tests/calendarEntries/input.graphql rename to server/tck/src/main/resources/tests/calendarEntries/input.graphql diff --git a/tck/src/main/resources/tests/calendarEntries/output.json b/server/tck/src/main/resources/tests/calendarEntries/output.json similarity index 100% rename from tck/src/main/resources/tests/calendarEntries/output.json rename to server/tck/src/main/resources/tests/calendarEntries/output.json diff --git a/tck/src/main/resources/tests/calendarEntries/test.properties b/server/tck/src/main/resources/tests/calendarEntries/test.properties similarity index 100% rename from tck/src/main/resources/tests/calendarEntries/test.properties rename to server/tck/src/main/resources/tests/calendarEntries/test.properties diff --git a/server/tck/src/main/resources/tests/charScalars/input.graphql b/server/tck/src/main/resources/tests/charScalars/input.graphql new file mode 100644 index 00000000..5868c183 --- /dev/null +++ b/server/tck/src/main/resources/tests/charScalars/input.graphql @@ -0,0 +1,7 @@ +{ + charHolder { + charPrimitiveInput(c: "a") + charObjectInput(c: "ab") + charArrayInput(cs: ["a", "b"]) + } +} diff --git a/server/tck/src/main/resources/tests/charScalars/output.json b/server/tck/src/main/resources/tests/charScalars/output.json new file mode 100644 index 00000000..d02ba018 --- /dev/null +++ b/server/tck/src/main/resources/tests/charScalars/output.json @@ -0,0 +1,12 @@ +{ + "data": { + "charHolder": { + "charPrimitiveInput": "a", + "charObjectInput": "a", + "charArrayInput": [ + "a", + "b" + ] + } + } +} diff --git a/server/tck/src/main/resources/tests/charScalars/test.properties b/server/tck/src/main/resources/tests/charScalars/test.properties new file mode 100644 index 00000000..db74c7f9 --- /dev/null +++ b/server/tck/src/main/resources/tests/charScalars/test.properties @@ -0,0 +1,2 @@ +ignore=false +priority=100 diff --git a/tck/src/main/resources/tests/checkin/cleanup.graphql b/server/tck/src/main/resources/tests/checkin/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/checkin/cleanup.graphql rename to server/tck/src/main/resources/tests/checkin/cleanup.graphql diff --git a/tck/src/main/resources/tests/checkin/input.graphql b/server/tck/src/main/resources/tests/checkin/input.graphql similarity index 100% rename from tck/src/main/resources/tests/checkin/input.graphql rename to server/tck/src/main/resources/tests/checkin/input.graphql diff --git a/tck/src/main/resources/tests/checkin/output.json b/server/tck/src/main/resources/tests/checkin/output.json similarity index 100% rename from tck/src/main/resources/tests/checkin/output.json rename to server/tck/src/main/resources/tests/checkin/output.json diff --git a/tck/src/main/resources/tests/checkin/test.properties b/server/tck/src/main/resources/tests/checkin/test.properties similarity index 100% rename from tck/src/main/resources/tests/checkin/test.properties rename to server/tck/src/main/resources/tests/checkin/test.properties diff --git a/tck/src/main/resources/tests/checkinWithFormat/cleanup.graphql b/server/tck/src/main/resources/tests/checkinWithFormat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/checkinWithFormat/cleanup.graphql rename to server/tck/src/main/resources/tests/checkinWithFormat/cleanup.graphql diff --git a/tck/src/main/resources/tests/checkinWithFormat/input.graphql b/server/tck/src/main/resources/tests/checkinWithFormat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/checkinWithFormat/input.graphql rename to server/tck/src/main/resources/tests/checkinWithFormat/input.graphql diff --git a/tck/src/main/resources/tests/checkinWithFormat/output.json b/server/tck/src/main/resources/tests/checkinWithFormat/output.json similarity index 100% rename from tck/src/main/resources/tests/checkinWithFormat/output.json rename to server/tck/src/main/resources/tests/checkinWithFormat/output.json diff --git a/tck/src/main/resources/tests/checkinWithFormat/test.properties b/server/tck/src/main/resources/tests/checkinWithFormat/test.properties similarity index 100% rename from tck/src/main/resources/tests/checkinWithFormat/test.properties rename to server/tck/src/main/resources/tests/checkinWithFormat/test.properties diff --git a/tck/src/main/resources/tests/createNewHero/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHero/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHero/cleanup.graphql rename to server/tck/src/main/resources/tests/createNewHero/cleanup.graphql diff --git a/tck/src/main/resources/tests/createNewHero/input.graphql b/server/tck/src/main/resources/tests/createNewHero/input.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHero/input.graphql rename to server/tck/src/main/resources/tests/createNewHero/input.graphql diff --git a/tck/src/main/resources/tests/createNewHero/output.json b/server/tck/src/main/resources/tests/createNewHero/output.json similarity index 100% rename from tck/src/main/resources/tests/createNewHero/output.json rename to server/tck/src/main/resources/tests/createNewHero/output.json diff --git a/tck/src/main/resources/tests/createNewHero/test.properties b/server/tck/src/main/resources/tests/createNewHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/createNewHero/test.properties rename to server/tck/src/main/resources/tests/createNewHero/test.properties diff --git a/tck/src/main/resources/tests/createNewHeroWithVariables/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHeroWithVariables/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHeroWithVariables/cleanup.graphql rename to server/tck/src/main/resources/tests/createNewHeroWithVariables/cleanup.graphql diff --git a/tck/src/main/resources/tests/createNewHeroWithVariables/input.graphql b/server/tck/src/main/resources/tests/createNewHeroWithVariables/input.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHeroWithVariables/input.graphql rename to server/tck/src/main/resources/tests/createNewHeroWithVariables/input.graphql diff --git a/tck/src/main/resources/tests/createNewHeroWithVariables/output.json b/server/tck/src/main/resources/tests/createNewHeroWithVariables/output.json similarity index 100% rename from tck/src/main/resources/tests/createNewHeroWithVariables/output.json rename to server/tck/src/main/resources/tests/createNewHeroWithVariables/output.json diff --git a/tck/src/main/resources/tests/createNewHeroWithVariables/test.properties b/server/tck/src/main/resources/tests/createNewHeroWithVariables/test.properties similarity index 100% rename from tck/src/main/resources/tests/createNewHeroWithVariables/test.properties rename to server/tck/src/main/resources/tests/createNewHeroWithVariables/test.properties diff --git a/tck/src/main/resources/tests/createNewHeroWithVariables/variables.json b/server/tck/src/main/resources/tests/createNewHeroWithVariables/variables.json similarity index 100% rename from tck/src/main/resources/tests/createNewHeroWithVariables/variables.json rename to server/tck/src/main/resources/tests/createNewHeroWithVariables/variables.json diff --git a/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/cleanup.graphql new file mode 100644 index 00000000..ede6546f --- /dev/null +++ b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/cleanup.graphql @@ -0,0 +1,5 @@ +mutation removeHero { + removeHero(hero: "Batman") { + name + } +} diff --git a/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/input.graphql b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/input.graphql new file mode 100644 index 00000000..9543a8d4 --- /dev/null +++ b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/input.graphql @@ -0,0 +1,8 @@ +mutation createNewHeroWithVariables($hero: SuperHeroInput){ + createNewHero(hero: $hero){ + name + primaryLocation + superPowers + realName + } +} \ No newline at end of file diff --git a/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/output.json b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/output.json new file mode 100644 index 00000000..74439046 --- /dev/null +++ b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/output.json @@ -0,0 +1,12 @@ +{ + "data": { + "createNewHero": { + "name": "Batman", + "primaryLocation": "Gotham City", + "superPowers": [ + "Genius-level intellect" + ], + "realName": "Bruce Wayne" + } + } +} \ No newline at end of file diff --git a/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/test.properties b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/test.properties new file mode 100644 index 00000000..cac12be9 --- /dev/null +++ b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/test.properties @@ -0,0 +1,3 @@ +# Tests that variables can contain full "complex" objects +ignore=false +priority=200 diff --git a/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/variables.json b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/variables.json new file mode 100644 index 00000000..b613802f --- /dev/null +++ b/server/tck/src/main/resources/tests/createNewHeroWithVariablesObject/variables.json @@ -0,0 +1,8 @@ +{ + "hero": { + "name": "Batman", + "realName": "Bruce Wayne", + "primaryLocation": "Gotham City", + "superPowers": ["Genius-level intellect"] + } +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/cleanup.graphql rename to server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/cleanup.graphql diff --git a/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/input.graphql b/server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/input.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/input.graphql rename to server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/input.graphql diff --git a/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/output.json b/server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/output.json similarity index 100% rename from tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/output.json rename to server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/output.json diff --git a/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/test.properties b/server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/test.properties similarity index 100% rename from tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/test.properties rename to server/tck/src/main/resources/tests/createNewHero_inputFieldWithDifferentName/test.properties diff --git a/tck/src/main/resources/tests/createNewHeros/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHeros/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHeros/cleanup.graphql rename to server/tck/src/main/resources/tests/createNewHeros/cleanup.graphql diff --git a/tck/src/main/resources/tests/createNewHeros/input.graphql b/server/tck/src/main/resources/tests/createNewHeros/input.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHeros/input.graphql rename to server/tck/src/main/resources/tests/createNewHeros/input.graphql diff --git a/tck/src/main/resources/tests/createNewHeros/output.json b/server/tck/src/main/resources/tests/createNewHeros/output.json similarity index 100% rename from tck/src/main/resources/tests/createNewHeros/output.json rename to server/tck/src/main/resources/tests/createNewHeros/output.json diff --git a/tck/src/main/resources/tests/createNewHeros/test.properties b/server/tck/src/main/resources/tests/createNewHeros/test.properties similarity index 100% rename from tck/src/main/resources/tests/createNewHeros/test.properties rename to server/tck/src/main/resources/tests/createNewHeros/test.properties diff --git a/tck/src/main/resources/tests/createNewHerosArray/cleanup.graphql b/server/tck/src/main/resources/tests/createNewHerosArray/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHerosArray/cleanup.graphql rename to server/tck/src/main/resources/tests/createNewHerosArray/cleanup.graphql diff --git a/tck/src/main/resources/tests/createNewHerosArray/input.graphql b/server/tck/src/main/resources/tests/createNewHerosArray/input.graphql similarity index 100% rename from tck/src/main/resources/tests/createNewHerosArray/input.graphql rename to server/tck/src/main/resources/tests/createNewHerosArray/input.graphql diff --git a/tck/src/main/resources/tests/createNewHerosArray/output.json b/server/tck/src/main/resources/tests/createNewHerosArray/output.json similarity index 100% rename from tck/src/main/resources/tests/createNewHerosArray/output.json rename to server/tck/src/main/resources/tests/createNewHerosArray/output.json diff --git a/tck/src/main/resources/tests/createNewHerosArray/test.properties b/server/tck/src/main/resources/tests/createNewHerosArray/test.properties similarity index 100% rename from tck/src/main/resources/tests/createNewHerosArray/test.properties rename to server/tck/src/main/resources/tests/createNewHerosArray/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/input.graphql b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/output.json b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/output.json rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/output.json diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/test.properties b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/test.properties rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedHero/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/cleanup.graphql b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/cleanup.graphql rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/cleanup.graphql diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/input.graphql b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output.json b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output.json rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output2.json b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output2.json new file mode 100644 index 00000000..de8415dc --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/output2.json @@ -0,0 +1,17 @@ +{ + "errors": [ + { + "message": "The field at path '/team/name' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'String' within parent type 'Team'", + "path": [ + "team", + "name" + ], + "extensions": { + "classification": "NullValueInNonNullableField" + } + } + ], + "data": { + "team": null + } +} diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/prepare.graphql b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/prepare.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/prepare.graphql rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/prepare.graphql diff --git a/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/test.properties b/server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/test.properties rename to server/tck/src/main/resources/tests/errorHandling/createNewNullNamedTeam/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/input.graphql b/server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/output.json b/server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/output.json rename to server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/output.json diff --git a/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/test.properties b/server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/test.properties rename to server/tck/src/main/resources/tests/errorHandling/createNewUnnamedHero/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/blacklist/input.graphql b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklist/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/blacklist/output.json b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklist/output.json rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/output.json diff --git a/tck/src/main/resources/tests/errorHandling/blacklist/test.properties b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklist/test.properties rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessage/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/blacklistTransitive/input.graphql b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklistTransitive/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/blacklistTransitive/output.json b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklistTransitive/output.json rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/output.json diff --git a/tck/src/main/resources/tests/errorHandling/blacklistTransitive/test.properties b/server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/blacklistTransitive/test.properties rename to server/tck/src/main/resources/tests/errorHandling/hideErrorMessageTransitive/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output2.json new file mode 100644 index 00000000..e8dbd5f1 --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/output2.json @@ -0,0 +1,14 @@ +{ + "data": null, + "errors": [ + { + "message": "Validation error of type WrongType: argument 'powerLevel' with value 'StringValue{value='Unlimited'}' is not a valid 'Int' - Expected AST type 'IntValue' but was 'StringValue'. @ 'updateItemPowerLevel'", + "locations": [ + { + "line": 2, + "column": 37 + } + ] + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidDataTypeValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidEnumValue/cleanup.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidEnumValue/cleanup.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/cleanup.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidEnumValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidEnumValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidEnumValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidEnumValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/output.json diff --git a/tck/src/main/resources/tests/errorHandling/invalidEnumValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidEnumValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidEnumValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output2.json new file mode 100644 index 00000000..fd8651bb --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "checkInWithCorrectDateFormat": null + }, + "errors": [ + { + "path": [ + "checkInWithCorrectDateFormat" + ], + "locations": [ + { + "column": 3, + "line": 2 + } + ], + "message": "Exception while fetching data (/checkInWithCorrectDateFormat) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateFormattedValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output2.json new file mode 100644 index 00000000..ec0efd45 --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "battleWithCorrectDateFormat": null + }, + "errors": [ + { + "path": [ + "battleWithCorrectDateFormat" + ], + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "message": "Exception while fetching data (/battleWithCorrectDateFormat) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeFormattedValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output2.json new file mode 100644 index 00000000..02058e73 --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "battle": null + }, + "errors": [ + { + "path": [ + "battle" + ], + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "message": "Exception while fetching data (/battle) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateTimeValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output2.json new file mode 100644 index 00000000..47c7161f --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "checkIn": null + }, + "errors": [ + { + "path": [ + "checkIn" + ], + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "message": "Exception while fetching data (/checkIn) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalDateValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output2.json new file mode 100644 index 00000000..830c264a --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "startPatrollingWithCorrectDateFormat": null + }, + "errors": [ + { + "path": [ + "startPatrollingWithCorrectDateFormat" + ], + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "message": "Exception while fetching data (/startPatrollingWithCorrectDateFormat) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeFormattedValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/input.graphql b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output.json rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output2.json b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output2.json new file mode 100644 index 00000000..cc0d08ef --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/output2.json @@ -0,0 +1,19 @@ +{ + "data": { + "startPatrolling": null + }, + "errors": [ + { + "path": [ + "startPatrolling" + ], + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "message": "Exception while fetching data (/startPatrolling) : Text 'Today' could not be parsed at index 0" + } + ] +} \ No newline at end of file diff --git a/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/test.properties b/server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/test.properties rename to server/tck/src/main/resources/tests/errorHandling/invalidLocalTimeValue/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/javaError/input.graphql b/server/tck/src/main/resources/tests/errorHandling/javaError/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/javaError/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/javaError/input.graphql diff --git a/server/tck/src/main/resources/tests/errorHandling/javaError/output.json b/server/tck/src/main/resources/tests/errorHandling/javaError/output.json new file mode 100644 index 00000000..e69de29b diff --git a/tck/src/main/resources/tests/errorHandling/javaError/test.properties b/server/tck/src/main/resources/tests/errorHandling/javaError/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/javaError/test.properties rename to server/tck/src/main/resources/tests/errorHandling/javaError/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/cleanup.graphql b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/cleanup.graphql rename to server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/cleanup.graphql diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/input.graphql b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output.json rename to server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output2.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output2.json new file mode 100644 index 00000000..2ca6b86b --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/output2.json @@ -0,0 +1,43 @@ +{ + "data": { + "createNewHero": { + "name": "Captain America", + "teamAffiliations": [ + { + "members": [ + { + "name": "Iron Man", + "currentLocation": "Wachovia" + }, + { + "name": "Spider Man", + "currentLocation": "Brooklyn" + }, + { + "name": "Wolverine", + "currentLocation": "New Orleans" + }, + { + "name": "Captain America", + "currentLocation": null + } + ] + } + ], + "primaryLocation": "New York, NY", + "superPowers": [ + "Super strength", + "Vibranium Shield" + ], + "realName": "Steven Rogers" + } + }, + "errors": [ + { + "path": [ + "createNewHero" + ], + "message": "Cannot find location for Captain America" + } + ] +} diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/test.properties b/server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/test.properties rename to server/tck/src/main/resources/tests/errorHandling/partialResultsAfterNewHeroNoLocation/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/input.graphql b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output.json rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output2.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output2.json new file mode 100644 index 00000000..106baedd --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/output2.json @@ -0,0 +1,27 @@ +{ + "data": { + "allHeroesWithError": [ + { + "name": "Iron Man", + "primaryLocation": "Los Angeles, CA" + }, + { + "name": "Wolverine", + "primaryLocation": "Unknown" + }, + null, + { + "name": "Spider Man", + "primaryLocation": "New York, NY" + } + ] + }, + "errors": [ + { + "path": [ + "allHeroesWithError" + ], + "message": "Failed to find one or more heroes" + } + ] +} diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/test.properties b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/test.properties rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLException/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/input.graphql b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output.json rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output.json diff --git a/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output2.json b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output2.json new file mode 100644 index 00000000..45925793 --- /dev/null +++ b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/output2.json @@ -0,0 +1,27 @@ +{ + "data": { + "allHeroesWithSpecificError": [ + { + "name": "Iron Man", + "primaryLocation": "Los Angeles, CA" + }, + { + "name": "Wolverine", + "primaryLocation": "Unknown" + }, + { + "name": "Starlord", + "primaryLocation": "Outer Space" + } + ] + }, + "errors": [ + { + "path": [ + "allHeroesWithSpecificError" + ], + "message": "Failed to find one or more heroes" + } + ] +} + diff --git a/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/test.properties b/server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/test.properties rename to server/tck/src/main/resources/tests/errorHandling/partialResultsInGraphQLExceptionSubclass/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/runtimeException/input.graphql b/server/tck/src/main/resources/tests/errorHandling/runtimeException/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/runtimeException/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/runtimeException/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/runtimeException/output.json b/server/tck/src/main/resources/tests/errorHandling/runtimeException/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/runtimeException/output.json rename to server/tck/src/main/resources/tests/errorHandling/runtimeException/output.json diff --git a/tck/src/main/resources/tests/errorHandling/runtimeException/test.properties b/server/tck/src/main/resources/tests/errorHandling/runtimeException/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/runtimeException/test.properties rename to server/tck/src/main/resources/tests/errorHandling/runtimeException/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/whitelist/input.graphql b/server/tck/src/main/resources/tests/errorHandling/showErrorMessage/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelist/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessage/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/whitelist/output.json b/server/tck/src/main/resources/tests/errorHandling/showErrorMessage/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelist/output.json rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessage/output.json diff --git a/tck/src/main/resources/tests/errorHandling/whitelist/test.properties b/server/tck/src/main/resources/tests/errorHandling/showErrorMessage/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelist/test.properties rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessage/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/whitelistTransitive/input.graphql b/server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelistTransitive/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/whitelistTransitive/output.json b/server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelistTransitive/output.json rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/output.json diff --git a/tck/src/main/resources/tests/errorHandling/whitelistTransitive/test.properties b/server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/whitelistTransitive/test.properties rename to server/tck/src/main/resources/tests/errorHandling/showErrorMessageTransitive/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/unknownField/input.graphql b/server/tck/src/main/resources/tests/errorHandling/unknownField/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownField/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/unknownField/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/unknownField/output.json b/server/tck/src/main/resources/tests/errorHandling/unknownField/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownField/output.json rename to server/tck/src/main/resources/tests/errorHandling/unknownField/output.json diff --git a/tck/src/main/resources/tests/errorHandling/unknownField/test.properties b/server/tck/src/main/resources/tests/errorHandling/unknownField/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownField/test.properties rename to server/tck/src/main/resources/tests/errorHandling/unknownField/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/input.graphql b/server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/output.json b/server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/output.json rename to server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/output.json diff --git a/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/test.properties b/server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/test.properties rename to server/tck/src/main/resources/tests/errorHandling/unknownHeroNonGraphQLException/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/unknownMutation/input.graphql b/server/tck/src/main/resources/tests/errorHandling/unknownMutation/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownMutation/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/unknownMutation/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/unknownMutation/output.json b/server/tck/src/main/resources/tests/errorHandling/unknownMutation/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownMutation/output.json rename to server/tck/src/main/resources/tests/errorHandling/unknownMutation/output.json diff --git a/tck/src/main/resources/tests/errorHandling/unknownMutation/test.properties b/server/tck/src/main/resources/tests/errorHandling/unknownMutation/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownMutation/test.properties rename to server/tck/src/main/resources/tests/errorHandling/unknownMutation/test.properties diff --git a/tck/src/main/resources/tests/errorHandling/unknownQuery/input.graphql b/server/tck/src/main/resources/tests/errorHandling/unknownQuery/input.graphql similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownQuery/input.graphql rename to server/tck/src/main/resources/tests/errorHandling/unknownQuery/input.graphql diff --git a/tck/src/main/resources/tests/errorHandling/unknownQuery/output.json b/server/tck/src/main/resources/tests/errorHandling/unknownQuery/output.json similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownQuery/output.json rename to server/tck/src/main/resources/tests/errorHandling/unknownQuery/output.json diff --git a/tck/src/main/resources/tests/errorHandling/unknownQuery/test.properties b/server/tck/src/main/resources/tests/errorHandling/unknownQuery/test.properties similarity index 100% rename from tck/src/main/resources/tests/errorHandling/unknownQuery/test.properties rename to server/tck/src/main/resources/tests/errorHandling/unknownQuery/test.properties diff --git a/tck/src/main/resources/tests/favouriteDrinkSize/cleanup.graphql b/server/tck/src/main/resources/tests/favouriteDrinkSize/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSize/cleanup.graphql rename to server/tck/src/main/resources/tests/favouriteDrinkSize/cleanup.graphql diff --git a/tck/src/main/resources/tests/favouriteDrinkSize/input.graphql b/server/tck/src/main/resources/tests/favouriteDrinkSize/input.graphql similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSize/input.graphql rename to server/tck/src/main/resources/tests/favouriteDrinkSize/input.graphql diff --git a/tck/src/main/resources/tests/favouriteDrinkSize/output.json b/server/tck/src/main/resources/tests/favouriteDrinkSize/output.json similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSize/output.json rename to server/tck/src/main/resources/tests/favouriteDrinkSize/output.json diff --git a/tck/src/main/resources/tests/favouriteDrinkSize/test.properties b/server/tck/src/main/resources/tests/favouriteDrinkSize/test.properties similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSize/test.properties rename to server/tck/src/main/resources/tests/favouriteDrinkSize/test.properties diff --git a/tck/src/main/resources/tests/favouriteDrinkSizeML/cleanup.graphql b/server/tck/src/main/resources/tests/favouriteDrinkSizeML/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSizeML/cleanup.graphql rename to server/tck/src/main/resources/tests/favouriteDrinkSizeML/cleanup.graphql diff --git a/tck/src/main/resources/tests/favouriteDrinkSizeML/input.graphql b/server/tck/src/main/resources/tests/favouriteDrinkSizeML/input.graphql similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSizeML/input.graphql rename to server/tck/src/main/resources/tests/favouriteDrinkSizeML/input.graphql diff --git a/tck/src/main/resources/tests/favouriteDrinkSizeML/output.json b/server/tck/src/main/resources/tests/favouriteDrinkSizeML/output.json similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSizeML/output.json rename to server/tck/src/main/resources/tests/favouriteDrinkSizeML/output.json diff --git a/tck/src/main/resources/tests/favouriteDrinkSizeML/test.properties b/server/tck/src/main/resources/tests/favouriteDrinkSizeML/test.properties similarity index 100% rename from tck/src/main/resources/tests/favouriteDrinkSizeML/test.properties rename to server/tck/src/main/resources/tests/favouriteDrinkSizeML/test.properties diff --git a/tck/src/main/resources/tests/getCharacter/input.graphql b/server/tck/src/main/resources/tests/getCharacter/input.graphql similarity index 100% rename from tck/src/main/resources/tests/getCharacter/input.graphql rename to server/tck/src/main/resources/tests/getCharacter/input.graphql diff --git a/tck/src/main/resources/tests/getCharacter/output.json b/server/tck/src/main/resources/tests/getCharacter/output.json similarity index 100% rename from tck/src/main/resources/tests/getCharacter/output.json rename to server/tck/src/main/resources/tests/getCharacter/output.json diff --git a/tck/src/main/resources/tests/getCharacter/test.properties b/server/tck/src/main/resources/tests/getCharacter/test.properties similarity index 100% rename from tck/src/main/resources/tests/getCharacter/test.properties rename to server/tck/src/main/resources/tests/getCharacter/test.properties diff --git a/server/tck/src/main/resources/tests/getHero/input.graphql b/server/tck/src/main/resources/tests/getHero/input.graphql new file mode 100644 index 00000000..e64ec815 --- /dev/null +++ b/server/tck/src/main/resources/tests/getHero/input.graphql @@ -0,0 +1,27 @@ +{ + superHero(name:"Iron Man") { + + name + primaryLocation + realName + superPowers + powerSource { + ... on Magic { + canBeLearned + } + ... on GeneticMutation { + isPresentAtBirth + dateOfMutation + } + ... on ExtremeWealth { + netWorth + } + } + teamAffiliations { + name + members{ + name + } + } + } +} diff --git a/tck/src/main/resources/tests/getHero/output.json b/server/tck/src/main/resources/tests/getHero/output.json similarity index 88% rename from tck/src/main/resources/tests/getHero/output.json rename to server/tck/src/main/resources/tests/getHero/output.json index adb089f9..0b72bdda 100644 --- a/tck/src/main/resources/tests/getHero/output.json +++ b/server/tck/src/main/resources/tests/getHero/output.json @@ -8,6 +8,9 @@ "wealth", "engineering" ], + "powerSource": { + "netWorth": 12400000000.00 + }, "teamAffiliations": [ { "name": "Avengers", @@ -26,4 +29,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tck/src/main/resources/tests/getHero/test.properties b/server/tck/src/main/resources/tests/getHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/getHero/test.properties rename to server/tck/src/main/resources/tests/getHero/test.properties diff --git a/tck/src/main/resources/tests/getHeroWithItems/input.graphql b/server/tck/src/main/resources/tests/getHeroWithItems/input.graphql similarity index 100% rename from tck/src/main/resources/tests/getHeroWithItems/input.graphql rename to server/tck/src/main/resources/tests/getHeroWithItems/input.graphql diff --git a/tck/src/main/resources/tests/getHeroWithItems/output.json b/server/tck/src/main/resources/tests/getHeroWithItems/output.json similarity index 100% rename from tck/src/main/resources/tests/getHeroWithItems/output.json rename to server/tck/src/main/resources/tests/getHeroWithItems/output.json diff --git a/tck/src/main/resources/tests/getHeroWithItems/test.properties b/server/tck/src/main/resources/tests/getHeroWithItems/test.properties similarity index 100% rename from tck/src/main/resources/tests/getHeroWithItems/test.properties rename to server/tck/src/main/resources/tests/getHeroWithItems/test.properties diff --git a/tck/src/main/resources/tests/importantDates/cleanup.graphql b/server/tck/src/main/resources/tests/importantDates/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/importantDates/cleanup.graphql rename to server/tck/src/main/resources/tests/importantDates/cleanup.graphql diff --git a/tck/src/main/resources/tests/importantDates/input.graphql b/server/tck/src/main/resources/tests/importantDates/input.graphql similarity index 100% rename from tck/src/main/resources/tests/importantDates/input.graphql rename to server/tck/src/main/resources/tests/importantDates/input.graphql diff --git a/tck/src/main/resources/tests/importantDates/output.json b/server/tck/src/main/resources/tests/importantDates/output.json similarity index 100% rename from tck/src/main/resources/tests/importantDates/output.json rename to server/tck/src/main/resources/tests/importantDates/output.json diff --git a/tck/src/main/resources/tests/importantDates/test.properties b/server/tck/src/main/resources/tests/importantDates/test.properties similarity index 100% rename from tck/src/main/resources/tests/importantDates/test.properties rename to server/tck/src/main/resources/tests/importantDates/test.properties diff --git a/tck/src/main/resources/tests/importantDatesUS/cleanup.graphql b/server/tck/src/main/resources/tests/importantDatesUS/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/importantDatesUS/cleanup.graphql rename to server/tck/src/main/resources/tests/importantDatesUS/cleanup.graphql diff --git a/tck/src/main/resources/tests/importantDatesUS/input.graphql b/server/tck/src/main/resources/tests/importantDatesUS/input.graphql similarity index 100% rename from tck/src/main/resources/tests/importantDatesUS/input.graphql rename to server/tck/src/main/resources/tests/importantDatesUS/input.graphql diff --git a/tck/src/main/resources/tests/importantDatesUS/output.json b/server/tck/src/main/resources/tests/importantDatesUS/output.json similarity index 100% rename from tck/src/main/resources/tests/importantDatesUS/output.json rename to server/tck/src/main/resources/tests/importantDatesUS/output.json diff --git a/tck/src/main/resources/tests/importantDatesUS/test.properties b/server/tck/src/main/resources/tests/importantDatesUS/test.properties similarity index 100% rename from tck/src/main/resources/tests/importantDatesUS/test.properties rename to server/tck/src/main/resources/tests/importantDatesUS/test.properties diff --git a/tck/src/main/resources/tests/jsonbProps/input.graphql b/server/tck/src/main/resources/tests/jsonbProps/input.graphql similarity index 100% rename from tck/src/main/resources/tests/jsonbProps/input.graphql rename to server/tck/src/main/resources/tests/jsonbProps/input.graphql diff --git a/tck/src/main/resources/tests/jsonbProps/output.json b/server/tck/src/main/resources/tests/jsonbProps/output.json similarity index 100% rename from tck/src/main/resources/tests/jsonbProps/output.json rename to server/tck/src/main/resources/tests/jsonbProps/output.json diff --git a/tck/src/main/resources/tests/jsonbProps/test.properties b/server/tck/src/main/resources/tests/jsonbProps/test.properties similarity index 100% rename from tck/src/main/resources/tests/jsonbProps/test.properties rename to server/tck/src/main/resources/tests/jsonbProps/test.properties diff --git a/tck/src/main/resources/tests/kidsAges/cleanup.graphql b/server/tck/src/main/resources/tests/kidsAges/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/kidsAges/cleanup.graphql rename to server/tck/src/main/resources/tests/kidsAges/cleanup.graphql diff --git a/tck/src/main/resources/tests/kidsAges/input.graphql b/server/tck/src/main/resources/tests/kidsAges/input.graphql similarity index 100% rename from tck/src/main/resources/tests/kidsAges/input.graphql rename to server/tck/src/main/resources/tests/kidsAges/input.graphql diff --git a/tck/src/main/resources/tests/kidsAges/output.json b/server/tck/src/main/resources/tests/kidsAges/output.json similarity index 100% rename from tck/src/main/resources/tests/kidsAges/output.json rename to server/tck/src/main/resources/tests/kidsAges/output.json diff --git a/tck/src/main/resources/tests/kidsAges/test.properties b/server/tck/src/main/resources/tests/kidsAges/test.properties similarity index 100% rename from tck/src/main/resources/tests/kidsAges/test.properties rename to server/tck/src/main/resources/tests/kidsAges/test.properties diff --git a/tck/src/main/resources/tests/location/cleanup.graphql b/server/tck/src/main/resources/tests/location/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/location/cleanup.graphql rename to server/tck/src/main/resources/tests/location/cleanup.graphql diff --git a/tck/src/main/resources/tests/location/input.graphql b/server/tck/src/main/resources/tests/location/input.graphql similarity index 100% rename from tck/src/main/resources/tests/location/input.graphql rename to server/tck/src/main/resources/tests/location/input.graphql diff --git a/tck/src/main/resources/tests/location/output.json b/server/tck/src/main/resources/tests/location/output.json similarity index 100% rename from tck/src/main/resources/tests/location/output.json rename to server/tck/src/main/resources/tests/location/output.json diff --git a/tck/src/main/resources/tests/location/test.properties b/server/tck/src/main/resources/tests/location/test.properties similarity index 100% rename from tck/src/main/resources/tests/location/test.properties rename to server/tck/src/main/resources/tests/location/test.properties diff --git a/tck/src/main/resources/tests/locationArray/cleanup.graphql b/server/tck/src/main/resources/tests/locationArray/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/locationArray/cleanup.graphql rename to server/tck/src/main/resources/tests/locationArray/cleanup.graphql diff --git a/tck/src/main/resources/tests/locationArray/input.graphql b/server/tck/src/main/resources/tests/locationArray/input.graphql similarity index 100% rename from tck/src/main/resources/tests/locationArray/input.graphql rename to server/tck/src/main/resources/tests/locationArray/input.graphql diff --git a/tck/src/main/resources/tests/locationArray/output.json b/server/tck/src/main/resources/tests/locationArray/output.json similarity index 100% rename from tck/src/main/resources/tests/locationArray/output.json rename to server/tck/src/main/resources/tests/locationArray/output.json diff --git a/tck/src/main/resources/tests/locationArray/test.properties b/server/tck/src/main/resources/tests/locationArray/test.properties similarity index 100% rename from tck/src/main/resources/tests/locationArray/test.properties rename to server/tck/src/main/resources/tests/locationArray/test.properties diff --git a/tck/src/main/resources/tests/locationLongLat/cleanup.graphql b/server/tck/src/main/resources/tests/locationLongLat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/locationLongLat/cleanup.graphql rename to server/tck/src/main/resources/tests/locationLongLat/cleanup.graphql diff --git a/tck/src/main/resources/tests/locationLongLat/input.graphql b/server/tck/src/main/resources/tests/locationLongLat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/locationLongLat/input.graphql rename to server/tck/src/main/resources/tests/locationLongLat/input.graphql diff --git a/tck/src/main/resources/tests/locationLongLat/output.json b/server/tck/src/main/resources/tests/locationLongLat/output.json similarity index 100% rename from tck/src/main/resources/tests/locationLongLat/output.json rename to server/tck/src/main/resources/tests/locationLongLat/output.json diff --git a/tck/src/main/resources/tests/locationLongLat/test.properties b/server/tck/src/main/resources/tests/locationLongLat/test.properties similarity index 100% rename from tck/src/main/resources/tests/locationLongLat/test.properties rename to server/tck/src/main/resources/tests/locationLongLat/test.properties diff --git a/tck/src/main/resources/tests/locationLongLatArray/cleanup.graphql b/server/tck/src/main/resources/tests/locationLongLatArray/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/locationLongLatArray/cleanup.graphql rename to server/tck/src/main/resources/tests/locationLongLatArray/cleanup.graphql diff --git a/tck/src/main/resources/tests/locationLongLatArray/input.graphql b/server/tck/src/main/resources/tests/locationLongLatArray/input.graphql similarity index 100% rename from tck/src/main/resources/tests/locationLongLatArray/input.graphql rename to server/tck/src/main/resources/tests/locationLongLatArray/input.graphql diff --git a/tck/src/main/resources/tests/locationLongLatArray/output.json b/server/tck/src/main/resources/tests/locationLongLatArray/output.json similarity index 100% rename from tck/src/main/resources/tests/locationLongLatArray/output.json rename to server/tck/src/main/resources/tests/locationLongLatArray/output.json diff --git a/tck/src/main/resources/tests/locationLongLatArray/test.properties b/server/tck/src/main/resources/tests/locationLongLatArray/test.properties similarity index 100% rename from tck/src/main/resources/tests/locationLongLatArray/test.properties rename to server/tck/src/main/resources/tests/locationLongLatArray/test.properties diff --git a/server/tck/src/main/resources/tests/nameTests.csv b/server/tck/src/main/resources/tests/nameTests.csv new file mode 100644 index 00000000..e98d69b2 --- /dev/null +++ b/server/tck/src/main/resources/tests/nameTests.csv @@ -0,0 +1,14 @@ +# Tests for @Name & @JsonbProperty +1| type Person | lastName: String | Expecting field lastName on type Person +2| input Person | lastName: String | Expecting field lastName on input PersonInput +3| type Person | firstName: String | Expecting field firstName on type Person +4| input Person | forename: String | Expecting field forename on input PersonInput +5| type Person | birth: Date | Expecting field birth on type Person +6| input Person | birthDay: Date | Expecting field birthDay on input PersonInput + +7| type JsonbPerson | lastName: String | Expecting field lastName on type JsonbPerson +8| input JsonbPerson | lastName: String | Expecting field lastName on input JsonbPersonInput +9| type JsonbPerson | firstName: String | Expecting field firstName on type JsonbPerson +10| input JsonbPerson | forename: String | Expecting field forename on input JsonbPersonInput +11| type JsonbPerson | birth: Date | Expecting field birth on type JsonbPerson +12| input JsonbPerson | birthDay: Date | Expecting field birthDay on input JsonbPersonInput diff --git a/tck/src/main/resources/tests/networth/cleanup.graphql b/server/tck/src/main/resources/tests/networth/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/networth/cleanup.graphql rename to server/tck/src/main/resources/tests/networth/cleanup.graphql diff --git a/tck/src/main/resources/tests/networth/input.graphql b/server/tck/src/main/resources/tests/networth/input.graphql similarity index 100% rename from tck/src/main/resources/tests/networth/input.graphql rename to server/tck/src/main/resources/tests/networth/input.graphql diff --git a/tck/src/main/resources/tests/networth/output.json b/server/tck/src/main/resources/tests/networth/output.json similarity index 100% rename from tck/src/main/resources/tests/networth/output.json rename to server/tck/src/main/resources/tests/networth/output.json diff --git a/tck/src/main/resources/tests/networth/test.properties b/server/tck/src/main/resources/tests/networth/test.properties similarity index 100% rename from tck/src/main/resources/tests/networth/test.properties rename to server/tck/src/main/resources/tests/networth/test.properties diff --git a/tck/src/main/resources/tests/networthUSD/cleanup.graphql b/server/tck/src/main/resources/tests/networthUSD/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/networthUSD/cleanup.graphql rename to server/tck/src/main/resources/tests/networthUSD/cleanup.graphql diff --git a/tck/src/main/resources/tests/networthUSD/input.graphql b/server/tck/src/main/resources/tests/networthUSD/input.graphql similarity index 100% rename from tck/src/main/resources/tests/networthUSD/input.graphql rename to server/tck/src/main/resources/tests/networthUSD/input.graphql diff --git a/tck/src/main/resources/tests/networthUSD/output.json b/server/tck/src/main/resources/tests/networthUSD/output.json similarity index 100% rename from tck/src/main/resources/tests/networthUSD/output.json rename to server/tck/src/main/resources/tests/networthUSD/output.json diff --git a/tck/src/main/resources/tests/networthUSD/test.properties b/server/tck/src/main/resources/tests/networthUSD/test.properties similarity index 100% rename from tck/src/main/resources/tests/networthUSD/test.properties rename to server/tck/src/main/resources/tests/networthUSD/test.properties diff --git a/tck/src/main/resources/tests/nonNullTests.csv b/server/tck/src/main/resources/tests/nonNullTests.csv similarity index 100% rename from tck/src/main/resources/tests/nonNullTests.csv rename to server/tck/src/main/resources/tests/nonNullTests.csv diff --git a/tck/src/main/resources/tests/nullField/cleanup.graphql b/server/tck/src/main/resources/tests/nullField/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/nullField/cleanup.graphql rename to server/tck/src/main/resources/tests/nullField/cleanup.graphql diff --git a/tck/src/main/resources/tests/nullField/input.graphql b/server/tck/src/main/resources/tests/nullField/input.graphql similarity index 100% rename from tck/src/main/resources/tests/nullField/input.graphql rename to server/tck/src/main/resources/tests/nullField/input.graphql diff --git a/tck/src/main/resources/tests/nullField/output.json b/server/tck/src/main/resources/tests/nullField/output.json similarity index 100% rename from tck/src/main/resources/tests/nullField/output.json rename to server/tck/src/main/resources/tests/nullField/output.json diff --git a/tck/src/main/resources/tests/nullField/prepare.graphql b/server/tck/src/main/resources/tests/nullField/prepare.graphql similarity index 100% rename from tck/src/main/resources/tests/nullField/prepare.graphql rename to server/tck/src/main/resources/tests/nullField/prepare.graphql diff --git a/tck/src/main/resources/tests/nullField/test.properties b/server/tck/src/main/resources/tests/nullField/test.properties similarity index 100% rename from tck/src/main/resources/tests/nullField/test.properties rename to server/tck/src/main/resources/tests/nullField/test.properties diff --git a/server/tck/src/main/resources/tests/referencedTypeTests.csv b/server/tck/src/main/resources/tests/referencedTypeTests.csv new file mode 100644 index 00000000..57e06e03 --- /dev/null +++ b/server/tck/src/main/resources/tests/referencedTypeTests.csv @@ -0,0 +1,7 @@ +# Referenced Type Tests +1| type ReferencingType | referencedType: ReferencedType | Expecting field referencedType in type ReferencingType +2| type ReferencingType | nonNullReferencedType: ReferencedType! | Expecting field nonNullReferencedType in type ReferencingType +3| type ReferencedType | value: String | Expecting field value in type ReferencedType +4| input ReferencingTypeInput | referencedType: ReferencedTypeInput | Expecting field referencedType in input ReferencingTypeInput +5| input ReferencingTypeInput | nonNullReferencedType: ReferencedTypeInput! | Expecting field nonNullReferencedType in input ReferencingTypeInput +6| input ReferencedTypeInput | value: String | Expecting field value in input ReferencingTypeInput diff --git a/tck/src/main/resources/tests/removeHero/cleanup.graphql b/server/tck/src/main/resources/tests/removeHero/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/removeHero/cleanup.graphql rename to server/tck/src/main/resources/tests/removeHero/cleanup.graphql diff --git a/tck/src/main/resources/tests/removeHero/input.graphql b/server/tck/src/main/resources/tests/removeHero/input.graphql similarity index 100% rename from tck/src/main/resources/tests/removeHero/input.graphql rename to server/tck/src/main/resources/tests/removeHero/input.graphql diff --git a/tck/src/main/resources/tests/removeHero/output.json b/server/tck/src/main/resources/tests/removeHero/output.json similarity index 100% rename from tck/src/main/resources/tests/removeHero/output.json rename to server/tck/src/main/resources/tests/removeHero/output.json diff --git a/tck/src/main/resources/tests/removeHero/test.properties b/server/tck/src/main/resources/tests/removeHero/test.properties similarity index 100% rename from tck/src/main/resources/tests/removeHero/test.properties rename to server/tck/src/main/resources/tests/removeHero/test.properties diff --git a/tck/src/main/resources/tests/removeHeroFromTeam/cleanup.graphql b/server/tck/src/main/resources/tests/removeHeroFromTeam/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/removeHeroFromTeam/cleanup.graphql rename to server/tck/src/main/resources/tests/removeHeroFromTeam/cleanup.graphql diff --git a/tck/src/main/resources/tests/removeHeroFromTeam/input.graphql b/server/tck/src/main/resources/tests/removeHeroFromTeam/input.graphql similarity index 100% rename from tck/src/main/resources/tests/removeHeroFromTeam/input.graphql rename to server/tck/src/main/resources/tests/removeHeroFromTeam/input.graphql diff --git a/tck/src/main/resources/tests/removeHeroFromTeam/output.json b/server/tck/src/main/resources/tests/removeHeroFromTeam/output.json similarity index 100% rename from tck/src/main/resources/tests/removeHeroFromTeam/output.json rename to server/tck/src/main/resources/tests/removeHeroFromTeam/output.json diff --git a/tck/src/main/resources/tests/removeHeroFromTeam/test.properties b/server/tck/src/main/resources/tests/removeHeroFromTeam/test.properties similarity index 100% rename from tck/src/main/resources/tests/removeHeroFromTeam/test.properties rename to server/tck/src/main/resources/tests/removeHeroFromTeam/test.properties diff --git a/tck/src/main/resources/tests/schemaTests.csv b/server/tck/src/main/resources/tests/schemaTests.csv similarity index 52% rename from tck/src/main/resources/tests/schemaTests.csv rename to server/tck/src/main/resources/tests/schemaTests.csv index a698c710..b58b74f9 100644 --- a/tck/src/main/resources/tests/schemaTests.csv +++ b/server/tck/src/main/resources/tests/schemaTests.csv @@ -30,70 +30,87 @@ 19| enum ShirtSize | HULK | Missing expected enum value, "HULK" # testDateScalarUsedForLocalDate -20|input SuperHeroInput| dateOfLastCheckin: Date | Missing or incorrect Scalar type in "SuperHeroInput" field "dateOfLastCheckin" -21|type SuperHero | dateOfLastCheckin: Date | Missing or incorrect Scalar type in "SuperHero" field "dateOfLastCheckin" +20|input SuperHeroInput| !dateOfLastCheckin: Date | Transformed Date Scalar type in "SuperHeroInput" field "dateOfLastCheckin" should not be Date +21|type SuperHero | !dateOfLastCheckin: Date | Transformed Date Scalar type in "SuperHero" field "dateOfLastCheckin" should not be Date +22|input SuperHeroInput| dateOfLastCheckin: String 'OR' dateOfLastCheckin: | Missing or incorrect Scalar type in "SuperHeroInput" field "dateOfLastCheckin" +23|type SuperHero | dateOfLastCheckin: String 'OR' dateOfLastCheckin: | Missing or incorrect Scalar type in "SuperHero" field "dateOfLastCheckin" # testTimeScalarUsedForLocalTime -22|input SuperHeroInput| patrolStartTime: Time | Missing or incorrect Scalar type in "SuperHeroInput" field "patrolStartTime" -23|type SuperHero | patrolStartTime: Time | Missing or incorrect Scalar type in "SuperHero" field "patrolStartTime" +24|input SuperHeroInput| !patrolStartTime: Time | Transformed Time Scalar type in "SuperHeroInput" field "patrolStartTime" should not be Time +25|type SuperHero | !patrolStartTime: Time | Transformed Time Scalar type in "SuperHero" field "patrolStartTime" should not be Time +26|input SuperHeroInput| patrolStartTime: String 'OR' patrolStartTime: | Missing or incorrect Scalar type in "SuperHeroInput" field "patrolStartTime" +27|type SuperHero | patrolStartTime: String 'OR' patrolStartTime: | Missing or incorrect Scalar type in "SuperHero" field "patrolStartTime" # testDateTimeScalarUsedForLocalDateTime -24|input SuperHeroInput| timeOfLastBattle: DateTime | Missing or incorrect Scalar type in "SuperHeroInput" field "timeOfLastBattle" -25|type SuperHero | timeOfLastBattle: DateTime | Missing or incorrect Scalar type in "SuperHero" field "timeOfLastBattle" +28|input SuperHeroInput| !timeOfLastBattle: DateTime | Transformed DateTime Scalar type in "SuperHeroInput" field "timeOfLastBattle" should not be DateTime +29|type SuperHero | !timeOfLastBattle: DateTime | Transformed DateTime Scalar type in "SuperHero" field "timeOfLastBattle" should not be DateTime +30|input SuperHeroInput| timeOfLastBattle: String 'OR' timeOfLastBattle: | Missing or incorrect Scalar type in "SuperHeroInput" field "timeOfLastBattle" +31|type SuperHero | timeOfLastBattle: String 'OR' timeOfLastBattle: | Missing or incorrect Scalar type in "SuperHero" field "timeOfLastBattle" # testSchemaContainsDescriptionForQueryMethods -26|type Query | "List all super heroes in the database" | Missing description on Query Method +32|type Query | "List all super heroes in the database" | Missing description on Query Method # testSchemaContainsDescriptionForMutationMethods -27|type Mutation | "Removes a hero... permanently..." | Missing description on Mutation Method +33|type Mutation | "Removes a hero... permanently..." | Missing description on Mutation Method # testSchemaContainsDescriptionForEntityTypes -28| | "Something of use to a super hero" | Missing description on Entity type +34| | "Something of use to a super hero" | Missing description on Entity type # testSchemaContainsDescriptionForInputTypes # testSchemaContainsDescriptionForArguments -29|type Query | "Super hero name, not real name" | Missing description on Query Argument +35|type Query | "Super hero name, not real name" | Missing description on Query Argument # testSchemaContainsDescriptionForOutputTypeFields -30|type SuperHero | "Super hero name/nickname" | Missing description on Output Type -31|type SuperHero | "Location where you are most likely to find this hero" | Missing description on Output Type +36|type SuperHero | "Super hero name/nickname" | Missing description on Output Type +37|type SuperHero | "Location where you are most likely to find this hero" | Missing description on Output Type # testSchemaContainsDescriptionForInputTypeFields -32|input SuperHeroInput| "Super hero name/nickname" | Missing description on Input Type -33|input SuperHeroInput| "Powers that make this hero super" | Missing description on Input Type +38|input SuperHeroInput| "Super hero name/nickname" | Missing description on Input Type +39|input SuperHeroInput| "Powers that make this hero super" | Missing description on Input Type # testSchemaOutputTypeFieldsContainsDescriptionFromJsonbDateFormat -34|type SuperHero | "MM/dd/yyyy" | Missing Date Format description on Output Type -35|type SuperHero | "HH:mm" | Missing Time Format description on Output Type -36|type SuperHero | "HH:mm:ss dd-MM-yyyy" | Missing DateTime Format description on Output Type +40|type SuperHero | "MM/dd/yyyy" | Missing Date Format description on Output Type +41|type SuperHero | "HH:mm" | Missing Time Format description on Output Type +42|type SuperHero | "HH:mm:ss dd-MM-yyyy" | Missing DateTime Format description on Output Type # testSchemaInputTypeFieldsContainsDescriptionFromJsonbDateFormat -37|input SuperHeroInput| "MM/dd/yyyy" | Missing Date Format description on Input Type -38|input SuperHeroInput| "HH:mm" | Missing Time Format description on Input Type -39|input SuperHeroInput| "HH:mm:ss dd-MM-yyyy" | Missing DateTime Format description on Input Type +43|input SuperHeroInput| "MM/dd/yyyy" | Missing Date Format description on Input Type +44|input SuperHeroInput| "HH:mm" | Missing Time Format description on Input Type +45|input SuperHeroInput| "HH:mm:ss dd-MM-yyyy" | Missing DateTime Format description on Input Type # testSchemaContainsDefaultValueOnEntityField -40|input ItemInput | supernatural: Boolean = false | Missing default value in Input boolean field +46|input ItemInput | supernatural: Boolean = false | Missing default value in Input boolean field # testSchemaContainsDefaultValueOnEntitySetter -41|input ItemInput | description: String = "An unidentified item" | Missing default value in Input String field +47|input ItemInput | description: String = "An unidentified item" | Missing default value in Input String field # testWithArgumentNameAndDefaultValue -42|type Query | allHeroesIn(city: String = "New York, NY"): [SuperHero] | Missing default value on argument -43|type Query | allHeroesInTeam(team: String): [SuperHero] | Missing argument on Query +48|type Query | allHeroesIn(city: String = "New York, NY"): [SuperHero] | Missing default value on argument +49|type Query | allHeroesInTeam(team: String): [SuperHero] | Missing argument on Query # testSourceFieldInType -44|type SuperHero | currentLocation: String | Expecting a currentLocation field in SuperHero due to Source annotation -45|type Query | currentLocation(superHero: SuperHeroInput): String | Expecting a currentLocation query in Query to Source annotation -46|type SuperHero | secretToken(maskFirstPart: Boolean = true): TopSecretToken | Expecting a secretToken field with a boolean argument in SuperHero due to Source annotation -47|type Query | !secretToken(maskFirstPart: Boolean = true): TopSecretToken | Not expecting a secretToken query in Query -48|type TopSecretToken | value: String | Expecting a TopSecretToken type, with a String value field +50|type SuperHero | currentLocation: String | Expecting a currentLocation field in SuperHero due to Source annotation +51|type Query | currentLocation(superHero: SuperHeroInput): String | Expecting a currentLocation query in Query to Source annotation +52|type SuperHero | secretToken(maskFirstPart: Boolean = true): TopSecretToken | Expecting a secretToken field with a boolean argument in SuperHero due to Source annotation +53|type Query | !secretToken(maskFirstPart: Boolean = true): TopSecretToken | Not expecting a secretToken query in Query +54|type TopSecretToken | value: String | Expecting a TopSecretToken type, with a String value field # testGetAndSetNotGetterAndSetter -49|type Query | getaway: String | Expecting a getaway query where the get is not removed -50|type Mutation | settlement: String | Expecting a settlement mutation where the set is not removed +55|type Query | getaway: String | Expecting a getaway query where the get is not removed +56|type Mutation | settlement: String | Expecting a settlement mutation where the set is not removed # testDescription -51|type Query | "Testing the blacklist of Checked Exceptions" | Expecting a description for the exportToFile query -52|type Query | "Super hero name, not real name" | Expecting a description for the name parameter on the exportToFile query \ No newline at end of file +57|type Query | "Testing the hideErrorMessage list of Checked Exceptions" | Expecting a description for the exportToFile query +58|type Query | "Super hero name, not real name" | Expecting a description for the name parameter on the exportToFile query + +# testJsonDefault +59|type Mutation | provisionHero(hero: String, item: ItemInput = { | Expecting a default value for item for provisionHero +60|type Mutation | id : 1000 | Expecting an id in the default value for item for provisionHero +61|type Mutation | name : "Cape" | Expecting a name in the default value for item for provisionHero +62|type Mutation | powerLevel : 3 | Expecting a powerLevel in the default value for item for provisionHero +63|type Mutation | height : 1.2 | Expecting a height in the default value for item for provisionHero +64|type Mutation | weight : 0.3 | Expecting a weight in the default value for item for provisionHero +65|type Mutation | supernatural : false | Expecting a supernatural in the default value for item for provisionHero +66|type Mutation | dateCreated : "19 February 1900 at 12:00 in Africa/Johannesburg" | Expecting a dateCreated in the default value for item for provisionHero +67|type Mutation | dateLastUsed : "29 Jan 2020 at 09:45 in zone +0200" | Expecting a dateLastUsed in the default value for item for provisionHero diff --git a/tck/src/main/resources/tests/setIdNumber/cleanup.graphql b/server/tck/src/main/resources/tests/setIdNumber/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/setIdNumber/cleanup.graphql rename to server/tck/src/main/resources/tests/setIdNumber/cleanup.graphql diff --git a/tck/src/main/resources/tests/setIdNumber/input.graphql b/server/tck/src/main/resources/tests/setIdNumber/input.graphql similarity index 100% rename from tck/src/main/resources/tests/setIdNumber/input.graphql rename to server/tck/src/main/resources/tests/setIdNumber/input.graphql diff --git a/tck/src/main/resources/tests/setIdNumber/output.json b/server/tck/src/main/resources/tests/setIdNumber/output.json similarity index 100% rename from tck/src/main/resources/tests/setIdNumber/output.json rename to server/tck/src/main/resources/tests/setIdNumber/output.json diff --git a/tck/src/main/resources/tests/setIdNumber/test.properties b/server/tck/src/main/resources/tests/setIdNumber/test.properties similarity index 100% rename from tck/src/main/resources/tests/setIdNumber/test.properties rename to server/tck/src/main/resources/tests/setIdNumber/test.properties diff --git a/tck/src/main/resources/tests/setIdNumberWithFormat/cleanup.graphql b/server/tck/src/main/resources/tests/setIdNumberWithFormat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/setIdNumberWithFormat/cleanup.graphql rename to server/tck/src/main/resources/tests/setIdNumberWithFormat/cleanup.graphql diff --git a/tck/src/main/resources/tests/setIdNumberWithFormat/input.graphql b/server/tck/src/main/resources/tests/setIdNumberWithFormat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/setIdNumberWithFormat/input.graphql rename to server/tck/src/main/resources/tests/setIdNumberWithFormat/input.graphql diff --git a/tck/src/main/resources/tests/setIdNumberWithFormat/output.json b/server/tck/src/main/resources/tests/setIdNumberWithFormat/output.json similarity index 100% rename from tck/src/main/resources/tests/setIdNumberWithFormat/output.json rename to server/tck/src/main/resources/tests/setIdNumberWithFormat/output.json diff --git a/tck/src/main/resources/tests/setIdNumberWithFormat/test.properties b/server/tck/src/main/resources/tests/setIdNumberWithFormat/test.properties similarity index 100% rename from tck/src/main/resources/tests/setIdNumberWithFormat/test.properties rename to server/tck/src/main/resources/tests/setIdNumberWithFormat/test.properties diff --git a/tck/src/main/resources/tests/setRivalTeam/cleanup.graphql b/server/tck/src/main/resources/tests/setRivalTeam/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/setRivalTeam/cleanup.graphql rename to server/tck/src/main/resources/tests/setRivalTeam/cleanup.graphql diff --git a/tck/src/main/resources/tests/setRivalTeam/input.graphql b/server/tck/src/main/resources/tests/setRivalTeam/input.graphql similarity index 100% rename from tck/src/main/resources/tests/setRivalTeam/input.graphql rename to server/tck/src/main/resources/tests/setRivalTeam/input.graphql diff --git a/tck/src/main/resources/tests/setRivalTeam/output.json b/server/tck/src/main/resources/tests/setRivalTeam/output.json similarity index 100% rename from tck/src/main/resources/tests/setRivalTeam/output.json rename to server/tck/src/main/resources/tests/setRivalTeam/output.json diff --git a/tck/src/main/resources/tests/setRivalTeam/test.properties b/server/tck/src/main/resources/tests/setRivalTeam/test.properties similarity index 100% rename from tck/src/main/resources/tests/setRivalTeam/test.properties rename to server/tck/src/main/resources/tests/setRivalTeam/test.properties diff --git a/server/tck/src/main/resources/tests/sourceSchemaTests.csv b/server/tck/src/main/resources/tests/sourceSchemaTests.csv new file mode 100644 index 00000000..a7385b61 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceSchemaTests.csv @@ -0,0 +1,10 @@ +# SourceTypes +1| type Query | source: SourceType | Expecting field source in Query +2| type SourceType | stringInput(input: String): String | Expecting field stringInput with parameter input in SourceType +3| type SourceType | nonNullStringInput(input: String!): String | Expecting field nonNullStringInput with non-null parameter input in SourceType +4| type SourceType | defaultStringInput(input: String = "Default value"): String | Expecting field defaultStringInput with parameter input in SourceType +5| type SourceType | ´dateInput( + "yyyy-MM-dd" + input: String + ): String´ | Expecting field dateInput with parameter input in SourceType +6| type SourceType | namedStringInput(in: String): String | Expecting field defaultStringInput with parameter `in` in SourceType diff --git a/server/tck/src/main/resources/tests/sourceWithDateInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithDateInput/input.graphql new file mode 100644 index 00000000..4e485b7b --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithDateInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithDateInput { + source { + dateInput(input: "2011-12-03") + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithDateInput/output.json b/server/tck/src/main/resources/tests/sourceWithDateInput/output.json new file mode 100644 index 00000000..85fbd641 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithDateInput/output.json @@ -0,0 +1,7 @@ +{ + "data": { + "source": { + "dateInput": "Input was: 2011-12-03" + } + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/input.graphql new file mode 100644 index 00000000..6c49f12b --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithDefaultStringInput { + source { + defaultStringInput + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/output.json b/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/output.json new file mode 100644 index 00000000..e8e6bb2f --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithDefaultStringInput/output.json @@ -0,0 +1,7 @@ +{ + "data": { + "source": { + "defaultStringInput": "Input was: Default value" + } + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullDateInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithNullDateInput/input.graphql new file mode 100644 index 00000000..c734c490 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullDateInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithNullDateInput { + source { + dateInput + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullDateInput/output.json b/server/tck/src/main/resources/tests/sourceWithNullDateInput/output.json new file mode 100644 index 00000000..8a3cd095 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullDateInput/output.json @@ -0,0 +1,7 @@ +{ + "data": { + "source": { + "dateInput": "Input was: null" + } + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/input.graphql new file mode 100644 index 00000000..7b0c97b2 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithNullOnNonNullStringInput { + source { + nonNullStringInput + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/output.json b/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/output.json new file mode 100644 index 00000000..7a47c1ea --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullOnNonNullStringInput/output.json @@ -0,0 +1,23 @@ +{ + "data": null, + "errors": [ + { + "message": "Validation error of type MissingFieldArgument: Missing field argument input @ 'source/nonNullStringInput'", + "locations": [ + { + "line": 3, + "column": 3 + } + ], + "extensions": { + "description": "Missing field argument input", + "validationErrorType": "MissingFieldArgument", + "queryPath": [ + "source", + "nonNullStringInput" + ], + "classification": "ValidationError" + } + } + ] +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullStringInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithNullStringInput/input.graphql new file mode 100644 index 00000000..b5129944 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullStringInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithNullStringInput { + source { + stringInput + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithNullStringInput/output.json b/server/tck/src/main/resources/tests/sourceWithNullStringInput/output.json new file mode 100644 index 00000000..f67e094e --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithNullStringInput/output.json @@ -0,0 +1,7 @@ +{ + "data": { + "source": { + "stringInput": "Input was: null" + } + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithStringInput/input.graphql b/server/tck/src/main/resources/tests/sourceWithStringInput/input.graphql new file mode 100644 index 00000000..a1d209f3 --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithStringInput/input.graphql @@ -0,0 +1,5 @@ +query testSourceWithStringInput { + source { + stringInput(input: "Hello World!") + } +} diff --git a/server/tck/src/main/resources/tests/sourceWithStringInput/output.json b/server/tck/src/main/resources/tests/sourceWithStringInput/output.json new file mode 100644 index 00000000..0f9f0eaa --- /dev/null +++ b/server/tck/src/main/resources/tests/sourceWithStringInput/output.json @@ -0,0 +1,7 @@ +{ + "data": { + "source": { + "stringInput": "Input was: Hello World!" + } + } +} diff --git a/tck/src/main/resources/tests/startPatrolling/cleanup.graphql b/server/tck/src/main/resources/tests/startPatrolling/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/startPatrolling/cleanup.graphql rename to server/tck/src/main/resources/tests/startPatrolling/cleanup.graphql diff --git a/tck/src/main/resources/tests/startPatrolling/input.graphql b/server/tck/src/main/resources/tests/startPatrolling/input.graphql similarity index 100% rename from tck/src/main/resources/tests/startPatrolling/input.graphql rename to server/tck/src/main/resources/tests/startPatrolling/input.graphql diff --git a/tck/src/main/resources/tests/startPatrolling/output.json b/server/tck/src/main/resources/tests/startPatrolling/output.json similarity index 100% rename from tck/src/main/resources/tests/startPatrolling/output.json rename to server/tck/src/main/resources/tests/startPatrolling/output.json diff --git a/tck/src/main/resources/tests/startPatrolling/test.properties b/server/tck/src/main/resources/tests/startPatrolling/test.properties similarity index 100% rename from tck/src/main/resources/tests/startPatrolling/test.properties rename to server/tck/src/main/resources/tests/startPatrolling/test.properties diff --git a/tck/src/main/resources/tests/startPatrollingWithFormat/cleanup.graphql b/server/tck/src/main/resources/tests/startPatrollingWithFormat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/startPatrollingWithFormat/cleanup.graphql rename to server/tck/src/main/resources/tests/startPatrollingWithFormat/cleanup.graphql diff --git a/tck/src/main/resources/tests/startPatrollingWithFormat/input.graphql b/server/tck/src/main/resources/tests/startPatrollingWithFormat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/startPatrollingWithFormat/input.graphql rename to server/tck/src/main/resources/tests/startPatrollingWithFormat/input.graphql diff --git a/tck/src/main/resources/tests/startPatrollingWithFormat/output.json b/server/tck/src/main/resources/tests/startPatrollingWithFormat/output.json similarity index 100% rename from tck/src/main/resources/tests/startPatrollingWithFormat/output.json rename to server/tck/src/main/resources/tests/startPatrollingWithFormat/output.json diff --git a/tck/src/main/resources/tests/startPatrollingWithFormat/test.properties b/server/tck/src/main/resources/tests/startPatrollingWithFormat/test.properties similarity index 100% rename from tck/src/main/resources/tests/startPatrollingWithFormat/test.properties rename to server/tck/src/main/resources/tests/startPatrollingWithFormat/test.properties diff --git a/server/tck/src/main/resources/tests/subtypeTests.csv b/server/tck/src/main/resources/tests/subtypeTests.csv new file mode 100644 index 00000000..7446ec61 --- /dev/null +++ b/server/tck/src/main/resources/tests/subtypeTests.csv @@ -0,0 +1,11 @@ +# SubTypes +1| type SubType | subTypeField: String | Expecting fields from type in OutputType +2| type SubType | parentTypeField: String | Expecting fields from parent in OutputType +3| type SubType | grandParentTypeField: String | Expecting fields from grand-parent in OutputType +4| input SubTypeInput | subTypeField: String | Expecting fields from type in InputType +5| input SubTypeInput | parentTypeField: String | Expecting fields from parent in InputType +6| input SubTypeInput | grandParentTypeField: String | Expecting fields from grand-parent in InputType +7| type SubType | "Field from parent" | Missing description on field from parent +8| type SubType | "Field from grand-parent" | Missing description on field from grand-parent +9| type SubType | nonNullParentField: String! | Expecting non-null field from parent in OutputType +10| input SubTypeInput | nonNullParentField: String! | Expecting non-null field from parent in InputType diff --git a/tck/src/main/resources/tests/track/cleanup.graphql b/server/tck/src/main/resources/tests/track/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/track/cleanup.graphql rename to server/tck/src/main/resources/tests/track/cleanup.graphql diff --git a/tck/src/main/resources/tests/track/input.graphql b/server/tck/src/main/resources/tests/track/input.graphql similarity index 100% rename from tck/src/main/resources/tests/track/input.graphql rename to server/tck/src/main/resources/tests/track/input.graphql diff --git a/tck/src/main/resources/tests/track/output.json b/server/tck/src/main/resources/tests/track/output.json similarity index 100% rename from tck/src/main/resources/tests/track/output.json rename to server/tck/src/main/resources/tests/track/output.json diff --git a/tck/src/main/resources/tests/track/test.properties b/server/tck/src/main/resources/tests/track/test.properties similarity index 100% rename from tck/src/main/resources/tests/track/test.properties rename to server/tck/src/main/resources/tests/track/test.properties diff --git a/tck/src/main/resources/tests/trackLongLat/cleanup.graphql b/server/tck/src/main/resources/tests/trackLongLat/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/trackLongLat/cleanup.graphql rename to server/tck/src/main/resources/tests/trackLongLat/cleanup.graphql diff --git a/tck/src/main/resources/tests/trackLongLat/input.graphql b/server/tck/src/main/resources/tests/trackLongLat/input.graphql similarity index 100% rename from tck/src/main/resources/tests/trackLongLat/input.graphql rename to server/tck/src/main/resources/tests/trackLongLat/input.graphql diff --git a/tck/src/main/resources/tests/trackLongLat/output.json b/server/tck/src/main/resources/tests/trackLongLat/output.json similarity index 100% rename from tck/src/main/resources/tests/trackLongLat/output.json rename to server/tck/src/main/resources/tests/trackLongLat/output.json diff --git a/tck/src/main/resources/tests/trackLongLat/test.properties b/server/tck/src/main/resources/tests/trackLongLat/test.properties similarity index 100% rename from tck/src/main/resources/tests/trackLongLat/test.properties rename to server/tck/src/main/resources/tests/trackLongLat/test.properties diff --git a/tck/src/main/resources/tests/updateItemPowerLevel/cleanup.graphql b/server/tck/src/main/resources/tests/updateItemPowerLevel/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevel/cleanup.graphql rename to server/tck/src/main/resources/tests/updateItemPowerLevel/cleanup.graphql diff --git a/tck/src/main/resources/tests/updateItemPowerLevel/input.graphql b/server/tck/src/main/resources/tests/updateItemPowerLevel/input.graphql similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevel/input.graphql rename to server/tck/src/main/resources/tests/updateItemPowerLevel/input.graphql diff --git a/tck/src/main/resources/tests/updateItemPowerLevel/output.json b/server/tck/src/main/resources/tests/updateItemPowerLevel/output.json similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevel/output.json rename to server/tck/src/main/resources/tests/updateItemPowerLevel/output.json diff --git a/tck/src/main/resources/tests/updateItemPowerLevel/test.properties b/server/tck/src/main/resources/tests/updateItemPowerLevel/test.properties similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevel/test.properties rename to server/tck/src/main/resources/tests/updateItemPowerLevel/test.properties diff --git a/tck/src/main/resources/tests/updateItemPowerLevelPercentage/cleanup.graphql b/server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/cleanup.graphql similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevelPercentage/cleanup.graphql rename to server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/cleanup.graphql diff --git a/tck/src/main/resources/tests/updateItemPowerLevelPercentage/input.graphql b/server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/input.graphql similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevelPercentage/input.graphql rename to server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/input.graphql diff --git a/tck/src/main/resources/tests/updateItemPowerLevelPercentage/output.json b/server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/output.json similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevelPercentage/output.json rename to server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/output.json diff --git a/tck/src/main/resources/tests/updateItemPowerLevelPercentage/test.properties b/server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/test.properties similarity index 100% rename from tck/src/main/resources/tests/updateItemPowerLevelPercentage/test.properties rename to server/tck/src/main/resources/tests/updateItemPowerLevelPercentage/test.properties diff --git a/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/cleanup.graphql b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/cleanup.graphql new file mode 100644 index 00000000..14b22d82 --- /dev/null +++ b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/cleanup.graphql @@ -0,0 +1,5 @@ +mutation removeHero { + removeHero(hero: "Black Panther") { + name + } +} diff --git a/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/input.graphql b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/input.graphql new file mode 100644 index 00000000..afc01baa --- /dev/null +++ b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/input.graphql @@ -0,0 +1,18 @@ +mutation createNewHero { + createNewHero(hero:{ + name: "Black Panther" + realName: "T'Challa" + superPowers: ["Top intellect"] + primaryLocation: "Wakanda, Africa" + teamAffiliations: [{name: "Avengers"}] + idNumber: "ID-98701234", + dateOfBirth: "An unparseable date" + }) { + name + primaryLocation + superPowers + realName + idNumber + birthday + } +} diff --git a/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/output.json b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/output.json new file mode 100644 index 00000000..dbf15830 --- /dev/null +++ b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/output.json @@ -0,0 +1,24 @@ +{ + "errors": [ + { + "message": "Validation error of type WrongType: argument 'dateOfBirth' with value 'StringValue{value='An unparseable date'}' is not a valid 'Date' @ 'createNewHero'", + "locations": [ + { + "line": 2, + "column": 5 + } + ], + "extensions": { + "description": "argument 'dateOfBirth' with value 'StringValue{value='An unparseable date'}' is not a valid 'Date'", + "validationErrorType": "WrongType", + "queryPath": [ + "createNewHero" + ], + "classification": "ValidationError" + } + } + ], + "data": { + "createNewHero": null + } +} diff --git a/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/test.properties b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/test.properties new file mode 100644 index 00000000..b25bcef6 --- /dev/null +++ b/server/tck/src/main/resources/tests/wrongDateFormatInInputObject/test.properties @@ -0,0 +1,2 @@ +ignore=false +priority=200 \ No newline at end of file diff --git a/server/tck/src/test/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParserTest.java b/server/tck/src/test/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParserTest.java new file mode 100644 index 00000000..8cd3e145 --- /dev/null +++ b/server/tck/src/test/java/org/eclipse/microprofile/graphql/tck/dynamic/schema/CsvParserTest.java @@ -0,0 +1,112 @@ +/* + * Copyright 2020 Contributors to the Eclipse Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 org.eclipse.microprofile.graphql.tck.dynamic.schema; + +import java.io.IOException; +import java.io.StringReader; +import java.util.List; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class CsvParserTest { + + @Test + public void shouldHandleDoubleEscape() throws IOException { + String content = "1| union X | ´´ | Should Handle DoubleEscape\n"; + + final List testDate = CsvParser.parse("shouldHandleDoubleEscape", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "´"); + + } + @Test + public void shouldHandleTripleEscape() throws IOException { + String content = "1| union X | ´Test ´´´ | Should Handle TripleEscape\n"; + + final List testDate = CsvParser.parse("shouldHandleTripleEscape", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "Test ´"); + + } + + @Test + public void shouldHandleEscaping() throws IOException { + String content = "1| union X | ´Y | Z´ | Should Handle Escaping\n"; + + final List testDate = CsvParser.parse("shouldHandleEscaping", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "Y | Z"); + Assert.assertEquals(testDate.get(0).getErrorMessage(), "(1) - Should Handle Escaping"); + } + + @Test + public void shouldHandleOr() throws IOException { + String content = "49| type Mutation | " + + "scalarHolder(arg0: ScalarHolderInput): ScalarHolder 'OR' scalarHolder(scalarHolder: ScalarHolderInput): ScalarHolder " + + "| Expecting a Mutation with the set removed from the name, scalarHolder.\n"; + + final List testDate = CsvParser.parse("shouldHandleEscaping", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().size(), 2); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "scalarHolder(arg0: ScalarHolderInput): ScalarHolder"); + Assert.assertEquals(testDate.get(0).getContainsString().get(1), "scalarHolder(scalarHolder: ScalarHolderInput): ScalarHolder"); + } + + @Test + public void shouldHandleMultilineEscaping() throws IOException { + String content = "5| type SourceType | ´dateInput(\n" + + " \"yyyy-MM-dd\"\n" + + " input: Date\n" + + " ): String´ | Expecting field dateInput with parameter input in SourceType\n"; + + final List testDate = CsvParser.parse("shouldHandleEscaping", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "dateInput(\n" + + " \"yyyy-MM-dd\"\n" + + " input: Date\n" + + " ): String"); + } + + @Test + public void shouldIgnoreCommentsInLine() throws IOException { + String content = "59| type ScalarHolder | \"#0.0 en-GB\" | Missing Number Format description on Output Type\n"; + + final List testDate = CsvParser.parse("shouldIgnoreCommentsInLine", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getContainsString().get(0), "\"#0.0 en-GB\""); + } + + @Test + public void shouldHandleComments() throws IOException { + String content = "# Basic Scalar Types\n" + + "1| type ScalarHolder | bigDecimalObject: BigDecimal | Expecting a BigDecimal Scalar Type in type ScalarHolder\n"; + + final List testDate = CsvParser.parse("shouldHandleComments", new StringReader(content)); + + Assert.assertEquals(testDate.size(), 1); + Assert.assertEquals(testDate.get(0).getHeader(), "Basic Scalar Types"); + Assert.assertEquals(testDate.get(0).getCount(), 1); + } +} diff --git a/tck/src/main/resources/META-INF/beans.xml b/tck/src/main/resources/META-INF/beans.xml deleted file mode 100644 index ce21305d..00000000 --- a/tck/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - diff --git a/tck/src/main/resources/tests/getHero/input.graphql b/tck/src/main/resources/tests/getHero/input.graphql deleted file mode 100644 index 1089f711..00000000 --- a/tck/src/main/resources/tests/getHero/input.graphql +++ /dev/null @@ -1,15 +0,0 @@ -{ - superHero(name:"Iron Man") { - - name - primaryLocation - realName - superPowers - teamAffiliations { - name - members{ - name - } - } - } -}