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_CREATE;
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 ChannelForkProtocolCreateTest {
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      }
61  
62      @Inject Console console;
63      @Inject CrudOperations crud;
64      @Page JGroupsPage page;
65      TableFragment channelTable;
66      TableFragment forkTable;
67      TableFragment forkProtocolTable;
68      FormFragment forkProtocolForm;
69  
70      @BeforeEach
71      void setUp() {
72          page.navigate();
73          console.verticalNavigation().selectPrimary("jgroups-channel-item");
74  
75          channelTable = page.getChannelTable();
76          forkTable = page.getChannelForkTable();
77          forkProtocolTable = page.getForkProtocolTable();
78          forkProtocolForm = page.getForkProtocolForm();
79      }
80  
81      @Test
82      void create() throws Exception {
83          channelTable.action(CHANNEL_CREATE, Names.FORK);
84          waitGui().until().element(forkTable.getRoot()).is().visible();
85  
86          forkTable.select(FORK_CREATE);
87          forkTable.action(FORK_CREATE, Names.PROTOCOL);
88          waitGui().until().element(forkProtocolTable.getRoot()).is().visible();
89  
90          crud.create(forkProtocolAddress(CHANNEL_CREATE, FORK_CREATE, FORK_PROTOCOL_CREATE), forkProtocolTable,
91                  FORK_PROTOCOL_CREATE);
92      }
93  }