Skip to content

Commit

Permalink
#782: Polished
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 5, 2013
1 parent 8eb963b commit efbf312
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 64 deletions.

This file was deleted.

Expand Up @@ -145,7 +145,6 @@ public void run() {
}

// notify before we die
Thread.currentThread().notifyAll();
getLog().info("Terminating thread " + Thread.currentThread());
}
}, mainClass + ".main()");
Expand All @@ -161,6 +160,7 @@ public void run() {
mojoLifecycle.join(threadGroup);

try {
getLog().info("We will now terminate thread group " + threadGroup);
mojoLifecycle.terminateThreads(threadGroup);
threadGroup.destroy();
} catch (IllegalThreadStateException e) {
Expand Down
28 changes: 6 additions & 22 deletions hawtio-maven-plugin/src/main/java/io/hawt/maven/TestMojo.java
Expand Up @@ -22,11 +22,11 @@
import java.net.URL;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;

import io.hawt.util.ReflectionHelper;
import io.hawt.maven.junit.DefaultJUnitService;
import io.hawt.maven.junit.JUnitService;
import io.hawt.util.ReflectionHelper;

import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
Expand All @@ -52,13 +52,6 @@ public class TestMojo extends CamelMojo {

private JUnitService jUnitService = new DefaultJUnitService();

private final CountDownLatch latch = new CountDownLatch(1);

@Override
protected MojoLifecycle createMojoLifecycle() {
return new CountdownLatchMojoLifecycle(getLog(), latch);
}

@Override
protected void doPrepareArguments() throws Exception {
bootstrapMain = false;
Expand Down Expand Up @@ -87,10 +80,8 @@ protected void afterBootstrapMain() throws Exception {
Object instance = ReflectionHelper.newInstance(clazz);
getLog().debug("Loaded " + className + " and instantiated " + instance);

Method beforeClass = jUnitService.findBeforeClass(clazz);
ReflectionHelper.invokeMethod(beforeClass, instance);
Method before = jUnitService.findBefore(clazz);
ReflectionHelper.invokeMethod(before, instance);
ReflectionHelper.invokeMethod(jUnitService.findBeforeClass(clazz), instance);
ReflectionHelper.invokeMethod(jUnitService.findBefore(clazz), instance);

// loop all test methods
List<Method> testMethods = jUnitService.findTestMethods(clazz);
Expand All @@ -108,15 +99,8 @@ protected void afterBootstrapMain() throws Exception {
Console console = System.console();
console.readLine();

try {
Method after = jUnitService.findAfter(clazz);
ReflectionHelper.invokeMethod(after, instance);
Method afterClass = jUnitService.findAfterClass(clazz);
ReflectionHelper.invokeMethod(afterClass, instance);
} finally {
// signal we are done
latch.countDown();
}
ReflectionHelper.invokeMethod(jUnitService.findAfter(clazz), instance);
ReflectionHelper.invokeMethod(jUnitService.findAfterClass(clazz), instance);
}

}

0 comments on commit efbf312

Please sign in to comment.