You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/12 09:03:17 UTC
svn commit: r506361 - in
/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest:
SCATestSet.java SCATestSuite.java TuscanyITestMojo.java
Author: jboynes
Date: Mon Feb 12 00:03:16 2007
New Revision: 506361
URL: http://svn.apache.org/viewvc?view=rev&rev=506361
Log:
separate testSet name from componentId
fixes problem using uris as report names in that they are written to subdirectories
add console reporting
Modified:
incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java
incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java
incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
Modified: incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java?view=diff&rev=506361&r1=506360&r2=506361
==============================================================================
--- incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java (original)
+++ incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSet.java Mon Feb 12 00:03:16 2007
@@ -24,6 +24,7 @@
import org.apache.maven.surefire.testset.SurefireTestSet;
import org.apache.maven.surefire.testset.TestSetFailedException;
import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.ReportEntry;
import org.apache.tuscany.spi.model.Operation;
@@ -32,20 +33,25 @@
*/
public class SCATestSet implements SurefireTestSet {
private final MavenEmbeddedRuntime runtime;
- private final URI name;
+ private final String name;
+ private final URI uri;
private final Collection<? extends Operation<?>> operations;
- public SCATestSet(MavenEmbeddedRuntime runtime, URI name, Collection<? extends Operation<?>> operations) {
+ public SCATestSet(MavenEmbeddedRuntime runtime, String name, URI uri, Collection<? extends Operation<?>> operations) {
this.runtime = runtime;
this.name = name;
+ this.uri = uri;
this.operations = operations;
}
public void execute(ReporterManager reporterManager, ClassLoader classLoader) throws TestSetFailedException {
for (Operation<?> operation : operations) {
+ reporterManager.testStarting(new ReportEntry(this, operation.getName(), getName()));
try {
- runtime.executeTest(name, operation);
+ runtime.executeTest(uri, operation);
+ reporterManager.testSucceeded(new ReportEntry(this, operation.getName(), getName()));
} catch (Exception e) {
+ reporterManager.testFailed(new ReportEntry(this, operation.getName(), getName()));
throw new TestSetFailedException(e);
}
}
@@ -56,7 +62,7 @@
}
public String getName() {
- return name.toString();
+ return name;
}
public Class getTestClass() {
Modified: incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java?view=diff&rev=506361&r1=506360&r2=506361
==============================================================================
--- incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java (original)
+++ incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/SCATestSuite.java Mon Feb 12 00:03:16 2007
@@ -24,6 +24,7 @@
import org.apache.maven.surefire.suite.SurefireTestSuite;
import org.apache.maven.surefire.report.ReporterManager;
import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.testset.TestSetFailedException;
/**
@@ -66,7 +67,10 @@
protected void execute(SCATestSet testSet, ReporterManager reporterManager, ClassLoader classLoader)
throws ReporterException, TestSetFailedException {
+ reporterManager.testSetStarting(new ReportEntry(this, testSet.getName(), "Starting"));
testSet.execute(reporterManager, classLoader);
+ reporterManager.testSetCompleted(new ReportEntry(this, testSet.getName(), "Completed"));
+ reporterManager.reset();
}
public Map locateTestSets(ClassLoader classLoader) throws TestSetFailedException {
Modified: incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java?view=diff&rev=506361&r1=506360&r2=506361
==============================================================================
--- incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java (original)
+++ incubator/tuscany/java/sca/runtime/itest/plugin/src/main/java/org/apache/tuscany/sca/plugin/itest/TuscanyITestMojo.java Mon Feb 12 00:03:16 2007
@@ -20,15 +20,14 @@
import java.io.File;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
-import java.net.URI;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
import java.util.Map;
+import java.util.Properties;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
@@ -38,6 +37,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.surefire.report.BriefConsoleReporter;
import org.apache.maven.surefire.report.BriefFileReporter;
import org.apache.maven.surefire.report.Reporter;
import org.apache.maven.surefire.report.ReporterException;
@@ -47,15 +47,15 @@
import org.apache.tuscany.api.TuscanyRuntimeException;
import org.apache.tuscany.host.runtime.InitializationException;
-import org.apache.tuscany.spi.model.CompositeImplementation;
+import org.apache.tuscany.sca.plugin.itest.implementation.junit.ImplementationJUnit;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.implementation.java.JavaMappedService;
+import org.apache.tuscany.spi.implementation.java.PojoComponentType;
import org.apache.tuscany.spi.model.ComponentDefinition;
import org.apache.tuscany.spi.model.CompositeComponentType;
+import org.apache.tuscany.spi.model.CompositeImplementation;
import org.apache.tuscany.spi.model.Implementation;
import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.component.Component;
-import org.apache.tuscany.spi.implementation.java.PojoComponentType;
-import org.apache.tuscany.spi.implementation.java.JavaMappedService;
-import org.apache.tuscany.sca.plugin.itest.implementation.junit.ImplementationJUnit;
/**
* @version $Rev$ $Date$
@@ -207,7 +207,7 @@
try {
Properties status = new Properties();
boolean success = run(testSuite, status);
- getLog().info("Test results: "+status);
+ getLog().debug("Test results: "+status);
return success;
} catch (ReporterException e) {
throw new MojoExecutionException(e.getMessage(), e);
@@ -219,8 +219,9 @@
public boolean run(SurefireTestSuite suite, Properties status) throws ReporterException, TestSetFailedException {
int totalTests = suite.getNumTests();
- Reporter reporter = new BriefFileReporter(reportsDirectory, trimStackTrace);
- List<Reporter> reports = Collections.singletonList(reporter);
+ List<Reporter> reports = new ArrayList<Reporter>();
+ reports.add(new BriefFileReporter(reportsDirectory, trimStackTrace));
+ reports.add(new BriefConsoleReporter(trimStackTrace));
ReporterManager reporterManager = new ReporterManager(reports);
reporterManager.initResultsFromProperties(status);
@@ -289,8 +290,8 @@
ComponentDefinition<? extends Implementation<?>> junitDefinition = entry.getValue();
Implementation<?> implementation = junitDefinition.getImplementation();
if (ImplementationJUnit.class.isAssignableFrom(implementation.getClass())) {
- URI testSetName = uriBase.resolve(name);
- SCATestSet testSet = createTestSet(runtime, testSetName, junitDefinition);
+ URI uri = uriBase.resolve(name);
+ SCATestSet testSet = createTestSet(runtime, name, uri, junitDefinition);
suite.add(testSet);
}
}
@@ -298,7 +299,8 @@
}
protected SCATestSet createTestSet(MavenEmbeddedRuntime runtime,
- URI name,
+ String name,
+ URI uri,
ComponentDefinition definition) throws MojoExecutionException {
ImplementationJUnit impl = (ImplementationJUnit) definition.getImplementation();
PojoComponentType componentType = impl.getComponentType();
@@ -308,6 +310,6 @@
throw new MojoExecutionException("No testServic defined on component: " + definition.getUri());
}
Map<String, ? extends Operation<?>> operations = testService.getServiceContract().getOperations();
- return new SCATestSet(runtime, name, operations.values());
+ return new SCATestSet(runtime, name, uri, operations.values());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org