Repository: syncope Updated Branches: refs/heads/master 8cee98bc2 -> 857d5e62a
[SYNCOPE-156] providing user, group and any object search panel Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/857d5e62 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/857d5e62 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/857d5e62 Branch: refs/heads/master Commit: 857d5e62a9b7113fc3082945cb54bfb51f6e7d9f Parents: 8cee98b Author: fmartelli <[email protected]> Authored: Tue Mar 15 17:38:51 2016 +0100 Committer: fmartelli <[email protected]> Committed: Tue Mar 15 17:38:51 2016 +0100 ---------------------------------------------------------------------- .../syncope/client/console/panels/AnyPanel.java | 239 +++++++++++++++++++ .../syncope/client/console/panels/Realm.java | 63 +---- .../console/rest/AnyObjectRestClient.java | 4 +- .../syncope/client/console/panels/AnyPanel.html | 27 +++ .../client/console/panels/AnyPanel.properties | 17 ++ .../console/panels/AnyPanel_it.properties | 17 ++ .../console/panels/AnyPanel_pt_BR.properties | 17 ++ .../syncope/fit/console/BulkActionITCase.java | 92 +++---- .../fit/console/DisplayAttributesITCase.java | 36 +-- 9 files changed, 387 insertions(+), 125 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java new file mode 100644 index 0000000..3946357 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/AnyPanel.java @@ -0,0 +1,239 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.console.panels; + +import org.apache.syncope.client.console.panels.search.AbstractSearchPanel; +import org.apache.syncope.client.console.panels.search.GroupSearchPanel; +import org.apache.syncope.client.console.panels.search.SearchClause; +import org.apache.syncope.client.console.panels.search.SearchClausePanel; +import org.apache.syncope.client.console.panels.search.SearchUtils; +import org.apache.syncope.client.console.panels.search.UserSearchPanel; +import org.apache.syncope.client.console.rest.AnyTypeClassRestClient; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; +import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion; +import org.apache.syncope.client.console.wizards.any.AnyObjectWizardBuilder; +import org.apache.syncope.client.console.wizards.any.GroupWizardBuilder; +import org.apache.syncope.client.console.wizards.any.UserWizardBuilder; +import org.apache.syncope.client.lib.SyncopeClient; +import org.apache.syncope.common.lib.to.AnyObjectTO; +import org.apache.syncope.common.lib.to.AnyTypeTO; +import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.RealmTO; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.types.AnyEntitlement; +import org.apache.syncope.common.lib.types.StandardEntitlement; +import org.apache.wicket.Component; +import org.apache.wicket.PageReference; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; +import org.apache.wicket.event.IEvent; +import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; +import org.apache.wicket.extensions.markup.html.tabs.ITab; +import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.panel.Panel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.model.util.ListModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.Collections; +import org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel; + +public class AnyPanel extends Panel { + + private static final long serialVersionUID = -1100228004207271270L; + + protected static final Logger LOG = LoggerFactory.getLogger(AnyPanel.class); + + private final AnyTypeTO anyTypeTO; + + private final RealmTO realmTO; + + private final AnyTypeClassRestClient anyTypeClassRestClient = new AnyTypeClassRestClient(); + + private final PageReference pageRef; + + private AbstractSearchPanel searchPanel; + + private final Panel searchResultPanel; + + @SuppressWarnings({ "unchecked", "unchecked" }) + public AnyPanel( + final String id, final AnyTypeTO anyTypeTO, final RealmTO realmTO, final PageReference pageRef) { + super(id); + this.anyTypeTO = anyTypeTO; + this.realmTO = realmTO; + this.pageRef = pageRef; + + // ------------------------ + // Accordion + // ------------------------ + final Model<Integer> model = Model.of(-1); + final StringResourceModel res = new StringResourceModel("search.result", this, new Model<>(anyTypeTO)); + + final Accordion accordion = new Accordion("accordionPanel", + Collections.<ITab>singletonList(new AbstractTab(res) { + + private static final long serialVersionUID = 1037272333056449377L; + + @Override + public WebMarkupContainer getPanel(final String panelId) { + searchPanel = getSearchPanel(panelId); + return searchPanel; + } + + }), model) { + + private static final long serialVersionUID = 1L; + + @Override + protected Component newTitle(final String markupId, final ITab tab, final Accordion.State state) { + return new AjaxLink<Integer>(markupId) { + + private static final long serialVersionUID = 1L; + + @Override + protected void onComponentTag(final ComponentTag tag) { + super.onComponentTag(tag); + tag.put("style", "color: #337ab7 !important"); + } + + @Override + public void onClick(final AjaxRequestTarget target) { + model.setObject(model.getObject() == 0 ? -1 : 0); + } + }.setBody(res); + } + }; + accordion.setOutputMarkupId(true); + add(accordion); + + searchResultPanel = getSearchResultPanel("searchResult"); + add(searchResultPanel); + // ------------------------ + } + + @Override + public void onEvent(final IEvent<?> event) { + if (event.getPayload() instanceof SearchClausePanel.SearchEvent) { + final AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget(); + + switch (anyTypeTO.getKind()) { + case USER: + UserSearchResultPanel.class.cast(AnyPanel.this.searchResultPanel).search(SearchUtils.buildFIQL( + AnyPanel.this.searchPanel.getModel().getObject(), + SyncopeClient.getUserSearchConditionBuilder()), target); + break; + case GROUP: + GroupSearchResultPanel.class.cast(AnyPanel.this.searchResultPanel).search(SearchUtils.buildFIQL( + AnyPanel.this.searchPanel.getModel().getObject(), + SyncopeClient.getGroupSearchConditionBuilder()), target); + break; + case ANY_OBJECT: + AnyObjectSearchResultPanel.class.cast(AnyPanel.this.searchResultPanel).search(SearchUtils.buildFIQL( + AnyPanel.this.searchPanel.getModel().getObject(), + SyncopeClient.getAnyObjectSearchConditionBuilder(anyTypeTO.getKey())), target); + break; + default: + } + target.add(searchResultPanel); + } else { + super.onEvent(event); + } + } + + private AbstractSearchPanel getSearchPanel(final String id) { + final AbstractSearchPanel panel; + switch (anyTypeTO.getKind()) { + case USER: + panel = UserSearchPanel.class.cast(new UserSearchPanel.Builder( + new ListModel<>(new ArrayList<SearchClause>())).required(false).enableSearch().build(id)); + MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, StandardEntitlement.USER_LIST); + break; + case GROUP: + panel = new GroupSearchPanel.Builder( + new ListModel<>(new ArrayList<SearchClause>())).required(false).enableSearch().build(id); + // list of group is available to all authenticated users + break; + case ANY_OBJECT: + panel = new AnyObjectSearchPanel.Builder(anyTypeTO.getKey(), + new ListModel<>(new ArrayList<SearchClause>())).required(false).enableSearch().build(id); + MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, + String.format("%s_%s", anyTypeTO.getKey(), AnyEntitlement.LIST)); + break; + default: + panel = null; + } + return panel; + } + + private Panel getSearchResultPanel(final String id) { + final Panel panel; + final String fiql; + switch (anyTypeTO.getKind()) { + case USER: + fiql = SyncopeClient.getUserSearchConditionBuilder().is("key").greaterThan(0).query(); + final UserTO userTO = new UserTO(); + userTO.setRealm(realmTO.getFullPath()); + panel = new UserSearchResultPanel.Builder( + anyTypeClassRestClient.list(anyTypeTO.getClasses()), + anyTypeTO.getKey(), + pageRef).setRealm(realmTO.getFullPath()).setFiltered(true). + setFiql(fiql).addNewItemPanelBuilder(new UserWizardBuilder( + BaseModal.CONTENT_ID, userTO, anyTypeTO.getClasses(), pageRef)).build(id); + MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, StandardEntitlement.USER_LIST); + break; + case GROUP: + fiql = SyncopeClient.getGroupSearchConditionBuilder().is("key").greaterThan(0).query(); + final GroupTO groupTO = new GroupTO(); + groupTO.setRealm(realmTO.getFullPath()); + panel = new GroupSearchResultPanel.Builder( + anyTypeClassRestClient.list(anyTypeTO.getClasses()), + anyTypeTO.getKey(), + pageRef).setRealm(realmTO.getFullPath()).setFiltered(true). + setFiql(fiql).addNewItemPanelBuilder(new GroupWizardBuilder( + BaseModal.CONTENT_ID, groupTO, anyTypeTO.getClasses(), pageRef)).build(id); + // list of group is available to all authenticated users + break; + case ANY_OBJECT: + fiql = SyncopeClient.getAnyObjectSearchConditionBuilder(anyTypeTO.getKey()).is("key").greaterThan(0). + query(); + final AnyObjectTO anyObjectTO = new AnyObjectTO(); + anyObjectTO.setRealm(realmTO.getFullPath()); + anyObjectTO.setType(anyTypeTO.getKey()); + panel = new AnyObjectSearchResultPanel.Builder( + anyTypeClassRestClient.list(anyTypeTO.getClasses()), + anyTypeTO.getKey(), + pageRef).setRealm(realmTO.getFullPath()).setFiltered(true). + setFiql(fiql).addNewItemPanelBuilder(new AnyObjectWizardBuilder( + BaseModal.CONTENT_ID, anyObjectTO, anyTypeTO.getClasses(), pageRef)).build(id); + MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, + String.format("%s_%s", anyObjectTO.getType(), AnyEntitlement.LIST)); + break; + default: + panel = new LabelPanel(id, null); + } + return panel; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java index 73118b4..201e15b 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/Realm.java @@ -18,31 +18,19 @@ */ package org.apache.syncope.client.console.panels; -import com.googlecode.wicket.jquery.core.panel.LabelPanel; import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel; import java.util.ArrayList; import java.util.List; -import org.apache.syncope.client.console.rest.AnyTypeClassRestClient; import org.apache.syncope.client.console.rest.AnyTypeRestClient; -import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.syncope.client.console.wizards.any.AnyObjectWizardBuilder; -import org.apache.syncope.client.console.wizards.any.GroupWizardBuilder; -import org.apache.syncope.client.console.wizards.any.UserWizardBuilder; -import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTypeTO; -import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.RealmTO; -import org.apache.syncope.common.lib.to.UserTO; -import org.apache.syncope.common.lib.types.AnyEntitlement; import org.apache.syncope.common.lib.types.StandardEntitlement; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.extensions.markup.html.tabs.ITab; -import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.panel.Panel; import org.apache.wicket.model.Model; import org.slf4j.Logger; @@ -60,16 +48,11 @@ public abstract class Realm extends Panel { private final AnyTypeRestClient anyTypeRestClient = new AnyTypeRestClient(); - private final AnyTypeClassRestClient anyTypeClassRestClient = new AnyTypeClassRestClient(); - - private final PageReference pageRef; - @SuppressWarnings({ "unchecked", "unchecked" }) public Realm(final String id, final RealmTO realmTO, final PageReference pageRef) { super(id); this.realmTO = realmTO; this.anyTypeTOs = anyTypeRestClient.list(); - this.pageRef = pageRef; add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList(pageRef))); } @@ -133,57 +116,13 @@ public abstract class Realm extends Panel { @Override public Panel getPanel(final String panelId) { - return getAnyPanel(panelId, pageRef, anyTypeTO); + return new AnyPanel(panelId, anyTypeTO, realmTO, pageRef); } }); } return tabs; } - private Panel getAnyPanel(final String id, final PageReference pageRef, final AnyTypeTO anyTypeTO) { - final Panel panel; - switch (anyTypeTO.getKind()) { - case USER: - final UserTO userTO = new UserTO(); - userTO.setRealm(realmTO.getFullPath()); - panel = new UserSearchResultPanel.Builder( - anyTypeClassRestClient.list(anyTypeTO.getClasses()), - anyTypeTO.getKey(), - pageRef).setRealm(realmTO.getFullPath()). - addNewItemPanelBuilder(new UserWizardBuilder( - BaseModal.CONTENT_ID, userTO, anyTypeTO.getClasses(), pageRef)).build(id); - MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, StandardEntitlement.USER_LIST); - break; - case GROUP: - final GroupTO groupTO = new GroupTO(); - groupTO.setRealm(realmTO.getFullPath()); - panel = new GroupSearchResultPanel.Builder( - anyTypeClassRestClient.list(anyTypeTO.getClasses()), - anyTypeTO.getKey(), - pageRef).setRealm(realmTO.getFullPath()). - addNewItemPanelBuilder(new GroupWizardBuilder( - BaseModal.CONTENT_ID, groupTO, anyTypeTO.getClasses(), pageRef)).build(id); - // list of group is available to all authenticated users - break; - case ANY_OBJECT: - final AnyObjectTO anyObjectTO = new AnyObjectTO(); - anyObjectTO.setRealm(realmTO.getFullPath()); - anyObjectTO.setType(anyTypeTO.getKey()); - panel = new AnyObjectSearchResultPanel.Builder( - anyTypeClassRestClient.list(anyTypeTO.getClasses()), - anyTypeTO.getKey(), - pageRef).setRealm(realmTO.getFullPath()). - addNewItemPanelBuilder(new AnyObjectWizardBuilder( - BaseModal.CONTENT_ID, anyObjectTO, anyTypeTO.getClasses(), pageRef)).build(id); - MetaDataRoleAuthorizationStrategy.authorize(panel, WebPage.RENDER, - String.format("%s_%s", anyObjectTO.getType(), AnyEntitlement.LIST)); - break; - default: - panel = new LabelPanel(id, null); - } - return panel; - } - protected abstract void onClickCreate(final AjaxRequestTarget target); protected abstract void onClickEdit(final AjaxRequestTarget target, final RealmTO realmTO); http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java index 176ec79..9890841 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/AnyObjectRestClient.java @@ -53,8 +53,8 @@ public class AnyObjectRestClient extends AbstractAnyRestClient<AnyObjectTO> { } @Override - public List<AnyObjectTO> list(final String realm, final int page, final int size, final SortParam<String> sort, - final String type) { + public List<AnyObjectTO> list( + final String realm, final int page, final int size, final SortParam<String> sort, final String type) { return list(type, realm).getResult(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.html new file mode 100644 index 0000000..3445d04 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.html @@ -0,0 +1,27 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> + <head><title></title></head> + <body> + <wicket:panel> + <div wicket:id="accordionPanel"></div> + <div wicket:id="searchResult"></div> + </wicket:panel> + </body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.properties new file mode 100644 index 0000000..aaee233 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +search.result=Filtered search for ${key} http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_it.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_it.properties new file mode 100644 index 0000000..19ecff3 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_it.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +search.result=Ricerca filtrata per ${key} http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_pt_BR.properties new file mode 100644 index 0000000..aaee233 --- /dev/null +++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/AnyPanel_pt_BR.properties @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +search.result=Filtered search for ${key} http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java index 28d43b9..b193672 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/BulkActionITCase.java @@ -33,6 +33,10 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.JVM) public class BulkActionITCase extends AbstractConsoleITCase { + private final String tabPanel = "body:content:body:tabbedPanel:panel:searchResult:"; + + private final String searchResultContainer = tabPanel + "container:content:"; + @Before public void login() { doLogin(ADMIN_UNAME, ADMIN_PWD); @@ -43,23 +47,23 @@ public class BulkActionITCase extends AbstractConsoleITCase { wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:1:link"); - Component component = findComponentByProp("username", "body:content:body:tabbedPanel:panel:container:content" - + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini"); + Component component = findComponentByProp("username", searchResultContainer + + "searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini"); assertNotNull(component); - final FormTester formTester = wicketTester.newFormTester("body:content:body:tabbedPanel:panel:container:" - + "content:searchContainer:resultTable:tablePanel:groupForm"); + final FormTester formTester = wicketTester.newFormTester(searchResultContainer + + "searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 1); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:container:content:searchContainer:" - + "resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); + wicketTester.executeAjaxEvent(searchResultContainer + "searchContainer:resultTable:tablePanel:bulkActionLink", + Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:container:content:searchContainer:resultTable" - + ":bulkModal:form:content:content:container", WebMarkupContainer.class); + wicketTester.assertComponent(searchResultContainer + + "searchContainer:resultTable:bulkModal:form:content:content:container", WebMarkupContainer.class); - assertNotNull(findComponentByProp("username", "body:content:body:tabbedPanel:panel:container:content:" + assertNotNull(findComponentByProp("username", searchResultContainer + "searchContainer:resultTable:bulkModal:form:content:content:container:selectedObjects", "rossini")); } @@ -68,38 +72,38 @@ public class BulkActionITCase extends AbstractConsoleITCase { wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:1:link"); - Component component = findComponentByProp("username", "body:content:body:tabbedPanel:panel:container:content" + Component component = findComponentByProp("username", searchResultContainer + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini"); assertNotNull(component); wicketTester.clickLink(component.getPageRelativePath() + ":cells:5:cell:panelManageResources:manageResourcesLink"); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", WebMarkupContainer.class); component = findComponentByProp("resourceName", - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", "resource-csv"); assertNotNull(component); final FormTester formTester = wicketTester.newFormTester( - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:firstLevelContainer:" + tabPanel + "alternativeDefaultModal:form:content:status:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 1); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container", WebMarkupContainer.class); - assertNotNull(findComponentByProp("resourceName", "body:content:body:tabbedPanel:panel:alternativeDefaultModal:" + assertNotNull(findComponentByProp("resourceName", tabPanel + "alternativeDefaultModal:" + "form:content:status:secondLevelContainer:second:container:selectedObjects", "resource-csv")); } @@ -110,70 +114,70 @@ public class BulkActionITCase extends AbstractConsoleITCase { wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:1:link"); - Component component = findComponentByProp("username", "body:content:body:tabbedPanel:panel:container:content" + Component component = findComponentByProp("username", searchResultContainer + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini"); assertNotNull(component); wicketTester.clickLink(component.getPageRelativePath() + ":cells:5:cell:panelEnable:enableLink"); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", WebMarkupContainer.class); FormTester formTester = wicketTester.newFormTester( - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:firstLevelContainer:" + tabPanel + "alternativeDefaultModal:form:content:status:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 2); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container", WebMarkupContainer.class); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:" + "status:secondLevelContainer:second:container:actions:panelSuspend:suspendLink", Constants.ON_CLICK); - wicketTester.assertLabel("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertLabel(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container:selectedObjects:body:rows:1:cells:3:cell", "SUCCESS"); // re-activate wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:1:link"); - component = findComponentByProp("username", "body:content:body:tabbedPanel:panel:container:content" + component = findComponentByProp("username", searchResultContainer + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "rossini"); assertNotNull(component); wicketTester.clickLink(component.getPageRelativePath() + ":cells:5:cell:panelEnable:enableLink"); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", WebMarkupContainer.class); formTester = wicketTester.newFormTester( - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:firstLevelContainer:" + tabPanel + "alternativeDefaultModal:form:content:status:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 2); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container", WebMarkupContainer.class); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:" + "status:secondLevelContainer:second:container:actions:panelReactivate:reactivateLink", Constants.ON_CLICK); - wicketTester.assertLabel("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertLabel(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container:selectedObjects:body:rows:1:cells:3:cell", "SUCCESS"); } @@ -182,38 +186,38 @@ public class BulkActionITCase extends AbstractConsoleITCase { wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:2:link"); - Component component = findComponentByProp("name", "body:content:body:tabbedPanel:panel:container:content" + Component component = findComponentByProp("name", searchResultContainer + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", "root"); assertNotNull(component); wicketTester.clickLink(component.getPageRelativePath() + ":cells:4:cell:panelManageResources:manageResourcesLink"); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", WebMarkupContainer.class); component = findComponentByProp("resourceName", - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", "ws-target-resource-1"); assertNotNull(component); final FormTester formTester = wicketTester.newFormTester( - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:firstLevelContainer:" + tabPanel + "alternativeDefaultModal:form:content:status:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 1); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container", WebMarkupContainer.class); - assertNotNull(findComponentByProp("resourceName", "body:content:body:tabbedPanel:panel:alternativeDefaultModal:" + assertNotNull(findComponentByProp("resourceName", tabPanel + "alternativeDefaultModal:" + "form:content:status:secondLevelContainer:second:container:selectedObjects", "ws-target-resource-1")); } @@ -222,38 +226,38 @@ public class BulkActionITCase extends AbstractConsoleITCase { wicketTester.clickLink("body:realmsLI:realms"); wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:3:link"); - Component component = findComponentByProp("key", "body:content:body:tabbedPanel:panel:container:content" + Component component = findComponentByProp("key", searchResultContainer + ":searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable", 1L); assertNotNull(component); wicketTester.clickLink(component.getPageRelativePath() + ":cells:3:cell:panelManageResources:manageResourcesLink"); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", WebMarkupContainer.class); component = findComponentByProp("resourceName", - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:groupForm:" + "checkgroup:dataTable", "ws-target-resource-1"); assertNotNull(component); final FormTester formTester = wicketTester.newFormTester( - "body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:firstLevelContainer:" + tabPanel + "alternativeDefaultModal:form:content:status:firstLevelContainer:" + "first:container:content:searchContainer:resultTable:tablePanel:groupForm"); assertNotNull(formTester); formTester.select("checkgroup", 1); - wicketTester.executeAjaxEvent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.executeAjaxEvent(tabPanel + "alternativeDefaultModal:form:content:status:" + "firstLevelContainer:first:container:content:searchContainer:resultTable:tablePanel:bulkActionLink", Constants.ON_CLICK); - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:alternativeDefaultModal:form:content:status:" + wicketTester.assertComponent(tabPanel + "alternativeDefaultModal:form:content:status:" + "secondLevelContainer:second:container", WebMarkupContainer.class); - assertNotNull(findComponentByProp("resourceName", "body:content:body:tabbedPanel:panel:alternativeDefaultModal:" + assertNotNull(findComponentByProp("resourceName", tabPanel + "alternativeDefaultModal:" + "form:content:status:secondLevelContainer:second:container:selectedObjects", "ws-target-resource-1")); } http://git-wip-us.apache.org/repos/asf/syncope/blob/857d5e62/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java ---------------------------------------------------------------------- diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java index d47da91..8ddaaad 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/DisplayAttributesITCase.java @@ -28,44 +28,46 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.JVM) public class DisplayAttributesITCase extends AbstractConsoleITCase { - + @Before public void login() { doLogin(ADMIN_UNAME, ADMIN_PWD); wicketTester.clickLink("body:realmsLI:realms"); wicketTester.assertRenderedPage(Realms.class); } - + @Test public void read() { wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:3:link"); wicketTester.clickLink("body:content:body:tabbedPanel:panel:" - + "container:content:searchContainer:resultTable:" + + "searchResult:container:content:searchContainer:resultTable:" + "tablePanel:groupForm:checkgroup:dataTable:topToolbars:" + "toolbars:1:headers:3:header:label:panelChangeView:changeViewLink"); - - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:displayAttributeModal", Modal.class); + + wicketTester.assertComponent( + "body:content:body:tabbedPanel:panel:searchResult:displayAttributeModal", Modal.class); } - + @Test public void set() { wicketTester.clickLink("body:content:body:tabbedPanel:tabs-container:tabs:3:link"); wicketTester.clickLink("body:content:body:tabbedPanel:panel:" - + "container:content:searchContainer:resultTable:" + + "searchResult:container:content:searchContainer:resultTable:" + "tablePanel:groupForm:checkgroup:dataTable:topToolbars:" + "toolbars:1:headers:3:header:label:panelChangeView:changeViewLink"); - - wicketTester.assertComponent("body:content:body:tabbedPanel:panel:displayAttributeModal", Modal.class); - - final FormTester formTester = - wicketTester.newFormTester("body:content:body:tabbedPanel:panel:displayAttributeModal:form"); - + + wicketTester.assertComponent( + "body:content:body:tabbedPanel:panel:searchResult:displayAttributeModal", Modal.class); + + final FormTester formTester = wicketTester.newFormTester( + "body:content:body:tabbedPanel:panel:searchResult:displayAttributeModal:form"); + formTester.setValue("content:container:details:paletteField:recorder", "status"); - - wicketTester. - clickLink("body:content:body:tabbedPanel:panel:displayAttributeModal:dialog:footer:inputs:0:submit"); + + wicketTester.clickLink( + "body:content:body:tabbedPanel:panel:searchResult:displayAttributeModal:dialog:footer:inputs:0:submit"); wicketTester.assertInfoMessages("Operation executed successfully"); - + wicketTester.clearFeedbackMessages(); } }
