You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2018/02/02 23:15:45 UTC

[sling-org-apache-sling-hc-core] branch master updated (5d553ec -> cf95348)

This is an automated email from the ASF dual-hosted git repository.

olli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-core.git.


    from 5d553ec  fix line endings
     new 30fa861  clean up test
     new cf95348  use FieldUtils to set scriptEngineManager in test

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/sling/hc/core/impl/ScriptableHealthCheckTest.java | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
olli@apache.org.

[sling-org-apache-sling-hc-core] 01/02: clean up test

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-core.git

commit 30fa861e01b282ff348bb76015ddaabd7e2c0111
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Feb 3 00:14:14 2018 +0100

    clean up test
---
 .../org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java     | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java b/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
index 421cedc..3c1464c 100644
--- a/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
@@ -18,7 +18,6 @@
 package org.apache.sling.hc.core.impl;
 
 import java.lang.reflect.Field;
-import java.util.Dictionary;
 
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
@@ -27,7 +26,6 @@ import org.apache.sling.hc.api.Result;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Matchers;
-import org.osgi.service.component.ComponentContext;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -37,8 +35,7 @@ import static org.mockito.Mockito.when;
 public class ScriptableHealthCheckTest {
     
     private ScriptableHealthCheck hc;
-    private Dictionary<String, String> props;
-    private ComponentContext ctx;
+
     private final JmxScriptBindingsProvider jmxScriptBindingsProvider = new JmxScriptBindingsProvider();
 
     private void assertExpression(String expression, String languageExtension, boolean expected) throws Exception {

-- 
To stop receiving notification emails like this one, please contact
olli@apache.org.

[sling-org-apache-sling-hc-core] 02/02: use FieldUtils to set scriptEngineManager in test

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-hc-core.git

commit cf9534886756af0fe905ac82d255b8284ee08a8a
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Feb 3 00:15:38 2018 +0100

    use FieldUtils to set scriptEngineManager in test
---
 .../org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java   | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java b/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
index 3c1464c..af3a142 100644
--- a/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
+++ b/src/test/java/org/apache/sling/hc/core/impl/ScriptableHealthCheckTest.java
@@ -17,11 +17,10 @@
  */
 package org.apache.sling.hc.core.impl;
 
-import java.lang.reflect.Field;
-
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 
+import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.sling.hc.api.Result;
 import org.junit.Before;
 import org.junit.Test;
@@ -43,9 +42,7 @@ public class ScriptableHealthCheckTest {
         assertNotNull("With the rhino jar in our classpath, we should get a js script engine", rhino);
         final ScriptEngineManager manager = mock(ScriptEngineManager.class);
         when(manager.getEngineByExtension(Matchers.same("ecma"))).thenReturn(rhino);
-        final Field f = hc.getClass().getDeclaredField("scriptEngineManager");
-        f.setAccessible(true);
-        f.set(hc, manager);
+        FieldUtils.writeDeclaredField(hc, "scriptEngineManager", manager, true);
 
         final ScriptableHealthCheckConfiguration configuration = mock(ScriptableHealthCheckConfiguration.class);
         when(configuration.expression()).thenReturn(expression);

-- 
To stop receiving notification emails like this one, please contact
olli@apache.org.