1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.mail;
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.page.configuration.MailPage;
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 import org.wildfly.extras.creaper.core.online.operations.Values;
36
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.FROM;
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.MailFixtures.SESSION_UPDATE;
42 import static org.jboss.hal.testsuite.fixtures.MailFixtures.sessionAddress;
43
44 @Manatoko
45 @Testcontainers
46 class MailSessionTest {
47
48 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
49
50 @BeforeAll
51 static void setupModel() throws Exception {
52 OnlineManagementClient client = wildFly.managementClient();
53 Operations operations = new Operations(client);
54 operations.add(sessionAddress(SESSION_UPDATE), Values.of(JNDI_NAME, Random.jndiName(SESSION_UPDATE)));
55 }
56
57 @Inject Console console;
58 @Inject CrudOperations crud;
59 @Page MailPage page;
60 FormFragment form;
61
62 @BeforeEach
63 void setUp() {
64 page.navigate(NAME, SESSION_UPDATE);
65 console.verticalNavigation().selectPrimary(Ids.MAIL_SESSION_ITEM);
66 form = page.getMailSessionForm();
67 }
68
69 @Test
70 void edit() throws Exception {
71 crud.update(sessionAddress(SESSION_UPDATE), form, FROM, "foo@bar.com");
72 }
73
74 @Test
75 void reset() throws Exception {
76 crud.reset(sessionAddress(SESSION_UPDATE), form);
77 }
78 }