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.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.Test;
32  import org.testcontainers.junit.jupiter.Container;
33  import org.testcontainers.junit.jupiter.Testcontainers;
34  import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
35  import org.wildfly.extras.creaper.core.online.operations.Operations;
36  import org.wildfly.extras.creaper.core.online.operations.Values;
37  
38  import static org.jboss.arquillian.graphene.Graphene.waitGui;
39  import static org.jboss.hal.dmr.ModelDescriptionConstants.PROPERTIES;
40  import static org.jboss.hal.dmr.ModelDescriptionConstants.STACK;
41  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.HA;
42  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.CHANNEL_CREATE;
43  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_CREATE;
44  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.FORK_PROTOCOL_UPDATE;
45  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.TCP;
46  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.channelAddress;
47  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkAddress;
48  import static org.jboss.hal.testsuite.fixtures.JGroupsFixtures.forkProtocolAddress;
49  
50  @Manatoko
51  @Testcontainers
52  class ChannelForkProtocolEditTest {
53  
54      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(HA);
55  
56      @BeforeAll
57      static void setupModel() throws Exception {
58          OnlineManagementClient client = wildFly.managementClient();
59          Operations operations = new Operations(client);
60          operations.add(channelAddress(CHANNEL_CREATE), Values.of(STACK, TCP));
61          operations.add(forkAddress(CHANNEL_CREATE, FORK_CREATE));
62          operations.add(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_UPDATE));
63      }
64  
65      @Inject Console console;
66      @Inject CrudOperations crud;
67      @Page JGroupsPage page;
68      TableFragment channelTable;
69      TableFragment forkTable;
70      TableFragment forkProtocolTable;
71      FormFragment forkProtocolForm;
72  
73      @BeforeEach
74      void setUp() {
75          page.navigate();
76          console.verticalNavigation().selectPrimary("jgroups-channel-item");
77  
78          channelTable = page.getChannelTable();
79          forkTable = page.getChannelForkTable();
80          forkProtocolTable = page.getForkProtocolTable();
81          forkProtocolForm = page.getForkProtocolForm();
82      }
83  
84      @Test
85      void update() throws Exception {
86          channelTable.action(CHANNEL_CREATE, Names.FORK);
87          waitGui().until().element(forkTable.getRoot()).is().visible();
88  
89          forkTable.select(FORK_CREATE);
90          forkTable.action(FORK_CREATE, Names.PROTOCOL);
91          waitGui().until().element(forkProtocolTable.getRoot()).is().visible();
92  
93          forkProtocolTable.select(FORK_PROTOCOL_UPDATE);
94          crud.update(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_UPDATE), forkProtocolForm,
95                  PROPERTIES, Random.properties());
96      }
97  }