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.container.WildFlyContainer;
23  import org.jboss.hal.testsuite.fragment.TableFragment;
24  import org.jboss.hal.testsuite.page.configuration.ElytronMappersDecodersPage;
25  import org.jboss.hal.testsuite.test.Manatoko;
26  import org.junit.jupiter.api.BeforeAll;
27  import org.junit.jupiter.api.BeforeEach;
28  import org.junit.jupiter.api.Test;
29  import org.testcontainers.junit.jupiter.Container;
30  import org.testcontainers.junit.jupiter.Testcontainers;
31  import org.wildfly.extras.creaper.core.online.operations.Operations;
32  import org.wildfly.extras.creaper.core.online.operations.Values;
33  
34  import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
35  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
36  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.EVIDENCE_DECODER_ITEM;
37  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.X500_EVIDENCE_DECODER_CREATE;
38  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.X500_EVIDENCE_DECODER_DELETE;
39  import static org.jboss.hal.testsuite.fixtures.SecurityFixtures.x500EvidenceDecoderAddress;
40  
41  @Manatoko
42  @Testcontainers
43  class X500EvidenceDecoderTest {
44  
45      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
46  
47      @BeforeAll
48      static void setupModel() throws Exception {
49          Operations operations = new Operations(wildFly.managementClient());
50          operations.add(x500EvidenceDecoderAddress(X500_EVIDENCE_DECODER_DELETE), Values.of(NAME, X500_EVIDENCE_DECODER_DELETE));
51      }
52  
53      @Inject Console console;
54      @Inject CrudOperations crud;
55      @Page ElytronMappersDecodersPage page;
56      TableFragment table;
57  
58      @BeforeEach
59      void prepare() {
60          page.navigate();
61          console.verticalNavigation().selectSecondary(EVIDENCE_DECODER_ITEM,
62                  "mappers-decoders-x500-subject-evidence-decoder-item");
63          table = page.getX500EvidenceDecoderTable();
64      }
65  
66      @Test
67      void create() throws Exception {
68          crud.create(x500EvidenceDecoderAddress(X500_EVIDENCE_DECODER_CREATE), table,
69                  form -> form.text(NAME, X500_EVIDENCE_DECODER_CREATE));
70      }
71  
72      @Test
73      void delete() throws Exception {
74          crud.delete(x500EvidenceDecoderAddress(X500_EVIDENCE_DECODER_DELETE), table, X500_EVIDENCE_DECODER_DELETE);
75      }
76  }