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.dmr.ModelNode;
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.model.ResourceVerifier;
28 import org.jboss.hal.testsuite.page.configuration.RemotingPage;
29 import org.jboss.hal.testsuite.test.Manatoko;
30 import org.junit.jupiter.api.BeforeAll;
31 import org.junit.jupiter.api.BeforeEach;
32 import org.junit.jupiter.api.Test;
33 import org.testcontainers.junit.jupiter.Container;
34 import org.testcontainers.junit.jupiter.Testcontainers;
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.PROPERTY;
41 import static org.jboss.hal.dmr.ModelDescriptionConstants.VALUE;
42 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
43 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.BACKLOG;
44 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.OUTBOUND_CREATE;
45 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.OUTBOUND_DELETE;
46 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.OUTBOUND_READ;
47 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.OUTBOUND_UPDATE;
48 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.URI;
49 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.outboundAddress;
50 import static org.jboss.hal.testsuite.fixtures.RemotingFixtures.uri;
51 import static org.junit.jupiter.api.Assertions.assertEquals;
52
53 @Manatoko
54 @Testcontainers
55 class OutboundTest {
56
57 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
58 private static OnlineManagementClient client;
59
60 @BeforeAll
61 static void setupModel() throws Exception {
62 client = wildFly.managementClient();
63 Operations operations = new Operations(client);
64 operations.add(outboundAddress(OUTBOUND_READ), Values.of(URI, uri(OUTBOUND_READ)));
65 operations.add(outboundAddress(OUTBOUND_UPDATE), Values.of(URI, uri(OUTBOUND_UPDATE)));
66 operations.add(outboundAddress(OUTBOUND_DELETE), Values.of(URI, uri(OUTBOUND_DELETE)));
67 }
68
69 @Inject Console console;
70 @Inject CrudOperations crud;
71 @Page RemotingPage page;
72 TableFragment table;
73 FormFragment form;
74
75 @BeforeEach
76 void setUp() {
77 page.navigate();
78 console.verticalNavigation().selectSecondary("remoting-outbound-connection-item",
79 "remoting-outbound-sub-item");
80 table = page.getOutboundTable();
81 form = page.getOutboundForm();
82 table.bind(form);
83 }
84
85 @Test
86 void create() throws Exception {
87 crud.create(outboundAddress(OUTBOUND_CREATE), table, form -> {
88 form.text(NAME, OUTBOUND_CREATE);
89 form.text(URI, uri(OUTBOUND_CREATE));
90 });
91 }
92
93 @Test
94 void read() {
95 table.select(OUTBOUND_READ);
96 assertEquals(uri(OUTBOUND_READ), form.value(URI));
97 }
98
99 @Test
100 void update() throws Exception {
101 ModelNode properties = Random.properties(BACKLOG, "15");
102
103 table.select(OUTBOUND_UPDATE);
104 crud.update(outboundAddress(OUTBOUND_UPDATE), form,
105 f -> f.properties(PROPERTY).add(properties),
106 resourceVerifier -> {
107
108 ResourceVerifier propertyVerifier = new ResourceVerifier(
109 outboundAddress(OUTBOUND_UPDATE).and(PROPERTY, BACKLOG), client);
110 propertyVerifier.verifyAttribute(VALUE, "15");
111 });
112 }
113
114 @Test
115 void delete() throws Exception {
116 crud.delete(outboundAddress(OUTBOUND_DELETE), table, OUTBOUND_DELETE);
117 }
118 }