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.logging;
17  
18  import org.jboss.arquillian.core.api.annotation.Inject;
19  import org.jboss.hal.testsuite.CrudOperations;
20  import org.jboss.hal.testsuite.fragment.FormFragment;
21  import org.jboss.hal.testsuite.page.configuration.LoggingConfigurationPage;
22  import org.junit.jupiter.api.BeforeEach;
23  import org.junit.jupiter.api.Test;
24  import org.wildfly.extras.creaper.core.online.operations.Address;
25  
26  import static org.jboss.hal.dmr.ModelDescriptionConstants.LEVEL;
27  
28  public abstract class AbstractRootLoggerTest {
29  
30      @Inject CrudOperations crud;
31  
32      protected abstract Address rootLoggerAddress();
33  
34      protected abstract void navigateToPage();
35  
36      protected abstract LoggingConfigurationPage getPage();
37  
38      @BeforeEach
39      void prepare() {
40          navigateToPage();
41      }
42  
43      @Test
44      void updateRootLogger() throws Exception {
45          FormFragment form = getPage().getRootLoggerForm();
46          crud.update(rootLoggerAddress(), form,
47                  f -> f.select(LEVEL, "ERROR"),
48                  resourceVerifier -> resourceVerifier.verifyAttribute(LEVEL, "ERROR"));
49      }
50  
51      @Test
52      void resetRootLogger() throws Exception {
53          FormFragment form = getPage().getRootLoggerForm();
54          crud.reset(rootLoggerAddress(), form);
55      }
56  }