use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testList_NoBrackets.
@Test
public void testList_NoBrackets() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
final ModelNode value = parseList(ctx, "${cli.test.prop1},${cli.test.prop2},${cli.test.prop3}");
assertNotNull(value);
assertEquals(ModelType.LIST, value.getType());
final List<ModelNode> list = value.asList();
assertEquals(3, list.size());
assertNotNull(list.get(0));
assertEquals("one", list.get(0).asString());
assertNotNull(list.get(1));
assertEquals("two", list.get(1).asString());
assertNotNull(list.get(2));
assertEquals("three", list.get(2).asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testDefaultValueForNotSetProperty.
@Test
public void testDefaultValueForNotSetProperty() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
ModelNode value = parseObject(ctx, "the value is ${cli.test.xxx:not set}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is not set", value.asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testPathSeparator.
@Test
public void testPathSeparator() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
ModelNode value = parseObject(ctx, "the value is ${:}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is " + File.pathSeparator, value.asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testDefault_List.
@Test
public void testDefault_List() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
final ModelNode value = parseObject(ctx, "[\"${cli.test.prop1}\",\"${cli.test.prop2}\"]");
assertNotNull(value);
assertEquals(ModelType.LIST, value.getType());
final List<ModelNode> list = value.asList();
assertEquals(2, list.size());
assertEquals("one", list.get(0).asString());
assertEquals("two", list.get(1).asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testFileSeparator.
@Test
public void testFileSeparator() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
ModelNode value = parseObject(ctx, "the value is ${/}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is " + File.separator, value.asString());
value = parseObject(ctx, "the value is \\${/}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is " + File.separator, value.asString());
value = parseObject(ctx, "the value is \\${/}.");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is " + File.separator + '.', value.asString());
}
Aggregations