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 2018/03/29 21:46:37 UTC

[1/7] deltaspike git commit: DELTASPIKE-1320 detect conflicts in globalAlternatives

Repository: deltaspike
Updated Branches:
  refs/heads/deltaspike-1.8.x f06a78939 -> 1785e0ff4


DELTASPIKE-1320 detect conflicts in globalAlternatives

labeled Alternatives take precendence over globalAlternatives


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/06fd261a
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/06fd261a
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/06fd261a

Branch: refs/heads/deltaspike-1.8.x
Commit: 06fd261a76e5ad8e791fd0fd4dd2994614f062ec
Parents: f06a789
Author: Mark Struberg <st...@apache.org>
Authored: Thu Mar 1 07:28:04 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:35:14 2018 +0200

----------------------------------------------------------------------
 ...lAwareGlobalAlternativeBeanClassProvider.java | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/06fd261a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
index adad429..8a2ddf7 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
@@ -48,26 +48,32 @@ public class LabelAwareGlobalAlternativeBeanClassProvider implements Alternative
         }
 
         Map<String, String> allProperties = ConfigResolver.getAllProperties();
+        // first read all globalAlternatives
         for (Map.Entry<String, String> property : allProperties.entrySet())
         {
-            if (activeQualifierLabel != null && property.getKey().startsWith(activeQualifierLabel))
+            if (property.getKey().startsWith(GLOBAL_ALTERNATIVES))
             {
-                String interfaceName = property.getKey().substring(activeQualifierLabel.length());
+                String interfaceName = property.getKey().substring(GLOBAL_ALTERNATIVES.length());
                 String implementation = property.getValue();
                 if (LOG.isLoggable(Level.FINE))
                 {
-                    LOG.fine("Enabling labeled alternative for interface " + interfaceName + ": " + implementation);
+                    LOG.fine("Enabling global alternative for interface " + interfaceName + ": " + implementation);
                 }
 
                 result.put(interfaceName, implementation);
             }
-            else if (property.getKey().startsWith(GLOBAL_ALTERNATIVES))
+        }
+
+        // and overwrite with any possible labled alternative, if exists
+        for (Map.Entry<String, String> property : allProperties.entrySet())
+        {
+            if (activeQualifierLabel != null && property.getKey().startsWith(activeQualifierLabel))
             {
-                String interfaceName = property.getKey().substring(GLOBAL_ALTERNATIVES.length());
+                String interfaceName = property.getKey().substring(activeQualifierLabel.length());
                 String implementation = property.getValue();
                 if (LOG.isLoggable(Level.FINE))
                 {
-                    LOG.fine("Enabling global alternative for interface " + interfaceName + ": " + implementation);
+                    LOG.fine("Enabling labeled alternative for interface " + interfaceName + ": " + implementation);
                 }
 
                 result.put(interfaceName, implementation);
@@ -76,4 +82,5 @@ public class LabelAwareGlobalAlternativeBeanClassProvider implements Alternative
 
         return result;
     }
+
 }


[7/7] deltaspike git commit: DELTASPIKE-1334 added javadoc for ConfigPreProcessor#beforeAddToConfig

Posted by gp...@apache.org.
DELTASPIKE-1334 added javadoc for ConfigPreProcessor#beforeAddToConfig


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/1785e0ff
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/1785e0ff
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/1785e0ff

Branch: refs/heads/deltaspike-1.8.x
Commit: 1785e0ff44d3f58c64cda0b257bdf0c23d7f40b0
Parents: 45dba46
Author: gpetracek <gp...@apache.org>
Authored: Thu Mar 29 23:19:38 2018 +0200
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:38:24 2018 +0200

----------------------------------------------------------------------
 .../core/spi/config/view/ConfigPreProcessor.java        | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/1785e0ff/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java
index 1cce3a4..3d9f4b6 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ConfigPreProcessor.java
@@ -30,5 +30,17 @@ import java.lang.annotation.Annotation;
  */
 public interface ConfigPreProcessor<T extends Annotation>
 {
+    /**
+     * @param metaData The annotation-instance which was found or the inherited instance.
+     *                 Since it's possible to override annotation-attributes alongside the inheritance-path,
+     *                 it can be a merged representation.
+     *                 To get rid of meta-data which is only inherited,
+     *                 it's required to check the presence of the physical annotation e.g. via
+     *                 ViewConfigNode#getSource#isAnnotationPresent
+     *                 and return a synthetic literal-instance (as a marker/placeholder),
+     *                 because 'null' isn't supported as return-value.
+     * @param viewConfigNode Instance which represents the current node
+     * @return The annotation-instance which should be used for the final meta-data
+     */
     T beforeAddToConfig(T metaData, ViewConfigNode viewConfigNode);
 }


