Repository: deltaspike Updated Branches: refs/heads/master d858893cf -> 94b6f181e
DELTASPIKE-1051 AbstractMethodError with ApplicationScoped repository - tests to replicate the issue Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/cda343bc Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/cda343bc Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/cda343bc Branch: refs/heads/master Commit: cda343bca9e0ed543d60fcd0dc4c11072e083653 Parents: d858893 Author: Thomas Andraschko <[email protected]> Authored: Mon Dec 28 17:00:28 2015 +0100 Committer: Thomas Andraschko <[email protected]> Committed: Mon Dec 28 17:00:28 2015 +0100 ---------------------------------------------------------------------- .../api/partialbean/uc011/BaseRepository.java | 26 ++++++++ .../partialbean/uc011/CustomerRepository.java | 30 ++++++++++ .../api/partialbean/uc011/EntityRepository.java | 28 +++++++++ .../uc011/ScopedPartialBeanTest.java | 63 ++++++++++++++++++++ .../uc011/TestPartialBeanHandler.java | 19 ++++++ 5 files changed, 166 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cda343bc/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/BaseRepository.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/BaseRepository.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/BaseRepository.java new file mode 100644 index 0000000..2637aa7 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/BaseRepository.java @@ -0,0 +1,26 @@ +/* + * 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.uc011; + +import java.io.Serializable; + +public abstract class BaseRepository<E> implements EntityRepository<E, Long>, Serializable +{ + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cda343bc/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/CustomerRepository.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/CustomerRepository.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/CustomerRepository.java new file mode 100644 index 0000000..9c7fae4 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/CustomerRepository.java @@ -0,0 +1,30 @@ +/* + * 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.uc011; + +import javax.enterprise.context.ApplicationScoped; + +import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding; + +@TestPartialBeanBinding +@ApplicationScoped +public abstract class CustomerRepository extends BaseRepository<Object> +{ + +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cda343bc/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/EntityRepository.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/EntityRepository.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/EntityRepository.java new file mode 100644 index 0000000..74d15b5 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/EntityRepository.java @@ -0,0 +1,28 @@ +/* + * 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.uc011; + +import java.io.Serializable; + +public interface EntityRepository<E, PK extends Serializable> { + + E save(E entity); + + E findBy(PK primaryKey); +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cda343bc/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/ScopedPartialBeanTest.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/ScopedPartialBeanTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/ScopedPartialBeanTest.java new file mode 100644 index 0000000..c40c991 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/ScopedPartialBeanTest.java @@ -0,0 +1,63 @@ +/* + * 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.uc011; + +import org.apache.deltaspike.core.api.provider.BeanProvider; +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.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class ScopedPartialBeanTest +{ + @Deployment + public static WebArchive war() + { + final String simpleName = ScopedPartialBeanTest.class.getSimpleName(); + final String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1); + + final JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar") + .addPackage(ScopedPartialBeanTest.class.getPackage()) + .addPackage(TestPartialBeanBinding.class.getPackage()) + .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); + + final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, archiveName + ".war") + .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive()) + .addAsLibraries(testJar) + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); + + return webArchive; + } + + @Test + @Ignore("Test to demonstrate a weld proxy issue") + public void testPartialBeanWithApplicationScope() throws Throwable + { + CustomerRepository repository = BeanProvider.getContextualReference(CustomerRepository.class); + repository.save(null); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/cda343bc/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/TestPartialBeanHandler.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/TestPartialBeanHandler.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/TestPartialBeanHandler.java new file mode 100644 index 0000000..9af7484 --- /dev/null +++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc011/TestPartialBeanHandler.java @@ -0,0 +1,19 @@ +package org.apache.deltaspike.test.core.api.partialbean.uc011; + +import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding; + +import javax.enterprise.context.Dependent; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; + +@TestPartialBeanBinding +@Dependent +public class TestPartialBeanHandler implements InvocationHandler +{ + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + return null; + } + +}
