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 2020/01/06 09:32:22 UTC

[isis] branch master updated: ISIS-2183: Converts ProxyFactoryPlugin -> ProxyFactoryService

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 ed33248  ISIS-2183: Converts ProxyFactoryPlugin -> ProxyFactoryService
ed33248 is described below

commit ed33248d417536dbb6e488a77333507a8b8f0fc6
Author: Andi Huber <ah...@apache.org>
AuthorDate: Mon Jan 6 10:32:13 2020 +0100

    ISIS-2183: Converts ProxyFactoryPlugin -> ProxyFactoryService
---
 .../bytebuddy/IsisModuleCodegenByteBuddy.java      |  4 ++++
 ...uddy.java => ProxyFactoryServiceByteBuddy.java} |  6 ++++--
 ...ons.internal.plugins.codegen.ProxyFactoryPlugin |  1 -
 .../internal/plugins/codegen/ProxyFactory.java     |  4 ++--
 ...FactoryPlugin.java => ProxyFactoryService.java} | 22 +++++-----------------
 .../ImposteriserTestUsingCodegenPlugin.java        | 11 -----------
 .../proxy/ProxyCreatorTestUsingCodegenPlugin.java  |  3 ++-
 .../WrapperFactoryDefault_wrappedObject_Test.java  | 16 +++++++++++++---
 ...actoryDefault_wrappedObject_transient_Test.java | 21 ++++++++++++++-------
 .../services/wrapper/WrapperFactoryDefault.java    | 13 +++++++------
 .../services/wrapper/proxy/ProxyCreator.java       |  8 +++++---
 .../wrapper/WrapperFactoryDefaultTest.java         | 15 +++++++++++----
 .../jmocking/ImposteriserUsingCodegenPlugin.java   |  3 ++-
 13 files changed, 69 insertions(+), 58 deletions(-)

diff --git a/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/IsisModuleCodegenByteBuddy.java b/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/IsisModuleCodegenByteBuddy.java
index 955083c..8f17fd0 100644
--- a/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/IsisModuleCodegenByteBuddy.java
+++ b/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/IsisModuleCodegenByteBuddy.java
@@ -3,12 +3,16 @@ package org.apache.isis.codegen.bytebuddy;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 
+import org.apache.isis.codegen.bytebuddy.services.ProxyFactoryServiceByteBuddy;
 import org.apache.isis.commons.IsisModuleCommons;
 
 @Configuration
 @Import({
         // modules
         IsisModuleCommons.class,
+        
+        // services
+        ProxyFactoryServiceByteBuddy.class
 })
 public class IsisModuleCodegenByteBuddy {
 }
diff --git a/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryPluginUsingByteBuddy.java b/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryServiceByteBuddy.java
similarity index 97%
rename from core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryPluginUsingByteBuddy.java
rename to core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryServiceByteBuddy.java
index e1e7c1b..4e58188 100644
--- a/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryPluginUsingByteBuddy.java
+++ b/core/codegen-bytebuddy/src/main/java/org/apache/isis/codegen/bytebuddy/services/ProxyFactoryServiceByteBuddy.java
@@ -26,13 +26,14 @@ import javax.annotation.Nullable;
 
 import org.objenesis.Objenesis;
 import org.objenesis.ObjenesisStd;
+import org.springframework.stereotype.Service;
 
 import org.apache.isis.commons.internal._Constants;
 import org.apache.isis.commons.internal.base._Casts;
 import org.apache.isis.commons.internal.base._NullSafe;
 import org.apache.isis.commons.internal.context._Context;
 import org.apache.isis.commons.internal.plugins.codegen.ProxyFactory;
-import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryPlugin;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 
 import net.bytebuddy.ByteBuddy;
 import net.bytebuddy.NamingStrategy;
@@ -40,7 +41,8 @@ import net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.Implementation
 import net.bytebuddy.implementation.InvocationHandlerAdapter;
 import net.bytebuddy.matcher.ElementMatchers;
 
