1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.distributableweb;
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.container.WildFlyContainer;
23 import org.jboss.hal.testsuite.fragment.FormFragment;
24 import org.jboss.hal.testsuite.fragment.TableFragment;
25 import org.jboss.hal.testsuite.page.configuration.DistributableWebPage;
26 import org.jboss.hal.testsuite.test.Manatoko;
27 import org.junit.jupiter.api.BeforeAll;
28 import org.junit.jupiter.api.BeforeEach;
29 import org.junit.jupiter.api.Test;
30 import org.testcontainers.junit.jupiter.Container;
31 import org.testcontainers.junit.jupiter.Testcontainers;
32 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
33 import org.wildfly.extras.creaper.core.online.operations.Operations;
34 import org.wildfly.extras.creaper.core.online.operations.Values;
35
36 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.REMOTE_CACHE_CONTAINER;
38 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.FULL;
39 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.ATTRIBUTE;
40 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.GRANULARITY;
41 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.HOTROD_SESSION_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.HOTROD_SESSION_DELETE;
43 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.HOTROD_SESSION_UPDATE;
44 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.REMOTE_SOCKET_BINDING;
45 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.SESSION;
46 import static org.jboss.hal.testsuite.fixtures.DistributableWebFixtures.hotrodSessionAddress;
47 import static org.jboss.hal.testsuite.fixtures.InfinispanFixtures.REMOTE_CC_CREATE;
48 import static org.jboss.hal.testsuite.test.configuration.distributableweb.DistributableWebOperations.addRemoteCacheContainer;
49 import static org.jboss.hal.testsuite.test.configuration.distributableweb.DistributableWebOperations.addRemoteSocketBinding;
50
51 @Manatoko
52 @Testcontainers
53 class HotrodSessionTest {
54
55 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(FULL);
56
57 @BeforeAll
58 static void setupModel() throws Exception {
59 OnlineManagementClient client = wildFly.managementClient();
60 Operations operations = new Operations(client);
61 addRemoteSocketBinding(client, operations, REMOTE_SOCKET_BINDING);
62 addRemoteCacheContainer(client, operations, REMOTE_CC_CREATE, REMOTE_SOCKET_BINDING);
63 Values values = Values.of(REMOTE_CACHE_CONTAINER, REMOTE_CC_CREATE).and(GRANULARITY, SESSION);
64 operations.add(hotrodSessionAddress(HOTROD_SESSION_UPDATE), values);
65 operations.add(hotrodSessionAddress(HOTROD_SESSION_DELETE), values);
66 }
67
68 @Page DistributableWebPage page;
69 @Inject CrudOperations crud;
70 @Inject Console console;
71 TableFragment table;
72 FormFragment form;
73
74 @BeforeEach
75 void setUp() {
76 page.navigate();
77 console.verticalNavigation().selectPrimary("dw-hotrod-session-management-item");
78 table = page.getHotrodSessionManagementTable();
79 form = page.getHotrodSessionManagementForm();
80 table.bind(form);
81 }
82
83 @Test
84 void create() throws Exception {
85 crud.create(hotrodSessionAddress(HOTROD_SESSION_CREATE), table, f -> {
86 f.text(NAME, HOTROD_SESSION_CREATE);
87 f.text(REMOTE_CACHE_CONTAINER, REMOTE_CC_CREATE);
88 });
89 }
90
91 @Test
92 void update() throws Exception {
93 table.select(HOTROD_SESSION_UPDATE);
94 crud.update(hotrodSessionAddress(HOTROD_SESSION_UPDATE), form,
95 f -> f.select(GRANULARITY, ATTRIBUTE),
96 verifier -> verifier.verifyAttribute(GRANULARITY, ATTRIBUTE));
97 }
98
99 @Test
100 void reset() throws Exception {
101 table.select(HOTROD_SESSION_UPDATE);
102 crud.reset(hotrodSessionAddress(HOTROD_SESSION_UPDATE), form);
103 }
104
105 @Test
106 void delete() throws Exception {
107 table.select(HOTROD_SESSION_DELETE);
108 crud.delete(hotrodSessionAddress(HOTROD_SESSION_DELETE), table, HOTROD_SESSION_DELETE);
109 }
110 }