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/01/19 11:05:11 UTC
[isis] branch master updated: ISIS-2944: just test case fixes
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 32194b5 ISIS-2944: just test case fixes
32194b5 is described below
commit 32194b57028a9cd6efabf11c766f713824896299
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 19 12:04:29 2022 +0100
ISIS-2944: just test case fixes
---
.../DomainModelTest_usingBadDomain.java | 31 ++++++++++++++-
.../bad/InvalidActionOverloadingWhenInherited.java | 45 ----------------------
.../InvalidMemberOverloadingWhenInherited.java} | 15 ++++----
...a => ProperMemberOverloadingWhenInherited.java} | 38 ++++++++----------
4 files changed, 54 insertions(+), 75 deletions(-)
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 bba7aa7..f64e002 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
@@ -57,10 +57,10 @@ import org.apache.isis.testdomain.model.bad.AmbiguousMixinAnnotations;
import org.apache.isis.testdomain.model.bad.AmbiguousTitle;
import org.apache.isis.testdomain.model.bad.Configuration_usingInvalidDomain;
import org.apache.isis.testdomain.model.bad.InvalidActionOverloading;
-import org.apache.isis.testdomain.model.bad.InvalidActionOverloadingWhenInherited;
import org.apache.isis.testdomain.model.bad.InvalidContradictingTypeSemantics;
import org.apache.isis.testdomain.model.bad.InvalidDomainObjectOnInterface;
import org.apache.isis.testdomain.model.bad.InvalidLogicalTypeNameClash;
+import org.apache.isis.testdomain.model.bad.InvalidMemberOverloadingWhenInherited;
import org.apache.isis.testdomain.model.bad.InvalidOrphanedActionSupport;
import org.apache.isis.testdomain.model.bad.InvalidOrphanedCollectionSupport;
import org.apache.isis.testdomain.model.bad.InvalidOrphanedPropertySupport;
@@ -159,8 +159,35 @@ class DomainModelTest_usingBadDomain {
"Action method overloading is not allowed");
validator.assertAnyFailuresContaining(
- Identifier.classIdentifier(LogicalType.fqcn(InvalidActionOverloadingWhenInherited.class)),
+ Identifier.classIdentifier(LogicalType.fqcn(
+ InvalidMemberOverloadingWhenInherited.WhenAnnotationOptional.class)),
"Action method overloading is not allowed");
+
+ validator.assertAnyFailuresContaining(
+ Identifier.classIdentifier(LogicalType.fqcn(
+ InvalidMemberOverloadingWhenInherited.WhenAnnotationRequired.class)),
+ "Action method overloading is not allowed");
+
+ validator.assertAnyFailuresContaining(
+ Identifier.classIdentifier(LogicalType.fqcn(
+ InvalidMemberOverloadingWhenInherited.WhenEncapsulationEnabled.class)),
+ "Action method overloading is not allowed");
+
+//TODO should fail as well, but rather difficult to implement
+// validator.assertAnyFailuresContaining(
+// Identifier.classIdentifier(LogicalType.fqcn(
+// InvalidMemberOverloadingWhenInherited.WhenAnnotationOptional.class)),
+// "#isActive(): has annotation @Domain.Include, is assumed to support a property");
+
+ validator.assertAnyFailuresContaining(
+ Identifier.classIdentifier(LogicalType.fqcn(
+ InvalidMemberOverloadingWhenInherited.WhenAnnotationRequired.class)),
+ "#isActive(): has annotation @Domain.Include, is assumed to support a property");
+
+ validator.assertAnyFailuresContaining(
+ Identifier.classIdentifier(LogicalType.fqcn(
+ InvalidMemberOverloadingWhenInherited.WhenEncapsulationEnabled.class)),
+ "#isActive(): has annotation @Domain.Include, is assumed to support a property");
}
@Test
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidActionOverloadingWhenInherited.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidActionOverloadingWhenInherited.java
deleted file mode 100644
index eb148e2..0000000
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidActionOverloadingWhenInherited.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.DomainObject;
-import org.apache.isis.applib.annotation.Nature;
-
-@DomainObject(nature = Nature.VIEW_MODEL)
-public class InvalidActionOverloadingWhenInherited
-extends Base {
-
- // overloading not allowed: should fail
- @Action
- public boolean anAction() {
- return false;
- }
-
-}
-
-abstract class Base {
-
- // overloading not allowed: should fail
- @Action
- public String anAction(final String param) {
- return param;
- }
-
-}
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidMemberOverloadingWhenInherited.java
similarity index 87%
copy from regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java
copy to regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidMemberOverloadingWhenInherited.java
index e0bc883..c38a1ab 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/bad/InvalidMemberOverloadingWhenInherited.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.testdomain.model.good;
+package org.apache.isis.testdomain.model.bad;
import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.DomainObject;
@@ -28,16 +28,17 @@ import org.apache.isis.applib.annotation.Property;
import lombok.Getter;
import lombok.Setter;
-public class ProperActionOverloadingWhenInherited {
+@DomainObject(nature = Nature.VIEW_MODEL)
+public class InvalidMemberOverloadingWhenInherited {
static abstract class Base {
// overloading not allowed, unless programmatic
- @Programmatic
public String anAction(final String param) {
return param;
}
+ // boolean property name clash, overloading not allowed even though programmatic
@Programmatic
public boolean isActive() {
return true;
@@ -45,13 +46,14 @@ public class ProperActionOverloadingWhenInherited {
}
+
@DomainObject(
nature = Nature.VIEW_MODEL,
introspection = Introspection.ANNOTATION_OPTIONAL)
public static class WhenAnnotationOptional
extends Base {
- // overloading of base action
+ // overloading not allowed: should fail
public String anAction() {
return "";
}
@@ -68,7 +70,7 @@ public class ProperActionOverloadingWhenInherited {
public static class WhenAnnotationRequired
extends Base {
- // overloading of base action
+ // overloading not allowed: should fail
@Action
public String anAction() {
return "";
@@ -87,7 +89,7 @@ public class ProperActionOverloadingWhenInherited {
public static class WhenEncapsulationEnabled
extends Base {
- // overloading of base action
+ // overloading not allowed: should fail
@Action
protected String anAction() {
return "";
@@ -101,6 +103,5 @@ public class ProperActionOverloadingWhenInherited {
}
-
}
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberOverloadingWhenInherited.java
similarity index 77%
rename from regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java
rename to regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberOverloadingWhenInherited.java
index e0bc883..46af50d 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperActionOverloadingWhenInherited.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/ProperMemberOverloadingWhenInherited.java
@@ -23,12 +23,8 @@ import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Introspection;
import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Property;
-import lombok.Getter;
-import lombok.Setter;
-
-public class ProperActionOverloadingWhenInherited {
+public class ProperMemberOverloadingWhenInherited {
static abstract class Base {
@@ -38,10 +34,10 @@ public class ProperActionOverloadingWhenInherited {
return param;
}
- @Programmatic
- public boolean isActive() {
- return true;
- }
+// @Programmatic
+// public boolean isActive() {
+// return true;
+// }
}
@@ -56,9 +52,9 @@ public class ProperActionOverloadingWhenInherited {
return "";
}
- // name-clash with base property
- @Getter @Setter
- private Boolean active;
+// // name-clash with base property
+// @Getter @Setter
+// private Boolean active;
}
@@ -74,10 +70,10 @@ public class ProperActionOverloadingWhenInherited {
return "";
}
- // name-clash with base property
- @Property
- @Getter @Setter
- private Boolean active;
+// // name-clash with base property
+// @Property
+// @Getter @Setter
+// private Boolean active;
}
@@ -93,11 +89,11 @@ public class ProperActionOverloadingWhenInherited {
return "";
}
- // name-clash with base property
- @Property
- private Boolean active;
- protected Boolean getActive() { return null;}
- protected void setActive(final Boolean flag) { }
+// // name-clash with base property
+// @Property
+// private Boolean active;
+// protected Boolean getActive() { return null;}
+// protected void setActive(final Boolean flag) { }
}