Search in sources :

Example 1 with ParsedRolloutPlanHeader

use of org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader in project wildfly-core by wildfly.

the class RolloutPlanParsingTestCase method testNonConcurrentGroupNames.

@Test
public void testNonConcurrentGroupNames() throws Exception {
    parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout groupA ,  groupB");
    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);
    final ModelNode node = new ModelNode();
    final ModelNode inSeries = node.get(Util.ROLLOUT_PLAN).get(Util.IN_SERIES);
    ModelNode group = new ModelNode();
    group.get("groupA");
    inSeries.add().get(Util.SERVER_GROUP).set(group);
    group = new ModelNode();
    group.get("groupB");
    inSeries.add().get(Util.SERVER_GROUP).set(group);
    final ModelNode headersNode = new ModelNode();
    header.addTo(ctx, headersNode);
    assertEquals(node, headersNode);
}
Also used : ParsedOperationRequestHeader(org.jboss.as.cli.operation.ParsedOperationRequestHeader) ModelNode(org.jboss.dmr.ModelNode) ParsedRolloutPlanHeader(org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader) Test(org.junit.Test)

Example 2 with ParsedRolloutPlanHeader

use of org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader 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());
}
Also used : ParsedOperationRequestHeader(org.jboss.as.cli.operation.ParsedOperationRequestHeader) SingleRolloutPlanGroup(org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup) ParsedRolloutPlanHeader(org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader) Test(org.junit.Test)

Example 3 with ParsedRolloutPlanHeader

use of org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader 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());
}
Also used : ParsedOperationRequestHeader(org.jboss.as.cli.operation.ParsedOperationRequestHeader) SingleRolloutPlanGroup(org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup) ParsedRolloutPlanHeader(org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader) Test(org.junit.Test)

Example 4 with ParsedRolloutPlanHeader

use of org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader in project wildfly-core by wildfly.

the class RolloutPlanParsingTestCase method testTwoConcurrentGroupNames.

@Test
public void testTwoConcurrentGroupNames() throws Exception {
    parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout groupA ^ groupB");
    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);
    final ModelNode node = new ModelNode();
    final ModelNode inSeries = node.get(Util.ROLLOUT_PLAN).get(Util.IN_SERIES);
    final ModelNode concurrent = new ModelNode();
    final ModelNode cg = concurrent.get(Util.CONCURRENT_GROUPS);
    cg.get("groupA");
    cg.get("groupB");
    inSeries.add().set(concurrent);
    final ModelNode headersNode = new ModelNode();
    header.addTo(ctx, headersNode);
    assertEquals(node, headersNode);
}
Also used : ParsedOperationRequestHeader(org.jboss.as.cli.operation.ParsedOperationRequestHeader) ModelNode(org.jboss.dmr.ModelNode) ParsedRolloutPlanHeader(org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader) Test(org.junit.Test)

Example 5 with ParsedRolloutPlanHeader

use of org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader in project wildfly-core by wildfly.

the class RolloutPlanParsingTestCase method testRolloutSingleGroupName.

/*    @Test
    public void testRolloutWithAProp() throws Exception {

        parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout prop=value");

        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());
        assertTrue(handler.endsOnSeparator());
        assertTrue(handler.endsOnHeaderListStart()); // TODO this is kind of strange but ok...
        assertFalse(handler.isRequestComplete());
        assertTrue(handler.hasHeaders());

        final List<OperationRequestHeader> headers = handler.getHeaders();
        assertEquals(1, headers.size());
        final OperationRequestHeader header = headers.get(0);
        assertTrue(header instanceof RolloutPlanHeader);
        final RolloutPlanHeader rollout = (RolloutPlanHeader) header;
        assertEquals("value", rollout.getProperty("prop"));
    }

    @Test
    public void testRolloutWithTwoProps() throws Exception {

        parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout prop1=value1 prop2 = value2");

        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());
        assertTrue(handler.endsOnSeparator());
        assertTrue(handler.endsOnHeaderListStart()); // TODO this is kind of strange but ok...
        assertFalse(handler.isRequestComplete());
        assertTrue(handler.hasHeaders());

        final List<OperationRequestHeader> headers = handler.getHeaders();
        assertEquals(1, headers.size());
        final OperationRequestHeader header = headers.get(0);
        assertTrue(header instanceof RolloutPlanHeader);
        final RolloutPlanHeader rollout = (RolloutPlanHeader) header;
        assertEquals("value1", rollout.getProperty("prop1"));
        assertEquals("value2", rollout.getProperty("prop2"));
    }
*/
@Test
public void testRolloutSingleGroupName() throws Exception {
    // parse("/profile=default/subsystem=threads/thread-factory=mytf:do{ rollout in-series = groupA}");
    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());
    assertTrue(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);
    final ModelNode node = new ModelNode();
    final ModelNode inSeries = node.get(Util.ROLLOUT_PLAN).get(Util.IN_SERIES);
    final ModelNode groupA = new ModelNode();
    groupA.get("groupA");
    inSeries.add().get(Util.SERVER_GROUP).set(groupA);
    final ModelNode headersNode = new ModelNode();
    header.addTo(ctx, headersNode);
    assertEquals(node, headersNode);
}
Also used : ParsedOperationRequestHeader(org.jboss.as.cli.operation.ParsedOperationRequestHeader) ModelNode(org.jboss.dmr.ModelNode) ParsedRolloutPlanHeader(org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader) Test(org.junit.Test)

Aggregations

ParsedRolloutPlanHeader (org.jboss.as.cli.operation.impl.ParsedRolloutPlanHeader)20 ParsedOperationRequestHeader (org.jboss.as.cli.operation.ParsedOperationRequestHeader)19 Test (org.junit.Test)19 SingleRolloutPlanGroup (org.jboss.as.cli.operation.impl.SingleRolloutPlanGroup)8 ModelNode (org.jboss.dmr.ModelNode)8