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 2022/05/31 04:20:42 UTC

[isis] branch master updated: ISIS-3063: adds aliases on DomainObjects should be unique test

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 ce03f78ae0 ISIS-3063: adds aliases on DomainObjects should be unique test
ce03f78ae0 is described below

commit ce03f78ae0823946dab3c2a56338b5ccfaa1c877
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 31 06:20:36 2022 +0200

    ISIS-3063: adds aliases on DomainObjects should be unique test
---
 .../DomainModelTest_usingBadDomain.java            | 15 ++++++++
 .../model/bad/InvalidObjectWithAlias.java          | 41 ++++++++++++++++++++++
 .../model/bad/InvalidServiceWithAlias.java         | 41 ++++++++++++++++++++++
 3 files changed, 97 insertions(+)

diff --git a/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingBadDomain.java b/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingBadDomain.java
index ed085cbf28..5486678a75 100644
--- a/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingBadDomain.java
+++ b/regressiontests/stable-domainmodel/src/test/java/org/apache/isis/testdomain/domainmodel/DomainModelTest_usingBadDomain.java
@@ -62,10 +62,12 @@ import org.apache.isis.testdomain.model.bad.InvalidActionOverloading;
 import org.apache.isis.testdomain.model.bad.InvalidContradictingTypeSemantics;
 import org.apache.isis.testdomain.model.bad.InvalidDomainObjectOnInterface;
 import org.apache.isis.testdomain.model.bad.InvalidMemberOverloadingWhenInherited;
+import org.apache.isis.testdomain.model.bad.InvalidObjectWithAlias;
 import org.apache.isis.testdomain.model.bad.InvalidOrphanedActionSupport;
 import org.apache.isis.testdomain.model.bad.InvalidOrphanedCollectionSupport;
 import org.apache.isis.testdomain.model.bad.InvalidOrphanedPropertySupport;
 import org.apache.isis.testdomain.model.bad.InvalidPropertyAnnotationOnAction;
+import org.apache.isis.testdomain.model.bad.InvalidServiceWithAlias;
 import org.apache.isis.testdomain.model.bad.OrphanedMemberSupportDetection;
 import org.apache.isis.testdomain.util.interaction.DomainObjectTesterFactory;
 import org.apache.isis.testing.integtestsupport.applib.validate.DomainModelValidator;
@@ -157,6 +159,19 @@ class DomainModelTest_usingBadDomain {
                 ProgrammingModelConstants.Validation.ORPHANED_METHOD, "hideMe()");
     }
 
+    @Test
+    void aliasesOnDomainObjectsAndServices_shouldBeUnique() {
+        validator.assertAnyFailuresContaining(
+                Identifier.classIdentifier(LogicalType.fqcn(InvalidServiceWithAlias.class)),
+                "Logical type name (or alias) testdomain.InvalidServiceWithAlias mapped to multiple non-abstract classes:");
+                //org.apache.isis.testdomain.model.bad.InvalidObjectWithAlias, org.apache.isis.testdomain.model.bad.InvalidServiceWithAlias
+
+        validator.assertAnyFailuresContaining(
+                Identifier.classIdentifier(LogicalType.fqcn(InvalidObjectWithAlias.class)),
+                "Logical type name (or alias) testdomain.InvalidObjectWithAlias mapped to multiple non-abstract classes:");
+                //org.apache.isis.testdomain.model.bad.InvalidObjectWithAlias, org.apache.isis.testdomain.model.bad.InvalidServiceWithAlias
+    }
+
     @Test
     void actionOverloading_shouldFail() {
         validator.assertAnyFailuresContaining(
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidObjectWithAlias.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidObjectWithAlias.java
new file mode 100644
index 0000000000..5a02801f1f
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidObjectWithAlias.java
@@ -0,0 +1,41 @@
+/*
+ *  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.bad;
+
+import javax.inject.Named;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.Nature;
+
+@Named("testdomain.InvalidObjectWithAlias")
+@DomainObject(nature = Nature.VIEW_MODEL,
+        aliased = {
+            "testdomain.v0.InvalidObjectWithAlias",
+            "testdomain.v0.InvalidServiceWithAlias", // <-- expected collision (validation error)
+        })
+public class InvalidObjectWithAlias {
+
+    @Action public LocalDateTime now() {
+        return LocalDateTime.now();
+    }
+
+}
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidServiceWithAlias.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidServiceWithAlias.java
new file mode 100644
index 0000000000..3c28e94420
--- /dev/null
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidServiceWithAlias.java
@@ -0,0 +1,41 @@
+/*
+ *  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.bad;
+
+import javax.inject.Named;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+
+@Named("testdomain.InvalidServiceWithAlias")
+@DomainService(nature = NatureOfService.VIEW,
+        aliased = {
+            "testdomain.v0.InvalidServiceWithAlias",
+            "testdomain.v0.InvalidObjectWithAlias", // <-- expected collision (validation error)
+        })
+public class InvalidServiceWithAlias {
+
+    @Action public LocalDateTime now() {
+        return LocalDateTime.now();
+    }
+
+}