use of org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup in project wildfly-core by wildfly.
the class RolloutPlanParsingTestCase method testEndsOnGroupPropertySeparator.
@Test
public void testEndsOnGroupPropertySeparator() throws Exception {
parse(":do{ rollout groupA( prop = v,");
assertFalse(handler.hasAddress());
assertTrue(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.endsOnSeparator());
assertFalse(handler.endsOnHeaderListStart());
assertFalse(handler.isRequestComplete());
assertTrue(handler.hasHeaders());
final Collection<ParsedOperationRequestHeader> headers = handler.getHeaders();
assertEquals(1, headers.size());
final ParsedOperationRequestHeader header = headers.iterator().next();
assertTrue(header instanceof ParsedRolloutPlanHeader);
ParsedRolloutPlanHeader rollout = (ParsedRolloutPlanHeader) header;
final SingleRolloutPlanGroup group = rollout.getLastGroup();
assertNotNull(group);
assertEquals("groupA", group.getGroupName());
assertFalse(group.endsOnPropertyListStart());
assertFalse(group.endsOnPropertyListEnd());
assertTrue(group.hasProperties());
assertFalse(group.endsOnPropertyValueSeparator());
assertNull(group.getLastPropertyName());
assertNull(group.getLastPropertyValue());
assertTrue(group.endsOnPropertySeparator());
assertEquals(29, group.getLastSeparatorIndex());
}
use of org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup in project wildfly-core by wildfly.
the class RolloutPlanParsingTestCase method testEndsOnGroupPropertiesEnd.
@Test
public void testEndsOnGroupPropertiesEnd() throws Exception {
parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout groupA()");
assertTrue(handler.hasAddress());
assertTrue(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.endsOnSeparator());
assertFalse(handler.endsOnHeaderListStart());
assertFalse(handler.isRequestComplete());
assertTrue(handler.hasHeaders());
final Collection<ParsedOperationRequestHeader> headers = handler.getHeaders();
assertEquals(1, headers.size());
final ParsedOperationRequestHeader header = headers.iterator().next();
assertTrue(header instanceof ParsedRolloutPlanHeader);
ParsedRolloutPlanHeader rollout = (ParsedRolloutPlanHeader) header;
final SingleRolloutPlanGroup group = rollout.getLastGroup();
assertNotNull(group);
assertEquals("groupA", group.getGroupName());
assertFalse(group.endsOnPropertyListStart());
assertTrue(group.endsOnPropertyListEnd());
assertFalse(group.hasProperties());
}
use of org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup in project wildfly-core by wildfly.
the class RolloutPlanParsingTestCase method testSpaceBeforeGroupPropertiesStart.
public void testSpaceBeforeGroupPropertiesStart() throws Exception {
parse(":do{ rollout groupA (");
assertFalse(handler.hasAddress());
assertTrue(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.endsOnSeparator());
assertFalse(handler.endsOnHeaderListStart());
assertFalse(handler.isRequestComplete());
assertTrue(handler.hasHeaders());
final Collection<ParsedOperationRequestHeader> headers = handler.getHeaders();
assertEquals(1, headers.size());
final ParsedOperationRequestHeader header = headers.iterator().next();
assertTrue(header instanceof ParsedRolloutPlanHeader);
ParsedRolloutPlanHeader rollout = (ParsedRolloutPlanHeader) header;
final SingleRolloutPlanGroup group = rollout.getLastGroup();
assertNotNull(group);
assertEquals("groupA", group.getGroupName());
assertTrue(group.endsOnPropertyListStart());
assertFalse(group.endsOnPropertyListEnd());
assertFalse(group.hasProperties());
}
use of org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup in project wildfly-core by wildfly.
the class RolloutPlanParsingTestCase method testEndsOnGroupPropertiesStart.
@Test
public void testEndsOnGroupPropertiesStart() throws Exception {
parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout groupA(");
assertTrue(handler.hasAddress());
assertTrue(handler.hasOperationName());
assertFalse(handler.hasProperties());
assertFalse(handler.endsOnAddressOperationNameSeparator());
assertFalse(handler.endsOnPropertyListStart());
assertFalse(handler.endsOnPropertySeparator());
assertFalse(handler.endsOnPropertyValueSeparator());
assertFalse(handler.endsOnNodeSeparator());
assertFalse(handler.endsOnNodeTypeNameSeparator());
assertFalse(handler.endsOnSeparator());
assertFalse(handler.endsOnHeaderListStart());
assertFalse(handler.isRequestComplete());
assertTrue(handler.hasHeaders());
final Collection<ParsedOperationRequestHeader> headers = handler.getHeaders();
assertEquals(1, headers.size());
final ParsedOperationRequestHeader header = headers.iterator().next();
assertTrue(header instanceof ParsedRolloutPlanHeader);
ParsedRolloutPlanHeader rollout = (ParsedRolloutPlanHeader) header;
final SingleRolloutPlanGroup group = rollout.getLastGroup();
assertNotNull(group);
assertEquals("groupA", group.getGroupName());
assertTrue(group.endsOnPropertyListStart());
assertFalse(group.endsOnPropertyListEnd());
assertFalse(group.hasProperties());
}
use of org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup in project wildfly-core by wildfly.
the class RolloutPlanHeaderCallbackHandler method enteredState.
@Override
public void enteredState(ParsingContext ctx) throws CommandFormatException {
final String id = ctx.getState().getId();
if (HeaderValueState.ID.equals(id)) {
ctx.enterState(RolloutPlanState.INSTANCE);
} else if (ServerGroupState.ID.equals(id)) {
group = new SingleRolloutPlanGroup();
} else if (ConcurrentSignState.ID.equals(id)) {
concurrent = true;
header.groupConcurrentSeparator(ctx.getLocation());
} else if ("NAME_VALUE_SEPARATOR".equals(id)) {
name = buffer.length() == 0 ? null : buffer.toString().trim();
if (name == null || name.isEmpty()) {
throw new CommandFormatException("Property is missing name at index " + ctx.getLocation());
}
if (group != null) {
group.addProperty(name, lastChunkIndex);
group.propertyValueSeparator(ctx.getLocation());
} else {
header.planIdValueSeparator(ctx.getLocation());
}
} else if (ServerGroupSeparatorState.ID.equals(id)) {
header.groupSequenceSeparator(ctx.getLocation());
} else if (PropertyListState.ID.equals(id)) {
if (group != null) {
group.propertyListStart(ctx.getLocation());
} else {
header.propertyListStart(ctx.getLocation());
}
}
buffer.setLength(0);
lastChunkIndex = ctx.getLocation();
}
Aggregations