[4/7] deltaspike git commit: DELTASPIKE-1329 log update of project-stage value

Posted by gp...@apache.org.
DELTASPIKE-1329 log update of project-stage value


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/5892839f
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/5892839f
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/5892839f

Branch: refs/heads/deltaspike-1.8.x
Commit: 5892839f1d0e52a17b4672eda27ccb10687cc03b
Parents: a2591c4
Author: gpetracek <gp...@apache.org>
Authored: Sat Mar 17 19:11:48 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:36:56 2018 +0200

----------------------------------------------------------------------
 .../apache/deltaspike/core/util/ProjectStageProducer.java   | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/5892839f/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java
index b79be81..4d30f00 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ProjectStageProducer.java
@@ -214,6 +214,15 @@ public class ProjectStageProducer implements Serializable
      */
     public static void setProjectStage(ProjectStage ps)
     {
+        if (projectStage != null)
+        {
+            LOG.info("change project-stage from " + projectStage + " to " + ps);
+        }
+        else
+        {
+            LOG.info("change project-stage to " + ps);
+        }
+
         projectStage = ps;
     }
 }


[3/7] deltaspike git commit: DELTASPIKE-1319 basic support for test-suites and minor improvements

Posted by gp...@apache.org.
DELTASPIKE-1319 basic support for test-suites and minor improvements


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/a2591c49
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/a2591c49
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/a2591c49

Branch: refs/heads/deltaspike-1.8.x
Commit: a2591c497f9f6f00c84b70d7a9f0b92b431e456e
Parents: e0a2505
Author: gpetracek <gp...@apache.org>
Authored: Thu Mar 1 21:50:11 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:36:35 2018 +0200

----------------------------------------------------------------------
 .../testcontrol/api/junit/CdiTestRunner.java    |  41 +------
 .../api/junit/CdiTestSuiteRunner.java           | 122 +++++++++++++++++++
 2 files changed, 124 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a2591c49/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java b/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java
index c855b40..f50650c 100644
--- a/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java
+++ b/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestRunner.java
@@ -50,7 +50,6 @@ import javax.enterprise.context.SessionScoped;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Named;
 import javax.inject.Singleton;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
@@ -468,7 +467,7 @@ public class CdiTestRunner extends BlockJUnit4ClassRunner
                     // Note that Weld 1 was "flat" anyway, so this property only affects newer versions of Weld
                     System.setProperty("org.jboss.weld.se.archive.isolation", "false");
 
-                    checkForLabeledAlternativeConfig(testClass);
+                    CdiTestSuiteRunner.applyAlternativeLabel(testClass);
 
                     container.boot(CdiTestSuiteRunner.getTestContainerConfig());
                     setContainerStarted();
@@ -493,43 +492,6 @@ public class CdiTestRunner extends BlockJUnit4ClassRunner
             startScopes(container, testClass, null, restrictedScopes.toArray(new Class[restrictedScopes.size()]));
         }
 
-        private void checkForLabeledAlternativeConfig(Class<?> testClass)
-        {
-            String activeAlternativeLabel = "";
-            TestControl testControl = testClass.getAnnotation(TestControl.class);
-
-            if (testControl != null)
-            {
-                Class<? extends TestControl.Label> activeTypedAlternativeLabel =
-                    testControl.activeAlternativeLabel();
-
-                if (!TestControl.Label.class.equals(activeTypedAlternativeLabel))
-                {
-                    Named labelName = activeTypedAlternativeLabel.getAnnotation(Named.class);
-
-                    if (labelName != null)
-                    {
-                        activeAlternativeLabel = labelName.value();
-                    }
-                    else
-                    {
-                        String labelClassName = activeTypedAlternativeLabel.getSimpleName();
-                        activeAlternativeLabel = labelClassName.substring(0, 1).toLowerCase();
-
-                        if (labelClassName.length() > 1)
-                        {
-                            activeAlternativeLabel += labelClassName.substring(1);
-                        }
-                    }
-                }
-            }
-            //always set it even if it is empty (it might overrule the value of the prev. test
-            System.setProperty("activeAlternativeLabel", activeAlternativeLabel); //will be picked up by ds-core
-
-            //TODO discuss a spi which allows to run such tests in parallel
-            System.setProperty("activeAlternativeLabelSource", testClass.getName()); //can be used for custom logic
-        }
-
         private void bootExternalContainers(Class testClass)
         {
             if (!this.testControl.startExternalContainers())
@@ -886,4 +848,5 @@ public class CdiTestRunner extends BlockJUnit4ClassRunner
 
         return Collections.unmodifiableList(cdiTestRunner.testContext.externalContainers);
     }
