You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/01/22 15:10:20 UTC

[isis] branch master updated: ISIS-2445: adds regression tests for title() and iconName() when inherited from an abstract super class

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

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 3c3566b  ISIS-2445: adds regression tests for title() and iconName() when inherited from an abstract super class
3c3566b is described below

commit 3c3566bb98a7d326a40c958a0595e8621c6653f7
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Jan 22 16:10:00 2021 +0100

    ISIS-2445: adds regression tests for title() and iconName() when
    inherited from an abstract super class
---
 .../model/good/ProperMemberInheritance.java        | 27 +++++++++++++++++++
 .../good/ProperMemberInheritanceAbstract.java      | 31 ++++++++++++++++++++++
 .../DomainModelTest_usingGoodDomain.java           | 23 ++++++++++++++++
 3 files changed, 81 insertions(+)

diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritance.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritance.java
new file mode 100644
index 0000000..8b1392e
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritance.java
@@ -0,0 +1,27 @@
+/*
+ *  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.isis.testdomain.model.good;
+
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Nature;
+
+@DomainObject(nature = Nature.VIEW_MODEL)
+public class ProperMemberInheritance extends ProperMemberInheritanceAbstract {
+
+}
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritanceAbstract.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritanceAbstract.java
new file mode 100644
index 0000000..29969e2
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberInheritanceAbstract.java
@@ -0,0 +1,31 @@
+/*
+ *  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.isis.testdomain.model.good;
+
+abstract class ProperMemberInheritanceAbstract {
+    
+    public String title() {
+        return "inherited title";
+    }
+    
+    public String iconName() {
+        return "inherited icon";
+    }
+
+}
diff --git a/regressiontests/stable/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java b/regressiontests/stable/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
index b1abd68..f294876 100644
--- a/regressiontests/stable/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
+++ b/regressiontests/stable/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingGoodDomain.java
@@ -32,14 +32,18 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import org.apache.isis.applib.services.jaxb.JaxbService;
 import org.apache.isis.applib.services.metamodel.MetaModelService;
 import org.apache.isis.applib.services.registry.ServiceRegistry;
+import org.apache.isis.applib.services.title.TitleService;
 import org.apache.isis.core.config.presets.IsisPresets;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.members.publish.execution.ExecutionPublishingFacet;
+import org.apache.isis.core.metamodel.facets.object.icon.IconFacet;
+import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 import org.apache.isis.core.metamodel.specloader.specimpl.IntrospectionState;
 import org.apache.isis.schema.metamodel.v2.DomainClassDto;
 import org.apache.isis.testdomain.conf.Configuration_headless;
 import org.apache.isis.testdomain.model.good.Configuration_usingValidDomain;
+import org.apache.isis.testdomain.model.good.ProperMemberInheritance;
 import org.apache.isis.testdomain.model.good.ProperMemberSupport;
 import org.apache.isis.testing.integtestsupport.applib.validate.DomainModelValidator;
 
@@ -70,6 +74,7 @@ class DomainModelTest_usingGoodDomain {
     @Inject private ServiceRegistry serviceRegistry;
 //    @Inject private FactoryService factoryService;
     @Inject private SpecificationLoader specificationLoader;
+    @Inject private TitleService titleService;
 
     void debug() {
         val config = new MetaModelService.Config()
@@ -155,6 +160,24 @@ class DomainModelTest_usingGoodDomain {
         
     }
     
+    @Test
+    void titleAndIconName_shouldBeInheritable() {
+        
+        val spec = specificationLoader.loadSpecification(ProperMemberInheritance.class, 
+                        IntrospectionState.TYPE_AND_MEMBERS_INTROSPECTED);
+        
+        val titleFacet = spec.getFacet(TitleFacet.class);
+        assertNotNull(titleFacet);
+        
+        val iconFacet = spec.getFacet(IconFacet.class);
+        assertNotNull(iconFacet);
+        
+        val properMemberInheritance = new ProperMemberInheritance();
+        assertEquals(properMemberInheritance.title(), titleService.titleOf(properMemberInheritance));
+        assertEquals(properMemberInheritance.iconName(), titleService.iconNameOf(properMemberInheritance));
+    }
+    
+    
     // -- HELPER
     
     private void assertHasPublishedActionFacet(FacetHolder facetHolder) {