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

danhaywood pushed a commit to branch ISIS-3223
in repository https://gitbox.apache.org/repos/asf/isis.git

commit c9dd754b1c9b8218513ddbee586addc77f010662
Author: Dan Haywood <[email protected]>
AuthorDate: Wed Sep 28 06:20:29 2022 +0100

    ISIS-3223: adds integ test (currently failing)
---
 enhance.sh                                         | 40 +++++----
 regressiontests/pom.xml                            |  1 +
 .../stable-core-wrapperfactory/log4j2-test.xml     | 78 ++++++++++++++++++
 .../logging-dn-enhance.properties                  | 48 +++++++++++
 regressiontests/stable-core-wrapperfactory/pom.xml | 96 ++++++++++++++++++++++
 .../src/main/java/include.txt                      |  1 +
 .../CoreWrapperFactory_IntegTestAbstract.java      | 59 +++++++++++++
 .../integtests/WrapperFactory_async_IntegTest.java | 90 ++++++++++++++++++++
 .../wrapperfactory/integtests/model/Counter.java   | 76 +++++++++++++++++
 .../integtests/model/CounterRepository.java        | 54 ++++++++++++
 .../integtests/model/Counter_bumpUsingMixin.java   | 41 +++++++++
 .../integtests/model/TestDomainModel.java          | 48 +++++++++++
 12 files changed, 616 insertions(+), 16 deletions(-)

diff --git a/enhance.sh b/enhance.sh
index dfff552b71..ec27edd2e9 100644
--- a/enhance.sh
+++ b/enhance.sh
@@ -20,16 +20,17 @@
 #
 
 usage() {
-  echo "$(basename $0): [-a] [-c] [-e] [-o] [-m] [-s] [-d] [-t] [-u]"         
>&2
-  echo "  -a : audit trail (extensions/security)"                             
>&2
-  echo "  -c : command log (extensions/core)"                                 
>&2
-  echo "  -e : execution log (extensions/core)"                               
>&2
-  echo "  -o : execution outbox (extensions/core)"                            
>&2
-  echo "  -m : secman (extensions/security)"                                  
>&2
-  echo "  -s : session log (extensions/security)"                             
>&2
-  echo "  -d : demo (examples/demo/domain)"                                   
>&2
-  echo "  -t : JDO regression tests (regressiontests/stable-persistence-jdo)" 
>&2
+  echo "$(basename $0): [-a] [-c] [-e] [-o] [-m] [-s] [-d] [-t] [-u] [-w]"     
>&2
+  echo "  -a : audit trail (extensions/security)"                              
>&2
+  echo "  -c : command log (extensions/core)"                                  
>&2
+  echo "  -e : execution log (extensions/core)"                                
>&2
+  echo "  -o : execution outbox (extensions/core)"                             
>&2
+  echo "  -m : secman (extensions/security)"                                   
>&2
+  echo "  -s : session log (extensions/security)"                              
>&2
+  echo "  -d : demo (examples/demo/domain)"                                    
>&2
+  echo "  -t : JDO regression tests (regressiontests/stable-persistence-jdo)"  
>&2
   echo "  -u : JDO regression tests (regressiontests/stable-cmdexecauditsess)" 
>&2
+  echo "  -w : JDO regression tests (regressiontests/core-wrapperfactory)"     
>&2
 }
 
 
@@ -39,15 +40,16 @@ COMMANDLOG=""
 DEMO=""
 EXECUTIONLOG=""
 EXECUTIONOUTBOX=""
-REGRESSIONTESTS=""
-REGRESSIONTESTS2=""
+REGRESSIONTESTS_PERSISTENCE_JDO=""
+REGRESSIONTESTS_CMDEXECAUDITSESS=""
+REGRESSIONTESTS_CORE_WRAPPERFACTORY=""
 SECMAN=""
 SESSIONLOG=""
 
 PATHS=()
 ALL_IF_REQUIRED=""
 
-while getopts ":acdeomshtu" arg; do
+while getopts ":acdeomshtuw" arg; do
   case $arg in
     h)
       usage
@@ -82,15 +84,20 @@ while getopts ":acdeomshtu" arg; do
       PATHS+=( "examples/demo/domain" )
       ;;
     t)
