[Schmitzm-commits] r1569 - trunk/schmitzm-core/src/test/java/de/schmitzm/testing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 28 20:57:31 CEST 2011


Author: alfonx
Date: 2011-04-28 20:57:30 +0200 (Thu, 28 Apr 2011)
New Revision: 1569

Modified:
   trunk/schmitzm-core/src/test/java/de/schmitzm/testing/TestingUtil.java
Log:


Modified: trunk/schmitzm-core/src/test/java/de/schmitzm/testing/TestingUtil.java
===================================================================
--- trunk/schmitzm-core/src/test/java/de/schmitzm/testing/TestingUtil.java	2011-04-28 13:07:09 UTC (rev 1568)
+++ trunk/schmitzm-core/src/test/java/de/schmitzm/testing/TestingUtil.java	2011-04-28 18:57:30 UTC (rev 1569)
@@ -1,7 +1,10 @@
 package de.schmitzm.testing;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.awt.Color;
 import java.awt.Component;
@@ -15,6 +18,8 @@
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
@@ -27,7 +32,6 @@
 
 import org.apache.log4j.Level;
 import org.junit.Ignore;
-import org.junit.Test;
 
 import de.schmitzm.io.IOUtil;
 import de.schmitzm.lang.LangUtil;
@@ -173,6 +177,9 @@
 	 */
 	public static void testGui(Component gui, String title, int waitMax)
 			throws Throwable {
+		
+		if (runsOnIntegrationServer())
+			waitMax = 0;
 
 		if (GraphicsEnvironment.isHeadless())
 			return;
@@ -226,6 +233,24 @@
 		}
 	}
 
+	/**
+	 * Versucht herauszufinden, ob wir auf einem Integration Server laufen. in dem Fall maxWait immer auf 0;
+	 */
+	private static boolean runsOnIntegrationServer() {
+	    try {
+
+	        InetAddress addr = InetAddress.getLocalHost();
+	    	    
+	        // Get hostname
+	        String hostname = addr.getHostName();
+	        if (hostname != null && hostname.equals("gisbert.wikisquare.de")) return true;
+	        else System.out.println("hostname = "+hostname);
+
+	    } catch (UnknownHostException e) {
+	    }
+	    return false;
+	}
+
 	public static void testGui(Image image, int waitMax) throws Throwable {
 
 		if (GraphicsEnvironment.isHeadless())
@@ -302,14 +327,9 @@
 			return;
 		}
 		if (IST == null) {
-			fail(msg, SOLL);
+			fail(msg);
 		}
 		assertEquals(msg, SOLL, IST);
 	}
 
-	private static void fail(String msg, Boolean sOLL) {
-		// TODO Auto-generated method stub
-		
-	}
-
 }



More information about the Schmitzm-commits mailing list