Fix Bootstrap test by not staring the shell and hence other threads that block the completion of tests run via gradle

This commit is contained in:
mpollack
2012-12-20 03:45:42 +08:00
parent ecf06a70ee
commit f317d21f04

View File

@@ -1,7 +1,5 @@
package org.springframework.shell;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.logging.Logger;
@@ -9,24 +7,18 @@ import junit.framework.Assert;
import org.junit.Test;
import org.springframework.shell.core.JLineShellComponent;
import org.springframework.shell.event.ShellStatus;
import org.springframework.shell.event.ShellStatus.Status;
import org.springframework.shell.support.logging.HandlerUtils;
public class BootstrapTest {
@Test
public void test() throws IOException, InterruptedException {
public void test() throws IOException {
try {
Bootstrap bootstrap = new Bootstrap(null);
JLineShellComponent shell = bootstrap.getJLineShellComponent();
shell.start();
while (shell.getShellStatus().getStatus() != ShellStatus.Status.USER_INPUT) {
Thread.sleep(100);
}
System.out.println("about to start shell...");
Assert.assertEquals("Number of CommandMarkers is incorrect", 4, shell.getSimpleParser().getCommandMarkers().size());
Assert.assertEquals("Number of Converters is incorrect", 16, shell.getSimpleParser().getConverters().size());
shell.stop();
Assert.assertEquals("Number of Converters is incorrect", 16, shell.getSimpleParser().getConverters().size());
} catch (RuntimeException t) {
throw t;
} finally {