use of org.jboss.as.cli.operation.ParsedCommandLine in project wildfly-core by wildfly.
the class PropertyReplacementTestCase method testUnresolvedCommandArgumentValue.
@Test
public // there is a different config option whether to resolve argument values
void testUnresolvedCommandArgumentValue() throws Exception {
final ParsedCommandLine parsed = parse("command-name ${" + OP_PROP_PROP_NAME + "}=test");
assertEquals("command-name", parsed.getOperationName());
assertFalse(parsed.hasProperty(OP_PROP_PROP_VALUE));
assertFalse(parsed.hasProperty("--" + OP_PROP_PROP_VALUE));
assertEquals(1, parsed.getOtherProperties().size());
assertEquals("${" + OP_PROP_PROP_NAME + "}=test", parsed.getOtherProperties().get(0));
}
use of org.jboss.as.cli.operation.ParsedCommandLine in project wildfly-core by wildfly.
the class PropertyReplacementTestCase method testOperationPropertyName.
@Test
public void testOperationPropertyName() throws Exception {
final ParsedCommandLine parsed = parse(":write-attribute(${" + OP_PROP_PROP_NAME + "}=test)");
assertEquals("write-attribute", parsed.getOperationName());
assertEquals(parsed.getPropertyValue(OP_PROP_PROP_VALUE), "test");
}
use of org.jboss.as.cli.operation.ParsedCommandLine in project wildfly-core by wildfly.
the class PropertyReplacementTestCase method testSystemPropertiesInTheMix.
@Test
public void testSystemPropertiesInTheMix() throws Exception {
final ParsedCommandLine parsed = parse("co${" + OP_PROP_NAME + "}${" + OP_PROP_NAME + "} " + "--${" + OP_PROP_PROP_NAME + "}_${" + OP_PROP_PROP_NAME + "}=${" + OP_PROP_PROP_NAME + "}");
assertEquals("co" + OP_PROP_VALUE + OP_PROP_VALUE, parsed.getOperationName());
assertTrue(parsed.getOtherProperties().isEmpty());
assertEquals("${" + OP_PROP_PROP_NAME + "}", parsed.getPropertyValue("--" + OP_PROP_PROP_VALUE + "_" + OP_PROP_PROP_VALUE));
}
use of org.jboss.as.cli.operation.ParsedCommandLine in project wildfly-core by wildfly.
the class PropertyReplacementTestCase method testHeaderNameAndValue.
@Test
public void testHeaderNameAndValue() throws Exception {
ParsedCommandLine parsed = parse(":write-attribute{${" + OP_PROP_PROP_NAME + "}=${" + OP_PROP_NAME + "}}");
assertEquals("write-attribute", parsed.getOperationName());
assertTrue(parsed.hasHeaders());
assertTrue(parsed.hasHeader(OP_PROP_PROP_VALUE));
ModelNode headers = new ModelNode();
parsed.getLastHeader().addTo(null, headers);
assertEquals(OP_PROP_VALUE, headers.get(OP_PROP_PROP_VALUE).asString());
parsed = parse(":write-attribute{${" + OP_PROP_PROP_NAME + "} ${" + OP_PROP_NAME + "}}");
assertEquals("write-attribute", parsed.getOperationName());
assertTrue(parsed.hasHeaders());
assertTrue(parsed.hasHeader(OP_PROP_PROP_VALUE));
headers = new ModelNode();
parsed.getLastHeader().addTo(null, headers);
assertEquals(OP_PROP_VALUE, headers.get(OP_PROP_PROP_VALUE).asString());
}
use of org.jboss.as.cli.operation.ParsedCommandLine in project wildfly-core by wildfly.
the class PropertyReplacementTestCase method testCommandName.
@Test
public void testCommandName() throws Exception {
final ParsedCommandLine parsed = parse("${" + OP_PROP_NAME + "}");
assertEquals(OP_PROP_VALUE, parsed.getOperationName());
}
Aggregations