1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.hal.testsuite.test.configuration.security;
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.Random;
23 import org.jboss.hal.testsuite.command.AddCredentialStore;
24 import org.jboss.hal.testsuite.container.WildFlyContainer;
25 import org.jboss.hal.testsuite.fragment.FormFragment;
26 import org.jboss.hal.testsuite.fragment.WizardFragment;
27 import org.jboss.hal.testsuite.model.ResourceVerifier;
28 import org.jboss.hal.testsuite.page.configuration.ElytronOtherSettingsPage;
29 import org.jboss.hal.testsuite.test.Manatoko;
30 import org.junit.jupiter.api.BeforeAll;
31 import org.junit.jupiter.api.BeforeEach;
32 import org.junit.jupiter.api.Test;
33 import org.testcontainers.junit.jupiter.Container;
34 import org.testcontainers.junit.jupiter.Testcontainers;
35 import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
36
37 import static org.jboss.hal.dmr.ModelDescriptionConstants.CREDENTIAL_STORE;
38 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
39 import static org.jboss.hal.resources.Ids.ELYTRON_OTHER_ITEM;
40 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
41 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CREDENTIAL_STORE_CREATE;
42 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.DEFAULT_RESOLVER;
43 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SECRET_KEY;
44 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.expressionEncryptionAddress;
45
46 @Manatoko
47 @Testcontainers
48 class ExpressionEncryptionAddTest {
49
50 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
51 static OnlineManagementClient client;
52
53 @BeforeAll
54 static void setupModel() throws Exception {
55 client = wildFly.managementClient();
56 client.apply(new AddCredentialStore(CREDENTIAL_STORE_CREATE));
57 }
58
59 @Inject Console console;
60 @Page ElytronOtherSettingsPage page;
61
62 @BeforeEach
63 void prepare() {
64 page.navigate();
65 console.verticalNavigation().selectSecondary(ELYTRON_OTHER_ITEM, Ids.ELYTRON_EXPRESSION);
66 }
67
68 @Test
69 void add() throws Exception {
70 page.getExpressionEmptyState().mainAction();
71 WizardFragment wizard = console.wizard();
72 FormFragment form = wizard.getForm(Ids.ELYTRON_EXPRESSION + "-add-form");
73 form.text(DEFAULT_RESOLVER, Random.name());
74 wizard.next();
75 form = wizard.getForm(Ids.ELYTRON_EXPRESSION + "-resolvers-add-form");
76 form.text(CREDENTIAL_STORE, CREDENTIAL_STORE_CREATE);
77 form.text(NAME, Random.name());
78 form.text(SECRET_KEY, Random.name());
79 wizard.finish();
80 new ResourceVerifier(expressionEncryptionAddress(), client).verifyExists();
81 }
82 }