deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-823 Reimplement Partial-Bean module
Date Fri, 13 Feb 2015 13:16:16 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master cdefea9d3 -> e58890b55


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ScopedPartialBeanTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ScopedPartialBeanTest.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ScopedPartialBeanTest.java
new file mode 100644
index 0000000..6f61984
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ScopedPartialBeanTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.uc005;
+
+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.apache.deltaspike.test.utils.CdiContainerUnderTest;
+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.Assert;
+import org.junit.Assume;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class ScopedPartialBeanTest
+{
+    private static final String CONTAINER_OWB_1_2_x_BEFORE_1_2_8 = "owb-1\\.2\\.[0-7]";
+
+    @Deployment
+    public static WebArchive war()
+    {
+        if (CdiContainerUnderTest.is(CONTAINER_OWB_1_2_x_BEFORE_1_2_8))
+        {
+            return ShrinkWrap.create(WebArchive.class, "empty.war");
+        }
+
+        String simpleName = ScopedPartialBeanTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
+                .addPackage(ScopedPartialBeanTest.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 testPartialBeanWithApplicationScope() throws Exception
+    {
+        // this test is known to not work under OWB 1.2.0 till 1.2.7 - see OWB #1036
+        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_2_x_BEFORE_1_2_8));
+
+        String result = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class).willFail();
+
+        Assert.assertEquals("partial-test-false", result);
+
+        String result2 = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class).willFail2();
+
+        Assert.assertEquals("partial-test-false", result2);
+
+        int count = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class).getManualResult();
+        Assert.assertEquals(0, count);
+
+        count = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class).getManualResult();
+        Assert.assertEquals(1, count);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/SuperInterface.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/SuperInterface.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/SuperInterface.java
new file mode 100644
index 0000000..7dfc7a8
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/SuperInterface.java
@@ -0,0 +1,24 @@
+/*
+ * 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.uc005;
+
+public interface SuperInterface
+{
+    String willFail();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuper.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuper.java
new file mode 100644
index 0000000..9e09abf
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuper.java
@@ -0,0 +1,31 @@
+/*
+/*
+ * 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.uc006;
+
+public abstract class AbstractSuper<T> extends AbstractSuperSuper
+{
+    abstract T willFail2() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException;
+
+    @Override
+    public String willFail3() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException
+    {
+        return "willFail3";
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuperSuper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuperSuper.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuperSuper.java
new file mode 100644
index 0000000..3a0bc5c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/AbstractSuperSuper.java
@@ -0,0 +1,27 @@
+/*
+/*
+ * 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.uc006;
+
+public abstract class AbstractSuperSuper
+{
+    public abstract String willFail3() throws ClassNotFoundException, NoSuchMethodException,
NoSuchFieldException;
+
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ApplicationScopedPartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ApplicationScopedPartialBean.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ApplicationScopedPartialBean.java
new file mode 100644
index 0000000..35c5fe2
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ApplicationScopedPartialBean.java
@@ -0,0 +1,36 @@
+/*
+ * 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.uc006;
+
+import org.apache.deltaspike.test.core.api.partialbean.shared.ThrowExceptionPartialBeanBinding;
+import javax.enterprise.context.ApplicationScoped;
+
+@ThrowExceptionPartialBeanBinding
+@ApplicationScoped
+public abstract class ApplicationScopedPartialBean extends AbstractSuper<String>
+{
+    private int count;
+
+    public abstract String getResult();
+
+    public int getManualResult()
+    {
+        return count++;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ScopedPartialBeanTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ScopedPartialBeanTest.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ScopedPartialBeanTest.java
new file mode 100644
index 0000000..0321e14
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc006/ScopedPartialBeanTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.uc006;
+
+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.Assert;
+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
+    public void testPartialBeanWithApplicationScope() throws Exception
+    {
+        ApplicationScopedPartialBean bean = BeanProvider.getContextualReference(ApplicationScopedPartialBean.class);
+        bean.getManualResult();
+
+        Assert.assertEquals("willFail3", bean.willFail3());
+
+        try
+        {
+            BeanProvider.getContextualReference(ApplicationScopedPartialBean.class).willFail2();
+
+            Assert.fail("#willFail2 should actually throw a ClassNotFoundException");
+        }
+        catch (Exception e)
+        {
+            Assert.assertEquals(e.getClass(), ClassNotFoundException.class);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBean.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBean.java
new file mode 100644
index 0000000..bc70f5c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBean.java
@@ -0,0 +1,66 @@
+/*
+ * 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.uc007;
+
+import org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptor;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestInterceptorAware;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestBean;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+@TestPartialBeanBinding
+@RequestScoped
+@CustomInterceptor
+public abstract class PartialBean implements /*just needed for testing interceptors: */ TestInterceptorAware
+{
+    @Inject
+    private TestBean testBean;
+
+    private String value;
+    private boolean intercepted;
+
+    public abstract String getResult();
+
+    @PostConstruct
+    protected void onCreate()
+    {
+        this.value = "manual";
+    }
+
+    @PreDestroy
+    protected void onDestroy()
+    {
+        //TODO check in a test
+    }
+
+    public String getManualResult()
+    {
+        return this.value + "-" + this.testBean.getValue() + "-" + this.intercepted;
+    }
+
+    @Override
+    public void setIntercepted(boolean intercepted)
+    {
+        this.intercepted = intercepted;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBeanAsAbstractClassWithInterceptorTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBeanAsAbstractClassWithInterceptorTest.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBeanAsAbstractClassWithInterceptorTest.java
new file mode 100644
index 0000000..2df6a45
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/PartialBeanAsAbstractClassWithInterceptorTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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.uc007;
+
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.partialbean.spi.PartialBeanProvider;
+import org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+import org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;
+import org.apache.deltaspike.test.utils.CdiContainerUnderTest;
+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.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+@Ignore("1) currently fails on wildfly/jboss because interceptors doesn't work on partial
beans"
+        + "2) arquillian doesn't deploy the TestPartialBeanProvider if tested != *-build-managed
profiles")
+public class PartialBeanAsAbstractClassWithInterceptorTest
+{
+    public static final String CONTAINER_WELD_2_0_0 = "weld-2\\.0\\.0\\..*";
+
+    @Deployment
+    public static WebArchive war()
+    {
+        // test doesn't work correclty on Weld 2.0.0 because PostConstruct isn't called on
the partial bean
+        if (CdiContainerUnderTest.is(CONTAINER_WELD_2_0_0))
+        {
+            return ShrinkWrap.create(WebArchive.class, "empty.war");
+        }
+
+        Asset beansXml = new StringAsset(
+            "<beans><interceptors><class>" +
+                    CustomInterceptorImpl.class.getName() +
+            "</class></interceptors></beans>"
+        );
+
+        String simpleName = PartialBeanAsAbstractClassWithInterceptorTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
+                .addPackage(PartialBeanAsAbstractClassWithInterceptorTest.class.getPackage())
+                .addPackage(TestPartialBeanBinding.class.getPackage())
+                .addAsServiceProvider(PartialBeanProvider.class, TestPartialBeanProvider.class)
+                .addAsManifestResource(beansXml, "beans.xml");
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())
+                .addAsLibraries(testJar)
+                .addAsWebInfResource(beansXml, "beans.xml");
+    }
+
+    @Test
+    public void testPartialBeanAsAbstractClassWithInterceptor() throws Exception
+    {
+        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_WELD_2_0_0));
+
+        PartialBean partialBean = BeanProvider.getContextualReference(PartialBean.class);
+        Assert.assertNotNull(partialBean);
+
+        String result = partialBean.getResult();
+
+        Assert.assertEquals("partial-test-true", result);
+
+        result = partialBean.getManualResult();
+
+        Assert.assertEquals("manual-test-true", result);
+
+        //TODO test pre-destroy callback
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/TestPartialBeanProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/TestPartialBeanProvider.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/TestPartialBeanProvider.java
new file mode 100644
index 0000000..a1e8d5c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc007/TestPartialBeanProvider.java
@@ -0,0 +1,32 @@
+/*
+ * 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.uc007;
+
+import org.apache.deltaspike.partialbean.spi.AbstractPartialBeanProvider;
+import org.apache.deltaspike.partialbean.spi.PartialBeanBuilder;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanHandler;
+
+public class TestPartialBeanProvider extends AbstractPartialBeanProvider
+{
+    public TestPartialBeanProvider()
+    {
+        add(new PartialBeanBuilder(TestPartialBeanBinding.class, TestPartialBeanHandler.class,
PartialBean.class));
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
index 1cb1c6d..c75cc77 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
@@ -18,6 +18,8 @@
  */
 package org.apache.deltaspike.test.core.api.partialbean.util;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 
@@ -29,15 +31,26 @@ public abstract class ArchiveUtils
 
     public static JavaArchive[] getDeltaSpikeCoreAndPartialBeanArchive()
     {
-        String[] excludedFiles;
+        ArrayList<JavaArchive> result = new ArrayList<JavaArchive>();
 
-        excludedFiles = new String[]{"META-INF.apache-deltaspike.properties"};
+        JavaArchive[] temp;
 
-        return ShrinkWrapArchiveUtil.getArchives(null,
+        temp = ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
-                new String[]{"org.apache.deltaspike.core",
+                new String[] { "org.apache.deltaspike.core",
                         "org.apache.deltaspike.test.category",
-                        "org.apache.deltaspike.partialbean"}, excludedFiles,
+                        "org.apache.deltaspike.partialbean" },
+                new String[] { "META-INF.apache-deltaspike.properties" },
                 "ds-core_and_partial-bean");
+        result.addAll(Arrays.asList(temp));
+
+        temp = ShrinkWrapArchiveUtil.getArchives(null,
+                "META-INF/MANIFEST.MF",
+                new String[] { "org.objectweb.asm" },
+                new String[] { },
+                "asm");
+        result.addAll(Arrays.asList(temp));
+
+        return result.toArray(new JavaArchive[result.size()]);
     }
 }


Mime
View raw message