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.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.RemotingPage;
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.MethodOrderer;
31 import org.junit.jupiter.api.Test;
32 import org.junit.jupiter.api.TestMethodOrder;
33 import org.testcontainers.junit.jupiter.Container;
34 import org.testcontainers.junit.jupiter.Testcontainers;
35 import org.wildfly.extras.creaper.commands.socketbindings.AddSocketBinding;
36 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
37 import org.wildfly.extras.creaper.core.online.operations.Operations;
38 import org.wildfly.extras.creaper.core.online.operations.Values;
39
40 import static java.util.Arrays.asList;
41 import static org.jboss.hal.dmr.ModelDescriptionConstants.SOCKET_BINDING;
42 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
43 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.CONNECTOR_REF;
44 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.HTTP_CONNECTOR_SECURITY;
45 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.HTTP_CONNECTOR_SECURITY_LISTENER;
46 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.HTTP_CONNECTOR_SECURITY_SOCKET;
47 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.INCLUDE_MECHANISMS;
48 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.httpConnectorAddress;
49 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.httpConnectorSecurityAddress;
50 import static org.jboss.hal.testsuite.fixtures.WebFixtures.DEFAULT_SERVER;
51 import static org.jboss.hal.testsuite.fixtures.WebFixtures.httpListenerAddress;
52
53 @Manatoko
54 @Testcontainers
55 @TestMethodOrder(MethodOrderer.MethodName.class)
56 class HttpConnectorSecurityTest {
57
58 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
59
60 @BeforeAll
61 static void setupModel() throws Exception {
62 OnlineManagementClient client = wildFly.managementClient();
63 Operations operations = new Operations(client);
64 client.apply(new AddSocketBinding.Builder(HTTP_CONNECTOR_SECURITY_SOCKET).build());
65 operations.add(httpListenerAddress(DEFAULT_SERVER, HTTP_CONNECTOR_SECURITY_LISTENER),
66 Values.of(SOCKET_BINDING, HTTP_CONNECTOR_SECURITY_SOCKET)).assertSuccess();
67 operations.add(httpConnectorAddress(HTTP_CONNECTOR_SECURITY),
68 Values.of(CONNECTOR_REF, HTTP_CONNECTOR_SECURITY_LISTENER)).assertSuccess();
69 }
70
71 @Inject Console console;
72 @Inject CrudOperations crud;
73 @Page RemotingPage page;
74 TableFragment table;
75 FormFragment form;
76
77 @BeforeEach
78 void prepare() {
79 page.navigate();
80 console.verticalNavigation().selectSecondary("remoting-remote-connector-item",
81 "remoting-http-connector-sub-item");
82 table = page.getHttpConnectorTable();
83 form = page.getHttpConnectorSecurityForm();
84 table.bind(form);
85 }
86
87 @Test
88 void _0create() throws Exception {
89 table.select(HTTP_CONNECTOR_SECURITY);
90 page.getHttpConnectorTabs().select(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_TAB);
91 crud.createSingleton(httpConnectorSecurityAddress(HTTP_CONNECTOR_SECURITY), form);
92 }
93
94 @Test
95 void _1update() throws Exception {
96 table.select(HTTP_CONNECTOR_SECURITY);
97 page.getHttpConnectorTabs().select(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_TAB);
98 crud.update(httpConnectorSecurityAddress(HTTP_CONNECTOR_SECURITY), form, INCLUDE_MECHANISMS,
99 asList("foo", "bar"));
100 }
101
102 @Test
103 void _2reset() throws Exception {
104 table.select(HTTP_CONNECTOR_SECURITY);
105 page.getHttpConnectorTabs().select(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_TAB);
106 crud.reset(httpConnectorSecurityAddress(HTTP_CONNECTOR_SECURITY), form);
107 }
108
109 @Test
110 void _3delete() throws Exception {
111 table.select(HTTP_CONNECTOR_SECURITY);
112 page.getHttpConnectorTabs().select(Ids.REMOTING_HTTP_CONNECTOR_SECURITY_TAB);
113 crud.deleteSingleton(httpConnectorSecurityAddress(HTTP_CONNECTOR_SECURITY), form);
114 }
115 }