1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.web;
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.container.WildFlyContainer;
22 import org.jboss.hal.testsuite.fragment.FormFragment;
23 import org.jboss.hal.testsuite.fragment.TableFragment;
24 import org.jboss.hal.testsuite.page.configuration.BufferCachePage;
25 import org.jboss.hal.testsuite.test.Manatoko;
26 import org.junit.jupiter.api.BeforeAll;
27 import org.junit.jupiter.api.BeforeEach;
28 import org.junit.jupiter.api.Test;
29 import org.testcontainers.junit.jupiter.Container;
30 import org.testcontainers.junit.jupiter.Testcontainers;
31 import org.wildfly.extras.creaper.core.online.operations.Operations;
32
33 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
34 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
35 import static org.jboss.hal.testsuite.fixtures.WebFixtures.BUFFERS_PER_REGION;
36 import static org.jboss.hal.testsuite.fixtures.WebFixtures.BUFFER_CACHE_CREATE;
37 import static org.jboss.hal.testsuite.fixtures.WebFixtures.BUFFER_CACHE_DELETE;
38 import static org.jboss.hal.testsuite.fixtures.WebFixtures.BUFFER_CACHE_UPDATE;
39 import static org.jboss.hal.testsuite.fixtures.WebFixtures.BUFFER_SIZE;
40 import static org.jboss.hal.testsuite.fixtures.WebFixtures.MAX_REGIONS;
41 import static org.jboss.hal.testsuite.fixtures.WebFixtures.bufferCacheAddress;
42
43 @Manatoko
44 @Testcontainers
45 class BufferCacheTest {
46
47 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
48
49 @BeforeAll
50 static void setupModel() throws Exception {
51 Operations operations = new Operations(wildFly.managementClient());
52 operations.add(bufferCacheAddress(BUFFER_CACHE_UPDATE));
53 operations.add(bufferCacheAddress(BUFFER_CACHE_DELETE));
54 }
55
56 @Page BufferCachePage page;
57 @Inject CrudOperations crud;
58 TableFragment table;
59 FormFragment form;
60
61 @BeforeEach
62 void prepare() {
63 page.navigate();
64 table = page.getTable();
65 form = page.getForm();
66 table.bind(form);
67 }
68
69 @Test
70 void create() throws Exception {
71 crud.create(bufferCacheAddress(BUFFER_CACHE_CREATE), table, form -> form.text(NAME, BUFFER_CACHE_CREATE));
72 }
73
74 @Test
75 void update() throws Exception {
76 table.select(BUFFER_CACHE_UPDATE);
77 crud.update(bufferCacheAddress(BUFFER_CACHE_UPDATE), form, f -> {
78 f.number(BUFFER_SIZE, 10);
79 f.number(BUFFERS_PER_REGION, 11);
80 f.number(MAX_REGIONS, 12);
81 }, resourceVerifier -> {
82 resourceVerifier.verifyAttribute(BUFFER_SIZE, 10);
83 resourceVerifier.verifyAttribute(BUFFERS_PER_REGION, 11);
84 resourceVerifier.verifyAttribute(MAX_REGIONS, 12);
85 });
86 }
87
88 @Test
89 void delete() throws Exception {
90 crud.delete(bufferCacheAddress(BUFFER_CACHE_DELETE), table, BUFFER_CACHE_DELETE);
91 }
92 }