You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2014/11/21 22:18:09 UTC

[14/14] knox git commit: KNOX-472: gateway-i18n-logging-sl4j refers to Log4jMessageLoggerFactory

KNOX-472: gateway-i18n-logging-sl4j refers to Log4jMessageLoggerFactory


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

Branch: refs/heads/v0.5.1
Commit: efc27089e80a06b330bc3297ad18dc4f347e9419
Parents: 5adbb55
Author: Kevin Minder <ke...@hortonworks.com>
Authored: Fri Nov 14 08:44:43 2014 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Fri Nov 21 16:03:37 2014 -0500

----------------------------------------------------------------------
 gateway-i18n-logging-log4j/pom.xml              | 15 +++++++
 .../log4j/Log4jMessageLoggerFactoryTest.java    | 45 ++++++++++++++++++++
 gateway-i18n-logging-sl4j/pom.xml               | 15 +++++++
 ...p.gateway.i18n.messages.MessageLoggerFactory |  2 +-
 .../sl4j/Sl4jMessageLoggerFactoryTest.java      | 45 ++++++++++++++++++++
 5 files changed, 121 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/efc27089/gateway-i18n-logging-log4j/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-i18n-logging-log4j/pom.xml b/gateway-i18n-logging-log4j/pom.xml
index 737f4f2..a0031f1 100644
--- a/gateway-i18n-logging-log4j/pom.xml
+++ b/gateway-i18n-logging-log4j/pom.xml
@@ -50,10 +50,25 @@
         </dependency>
 
         <dependency>
+            <groupId>${gateway-group}</groupId>
+            <artifactId>gateway-test-utils</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/efc27089/gateway-i18n-logging-log4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactoryTest.java
----------------------------------------------------------------------
diff --git a/gateway-i18n-logging-log4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactoryTest.java b/gateway-i18n-logging-log4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactoryTest.java
new file mode 100644
index 0000000..2d97f27
--- /dev/null
+++ b/gateway-i18n-logging-log4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/log4j/Log4jMessageLoggerFactoryTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.hadoop.gateway.i18n.messages.loggers.log4j;
+
+import org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+public class Log4jMessageLoggerFactoryTest {
+
+  @Test
+  public void testServiceLoader() throws Exception {
+    ServiceLoader loader = ServiceLoader.load( MessageLoggerFactory.class );
+    Iterator iterator = loader.iterator();
+    assertThat( "Service iterator empty.", iterator.hasNext() );
+    while( iterator.hasNext() ) {
+      Object object = iterator.next();
+      if( object instanceof Log4jMessageLoggerFactory ) {
+        return;
+      }
+    }
+    fail( "Failed to find " + Log4jMessageLoggerFactory.class.getName() + " via service loader." );
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/knox/blob/efc27089/gateway-i18n-logging-sl4j/pom.xml
----------------------------------------------------------------------
diff --git a/gateway-i18n-logging-sl4j/pom.xml b/gateway-i18n-logging-sl4j/pom.xml
index 7817f27..78c1118 100644
--- a/gateway-i18n-logging-sl4j/pom.xml
+++ b/gateway-i18n-logging-sl4j/pom.xml
@@ -50,10 +50,25 @@
         </dependency>
 
         <dependency>
+            <groupId>${gateway-group}</groupId>
+            <artifactId>gateway-test-utils</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-library</artifactId>
+            <scope>test</scope>
+        </dependency>
 
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/knox/blob/efc27089/gateway-i18n-logging-sl4j/src/main/resources/META-INF/services/org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory
----------------------------------------------------------------------
diff --git a/gateway-i18n-logging-sl4j/src/main/resources/META-INF/services/org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory b/gateway-i18n-logging-sl4j/src/main/resources/META-INF/services/org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory
index 862446a..afd88bd 100644
--- a/gateway-i18n-logging-sl4j/src/main/resources/META-INF/services/org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory
+++ b/gateway-i18n-logging-sl4j/src/main/resources/META-INF/services/org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory
@@ -16,4 +16,4 @@
 # limitations under the License.
 ##########################################################################
 
-org.apache.hadoop.gateway.i18n.messages.loggers.sl4j.Log4jMessageLoggerFactory
\ No newline at end of file
+org.apache.hadoop.gateway.i18n.messages.loggers.sl4j.Sl4jMessageLoggerFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/efc27089/gateway-i18n-logging-sl4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/sl4j/Sl4jMessageLoggerFactoryTest.java
----------------------------------------------------------------------
diff --git a/gateway-i18n-logging-sl4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/sl4j/Sl4jMessageLoggerFactoryTest.java b/gateway-i18n-logging-sl4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/sl4j/Sl4jMessageLoggerFactoryTest.java
new file mode 100644
index 0000000..699ad3d
--- /dev/null
+++ b/gateway-i18n-logging-sl4j/src/test/java/org/apache/hadoop/gateway/i18n/messages/loggers/sl4j/Sl4jMessageLoggerFactoryTest.java
@@ -0,0 +1,45 @@
+/**
+ * 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.hadoop.gateway.i18n.messages.loggers.sl4j;
+
+import org.apache.hadoop.gateway.i18n.messages.MessageLoggerFactory;
+import org.junit.Test;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.fail;
+
+public class Sl4jMessageLoggerFactoryTest {
+
+  @Test
+  public void testServiceLoader() throws Exception {
+    ServiceLoader loader = ServiceLoader.load( MessageLoggerFactory.class );
+    Iterator iterator = loader.iterator();
+    assertThat( "Service iterator empty.", iterator.hasNext() );
+    while( iterator.hasNext() ) {
+      Object object = iterator.next();
+      if( object instanceof Sl4jMessageLoggerFactory ) {
+        return;
+      }
+    }
+    fail( "Failed to find " + Sl4jMessageLoggerFactory.class.getName() + " via service loader." );
+  }
+
+}