Search in sources :

Example 1 with ResourceDescriptionBuilder

use of org.jboss.hal.core.mbui.ResourceDescriptionBuilder in project console by hal.

the class ModelNodeFormTest method defaultStateMachine.

@Test
public void defaultStateMachine() {
    StateMachine stateMachine = new ModelNodeForm.Builder("defaultStateMachine", metadata(new ResourceDescriptionBuilder().attributes())).stateMachine();
    Assert.assertTrue(stateMachine instanceof ExistingStateMachine);
}
Also used : ExistingStateMachine(org.jboss.hal.ballroom.form.ExistingStateMachine) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) StateMachine(org.jboss.hal.ballroom.form.StateMachine) ReadOnlyStateMachine(org.jboss.hal.ballroom.form.ReadOnlyStateMachine) ExistingStateMachine(org.jboss.hal.ballroom.form.ExistingStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) Test(org.junit.Test)

Example 2 with ResourceDescriptionBuilder

use of org.jboss.hal.core.mbui.ResourceDescriptionBuilder in project console by hal.

the class ModelNodeFormTest method noRuntime.

@Test
public void noRuntime() throws Exception {
    ModelNodeForm<ModelNode> form = builder("noRuntime", new ResourceDescriptionBuilder().storage(ImmutableMap.of("foo", CONFIGURATION, "bar", RUNTIME))).build();
    Iterable<FormItem> formItems = form.getFormItems();
    Iterator<FormItem> iterator = formItems.iterator();
    assertEquals(1, Iterables.size(formItems));
    assertEquals("foo", iterator.next().getName());
}
Also used : FormItem(org.jboss.hal.ballroom.form.FormItem) ModelNode(org.jboss.hal.dmr.ModelNode) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) Test(org.junit.Test)

Example 3 with ResourceDescriptionBuilder

use of org.jboss.hal.core.mbui.ResourceDescriptionBuilder in project console by hal.

the class ModelNodeFormTest method createResourceStateMachine.

// ------------------------------------------------------ verify different state machines
@Test
public void createResourceStateMachine() {
    StateMachine stateMachine = new ModelNodeForm.Builder("createResourceStateMachine", metadata(new ResourceDescriptionBuilder().requestProperties(Collections.emptyMap()))).fromRequestProperties().stateMachine();
    Assert.assertTrue(stateMachine instanceof AddOnlyStateMachine);
}
Also used : ExistingStateMachine(org.jboss.hal.ballroom.form.ExistingStateMachine) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) StateMachine(org.jboss.hal.ballroom.form.StateMachine) ReadOnlyStateMachine(org.jboss.hal.ballroom.form.ReadOnlyStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) Test(org.junit.Test)

Example 4 with ResourceDescriptionBuilder

use of org.jboss.hal.core.mbui.ResourceDescriptionBuilder in project console by hal.

the class ModelNodeFormTest method editOnlyStateMachine.

@Test
public void editOnlyStateMachine() {
    StateMachine stateMachine = new ModelNodeForm.Builder("editOnlyStateMachine", metadata(new ResourceDescriptionBuilder().attributes())).fromRequestProperties().stateMachine();
    Assert.assertTrue(stateMachine instanceof AddOnlyStateMachine);
}
Also used : ExistingStateMachine(org.jboss.hal.ballroom.form.ExistingStateMachine) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) StateMachine(org.jboss.hal.ballroom.form.StateMachine) ReadOnlyStateMachine(org.jboss.hal.ballroom.form.ReadOnlyStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) Test(org.junit.Test)

Example 5 with ResourceDescriptionBuilder

use of org.jboss.hal.core.mbui.ResourceDescriptionBuilder in project console by hal.

the class ModelNodeFormTest method viewOnlyStateMachine.

@Test
public void viewOnlyStateMachine() {
    StateMachine stateMachine = new ModelNodeForm.Builder("viewOnlyStateMachine", metadata(new ResourceDescriptionBuilder().attributes())).readOnly().stateMachine();
    Assert.assertTrue(stateMachine instanceof ReadOnlyStateMachine);
}
Also used : ReadOnlyStateMachine(org.jboss.hal.ballroom.form.ReadOnlyStateMachine) ExistingStateMachine(org.jboss.hal.ballroom.form.ExistingStateMachine) AddOnlyStateMachine(org.jboss.hal.ballroom.form.AddOnlyStateMachine) StateMachine(org.jboss.hal.ballroom.form.StateMachine) ReadOnlyStateMachine(org.jboss.hal.ballroom.form.ReadOnlyStateMachine) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) ResourceDescriptionBuilder(org.jboss.hal.core.mbui.ResourceDescriptionBuilder) Test(org.junit.Test)

Aggregations

ResourceDescriptionBuilder (org.jboss.hal.core.mbui.ResourceDescriptionBuilder)5 Test (org.junit.Test)5 AddOnlyStateMachine (org.jboss.hal.ballroom.form.AddOnlyStateMachine)4 ExistingStateMachine (org.jboss.hal.ballroom.form.ExistingStateMachine)4 ReadOnlyStateMachine (org.jboss.hal.ballroom.form.ReadOnlyStateMachine)4 StateMachine (org.jboss.hal.ballroom.form.StateMachine)4 FormItem (org.jboss.hal.ballroom.form.FormItem)1 ModelNode (org.jboss.hal.dmr.ModelNode)1