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