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.SCHEDULED_EXECUTOR_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.EEFixtures.SCHEDULED_EXECUTOR_DELETE;
43 import static org.jboss.hal.testsuite.fixtures.EEFixtures.SCHEDULED_EXECUTOR_READ;
44 import static org.jboss.hal.testsuite.fixtures.EEFixtures.SCHEDULED_EXECUTOR_UPDATE;
45 import static org.jboss.hal.testsuite.fixtures.EEFixtures.scheduledExecutorAddress;
46
47 @Manatoko
48 @Testcontainers
49 class ScheduledExecutorTest {
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(scheduledExecutorAddress(SCHEDULED_EXECUTOR_READ), Values.of(JNDI_NAME, Random.jndiName()));
58 operations.add(scheduledExecutorAddress(SCHEDULED_EXECUTOR_UPDATE), Values.of(JNDI_NAME, Random.jndiName()));
59 operations.add(scheduledExecutorAddress(SCHEDULED_EXECUTOR_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_MANAGED_EXECUTOR_SCHEDULED);
72
73 table = page.getExecutorScheduledTable();
74 form = page.getExecutorScheduledForm();
75 table.bind(form);
76 }
77
78 @Test
79 void create() throws Exception {
80 String jndiName = Random.jndiName();
81 crud.create(scheduledExecutorAddress(SCHEDULED_EXECUTOR_CREATE), table, form -> {
82 form.text(NAME, SCHEDULED_EXECUTOR_CREATE);
83 form.text(JNDI_NAME, jndiName);
84 });
85 }
86
87 @Test
88 void update() throws Exception {
89 table.select(SCHEDULED_EXECUTOR_UPDATE);
90 crud.update(scheduledExecutorAddress(SCHEDULED_EXECUTOR_UPDATE), form, JNDI_NAME, Random.jndiName());
91 }
92
93 @Test
94 void reset() throws Exception {
95 table.select(SCHEDULED_EXECUTOR_UPDATE);
96 crud.reset(scheduledExecutorAddress(SCHEDULED_EXECUTOR_UPDATE), form);
97 }
98
99 @Test
100 void delete() throws Exception {
101 crud.delete(scheduledExecutorAddress(SCHEDULED_EXECUTOR_DELETE), table, SCHEDULED_EXECUTOR_DELETE);
102 }
103 }