1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.socketbinding;
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.command.AddLocalSocketBinding;
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.SocketBindingPage;
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
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
38 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING_REF;
39 import static org.jboss.hal.testsuite.command.SocketBindingCommand.refName;
40 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
41 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.OUTBOUND_LOCAL_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.OUTBOUND_LOCAL_DELETE;
43 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.OUTBOUND_LOCAL_UPDATE;
44 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.SOURCE_PORT;
45 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.STANDARD_SOCKETS;
46 import static org.jboss.hal.testsuite.fixtures.SocketBindingFixtures.outboundLocalAddress;
47
48 @Manatoko
49 @Testcontainers
50 class OutboundLocalTest {
51
52 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
53
54 @BeforeAll
55 static void setupModel() throws Exception {
56 OnlineManagementClient client = wildFly.managementClient();
57 client.apply(
58 new AddSocketBinding.Builder(refName(OUTBOUND_LOCAL_CREATE)).build(),
59 new AddLocalSocketBinding(OUTBOUND_LOCAL_UPDATE),
60 new AddLocalSocketBinding(OUTBOUND_LOCAL_DELETE));
61 }
62
63 @Inject Console console;
64 @Inject CrudOperations crud;
65 @Page SocketBindingPage page;
66 TableFragment table;
67 FormFragment form;
68
69 @BeforeEach
70 void prepare() {
71 page.navigate(NAME, STANDARD_SOCKETS);
72 console.verticalNavigation().selectPrimary(Ids.SOCKET_BINDING_GROUP_OUTBOUND_LOCAL + "-" + Ids.ITEM);
73
74 table = page.getOutboundLocalTable();
75 form = page.getOutboundLocalForm();
76 table.bind(form);
77 }
78
79 @Test
80 void create() throws Exception {
81 crud.create(outboundLocalAddress(STANDARD_SOCKETS, OUTBOUND_LOCAL_CREATE), table, form -> {
82 form.text(NAME, OUTBOUND_LOCAL_CREATE);
83 form.text(SOCKET_BINDING_REF, refName(OUTBOUND_LOCAL_CREATE));
84 });
85 }
86
87 @Test
88 void update() throws Exception {
89 table.select(OUTBOUND_LOCAL_UPDATE);
90 crud.update(outboundLocalAddress(STANDARD_SOCKETS, OUTBOUND_LOCAL_UPDATE), form, SOURCE_PORT, 1234);
91 }
92
93 @Test
94 void updateInvalidPort() {
95 table.select(OUTBOUND_LOCAL_UPDATE);
96 crud.updateWithError(form, SOURCE_PORT, -1);
97 }
98
99 @Test
100 void reset() throws Exception {
101 table.select(OUTBOUND_LOCAL_UPDATE);
102 crud.reset(outboundLocalAddress(STANDARD_SOCKETS, OUTBOUND_LOCAL_UPDATE), form);
103 }
104
105 @Test
106 void delete() throws Exception {
107 crud.delete(outboundLocalAddress(STANDARD_SOCKETS, OUTBOUND_LOCAL_DELETE), table, OUTBOUND_LOCAL_DELETE);
108 }
109 }