View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.fit.console;
20  
21  import static org.junit.jupiter.api.Assertions.assertNotNull;
22  
23  import org.apache.syncope.client.console.wicket.markup.html.form.IndicatingOnConfirmAjaxLink;
24  import org.apache.syncope.client.ui.commons.Constants;
25  import org.apache.wicket.Component;
26  import org.apache.wicket.markup.html.basic.Label;
27  import org.apache.wicket.markup.html.form.TextField;
28  import org.apache.wicket.util.tester.FormTester;
29  import org.junit.jupiter.api.BeforeEach;
30  import org.junit.jupiter.api.Test;
31  
32  public class AnyObjectsITCase extends AbstractConsoleITCase {
33  
34      private static final String TAB_PANEL = "body:content:body:container:content:tabbedPanel:panel:searchResult:";
35  
36      private static final String CONTAINER = TAB_PANEL + "container:content:";
37  
38      @BeforeEach
39      public void login() {
40          doLogin(ADMIN_UNAME, ADMIN_PWD);
41      }
42  
43      @Test
44      public void filteredSearch() {
45          TESTER.clickLink("body:realmsLI:realms", false);
46  
47          TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
48  
49          TESTER.clickLink(
50                  "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:title");
51  
52          TESTER.executeAjaxEvent(
53                  "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:"
54                  + "content:searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panelPlus:add",
55                  Constants.ON_CLICK);
56  
57          TESTER.assertComponent(
58                  "body:content:body:container:content:tabbedPanel:panel:accordionPanel:tabs:0:body:content:"
59                  + "searchFormContainer:search:multiValueContainer:innerForm:content:view:0:panel:container:value:"
60                  + "textField", TextField.class);
61      }
62  
63      @Test
64      public void clickToClonePrinter() {
65          TESTER.clickLink("body:realmsLI:realms", false);
66          TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
67  
68          Component component = findComponentByProp("key", CONTAINER
69                  + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
70                  "8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
71          assertNotNull(component);
72  
73          TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
74          TESTER.clickLink(TAB_PANEL
75                  + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
76                  + "actions:actions:actionRepeater:5:action:action");
77  
78          FormTester formTester = TESTER.newFormTester(TAB_PANEL
79                  + "outerObjectsRepeater:0:outer:form:content:form");
80          assertNotNull(formTester);
81  
82          formTester.submit("buttons:cancel");
83      }
84  
85      @Test
86      public void editPrinter() {
87          TESTER.clickLink("body:realmsLI:realms", false);
88          TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
89  
90          Component component = findComponentByProp("key", CONTAINER
91                  + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
92                  "8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
93          assertNotNull(component);
94  
95          TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
96          TESTER.clickLink(TAB_PANEL
97                  + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
98                  + "actions:actions:actionRepeater:0:action:action");
99  
100         FormTester formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:0:outer:form:content:form");
101         assertNotNull(formTester);
102         formTester.submit("buttons:next");
103 
104         formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:0:outer:form:content:form");
105         assertNotNull(formTester);
106         formTester.submit("buttons:next");
107 
108         formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:0:outer:form:content:form");
109         assertNotNull(formTester);
110         formTester.submit("buttons:next");
111 
112         formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:0:outer:form:content:form");
113         assertNotNull(formTester);
114         formTester.submit("buttons:next");
115 
116         TESTER.cleanupFeedbackMessages();
117 
118         formTester = TESTER.newFormTester(TAB_PANEL + "outerObjectsRepeater:0:outer:form:content:form");
119         assertNotNull(formTester);
120         formTester.submit("buttons:finish");
121 
122         assertSuccessMessage();
123 
124         TESTER.assertComponent(TAB_PANEL
125                 + "outerObjectsRepeater:0:outer:form:content:customResultBody:resources:"
126                 + "firstLevelContainer:first:container:content:group:beans:0:fields:0:field", Label.class);
127 
128         TESTER.clickLink(TAB_PANEL
129                 + "outerObjectsRepeater:0:outer:form:content:action:actionRepeater:0:action:action");
130 
131         component = findComponentByProp("key", CONTAINER
132                 + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
133                 "8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
134         assertNotNull(component);
135     }
136 
137     @Test
138     public void checkDeletePrinterLink() {
139         TESTER.clickLink("body:realmsLI:realms", false);
140         TESTER.clickLink("body:content:body:container:content:tabbedPanel:tabs-container:tabs:3:link");
141 
142         Component component = findComponentByProp("key", CONTAINER
143                 + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable",
144                 "8559d14d-58c2-46eb-a2d4-a7d35161e8f8");
145         assertNotNull(component);
146 
147         TESTER.executeAjaxEvent(component.getPageRelativePath(), Constants.ON_CLICK);
148         TESTER.assertComponent(TAB_PANEL
149                 + "outerObjectsRepeater:1:outer:container:content:togglePanelContainer:container:"
150                 + "actions:actions:actionRepeater:6:action:action",
151                 IndicatingOnConfirmAjaxLink.class);
152     }
153 }