View Javadoc
1   /*
2    *  Copyright 2022 Red Hat
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package org.jboss.hal.testsuite.test.configuration.modcluster;
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.page.configuration.ModclusterPage;
25  import org.jboss.hal.testsuite.test.Manatoko;
26  import org.junit.jupiter.api.BeforeAll;
27  import org.junit.jupiter.api.BeforeEach;
28  import org.junit.jupiter.api.Test;
29  import org.testcontainers.junit.jupiter.Container;
30  import org.testcontainers.junit.jupiter.Testcontainers;
31  import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
32  import org.wildfly.extras.creaper.core.online.operations.Operations;
33  import org.wildfly.extras.creaper.core.online.operations.Values;
34  
35  import static org.jboss.hal.dmr.ModelDescriptionConstants.DEFAULT;
36  import static org.jboss.hal.dmr.ModelDescriptionConstants.HTTPS;
37  import static org.jboss.hal.dmr.ModelDescriptionConstants.LISTENER;
38  import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
39  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
40  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.EXCLUDED_CONTEXTS;
41  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.NODE_TIMEOUT;
42  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.PROXY_UPDATE;
43  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.PROXY_URL;
44  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.STICKY_SESSION;
45  import static org.jboss.hal.testsuite.fixtures.ModclusterFixtures.proxyAddress;
46  
47  @Manatoko
48  @Testcontainers
49  class ModclusterConfigurationTest {
50  
51      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);
52  
53      @BeforeAll
54      static void setupModel() throws Exception {
55          OnlineManagementClient client = wildFly.managementClient();
56          Operations operations = new Operations(client);
57          operations.add(proxyAddress(PROXY_UPDATE), Values.of(LISTENER, DEFAULT));
58      }
59  
60      @Inject Console console;
61      @Inject CrudOperations crud;
62      @Page ModclusterPage page;
63      FormFragment form;
64  
65      @BeforeEach
66      void setUp() {
67          page.navigate(NAME, PROXY_UPDATE);
68          console.verticalNavigation().selectPrimary("proxy-item");
69      }
70  
71      @Test
72      void updateAdvertising() throws Exception {
73          page.getTabs().select("advertising-tab");
74          form = page.getAdvertisingForm();
75          crud.update(proxyAddress(PROXY_UPDATE), form, LISTENER, HTTPS);
76      }
77  
78      @Test
79      void updateSessions() throws Exception {
80          page.getTabs().select("sessions-tab");
81          form = page.getSessionsForm();
82          crud.update(proxyAddress(PROXY_UPDATE), form, STICKY_SESSION, false);
83      }
84  
85      @Test
86      void updateWebContexts() throws Exception {
87          page.getTabs().select("web-contexts-tab");
88          form = page.getWebContextsForm();
89          crud.update(proxyAddress(PROXY_UPDATE), form, EXCLUDED_CONTEXTS);
90      }
91  
92      @Test
93      void updateProxies() throws Exception {
94          page.getTabs().select("proxies-tab");
95          form = page.getProxiesForm();
96          crud.update(proxyAddress(PROXY_UPDATE), form, PROXY_URL);
97      }
98  
99      @Test
100     void updateNetworking() throws Exception {
101         page.getTabs().select("networking-tab");
102         form = page.getNetworkingForm();
103         crud.update(proxyAddress(PROXY_UPDATE), form, NODE_TIMEOUT, 123);
104     }
105 }