+
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/a2591c49/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java b/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java
index e24dda6..bfe0b45 100644
--- a/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java
+++ b/deltaspike/modules/test-control/api/src/main/java/org/apache/deltaspike/testcontrol/api/junit/CdiTestSuiteRunner.java
@@ -22,6 +22,10 @@ import org.apache.deltaspike.cdise.api.CdiContainer;
 import org.apache.deltaspike.cdise.api.CdiContainerLoader;
 import org.apache.deltaspike.core.api.config.ConfigResolver;
 import org.apache.deltaspike.core.api.config.PropertyLoader;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.core.util.ClassDeactivationUtils;
+import org.apache.deltaspike.testcontrol.api.TestControl;
 import org.junit.runner.Description;
 import org.junit.runner.Runner;
 import org.junit.runner.notification.Failure;
@@ -31,8 +35,12 @@ import org.junit.runners.Suite;
 import org.junit.runners.model.InitializationError;
 import org.junit.runners.model.RunnerBuilder;
 
+import javax.inject.Named;
+import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -103,6 +111,8 @@ public class CdiTestSuiteRunner extends Suite
 
         if (!containerStarted)
         {
+            applyAlternativeLabel(getTestClass().getJavaClass());
+
             container.boot(getTestContainerConfig());
             containerStarted = true;
         }
@@ -207,4 +217,116 @@ public class CdiTestSuiteRunner extends Suite
             CUSTOM_TEST_CONTAINER_CONFIG_FILE_KEY, DEFAULT_TEST_CONTAINER_CONFIG_FILE_NAME);
         return PropertyLoader.getProperties(cdiTestRunnerConfig);
     }
+
+    //just here, because all shared methods are in this class
+    static void applyAlternativeLabel(Class<?> currentAnnotationSource)
+    {
+        String activeAlternativeLabel = checkForLabeledAlternativeConfig(currentAnnotationSource);
+        initTestEnvConfig(currentAnnotationSource, activeAlternativeLabel);
+    }
+
+    private static String checkForLabeledAlternativeConfig(Class<?> currentAnnotationSource)
+    {
+        String activeAlternativeLabel = "";
+        TestControl testControl = currentAnnotationSource.getAnnotation(TestControl.class);
+
+        if (testControl != null)
+        {
+            Class<? extends TestControl.Label> activeTypedAlternativeLabel =
+                    testControl.activeAlternativeLabel();
+
+            if (!TestControl.Label.class.equals(activeTypedAlternativeLabel))
+            {
+                Named labelName = activeTypedAlternativeLabel.getAnnotation(Named.class);
+
+                if (labelName != null)
+                {
+                    activeAlternativeLabel = labelName.value();
+                }
+                else
+                {
+                    String labelClassName = activeTypedAlternativeLabel.getSimpleName();
+                    activeAlternativeLabel = labelClassName.substring(0, 1).toLowerCase();
+
+                    if (labelClassName.length() > 1)
+                    {
+                        activeAlternativeLabel += labelClassName.substring(1);
+                    }
+                }
+            }
+        }
+        return activeAlternativeLabel;
+    }
+
+    private static void initTestEnvConfig(Class<?> testClass, String activeAlternativeLabel)
+    {
+        if (ClassDeactivationUtils.isActivated(TestConfigSource.class))
+        {
+            TestConfigSource testConfigSource = null;
+
+            for (ConfigSource configSource : ConfigResolver.getConfigSources())
+            {
+                if (configSource instanceof TestConfigSource)
+                {
+                    //if it happens: parallel test-execution can't be supported with labeled alternatives
+                    testConfigSource = (TestConfigSource) configSource;
+                }
+            }
+
+            if (testConfigSource == null)
+            {
+                testConfigSource = new TestConfigSource();
+                ConfigResolver.addConfigSources(Arrays.<ConfigSource>asList(testConfigSource));
+            }
+
+            //always set it even if it is empty (it might overrule the value of the prev. test
+            testConfigSource.getProperties().put("activeAlternativeLabel", activeAlternativeLabel);
+
+            testConfigSource.getProperties().put("activeAlternativeLabelSource", testClass.getName());
+        }
+        else
+        {
+            //always set it even if it is empty (it might overrule the value of the prev. test
+            System.setProperty("activeAlternativeLabel", activeAlternativeLabel); //will be picked up by ds-core
+
+            System.setProperty("activeAlternativeLabelSource", testClass.getName()); //can be used for custom logic
+        }
+    }
+
+    //config-sources are already stored per classloader
+    //keep it public to allow type-safe deactivation (if needed)
+    public static class TestConfigSource implements ConfigSource, Deactivatable
+    {
+        private Map<String, String> testConfig = new ConcurrentHashMap<String, String>();
+
+        @Override
+        public int getOrdinal()
+        {
+            return Integer.MIN_VALUE;
+        }
+
+        @Override
+        public Map<String, String> getProperties()
+        {
+            return testConfig;
+        }
+
+        @Override
+        public String getPropertyValue(String key)
+        {
+            return testConfig.get(key);
+        }
+
+        @Override
+        public String getConfigName()
+        {
+            return "ds-test-config";
+        }
+
+        @Override
+        public boolean isScannable()
+        {
+            return true;
+        }
+    }
 }


