1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.ee;
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.EEPage;
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.core.online.OnlineManagementClient;
35 import org.wildfly.extras.creaper.core.online.operations.Operations;
36 import org.wildfly.extras.creaper.core.online.operations.Values;
37
38 import static org.jboss.hal.dmr.ModelDescriptionConstants.JNDI_NAME;
39 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
40 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
41 import static org.jboss.hal.testsuite.fixtures.EEFixtures.CONTEXT_SERVICE_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.EEFixtures.CONTEXT_SERVICE_DELETE;
43 import static org.jboss.hal.testsuite.fixtures.EEFixtures.CONTEXT_SERVICE_READ;
44 import static org.jboss.hal.testsuite.fixtures.EEFixtures.CONTEXT_SERVICE_UPDATE;
45 import static org.jboss.hal.testsuite.fixtures.EEFixtures.contextServiceAddress;
46
47 @Manatoko
48 @Testcontainers
49 class ContextServiceTest {
50
51 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
52
53 @BeforeAll
54 static void setupModel() throws Exception {
55 OnlineManagementClient client = wildFly.managementClient();
56 Operations operations = new Operations(client);
57 operations.add(contextServiceAddress(CONTEXT_SERVICE_READ), Values.of(JNDI_NAME, Random.jndiName()));
58 operations.add(contextServiceAddress(CONTEXT_SERVICE_UPDATE), Values.of(JNDI_NAME, Random.jndiName()));
59 operations.add(contextServiceAddress(CONTEXT_SERVICE_DELETE), Values.of(JNDI_NAME, Random.jndiName()));
60 }
61
62 @Inject Console console;
63 @Inject CrudOperations crud;
64 @Page EEPage page;
65 TableFragment table;
66 FormFragment form;
67
68 @BeforeEach
69 void prepare() {
70 page.navigate();
71 console.verticalNavigation().selectSecondary(Ids.EE_SERVICES_ITEM, Ids.EE_CONTEXT_SERVICE);
72
73 table = page.getContextServiceTable();
74 form = page.getContextServiceForm();
75 table.bind(form);
76 }
77
78 @Test
79 void create() throws Exception {
80 crud.create(contextServiceAddress(CONTEXT_SERVICE_CREATE), table, form -> {
81 form.text(NAME, CONTEXT_SERVICE_CREATE);
82 form.text(JNDI_NAME, Random.jndiName());
83 });
84 }
85
86 @Test
87 void update() throws Exception {
88 table.select(CONTEXT_SERVICE_UPDATE);
89 crud.update(contextServiceAddress(CONTEXT_SERVICE_UPDATE), form, JNDI_NAME, Random.jndiName());
90 }
91
92 @Test
93 void delete() throws Exception {
94 crud.delete(contextServiceAddress(CONTEXT_SERVICE_DELETE), table, CONTEXT_SERVICE_DELETE);
95 }
96 }