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