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.jca;
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.container.WildFlyContainer;
24  import org.jboss.hal.testsuite.fragment.FormFragment;
25  import org.jboss.hal.testsuite.page.configuration.JcaPage;
26  import org.jboss.hal.testsuite.test.Manatoko;
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  
32  import static org.jboss.hal.dmr.ModelDescriptionConstants.ENABLED;
33  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
34  import static org.jboss.hal.testsuite.fixtures.JcaFixtures.ARCHIVE_VALIDATION_ADDRESS;
35  import static org.jboss.hal.testsuite.fixtures.JcaFixtures.BEAN_VALIDATION_ADDRESS;
36  import static org.jboss.hal.testsuite.fixtures.JcaFixtures.CACHED_CONNECTION_MANAGER_ADDRESS;
37  import static org.jboss.hal.testsuite.fixtures.JcaFixtures.DEBUG;
38  
39  @Manatoko
40  @Testcontainers
41  class JcaConfigurationTest {
42  
43      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
44  
45      @Inject Console console;
46      @Inject CrudOperations crud;
47      @Page JcaPage page;
48      FormFragment form;
49  
50      @BeforeEach
51      void prepare() {
52          page.navigate();
53          console.verticalNavigation().selectPrimary(Ids.JCA_CONFIGURATION_ITEM);
54      }
55  
56      @Test
57      void updateCachedConnectionManager() throws Exception {
58          page.getConfigurationTabs().select(Ids.JCA_CCM_TAB);
59          form = page.getCachedConnectionManagerForm();
60          crud.update(CACHED_CONNECTION_MANAGER_ADDRESS, form, DEBUG, true);
61      }
62  
63      @Test
64      void resetCachedConnectionManager() throws Exception {
65          page.getConfigurationTabs().select(Ids.JCA_CCM_TAB);
66          form = page.getCachedConnectionManagerForm();
67          crud.reset(CACHED_CONNECTION_MANAGER_ADDRESS, form);
68      }
69  
70      @Test
71      void updateArchiveValidation() throws Exception {
72          page.getConfigurationTabs().select(Ids.JCA_ARCHIVE_VALIDATION_TAB);
73          form = page.getArchiveValidationForm();
74          crud.update(ARCHIVE_VALIDATION_ADDRESS, form, ENABLED, false);
75      }
76  
77      @Test
78      void resetArchiveValidation() throws Exception {
79          page.getConfigurationTabs().select(Ids.JCA_ARCHIVE_VALIDATION_TAB);
80          form = page.getArchiveValidationForm();
81          crud.reset(ARCHIVE_VALIDATION_ADDRESS, form);
82      }
83  
84      @Test
85      void updateBeanValidation() throws Exception {
86          page.getConfigurationTabs().select(Ids.JCA_BEAN_VALIDATION_TAB);
87          form = page.getBeanValidationForm();
88          crud.update(BEAN_VALIDATION_ADDRESS, form, ENABLED, false);
89      }
90  
91      @Test
92      void resetBeanValidation() throws Exception {
93          page.getConfigurationTabs().select(Ids.JCA_BEAN_VALIDATION_TAB);
94          form = page.getBeanValidationForm();
95          crud.reset(BEAN_VALIDATION_ADDRESS, form);
96      }
97  }