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.resources.Names;
21 import org.jboss.hal.testsuite.Console;
22 import org.jboss.hal.testsuite.CrudOperations;
23 import org.jboss.hal.testsuite.Random;
24 import org.jboss.hal.testsuite.container.WildFlyContainer;
25 import org.jboss.hal.testsuite.fragment.FormFragment;
26 import org.jboss.hal.testsuite.fragment.TableFragment;
27 import org.jboss.hal.testsuite.page.configuration.JGroupsPage;
28 import org.jboss.hal.testsuite.test.Manatoko;
29 import org.junit.jupiter.api.BeforeAll;
30 import org.junit.jupiter.api.BeforeEach;
31 import org.junit.jupiter.api.MethodOrderer;
32 import org.junit.jupiter.api.Test;
33 import org.junit.jupiter.api.TestMethodOrder;
34 import org.testcontainers.junit.jupiter.Container;
35 import org.testcontainers.junit.jupiter.Testcontainers;
36 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
37 import org.wildfly.extras.creaper.core.online.operations.Batch;
38 import org.wildfly.extras.creaper.core.online.operations.Operations;
39 import org.wildfly.extras.creaper.core.online.operations.Values;
40
41 import static org.jboss.arquillian.graphene.Graphene.waitGui;
42 import static org.jboss.hal.dmr.ModelDescriptionConstants.RELAY;
43 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING;
44 import static org.jboss.hal.dmr.ModelDescriptionConstants.STATISTICS_ENABLED;
45 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
46 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.JGROUPS_TCP;
47 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.SITE;
48 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.STACK_CREATE;
49 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TRANSPORT_CREATE;
50 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.relayAddress;
51 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.stackAddress;
52 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.transportAddress;
53
54 @Manatoko
55 @Testcontainers
56 @TestMethodOrder(MethodOrderer.MethodName.class)
57 class StackRelayTest {
58
59 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);
60
61 @BeforeAll
62 static void setupModel() throws Exception {
63 OnlineManagementClient client = wildFly.managementClient();
64 Operations operations = new Operations(client);
65 Batch stackCreate = new Batch();
66 stackCreate.add(stackAddress(STACK_CREATE));
67 stackCreate.add(transportAddress(STACK_CREATE, TRANSPORT_CREATE), Values.of(SOCKET_BINDING, JGROUPS_TCP));
68 operations.batch(stackCreate);
69 }
70
71 @Inject Console console;
72 @Inject CrudOperations crud;
73 @Page JGroupsPage page;
74 FormFragment relayForm;
75 TableFragment stackTable;
76 TableFragment relayTable;
77
78 @BeforeEach
79 void setUp() {
80 page.navigate();
81 console.verticalNavigation().selectPrimary("jgroups-stack-item");
82
83 stackTable = page.getStackTable();
84 relayTable = page.getRelayTable();
85 relayForm = page.getRelayForm();
86 relayTable.bind(relayForm);
87 }
88
89
90
91 @Test
92 void create() throws Exception {
93 stackTable.action(STACK_CREATE, Names.RELAY);
94 waitGui().until().element(relayTable.getRoot()).is().visible();
95
96 String site = Random.name();
97 crud.create(relayAddress(STACK_CREATE), relayTable, form -> form.text(SITE, site),
98 resourceVerifier -> resourceVerifier.verifyAttribute(SITE, site));
99 }
100
101 @Test()
102 void update() throws Exception {
103 stackTable.action(STACK_CREATE, Names.RELAY);
104 waitGui().until().element(relayTable.getRoot()).is().visible();
105
106 relayTable.select(RELAY.toUpperCase());
107 crud.update(relayAddress(STACK_CREATE), relayForm, STATISTICS_ENABLED, true);
108 }
109
110 @Test
111 void zzzDelete() throws Exception {
112 stackTable.action(STACK_CREATE, Names.RELAY);
113 waitGui().until().element(relayTable.getRoot()).is().visible();
114 crud.delete(relayAddress(STACK_CREATE), relayTable, RELAY.toUpperCase());
115 }
116 }