This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3676 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 08dbd629dfd9bab1dae32b55e6de690eba17e0e2 Author: danhaywood <[email protected]> AuthorDate: Thu Feb 22 19:31:14 2024 +0000 CAUSEWAY-3676: wip, still hitting: "Validation error (FieldUndefined@[university_dept_Department]) : Field 'university_dept_Department' in type 'SimpleAndRich' is undefined" --- .../viewer/graphql/model/context/Context.java | 7 +-- .../model/domain/common/SchemaStrategy.java | 17 +++++--- .../domain/common/query/GqlvDomainObject.java | 9 +++- .../domain/common/query/GqlvDomainService.java | 6 ++- .../model/domain/common/query/GvqlActionUtils.java | 8 +--- .../model/domain/rich/SchemaStrategyRich.java | 10 ----- .../rich/mutation/GqlvMutationForAction.java | 3 +- .../rich/mutation/GqlvMutationForProperty.java | 3 +- .../model/domain/rich/query/GqlvAction.java | 3 +- .../model/domain/rich/query/GqlvMetaSaveAs.java | 7 +-- .../model/domain/simple/SchemaStrategySimple.java | 11 ----- .../simple/mutation/GqlvMutationForAction.java | 3 +- .../model/domain/simple/query/GqlvAction.java | 3 +- .../viewer/test/e2e/AbstractDynamic_IntegTest.java | 2 +- .../graphql/viewer/test/e2e/Admin_IntegTest.java | 2 +- .../viewer/test/e2e/Calculator_IntegTest.java | 2 +- .../viewer/test/e2e/Department_IntegTest.java | 2 +- .../viewer/test/e2e/DeptHead_IntegTest.java | 2 +- .../graphql/viewer/test/e2e/People_IntegTest.java | 2 +- .../graphql/viewer/test/e2e/Person_IntegTest.java | 2 +- .../graphql/viewer/test/e2e/Staff_IntegTest.java | 2 +- .../e2e/special/DepartmentMutating_IntegTest.java | 4 +- viewers/graphql/test/src/test/resources/schema.gql | 50 ---------------------- 23 files changed, 47 insertions(+), 113 deletions(-) diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java index 51744b3fd2..c93d45ca76 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/context/Context.java @@ -61,11 +61,8 @@ public class Context { public final GraphQLTypeRegistry graphQLTypeRegistry; - public final Map<ObjectSpecification, GqlvDomainService> richDomainServiceBySpec = new LinkedHashMap<>(); - public final Map<ObjectSpecification, GqlvDomainObject> richDomainObjectBySpec = new LinkedHashMap<>(); - - public final Map<ObjectSpecification, GqlvDomainService> simpleDomainServiceBySpec = new LinkedHashMap<>(); - public final Map<ObjectSpecification, GqlvDomainObject> simpleDomainObjectBySpec = new LinkedHashMap<>(); + public final Map<String, GqlvDomainService> domainServiceByTypeName = new LinkedHashMap<>(); + public final Map<String, GqlvDomainObject> domainObjectByTypeName = new LinkedHashMap<>(); public ImmutableEnumSet<ActionScope> getActionScope() { return causewaySystemEnvironment.getDeploymentType().isProduction() diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java index 64d0a0d4bd..f792ccd9b9 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/SchemaStrategy.java @@ -32,19 +32,18 @@ public interface SchemaStrategy { final Context context) { mapSuperclassesIfNecessary(this, objectSpecification, context); - return this.domainObjectBySpec(context).computeIfAbsent(objectSpecification, spec -> new GqlvDomainObject(this, spec, context)); + val typeNameFor = GqlvDomainObject.typeNameFor(this, objectSpecification); + return context.domainObjectByTypeName.computeIfAbsent(typeNameFor, typeName -> new GqlvDomainObject(this, typeName, objectSpecification, context)); } default GqlvDomainService domainServiceFor( final ObjectSpecification objectSpecification, final Object servicePojo, final Context context) { - return this.domainServiceBySpec(context).computeIfAbsent(objectSpecification, spec -> new GqlvDomainService(this, spec, servicePojo, context)); + val typeNameFor = GqlvDomainService.typeNameFor(this, objectSpecification); + return context.domainServiceByTypeName.computeIfAbsent(typeNameFor, typeName -> new GqlvDomainService(this, typeName, objectSpecification, servicePojo, context)); } - Map<ObjectSpecification, GqlvDomainObject> domainObjectBySpec(Context context); - Map<ObjectSpecification, GqlvDomainService> domainServiceBySpec(Context context); - String topLevelFieldNameFrom(CausewayConfiguration.Viewer.Graphql graphqlConfiguration); @@ -73,11 +72,15 @@ public interface SchemaStrategy { final ObjectSpecification objectSpecification, final Context context) { // no need to map if the target subclass has already been built - if(schemaStrategy.domainObjectBySpec(context).containsKey(objectSpecification)) { + val typeName = GqlvDomainObject.typeNameFor(schemaStrategy, objectSpecification); + if(context.domainObjectByTypeName.containsKey(typeName)) { return; } val superclasses = superclassesOf(objectSpecification); - superclasses.forEach(objectSpec -> schemaStrategy.domainObjectBySpec(context).computeIfAbsent(objectSpec, spec -> new GqlvDomainObject(schemaStrategy, spec, context))); + superclasses.forEach(objectSpec -> { + val typeNameForSuperclass = GqlvDomainObject.typeNameFor(schemaStrategy, objectSpecification); + context.domainObjectByTypeName.computeIfAbsent(typeNameForSuperclass, typeNm -> new GqlvDomainObject(schemaStrategy, typeNm, objectSpecification, context)); + }); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java index bcee9d8177..615a8a2581 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainObject.java @@ -69,11 +69,16 @@ public class GqlvDomainObject @Getter private final GraphQLInputObjectType gqlInputObjectType; + public static String typeNameFor(SchemaStrategy schemaStrategy, ObjectSpecification objectSpecification) { + return TypeNames.objectTypeNameFor(objectSpecification, schemaStrategy.getSchemaType()); + } + public GqlvDomainObject( final SchemaStrategy schemaStrategy, + final String typeName, final ObjectSpecification objectSpecification, final Context context) { - super(TypeNames.objectTypeNameFor(objectSpecification, schemaStrategy.getSchemaType()), context); + super(typeName, context); this.schemaStrategy = schemaStrategy; this.objectSpecification = objectSpecification; @@ -171,7 +176,7 @@ public class GqlvDomainObject @Override protected Object fetchData(DataFetchingEnvironment dataFetchingEnvironment) { Object target = dataFetchingEnvironment.getArgument("object"); - return GvqlActionUtils.asPojo(schemaStrategy, getObjectSpecification(), target, new Environment.For(dataFetchingEnvironment), context) + return GvqlActionUtils.asPojo(getObjectSpecification(), target, new Environment.For(dataFetchingEnvironment), context) .orElse(null); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainService.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainService.java index 347af2d9c8..81817ba0d6 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainService.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GqlvDomainService.java @@ -53,13 +53,17 @@ public class GqlvDomainService private final List<GqlvAbstractCustom> actions = new ArrayList<>(); + public static String typeNameFor(SchemaStrategy schemaStrategy, ObjectSpecification objectSpecification) { + return TypeNames.objectTypeNameFor(objectSpecification, schemaStrategy.getSchemaType()); + } public GqlvDomainService( final SchemaStrategy schemaStrategy, + final String typeName, final ObjectSpecification objectSpecification, final Object servicePojo, final Context context) { - super(TypeNames.objectTypeNameFor(objectSpecification, schemaStrategy.getSchemaType()), context); + super(typeName, context); this.schemaStrategy = schemaStrategy; this.objectSpecification = objectSpecification; diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java index fd53eecbfb..14d4cf0e0a 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/common/query/GvqlActionUtils.java @@ -13,7 +13,6 @@ import org.apache.causeway.core.metamodel.spec.feature.ObjectAction; import org.apache.causeway.core.metamodel.spec.feature.ObjectActionParameter; import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.Environment; -import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; import lombok.val; @@ -21,7 +20,6 @@ import lombok.val; public class GvqlActionUtils { public static Optional<Object> asPojo( - final SchemaStrategy schemaStrategy, final ObjectSpecification elementType, final Object argumentValueObj, final Environment environment, @@ -82,14 +80,12 @@ public class GvqlActionUtils { } /** - * @param schemaStrategy * @param environment * @param objectAction * @param context * @return */ public static Can<ManagedObject> argumentManagedObjectsFor( - SchemaStrategy schemaStrategy, final Environment environment, final ObjectAction objectAction, final Context context) { @@ -119,12 +115,12 @@ public class GvqlActionUtils { if (argumentValue instanceof List) { val argumentValueList = (List<Object>) argumentValue; pojoOrPojoList = argumentValueList.stream() - .map(value -> asPojo(schemaStrategy, oap.getElementType(), value, environment, context)) + .map(value -> asPojo(oap.getElementType(), value, environment, context)) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList()); } else { - pojoOrPojoList = asPojo(schemaStrategy, oap.getElementType(), argumentValue, environment, context).orElse(null); + pojoOrPojoList = asPojo(oap.getElementType(), argumentValue, environment, context).orElse(null); } return ManagedObject.adaptParameter(oap, pojoOrPojoList); diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java index 653c482f57..81ff464708 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/SchemaStrategyRich.java @@ -27,16 +27,6 @@ public class SchemaStrategyRich implements SchemaStrategy { return SchemaType.RICH; } - @Override - public Map<ObjectSpecification, GqlvDomainObject> domainObjectBySpec(Context context) { - return context.richDomainObjectBySpec; - } - - @Override - public Map<ObjectSpecification, GqlvDomainService> domainServiceBySpec(Context context) { - return context.richDomainServiceBySpec; - } - @Override public String topLevelFieldNameFrom(CausewayConfiguration.Viewer.Graphql graphqlConfiguration) { return graphqlConfiguration.getTopLevelFieldNameForRich(); diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForAction.java index ca379fe006..88328fa332 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForAction.java @@ -36,6 +36,7 @@ import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstract; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvAction; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvMetaSaveAs; @@ -159,7 +160,7 @@ public class GqlvMutationForAction extends GqlvAbstract { } else { String refValue = argumentValue.get("ref"); if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); + String key = GvqlActionUtils.keyFor(refValue); BookmarkedPojo value = ((Environment) environment).getGraphQlContext().get(key); result = Optional.of(value).map(BookmarkedPojo::getTargetPojo); } else { diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForProperty.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForProperty.java index 381f3d7432..ad0bdbf784 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForProperty.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/mutation/GqlvMutationForProperty.java @@ -39,6 +39,7 @@ import org.apache.causeway.viewer.graphql.model.domain.Environment; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstract; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.domain.rich.query.GqlvMetaSaveAs; import org.apache.causeway.viewer.graphql.model.exceptions.DisabledException; import org.apache.causeway.viewer.graphql.model.exceptions.HiddenException; @@ -110,7 +111,7 @@ public class GqlvMutationForProperty extends GqlvAbstract { } else { String refValue = argumentValue1.get("ref"); if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); + String key = GvqlActionUtils.keyFor(refValue); BookmarkedPojo value = environment.getGraphQlContext().get(key); result = Optional.of(value).map(BookmarkedPojo::getTargetPojo); } else { diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvAction.java index 5d5dbced1b..fa17c210d1 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvAction.java @@ -41,6 +41,7 @@ import org.apache.causeway.viewer.graphql.model.domain.Parent; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; import org.apache.causeway.viewer.graphql.model.types.TypeMapper; @@ -202,7 +203,7 @@ public class GqlvAction val refValue = argumentValue.get("ref"); if (refValue != null) { - String key = GqlvMetaSaveAs.keyFor(refValue); + String key = GvqlActionUtils.keyFor(refValue); BookmarkedPojo bookmarkedPojo = environment.getGraphQlContext().get(key); if (bookmarkedPojo == null) { throw new IllegalArgumentException(String.format( diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaSaveAs.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaSaveAs.java index b81b58c896..c928a0bfc4 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaSaveAs.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/rich/query/GqlvMetaSaveAs.java @@ -27,6 +27,7 @@ import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; import org.apache.causeway.viewer.graphql.model.context.Context; import org.apache.causeway.viewer.graphql.model.domain.GqlvAbstract; +import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.fetcher.BookmarkedPojo; public class GqlvMetaSaveAs extends GqlvAbstract { @@ -48,7 +49,7 @@ public class GqlvMetaSaveAs extends GqlvAbstract { protected Object fetchData(DataFetchingEnvironment environment) { String ref = environment.getArgument("ref"); GqlvMeta.Fetcher source = environment.getSource(); - String originalKey = keyFor(ref); + String originalKey = GvqlActionUtils.keyFor(ref); GraphQLContext graphQlContext = environment.getGraphQlContext(); // we ensure the key hasn't been used already @@ -61,8 +62,4 @@ public class GqlvMetaSaveAs extends GqlvAbstract { return ref; } - public static String keyFor(String ref) { - return GqlvMetaSaveAs.class.getName() + "#" + ref; - } - } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java index b3ec1ef047..49db064006 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/SchemaStrategySimple.java @@ -18,7 +18,6 @@ import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvCollecti import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvMeta; import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvProperty; -import org.apache.causeway.viewer.graphql.model.domain.simple.query.GqlvTopLevelQuerySimpleSchema; public class SchemaStrategySimple implements SchemaStrategy { @@ -27,16 +26,6 @@ public class SchemaStrategySimple implements SchemaStrategy { return SchemaType.SIMPLE; } - @Override - public Map<ObjectSpecification, GqlvDomainObject> domainObjectBySpec(Context context) { - return context.simpleDomainObjectBySpec; - } - - @Override - public Map<ObjectSpecification, GqlvDomainService> domainServiceBySpec(Context context) { - return context.simpleDomainServiceBySpec; - } - @Override public String topLevelFieldNameFrom(CausewayConfiguration.Viewer.Graphql graphqlConfiguration) { return graphqlConfiguration.getTopLevelFieldNameForSimple(); diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java index ed121368e5..6dd8fcadf7 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/mutation/GqlvMutationForAction.java @@ -32,7 +32,6 @@ import graphql.schema.GraphQLType; import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; -import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.springframework.lang.Nullable; @@ -246,7 +245,7 @@ public class GqlvMutationForAction extends GqlvAbstract { private Can<ManagedObject> argumentManagedObjectsFor( final Environment dataFetchingEnvironment, final ObjectAction objectAction) { - return GvqlActionUtils.argumentManagedObjectsFor(SchemaStrategy.SIMPLE, dataFetchingEnvironment, objectAction, context); + return GvqlActionUtils.argumentManagedObjectsFor(dataFetchingEnvironment, objectAction, context); } diff --git a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java index 068585661a..1d18801e39 100644 --- a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java +++ b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/simple/query/GqlvAction.java @@ -36,7 +36,6 @@ import org.apache.causeway.viewer.graphql.model.domain.Environment; import org.apache.causeway.viewer.graphql.model.domain.Parent; import org.apache.causeway.viewer.graphql.model.domain.SchemaType; import org.apache.causeway.viewer.graphql.model.domain.TypeNames; -import org.apache.causeway.viewer.graphql.model.domain.common.SchemaStrategy; import org.apache.causeway.viewer.graphql.model.domain.common.query.GqlvMemberHolder; import org.apache.causeway.viewer.graphql.model.domain.common.query.GvqlActionUtils; import org.apache.causeway.viewer.graphql.model.types.TypeMapper; @@ -112,7 +111,7 @@ public class GqlvAction final ObjectAction objectAction, final BookmarkService bookmarkService) { - return GvqlActionUtils.argumentManagedObjectsFor(SchemaStrategy.SIMPLE, dataFetchingEnvironment, objectAction, context); + return GvqlActionUtils.argumentManagedObjectsFor(dataFetchingEnvironment, objectAction, context); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/AbstractDynamic_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/AbstractDynamic_IntegTest.java index 4c90826969..9e40b79bd2 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/AbstractDynamic_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/AbstractDynamic_IntegTest.java @@ -48,7 +48,7 @@ public abstract class AbstractDynamic_IntegTest extends Abstract_IntegTest { this("._.gql"); } - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + protected Iterable<DynamicTest> each() throws IOException, URISyntaxException { val integClassName = getClass().getSimpleName(); val classUrl = getClass().getResource(integClassName + ".class"); diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Admin_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Admin_IntegTest.java index e287cfbc31..15ab840000 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Admin_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Admin_IntegTest.java @@ -49,7 +49,7 @@ public class Admin_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java index a6d493b422..75fd0359fc 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java @@ -52,7 +52,7 @@ public class Calculator_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java index 76e7b850d5..6870edcb68 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java @@ -55,7 +55,7 @@ public class Department_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java index 05783aae26..9618bce3a8 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java @@ -53,7 +53,7 @@ public class DeptHead_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/People_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/People_IntegTest.java index 2e076dd0cc..7d170fae3e 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/People_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/People_IntegTest.java @@ -43,7 +43,7 @@ public class People_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Person_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Person_IntegTest.java index 838a9094f8..f4dd8cbb4c 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Person_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Person_IntegTest.java @@ -43,7 +43,7 @@ public class Person_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java index 4241b46adb..2482392b72 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java @@ -63,7 +63,7 @@ public class Staff_IntegTest extends AbstractDynamic_IntegTest { @Override @TestFactory - Iterable<DynamicTest> each() throws IOException, URISyntaxException { + public Iterable<DynamicTest> each() throws IOException, URISyntaxException { return super.each(); } diff --git a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/special/DepartmentMutating_IntegTest.java b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/special/DepartmentMutating_IntegTest.java index 90c54e672d..7ef0731d07 100644 --- a/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/special/DepartmentMutating_IntegTest.java +++ b/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/special/DepartmentMutating_IntegTest.java @@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; import org.springframework.transaction.annotation.Propagation; @@ -43,7 +44,8 @@ import lombok.val; //NOT USING @Transactional since we are running server within same transaction otherwise -@Order(110) +@Order(900) +@DirtiesContext // yucky workaround @ActiveProfiles("test") public class DepartmentMutating_IntegTest extends Abstract_IntegTest { diff --git a/viewers/graphql/test/src/test/resources/schema.gql b/viewers/graphql/test/src/test/resources/schema.gql index d8742a001b..6edae8d604 100644 --- a/viewers/graphql/test/src/test/resources/schema.gql +++ b/viewers/graphql/test/src/test/resources/schema.gql @@ -1665,22 +1665,6 @@ type rich__causeway_schema_metamodel_v2_DomainClassDto__service__gqlv_property { validate(service: Boolean): String } -type rich__causeway_schema_metamodel_v2_FacetHolder { - "Object metadata" - _meta: rich__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta -} - -type rich__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta { - cssClass: String - grid: String - icon: String - id: String! - layout: String - logicalTypeName: String! - saveAs(ref: String): String - title: String! -} - type rich__causeway_security_LoginRedirect { "Object metadata" _meta: rich__causeway_security_LoginRedirect__gqlv_meta @@ -5509,22 +5493,6 @@ type simple__causeway_schema_metamodel_v2_DomainClassDto__service__gqlv_property validate(service: Boolean): String } -type simple__causeway_schema_metamodel_v2_FacetHolder { - "Object metadata" - _meta: simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta -} - -type simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_meta { - cssClass: String - grid: String - icon: String - id: String! - layout: String - logicalTypeName: String! - saveAs(ref: String): String - title: String! -} - type simple__causeway_security_LoginRedirect { "Object metadata" _meta: simple__causeway_security_LoginRedirect__gqlv_meta @@ -8167,15 +8135,6 @@ input rich__causeway_schema_metamodel_v2_DomainClassDto__gqlv_input { ref: String } -input rich__causeway_schema_metamodel_v2_FacetHolder__gqlv_input { - "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" - id: ID - "If object identified by 'id', then optionally specifies concrete type. This is only required if the parameter type defines a super class" - logicalTypeName: String - "Use either 'ref' or 'id'; looks up an object previously saved to the execution context using 'saveAs(ref: ...)'" - ref: String -} - input rich__causeway_security_LoginRedirect__gqlv_input { "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" id: ID @@ -8518,15 +8477,6 @@ input simple__causeway_schema_metamodel_v2_DomainClassDto__gqlv_input { ref: String } -input simple__causeway_schema_metamodel_v2_FacetHolder__gqlv_input { - "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" - id: ID - "If object identified by 'id', then optionally specifies concrete type. This is only required if the parameter type defines a super class" - logicalTypeName: String - "Use either 'ref' or 'id'; looks up an object previously saved to the execution context using 'saveAs(ref: ...)'" - ref: String -} - input simple__causeway_security_LoginRedirect__gqlv_input { "Use either 'id' or 'ref'; looks up an entity from the persistent data store, or if a view model, then recreates using the id as a memento of the object's state" id: ID
