You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by og...@apache.org on 2011/02/11 19:48:01 UTC
svn commit: r1069918 - in /incubator/stanbol/trunk/commons/testing:
jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java
stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java
Author: ogrisel
Date: Fri Feb 11 18:48:01 2011
New Revision: 1069918
URL: http://svn.apache.org/viewvc?rev=1069918&view=rev
Log:
STANBOL-79: Integration should be easily launchable from eclipse
Modified:
incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java
incubator/stanbol/trunk/commons/testing/stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java
Modified: incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java?rev=1069918&r1=1069917&r2=1069918&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java (original)
+++ incubator/stanbol/trunk/commons/testing/jarexec/src/main/java/org/apache/stanbol/commons/testing/jarexec/JarExecutor.java Fri Feb 11 18:48:01 2011
@@ -39,6 +39,8 @@ public class JarExecutor {
private final int serverPort;
public static final int DEFAULT_PORT = 8765;
+ public static final String DEFAULT_JAR_FOLDER = "target/dependency";
+ public static final String DEFAULT_JAR_NAME_REGEXP = "org.apache.stanbol.*full.*jar$";
public static final String PROP_PREFIX = "jar.executor.";
public static final String PROP_SERVER_PORT = PROP_PREFIX + "server.port";
public static final String PROP_JAR_FOLDER = PROP_PREFIX + "jar.folder";
@@ -69,24 +71,22 @@ public class JarExecutor {
return instance;
}
- private String requireSystemProperty(String name) throws ExecutorException {
- final String result = System.getProperty(name);
- if(result == null || result.trim().length() == 0) {
- throw new ExecutorException("Missing system property: " + name);
- }
- return result.trim();
- }
-
/** Build a JarExecutor, locate the jar to run, etc */
private JarExecutor(Properties config) throws ExecutorException {
final boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");
- String str = config.getProperty(PROP_SERVER_PORT);
- serverPort = str == null ? DEFAULT_PORT : Integer.valueOf(str);
+ String portStr = config.getProperty(PROP_SERVER_PORT);
+ serverPort = portStr == null ? DEFAULT_PORT : Integer.valueOf(portStr);
javaExecutable = isWindows ? "java.exe" : "java";
- final File jarFolder = new File(requireSystemProperty(PROP_JAR_FOLDER));
- final Pattern jarPattern = Pattern.compile(requireSystemProperty(PROP_JAR_NAME_REGEXP));
+
+ String jarFolderPath = config.getProperty(PROP_JAR_FOLDER);
+ jarFolderPath = jarFolderPath == null ? DEFAULT_JAR_FOLDER : jarFolderPath;
+ final File jarFolder = new File(jarFolderPath);
+
+ String jarNameRegexp = config.getProperty(PROP_JAR_NAME_REGEXP);
+ jarNameRegexp = jarNameRegexp == null ? DEFAULT_JAR_NAME_REGEXP : jarNameRegexp;
+ final Pattern jarPattern = Pattern.compile(jarNameRegexp);
// Find executable jar
final String [] candidates = jarFolder.list();
@@ -106,8 +106,8 @@ public class JarExecutor {
}
if(f == null) {
- throw new ExecutorException("Executable jar matching " + jarPattern
- + " not found in " + jarFolder.getAbsolutePath()
+ throw new ExecutorException("Executable jar matching '" + jarPattern
+ + "' not found in " + jarFolder.getAbsolutePath()
+ ", candidates are " + Arrays.asList(candidates));
}
jarToExecute = f;
Modified: incubator/stanbol/trunk/commons/testing/stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/testing/stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java?rev=1069918&r1=1069917&r2=1069918&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/testing/stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java (original)
+++ incubator/stanbol/trunk/commons/testing/stanbol/src/main/java/org/apache/stanbol/commons/testing/stanbol/StanbolTestBase.java Fri Feb 11 18:48:01 2011
@@ -83,10 +83,7 @@ public class StanbolTestBase {
// Timeout for readyness test
final String sec = System.getProperty(SERVER_READY_TIMEOUT_PROP);
- if(sec == null) {
- throw new Exception("Missing property: " + SERVER_READY_TIMEOUT_PROP);
- }
- final int timeoutSec = Integer.valueOf(sec);
+ final int timeoutSec = sec == null ? 60 : Integer.valueOf(sec);
System.out.println("Will wait up to " + timeoutSec + " seconds for server to become ready");
final long endTime = System.currentTimeMillis() + timeoutSec * 1000L;