1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.jgroups;
17
18 import org.jboss.arquillian.core.api.annotation.Inject;
19 import org.jboss.arquillian.graphene.page.Page;
20 import org.jboss.hal.testsuite.Console;
21 import org.jboss.hal.testsuite.CrudOperations;
22 import org.jboss.hal.testsuite.Random;
23 import org.jboss.hal.testsuite.container.WildFlyContainer;
24 import org.jboss.hal.testsuite.fragment.FormFragment;
25 import org.jboss.hal.testsuite.fragment.TableFragment;
26 import org.jboss.hal.testsuite.page.configuration.JGroupsPage;
27 import org.jboss.hal.testsuite.test.Manatoko;
28 import org.junit.jupiter.api.BeforeAll;
29 import org.junit.jupiter.api.BeforeEach;
30 import org.junit.jupiter.api.Test;
31 import org.testcontainers.junit.jupiter.Container;
32 import org.testcontainers.junit.jupiter.Testcontainers;
33 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
34 import org.wildfly.extras.creaper.core.online.operations.Batch;
35 import org.wildfly.extras.creaper.core.online.operations.Operations;
36 import org.wildfly.extras.creaper.core.online.operations.Values;
37
38 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
39 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING;
40 import static org.jboss.hal.dmr.ModelDescriptionConstants.STATISTICS_ENABLED;
41 import static org.jboss.hal.dmr.ModelDescriptionConstants.TRANSPORT;
42 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
43 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.JGROUPS_TCP;
44 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.STACK_CREATE;
45 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.STACK_DELETE;
46 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.STACK_UPDATE;
47 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TRANSPORT_CREATE;
48 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.stackAddress;
49 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.transportAddress;
50
51 @Manatoko
52 @Testcontainers
53 class StackTest {
54
55 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);
56
57 @BeforeAll
58 static void setupModel() throws Exception {
59 OnlineManagementClient client = wildFly.managementClient();
60 Operations operations = new Operations(client);
61 Batch stackUpdate = new Batch();
62 stackUpdate.add(stackAddress(STACK_UPDATE));
63 stackUpdate.add(transportAddress(STACK_UPDATE, TRANSPORT_CREATE), Values.of(SOCKET_BINDING, JGROUPS_TCP));
64 Batch stackDelete = new Batch();
65 stackDelete.add(stackAddress(STACK_DELETE));
66 stackDelete.add(transportAddress(STACK_DELETE, TRANSPORT_CREATE), Values.of(SOCKET_BINDING, JGROUPS_TCP));
67 operations.batch(stackUpdate);
68 operations.batch(stackDelete);
69 }
70
71 @Inject Console console;
72 @Inject CrudOperations crud;
73 @Page JGroupsPage page;
74 FormFragment form;
75 TableFragment table;
76
77 @BeforeEach
78 void setUp() {
79 page.navigate();
80 console.verticalNavigation().selectPrimary("jgroups-stack-item");
81
82 table = page.getStackTable();
83 form = page.getStackForm();
84 table.bind(form);
85 }
86
87 @Test
88 void create() throws Exception {
89 crud.create(stackAddress(STACK_CREATE), table, form -> {
90 form.text(NAME, STACK_CREATE);
91 form.text(TRANSPORT, Random.name());
92 form.text(SOCKET_BINDING, JGROUPS_TCP);
93 });
94 }
95
96 @Test
97 void update() throws Exception {
98 table.select(STACK_UPDATE);
99 crud.update(stackAddress(STACK_UPDATE), form, STATISTICS_ENABLED, true);
100 }
101
102 @Test
103 void delete() throws Exception {
104 crud.delete(stackAddress(STACK_DELETE), table, STACK_DELETE);
105 }
106 }