eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject incubator-eagle git commit: [MINOR] Resolve unstable UT and clean slf4j-log4j dependencies
Date Thu, 20 Oct 2016 09:22:05 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 64fce8f80 -> 605c8b21a


[MINOR] Resolve unstable UT and clean slf4j-log4j dependencies

Resolve unstable UT and clean useless `slf4j-log4j` dependencies.

Author: Hao Chen <hao@apache.org>

Closes #539 from haoch/ResolveUnstableUT.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/605c8b21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/605c8b21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/605c8b21

Branch: refs/heads/master
Commit: 605c8b21afcecd5d09444755302bce34b3400c2b
Parents: 64fce8f
Author: Hao Chen <hao@apache.org>
Authored: Thu Oct 20 17:21:55 2016 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Thu Oct 20 17:21:55 2016 +0800

----------------------------------------------------------------------
 .../eagle-embed/eagle-embed-server/pom.xml      |  13 +-
 .../service/embedded/tomcat/EmbeddedServer.java | 129 +++++++++----------
 .../embedded/tomcat/TestEmbeddedServer.java     |  56 ++++----
 3 files changed, 99 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/605c8b21/eagle-core/eagle-embed/eagle-embed-server/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-embed/eagle-embed-server/pom.xml b/eagle-core/eagle-embed/eagle-embed-server/pom.xml
index a07ba59..4ef62a0 100644
--- a/eagle-core/eagle-embed/eagle-embed-server/pom.xml
+++ b/eagle-core/eagle-embed/eagle-embed-server/pom.xml
@@ -54,16 +54,13 @@
             <artifactId>tomcat-embed-websocket</artifactId>
         </dependency>
         <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
         </dependency>
-        <!--<dependency>-->
-        <!--<groupId>org.slf4j</groupId>-->
-        <!--<artifactId>slf4j-log4j12</artifactId>-->
-        <!--</dependency>-->
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>log4j-over-slf4j</artifactId>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
     <build>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/605c8b21/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
b/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
index 35d3967..203e52b 100644
--- a/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
+++ b/eagle-core/eagle-embed/eagle-embed-server/src/main/java/org/apache/eagle/service/embedded/tomcat/EmbeddedServer.java
@@ -16,23 +16,23 @@
  */
 package org.apache.eagle.service.embedded.tomcat;
 