-      REGRESSIONTESTS="enhance"
+      REGRESSIONTESTS_PERSISTENCE_JDO="enhance"
       PATHS+=( "regressiontests/stable-persistence-jdo" )
       ALL_IF_REQUIRED="-Dmodule-all"
       ;;
     u)
-      REGRESSIONTESTS2="enhance"
+      REGRESSIONTESTS_CMDEXECAUDITSESS="enhance"
       PATHS+=( "regressiontests/stable-cmdexecauditsess/persistence-jdo" )
       ALL_IF_REQUIRED="-Dmodule-all"
       ;;
+    w)
+      REGRESSIONTESTS_CORE_WRAPPERFACTORY="enhance"
+      PATHS+=( "regressiontests/stable-core-wrapperfactory" )
+      ALL_IF_REQUIRED="-Dmodule-all"
+      ;;
     *)
       usage
       exit 1
@@ -106,8 +113,9 @@ echo "EXECUTIONOUTBOX  : $EXECUTIONOUTBOX"
 echo "SECMAN           : $SECMAN"
 echo "SESSIONLOG       : $SESSIONLOG"
 echo "DEMO             : $DEMO"
-echo "REGRESSIONTESTS  : $REGRESSIONTESTS"
-echo "REGRESSIONTESTS2 : $REGRESSIONTESTS2"
+echo "REGRESSIONTESTS_PERSISTENCE_JDO     : $REGRESSIONTESTS_PERSISTENCE_JDO"
+echo "REGRESSIONTESTS_CMDEXECAUDITSESS    : $REGRESSIONTESTS_CMDEXECAUDITSESS"
+echo "REGRESSIONTESTS_CORE_WRAPPERFACTORY : 
REGRESSIONTESTS_CORE_WRAPPERFACTORY"
 
 
 printf -v PATHS_SPLATTED '%s,' "${PATHS[@]}"
diff --git a/regressiontests/pom.xml b/regressiontests/pom.xml
index 14b068243b..e685247d64 100644
--- a/regressiontests/pom.xml
+++ b/regressiontests/pom.xml
@@ -292,6 +292,7 @@
                <module>stable</module>
                <module>stable-bootstrapping</module>
                <module>stable-config</module>
+               <module>stable-core-wrapperfactory</module>
                <module>stable-cucumber</module>
                <module>stable-domainmodel</module>
                <module>stable-eventhandling</module>
