1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.jmx;
17
18 import org.jboss.arquillian.core.api.annotation.Inject;
19 import org.jboss.arquillian.graphene.page.Page;
20 import org.jboss.hal.resources.Ids;
21 import org.jboss.hal.testsuite.Console;
22 import org.jboss.hal.testsuite.CrudOperations;
23 import org.jboss.hal.testsuite.container.WildFlyContainer;
24 import org.jboss.hal.testsuite.fragment.FormFragment;
25 import org.jboss.hal.testsuite.page.configuration.JmxPage;
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.Disabled;
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.operations.Operations;
34
35 import static org.jboss.hal.dmr.ModelDescriptionConstants.ENABLED;
36 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
37 import static org.jboss.hal.testsuite.fixtures.JmxFixtures.AUDIT_LOG_ADDRESS;
38 import static org.jboss.hal.testsuite.fixtures.JmxFixtures.NON_CORE_MBEAN_SENSITIVITY;
39 import static org.jboss.hal.testsuite.fixtures.JmxFixtures.REMOTING_CONNECTOR_ADDRESS;
40 import static org.jboss.hal.testsuite.fixtures.JmxFixtures.SUBSYSTEM_ADDRESS;
41 import static org.jboss.hal.testsuite.fixtures.JmxFixtures.USE_MANAGEMENT_ENDPOINT;
42
43 @Manatoko
44 @Testcontainers
45 class JmxTest {
46
47 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
48 private static Operations operations;
49
50 @BeforeAll
51 static void setupModel() {
52 operations = new Operations(wildFly.managementClient());
53 }
54
55 @Inject Console console;
56 @Inject CrudOperations crud;
57 @Page JmxPage page;
58 FormFragment form;
59
60 @BeforeEach
61 void setUp() {
62 page.navigate();
63 }
64
65
66
67 @Test
68 void updateConfiguration() throws Exception {
69 console.verticalNavigation().selectPrimary(Ids.JMX_CONFIGURATION_ITEM);
70 form = page.getConfigurationForm();
71 crud.update(SUBSYSTEM_ADDRESS, form, NON_CORE_MBEAN_SENSITIVITY, true);
72 }
73
74 @Test
75 void resetConfiguration() throws Exception {
76 console.verticalNavigation().selectPrimary(Ids.JMX_CONFIGURATION_ITEM);
77 form = page.getConfigurationForm();
78 crud.reset(SUBSYSTEM_ADDRESS, form);
79 }
80
81
82
83 @Test
84 void createAuditLog() throws Exception {
85 if (operations.removeIfExists(AUDIT_LOG_ADDRESS)) {
86 console.reload();
87 }
88
89 console.verticalNavigation().selectPrimary(Ids.JMX_AUDIT_LOG_ITEM);
90 form = page.getAuditForm();
91 crud.createSingleton(AUDIT_LOG_ADDRESS, form);
92 }
93
94 @Test
95 void updateAuditLog() throws Exception {
96 if (!operations.exists(AUDIT_LOG_ADDRESS)) {
97 operations.add(AUDIT_LOG_ADDRESS);
98 console.reload();
99 }
100 console.verticalNavigation().selectPrimary(Ids.JMX_AUDIT_LOG_ITEM);
101 form = page.getAuditForm();
102 crud.update(AUDIT_LOG_ADDRESS, form, ENABLED, false);
103 }
104
105 @Test
106 void resetAuditLog() throws Exception {
107 if (!operations.exists(AUDIT_LOG_ADDRESS)) {
108 operations.add(AUDIT_LOG_ADDRESS);
109 console.reload();
110 }
111 console.verticalNavigation().selectPrimary(Ids.JMX_AUDIT_LOG_ITEM);
112 form = page.getAuditForm();
113 crud.reset(AUDIT_LOG_ADDRESS, form);
114 }
115
116 @Test
117 void deleteAuditLog() throws Exception {
118 if (!operations.exists(AUDIT_LOG_ADDRESS)) {
119 operations.add(AUDIT_LOG_ADDRESS);
120 console.reload();
121 }
122 console.verticalNavigation().selectPrimary(Ids.JMX_AUDIT_LOG_ITEM);
123 form = page.getAuditForm();
124 crud.deleteSingleton(AUDIT_LOG_ADDRESS, form);
125 }
126
127
128
129 @Test
130 @Disabled
131 void createRemotingConnector() throws Exception {
132 if (operations.removeIfExists(REMOTING_CONNECTOR_ADDRESS)) {
133 console.reload();
134 }
135
136 console.verticalNavigation().selectPrimary(Ids.JMX_REMOTING_CONNECTOR_ITEM);
137 form = page.getRemotingConnectorForm();
138 crud.createSingleton(REMOTING_CONNECTOR_ADDRESS, form);
139 }
140
141 @Test
142 void updateRemotingConnector() throws Exception {
143 if (!operations.exists(REMOTING_CONNECTOR_ADDRESS)) {
144 operations.add(REMOTING_CONNECTOR_ADDRESS);
145 console.reload();
146 }
147 console.verticalNavigation().selectPrimary(Ids.JMX_REMOTING_CONNECTOR_ITEM);
148 form = page.getRemotingConnectorForm();
149 crud.update(REMOTING_CONNECTOR_ADDRESS, form, USE_MANAGEMENT_ENDPOINT, false);
150 }
151
152 @Test
153 void resetRemotingConnector() throws Exception {
154 if (!operations.exists(REMOTING_CONNECTOR_ADDRESS)) {
155 operations.add(REMOTING_CONNECTOR_ADDRESS);
156 console.reload();
157 }
158 console.verticalNavigation().selectPrimary(Ids.JMX_REMOTING_CONNECTOR_ITEM);
159 form = page.getRemotingConnectorForm();
160 crud.reset(REMOTING_CONNECTOR_ADDRESS, form);
161 }
162
163 @Test
164 void deleteRemotingConnector() throws Exception {
165 if (!operations.exists(REMOTING_CONNECTOR_ADDRESS)) {
166 operations.add(REMOTING_CONNECTOR_ADDRESS);
167 console.reload();
168 }
169 console.verticalNavigation().selectPrimary(Ids.JMX_REMOTING_CONNECTOR_ITEM);
170 form = page.getRemotingConnectorForm();
171 crud.deleteSingleton(REMOTING_CONNECTOR_ADDRESS, form);
172 }
173 }