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.PROPERTIES;
43 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING;
44 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
45 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.JGROUPS_TCP;
46 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.PROTOCOL_CREATE;
47 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.PROTOCOL_DELETE;
48 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.PROTOCOL_UPDATE;
49 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.STACK_CREATE;
50 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TRANSPORT_CREATE;
51 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.protocolAddress;
52 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.stackAddress;
53 import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.transportAddress;
54
55 @Manatoko
56 @Testcontainers
57 @TestMethodOrder(MethodOrderer.MethodName.class)
58 public class StackProtocolTest {
59
60 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);
61
62 @BeforeAll
63 static void setupModel() throws Exception {
64 OnlineManagementClient client = wildFly.managementClient();
65 Operations operations = new Operations(client);
66 Batch stackCreate = new Batch();
67 stackCreate.add(stackAddress(STACK_CREATE));
68 stackCreate.add(transportAddress(STACK_CREATE, TRANSPORT_CREATE), Values.of(SOCKET_BINDING, JGROUPS_TCP));
69 operations.batch(stackCreate);
70 operations.add(protocolAddress(STACK_CREATE, PROTOCOL_UPDATE));
71 operations.add(protocolAddress(STACK_CREATE, PROTOCOL_DELETE));
72 }
73
74 @Inject Console console;
75 @Inject CrudOperations crud;
76 @Page JGroupsPage page;
77 FormFragment protocolForm;
78 TableFragment stackTable;
79 TableFragment protocolTable;
80
81 @BeforeEach
82 void setUp() {
83 page.navigate();
84 console.verticalNavigation().selectPrimary("jgroups-stack-item");
85
86 stackTable = page.getStackTable();
87 protocolTable = page.getProtocolTable();
88 protocolForm = page.getProtocolForm();
89 protocolTable.bind(protocolForm);
90 }
91
92
93
94 @Test
95 void create() throws Exception {
96 stackTable.action(STACK_CREATE, Names.PROTOCOL);
97 waitGui().until().element(protocolTable.getRoot()).is().visible();
98 crud.create(protocolAddress(STACK_CREATE, PROTOCOL_CREATE), protocolTable, PROTOCOL_CREATE);
99 }
100
101 @Test()
102 void update() throws Exception {
103 stackTable.action(STACK_CREATE, Names.PROTOCOL);
104 waitGui().until().element(protocolTable.getRoot()).is().visible();
105 protocolTable.select(PROTOCOL_UPDATE);
106 crud.update(protocolAddress(STACK_CREATE, PROTOCOL_UPDATE), protocolForm, PROPERTIES, Random.properties());
107 }
108
109 @Test
110 void zzzDelete() throws Exception {
111 stackTable.action(STACK_CREATE, Names.PROTOCOL);
112 waitGui().until().element(protocolTable.getRoot()).is().visible();
113 crud.delete(protocolAddress(STACK_CREATE, PROTOCOL_DELETE), protocolTable, PROTOCOL_DELETE);
114 }
115 }