use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testNestedAndRecursive.
@Test
public void testNestedAndRecursive() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
ModelNode value = parseObject(ctx, "the value is ${${cli.test.ref1}.${cli.test.ref2}}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is valuable", value.asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testDefault_Object.
@Test
public void testDefault_Object() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
final ModelNode value = parseObject(ctx, "{\"${cli.test.prop1}\"=>\"${cli.test.prop2}\",\"${cli.test.prop3}\"=>\"${cli.test.prop4}\"}");
assertNotNull(value);
assertEquals(ModelType.OBJECT, value.getType());
final List<Property> list = value.asPropertyList();
assertEquals(2, list.size());
assertEquals("one", list.get(0).getName());
assertEquals("two", list.get(0).getValue().asString());
assertEquals("three", list.get(1).getName());
assertEquals("four", list.get(1).getValue().asString());
}
use of org.jboss.as.cli.completion.mock.MockCommandContext in project wildfly-core by wildfly.
the class ParameterValueResolutionTestCase method testSimpleText.
@Test
public void testSimpleText() throws Exception {
final CommandContext ctx = new MockCommandContext();
ctx.setResolveParameterValues(true);
ModelNode value = parseObject(ctx, "the value is $\\{cli.test.valuable\\}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is ${cli.test.valuable}", value.asString());
value = parseObject(ctx, "the value is ${cli.test.valuable}");
assertNotNull(value);
assertEquals(ModelType.STRING, value.getType());
assertEquals("the value is valuable", value.asString());
}
Aggregations