From 8cf421f79b81434596fad9e698bdeb44384cd242 Mon Sep 17 00:00:00 2001 From: rfeng Date: Wed, 1 Jul 2009 20:02:09 +0000 Subject: Use system property to check if the launcher is running under maven surefire test git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@790349 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/modules/node-launcher-equinox/pom.xml | 7 ++++++- .../sca/node/equinox/launcher/NodeLauncherUtil.java | 16 ++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'java/sca/modules/node-launcher-equinox') diff --git a/java/sca/modules/node-launcher-equinox/pom.xml b/java/sca/modules/node-launcher-equinox/pom.xml index 77e7f932ed..45d6ecc970 100644 --- a/java/sca/modules/node-launcher-equinox/pom.xml +++ b/java/sca/modules/node-launcher-equinox/pom.xml @@ -78,7 +78,12 @@ 2.0-SNAPSHOT test - + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + test + org.apache.tuscany.sca tuscany-extensibility-equinox diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java index 35dcd9bd5f..e795723b38 100644 --- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java +++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherUtil.java @@ -767,8 +767,8 @@ final class NodeLauncherUtil { count++; } } - if (count != 0) { - logger.info("Runtime classpath: " + count + if (count != 0 && logger.isLoggable(Level.FINE)) { + logger.fine("Runtime classpath: " + count + " classes folder" + (count > 1 ? "s" : "") + " from " @@ -816,6 +816,11 @@ final class NodeLauncherUtil { } } + private static boolean isMavenTestMode() { + return getProperty("surefire.test.class.path") != null || getProperty("surefire.real.class.path") != null + || getProperty("localRepository") != null; + } + /** * Determine the Tuscany runtime classpath entries. * @@ -873,8 +878,7 @@ final class NodeLauncherUtil { // Development mode, we're running off classes in a workspace // and not from Maven surefire, collect all bundles in the workspace if (useModulesDirectory) { - ClassLoader cl = NodeLauncherUtil.class.getClassLoader(); - if (!cl.getClass().getName().startsWith("org.apache.maven.surefire")) { + if (!isMavenTestMode()) { File file = new File(uri); if (file.exists()) { File moduleDirectory = file.getParentFile().getParentFile(); @@ -982,8 +986,8 @@ final class NodeLauncherUtil { } count = urls.size() - count; - if (count != 0) { - logger.info("Runtime classpath: " + count + if (count != 0 && logger.isLoggable(Level.FINE)) { + logger.fine("Runtime classpath: " + count + " JAR" + (count > 1 ? "s" : "") + " from application classpath."); -- cgit v1.2.3