diff --git a/regressiontests/stable-core-wrapperfactory/log4j2-test.xml 
b/regressiontests/stable-core-wrapperfactory/log4j2-test.xml
new file mode 100644
index 0000000000..0ed7986e24
--- /dev/null
+++ b/regressiontests/stable-core-wrapperfactory/log4j2-test.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<Configuration status="WARN">
+       <Properties>
+               <Property name="PID">????</Property>
+               <Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property>
+               <Property name="LOG_LEVEL_PATTERN">%5p</Property>
+               <Property name="LOG_DATEFORMAT_PATTERN">yyyy-MM-dd 
HH:mm:ss.SSS</Property>
+               <Property 
name="CONSOLE_LOG_PATTERN">%clr{%d{${LOG_DATEFORMAT_PATTERN}}}{faint} 
%clr{${LOG_LEVEL_PATTERN}} %clr{${sys:PID}}{magenta} %clr{---}{faint} 
%clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} 
%m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
+               <Property name="FILE_LOG_PATTERN">%d{${LOG_DATEFORMAT_PATTERN}} 
${LOG_LEVEL_PATTERN} ${sys:PID} --- [%t] %-40.40c{1.} : 
%m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property>
+       </Properties>
+       <Appenders>
+               <Console name="Console" target="SYSTEM_OUT" follow="true">
+                       <PatternLayout pattern="${sys:CONSOLE_LOG_PATTERN}" />
+               </Console>
+       </Appenders>
+       <Loggers>
+               <Logger name="org.apache.catalina.startup.DigesterFactory" 
level="error" />
+               <Logger name="org.apache.catalina.util.LifecycleBase" 
level="error" />
+               <Logger name="org.apache.coyote.http11.Http11NioProtocol" 
level="warn" />
+               <logger name="org.apache.sshd.common.util.SecurityUtils" 
level="warn"/>
+               <Logger name="org.apache.tomcat.util.net.NioSelectorPool" 
level="warn" />
+               <Logger 
name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error" />
+               <Logger name="org.hibernate.validator.internal.util.Version" 
level="warn" />
+               <logger name="org.springframework.boot.actuate.endpoint.jmx" 
level="warn"/>
+               
+               <logger name="org.apache.directory" level="warn"/>
+               <logger name="org.apache.directory.api.ldap.model.entry.Value" 
level="off"/>
+               
+               <logger name="DataNucleus.Persistence" level="info"/>
+               <logger name="DataNucleus.Transaction" level="info"/>
+               <logger name="DataNucleus.Datastore.Schema" level="info"/>
+               <logger name="DataNucleus.Datastore.Native" level="info"/>
+               
+               <Root level="info">
+                       <AppenderRef ref="Console" />
+               </Root>
+       </Loggers>
+</Configuration>
+
+<!-- # DataNucleus Logging Categories -->
+<!-- DataNucleus.Persistence - All messages relating to the persistence 
process -->
+<!-- DataNucleus.Transaction - All messages relating to transactions -->
+<!-- DataNucleus.Connection - All messages relating to Connections. -->
+<!-- DataNucleus.Query - All messages relating to queries -->
+<!-- DataNucleus.Cache - All messages relating to the DataNucleus Cache -->
+<!-- DataNucleus.MetaData - All messages relating to MetaData -->
+<!-- DataNucleus.Datastore - All general datastore messages -->
+<!-- DataNucleus.Datastore.Schema - All schema related datastore log messages 
-->
+<!-- DataNucleus.Datastore.Persist - All datastore persistence messages -->
+<!-- DataNucleus.Datastore.Retrieve - All datastore retrieval messages -->
+<!-- DataNucleus.Datastore.Native - Log of all 'native' statements sent to the 
datastore -->
+<!-- DataNucleus.General - All general operational messages -->
+<!-- DataNucleus.Lifecycle - All messages relating to object lifecycle changes 
-->
+<!-- DataNucleus.ValueGeneration - All messages relating to value generation 
-->
+<!-- DataNucleus.Enhancer - All messages from the DataNucleus Enhancer. -->
+<!-- DataNucleus.SchemaTool - All messages from DataNucleus SchemaTool -->
+<!-- DataNucleus.JDO - All messages general to JDO -->
+<!-- DataNucleus.JPA - All messages general to JPA -->
+<!-- DataNucleus.JCA - All messages relating to Connector JCA. -->
+<!-- DataNucleus.IDE - Messages from the DataNucleus IDE. -->
\ No newline at end of file
diff --git 
a/regressiontests/stable-core-wrapperfactory/logging-dn-enhance.properties 
b/regressiontests/stable-core-wrapperfactory/logging-dn-enhance.properties
new file mode 100644
index 0000000000..515c2a2966
--- /dev/null
+++ b/regressiontests/stable-core-wrapperfactory/logging-dn-enhance.properties
@@ -0,0 +1,48 @@
+#
+#  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.
+#
+
+log4j.appender.A1=org.apache.log4j.FileAppender
+log4j.appender.A1.File=datanucleus.log
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} (%t) %-5p [%c] - 
%m%n
+
+
+# overriding all those below... 
+log4j.category.DataNucleus=ERROR
+
+log4j.category.DataNucleus.Persistence=INFO, A1
+log4j.category.DataNucleus.Transaction=INFO, A1
+log4j.category.DataNucleus.Connection=INFO, A1
+log4j.category.DataNucleus.Query=INFO, A1
+log4j.category.DataNucleus.Cache=INFO, A1
+log4j.category.DataNucleus.MetaData=INFO, A1
+log4j.category.DataNucleus.Datastore=INFO, A1
+log4j.category.DataNucleus.Datastore.Schema=INFO, A1
+log4j.category.DataNucleus.Datastore.Persist=INFO, A1
+log4j.category.DataNucleus.Datastore.Retrieve=INFO, A1
+#Log of all 'native' statements sent to the datastore
+log4j.category.DataNucleus.Datastore.Native=INFO, A1 
+log4j.category.DataNucleus.General=INFO, A1
+#All messages relating to object lifecycle changes
+log4j.category.DataNucleus.Lifecycle=INFO, A1
+log4j.category.DataNucleus.ValueGeneration=INFO, A1
+log4j.category.DataNucleus.Enhancer=INFO, A1
+log4j.category.DataNucleus.SchemaTool=INFO, A1
+log4j.category.DataNucleus.JDO=INFO, A1
+ 
\ No newline at end of file
diff --git a/regressiontests/stable-core-wrapperfactory/pom.xml 
b/regressiontests/stable-core-wrapperfactory/pom.xml
new file mode 100644
index 0000000000..c0b9bceb25
--- /dev/null
+++ b/regressiontests/stable-core-wrapperfactory/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.isis.regressiontests</groupId>
+        <artifactId>isis-regressiontests</artifactId>
+        <version>2.0.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>isis-regressiontests-core-wrapperfactory</artifactId>
+    <name>Apache Isis - Regression Tests (stable) - Core WrapperFactory</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.isis.extensions</groupId>
+                <artifactId>isis-extensions</artifactId>
+                <version>2.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.isis.testing</groupId>
+                <artifactId>isis-testing</artifactId>
+                <version>2.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.isis.core</groupId>
+                <artifactId>isis-core</artifactId>
+                <version>2.0.0-SNAPSHOT</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-config</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-applib</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>jakarta.xml.ws</groupId>
+            <artifactId>jakarta.xml.ws-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.testing</groupId>
+            <artifactId>isis-testing-integtestsupport-applib</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.persistence</groupId>
+            <artifactId>isis-persistence-jdo-datanucleus</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.testing</groupId>
+            <artifactId>isis-testing-fixtures-applib</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.gavlyukovskiy</groupId>
+            <artifactId>p6spy-spring-boot-starter</artifactId>
+            <version>1.8.0</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+</project>
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/main/java/include.txt 
b/regressiontests/stable-core-wrapperfactory/src/main/java/include.txt
new file mode 100644
index 0000000000..4f9c4e05b9
--- /dev/null
+++ b/regressiontests/stable-core-wrapperfactory/src/main/java/include.txt
@@ -0,0 +1 @@
+existence of the src/main/java folder, even if empty, suppresses build 
[WARNING] JAR will be empty - no content was marked for inclusion
\ No newline at end of file
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/CoreWrapperFactory_IntegTestAbstract.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/CoreWrapperFactory_IntegTestAbstract.java
new file mode 100644
index 0000000000..13a02b0b64
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/CoreWrapperFactory_IntegTestAbstract.java
@@ -0,0 +1,59 @@
+package org.apache.isis.regressiontests.core.wrapperfactory.integtests;
+
+import javax.inject.Inject;
+
+import org.apache.isis.core.config.presets.IsisPresets;
+import org.apache.isis.core.runtimeservices.IsisModuleCoreRuntimeServices;
+import 
org.apache.isis.persistence.jdo.datanucleus.IsisModulePersistenceJdoDatanucleus;
+import 
org.apache.isis.regressiontests.core.wrapperfactory.integtests.model.Counter;
+import 
org.apache.isis.regressiontests.core.wrapperfactory.integtests.model.CounterRepository;
+import 
org.apache.isis.regressiontests.core.wrapperfactory.integtests.model.TestDomainModel;
+import org.apache.isis.security.bypass.IsisModuleSecurityBypass;
+import 
org.apache.isis.testing.fixtures.applib.IsisIntegrationTestAbstractWithFixtures;
+import org.apache.isis.testing.fixtures.applib.IsisModuleTestingFixturesApplib;
+import org.junit.jupiter.api.BeforeAll;
+import org.springframework.boot.SpringBootConfiguration;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.Import;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.PropertySources;
+import org.springframework.test.context.ActiveProfiles;
+
+@SpringBootTest(
+        classes = CoreWrapperFactory_IntegTestAbstract.AppManifest.class
+)
+@ActiveProfiles("test")
+public abstract class CoreWrapperFactory_IntegTestAbstract extends 
IsisIntegrationTestAbstractWithFixtures {
+
+    @SpringBootConfiguration
+    @EnableAutoConfiguration
+    @Import({
+            IsisModuleCoreRuntimeServices.class,
+            IsisModuleSecurityBypass.class,
+            IsisModulePersistenceJdoDatanucleus.class,
+            IsisModuleTestingFixturesApplib.class,
+
+            TestDomainModel.class,
+    })
+    @PropertySources({
+            @PropertySource(IsisPresets.H2InMemory_withUniqueSchema),
+            @PropertySource(IsisPresets.DatanucleusAutocreateNoValidate),
+            @PropertySource(IsisPresets.DatanucleusEagerlyCreateTables),
+            @PropertySource(IsisPresets.UseLog4j2Test),
+    })
+    public static class AppManifest {
+    }
+
+    @BeforeAll
+    static void beforeAll() {
+        IsisPresets.forcePrototyping();
+    }
+
+    protected Counter newCounter(String name) {
+        return Counter.builder().name(name).build();
+    }
+
+
+    @Inject protected CounterRepository counterRepository;
+}
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/WrapperFactory_async_IntegTest.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/WrapperFactory_async_IntegTest.java
new file mode 100644
index 0000000000..5cf313bd6a
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/WrapperFactory_async_IntegTest.java
@@ -0,0 +1,90 @@
+package org.apache.isis.regressiontests.core.wrapperfactory.integtests;
+
+import lombok.SneakyThrows;
+import lombok.val;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.applib.services.wrapper.control.AsyncControl;
+import org.apache.isis.applib.services.xactn.TransactionService;
+import 
org.apache.isis.regressiontests.core.wrapperfactory.integtests.model.Counter;
+import 
org.apache.isis.regressiontests.core.wrapperfactory.integtests.model.Counter_bumpUsingMixin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.springframework.transaction.annotation.Propagation;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Run "sh enhance.sh -w" first, to enhance the test JDO entities.
+ */
+class WrapperFactory_async_IntegTest extends 
CoreWrapperFactory_IntegTestAbstract {
+
+    @Inject WrapperFactory wrapperFactory;
+    @Inject TransactionService transactionService;
+    @Inject BookmarkService bookmarkService;
+
+    Bookmark bookmark;
+
+    @BeforeEach
+    void setup_counter() {
+
+        transactionService.runTransactional(Propagation.REQUIRES_NEW, () -> {
+            counterRepository.persist(newCounter("fred"));
+            List<Counter> counters = counterRepository.find();
+            assertThat(counters).hasSize(1);
+
+            bookmark = bookmarkService.bookmarkForElseFail(counters.get(0));
+        }).ifFailureFail();
+
+        // given
+        assertThat(bookmark).isNotNull();
+
+        val counter = bookmarkService.lookup(bookmark, 
Counter.class).orElseThrow();
+        assertThat(counter.getNum()).isNull();
+    }
+
+    @SneakyThrows
+    @Test
+    void async_using_default_executor_service() {
+
+        // when
+        transactionService.runTransactional(Propagation.REQUIRES_NEW, () -> {
+            val counter = bookmarkService.lookup(bookmark, 
Counter.class).orElseThrow();
+
+            wrapperFactory.asyncWrap(counter, 
AsyncControl.returning(Counter.class)).bumpUsingDeclaredAction();
+
+            Thread.sleep(1_000);// horrid, but let's just wait 1 sec to allow 
executor to complete before continuing
+        }).ifFailureFail();
+
+        // then
+        transactionService.runTransactional(Propagation.REQUIRES_NEW, () -> {
+            val counter = bookmarkService.lookup(bookmark, 
Counter.class).orElseThrow();
+            assertThat(counter.getNum()).isEqualTo(1L);
+        }).ifFailureFail();
+
+        // when
+        transactionService.runTransactional(Propagation.REQUIRES_NEW, () -> {
+            val counter = bookmarkService.lookup(bookmark, 
Counter.class).orElseThrow();
+            assertThat(counter.getNum()).isEqualTo(1L);
+
+            // when
+            wrapperFactory.asyncWrapMixin(Counter_bumpUsingMixin.class, 
counter, AsyncControl.returning(Counter.class)).act();
+
+            Thread.sleep(1_000);// horrid, but let's just wait 1 sec to allow 
executor to complete before continuing
+        }).ifFailureFail();
+
+        // then
+        transactionService.runTransactional(Propagation.REQUIRES_NEW, () -> {
+            val counter = bookmarkService.lookup(bookmark, 
Counter.class).orElseThrow();
+            assertThat(counter).isNotNull();
+            assertThat(counter.getNum()).isEqualTo(2L);
+        }).ifFailureFail();
+    }
+
+}
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter.java
new file mode 100644
index 0000000000..471c5f7776
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter.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.isis.regressiontests.core.wrapperfactory.integtests.model;
+
+import lombok.*;
+
+import javax.inject.Named;
+import javax.jdo.annotations.Column;
+import javax.jdo.annotations.DatastoreIdentity;
+import javax.jdo.annotations.IdGeneratorStrategy;
+import javax.jdo.annotations.PersistenceCapable;
+
+import org.apache.isis.applib.annotation.*;
+
+@PersistenceCapable(
+        schema = TestDomainModel.SCHEMA,
+        table = "Counter"
+)
+@DatastoreIdentity(strategy = IdGeneratorStrategy.IDENTITY, column = "id")
+@Named(TestDomainModel.NAMESPACE + ".Counter")
+@DomainObject(nature = Nature.ENTITY)
+@NoArgsConstructor
+@Builder
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
+public class Counter implements Comparable<Counter> {
+
+    @Property(editing = Editing.ENABLED, commandPublishing = 
Publishing.ENABLED)
+    @Column(allowsNull = "true")
+    @Getter @Setter
+    private Long num;
+
+    @Column(allowsNull = "false")
+    @Getter @Setter
+    private String name;
+
+    @Column(allowsNull = "true")
+    @Getter @Setter
+    private Long num2;
+
+    @Action(commandPublishing = Publishing.ENABLED)
+    public Counter bumpUsingDeclaredAction() {
+        return doBump();
+    }
+
+    Counter doBump() {
+        if (getNum() == null) {
+            setNum(1L);
+        } else {
+            setNum(getNum() + 1);
+        }
+        return this;
+    }
+
+    @Override
+    public int compareTo(final Counter o) {
+        return this.getName().compareTo(o.getName());
+    }
+}
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/CounterRepository.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/CounterRepository.java
new file mode 100644
index 0000000000..6bde3c24b9
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/CounterRepository.java
@@ -0,0 +1,54 @@
+/*
+ * 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.regressiontests.core.wrapperfactory.integtests.model;
+
+import java.util.List;
+import java.util.Objects;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class CounterRepository {
+
+    private final Class<Counter> counterClass = Counter.class;
+
+    public List<Counter> find() {
+        return repositoryService.allInstances(counterClass);
+    }
+
+    public Counter persist(Counter counter) {
+        return repositoryService.persistAndFlush(counter);
+    }
+
+    public void removeAll() {
+        repositoryService.removeAll(counterClass);
+    }
+
+    @Inject RepositoryService repositoryService;
+
+    public Counter findByName(String name) {
+        List<Counter> xes = find();
+        return xes.stream().filter(x -> Objects.equals(x.getName(), 
name)).findFirst().orElseThrow();
+    }
+}
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter_bumpUsingMixin.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter_bumpUsingMixin.java
new file mode 100644
index 0000000000..25b966979a
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/Counter_bumpUsingMixin.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.regressiontests.core.wrapperfactory.integtests.model;
+
+import lombok.RequiredArgsConstructor;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.Publishing;
+import org.apache.isis.applib.services.wrapper.Mixin;
+
+@Action(
+        commandPublishing = Publishing.ENABLED,
+        executionPublishing = Publishing.ENABLED
+)
+@RequiredArgsConstructor
+public class Counter_bumpUsingMixin implements Mixin<Counter> {
+
+    private final Counter counter;
+
+    public Counter act() {
+        return counter.doBump();
+    }
+}
diff --git 
a/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/TestDomainModel.java
 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/TestDomainModel.java
new file mode 100644
index 0000000000..75efcf85ca
--- /dev/null
+++ 
b/regressiontests/stable-core-wrapperfactory/src/test/java/org/apache/isis/regressiontests/core/wrapperfactory/integtests/model/TestDomainModel.java
@@ -0,0 +1,48 @@
+/*
+ * 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.regressiontests.core.wrapperfactory.integtests.model;
+
+import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScript;
+import org.apache.isis.testing.fixtures.applib.modules.ModuleWithFixtures;
+import 
org.apache.isis.testing.fixtures.applib.teardown.jdo.TeardownFixtureJdoAbstract;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+
+@Configuration
+@Import({
+})
+@ComponentScan
+public class TestDomainModel implements ModuleWithFixtures {
+
+    public static final String NAMESPACE = "common.facade.test";
+    public static final String SCHEMA = "commonFacadeTest";
+
+    @Override
+    public FixtureScript getTeardownFixture() {
+        return new TeardownFixtureJdoAbstract() {
+            @Override
+            protected void execute(ExecutionContext executionContext) {
+                deleteFrom(Counter.class);
+            }
+        };
+    }
+}

Reply via email to