You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2013/03/25 22:54:29 UTC
[1/2] DELTASPIKE-331 partial-bean module
Updated Branches:
refs/heads/master 682741460 -> 82be1a295
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestBean.java
new file mode 100644
index 0000000..ec3c0ac
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestBean.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.shared;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class TestBean
+{
+ public String getValue()
+ {
+ return "test";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestInterceptorAware.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestInterceptorAware.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestInterceptorAware.java
new file mode 100644
index 0000000..5140121
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestInterceptorAware.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.shared;
+
+/**
+ * Just needed for testing interceptors
+ */
+public interface TestInterceptorAware
+{
+ void setIntercepted(boolean intercepted);
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanBinding.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanBinding.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanBinding.java
new file mode 100644
index 0000000..be4c389
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanBinding.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.shared;
+
+import org.apache.deltaspike.partialbean.api.annotation.PartialBeanBinding;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@PartialBeanBinding
+
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface TestPartialBeanBinding
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanHandler.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanHandler.java
new file mode 100644
index 0000000..69e9712
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/TestPartialBeanHandler.java
@@ -0,0 +1,60 @@
+/*
+ * 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.shared;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+@TestPartialBeanBinding
+@CustomInterceptor //for uc003
+@Dependent //normal-scopes are possible as well
+public class TestPartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware
+{
+ @Inject
+ private TestBean testBean;
+
+ private String value;
+ private boolean intercepted;
+
+ @PostConstruct
+ protected void onCreate()
+ {
+ this.value = "partial";
+ }
+
+ @PreDestroy
+ protected void onDestroy()
+ {
+ //TODO check in a test
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+ {
+ return this.value + "-" + this.testBean.getValue() + "-" + this.intercepted;
+ }
+
+ public void setIntercepted(boolean intercepted)
+ {
+ this.intercepted = intercepted;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBean.java
new file mode 100644
index 0000000..72ba7e9
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBean.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.uc001;
+
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+
+import javax.enterprise.context.RequestScoped;
+
+@TestPartialBeanBinding
+@RequestScoped
+public interface PartialBean
+{
+ String getResult();
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
new file mode 100644
index 0000000..00d4a60
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.uc001;
+
+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;
+
+import javax.inject.Inject;
+
+@RunWith(Arquillian.class)
+public class PartialBeanAsInterfaceTest
+{
+ @Inject
+ private PartialBean partialBean;
+
+ @Deployment
+ public static WebArchive war()
+ {
+ String simpleName = PartialBeanAsInterfaceTest.class.getSimpleName();
+ String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+ JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
+ .addPackage(PartialBeanAsInterfaceTest.class.getPackage())
+ .addPackage(TestPartialBeanBinding.class.getPackage())
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+ return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())
+ .addAsLibraries(testJar)
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ public void testPartialBeanAsInterface() throws Exception
+ {
+ String result = this.partialBean.getResult();
+
+ Assert.assertEquals("partial-test-false", result);
+
+ //TODO test pre-destroy callback
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBean.java
new file mode 100644
index 0000000..a9db392
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBean.java
@@ -0,0 +1,56 @@
+/*
+ * 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.uc002;
+
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+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
+public abstract class PartialBean
+{
+ @Inject
+ private TestBean testBean;
+
+ private String value;
+
+ 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();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
new file mode 100644
index 0000000..eec97c3
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.uc002;
+
+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;
+
+import javax.inject.Inject;
+
+@RunWith(Arquillian.class)
+public class PartialBeanAsAbstractClassTest
+{
+ @Inject
+ private PartialBean partialBean;
+
+ @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");
+
+ return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())
+ .addAsLibraries(testJar)
+ .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
+
+ @Test
+ public void testPartialBeanAsAbstractClass() throws Exception
+ {
+ String result = this.partialBean.getResult();
+
+ Assert.assertEquals("partial-test-false", result);
+
+ result = this.partialBean.getManualResult();
+
+ Assert.assertEquals("manual-test", result);
+
+ //TODO test pre-destroy callback
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBean.java
new file mode 100644
index 0000000..898d6d1
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/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.uc003;
+
+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 //doesn't work currently
+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/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
new file mode 100644
index 0000000..40fadde
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.uc003;
+
+import org.apache.deltaspike.test.category.SeCategory;
+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.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.EmptyAsset;
+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.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import javax.inject.Inject;
+
+@RunWith(Arquillian.class)
+@Category(SeCategory.class) //TODO use different category (only new versions of weld)
+public class PartialBeanAsAbstractClassWithInterceptorTest
+{
+ @Inject
+ private PartialBean partialBean;
+
+ @Deployment
+ public static WebArchive 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())
+ .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+ return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+ .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())
+ .addAsLibraries(testJar)
+ .addAsWebInfResource(beansXml, "beans.xml");
+ }
+
+ @Test
+ public void testPartialBeanAsAbstractClassWithInterceptor() throws Exception
+ {
+ String result = this.partialBean.getResult();
+
+ Assert.assertEquals("partial-test-true", result);
+
+ result = this.partialBean.getManualResult();
+
+ //"manual-test-true" would be the goal, but it isn't supported (for now)
+ Assert.assertEquals("manual-test-false", result);
+
+ //TODO test pre-destroy callback
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/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
new file mode 100644
index 0000000..d70ebf4
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/util/ArchiveUtils.java
@@ -0,0 +1,40 @@
+/*
+ * 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.util;
+
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public abstract class ArchiveUtils
+{
+ private ArchiveUtils()
+ {
+ }
+
+ public static JavaArchive[] getDeltaSpikeCoreAndPartialBeanArchive()
+ {
+ String[] excludedFiles;
+
+ excludedFiles = new String[]{"META-INF.apache-deltaspike.properties"};
+
+ return ShrinkWrapArchiveUtil.getArchives(null,
+ "META-INF/beans.xml",
+ new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.partialbean"}, excludedFiles);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/resources/META-INF/beans.xml b/deltaspike/modules/partial-bean/impl/src/test/resources/META-INF/beans.xml
new file mode 100644
index 0000000..0eaf52c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/resources/META-INF/beans.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <!-- DON'T add content to this file - it's >only< needed as marker file for the test-scan -->
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/resources/arquillian.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/resources/arquillian.xml b/deltaspike/modules/partial-bean/impl/src/test/resources/arquillian.xml
new file mode 100644
index 0000000..d6165ac
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/resources/arquillian.xml
@@ -0,0 +1,82 @@
+<!--
+ 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.
+-->
+
+<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <!--Uncomment to have test archives exported to the file system for inspection -->
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <container qualifier="jbossas-managed-7">
+ <configuration>
+ <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+ <property name="outputToConsole">false</property>
+ <property name="allowConnectingToRunningServer">true</property>
+ </configuration>
+ </container>
+
+ <container qualifier="jbossas-build-managed-7">
+ <configuration>
+ <property name="jbossHome">${arquillian.jboss_home}</property>
+ <property name="javaVmArguments">-client -noverify -Xms64m -Xmx1024m -XX:MaxPermSize=512m</property>
+ <property name="outputToConsole">false</property>
+ <property name="allowConnectingToRunningServer">true</property>
+ </configuration>
+ </container>
+
+ <container qualifier="jbossas-remote-7">
+ <!--
+ for remote debugging enable "remote socket debugging" - uncomment:
+ set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+ in
+ standalone.conf (standalone.conf.bat)
+ and connect to
+ port 8787
+ -->
+ </container>
+
+ <!-- don't remove the qualifier - it's needed for the arquillian.launch property -->
+ <container qualifier="glassfish-remote-3.1">
+ </container>
+
+ <container qualifier="wls-remote-12c">
+ <configuration>
+ <property name="adminUrl">t3://localhost:7001</property>
+ <property name="adminUserName">weblogic1</property>
+ <property name="adminPassword">weblogic1</property>
+ <property name="target">AdminServer</property>
+ <property name="wlsHome">${WLS_HOME}</property>
+ </configuration>
+ </container>
+
+ <container qualifier="tomee">
+ <configuration>
+ <!-- tomee gets copied to this directory during the build -->
+ <property name="dir">target/tomee</property>
+
+ <!-- value '-1' to allow arquillian-tomee-remote to use dynamic settings -->
+ <property name="httpPort">-1</property>
+ <property name="ajpPort">-1</property>
+ <property name="stopPort">-1</property>
+ <property name="appWorkingDir">target/arquillian-test-working-dir</property>
+ </configuration>
+ </container>
+</arquillian>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/pom.xml b/deltaspike/modules/partial-bean/pom.xml
new file mode 100644
index 0000000..c83c77b
--- /dev/null
+++ b/deltaspike/modules/partial-bean/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>modules-project</artifactId>
+ <version>0.4-incubating-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>partial-bean-module-project</artifactId>
+ <version>0.4-incubating-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Apache DeltaSpike Partial-Bean-Module</name>
+
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/pom.xml b/deltaspike/modules/pom.xml
index 0d11653..b1b9656 100644
--- a/deltaspike/modules/pom.xml
+++ b/deltaspike/modules/pom.xml
@@ -38,5 +38,6 @@
<module>security</module>
<module>jpa</module>
<module>jsf</module>
+ <module>partial-bean</module>
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/parent/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/parent/pom.xml b/deltaspike/parent/pom.xml
index 1829997..aad8b5d 100644
--- a/deltaspike/parent/pom.xml
+++ b/deltaspike/parent/pom.xml
@@ -538,6 +538,20 @@
</dependency>
<dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-partial-bean-module-api</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-partial-bean-module-impl</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_2.5_spec</artifactId>
<version>${geronimo-servlet-2.5-spec.version}</version>
[2/2] git commit: DELTASPIKE-331 partial-bean module
Posted by gp...@apache.org.
DELTASPIKE-331 partial-bean module
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/82be1a29
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/82be1a29
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/82be1a29
Branch: refs/heads/master
Commit: 82be1a295a33fdea4ee43d0178d0d778e14356c7
Parents: 6827414
Author: gpetracek <gp...@apache.org>
Authored: Mon Mar 25 22:35:17 2013 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Mon Mar 25 22:51:17 2013 +0100
----------------------------------------------------------------------
.../annotation/InvocationHandlerBinding.java | 31 ---
deltaspike/core/impl/pom.xml | 5 -
.../InvocationHandlerBindingExtension.java | 189 ---------------
.../invocationhandler/PartialBeanLifecycle.java | 147 -----------
.../PartialBeanMethodHandler.java | 48 ----
.../services/javax.enterprise.inject.spi.Extension | 1 -
.../shared/CustomInterceptor.java | 33 ---
.../shared/CustomInterceptorImpl.java | 42 ----
.../shared/PartialBeanBinding.java | 35 ---
.../shared/PartialBeanHandler.java | 60 -----
.../api/invocationhandler/shared/TestBean.java | 30 ---
.../shared/TestInterceptorAware.java | 27 --
.../api/invocationhandler/uc001/PartialBean.java | 30 ---
.../uc001/PartialBeanAsInterfaceTest.java | 67 -----
.../api/invocationhandler/uc002/PartialBean.java | 56 -----
.../uc002/PartialBeanAsAbstractClassTest.java | 71 ------
.../api/invocationhandler/uc003/PartialBean.java | 66 -----
...tialBeanAsAbstractClassWithInterceptorTest.java | 84 -------
deltaspike/modules/partial-bean/api/pom.xml | 60 +++++
.../api/annotation/PartialBeanBinding.java | 31 +++
.../api/src/main/resources/META-INF/beans.xml | 22 ++
deltaspike/modules/partial-bean/impl/pom.xml | 50 ++++
.../impl/PartialBeanBindingExtension.java | 189 +++++++++++++++
.../partialbean/impl/PartialBeanLifecycle.java | 147 +++++++++++
.../partialbean/impl/PartialBeanMethodHandler.java | 48 ++++
.../impl/src/main/resources/META-INF/beans.xml | 23 ++
.../services/javax.enterprise.inject.spi.Extension | 20 ++
.../api/partialbean/shared/CustomInterceptor.java | 33 +++
.../partialbean/shared/CustomInterceptorImpl.java | 42 ++++
.../test/core/api/partialbean/shared/TestBean.java | 30 +++
.../partialbean/shared/TestInterceptorAware.java | 27 ++
.../partialbean/shared/TestPartialBeanBinding.java | 35 +++
.../partialbean/shared/TestPartialBeanHandler.java | 60 +++++
.../core/api/partialbean/uc001/PartialBean.java | 30 +++
.../uc001/PartialBeanAsInterfaceTest.java | 67 +++++
.../core/api/partialbean/uc002/PartialBean.java | 56 +++++
.../uc002/PartialBeanAsAbstractClassTest.java | 71 ++++++
.../core/api/partialbean/uc003/PartialBean.java | 66 +++++
...tialBeanAsAbstractClassWithInterceptorTest.java | 84 +++++++
.../core/api/partialbean/util/ArchiveUtils.java | 40 +++
.../impl/src/test/resources/META-INF/beans.xml | 24 ++
.../impl/src/test/resources/arquillian.xml | 82 +++++++
deltaspike/modules/partial-bean/pom.xml | 40 +++
deltaspike/modules/pom.xml | 1 +
deltaspike/parent/pom.xml | 14 +
45 files changed, 1392 insertions(+), 1022 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/invocationhandler/annotation/InvocationHandlerBinding.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/invocationhandler/annotation/InvocationHandlerBinding.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/invocationhandler/annotation/InvocationHandlerBinding.java
deleted file mode 100644
index a4fdda9..0000000
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/invocationhandler/annotation/InvocationHandlerBinding.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.core.api.invocationhandler.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@Retention(RUNTIME)
-@Target(ANNOTATION_TYPE)
-public @interface InvocationHandlerBinding
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/pom.xml b/deltaspike/core/impl/pom.xml
index 3c99e9c..a978232 100644
--- a/deltaspike/core/impl/pom.xml
+++ b/deltaspike/core/impl/pom.xml
@@ -55,11 +55,6 @@
<artifactId>deltaspike-core-api</artifactId>
<version>${project.version}</version>
</dependency>
-
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/InvocationHandlerBindingExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/InvocationHandlerBindingExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/InvocationHandlerBindingExtension.java
deleted file mode 100644
index 061f5d2..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/InvocationHandlerBindingExtension.java
+++ /dev/null
@@ -1,189 +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.core.impl.invocationhandler;
-
-import org.apache.deltaspike.core.api.invocationhandler.annotation.InvocationHandlerBinding;
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.ClassUtils;
-import org.apache.deltaspike.core.util.bean.BeanBuilder;
-import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class InvocationHandlerBindingExtension implements Extension, Deactivatable
-{
- private static final Logger LOG = Logger.getLogger(InvocationHandlerBindingExtension.class.getName());
-
- private Boolean isActivated = true;
- private Map<Class<?>, Class<? extends Annotation>> partialBeans =
- new HashMap<Class<?>, Class<? extends Annotation>>();
- private Map<Class<? extends Annotation>, Class<? extends InvocationHandler>> partialBeanHandlers =
- new HashMap<Class<? extends Annotation>, Class<? extends InvocationHandler>>();
-
- private IllegalStateException definitionError;
-
- protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
- {
- this.isActivated = ClassDeactivationUtils.isActivated(getClass());
-
- if (this.isActivated)
- {
- this.isActivated = ClassUtils.tryToLoadClassForName("javassist.util.proxy.ProxyFactory") != null;
-
- if (!this.isActivated && LOG.isLoggable(Level.WARNING))
- {
- LOG.warning("@" + InvocationHandlerBinding.class.getName() +
- " deactivated because Javassist is missing.");
- }
- }
- }
-
- public <X> void findInvocationHandlerBindings(@Observes ProcessAnnotatedType<X> pat, BeanManager beanManager)
- {
- if (!this.isActivated || this.definitionError != null)
- {
- return;
- }
-
- Class<X> beanClass = pat.getAnnotatedType().getJavaClass();
- Class<? extends Annotation> bindingAnnotationClass = getInvocationHandlerBindingAnnotationClass(pat);
-
- if (bindingAnnotationClass == null)
- {
- return;
- }
-
- if ((beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers())))
- {
- this.partialBeans.put(beanClass, bindingAnnotationClass);
- }
- else if (InvocationHandler.class.isAssignableFrom(beanClass))
- {
- validateInvocationHandler(
- beanClass, bindingAnnotationClass, pat.getAnnotatedType().getAnnotations(), beanManager);
-
- this.partialBeanHandlers.put(bindingAnnotationClass, (Class<? extends InvocationHandler>) beanClass);
- }
- else
- {
- this.definitionError = new IllegalStateException(beanClass.getName() + " is annotated with @" +
- bindingAnnotationClass.getName() + " and therefore has to be " +
- "an abstract class, an interface or an implementation of " + InvocationHandler.class.getName());
- }
- }
-
- public <X> void createBeans(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
- {
- if (!this.isActivated)
- {
- return;
- }
-
- if (this.definitionError != null)
- {
- afterBeanDiscovery.addDefinitionError(this.definitionError);
- return;
- }
-
- for (Map.Entry<Class<?>, Class<? extends Annotation>> partialBeanEntry : this.partialBeans.entrySet())
- {
- Bean partialBean = createPartialBean(partialBeanEntry.getKey(), partialBeanEntry.getValue(), beanManager);
-
- if (partialBean != null)
- {
- afterBeanDiscovery.addBean(partialBean);
- }
- else
- {
- afterBeanDiscovery.addDefinitionError(new IllegalStateException("A class which implements " +
- InvocationHandler.class.getName() + " and is annotated with @" +
- partialBeanEntry.getValue().getName() + " is needed as a handler for " +
- partialBeanEntry.getKey().getName() + ". See the documentation about @" +
- InvocationHandlerBinding.class.getName() + "."));
- }
- }
-
- this.partialBeans.clear();
- this.partialBeanHandlers.clear();
- }
-
- protected <T> Bean<T> createPartialBean(Class<T> beanClass,
- Class<? extends Annotation> bindingAnnotationClass,
- BeanManager beanManager)
- {
- Class<? extends InvocationHandler> invocationHandlerClass = partialBeanHandlers.get(bindingAnnotationClass);
-
- if (invocationHandlerClass == null)
- {
- return null;
- }
-
- AnnotatedType<T> annotatedType = new AnnotatedTypeBuilder<T>().readFromType(beanClass).create();
-
- BeanBuilder<T> beanBuilder = new BeanBuilder<T>(beanManager)
- .readFromType(annotatedType)
- .passivationCapable(true)
- .beanLifecycle(new PartialBeanLifecycle(beanClass, invocationHandlerClass, beanManager));
-
- return beanBuilder.create();
- }
-
- protected <X> Class<? extends Annotation> getInvocationHandlerBindingAnnotationClass(ProcessAnnotatedType<X> pat)
- {
- for (Annotation annotation : pat.getAnnotatedType().getAnnotations())
- {
- if (annotation.annotationType().isAnnotationPresent(InvocationHandlerBinding.class))
- {
- return annotation.annotationType();
- }
- }
-
- return null;
- }
-
- protected <X> void validateInvocationHandler(Class<X> beanClass,
- Class<? extends Annotation> bindingAnnotationClass,
- Set<Annotation> annotations,
- BeanManager beanManager)
- {
- Class<? extends InvocationHandler> alreadyFoundHandler = this.partialBeanHandlers.get(bindingAnnotationClass);
- if (alreadyFoundHandler != null)
- {
- this.definitionError = new IllegalStateException("Multiple handlers found for " +
- bindingAnnotationClass.getName() + " (" +
- alreadyFoundHandler.getName() + " and " + beanClass.getName() + ")");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanLifecycle.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanLifecycle.java
deleted file mode 100644
index e426f0d..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanLifecycle.java
+++ /dev/null
@@ -1,147 +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.core.impl.invocationhandler;
-
-import javassist.util.proxy.MethodFilter;
-import javassist.util.proxy.ProxyFactory;
-import javassist.util.proxy.ProxyObject;
-import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.util.ExceptionUtils;
-import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
-import org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.util.Set;
-
-class PartialBeanLifecycle<T, H extends InvocationHandler> implements ContextualLifecycle<T>
-{
- private final Class<? extends T> partialBeanProxyClass;
-
- private final InjectionTarget<T> partialBeanInjectionTarget;
- private final Class<H> handlerClass;
- private CreationalContext<?> creationalContextOfDependentHandler;
-
- PartialBeanLifecycle(Class<T> partialBeanClass, Class<H> handlerClass, BeanManager beanManager)
- {
- this.handlerClass = handlerClass;
-
- ProxyFactory proxyFactory = new ProxyFactory();
-
- if (partialBeanClass.isInterface())
- {
- this.partialBeanInjectionTarget = null;
-
- proxyFactory.setInterfaces(new Class[]{partialBeanClass});
- }
- else
- {
- AnnotatedTypeBuilder<T> partialBeanTypeBuilder =
- new AnnotatedTypeBuilder<T>().readFromType(partialBeanClass);
- this.partialBeanInjectionTarget = beanManager.createInjectionTarget(partialBeanTypeBuilder.create());
-
- proxyFactory.setSuperclass(partialBeanClass);
- }
-
- proxyFactory.setFilter(new MethodFilter()
- {
- public boolean isHandled(Method method)
- {
- return !"finalize".equals(method.getName());
- }
- });
-
- this.partialBeanProxyClass = ((Class<?>) proxyFactory.createClass()).asSubclass(partialBeanClass);
- }
-
- public T create(Bean bean, CreationalContext creationalContext)
- {
- try
- {
- H handlerInstance = createHandlerInstance();
-
- T instance = this.partialBeanProxyClass.newInstance();
-
- if (this.partialBeanInjectionTarget != null)
- {
- this.partialBeanInjectionTarget.inject(instance, creationalContext);
- this.partialBeanInjectionTarget.postConstruct(instance);
- }
-
- PartialBeanMethodHandler<H> methodHandler = new PartialBeanMethodHandler<H>(handlerInstance);
- ((ProxyObject) instance).setHandler(methodHandler);
- return instance;
- }
- catch (Exception e)
- {
- ExceptionUtils.throwAsRuntimeException(e);
- }
- //can't happen
- return null;
- }
-
- private H createHandlerInstance()
- {
- Set<Bean<H>> handlerBeans = BeanProvider.getBeanDefinitions(this.handlerClass, false, true);
-
- if (handlerBeans.size() != 1)
- {
- throw new IllegalStateException(handlerBeans.size() + " beans found for " + this.handlerClass);
- }
-
- Bean<H> handlerBean = handlerBeans.iterator().next();
-
- BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
- CreationalContext<?> creationalContextOfHandler = beanManager.createCreationalContext(handlerBean);
-
- H handlerInstance = (H)beanManager.getReference(handlerBean, this.handlerClass, creationalContextOfHandler);
-
- if (handlerBean.getScope().equals(Dependent.class))
- {
- this.creationalContextOfDependentHandler = creationalContextOfHandler;
- }
- return handlerInstance;
- }
-
- public void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext)
- {
- if (this.partialBeanInjectionTarget != null)
- {
- this.partialBeanInjectionTarget.preDestroy(instance);
- }
-
- if (this.creationalContextOfDependentHandler != null)
- {
- this.creationalContextOfDependentHandler.release();
- }
-
- /*
- H handlerInstance = (H) ((PartialBeanMethodHandler)((ProxyObject) instance).getHandler()).getHandlerInstance();
- injectionTarget.dispose(handlerInstance); //currently producers aren't supported
- }
- */
- creationalContext.release();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanMethodHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanMethodHandler.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanMethodHandler.java
deleted file mode 100644
index ab1e340..0000000
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/invocationhandler/PartialBeanMethodHandler.java
+++ /dev/null
@@ -1,48 +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.core.impl.invocationhandler;
-
-import javassist.util.proxy.MethodHandler;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-class PartialBeanMethodHandler<T extends InvocationHandler> implements MethodHandler
-{
- private final T handlerInstance;
-
- PartialBeanMethodHandler(T handlerInstance)
- {
- this.handlerInstance = handlerInstance;
- }
-
- public Object invoke(Object target, Method method, Method proceedMethod, Object[] arguments) throws Throwable
- {
- if (proceedMethod != null)
- {
- return proceedMethod.invoke(target, arguments);
- }
- return this.handlerInstance.invoke(target, method, arguments);
- }
-
- T getHandlerInstance()
- {
- return this.handlerInstance;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/deltaspike/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
index 4beacd7..b58a69f 100644
--- a/deltaspike/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ b/deltaspike/core/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -22,4 +22,3 @@ org.apache.deltaspike.core.impl.message.MessageBundleExtension
org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension
org.apache.deltaspike.core.impl.config.ConfigurationExtension
org.apache.deltaspike.core.impl.jmx.MBeanExtension
-org.apache.deltaspike.core.impl.invocationhandler.InvocationHandlerBindingExtension
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptor.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptor.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptor.java
deleted file mode 100644
index 4cc74a9..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptor.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.test.core.api.invocationhandler.shared;
-
-import javax.interceptor.InterceptorBinding;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@Retention(RUNTIME)
-@Target(TYPE)
-@InterceptorBinding
-public @interface CustomInterceptor
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptorImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptorImpl.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptorImpl.java
deleted file mode 100644
index fc2ef3a..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/CustomInterceptorImpl.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.test.core.api.invocationhandler.shared;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-import java.io.Serializable;
-
-@Interceptor
-@CustomInterceptor
-public class CustomInterceptorImpl implements Serializable
-{
- @AroundInvoke
- public Object interceptIt(InvocationContext invocationContext) throws Exception
- {
- Object target = invocationContext.getTarget();
-
- if (target instanceof TestInterceptorAware)
- {
- ((TestInterceptorAware)target).setIntercepted(true);
- }
-
- return invocationContext.proceed();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanBinding.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanBinding.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanBinding.java
deleted file mode 100644
index 4d33eab..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanBinding.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.test.core.api.invocationhandler.shared;
-
-import org.apache.deltaspike.core.api.invocationhandler.annotation.InvocationHandlerBinding;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-@InvocationHandlerBinding
-
-@Retention(RUNTIME)
-@Target(TYPE)
-public @interface PartialBeanBinding
-{
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanHandler.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanHandler.java
deleted file mode 100644
index bac54f8..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/PartialBeanHandler.java
+++ /dev/null
@@ -1,60 +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.test.core.api.invocationhandler.shared;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.Dependent;
-import javax.inject.Inject;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-@PartialBeanBinding
-@CustomInterceptor //for uc003
-@Dependent //normal-scopes are possible as well
-public class PartialBeanHandler implements InvocationHandler, /*just needed for testing interceptors: */TestInterceptorAware
-{
- @Inject
- private TestBean testBean;
-
- private String value;
- private boolean intercepted;
-
- @PostConstruct
- protected void onCreate()
- {
- this.value = "partial";
- }
-
- @PreDestroy
- protected void onDestroy()
- {
- //TODO check in a test
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return this.value + "-" + this.testBean.getValue() + "-" + this.intercepted;
- }
-
- public void setIntercepted(boolean intercepted)
- {
- this.intercepted = intercepted;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestBean.java
deleted file mode 100644
index 1acd85e..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestBean.java
+++ /dev/null
@@ -1,30 +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.test.core.api.invocationhandler.shared;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-public class TestBean
-{
- public String getValue()
- {
- return "test";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestInterceptorAware.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestInterceptorAware.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestInterceptorAware.java
deleted file mode 100644
index 58044dd..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/shared/TestInterceptorAware.java
+++ /dev/null
@@ -1,27 +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.test.core.api.invocationhandler.shared;
-
-/**
- * Just needed for testing interceptors
- */
-public interface TestInterceptorAware
-{
- void setIntercepted(boolean intercepted);
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBean.java
deleted file mode 100644
index 8878d8e..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBean.java
+++ /dev/null
@@ -1,30 +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.test.core.api.invocationhandler.uc001;
-
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-
-import javax.enterprise.context.RequestScoped;
-
-@PartialBeanBinding
-@RequestScoped
-public interface PartialBean
-{
- String getResult();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBeanAsInterfaceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBeanAsInterfaceTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBeanAsInterfaceTest.java
deleted file mode 100644
index ffe7129..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc001/PartialBeanAsInterfaceTest.java
+++ /dev/null
@@ -1,67 +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.test.core.api.invocationhandler.uc001;
-
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-import org.apache.deltaspike.test.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;
-
-import javax.inject.Inject;
-
-@RunWith(Arquillian.class)
-public class PartialBeanAsInterfaceTest
-{
- @Inject
- private PartialBean partialBean;
-
- @Deployment
- public static WebArchive war()
- {
- String simpleName = PartialBeanAsInterfaceTest.class.getSimpleName();
- String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
-
- JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
- .addPackage(PartialBeanAsInterfaceTest.class.getPackage())
- .addPackage(PartialBeanBinding.class.getPackage())
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
-
- return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
- .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
- .addAsLibraries(testJar)
- .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
- }
-
- @Test
- public void testPartialBeanAsInterface() throws Exception
- {
- String result = this.partialBean.getResult();
-
- Assert.assertEquals("partial-test-false", result);
-
- //TODO test pre-destroy callback
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBean.java
deleted file mode 100644
index e66846c..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBean.java
+++ /dev/null
@@ -1,56 +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.test.core.api.invocationhandler.uc002;
-
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.TestBean;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-@PartialBeanBinding
-@RequestScoped
-public abstract class PartialBean
-{
- @Inject
- private TestBean testBean;
-
- private String value;
-
- 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();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBeanAsAbstractClassTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBeanAsAbstractClassTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBeanAsAbstractClassTest.java
deleted file mode 100644
index feeb2aa..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc002/PartialBeanAsAbstractClassTest.java
+++ /dev/null
@@ -1,71 +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.test.core.api.invocationhandler.uc002;
-
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-import org.apache.deltaspike.test.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;
-
-import javax.inject.Inject;
-
-@RunWith(Arquillian.class)
-public class PartialBeanAsAbstractClassTest
-{
- @Inject
- private PartialBean partialBean;
-
- @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(PartialBeanBinding.class.getPackage())
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
-
- return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
- .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
- .addAsLibraries(testJar)
- .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
- }
-
- @Test
- public void testPartialBeanAsAbstractClass() throws Exception
- {
- String result = this.partialBean.getResult();
-
- Assert.assertEquals("partial-test-false", result);
-
- result = this.partialBean.getManualResult();
-
- Assert.assertEquals("manual-test", result);
-
- //TODO test pre-destroy callback
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBean.java
deleted file mode 100644
index 91bfdd3..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBean.java
+++ /dev/null
@@ -1,66 +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.test.core.api.invocationhandler.uc003;
-
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.CustomInterceptor;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.TestInterceptorAware;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.TestBean;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-@PartialBeanBinding
-@RequestScoped
-@CustomInterceptor //doesn't work currently
-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/incubator-deltaspike/blob/82be1a29/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
deleted file mode 100644
index 18a0a37..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/invocationhandler/uc003/PartialBeanAsAbstractClassWithInterceptorTest.java
+++ /dev/null
@@ -1,84 +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.test.core.api.invocationhandler.uc003;
-
-import org.apache.deltaspike.test.category.SeCategory;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.CustomInterceptorImpl;
-import org.apache.deltaspike.test.core.api.invocationhandler.shared.PartialBeanBinding;
-import org.apache.deltaspike.test.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.Asset;
-import org.jboss.shrinkwrap.api.asset.EmptyAsset;
-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.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-
-import javax.inject.Inject;
-
-@RunWith(Arquillian.class)
-@Category(SeCategory.class) //TODO use different category (only new versions of weld)
-public class PartialBeanAsAbstractClassWithInterceptorTest
-{
- @Inject
- private PartialBean partialBean;
-
- @Deployment
- public static WebArchive 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(PartialBeanBinding.class.getPackage())
- .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
-
- return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
- .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
- .addAsLibraries(testJar)
- .addAsWebInfResource(beansXml, "beans.xml");
- }
-
- @Test
- public void testPartialBeanAsAbstractClassWithInterceptor() throws Exception
- {
- String result = this.partialBean.getResult();
-
- Assert.assertEquals("partial-test-true", result);
-
- result = this.partialBean.getManualResult();
-
- //"manual-test-true" would be the goal, but it isn't supported (for now)
- Assert.assertEquals("manual-test-false", result);
-
- //TODO test pre-destroy callback
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/pom.xml b/deltaspike/modules/partial-bean/api/pom.xml
new file mode 100644
index 0000000..9279c48
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>partial-bean-module-project</artifactId>
+ <version>0.4-incubating-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-partial-bean-module-api</artifactId>
+
+ <name>Apache DeltaSpike Partial-Bean-Module API</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.deltaspike.core</groupId>
+ <artifactId>deltaspike-core-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <inherited>true</inherited>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/api/annotation/PartialBeanBinding.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/api/annotation/PartialBeanBinding.java b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/api/annotation/PartialBeanBinding.java
new file mode 100644
index 0000000..411c043
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/api/annotation/PartialBeanBinding.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.partialbean.api.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Retention(RUNTIME)
+@Target(ANNOTATION_TYPE)
+public @interface PartialBeanBinding
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/api/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/resources/META-INF/beans.xml b/deltaspike/modules/partial-bean/api/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..c913a0e
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd"/>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/pom.xml b/deltaspike/modules/partial-bean/impl/pom.xml
new file mode 100644
index 0000000..5544a62
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>partial-bean-module-project</artifactId>
+ <version>0.4-incubating-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-partial-bean-module-impl</artifactId>
+
+ <name>Apache DeltaSpike Partial-Bean-Module Impl</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.deltaspike.core</groupId>
+ <artifactId>deltaspike-core-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.deltaspike.modules</groupId>
+ <artifactId>deltaspike-partial-bean-module-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
new file mode 100644
index 0000000..59c2d2c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
@@ -0,0 +1,189 @@
+/*
+ * 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.partialbean.impl;
+
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+import org.apache.deltaspike.core.util.ClassDeactivationUtils;
+import org.apache.deltaspike.core.util.ClassUtils;
+import org.apache.deltaspike.core.util.bean.BeanBuilder;
+import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
+import org.apache.deltaspike.partialbean.api.annotation.PartialBeanBinding;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class PartialBeanBindingExtension implements Extension, Deactivatable
+{
+ private static final Logger LOG = Logger.getLogger(PartialBeanBindingExtension.class.getName());
+
+ private Boolean isActivated = true;
+ private Map<Class<?>, Class<? extends Annotation>> partialBeans =
+ new HashMap<Class<?>, Class<? extends Annotation>>();
+ private Map<Class<? extends Annotation>, Class<? extends InvocationHandler>> partialBeanHandlers =
+ new HashMap<Class<? extends Annotation>, Class<? extends InvocationHandler>>();
+
+ private IllegalStateException definitionError;
+
+ protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+ {
+ this.isActivated = ClassDeactivationUtils.isActivated(getClass());
+
+ if (this.isActivated)
+ {
+ this.isActivated = ClassUtils.tryToLoadClassForName("javassist.util.proxy.ProxyFactory") != null;
+
+ if (!this.isActivated && LOG.isLoggable(Level.WARNING))
+ {
+ LOG.warning("@" + PartialBeanBinding.class.getName() +
+ " deactivated because Javassist is missing.");
+ }
+ }
+ }
+
+ public <X> void findInvocationHandlerBindings(@Observes ProcessAnnotatedType<X> pat, BeanManager beanManager)
+ {
+ if (!this.isActivated || this.definitionError != null)
+ {
+ return;
+ }
+
+ Class<X> beanClass = pat.getAnnotatedType().getJavaClass();
+ Class<? extends Annotation> bindingAnnotationClass = getInvocationHandlerBindingAnnotationClass(pat);
+
+ if (bindingAnnotationClass == null)
+ {
+ return;
+ }
+
+ if ((beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers())))
+ {
+ this.partialBeans.put(beanClass, bindingAnnotationClass);
+ }
+ else if (InvocationHandler.class.isAssignableFrom(beanClass))
+ {
+ validateInvocationHandler(
+ beanClass, bindingAnnotationClass, pat.getAnnotatedType().getAnnotations(), beanManager);
+
+ this.partialBeanHandlers.put(bindingAnnotationClass, (Class<? extends InvocationHandler>) beanClass);
+ }
+ else
+ {
+ this.definitionError = new IllegalStateException(beanClass.getName() + " is annotated with @" +
+ bindingAnnotationClass.getName() + " and therefore has to be " +
+ "an abstract class, an interface or an implementation of " + InvocationHandler.class.getName());
+ }
+ }
+
+ public <X> void createBeans(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
+ {
+ if (!this.isActivated)
+ {
+ return;
+ }
+
+ if (this.definitionError != null)
+ {
+ afterBeanDiscovery.addDefinitionError(this.definitionError);
+ return;
+ }
+
+ for (Map.Entry<Class<?>, Class<? extends Annotation>> partialBeanEntry : this.partialBeans.entrySet())
+ {
+ Bean partialBean = createPartialBean(partialBeanEntry.getKey(), partialBeanEntry.getValue(), beanManager);
+
+ if (partialBean != null)
+ {
+ afterBeanDiscovery.addBean(partialBean);
+ }
+ else
+ {
+ afterBeanDiscovery.addDefinitionError(new IllegalStateException("A class which implements " +
+ InvocationHandler.class.getName() + " and is annotated with @" +
+ partialBeanEntry.getValue().getName() + " is needed as a handler for " +
+ partialBeanEntry.getKey().getName() + ". See the documentation about @" +
+ PartialBeanBinding.class.getName() + "."));
+ }
+ }
+
+ this.partialBeans.clear();
+ this.partialBeanHandlers.clear();
+ }
+
+ protected <T> Bean<T> createPartialBean(Class<T> beanClass,
+ Class<? extends Annotation> bindingAnnotationClass,
+ BeanManager beanManager)
+ {
+ Class<? extends InvocationHandler> invocationHandlerClass = partialBeanHandlers.get(bindingAnnotationClass);
+
+ if (invocationHandlerClass == null)
+ {
+ return null;
+ }
+
+ AnnotatedType<T> annotatedType = new AnnotatedTypeBuilder<T>().readFromType(beanClass).create();
+
+ BeanBuilder<T> beanBuilder = new BeanBuilder<T>(beanManager)
+ .readFromType(annotatedType)
+ .passivationCapable(true)
+ .beanLifecycle(new PartialBeanLifecycle(beanClass, invocationHandlerClass, beanManager));
+
+ return beanBuilder.create();
+ }
+
+ protected <X> Class<? extends Annotation> getInvocationHandlerBindingAnnotationClass(ProcessAnnotatedType<X> pat)
+ {
+ for (Annotation annotation : pat.getAnnotatedType().getAnnotations())
+ {
+ if (annotation.annotationType().isAnnotationPresent(PartialBeanBinding.class))
+ {
+ return annotation.annotationType();
+ }
+ }
+
+ return null;
+ }
+
+ protected <X> void validateInvocationHandler(Class<X> beanClass,
+ Class<? extends Annotation> bindingAnnotationClass,
+ Set<Annotation> annotations,
+ BeanManager beanManager)
+ {
+ Class<? extends InvocationHandler> alreadyFoundHandler = this.partialBeanHandlers.get(bindingAnnotationClass);
+ if (alreadyFoundHandler != null)
+ {
+ this.definitionError = new IllegalStateException("Multiple handlers found for " +
+ bindingAnnotationClass.getName() + " (" +
+ alreadyFoundHandler.getName() + " and " + beanClass.getName() + ")");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
new file mode 100644
index 0000000..5babb17
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
@@ -0,0 +1,147 @@
+/*
+ * 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.partialbean.impl;
+
+import javassist.util.proxy.MethodFilter;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
+import org.apache.deltaspike.core.api.provider.BeanProvider;
+import org.apache.deltaspike.core.util.ExceptionUtils;
+import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
+import org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+class PartialBeanLifecycle<T, H extends InvocationHandler> implements ContextualLifecycle<T>
+{
+ private final Class<? extends T> partialBeanProxyClass;
+
+ private final InjectionTarget<T> partialBeanInjectionTarget;
+ private final Class<H> handlerClass;
+ private CreationalContext<?> creationalContextOfDependentHandler;
+
+ PartialBeanLifecycle(Class<T> partialBeanClass, Class<H> handlerClass, BeanManager beanManager)
+ {
+ this.handlerClass = handlerClass;
+
+ ProxyFactory proxyFactory = new ProxyFactory();
+
+ if (partialBeanClass.isInterface())
+ {
+ this.partialBeanInjectionTarget = null;
+
+ proxyFactory.setInterfaces(new Class[]{partialBeanClass});
+ }
+ else
+ {
+ AnnotatedTypeBuilder<T> partialBeanTypeBuilder =
+ new AnnotatedTypeBuilder<T>().readFromType(partialBeanClass);
+ this.partialBeanInjectionTarget = beanManager.createInjectionTarget(partialBeanTypeBuilder.create());
+
+ proxyFactory.setSuperclass(partialBeanClass);
+ }
+
+ proxyFactory.setFilter(new MethodFilter()
+ {
+ public boolean isHandled(Method method)
+ {
+ return !"finalize".equals(method.getName());
+ }
+ });
+
+ this.partialBeanProxyClass = ((Class<?>) proxyFactory.createClass()).asSubclass(partialBeanClass);
+ }
+
+ public T create(Bean bean, CreationalContext creationalContext)
+ {
+ try
+ {
+ H handlerInstance = createHandlerInstance();
+
+ T instance = this.partialBeanProxyClass.newInstance();
+
+ if (this.partialBeanInjectionTarget != null)
+ {
+ this.partialBeanInjectionTarget.inject(instance, creationalContext);
+ this.partialBeanInjectionTarget.postConstruct(instance);
+ }
+
+ PartialBeanMethodHandler<H> methodHandler = new PartialBeanMethodHandler<H>(handlerInstance);
+ ((ProxyObject) instance).setHandler(methodHandler);
+ return instance;
+ }
+ catch (Exception e)
+ {
+ ExceptionUtils.throwAsRuntimeException(e);
+ }
+ //can't happen
+ return null;
+ }
+
+ private H createHandlerInstance()
+ {
+ Set<Bean<H>> handlerBeans = BeanProvider.getBeanDefinitions(this.handlerClass, false, true);
+
+ if (handlerBeans.size() != 1)
+ {
+ throw new IllegalStateException(handlerBeans.size() + " beans found for " + this.handlerClass);
+ }
+
+ Bean<H> handlerBean = handlerBeans.iterator().next();
+
+ BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
+ CreationalContext<?> creationalContextOfHandler = beanManager.createCreationalContext(handlerBean);
+
+ H handlerInstance = (H)beanManager.getReference(handlerBean, this.handlerClass, creationalContextOfHandler);
+
+ if (handlerBean.getScope().equals(Dependent.class))
+ {
+ this.creationalContextOfDependentHandler = creationalContextOfHandler;
+ }
+ return handlerInstance;
+ }
+
+ public void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext)
+ {
+ if (this.partialBeanInjectionTarget != null)
+ {
+ this.partialBeanInjectionTarget.preDestroy(instance);
+ }
+
+ if (this.creationalContextOfDependentHandler != null)
+ {
+ this.creationalContextOfDependentHandler.release();
+ }
+
+ /*
+ H handlerInstance = (H) ((PartialBeanMethodHandler)((ProxyObject) instance).getHandler()).getHandlerInstance();
+ injectionTarget.dispose(handlerInstance); //currently producers aren't supported
+ }
+ */
+ creationalContext.release();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanMethodHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanMethodHandler.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanMethodHandler.java
new file mode 100644
index 0000000..c8a8d58
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanMethodHandler.java
@@ -0,0 +1,48 @@
+/*
+ * 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.partialbean.impl;
+
+import javassist.util.proxy.MethodHandler;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+class PartialBeanMethodHandler<T extends InvocationHandler> implements MethodHandler
+{
+ private final T handlerInstance;
+
+ PartialBeanMethodHandler(T handlerInstance)
+ {
+ this.handlerInstance = handlerInstance;
+ }
+
+ public Object invoke(Object target, Method method, Method proceedMethod, Object[] arguments) throws Throwable
+ {
+ if (proceedMethod != null)
+ {
+ return proceedMethod.invoke(target, arguments);
+ }
+ return this.handlerInstance.invoke(target, method, arguments);
+ }
+
+ T getHandlerInstance()
+ {
+ return this.handlerInstance;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/beans.xml b/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..4070730
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
new file mode 100644
index 0000000..9d230f8
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -0,0 +1,20 @@
+#####################################################################################
+# 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.
+#####################################################################################
+
+org.apache.deltaspike.partialbean.impl.PartialBeanBindingExtension
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptor.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptor.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptor.java
new file mode 100644
index 0000000..89930a3
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptor.java
@@ -0,0 +1,33 @@
+/*
+ * 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.shared;
+
+import javax.interceptor.InterceptorBinding;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Retention(RUNTIME)
+@Target(TYPE)
+@InterceptorBinding
+public @interface CustomInterceptor
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/82be1a29/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorImpl.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorImpl.java
new file mode 100644
index 0000000..075e1db
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/CustomInterceptorImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.shared;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import java.io.Serializable;
+
+@Interceptor
+@CustomInterceptor
+public class CustomInterceptorImpl implements Serializable
+{
+ @AroundInvoke
+ public Object interceptIt(InvocationContext invocationContext) throws Exception
+ {
+ Object target = invocationContext.getTarget();
+
+ if (target instanceof TestInterceptorAware)
+ {
+ ((TestInterceptorAware)target).setIntercepted(true);
+ }
+
+ return invocationContext.proceed();
+ }
+}