Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,82 @@
package org.baeldung.shell.simple;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.shell.Bootstrap;
import org.springframework.shell.core.CommandResult;
import org.springframework.shell.core.JLineShellComponent;
import java.io.File;
public class SimpleCLIIntegrationTest {
static JLineShellComponent shell;
@BeforeClass
public static void startUp() throws InterruptedException {
final Bootstrap bootstrap = new Bootstrap();
shell = bootstrap.getJLineShellComponent();
}
@AfterClass
public static void shutdown() {
shell.stop();
// delete contents.txt
final File testFile = new File("contents.txt");
if (testFile.exists()) {
testFile.delete();
}
}
public static JLineShellComponent getShell() {
return shell;
}
@Test
public void givenCommandConfig_whenExecutingWebGetCommand_thenCorrectResult() {
final CommandResult resultWebSave = shell.executeCommand("web-get --url https://www.google.com");
Assert.assertTrue(resultWebSave.isSuccess());
}
@Test
public void givenCommandConfig_whenExecutingWebSaveCommand_thenCorrectResult() {
shell.executeCommand("admin-enable");
final CommandResult result = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
Assert.assertArrayEquals(new boolean[] { result.isSuccess(), new File("contents.txt").exists() }, new boolean[] { true, true });
}
@Test
public void givenCommandConfig_whenAdminEnableCommandExecuted_thenCorrectAvailability() {
final CommandResult resultAdminDisable = shell.executeCommand("admin-disable");
final CommandResult resultWebSaveUnavailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
final CommandResult resultAdminEnable = shell.executeCommand("admin-enable");
final CommandResult resultWebSaveAvailable = shell.executeCommand("web-save --url https://www.google.com --out contents.txt");
Assert.assertArrayEquals(new boolean[] { resultAdminDisable.isSuccess(), resultWebSaveUnavailable.isSuccess(), resultAdminEnable.isSuccess(), resultWebSaveAvailable.isSuccess() }, new boolean[] { true, false, true, true });
}
@Test
public void givenCommandConfig_whenWebSaveCommandExecutedNoOutArgument_thenError() {
shell.executeCommand("admin-enable");
final CommandResult resultWebSave = shell.executeCommand("web-save --url https://www.google.com");
Assert.assertEquals(resultWebSave.isSuccess(), false);
}
@Test
public void givenCommandConfig_whenExecutingWebGetCommandWithDefaultArgument_thenCorrectResult() {
final CommandResult result = shell.executeCommand("web-get https://www.google.com");
Assert.assertEquals(result.isSuccess(), true);
}
}
@@ -0,0 +1,13 @@
*.class
#folders#
/target
/neoDb*
/data
/src/main/webapp/WEB-INF/classes
*/META-INF/*
# Packaged files #
*.jar
*.war
*.ear