This is an automated email from the ASF dual-hosted git repository. ahuber pushed a commit to branch 3327-mm-getter-glitch in repository https://gitbox.apache.org/repos/asf/isis.git
commit 181b2e4258474a4f200bd303b8bd4910e6462554 Author: Andi Huber <[email protected]> AuthorDate: Tue Jan 17 14:36:04 2023 +0100 ISIS-3327: adds test case, but cannot reproduce issue --- .../domainmodel/DomainModelTest_forNavigable.java | 76 ++++++++++++++++++++++ .../testdomain/model/navigable/ITypeA.java | 25 +++++++ .../testdomain/model/navigable/ITypeB.java | 23 +++++++ .../causeway/testdomain/model/navigable/TypeA.java | 44 +++++++++++++ .../causeway/testdomain/model/navigable/TypeB.java | 32 +++++++++ 5 files changed, 200 insertions(+) diff --git a/regressiontests/stable-domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/DomainModelTest_forNavigable.java b/regressiontests/stable-domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/DomainModelTest_forNavigable.java new file mode 100644 index 0000000000..db160e0939 --- /dev/null +++ b/regressiontests/stable-domainmodel/src/test/java/org/apache/causeway/testdomain/domainmodel/DomainModelTest_forNavigable.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.causeway.testdomain.domainmodel; + +import javax.inject.Inject; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.apache.causeway.applib.annotation.Introspection.IntrospectionPolicy; +import org.apache.causeway.commons.collections.Can; +import org.apache.causeway.core.config.CausewayConfiguration; +import org.apache.causeway.core.config.presets.CausewayPresets; +import org.apache.causeway.core.metamodel.spec.feature.MixedIn; +import org.apache.causeway.core.metamodel.specloader.SpecificationLoader; +import org.apache.causeway.testdomain.conf.Configuration_headless; +import org.apache.causeway.testdomain.model.navigable.TypeA; +import org.apache.causeway.testing.integtestsupport.applib.CausewayIntegrationTestAbstract; + +import lombok.val; + +@SpringBootTest( + classes = { + Configuration_headless.class, + }, + properties = { + "causeway.core.meta-model.introspector.policy=ANNOTATION_REQUIRED", + }) +@TestPropertySource({ + CausewayPresets.IntrospectFully, + CausewayPresets.UseLog4j2Test, + CausewayPresets.SilenceMetaModel, + CausewayPresets.SilenceProgrammingModel +}) +class DomainModelTest_forNavigable extends CausewayIntegrationTestAbstract { + + @Inject private SpecificationLoader specificationLoader; + @Inject private CausewayConfiguration causewayConfiguration; + + @Test + void overridden_getter_from_interface_should_be_included_with_snapshots() { + + val introspectorCfg = causewayConfiguration.getCore().getMetaModel().getIntrospector(); + assertEquals(IntrospectionPolicy.ANNOTATION_REQUIRED, introspectorCfg.getPolicy()); + + val specA = specificationLoader.specForTypeElseFail(TypeA.class); + //val specB = specificationLoader.specForTypeElseFail(TypeB.class); + + val propsA = specA.streamProperties(MixedIn.EXCLUDED) + .collect(Can.toCan()); + + assertEquals(1, propsA.size()); + assertFalse(propsA.getSingletonOrFail().isExcludedFromSnapshots()); + } + +} diff --git a/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeA.java b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeA.java new file mode 100644 index 0000000000..0aa11cea72 --- /dev/null +++ b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeA.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.causeway.testdomain.model.navigable; + +public interface ITypeA { + + ITypeB getParent(); + +} diff --git a/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeB.java b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeB.java new file mode 100644 index 0000000000..0de35f6177 --- /dev/null +++ b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/ITypeB.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.causeway.testdomain.model.navigable; + +public interface ITypeB { + +} diff --git a/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeA.java b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeA.java new file mode 100644 index 0000000000..ac79a844b9 --- /dev/null +++ b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeA.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.causeway.testdomain.model.navigable; + +import javax.inject.Named; + +import org.apache.causeway.applib.annotation.DomainObject; +import org.apache.causeway.applib.annotation.DomainObjectLayout; +import org.apache.causeway.applib.annotation.Nature; +import org.apache.causeway.applib.annotation.Navigable; +import org.apache.causeway.applib.annotation.Property; +import org.apache.causeway.applib.annotation.PropertyLayout; +import org.apache.causeway.applib.annotation.Where; + +import lombok.Getter; +import lombok.Setter; + +@DomainObject(nature = Nature.VIEW_MODEL) +@DomainObjectLayout( cssClassFa="play" ) +@Named("testdomain.navigable.TypeA") +public class TypeA implements ITypeA { + + @Property + @PropertyLayout(navigable = Navigable.PARENT, hidden = Where.EVERYWHERE) + @Getter @Setter + private TypeB parent; + +} diff --git a/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeB.java b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeB.java new file mode 100644 index 0000000000..62be1e4ab6 --- /dev/null +++ b/regressiontests/stable/src/main/java/org/apache/causeway/testdomain/model/navigable/TypeB.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.causeway.testdomain.model.navigable; + +import javax.inject.Named; + +import org.apache.causeway.applib.annotation.DomainObject; +import org.apache.causeway.applib.annotation.DomainObjectLayout; +import org.apache.causeway.applib.annotation.Nature; + +@DomainObject(nature = Nature.VIEW_MODEL) +@DomainObjectLayout( cssClassFa="play" ) +@Named("testdomain.navigable.TypeB") +public class TypeB implements ITypeB { + +}
