You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by jo...@apache.org on 2016/10/28 00:47:27 UTC
[1/2] deltaspike git commit: DELTASPIKE-1208: Fixed variable
replacement in configured values for getProjectStageAwarePropertyValue
Repository: deltaspike
Updated Branches:
refs/heads/master 0596f9db2 -> ebb24accd
DELTASPIKE-1208: Fixed variable replacement in configured values for getProjectStageAwarePropertyValue
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/7215f7b7
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/7215f7b7
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/7215f7b7
Branch: refs/heads/master
Commit: 7215f7b7fdea436017c8a331d5468dc8fc5c7145
Parents: 0596f9d
Author: tzhmava4 <va...@swisscom.com>
Authored: Thu Oct 20 07:52:42 2016 +0200
Committer: John D. Ament <jo...@apache.org>
Committed: Thu Oct 27 20:46:19 2016 -0400
----------------------------------------------------------------------
.../core/api/config/ConfigResolver.java | 1 -
.../test/api/config/ConfigResolverTest.java | 22 +++++++++++++++-----
.../test/api/config/TestConfigSource.java | 5 +++++
3 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
index 5a54abb..f8f522b 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
@@ -245,7 +245,6 @@ public final class ConfigResolver
String value = getPropertyValue(key + '.' + ps, configResolverContext);
if (value == null)
{
- configResolverContext.setProjectStageAware(false);
value = getPropertyValue(key, configResolverContext);
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
index 54e47ac..be24c62 100644
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
+++ b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
@@ -197,15 +197,27 @@ public class ConfigResolverTest
}
@Test
- public void testProjectStageAwarePropertyValueReference() {
- final String expected =
+ public void testProjectStageAwarePropertyValueReference_1() {
+ final String expectedFooUrl =
+ "http://bar-dev/services";
+
+ final String actualFooUrl =
+ ConfigResolver.getProjectStageAwarePropertyValue(
+ "foo.url");
+
+ Assert.assertEquals(expectedFooUrl, actualFooUrl);
+ }
+
+ @Test
+ public void testProjectStageAwarePropertyValueReference_2() {
+ final String expected =
"projectStageAware-exampleEntry-1-is-tomato-UnitTest";
-
- final String projectStageAwareExampleEntry1 =
+
+ final String projectStageAwareExampleEntry1 =
ConfigResolver.getProjectStageAwarePropertyValue(
"deltaspike.test.exampleEntry-2",
"");
-
+
Assert.assertEquals(expected, projectStageAwareExampleEntry1);
}
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
index 4798f67..ad177b0 100644
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
+++ b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
@@ -93,6 +93,11 @@ public class TestConfigSource implements ConfigSource
props.put("deltaspike.test.projectstagefallback", "Value without ProjectStage");
// ProjectStage aware property value with resolved reference
+ props.put("foo.url", "${bar.url}/services");
+ props.put("bar.url", "undefined");
+ props.put("bar.url.UnitTest", "http://bar-dev");
+ props.put("bar.url.Production", "http://bar-prod");
+
props.put("deltaspike.test.exampleEntry-1", "tomato");
props.put("deltaspike.test.exampleEntry-1.UnitTest", "tomato-UnitTest");
props.put("deltaspike.test.exampleEntry-2", "default-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");
[2/2] deltaspike git commit: DELTASPIKE-1207: fix exception handling
in DynamicMBeanWrapper.invoke()
Posted by jo...@apache.org.
DELTASPIKE-1207: fix exception handling in DynamicMBeanWrapper.invoke()
- don't wrap MBeanException directly thrown by the MBean method
- document exception handling in @JmxManaged
This closes #66
This closes #62
Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/ebb24acc
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/ebb24acc
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/ebb24acc
Branch: refs/heads/master
Commit: ebb24accd05648df3206d77149ccf182d367700f
Parents: 7215f7b
Author: famod <f....@gmx.net>
Authored: Sun Oct 16 22:17:47 2016 +0200
Committer: John D. Ament <jo...@apache.org>
Committed: Thu Oct 27 20:47:08 2016 -0400
----------------------------------------------------------------------
.../deltaspike/core/api/jmx/JmxManaged.java | 6 +++--
.../core/impl/jmx/DynamicMBeanWrapper.java | 25 ++++++++++++++++----
2 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ebb24acc/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java
index 1b1001b..b9f28ae 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/jmx/JmxManaged.java
@@ -28,9 +28,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Describes a JMX operation or attribute, when used on a method or a field, respectively.
- *
+ * <p>
* Used on a method it describes a JMX operation with an optional description.
- *
+ * An exception thrown by the method will be wrapped in a {@link javax.management.MBeanException}
+ * unless it already is a {@code MBeanException}.
+ * <p>
* Used on a field it describes a JMX attribute. This attribute is readable if a getter on this field is available and
* writable if a setter is found.
*/
http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ebb24acc/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java
index 09166d5..9a7c1e0 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/jmx/DynamicMBeanWrapper.java
@@ -59,7 +59,6 @@ import org.apache.deltaspike.core.api.jmx.MBean;
import org.apache.deltaspike.core.api.jmx.NotificationInfo;
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.ParameterUtil;
/**
@@ -396,17 +395,33 @@ public class DynamicMBeanWrapper extends NotificationBroadcasterSupport implemen
{
return operations.get(actionName).invoke(instance(), params);
}
- catch (Exception e)
+ catch (InvocationTargetException e)
+ {
+ final Throwable cause = e.getCause();
+ if (cause instanceof Error)
+ {
+ throw (Error) cause;
+ }
+ if (cause instanceof MBeanException)
+ {
+ throw (MBeanException) cause;
+ }
+ throw new MBeanException((Exception) cause, actionName + " failed with exception");
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ReflectionException(e, actionName + " could not be invoked");
+ }
+ catch (IllegalArgumentException e)
{
- LOGGER.log(Level.SEVERE, actionName + " can't be invoked", e);
- throw ExceptionUtils.throwAsRuntimeException(e);
+ throw new ReflectionException(e, actionName + " could not be invoked");
}
finally
{
Thread.currentThread().setContextClassLoader(oldCl);
}
}
- throw new MBeanException(new IllegalArgumentException(), actionName + " doesn't exist");
+ throw new ReflectionException(new NoSuchMethodException(actionName + " doesn't exist"));
}
private synchronized Object instance()