1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.deploymentscanner;
17
18 import org.jboss.arquillian.core.api.annotation.Inject;
19 import org.jboss.arquillian.graphene.page.Page;
20 import org.jboss.hal.testsuite.CrudOperations;
21 import org.jboss.hal.testsuite.Random;
22 import org.jboss.hal.testsuite.container.WildFlyContainer;
23 import org.jboss.hal.testsuite.fragment.FormFragment;
24 import org.jboss.hal.testsuite.fragment.TableFragment;
25 import org.jboss.hal.testsuite.page.configuration.DeploymentScannerPage;
26 import org.jboss.hal.testsuite.test.Manatoko;
27 import org.junit.jupiter.api.BeforeAll;
28 import org.junit.jupiter.api.BeforeEach;
29 import org.junit.jupiter.api.Test;
30 import org.testcontainers.junit.jupiter.Container;
31 import org.testcontainers.junit.jupiter.Testcontainers;
32 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
33 import org.wildfly.extras.creaper.core.online.operations.Operations;
34 import org.wildfly.extras.creaper.core.online.operations.Values;
35
36 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.PATH;
38 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
39 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.DS_CREATE;
40 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.DS_DELETE;
41 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.DS_READ;
42 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.DS_UPDATE;
43 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.DS_UPDATE_RESET;
44 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.deploymentScannerAddress;
45 import static org.jboss.hal.testsuite.fixtures.DeploymentScannerFixtures.path;
46 import static org.junit.jupiter.api.Assertions.assertEquals;
47
48 @Manatoko
49 @Testcontainers
50 class DeploymentScannerTest {
51
52 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
53
54 @BeforeAll
55 static void setupModel() throws Exception {
56 OnlineManagementClient client = wildFly.managementClient();
57 Operations operations = new Operations(client);
58 operations.add(deploymentScannerAddress(DS_READ), Values.of(PATH, path(DS_READ)));
59 operations.add(deploymentScannerAddress(DS_UPDATE), Values.of(PATH, path(DS_UPDATE)));
60 operations.add(deploymentScannerAddress(DS_UPDATE_RESET), Values.of(PATH, path(DS_UPDATE_RESET)));
61 operations.add(deploymentScannerAddress(DS_DELETE), Values.of(PATH, path(DS_DELETE)));
62 }
63
64 @Page DeploymentScannerPage page;
65 @Inject CrudOperations crud;
66 TableFragment table;
67 FormFragment form;
68
69 @BeforeEach
70 void prepare() {
71 page.navigate();
72 form = page.getForm();
73 table = page.getTable();
74 table.bind(form);
75 }
76
77 @Test
78 void create() throws Exception {
79 crud.create(deploymentScannerAddress(DS_CREATE), table, form -> {
80 form.text(NAME, DS_CREATE);
81 form.text(PATH, path(DS_CREATE));
82 });
83 }
84
85 @Test
86 void read() {
87 table.select(DS_READ);
88 assertEquals(path(DS_READ), form.value(PATH));
89 }
90
91 @Test
92 void update() throws Exception {
93 table.select(DS_UPDATE);
94 crud.update(deploymentScannerAddress(DS_UPDATE), form, PATH, Random.name() + "/" + Random.name());
95 }
96
97 @Test
98 void reset() throws Exception {
99 table.select(DS_UPDATE_RESET);
100 crud.reset(deploymentScannerAddress(DS_UPDATE), form);
101 }
102
103 @Test
104 void delete() throws Exception {
105 crud.delete(deploymentScannerAddress(DS_DELETE), table, DS_DELETE);
106 }
107 }