[LOG4J2-1597]

Add Groovy test to make sure all is well with any javax.script engine.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9a50278f
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9a50278f
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9a50278f

Branch: refs/heads/master
Commit: 9a50278fccd41a282bd3a2d641f1b4e7223c2f31
Parents: c5ee9dc
Author: Gary Gregory <ggreg...@apache.org>
Authored: Mon Sep 19 00:05:44 2016 -0700
Committer: Gary Gregory <ggreg...@apache.org>
Committed: Mon Sep 19 00:05:44 2016 -0700

----------------------------------------------------------------------
 .../appender/ScriptSelectorAppenderTest.java    |  4 +--
 .../log4j-appender-selector-groovy.xml          | 35 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9a50278f/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptSelectorAppenderTest.java
----------------------------------------------------------------------
diff --git 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptSelectorAppenderTest.java
 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptSelectorAppenderTest.java
index e1c8a14..c5095c2 100644
--- 
a/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptSelectorAppenderTest.java
+++ 
b/log4j-core/src/test/java/org/apache/logging/log4j/core/appender/ScriptSelectorAppenderTest.java
@@ -38,11 +38,11 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public class ScriptSelectorAppenderTest {
 
-    @Parameterized.Parameters(name = "{0} {1}")
+    @Parameterized.Parameters(name = "{0}")
     public static Object[][] getParameters() {
         // @formatter:off
         return new Object[][] { 
-            // { "log4j-appender-selector-groovy.xml" },
+            { "log4j-appender-selector-groovy.xml" },
             { "log4j-appender-selector-javascript.xml" },
         };
         // @formatter:on

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9a50278f/log4j-core/src/test/resources/log4j-appender-selector-groovy.xml
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/resources/log4j-appender-selector-groovy.xml 
b/log4j-core/src/test/resources/log4j-appender-selector-groovy.xml
new file mode 100644
index 0000000..4a15273
--- /dev/null
+++ b/log4j-core/src/test/resources/log4j-appender-selector-groovy.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+<Configuration status="WARN" name="RoutingTest">
+  <Appenders>
+    <ScriptSelector name="SelectIt">
+      <Script language="groovy"><![CDATA[
+         return "OSNameFoo".contains("Foo") ? "List2": "List1";]]>
+      </Script>
+      <AppenderSet>
+        <List name="List1" />
+        <List name="List2" />
+      </AppenderSet>
+    </ScriptSelector>
+  </Appenders>
+  <Loggers>
+    <Root level="error">
+      <AppenderRef ref="SelectIt" />
+    </Root>
+  </Loggers>
+</Configuration>
\ No newline at end of file

Reply via email to