View Javadoc
1   /*
2    *  Copyright 2022 Red Hat
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
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.container.WildFlyContainer;
24  import org.jboss.hal.testsuite.fragment.FormFragment;
25  import org.jboss.hal.testsuite.fragment.TableFragment;
26  import org.jboss.hal.testsuite.page.configuration.ElytronOtherSettingsPage;
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.operations.Operations;
34  
35  import static org.jboss.hal.dmr.ModelDescriptionConstants.PROVIDER_NAME;
36  import static org.jboss.hal.resources.Ids.ELYTRON_CLIENT_SSL_CONTEXT;
37  import static org.jboss.hal.resources.Ids.ELYTRON_SSL_ITEM;
38  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
39  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CIPHER_SUITE_NAMES;
40  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CLIENT_SSL_CREATE;
41  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CLIENT_SSL_DELETE;
42  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.CLIENT_SSL_UPDATE;
43  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.SSL_CONTEXT_CIPHER_SUITE_NAMES;
44  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.clientSslContextAddress;
45  
46  @Manatoko
47  @Testcontainers
48  class ClientSSLContextTest {
49  
50      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
51  
52      @BeforeAll
53      static void setupModel() throws Exception {
54          Operations operations = new Operations(wildFly.managementClient());
55          operations.add(clientSslContextAddress(CLIENT_SSL_UPDATE));
56          operations.add(clientSslContextAddress(CLIENT_SSL_DELETE));
57      }
58  
59      @Inject Console console;
60      @Inject CrudOperations crud;
61      @Page ElytronOtherSettingsPage page;
62      TableFragment table;
63      FormFragment form;
64  
65      @BeforeEach
66      void prepare() {
67          page.navigate();
68          console.verticalNavigation().selectSecondary(ELYTRON_SSL_ITEM, ELYTRON_CLIENT_SSL_CONTEXT + "-item");
69          table = page.getClientSslContextTable();
70          form = page.getClientSslContextForm();
71          table.bind(form);
72      }
73  
74      @Test
75      void create() throws Exception {
76          crud.create(clientSslContextAddress(CLIENT_SSL_CREATE), table, CLIENT_SSL_CREATE);
77      }
78  
79      @Test
80      void update() throws Exception {
81          table.select(CLIENT_SSL_UPDATE);
82          crud.update(clientSslContextAddress(CLIENT_SSL_UPDATE), form, PROVIDER_NAME, Random.name());
83      }
84  
85      @Test
86      void updateCipherNames() throws Exception {
87          table.select(CLIENT_SSL_UPDATE);
88          crud.update(clientSslContextAddress(CLIENT_SSL_UPDATE), form, CIPHER_SUITE_NAMES,
89                  SSL_CONTEXT_CIPHER_SUITE_NAMES);
90      }
91  
92      @Test
93      void delete() throws Exception {
94          crud.delete(clientSslContextAddress(CLIENT_SSL_DELETE), table, CLIENT_SSL_DELETE);
95      }
96  }