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.ee;
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.Random;
24  import org.jboss.hal.testsuite.container.WildFlyContainer;
25  import org.jboss.hal.testsuite.fragment.FormFragment;
26  import org.jboss.hal.testsuite.page.configuration.EEPage;
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.OnlineManagementClient;
34  import org.wildfly.extras.creaper.core.online.operations.Operations;
35  import org.wildfly.extras.creaper.core.online.operations.Values;
36  
37  import static org.jboss.hal.dmr.ModelDescriptionConstants.NAME;
38  import static org.jboss.hal.dmr.ModelDescriptionConstants.PATH;
39  import static org.jboss.hal.dmr.ModelDescriptionConstants.RELATIVE_TO;
40  import static org.jboss.hal.testsuite.container.WildFlyConfiguration.DEFAULT;
41  import static org.jboss.hal.testsuite.fixtures.EEFixtures.GLOBAL_DIRECTORY_UPDATE;
42  import static org.jboss.hal.testsuite.fixtures.EEFixtures.globalDirectoryAddress;
43  import static org.jboss.hal.testsuite.fixtures.PathsFixtures.JBOSS_SERVER_DATA_DIR;
44  
45  @Manatoko
46  @Testcontainers
47  class GlobalDirectoryUpdateTest {
48  
49      @Container static WildFlyContainer wildFly = WildFlyContainer.standalone(DEFAULT);
50  
51      @BeforeAll
52      static void setupModel() throws Exception {
53          OnlineManagementClient client = wildFly.managementClient();
54          Operations operations = new Operations(client);
55          operations.add(globalDirectoryAddress(GLOBAL_DIRECTORY_UPDATE), Values.of(NAME, GLOBAL_DIRECTORY_UPDATE)
56                  .and(PATH, Random.name())
57                  .and(RELATIVE_TO, JBOSS_SERVER_DATA_DIR));
58      }
59  
60      @Inject Console console;
61      @Inject CrudOperations crud;
62      @Page EEPage page;
63      FormFragment form;
64  
65      @BeforeEach
66      void prepare() {
67          page.navigate();
68          console.verticalNavigation().selectPrimary(Ids.EE_GLOBAL_MODULES_ITEM);
69          form = page.getGlobalDirectoryForm();
70      }
71  
72      @Test
73      void update() throws Exception {
74          crud.update(globalDirectoryAddress(GLOBAL_DIRECTORY_UPDATE), form, PATH, Random.name());
75      }
76  }