-public class ProxyFactoryPluginUsingByteBuddy implements ProxyFactoryPlugin {
+@Service
+public class ProxyFactoryServiceByteBuddy implements ProxyFactoryService {
 
     private final ClassLoadingStrategyAdvisor strategyAdvisor = new ClassLoadingStrategyAdvisor();
 
diff --git a/core/codegen-bytebuddy/src/main/resources/META-INF/services/org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryPlugin b/core/codegen-bytebuddy/src/main/resources/META-INF/services/org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryPlugin
deleted file mode 100644
index 5ff2be7..0000000
--- a/core/codegen-bytebuddy/src/main/resources/META-INF/services/org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryPlugin
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.isis.codegen.bytebuddy.services.ProxyFactoryPluginUsingByteBuddy
\ No newline at end of file
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactory.java b/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactory.java
index 5bc8b91..c73a19a 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactory.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactory.java
@@ -65,8 +65,8 @@ public interface ProxyFactory<T> {
             this.constructorArgTypes = constructorArgTypes;
             return this;
         }
-        public ProxyFactory<T> build() {
-            return ProxyFactoryPlugin.get().factory(base, interfaces, constructorArgTypes);
+        public ProxyFactory<T> build(ProxyFactoryService proxyFactoryService) {
+            return proxyFactoryService.factory(base, interfaces, constructorArgTypes);
         }
     }
 
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryPlugin.java b/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryService.java
similarity index 67%
rename from core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryPlugin.java
rename to core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryService.java
index 640636a..59f689d 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryPlugin.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/plugins/codegen/ProxyFactoryService.java
@@ -20,27 +20,15 @@ package org.apache.isis.commons.internal.plugins.codegen;
 
 import javax.annotation.Nullable;
 
-import org.apache.isis.commons.internal.context._Plugin;
-
-public interface ProxyFactoryPlugin {
-
-    // -- INTERFACE
+/**
+ * Replaces the former ProxyFactoryPlugin
+ * @since 2.0
+ */
+public interface ProxyFactoryService {
 
     public <T> ProxyFactory<T> factory(
             Class<T> base,
             @Nullable Class<?>[] interfaces,
             @Nullable Class<?>[] constructorArgTypes);
 
-
-    // -- LOOKUP
-
-    public static ProxyFactoryPlugin get() {
-        return _Plugin.getOrElse(ProxyFactoryPlugin.class,
-                ambiguousPlugins->{
-                    return _Plugin.pickAnyAndWarn(ProxyFactoryPlugin.class, ambiguousPlugins);
-                },
-                ()->{
-                    throw _Plugin.absenceNonRecoverable(ProxyFactoryPlugin.class);
-                });
-    }
 }
diff --git a/core/detached-tests/src/test/java/org/apache/isis/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java b/core/detached-tests/src/test/java/org/apache/isis/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
index 1f448c6..3639639 100644
--- a/core/detached-tests/src/test/java/org/apache/isis/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
+++ b/core/detached-tests/src/test/java/org/apache/isis/unittestsupport/jmocking/ImposteriserTestUsingCodegenPlugin.java
@@ -21,7 +21,6 @@ package org.apache.isis.unittestsupport.jmocking;
 import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Date;
@@ -44,7 +43,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import org.apache.isis.commons.internal.context._Context;
-import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryPlugin;
 
 class ImposteriserTestUsingCodegenPlugin {
 
@@ -72,15 +70,6 @@ class ImposteriserTestUsingCodegenPlugin {
         invocation = null;
     }
 
-    // //////////////////////////////////////
-
-    @Test
-    void canLoadCodegenPlugin() throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
-        assertNotNull(ProxyFactoryPlugin.get());
-    }
-
-    // //////////////////////////////////////
-
     @Test
     void happyCaseWhenJdkInterface() {
         assertTrue(imposteriser.canImposterise(Runnable.class));
diff --git a/core/detached-tests/src/test/java/org/apache/isis/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java b/core/detached-tests/src/test/java/org/apache/isis/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
index 46b4c2b..50960e9 100644
--- a/core/detached-tests/src/test/java/org/apache/isis/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
+++ b/core/detached-tests/src/test/java/org/apache/isis/wrapper/proxy/ProxyCreatorTestUsingCodegenPlugin.java
@@ -26,6 +26,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
+import org.apache.isis.codegen.bytebuddy.services.ProxyFactoryServiceByteBuddy;
 import org.apache.isis.runtime.services.wrapper.handlers.DelegatingInvocationHandler;
 import org.apache.isis.runtime.services.wrapper.proxy.ProxyCreator;
 
@@ -35,7 +36,7 @@ public class ProxyCreatorTestUsingCodegenPlugin {
 
     @Before
     public void setUp() throws Exception {
-        proxyCreator = new ProxyCreator();
+        proxyCreator = new ProxyCreator(new ProxyFactoryServiceByteBuddy());
     }
 
     public static class Employee {
diff --git a/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_Test.java b/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_Test.java
index 0822142..eec5c5a 100644
--- a/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_Test.java
+++ b/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_Test.java
@@ -42,6 +42,8 @@ import org.apache.isis.applib.services.wrapper.DisabledException;
 import org.apache.isis.applib.services.wrapper.HiddenException;
 import org.apache.isis.applib.services.wrapper.InvalidException;
 import org.apache.isis.applib.services.xactn.TransactionService;
+import org.apache.isis.codegen.bytebuddy.services.ProxyFactoryServiceByteBuddy;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 import org.apache.isis.metamodel.MetaModelContext_forTesting;
 import org.apache.isis.metamodel.context.MetaModelContext;
 import org.apache.isis.metamodel.facetapi.FacetUtil;
@@ -75,6 +77,8 @@ import org.apache.isis.unittestsupport.config.internal._Config;
 import org.apache.isis.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import lombok.val;
+
 public class WrapperFactoryDefault_wrappedObject_Test {
 
     @Rule
@@ -121,13 +125,16 @@ public class WrapperFactoryDefault_wrappedObject_Test {
     public void setUp() {
 
         // PRODUCTION
+        
+        val proxyFactoryService = (ProxyFactoryService) new ProxyFactoryServiceByteBuddy();
 
         metaModelContext = MetaModelContext_forTesting.builder()
                 .specificationLoader(mockSpecificationLoader)
                 .objectManager(mockObjectManager)
 //                .singleton(mockPersistenceSessionServiceInternal)
                 .authenticationSessionProvider(mockAuthenticationSessionProvider)
-                .singleton(wrapperFactory = createWrapperFactory())
+                .singleton(proxyFactoryService)
+                .singleton(wrapperFactory = createWrapperFactory(proxyFactoryService))
                 .singleton(mockCommandContext)
                 .singleton(mockCommandDtoServiceInternal)
                 .singleton(mockFactoryService)
@@ -249,8 +256,11 @@ public class WrapperFactoryDefault_wrappedObject_Test {
         employeeWO = wrapperFactory.wrap(employeeDO);
     }
 
-    protected WrapperFactoryDefault createWrapperFactory() {
-        return new WrapperFactoryDefault();
+    protected WrapperFactoryDefault createWrapperFactory(ProxyFactoryService proxyFactoryService) {
+        val wrapperFactory = new WrapperFactoryDefault();
+        wrapperFactory.proxyFactoryService = proxyFactoryService;
+        wrapperFactory.init();
+        return wrapperFactory;
     }
 
     @Test
diff --git a/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_transient_Test.java b/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_transient_Test.java
index 683e842..c862c26 100644
--- a/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_transient_Test.java
+++ b/core/persistence/jdo/datanucleus-5/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault_wrappedObject_transient_Test.java
@@ -43,6 +43,8 @@ import org.apache.isis.applib.services.wrapper.events.PropertyModifyEvent;
 import org.apache.isis.applib.services.wrapper.events.PropertyUsabilityEvent;
 import org.apache.isis.applib.services.wrapper.events.PropertyVisibilityEvent;
 import org.apache.isis.applib.services.xactn.TransactionService;
+import org.apache.isis.codegen.bytebuddy.services.ProxyFactoryServiceByteBuddy;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 import org.apache.isis.metamodel.MetaModelContext_forTesting;
 import org.apache.isis.metamodel.consent.Allow;
 import org.apache.isis.metamodel.consent.Consent;
@@ -70,6 +72,8 @@ import org.apache.isis.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
 import static org.apache.isis.unittestsupport.jmocking.PostponedAction.returnValuePostponed;
 
+import lombok.val;
+
 /**
  * Contract test.
  */
@@ -114,12 +118,15 @@ public class WrapperFactoryDefault_wrappedObject_transient_Test {
     public void setUp() throws Exception {
 
         // PRODUCTION
-
+        
+        val proxyFactoryService = (ProxyFactoryService) new ProxyFactoryServiceByteBuddy();
+        
         metaModelContext = MetaModelContext_forTesting.builder()
                 .specificationLoader(mockSpecificationLoader)
                 .objectManager(mockObjectManager)
                 .authenticationSessionProvider(mockAuthenticationSessionProvider)
-                .singleton(wrapperFactory = createWrapperFactory())
+                .singleton(proxyFactoryService)
+                .singleton(wrapperFactory = createWrapperFactory(proxyFactoryService))
                 .singleton(mockFactoryService)
                 .singleton(mockIsisSessionFactory)
                 .singleton(mockTransactionService)
@@ -187,11 +194,11 @@ public class WrapperFactoryDefault_wrappedObject_transient_Test {
         employeeWO = wrapperFactory.wrap(employeeDO);
     }
 
-    /**
-     * Mandatory hook.
-     */
-    protected WrapperFactoryDefault createWrapperFactory() {
-        return new WrapperFactoryDefault();
+    protected WrapperFactoryDefault createWrapperFactory(ProxyFactoryService proxyFactoryService) {
+        val wrapperFactory = new WrapperFactoryDefault();
+        wrapperFactory.proxyFactoryService = proxyFactoryService;
+        wrapperFactory.init();
+        return wrapperFactory;
     }
 
     @Test(expected = DisabledException.class)
diff --git a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault.java b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault.java
index 6f55fad..91ea3b8 100644
--- a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault.java
+++ b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefault.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BiConsumer;
 
+import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import javax.inject.Named;
 
@@ -61,6 +62,7 @@ import org.apache.isis.applib.services.wrapper.listeners.InteractionListener;
 import org.apache.isis.applib.services.xactn.TransactionService;
 import org.apache.isis.commons.internal.base._Casts;
 import org.apache.isis.commons.internal.exceptions._Exceptions;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 import org.apache.isis.metamodel.context.MetaModelContext;
 import org.apache.isis.runtime.services.wrapper.dispatchers.InteractionEventDispatcher;
 import org.apache.isis.runtime.services.wrapper.dispatchers.InteractionEventDispatcherTypeSafe;
@@ -88,19 +90,18 @@ public class WrapperFactoryDefault implements WrapperFactory {
     @Inject private MetaModelContext metaModelContext;
     @Inject private IsisSessionFactory isisSessionFactory;
     @Inject private TransactionService transactionService;
+    @Inject protected ProxyFactoryService proxyFactoryService; // protected to allow JUnit test
 
     private final List<InteractionListener> listeners = new ArrayList<InteractionListener>();
-    private final ProxyContextHandler proxyContextHandler;
     private final Map<Class<? extends InteractionEvent>, InteractionEventDispatcher> 
         dispatchersByEventClass = 
             new HashMap<Class<? extends InteractionEvent>, InteractionEventDispatcher>();
-
-    public WrapperFactoryDefault() {
-        this(new ProxyCreator());
-    }
+    private ProxyContextHandler proxyContextHandler;
     
-    WrapperFactoryDefault(ProxyCreator proxyCreator) {
+    @PostConstruct
+    public void init() {
 
+        val proxyCreator = new ProxyCreator(proxyFactoryService);
         proxyContextHandler = new ProxyContextHandler(proxyCreator);
         
         putDispatcher(ObjectTitleEvent.class, (listener, event)->listener.objectTitleRead(event));
diff --git a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/proxy/ProxyCreator.java b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/proxy/ProxyCreator.java
index 9a29cdc..d5b26c5 100644
--- a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/proxy/ProxyCreator.java
+++ b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/wrapper/proxy/ProxyCreator.java
@@ -29,6 +29,7 @@ import org.apache.isis.applib.services.wrapper.WrappingObject;
 import org.apache.isis.commons.internal.base._Casts;
 import org.apache.isis.commons.internal.collections._Arrays;
 import org.apache.isis.commons.internal.plugins.codegen.ProxyFactory;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 import org.apache.isis.metamodel.specloader.classsubstitutor.ProxyEnhanced;
 import org.apache.isis.runtime.services.wrapper.handlers.DelegatingInvocationHandler;
 
@@ -39,9 +40,10 @@ import lombok.RequiredArgsConstructor;
 public class ProxyCreator {
 
     @NonNull private final Map<Class<?>, ProxyFactory<?>> proxyFactoryByClass;
+    @NonNull private final ProxyFactoryService proxyFactoryService;
 
-    public ProxyCreator() {
-        this(Collections.synchronizedMap(new WeakHashMap<>()));
+    public ProxyCreator(final ProxyFactoryService proxyFactoryService) {
+        this(Collections.synchronizedMap(new WeakHashMap<>()), proxyFactoryService);
     }
 
     public <T> T instantiateProxy(final DelegatingInvocationHandler<T> handler) {
@@ -77,7 +79,7 @@ public class ProxyCreator {
 
         final ProxyFactory<T> proxyFactory = ProxyFactory.builder(toProxyClass)
                 .interfaces(interfaces)
-                .build();
+                .build(proxyFactoryService);
 
         return proxyFactory;
     }
diff --git a/core/runtime-services/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefaultTest.java b/core/runtime-services/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefaultTest.java
index 9bbb6f5..1ff7e7f 100644
--- a/core/runtime-services/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefaultTest.java
+++ b/core/runtime-services/src/test/java/org/apache/isis/runtime/services/wrapper/WrapperFactoryDefaultTest.java
@@ -32,7 +32,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
 
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 import org.apache.isis.applib.services.wrapper.WrappingObject;
-import org.apache.isis.runtime.services.wrapper.proxy.ProxyCreator;
+import org.apache.isis.commons.internal.plugins.codegen.ProxyFactoryService;
 import org.apache.isis.unittestsupport.jmocking.JUnitRuleMockery2;
 
 import lombok.RequiredArgsConstructor;
@@ -66,8 +66,7 @@ public class WrapperFactoryDefaultTest {
     @Rule
     public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES);
 
-    @Mock
-    private ProxyCreator mockProxyCreator;
+    @Mock private ProxyFactoryService mockProxyFactoryService;
     private WrapperFactoryDefault wrapperFactory;
 
     private DomainObject createProxyCalledWithDomainObject;
@@ -75,15 +74,23 @@ public class WrapperFactoryDefaultTest {
 
     @Before
     public void setUp() throws Exception {
-        wrapperFactory = new WrapperFactoryDefault(mockProxyCreator) {
+        wrapperFactory = new WrapperFactoryDefault() {
 
             @Override
+            public void init() {
+                this.proxyFactoryService = mockProxyFactoryService; 
+                super.init();
+            }
+            
+            @Override
             protected <T> T createProxy(T domainObject, EnumSet<WrapperFactory.ExecutionMode> mode) {
                 WrapperFactoryDefaultTest.this.createProxyCalledWithMode = mode;
                 WrapperFactoryDefaultTest.this.createProxyCalledWithDomainObject = (DomainObject) domainObject;
                 return domainObject;
             }
         };
+        
+        
     }
 
     @Test
diff --git a/core/testsupport/unittestsupport/src/main/java/org/apache/isis/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java b/core/testsupport/unittestsupport/src/main/java/org/apache/isis/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
index 274d219..2d8f029 100644
--- a/core/testsupport/unittestsupport/src/main/java/org/apache/isis/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
+++ b/core/testsupport/unittestsupport/src/main/java/org/apache/isis/unittestsupport/jmocking/ImposteriserUsingCodegenPlugin.java
@@ -26,6 +26,7 @@ import org.jmock.api.Invocation;
 import org.jmock.api.Invokable;
 import org.jmock.lib.JavaReflectionImposteriser;
 
+import org.apache.isis.codegen.bytebuddy.services.ProxyFactoryServiceByteBuddy;
 import org.apache.isis.commons.internal.plugins.codegen.ProxyFactory;
 
 class ImposteriserUsingCodegenPlugin implements Imposteriser {
@@ -63,7 +64,7 @@ class ImposteriserUsingCodegenPlugin implements Imposteriser {
 
         final ProxyFactory<T> factory = ProxyFactory.builder(mockedType)
                 .interfaces(ancilliaryTypes)
-                .build();
+                .build(new ProxyFactoryServiceByteBuddy());
 
         final boolean initialize = false;