use of org.apache.ignite.internal.visor.tx.VisorTxTaskArg in project ignite by apache.
the class CommandHandlerParsingTest method testTransactionArguments.
/**
* Test parsing dump transaction arguments.
*/
@Test
public void testTransactionArguments() {
ConnectionAndSslParameters args;
parseArgs(asList("--tx"));
assertParseArgsThrows("Expecting --min-duration", "--tx", "--min-duration");
assertParseArgsThrows("Invalid value for --min-duration: -1", "--tx", "--min-duration", "-1");
assertParseArgsThrows("Expecting --min-size", "--tx", "--min-size");
assertParseArgsThrows("Invalid value for --min-size: -1", "--tx", "--min-size", "-1");
assertParseArgsThrows("--label", "--tx", "--label");
assertParseArgsThrows("Illegal regex syntax", "--tx", "--label", "tx123[");
assertParseArgsThrows("Projection can't be used together with list of consistent ids.", "--tx", "--servers", "--nodes", "1,2,3");
args = parseArgs(asList("--tx", "--min-duration", "120", "--min-size", "10", "--limit", "100", "--order", "SIZE", "--servers"));
VisorTxTaskArg arg = ((TxCommands) args.command()).arg();
assertEquals(Long.valueOf(120 * 1000L), arg.getMinDuration());
assertEquals(Integer.valueOf(10), arg.getMinSize());
assertEquals(Integer.valueOf(100), arg.getLimit());
assertEquals(VisorTxSortOrder.SIZE, arg.getSortOrder());
assertEquals(VisorTxProjection.SERVER, arg.getProjection());
args = parseArgs(asList("--tx", "--min-duration", "130", "--min-size", "1", "--limit", "60", "--order", "DURATION", "--clients"));
arg = ((TxCommands) args.command()).arg();
assertEquals(Long.valueOf(130 * 1000L), arg.getMinDuration());
assertEquals(Integer.valueOf(1), arg.getMinSize());
assertEquals(Integer.valueOf(60), arg.getLimit());
assertEquals(VisorTxSortOrder.DURATION, arg.getSortOrder());
assertEquals(VisorTxProjection.CLIENT, arg.getProjection());
args = parseArgs(asList("--tx", "--nodes", "1,2,3"));
arg = ((TxCommands) args.command()).arg();
assertNull(arg.getProjection());
assertEquals(asList("1", "2", "3"), arg.getConsistentIds());
}
Aggregations