Repository: deltaspike Updated Branches: refs/heads/master 6f1b7efd6 -> 9ba6c92bd
DELTASPIKE-1039 LinkageError on container reboot Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/9ba6c92b Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/9ba6c92b Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/9ba6c92b Branch: refs/heads/master Commit: 9ba6c92bd6ba0bc7af433289d48eccfc313f8abd Parents: 6f1b7ef Author: tandraschko <[email protected]> Authored: Fri Dec 11 15:52:51 2015 +0100 Committer: tandraschko <[email protected]> Committed: Fri Dec 11 15:53:19 2015 +0100 ---------------------------------------------------------------------- .../uc010/PartialBeanAsAbstractClassTest.java | 80 ++++++++++++++++++++ .../partialbean/uc010/PartialBeanWrapper.java | 34 +++++++++ .../uc010/TestPartialBeanHandler.java | 35 +++++++++ .../proxy/impl/AsmProxyClassGenerator.java | 2 +- 4 files changed, 150 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9ba6c92b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanAsAbstractClassTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanAsAbstractClassTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanAsAbstractClassTest.java new file mode 100644 index 0000000..054175e --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanAsAbstractClassTest.java @@ -0,0 +1,80 @@ +/* + * 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.test.core.api.partialbean.uc010; + +import javax.enterprise.inject.spi.BeanManager; +import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding; +import org.apache.deltaspike.test.core.api.partialbean.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.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Test; +import org.junit.runner.RunWith; + +import javax.inject.Inject; +import org.apache.deltaspike.partialbean.impl.PartialBeanProxyFactory; +import org.apache.deltaspike.test.core.api.partialbean.uc010.PartialBeanWrapper.PartialBean; + +@RunWith(Arquillian.class) +public class PartialBeanAsAbstractClassTest +{ + @Inject + private PartialBean partialBean; + + @Inject + private BeanManager beanManager; + + @Deployment + public static WebArchive war() + { + String simpleName = PartialBeanAsAbstractClassTest.class.getSimpleName(); + String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") + .addPackage(PartialBeanAsAbstractClassTest.class.getPackage()) + .addPackage(TestPartialBeanBinding.class.getPackage()) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + + WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName + ".war") + .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive()) + .addAsLibraries(testJar) + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + + return webArchive; + } + + @Test + public void testDuplicateProxyGeneration() throws Exception + { + this.partialBean.getResult("test"); + + PartialBeanProxyFactory.getInstance().getProxyClass( + beanManager, + PartialBean.class, + TestPartialBeanHandler.class); + + PartialBeanProxyFactory.getInstance().getProxyClass( + beanManager, + PartialBean.class, + TestPartialBeanHandler.class); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9ba6c92b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanWrapper.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanWrapper.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanWrapper.java new file mode 100644 index 0000000..187e958 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/PartialBeanWrapper.java @@ -0,0 +1,34 @@ +/* + * 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.test.core.api.partialbean.uc010; + +import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding; +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.RequestScoped; + +@ApplicationScoped +public class PartialBeanWrapper +{ + @TestPartialBeanBinding + @RequestScoped + public interface PartialBean + { + String getResult(String value); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9ba6c92b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/TestPartialBeanHandler.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/TestPartialBeanHandler.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/TestPartialBeanHandler.java new file mode 100644 index 0000000..3f5548b --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc010/TestPartialBeanHandler.java @@ -0,0 +1,35 @@ +/* + * 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.test.core.api.partialbean.uc010; + +import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import javax.enterprise.context.ApplicationScoped; + +@TestPartialBeanBinding +@ApplicationScoped +public class TestPartialBeanHandler implements InvocationHandler +{ + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + return null; + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/9ba6c92b/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java b/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java index 59860e4..c795a0c 100644 --- a/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java +++ b/deltaspike/modules/proxy/impl-asm5/src/main/java/org/apache/deltaspike/proxy/impl/AsmProxyClassGenerator.java @@ -57,7 +57,7 @@ public class AsmProxyClassGenerator implements ProxyClassGenerator java.lang.reflect.Method[] delegateMethods, java.lang.reflect.Method[] interceptMethods) { - String proxyName = targetClass.getCanonicalName() + suffix; + String proxyName = targetClass.getName() + suffix; String classFileName = proxyName.replace('.', '/'); byte[] proxyBytes = generateProxyClassBytes(targetClass, delegateInvocationHandlerClass,
