use of com.quorum.tessera.cli.CliResult in project tessera by ConsenSys.
the class PicoCliDelegateTest method legacyConfigOverride.
@Test
public void legacyConfigOverride() throws Exception {
Path configFile = Paths.get(getClass().getResource("/sample-config.json").toURI());
CliResult result = cliDelegate.execute("-configfile", configFile.toString(), "-jdbc.autoCreateTables", "true", "-useWhiteList", "true");
assertThat(result).isNotNull();
assertThat(result.getConfig()).isPresent();
assertThat(result.getStatus()).isEqualTo(0);
assertThat(result.isSuppressStartup()).isFalse();
Config config = result.getConfig().get();
assertThat(config.getJdbcConfig()).isNotNull();
assertThat(config.getJdbcConfig().isAutoCreateTables()).isTrue();
assertThat(config.isUseWhiteList()).isTrue();
}
use of com.quorum.tessera.cli.CliResult in project tessera by ConsenSys.
the class PicoCliDelegateTest method help.
@Test
public void help() throws Exception {
final CliResult result = cliDelegate.execute("help");
final String sysout = systemOutOutput.getLog();
final String syserr = systemErrOutput.getLog();
assertThat(result).isNotNull();
assertThat(result.getConfig()).isNotPresent();
assertThat(result.getStatus()).isEqualTo(0);
assertThat(result.isSuppressStartup()).isTrue();
assertThat(syserr).isEmpty();
assertThat(sysout).isNotEmpty();
assertThat(sysout).contains("Usage: tessera [OPTIONS] [COMMAND]", "Description:", "Options:", "Commands:");
}
use of com.quorum.tessera.cli.CliResult in project tessera by ConsenSys.
the class PicoCliDelegateTest method keygenHelp.
@Test
public void keygenHelp() throws Exception {
final CliResult result = cliDelegate.execute("keygen", "help");
final String sysout = systemOutOutput.getLog();
final String syserr = systemErrOutput.getLog();
assertThat(result).isNotNull();
assertThat(result.getConfig()).isNotPresent();
assertThat(result.getStatus()).isEqualTo(0);
assertThat(result.isSuppressStartup()).isTrue();
assertThat(syserr).isEmpty();
assertThat(sysout).isNotEmpty();
assertThat(sysout).contains("Usage: tessera keygen [OPTIONS] [COMMAND]", "Description:", "Options:", "Commands:");
}
use of com.quorum.tessera.cli.CliResult in project tessera by ConsenSys.
the class PicoCliDelegateTest method keygenThenExit.
@Test
public void keygenThenExit() throws Exception {
FilesystemKeyPair keypair = mock(FilesystemKeyPair.class);
when(keyGenerator.generate(anyString(), eq(null), eq(null))).thenReturn(keypair);
final CliResult result = cliDelegate.execute("-keygen", "--encryptor.type", "NACL");
assertThat(result).isNotNull();
assertThat(result.isSuppressStartup()).isTrue();
verify(keyGenerator).generate(anyString(), eq(null), eq(null));
}
use of com.quorum.tessera.cli.CliResult in project tessera by ConsenSys.
the class PicoCliDelegateTest method configOverride.
// @Test
// public void keygenFileUpdateOptionsRequireConfigfile() {
//
// FilesystemKeyPair keypair = mock(FilesystemKeyPair.class);
// when(keyGenerator.generate(anyString(), eq(null), eq(null))).thenReturn(keypair);
//
// Throwable ex = catchThrowable(() -> cliDelegate.execute("-keygen", "-output",
// "somepath"));
//
// assertThat(ex).isNotNull();
// assertThat(ex).isExactlyInstanceOf(CliException.class);
// assertThat(ex.getMessage()).contains("Missing required argument(s):
// --configfile=<config>");
// }
@Test
public void configOverride() throws Exception {
Path configFile = Paths.get(getClass().getResource("/sample-config.json").toURI());
CliResult result = cliDelegate.execute("-configfile", configFile.toString(), "-o", "jdbc.autoCreateTables=true", "-o", "useWhiteList=true");
assertThat(result).isNotNull();
assertThat(result.getConfig()).isPresent();
assertThat(result.getConfig().get().getJdbcConfig().isAutoCreateTables()).isTrue();
assertThat(result.getConfig().get().isUseWhiteList()).isTrue();
}
Aggregations