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.testsuite.Console;
21 import org.jboss.hal.testsuite.CrudOperations;
22 import org.jboss.hal.testsuite.Random;
23 import org.jboss.hal.testsuite.command.AddKeyManager;
24 import org.jboss.hal.testsuite.container.WildFlyContainer;
25 import org.jboss.hal.testsuite.fragment.FormFragment;
26 import org.jboss.hal.testsuite.fragment.TableFragment;
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 import org.wildfly.extras.creaper.core.online.operations.Operations;
37 import org.wildfly.extras.creaper.core.online.operations.Values;
38
39 import static org.jboss.hal.dmr.ModelDescriptionConstants.KEY_MANAGER;
40 import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
41 import static org.jboss.hal.dmr.ModelDescriptionConstants.PROVIDER_NAME;
42 import static org.jboss.hal.resources.Ids.ELYTRON_SERVER_SSL_CONTEXT;
43 import static org.jboss.hal.resources.Ids.ELYTRON_SSL_ITEM;
44 import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
45 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CIPHER_SUITE_NAMES;
46 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.KEY_MANAGER_CREATE;
47 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SERVER_SSL_CREATE;
48 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SERVER_SSL_DELETE;
49 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SERVER_SSL_UPDATE;
50 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SSL_CONTEXT_CIPHER_SUITE_NAMES;
51 import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.serverSslContextAddress;
52
53 @Manatoko
54 @Testcontainers
55 class ServerSSLContextTest {
56
57 @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
58
59 @BeforeAll
60 static void setupModel() throws Exception {
61 OnlineManagementClient client = wildFly.managementClient();
62 client.apply(new AddKeyManager(KEY_MANAGER_CREATE));
63
64 Operations operations = new Operations(client);
65 operations.add(serverSslContextAddress(SERVER_SSL_UPDATE), Values.of(KEY_MANAGER, KEY_MANAGER_CREATE));
66 operations.add(serverSslContextAddress(SERVER_SSL_DELETE), Values.of(KEY_MANAGER, KEY_MANAGER_CREATE));
67 }
68
69 @Inject Console console;
70 @Inject CrudOperations crud;
71 @Page ElytronOtherSettingsPage page;
72 TableFragment table;
73 FormFragment form;
74
75 @BeforeEach
76 void prepare() {
77 page.navigate();
78 console.verticalNavigation().selectSecondary(ELYTRON_SSL_ITEM, ELYTRON_SERVER_SSL_CONTEXT + "-item");
79 table = page.getServerSslContextTable();
80 form = page.getServerSslContextForm();
81 table.bind(form);
82 }
83
84 @Test
85 void create() throws Exception {
86 crud.create(serverSslContextAddress(SERVER_SSL_CREATE), table, f -> {
87 f.text(NAME, SERVER_SSL_CREATE);
88 f.text(KEY_MANAGER, KEY_MANAGER_CREATE);
89 }, ResourceVerifier::verifyExists);
90 }
91
92 @Test
93 void update() throws Exception {
94 table.select(SERVER_SSL_UPDATE);
95 crud.update(serverSslContextAddress(SERVER_SSL_UPDATE), form, PROVIDER_NAME, Random.name());
96 }
97
98 @Test
99 void updateCipherNames() throws Exception {
100 table.select(SERVER_SSL_UPDATE);
101 crud.update(serverSslContextAddress(SERVER_SSL_UPDATE), form, CIPHER_SUITE_NAMES,
102 SSL_CONTEXT_CIPHER_SUITE_NAMES);
103 }
104
105 @Test
106 void delete() throws Exception {
107 crud.delete(serverSslContextAddress(SERVER_SSL_DELETE), table, SERVER_SSL_DELETE);
108 }
109 }