1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.transaction;
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.command.AddLocalSocketBinding;
24 import org.jboss.hal.testsuite.container.WildFlyContainer;
25 import org.jboss.hal.testsuite.fixtures.TransactionFixtures;
26 import org.jboss.hal.testsuite.page.configuration.TransactionPage;
27 import org.jboss.hal.testsuite.test.Manatoko;
28 import org.junit.jupiter.api.BeforeAll;
29 import org.junit.jupiter.api.BeforeEach;
30 import org.junit.jupiter.api.Test;
31 import org.testcontainers.junit.jupiter.Container;
32 import org.testcontainers.junit.jupiter.Testcontainers;
33 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
34 import org.wildfly.extras.creaper.core.online.operations.Operations;
35
36 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
37
38 @Manatoko
39 @Testcontainers
40 class RecoveryTest {
41
42 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
43 private static Operations operations;
44
45 @BeforeAll
46 static void setupModel() throws Exception {
47 OnlineManagementClient client = wildFly.managementClient();
48 operations = new Operations(client);
49 client.apply(new AddLocalSocketBinding(TransactionFixtures.RECOVERY_SOCKET_BINDING_CREATE));
50 client.apply(new AddLocalSocketBinding(TransactionFixtures.RECOVERY_STATUS_SOCKET_BINDING));
51 }
52
53 @Inject Console console;
54 @Inject CrudOperations crudOperations;
55 @Page TransactionPage page;
56
57 @BeforeEach
58 void prepare() {
59 page.navigate();
60 console.verticalNavigation()
61 .selectPrimary(Ids.build("tx", "recovery", "config", "item"));
62 }
63
64 @Test
65 void editSocketBinding() throws Exception {
66 crudOperations.update(TransactionFixtures.TRANSACTIONS_ADDRESS, page.getRecoveryForm(),
67 TransactionFixtures.SOCKET_BINDING,
68 TransactionFixtures.RECOVERY_SOCKET_BINDING_CREATE);
69 }
70
71 @Test
72 void editStatusSocketBinding() throws Exception {
73 crudOperations.update(TransactionFixtures.TRANSACTIONS_ADDRESS, page.getRecoveryForm(),
74 TransactionFixtures.STATUS_SOCKET_BINDING,
75 TransactionFixtures.RECOVERY_STATUS_SOCKET_BINDING);
76 }
77
78 @Test
79 void toggleRecoveryListener() throws Exception {
80 boolean recoveryListener = operations
81 .readAttribute(TransactionFixtures.TRANSACTIONS_ADDRESS, TransactionFixtures.RECOVERY_LISTENER)
82 .booleanValue();
83 crudOperations.update(TransactionFixtures.TRANSACTIONS_ADDRESS, page.getRecoveryForm(),
84 TransactionFixtures.RECOVERY_LISTENER,
85 !recoveryListener);
86 }
87 }