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.profile;
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.Random;
22  import org.jboss.hal.testsuite.command.AddRemoteSocketBinding;
23  import org.jboss.hal.testsuite.container.WildFlyContainer;
24  import org.jboss.hal.testsuite.fixtures.LoggingFixtures;
25  import org.jboss.hal.testsuite.model.AvailablePortFinder;
26  import org.jboss.hal.testsuite.page.configuration.LoggingConfigurationPage;
27  import org.jboss.hal.testsuite.page.configuration.LoggingProfileConfigurationPage;
28  import org.jboss.hal.testsuite.test.Manatoko;
29  import org.jboss.hal.testsuite.test.configuration.logging.AbstractRootLoggerTest;
30  import org.junit.jupiter.api.BeforeAll;
31  import org.testcontainers.junit.jupiter.Container;
32  import org.testcontainers.junit.jupiter.Testcontainers;
33  import org.wildfly.extras.creaper.core.online.OnlineManagementClient;
34  import org.wildfly.extras.creaper.core.online.operations.Address;
35  import org.wildfly.extras.creaper.core.online.operations.Operations;
36  
37  import static org.jboss.hal.dmr.ModelDescriptionConstants.OUTBOUND_SOCKET_BINDING_REF;
38  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
39  import static org.jboss.hal.testsuite.fixtures.LoggingFixtures.NAME;
40  
41  @Manatoko
42  @Testcontainers
43  class RootLoggerTest extends AbstractRootLoggerTest {
44  
45      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
46      static final String LOGGING_PROFILE = "logger-profile-" + Random.name();
47  
48      @BeforeAll
49      static void setupModel() throws Exception {
50          OnlineManagementClient client = wildFly.managementClient();
51          Operations ops = new Operations(client);
52  
53          AddRemoteSocketBinding addRemoteSocketBinding = new AddRemoteSocketBinding(OUTBOUND_SOCKET_BINDING_REF,
54                  Random.name(), AvailablePortFinder.getNextAvailableTCPPort());
55          client.apply(addRemoteSocketBinding);
56          ops.add(LoggingFixtures.LoggingProfile.loggingProfileAddress(LOGGING_PROFILE)).assertSuccess();
57          ops.add(LoggingFixtures.LoggingProfile.rootLoggerAddress(LOGGING_PROFILE)).assertSuccess();
58      }
59  
60      @Inject Console console;
61      @Page LoggingProfileConfigurationPage page;
62  
63      @Override
64      protected Address rootLoggerAddress() {
65          return LoggingFixtures.LoggingProfile.rootLoggerAddress(LOGGING_PROFILE);
66      }
67  
68      @Override
69      protected void navigateToPage() {
70          page.navigate(NAME, LOGGING_PROFILE);
71          console.verticalNavigation().selectPrimary("logging-profile-root-logger-item");
72      }
73  
74      @Override
75      protected LoggingConfigurationPage getPage() {
76          return page;
77      }
78  }