[6/7] deltaspike git commit: DELTASPIKE-1332 support custom view-meta-data without default-values for primitive data-types

Posted by gp...@apache.org.
DELTASPIKE-1332 support custom view-meta-data without default-values for primitive data-types


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/45dba462
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/45dba462
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/45dba462

Branch: refs/heads/deltaspike-1.8.x
Commit: 45dba462b8f16d86e3246bc28910fb241ef332e1
Parents: add0adf
Author: gpetracek <gp...@apache.org>
Authored: Fri Mar 23 23:34:24 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:37:55 2018 +0200

----------------------------------------------------------------------
 .../impl/config/view/DefaultConfigNodeConverter.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/45dba462/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
index 44682cb..8851592 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
@@ -192,7 +192,17 @@ public class DefaultConfigNodeConverter implements ConfigNodeConverter
             Annotation defaultAnnotation = AnnotationInstanceProvider.of(existingMetaData.annotationType());
             try
             {
-                Object defaultValue = annotationMethod.invoke(defaultAnnotation);
+                Object defaultValue = null;
+
+                try
+                {
+                    defaultValue = annotationMethod.invoke(defaultAnnotation);
+                }
+                catch (NullPointerException e) //happens with primitive data-types without default values
+                {
+                    defaultValue = null;
+                }
+
                 Object existingValue = annotationMethod.invoke(existingMetaData);
 
                 if (existingValue == null /*possible with literal instances*/ ||


[5/7] deltaspike git commit: DELTASPIKE-1331 improved method signature of ViewConfigNode#getSource

Posted by gp...@apache.org.
DELTASPIKE-1331 improved method signature of ViewConfigNode#getSource


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/add0adf3
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/add0adf3
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/add0adf3

Branch: refs/heads/deltaspike-1.8.x
Commit: add0adf311d260b9e727e172d5248161bdc62d16
Parents: 5892839
Author: gpetracek <gp...@apache.org>
Authored: Fri Mar 23 23:21:38 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:37:18 2018 +0200

----------------------------------------------------------------------
 .../apache/deltaspike/core/spi/config/view/ViewConfigNode.java | 2 +-
 .../jsf/impl/config/view/DefaultConfigNodeConverter.java       | 2 +-
 .../deltaspike/jsf/impl/config/view/FolderConfigNode.java      | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/add0adf3/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java
index 3aa7e72..64b70f3 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/spi/config/view/ViewConfigNode.java
@@ -34,7 +34,7 @@ public interface ViewConfigNode
 
     List<ViewConfigNode> getChildren();
 
-    Class getSource();
+    Class<?> getSource();
 
     Set<Annotation> getMetaData();
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/add0adf3/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
index c25d742..44682cb 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/DefaultConfigNodeConverter.java
@@ -67,7 +67,7 @@ public class DefaultConfigNodeConverter implements ConfigNodeConverter
         {
             View viewAnnotation = findMetaDataByType(mergedMetaData, View.class);
             String viewId = viewAnnotation.basePath() + viewAnnotation.name() + "." + viewAnnotation.extension();
-            return new DefaultViewPathConfigDescriptor(viewId, node.getSource(),
+            return new DefaultViewPathConfigDescriptor(viewId, (Class<? extends ViewConfig>) node.getSource(),
                     filterInheritedFolderMetaData(mergedMetaData), node.getCallbackDescriptors());
         }
         else

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/add0adf3/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
index 3a357c7..85ccf9e 100644
--- a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/config/view/FolderConfigNode.java
@@ -29,9 +29,9 @@ import java.util.Set;
 public class FolderConfigNode extends AbstractConfigNode
 {
     //not all interfaces have to implement the ViewConfig interface
-    private final Class nodeId;
+    private final Class<?> nodeId;
 
-    public FolderConfigNode(Class nodeId, ViewConfigNode parent, Set<Annotation> nodeMetaData)
+    public FolderConfigNode(Class<?> nodeId, ViewConfigNode parent, Set<Annotation> nodeMetaData)
     {
         super(parent, nodeMetaData);
         this.nodeId = nodeId;
@@ -55,7 +55,7 @@ public class FolderConfigNode extends AbstractConfigNode
     }
 
     @Override
-    public Class getSource()
+    public Class<?> getSource()
     {
         return this.nodeId;
     }


[2/7] deltaspike git commit: DELTASPIKE-1320 labeled alternatives take priority over global alternatives

Posted by gp...@apache.org.
DELTASPIKE-1320 labeled alternatives take priority over global alternatives


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/e0a25055
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/e0a25055
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/e0a25055

Branch: refs/heads/deltaspike-1.8.x
Commit: e0a2505580dea6d2d95d9677a0f1ec686ce398f4
Parents: 06fd261
Author: gpetracek <gp...@apache.org>
Authored: Thu Mar 1 09:09:15 2018 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Mar 29 23:35:52 2018 +0200

----------------------------------------------------------------------
 ...AwareGlobalAlternativeBeanClassProvider.java | 24 ++++++++------------
 1 file changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e0a25055/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
index 8a2ddf7..9d7d296 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exclude/extension/LabelAwareGlobalAlternativeBeanClassProvider.java
@@ -48,39 +48,35 @@ public class LabelAwareGlobalAlternativeBeanClassProvider implements Alternative
         }
 
         Map<String, String> allProperties = ConfigResolver.getAllProperties();
-        // first read all globalAlternatives
         for (Map.Entry<String, String> property : allProperties.entrySet())
         {
-            if (property.getKey().startsWith(GLOBAL_ALTERNATIVES))
+            if (activeQualifierLabel != null && property.getKey().startsWith(activeQualifierLabel))
             {
-                String interfaceName = property.getKey().substring(GLOBAL_ALTERNATIVES.length());
+                String interfaceName = property.getKey().substring(activeQualifierLabel.length());
                 String implementation = property.getValue();
                 if (LOG.isLoggable(Level.FINE))
                 {
-                    LOG.fine("Enabling global alternative for interface " + interfaceName + ": " + implementation);
+                    LOG.fine("Enabling labeled alternative for interface " + interfaceName + ": " + implementation);
                 }
 
                 result.put(interfaceName, implementation);
             }
-        }
-
-        // and overwrite with any possible labled alternative, if exists
-        for (Map.Entry<String, String> property : allProperties.entrySet())
-        {
-            if (activeQualifierLabel != null && property.getKey().startsWith(activeQualifierLabel))
+            else if (property.getKey().startsWith(GLOBAL_ALTERNATIVES))
             {
-                String interfaceName = property.getKey().substring(activeQualifierLabel.length());
+                String interfaceName = property.getKey().substring(GLOBAL_ALTERNATIVES.length());
                 String implementation = property.getValue();
                 if (LOG.isLoggable(Level.FINE))
                 {
-                    LOG.fine("Enabling labeled alternative for interface " + interfaceName + ": " + implementation);
+                    LOG.fine("Enabling global alternative for interface " + interfaceName + ": " + implementation);
                 }
 
-                result.put(interfaceName, implementation);
+                if (!result.containsKey(interfaceName)) //don't override labeled alternatives
+                {
+                    result.put(interfaceName, implementation);
+                }
             }
         }
 
         return result;
     }
-
 }