dubbo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] diecui1202 closed pull request #2406: Dubbo- #1684
Date Fri, 21 Sep 2018 02:37:39 GMT
diecui1202 closed pull request #2406: Dubbo- #1684
URL: https://github.com/apache/incubator-dubbo/pull/2406
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-container/dubbo-container-log4j/src/test/java/org/apache/dubbo/container/log4j/Log4jContainerTest.java
b/dubbo-container/dubbo-container-log4j/src/test/java/org/apache/dubbo/container/log4j/Log4jContainerTest.java
index b34d643930..08746a8e14 100644
--- a/dubbo-container/dubbo-container-log4j/src/test/java/org/apache/dubbo/container/log4j/Log4jContainerTest.java
+++ b/dubbo-container/dubbo-container-log4j/src/test/java/org/apache/dubbo/container/log4j/Log4jContainerTest.java
@@ -17,19 +17,29 @@
 package org.apache.dubbo.container.log4j;
 
 import org.apache.dubbo.common.extension.ExtensionLoader;
+import org.apache.dubbo.common.logger.Logger;
+import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.container.Container;
-
 import org.junit.Test;
 
 /**
  * StandaloneContainerTest
  */
 public class Log4jContainerTest {
+	
+	static final Logger logger = LoggerFactory.getLogger(Log4jContainerTest.class);
+
 
     @Test
     public void testContainer() {
+    	System.setProperty(Log4jContainer.LOG4J_SUBDIRECTORY, "info");
+    	System.setProperty(Log4jContainer.LOG4J_FILE,  System.getProperty("java.io.tmpdir")+"info.log");
       
         Log4jContainer container = (Log4jContainer) ExtensionLoader.getExtensionLoader(Container.class).getExtension("log4j");
         container.start();
+        logger.debug("Test debug:" + this.getClass().getName());
+        logger.warn("Test warn:" + this.getClass().getName());
+        logger.info("Test info:" + this.getClass().getName());
+        logger.error("Test error:" + this.getClass().getName());
         container.stop();
     }
 
diff --git a/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/MainLauncherTest.java
b/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/MainLauncherTest.java
new file mode 100644
index 0000000000..6803e54685
--- /dev/null
+++ b/dubbo-container/dubbo-container-spring/src/test/java/org/apache/dubbo/container/spring/MainLauncherTest.java
@@ -0,0 +1,34 @@
+package org.apache.dubbo.container.spring;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.dubbo.container.Main;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+/**
+ * SpringContainerTest
+ *
+ */
+public class MainLauncherTest 
+{
+	@Test
+    public void testMain(){		
+        System.setProperty(Main.SHUTDOWN_HOOK_KEY,"true");
+        new Thread(new Runnable() {			
+			@Override
+			public void run() {
+				try {
+					TimeUnit.SECONDS.sleep(5);
+				} catch (InterruptedException e) {
+				}
+				Class<?> obj = SpringContainer.getContext().getBean("container").getClass();
+		        Assert.assertEquals(SpringContainer.class,obj );
+		        System.exit(0);
+			}
+		}).start();
+        Main.main(null);
+    }
+}
+


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Mime
View raw message