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