-import java.io.File;
-
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.startup.Tomcat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.File;
+
 public class EmbeddedServer {
-	
-	private static EmbeddedServer server;
-	private Tomcat tomcat;
-	private String webappDirLocation;
-	private int port;
-	private static int DEFAULT_TOMCAT_PORT = 38080;
-	private static final Logger LOG = LoggerFactory.getLogger(EmbeddedServer.class);
-		
-	public static void main(String[] args) {
+
+    private static EmbeddedServer server;
+    private Tomcat tomcat;
+    private String webappDirLocation;
+    private int port;
+    private static int DEFAULT_TOMCAT_PORT = 38080;
+    private static final Logger LOG = LoggerFactory.getLogger(EmbeddedServer.class);
+
+    public static void main(String[] args) {
         // args: webappLocation, port
         int tomcatPort;
         if (args.length > 1) {
@@ -41,69 +41,68 @@ public class EmbeddedServer {
             tomcatPort = DEFAULT_TOMCAT_PORT;
         }
         new EmbeddedServer(args[0], tomcatPort).start();
-	}
+    }
+
+    private EmbeddedServer(String webappDirLocation) {
+        this(webappDirLocation, DEFAULT_TOMCAT_PORT);
+    }
+
+    private EmbeddedServer(String webappDirLocation, int port) {
+        this.webappDirLocation = webappDirLocation;
+        this.port = port;
+    }
 
-	private EmbeddedServer(String webappDirLocation) {
-		this(webappDirLocation, DEFAULT_TOMCAT_PORT);
-	}
-	
-	private EmbeddedServer(String webappDirLocation, int port) {
-		this.webappDirLocation = webappDirLocation;
-		this.port = port;
-	}
-	
     public static EmbeddedServer getInstance(String webappDirLocation) {
-    	if (server == null) {
-    		synchronized(EmbeddedServer.class) {
-    			if (server == null) {
-    				server = new EmbeddedServer(webappDirLocation);
-    				server.start();   						
-    			}
-    		}
-    	}
-    	return server;
+        if (server == null) {
+            synchronized (EmbeddedServer.class) {
+                if (server == null) {
+                    server = new EmbeddedServer(webappDirLocation);
+                    server.start();
+                }
+            }
+        }
+        return server;
+    }
+
+    public int getPort() {
+        return port;
     }
 
-	public int getPort() {
-		return port;
-	}
-	
-	public void start() {
-		tomcat = new Tomcat();
-		tomcat.setHostname("localhost");
-		tomcat.setPort(port);
-		try {
-			tomcat.addWebapp("/eagle-service", new File(webappDirLocation).getAbsolutePath());
-			tomcat.start();
+    public void start() {
+        tomcat = new Tomcat();
+        tomcat.setHostname("localhost");
+        tomcat.setPort(port);
+        try {
+            tomcat.addWebapp("/eagle-service", new File(webappDirLocation).getAbsolutePath());
+            tomcat.start();
 
-		} catch (Exception ex) {
-			LOG.error("Got an exception " + ex.getMessage());
-		}
+        } catch (Exception ex) {
+            LOG.error("Got an exception " + ex.getMessage());
+        }
 
         Runtime.getRuntime().addShutdownHook(new Thread() {
             @Override
             public void run() {
-            	try {            		
-            		shutdown();
-            	}
-            	catch (Throwable t) {
-            		LOG.error("Got an exception why shutting down..." + t.getMessage());
-            	}
+                try {
+                    shutdown();
+                } catch (Throwable t) {
+                    LOG.error("Got an exception why shutting down..." + t.getMessage());
+                }
             }
         });
-		try {
-			Thread.sleep(10000000);
-		}catch(Exception ex){
-			ex.printStackTrace();
-		}
-	}
-	
-	public void shutdown() throws Throwable {
-	  	if (tomcat.getServer() != null && tomcat.getServer().getState() != LifecycleState.DESTROYED)
{
-	        if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
-	        	tomcat.stop();
-	        }
-	        tomcat.destroy();
-	    }
-	}
+        try {
+            Thread.sleep(10000000);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public void shutdown() throws Throwable {
+        if (tomcat.getServer() != null && tomcat.getServer().getState() != LifecycleState.DESTROYED)
{
+            if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
+                tomcat.stop();
+            }
+            tomcat.destroy();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/605c8b21/eagle-core/eagle-embed/eagle-embed-server/src/test/java/org/apache/eagle/service/embedded/tomcat/TestEmbeddedServer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-embed/eagle-embed-server/src/test/java/org/apache/eagle/service/embedded/tomcat/TestEmbeddedServer.java
b/eagle-core/eagle-embed/eagle-embed-server/src/test/java/org/apache/eagle/service/embedded/tomcat/TestEmbeddedServer.java
index 1351ac7..5299e0c 100644
--- a/eagle-core/eagle-embed/eagle-embed-server/src/test/java/org/apache/eagle/service/embedded/tomcat/TestEmbeddedServer.java
+++ b/eagle-core/eagle-embed/eagle-embed-server/src/test/java/org/apache/eagle/service/embedded/tomcat/TestEmbeddedServer.java
@@ -1,26 +1,30 @@
-/*
- * 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.eagle.service.embedded.tomcat;
-
-public class TestEmbeddedServer {
-	
-	//@Test
-	public void test() throws Throwable{
-		String webappDirLocation = "../../../eagle-webservice/target/eagle-service";
-		EmbeddedServer.getInstance(webappDirLocation);
-	}
-}
+/*
+ * 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.eagle.service.embedded.tomcat;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class TestEmbeddedServer {
+	
+	@Test
+	public void test() throws Throwable{
+		String webappDirLocation = "../../../eagle-webservice/target/eagle-service";
+		EmbeddedServer.getInstance(webappDirLocation);
+	}
+}
\ No newline at end of file


Mime
View raw message