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/01/11 21:17:27 UTC
git commit: DELTASPIKE-294 alternative bean-classes have to match the
configured class to get enabled
Updated Branches:
refs/heads/master b1275a26e -> 820924d0f
DELTASPIKE-294 alternative bean-classes have to match the configured class to get enabled
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/820924d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/820924d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/820924d0
Branch: refs/heads/master
Commit: 820924d0fd05636def1aaadcf3de8d4253a64dfa
Parents: b1275a2
Author: gpetracek <gp...@apache.org>
Authored: Fri Jan 11 20:55:16 2013 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Fri Jan 11 21:13:45 2013 +0100
----------------------------------------------------------------------
.../impl/exclude/extension/ExcludeExtension.java | 6 ++-
.../alternative/global/GlobalAlternativeTest.java | 2 +-
.../core/api/alternative/global/SubBaseBean2.java | 30 +++++++++++++++
.../META-INF/apache-deltaspike.properties | 2 +-
4 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/820924d0/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
index 4b1bf2a..e76a257 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/ExcludeExtension.java
@@ -214,7 +214,8 @@ public class ExcludeExtension implements Extension, Deactivatable
continue;
}
- if (isAlternativeBeanImplementation) //current bean is annotated with @Alternative
+ //current bean is annotated with @Alternative and of the same type as the configured bean
+ if (isAlternativeBeanImplementation && alternativeBeanClass.equals(currentBean))
{
if (doQualifiersMatch(qualifiersOfCurrentBean, qualifiersOfConfiguredBean))
{
@@ -286,7 +287,8 @@ public class ExcludeExtension implements Extension, Deactivatable
continue;
}
- if (isAlternativeBeanImplementation)
+ //current bean is annotated with @Alternative and of the same type as the configured bean
+ if (isAlternativeBeanImplementation && alternativeBeanClass.equals(currentBean))
{
if (doQualifiersMatch(qualifiersOfCurrentBean, qualifiersOfConfiguredBean))
{
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/820924d0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
index 63ba281..287fae2 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/GlobalAlternativeTest.java
@@ -87,7 +87,7 @@ public class GlobalAlternativeTest
List<BaseBean1> testBeans = BeanProvider.getContextualReferences(BaseBean1.class, true);
Assert.assertEquals(1, testBeans.size());
- Assert.assertEquals(SubBaseBean1.class.getName(), testBeans.get(0).getClass().getName());
+ Assert.assertEquals(SubBaseBean2.class.getName(), testBeans.get(0).getClass().getName());
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/820924d0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean2.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean2.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean2.java
new file mode 100644
index 0000000..7d5ca99
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/global/SubBaseBean2.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.alternative.global;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Alternative;
+
+/**
+ */
+@Alternative
+@Dependent
+public class SubBaseBean2 extends SubBaseBean1
+{
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/820924d0/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties b/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
index 12fad78..c20b420 100644
--- a/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
+++ b/deltaspike/core/impl/src/test/resources/META-INF/apache-deltaspike.properties
@@ -20,7 +20,7 @@ org.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike
testProperty02=test_value_02
db=prodDB
-org.apache.deltaspike.test.core.api.alternative.global.BaseBean1=org.apache.deltaspike.test.core.api.alternative.global.SubBaseBean1
+org.apache.deltaspike.test.core.api.alternative.global.BaseBean1=org.apache.deltaspike.test.core.api.alternative.global.SubBaseBean2
org.apache.deltaspike.test.core.api.alternative.global.BaseInterface1=org.apache.deltaspike.test.core.api.alternative.global.BaseInterface1AlternativeImplementation
org.apache.deltaspike.test.core.api.alternative.global.qualifier.BaseInterface=org.apache.deltaspike.test.core.api.alternative.global.qualifier.AlternativeBaseBeanB