This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/deltaspike.git
The following commit(s) were added to refs/heads/master by this push:
new 80a09955d DELTASPIKE-1471 Remove @EnableInterceptors in favor of CDI
InterceptionFactory
80a09955d is described below
commit 80a09955db24432b596345021c6997339d587958
Author: Thomas Andraschko <[email protected]>
AuthorDate: Tue Feb 27 17:03:50 2024 +0100
DELTASPIKE-1471 Remove @EnableInterceptors in favor of CDI
InterceptionFactory
---
.../deltaspike/proxy/api/EnableInterceptors.java | 37 ---------
.../proxy/util/EnableInterceptorsInterceptor.java | 43 -----------
.../enableinterceptors/EnableInterceptorsTest.java | 90 ----------------------
.../proxy/impl/enableinterceptors/MyBean.java | 59 --------------
.../impl/enableinterceptors/MyBeanInterceptor.java | 37 ---------
.../MyBeanInterceptorBinding.java | 37 ---------
.../impl/enableinterceptors/MyBeanProducer.java | 33 --------
.../dynamicbinding/MyRepository.java | 39 ----------
.../dynamicbinding/MyRepositoryProducer.java | 32 --------
.../dynamicbinding/SimpleCache.java | 35 ---------
.../dynamicbinding/SimpleCacheExtension.java | 31 --------
.../dynamicbinding/SimpleCacheInterceptor.java | 47 -----------
.../dynamicbinding/SimpleCacheManager.java | 42 ----------
.../dynamicbinding/SimpleCacheTest.java | 82 --------------------
14 files changed, 644 deletions(-)
diff --git
a/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java
b/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java
deleted file mode 100644
index d8c59e3e6..000000000
---
a/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/api/EnableInterceptors.java
+++ /dev/null
@@ -1,37 +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.deltaspike.proxy.api;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import jakarta.interceptor.InterceptorBinding;
-
-@InterceptorBinding
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface EnableInterceptors
-{
-
-}
diff --git
a/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsInterceptor.java
b/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsInterceptor.java
deleted file mode 100644
index 8c7908fde..000000000
---
a/deltaspike/modules/proxy/api/obsolete/src/main/java/org/apache/deltaspike/proxy/util/EnableInterceptorsInterceptor.java
+++ /dev/null
@@ -1,43 +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.deltaspike.proxy.util;
-
-import java.io.Serializable;
-import jakarta.enterprise.inject.spi.BeanManager;
-import jakarta.inject.Inject;
-import jakarta.interceptor.AroundInvoke;
-import jakarta.interceptor.Interceptor;
-import jakarta.interceptor.InvocationContext;
-import org.apache.deltaspike.proxy.api.EnableInterceptors;
-
-@Interceptor
-@EnableInterceptors
-public class EnableInterceptorsInterceptor implements Serializable
-{
- @Inject
- private BeanManager beanManager;
-
- @AroundInvoke
- public Object wrapBeanCandidate(InvocationContext invocationContext)
throws Exception
- {
- Object producerResult = invocationContext.proceed();
-
- return EnableInterceptorsProxyFactory.wrap(producerResult,
beanManager);
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
deleted file mode 100644
index 2ff17cc59..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/EnableInterceptorsTest.java
+++ /dev/null
@@ -1,90 +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.deltaspike.proxy.impl.enableinterceptors;
-
-import jakarta.inject.Inject;
-
-import org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor;
-import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.descriptor.api.Descriptors;
-import org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(Arquillian.class)
-public class EnableInterceptorsTest
-{
- @Deployment
- public static WebArchive war()
- {
- String simpleName = EnableInterceptorsTest.class.getSimpleName();
- String archiveName = simpleName.substring(0, 1).toLowerCase() +
simpleName.substring(1);
-
- // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor
- BeansDescriptor beansWithEnablingInterceptor =
Descriptors.create(BeansDescriptor.class);
-
beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName());
-
- // war archive needs MyBeanInterceptor enabled
- BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
-
beans.getOrCreateInterceptors().clazz(MyBeanInterceptor.class.getName());
-
- JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName
+ ".jar")
- .addPackage(EnableInterceptorsTest.class.getPackage())
- .addAsManifestResource(new
StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml");
-
- return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
-
.addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive())
- .addAsLibraries(testJar)
- .addAsWebInfResource(new StringAsset(beans.exportAsString()),
"beans.xml");
- }
-
- @Inject
- private MyBean myBean;
-
- @Test
- public void testInterception() throws Exception
- {
- Assert.assertFalse(myBean.isIntercepted());
- Assert.assertFalse(myBean.isMethodCalled());
-
- myBean.somethingIntercepted();
-
- Assert.assertTrue(myBean.isIntercepted());
- Assert.assertTrue(myBean.isMethodCalled());
- }
-
- @Test
- public void testNonInterception() throws Exception
- {
- Assert.assertFalse(myBean.isIntercepted());
- Assert.assertFalse(myBean.isMethodCalled());
-
- myBean.somethingNotIntercepted();
-
- Assert.assertFalse(myBean.isIntercepted());
- Assert.assertTrue(myBean.isMethodCalled());
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java
deleted file mode 100644
index e1406e8fa..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBean.java
+++ /dev/null
@@ -1,59 +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.deltaspike.proxy.impl.enableinterceptors;
-
-import org.apache.deltaspike.core.api.exclude.Exclude;
-
-@Exclude
-public class MyBean
-{
- private boolean intercepted;
- private boolean methodCalled;
-
- public boolean isIntercepted()
- {
- return intercepted;
- }
-
- public void setIntercepted(boolean intercepted)
- {
- this.intercepted = intercepted;
- }
-
- public boolean isMethodCalled()
- {
- return methodCalled;
- }
-
- public void setMethodCalled(boolean methodCalled)
- {
- this.methodCalled = methodCalled;
- }
-
- @MyBeanInterceptorBinding
- public void somethingIntercepted()
- {
- methodCalled = true;
- }
-
- public void somethingNotIntercepted()
- {
- methodCalled = true;
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java
deleted file mode 100644
index f15fb71c3..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptor.java
+++ /dev/null
@@ -1,37 +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.deltaspike.proxy.impl.enableinterceptors;
-
-import java.io.Serializable;
-import jakarta.interceptor.AroundInvoke;
-import jakarta.interceptor.Interceptor;
-import jakarta.interceptor.InvocationContext;
-
-@Interceptor
-@MyBeanInterceptorBinding
-public class MyBeanInterceptor implements Serializable
-{
- @AroundInvoke
- public Object wrapBeanCandidate(InvocationContext invocationContext)
throws Exception
- {
- ((MyBean) invocationContext.getTarget()).setIntercepted(true);
-
- return invocationContext.proceed();
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java
deleted file mode 100644
index 4e57fb6c9..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanInterceptorBinding.java
+++ /dev/null
@@ -1,37 +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.deltaspike.proxy.impl.enableinterceptors;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import jakarta.interceptor.InterceptorBinding;
-
-@InterceptorBinding
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface MyBeanInterceptorBinding
-{
-
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java
deleted file mode 100644
index d3dfbd48f..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/MyBeanProducer.java
+++ /dev/null
@@ -1,33 +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.deltaspike.proxy.impl.enableinterceptors;
-
-import jakarta.enterprise.inject.Produces;
-import org.apache.deltaspike.proxy.api.EnableInterceptors;
-
-public class MyBeanProducer
-{
- @Produces
- @EnableInterceptors
- public MyBean produce()
- {
- MyBean myBean = new MyBean();
- return myBean;
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepository.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepository.java
deleted file mode 100644
index cad7803c6..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepository.java
+++ /dev/null
@@ -1,39 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.deltaspike.core.api.exclude.Exclude;
-
-@Exclude
-public class MyRepository
-{
- @SimpleCache
- public List<String> getAllUsers()
- {
- ArrayList<String> users = new ArrayList<>();
-
- users.add("Me");
- users.add("You");
- users.add("Anyone");
-
- return users;
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepositoryProducer.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepositoryProducer.java
deleted file mode 100644
index aa9268e60..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/MyRepositoryProducer.java
+++ /dev/null
@@ -1,32 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import jakarta.enterprise.inject.Produces;
-import org.apache.deltaspike.proxy.api.EnableInterceptors;
-
-public class MyRepositoryProducer
-{
- @Produces
- @EnableInterceptors
- public MyRepository produce()
- {
- return new MyRepository();
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCache.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCache.java
deleted file mode 100644
index 081fc0714..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCache.java
+++ /dev/null
@@ -1,35 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Documented
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.TYPE, ElementType.METHOD })
-public @interface SimpleCache
-{
-
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheExtension.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheExtension.java
deleted file mode 100644
index d34d6c8dc..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheExtension.java
+++ /dev/null
@@ -1,31 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import jakarta.enterprise.event.Observes;
-import jakarta.enterprise.inject.spi.BeforeBeanDiscovery;
-import jakarta.enterprise.inject.spi.Extension;
-
-public class SimpleCacheExtension implements Extension
-{
- void discoverInterceptorBindings(@Observes BeforeBeanDiscovery
beforeBeanDiscoveryEvent)
- {
- beforeBeanDiscoveryEvent.addInterceptorBinding(SimpleCache.class);
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheInterceptor.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheInterceptor.java
deleted file mode 100644
index 29054d63a..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheInterceptor.java
+++ /dev/null
@@ -1,47 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import java.io.Serializable;
-import jakarta.inject.Inject;
-import jakarta.interceptor.AroundInvoke;
-import jakarta.interceptor.Interceptor;
-import jakarta.interceptor.InvocationContext;
-
-@Interceptor
-@SimpleCache
-public class SimpleCacheInterceptor implements Serializable
-{
- @Inject
- private SimpleCacheManager scm;
-
- @AroundInvoke
- public Object wrapBeanCandidate(InvocationContext invocationContext)
throws Exception
- {
- if (scm.getSingletonCache().containsKey(invocationContext.getMethod()))
- {
- return scm.getSingletonCache().get(invocationContext.getMethod());
- }
-
- Object result = invocationContext.proceed();
- scm.getSingletonCache().put(invocationContext.getMethod(), result);
-
- return result;
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheManager.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheManager.java
deleted file mode 100644
index 13a5af40a..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheManager.java
+++ /dev/null
@@ -1,42 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-import jakarta.annotation.PostConstruct;
-import jakarta.enterprise.context.ApplicationScoped;
-
-@ApplicationScoped
-public class SimpleCacheManager {
-
- private Map<Method, Object> singletonCache;
-
- @PostConstruct
- public void init()
- {
- singletonCache = new HashMap<>();
- }
-
- public Map<Method, Object> getSingletonCache()
- {
- return singletonCache;
- }
-}
diff --git
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheTest.java
b/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheTest.java
deleted file mode 100644
index 267ed47e2..000000000
---
a/deltaspike/modules/proxy/impl-asm/obsolete/src/test/java/org/apache/deltaspike/proxy/impl/enableinterceptors/dynamicbinding/SimpleCacheTest.java
+++ /dev/null
@@ -1,82 +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.deltaspike.proxy.impl.enableinterceptors.dynamicbinding;
-
-import java.util.List;
-import jakarta.enterprise.inject.spi.Extension;
-import jakarta.inject.Inject;
-
-import org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor;
-import org.apache.deltaspike.test.proxy.impl.util.ArchiveUtils;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.descriptor.api.Descriptors;
-import org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(Arquillian.class)
-public class SimpleCacheTest
-{
- @Deployment
- public static WebArchive war()
- {
- String simpleName = SimpleCacheTest.class.getSimpleName();
- String archiveName = simpleName.substring(0, 1).toLowerCase() +
simpleName.substring(1);
-
- // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor
- BeansDescriptor beansWithEnablingInterceptor =
Descriptors.create(BeansDescriptor.class);
-
beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName());
-
- // war archive needs SimpleCacheInterceptor enabled
- BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
-
beans.getOrCreateInterceptors().clazz(SimpleCacheInterceptor.class.getName());
-
- JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName
+ ".jar")
- .addPackage(SimpleCacheTest.class.getPackage())
- .addAsManifestResource(new
StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml");
-
- return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
-
.addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive())
- .addAsLibraries(testJar)
- .addAsServiceProvider(Extension.class,
SimpleCacheExtension.class)
- .addAsWebInfResource(new StringAsset(beans.exportAsString()),
"beans.xml");
- }
-
- @Inject
- private MyRepository myRepository;
-
- @Test
- public void testCache() throws Exception
- {
- List<String> users = myRepository.getAllUsers();
-
- Assert.assertNotNull(users);
- Assert.assertEquals(3, users.size());
-
-
- Assert.assertSame(users, myRepository.getAllUsers());
- }
-
-}