1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.remoting;
17
18 import org.jboss.arquillian.core.api.annotation.Inject;
19 import org.jboss.arquillian.graphene.page.Page;
20 import org.jboss.hal.resources.Ids;
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.RemotingPage;
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.commands.socketbindings.AddSocketBinding;
35 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
36 import org.wildfly.extras.creaper.core.online.operations.Operations;
37 import org.wildfly.extras.creaper.core.online.operations.Values;
38
39 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
40 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING;
41 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
42 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.AUTHENTICATION_PROVIDER;
43 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.CONNECTOR_CREATE;
44 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.CONNECTOR_DELETE;
45 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.CONNECTOR_READ;
46 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.CONNECTOR_UPDATE;
47 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.connectorAddress;
48 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.INBOUND_READ;
49 import static org.junit.jupiter.api.Assertions.assertEquals;
50
51 @Manatoko
52 @Testcontainers
53 class ConnectorTest {
54
55 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
56
57 @BeforeAll
58 static void setupModel() throws Exception {
59 OnlineManagementClient client = wildFly.managementClient();
60 Operations operations = new Operations(client);
61 client.apply(new AddSocketBinding.Builder(INBOUND_READ).build());
62 operations.add(connectorAddress(CONNECTOR_READ), Values.of(SOCKET_BINDING, INBOUND_READ));
63 operations.add(connectorAddress(CONNECTOR_UPDATE), Values.of(SOCKET_BINDING, INBOUND_READ));
64 operations.add(connectorAddress(CONNECTOR_DELETE), Values.of(SOCKET_BINDING, INBOUND_READ));
65 }
66
67 @Inject Console console;
68 @Inject CrudOperations crud;
69 @Page RemotingPage page;
70 TableFragment table;
71 FormFragment form;
72
73 @BeforeEach
74 void setUp() {
75 page.navigate();
76 console.verticalNavigation().selectSecondary("remoting-remote-connector-item",
77 "remoting-connector-sub-item");
78 table = page.getConnectorTable();
79 form = page.getConnectorAttributesForm();
80 table.bind(form);
81 }
82
83 @Test
84 void create() throws Exception {
85 crud.create(connectorAddress(CONNECTOR_CREATE), table, form -> {
86 form.text(NAME, CONNECTOR_CREATE);
87 form.text(SOCKET_BINDING, INBOUND_READ);
88 });
89 }
90
91 @Test
92 void read() {
93 table.select(CONNECTOR_READ);
94 page.getConnectorTabs().select(Ids.REMOTING_CONNECTOR_TAB);
95 form.showSensitive(SOCKET_BINDING);
96 assertEquals(INBOUND_READ, form.value(SOCKET_BINDING));
97 }
98
99 @Test
100 void update() throws Exception {
101 table.select(CONNECTOR_UPDATE);
102 page.getConnectorTabs().select(Ids.REMOTING_CONNECTOR_TAB);
103 crud.update(connectorAddress(CONNECTOR_UPDATE), form, AUTHENTICATION_PROVIDER, Random.name());
104 }
105
106 @Test
107 void reset() throws Exception {
108 table.select(CONNECTOR_UPDATE);
109 page.getConnectorTabs().select(Ids.REMOTING_CONNECTOR_TAB);
110 crud.reset(connectorAddress(CONNECTOR_UPDATE), form);
111 }
112 }