1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.jca;
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.WildFlyConfiguration;
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.JcaPage;
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.DEFAULT;
39 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
40 import static org.jboss.hal.dmr.ModelDescriptionConstants.WORKMANAGER;
41 import static org.jboss.hal.testsuite.fixtures.JcaFixtures.BC_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.JcaFixtures.BC_DELETE;
43 import static org.jboss.hal.testsuite.fixtures.JcaFixtures.BC_READ;
44 import static org.jboss.hal.testsuite.fixtures.JcaFixtures.bootstrapContextAddress;
45 import static org.junit.jupiter.api.Assertions.assertEquals;
46
47 @Manatoko
48 @Testcontainers
49 class BootstrapContextTest {
50
51 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(WildFlyConfiguration.DEFAULT);
52
53 @BeforeAll
54 static void setupModel() throws Exception {
55 OnlineManagementClient client = wildFly.managementClient();
56 Operations operations = new Operations(client);
57 operations.add(bootstrapContextAddress(BC_READ), Values.of(NAME, BC_READ).and(WORKMANAGER, DEFAULT));
58 operations.add(bootstrapContextAddress(BC_DELETE), Values.of(NAME, BC_DELETE).and(WORKMANAGER, DEFAULT));
59 }
60
61 @Inject Console console;
62 @Inject CrudOperations crud;
63 @Page JcaPage page;
64 TableFragment table;
65 FormFragment form;
66
67 @BeforeEach
68 void setUp() {
69 page.navigate();
70 console.verticalNavigation().selectPrimary(Ids.JCA_BOOTSTRAP_CONTEXT_ITEM);
71
72 form = page.getBootstrapContextForm();
73 table = page.getBootstrapContextTable();
74 table.bind(form);
75 }
76
77 @Test
78 void create() throws Exception {
79 crud.create(bootstrapContextAddress(BC_CREATE), table, form -> {
80 form.text(NAME, BC_CREATE);
81 form.text(WORKMANAGER, DEFAULT);
82 });
83 }
84
85 @Test
86 void read() {
87 table.select(BC_READ);
88 assertEquals(BC_READ, form.value(NAME));
89 assertEquals(DEFAULT, form.value(WORKMANAGER));
90 }
91
92 @Test
93 void delete() throws Exception {
94 crud.delete(bootstrapContextAddress(BC_DELETE), table, BC_DELETE);
95 }
96 }