Commit 3000e263 authored by Adrien's avatar Adrien Committed by GitHub
Browse files

feat(project explorer) test organization action from explorer (#1411)

feat(project explorer) add swtbot test for organization
parent 4c5dfe90
......@@ -5,14 +5,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.actors.ui.handler;
......@@ -26,28 +24,27 @@ import org.bonitasoft.studio.actors.repository.OrganizationFileStore;
import org.bonitasoft.studio.actors.repository.OrganizationRepositoryStore;
import org.bonitasoft.studio.common.repository.CommonRepositoryPlugin;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.common.repository.filestore.FileStoreFinder;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
import org.bonitasoft.studio.common.repository.model.IRepositoryStore;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.PlatformUI;
public class ExportOrganizationHandler extends AbstractHandler {
FileStoreFinder fileStoreFinder;
public ExportOrganizationHandler() {
fileStoreFinder = new FileStoreFinder();
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final IRepositoryStore<? extends IRepositoryFileStore> organizationStore = RepositoryManager.getInstance().getRepositoryStore(OrganizationRepositoryStore.class) ;
List<IRepositoryStore<? extends IRepositoryFileStore>> stores = new ArrayList<IRepositoryStore<? extends IRepositoryFileStore>>() ;
stores.add(organizationStore) ;
final IRepositoryStore<? extends IRepositoryFileStore> organizationStore = RepositoryManager.getInstance()
.getRepositoryStore(OrganizationRepositoryStore.class);
List<IRepositoryStore<? extends IRepositoryFileStore>> stores = new ArrayList<>();
stores.add(organizationStore);
CommonRepositoryPlugin.exportArtifactsToFile(stores, getSelection(), Messages.exportOrganizationTitle);
......@@ -56,25 +53,10 @@ public class ExportOrganizationHandler extends AbstractHandler {
private Set<Object> getSelection() {
Set<Object> res = new HashSet<>();
ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
if (service == null) {
return res;
}
ISelection selection = service.getSelection();
if (selection instanceof IStructuredSelection
&& ((IStructuredSelection) selection).size() == 1) {
Object sel = ((IStructuredSelection) selection).getFirstElement();
if (sel instanceof IAdaptable && ((IAdaptable) sel).getAdapter(IResource.class) != null) {
IResource adapter = ((IAdaptable) sel).getAdapter(IResource.class);
if (adapter instanceof IFile) {
IRepositoryFileStore fileStore = RepositoryManager.getInstance().getCurrentRepository()
.getFileStore(adapter);
if (fileStore instanceof OrganizationFileStore) {
res.add(fileStore);
}
}
}
}
fileStoreFinder.findSelectedFileStore(RepositoryManager.getInstance().getCurrentRepository())
.filter(OrganizationFileStore.class::isInstance)
.map(OrganizationFileStore.class::cast)
.ifPresent(res::add);
return res;
}
......
......@@ -24,6 +24,7 @@ import java.util.stream.Collectors;
import javax.inject.Inject;
import org.bonitasoft.studio.application.views.provider.UIDArtifactFilters;
import org.bonitasoft.studio.common.jface.SWTBotConstants;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.eclipse.core.resources.IProject;
import org.eclipse.e4.core.contexts.IEclipseContext;
......@@ -127,6 +128,8 @@ public class BonitaProjectExplorer extends CommonNavigator {
protected CommonViewer createCommonViewerObject(Composite aParent) {
CommonViewer commonViewer = new PackageExplorerProblemTreeViewer(getViewSite().getId(), aParent,
SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
commonViewer.getTree().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY,
"org.bonitasoft.studio.application.projectExplorerTree");
commonViewer.addFilter(UIDArtifactFilters.filterUIDArtifactChildren());
return commonViewer;
}
......
......@@ -89,55 +89,56 @@ Export-Package: org.bonitasoft.console.common.server.preferences.constan
="0.0.0",org.bonitasoft.engine.expression.impl;version="0.0.0",org.boni
tasoft.engine.filter;version="0.0.0",org.bonitasoft.engine.form;version
="0.0.0",org.bonitasoft.engine.home;version="0.0.0",org.bonitasoft.engi
ne.http;version="0.0.0",org.bonitasoft.engine.identity;version="0.0.0",
org.bonitasoft.engine.identity.impl;version="0.0.0",org.bonitasoft.engi
ne.io;version="0.0.0",org.bonitasoft.engine.job;version="0.0.0",org.bon
itasoft.engine.job.impl;version="0.0.0",org.bonitasoft.engine.operation
;version="0.0.0",org.bonitasoft.engine.operation.impl;version="0.0.0",o
rg.bonitasoft.engine.page;version="0.0.0",org.bonitasoft.engine.page.im
pl;version="0.0.0",org.bonitasoft.engine.platform;version="0.0.0",org.b
onitasoft.engine.platform.command;version="0.0.0",org.bonitasoft.engine
.platform.command.impl;version="0.0.0",org.bonitasoft.engine.platform.i
mpl;version="0.0.0",org.bonitasoft.engine.profile;version="0.0.0",org.b
onitasoft.engine.profile.impl;version="0.0.0",org.bonitasoft.engine.pro
file.xml;version="0.0.0",org.bonitasoft.engine.search;version="0.0.0",o
rg.bonitasoft.engine.search.impl;version="0.0.0",org.bonitasoft.engine.
session;version="0.0.0",org.bonitasoft.engine.session.impl;version="0.0
.0",org.bonitasoft.engine.tenant;version="0.0.0",org.bonitasoft.engine.
theme;version="0.0.0",org.bonitasoft.engine.theme.exception;version="0.
0.0",org.bonitasoft.engine.theme.impl;version="0.0.0",org.bonitasoft.en
gine.util;version="0.0.0",org.bonitasoft.engine.xml;version="0.0.0",org
.bonitasoft.engine.xml.parser;version="0.0.0"
Include-Resource: , lib/bonita-client.jar=/Users/adrien/.m2/repository/o
rg/bonitasoft/engine/bonita-client/7.8.0-SNAPSHOT/bonita-client-7.8.0-S
NAPSHOT.jar,lib/httpmime.jar=/Users/adrien/.m2/repository/org/apache/ht
tpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar,lib/commons-codec.jar=/U
sers/adrien/.m2/repository/commons-codec/commons-codec/1.7/commons-code
c-1.7.jar,lib/httpclient.jar=/Users/adrien/.m2/repository/org/apache/ht
tpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar,lib/httpcore.jar=/Us
ers/adrien/.m2/repository/org/apache/httpcomponents/httpcore/4.4.4/http
core-4.4.4.jar,lib/commons-logging.jar=/Users/adrien/.m2/repository/com
mons-logging/commons-logging/1.2/commons-logging-1.2.jar,lib/xstream.ja
r=/Users/adrien/.m2/repository/com/thoughtworks/xstream/xstream/1.4.10/
xstream-1.4.10.jar,lib/xmlpull.jar=/Users/adrien/.m2/repository/xmlpull
/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar,lib/xpp3_min.jar=/Users/adrien/.m2
/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar,lib/bonita-common.
jar=/Users/adrien/.m2/repository/org/bonitasoft/engine/bonita-common/7.
8.0-SNAPSHOT/bonita-common-7.8.0-SNAPSHOT.jar,lib/commons-lang3.jar=/Us
ers/adrien/.m2/repository/org/apache/commons/commons-lang3/3.3.2/common
s-lang3-3.3.2.jar,lib/jackson-annotations.jar=/Users/adrien/.m2/reposit
ory/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annota
tions-2.9.0.jar,lib/commons-io.jar=/Users/adrien/.m2/repository/commons
-io/commons-io/2.5/commons-io-2.5.jar,lib/jackson-databind.jar=/Users/a
drien/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.0/
jackson-databind-2.9.0.jar,lib/jackson-core.jar=/Users/adrien/.m2/repos
itory/com/fasterxml/jackson/core/jackson-core/2.9.0/jackson-core-2.9.0.
jar,lib/slf4j-api.jar=/Users/adrien/.m2/repository/org/slf4j/slf4j-api/
1.7.25/slf4j-api-1.7.25.jar,lib/console-server.jar=/Users/adrien/.m2/re
pository/org/bonitasoft/console/console-server/7.8.0-SNAPSHOT/console-s
erver-7.8.0-SNAPSHOT-classes.jar,lib/console-common.jar=/Users/adrien/.
m2/repository/org/bonitasoft/console/console-common/7.8.0-SNAPSHOT/cons
ole-common-7.8.0-SNAPSHOT.jar,javadoc.zip,plugin.xml,tomcat=tomcat
ne.identity;version="0.0.0",org.bonitasoft.engine.identity.impl;version
="0.0.0",org.bonitasoft.engine.io;version="0.0.0",org.bonitasoft.engine
.job;version="0.0.0",org.bonitasoft.engine.job.impl;version="0.0.0",org
.bonitasoft.engine.operation;version="0.0.0",org.bonitasoft.engine.oper
ation.impl;version="0.0.0",org.bonitasoft.engine.page;version="0.0.0",o
rg.bonitasoft.engine.page.impl;version="0.0.0",org.bonitasoft.engine.pl
atform;version="0.0.0",org.bonitasoft.engine.platform.command;version="
0.0.0",org.bonitasoft.engine.platform.command.impl;version="0.0.0",org.
bonitasoft.engine.platform.impl;version="0.0.0",org.bonitasoft.engine.p
rofile;version="0.0.0",org.bonitasoft.engine.profile.impl;version="0.0.
0",org.bonitasoft.engine.profile.xml;version="0.0.0",org.bonitasoft.eng
ine.search;version="0.0.0",org.bonitasoft.engine.search.impl;version="0
.0.0",org.bonitasoft.engine.session;version="0.0.0",org.bonitasoft.engi
ne.session.impl;version="0.0.0",org.bonitasoft.engine.tenant;version="0
.0.0",org.bonitasoft.engine.theme;version="0.0.0",org.bonitasoft.engine
.theme.exception;version="0.0.0",org.bonitasoft.engine.theme.impl;versi
on="0.0.0",org.bonitasoft.engine.util;version="0.0.0",org.bonitasoft.en
gine.xml;version="0.0.0",org.bonitasoft.engine.xml.parser;version="0.0.
0"
Include-Resource: , lib/bonita-client.jar=C:\Users\Adrien\.m2\repository
\org\bonitasoft\engine\bonita-client\7.8.0-SNAPSHOT\bonita-client-7.8.0
-SNAPSHOT.jar,lib/httpmime.jar=C:\Users\Adrien\.m2\repository\org\apach
e\httpcomponents\httpmime\4.5.2\httpmime-4.5.2.jar,lib/commons-codec.ja
r=C:\Users\Adrien\.m2\repository\commons-codec\commons-codec\1.7\common
s-codec-1.7.jar,lib/httpclient.jar=C:\Users\Adrien\.m2\repository\org\a
pache\httpcomponents\httpclient\4.5.2\httpclient-4.5.2.jar,lib/httpcore
.jar=C:\Users\Adrien\.m2\repository\org\apache\httpcomponents\httpcore\
4.4.4\httpcore-4.4.4.jar,lib/commons-logging.jar=C:\Users\Adrien\.m2\re
pository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar,li
b/xstream.jar=C:\Users\Adrien\.m2\repository\com\thoughtworks\xstream\x
stream\1.4.10\xstream-1.4.10.jar,lib/xmlpull.jar=C:\Users\Adrien\.m2\re
pository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar,lib/xpp3_min.jar=C
:\Users\Adrien\.m2\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar,
lib/bonita-common.jar=C:\Users\Adrien\.m2\repository\org\bonitasoft\eng
ine\bonita-common\7.8.0-SNAPSHOT\bonita-common-7.8.0-SNAPSHOT.jar,lib/c
ommons-lang3.jar=C:\Users\Adrien\.m2\repository\org\apache\commons\comm
ons-lang3\3.3.2\commons-lang3-3.3.2.jar,lib/jackson-annotations.jar=C:\
Users\Adrien\.m2\repository\com\fasterxml\jackson\core\jackson-annotati
ons\2.9.0\jackson-annotations-2.9.0.jar,lib/commons-io.jar=C:\Users\Adr
ien\.m2\repository\commons-io\commons-io\2.5\commons-io-2.5.jar,lib/jac
kson-databind.jar=C:\Users\Adrien\.m2\repository\com\fasterxml\jackson\
core\jackson-databind\2.9.0\jackson-databind-2.9.0.jar,lib/jackson-core
.jar=C:\Users\Adrien\.m2\repository\com\fasterxml\jackson\core\jackson-
core\2.9.0\jackson-core-2.9.0.jar,lib/slf4j-api.jar=C:\Users\Adrien\.m2
\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar,lib/console
-server.jar=C:\Users\Adrien\.m2\repository\org\bonitasoft\console\conso
le-server\7.8.0-SNAPSHOT\console-server-7.8.0-SNAPSHOT-classes.jar,lib/
console-common.jar=C:\Users\Adrien\.m2\repository\org\bonitasoft\consol
e\console-common\7.8.0-SNAPSHOT\console-common-7.8.0-SNAPSHOT.jar,javad
oc.zip,plugin.xml,tomcat=tomcat
Private-Package: lib,tomcat,tomcat.server,tomcat.server.bin,tomcat.serve
r.conf.Catalina.localhost,tomcat.server.conf,tomcat.server.lib,tomcat.s
erver.lib.bonita,tomcat.server.logs,tomcat.server.temp,tomcat.server.we
......@@ -236,71 +237,72 @@ Private-Package: lib,tomcat,tomcat.server,tomcat.server.bin,tomcat.serve
t.server.api.bonitaPage,org.bonitasoft.web.rest.server.api.bpm.cases,or
g.bonitasoft.web.rest.server.api.bpm.connector,org.bonitasoft.web.rest.
server.api.bpm.flownode,org.bonitasoft.web.rest.server.api.bpm.flownode
.archive,org.bonitasoft.web.rest.server.api.bpm.process,org.bonitasoft.
web.rest.server.api.deployer,org.bonitasoft.web.rest.server.api.documen
t,org.bonitasoft.web.rest.server.api.document.api.impl,org.bonitasoft.w
eb.rest.server.api.extension,org.bonitasoft.web.rest.server.api.form,or
g.bonitasoft.web.rest.server.api.organization,org.bonitasoft.web.rest.s
erver.api.organization.password.validator,org.bonitasoft.web.rest.serve
r.api.page,org.bonitasoft.web.rest.server.api.platform,org.bonitasoft.w
eb.rest.server.api.profile,org.bonitasoft.web.rest.server.api.resource,
org.bonitasoft.web.rest.server.api.system,org.bonitasoft.web.rest.serve
r.api.tenant,org.bonitasoft.web.rest.server.datastore,org.bonitasoft.we
b.rest.server.datastore.application,org.bonitasoft.web.rest.server.data
store.applicationmenu,org.bonitasoft.web.rest.server.datastore.applicat
ionpage,org.bonitasoft.web.rest.server.datastore.bpm.cases,org.bonitaso
ft.web.rest.server.datastore.bpm.connector,org.bonitasoft.web.rest.serv
er.datastore.bpm.flownode,org.bonitasoft.web.rest.server.datastore.bpm.
flownode.archive,org.bonitasoft.web.rest.server.datastore.bpm.flownode.
archive.converter,org.bonitasoft.web.rest.server.datastore.bpm.process,
org.bonitasoft.web.rest.server.datastore.bpm.process.helper,org.bonitas
oft.web.rest.server.datastore.converter,org.bonitasoft.web.rest.server.
datastore.filter,org.bonitasoft.web.rest.server.datastore.organization,
org.bonitasoft.web.rest.server.datastore.page,org.bonitasoft.web.rest.s
erver.datastore.profile,org.bonitasoft.web.rest.server.datastore.profil
e.entry,org.bonitasoft.web.rest.server.datastore.profile.member,org.bon
itasoft.web.rest.server.datastore.system,org.bonitasoft.web.rest.server
.datastore.utils,org.bonitasoft.web.rest.server.engineclient,org.bonita
soft.web.rest.server.framework,org.bonitasoft.web.rest.server.framework
.api,org.bonitasoft.web.rest.server.framework.exception,org.bonitasoft.
web.rest.server.framework.json,org.bonitasoft.web.rest.server.framework
.search,org.bonitasoft.web.rest.server.framework.servlet,org.bonitasoft
.web.rest.server.framework.utils,org.bonitasoft.web.rest.server.framewo
rk.utils.converter,org.bonitasoft.web.rest.server.framework.utils.conve
rter.typed,org.bonitasoft.web.rest.server.utils,org.bonitasoft.web.tool
kit.server,org.bonitasoft.web.toolkit.server.servlet,org.bonitasoft.web
.toolkit.server.utils,org.bonitasoft.console.common.server.filter,org.b
onitasoft.console.common.server.themes,org.bonitasoft.console.common.se
rver.themes.exception,org.bonitasoft.web,org.bonitasoft.web.common.mode
l,org.bonitasoft.web.rest.model,org.bonitasoft.web.rest.model.applicati
on,org.bonitasoft.web.rest.model.applicationmenu,org.bonitasoft.web.res
t.model.applicationpage,org.bonitasoft.web.rest.model.bdm,org.bonitasof
t.web.rest.model.bpm,org.bonitasoft.web.rest.model.bpm.cases,org.bonita
soft.web.rest.model.bpm.connector,org.bonitasoft.web.rest.model.bpm.flo
wnode,org.bonitasoft.web.rest.model.bpm.process,org.bonitasoft.web.rest
.model.builder.bpm.cases,org.bonitasoft.web.rest.model.builder.bpm.proc
ess,org.bonitasoft.web.rest.model.builder.identity,org.bonitasoft.web.r
est.model.builder.organisation,org.bonitasoft.web.rest.model.builder.pr
ofile,org.bonitasoft.web.rest.model.builder.profile.entry,org.bonitasof
t.web.rest.model.builder.profile.member,org.bonitasoft.web.rest.model.d
ocument,org.bonitasoft.web.rest.model.identity,org.bonitasoft.web.rest.
model.monitoring.report,org.bonitasoft.web.rest.model.platform,org.boni
tasoft.web.rest.model.portal.page,org.bonitasoft.web.rest.model.portal.
profile,org.bonitasoft.web.rest.model.system,org.bonitasoft.web.rest.mo
del.tenant,org.bonitasoft.web.rest.model.user,org.bonitasoft.web.toolki
t.client,org.bonitasoft.web.toolkit.client.common,org.bonitasoft.web.to
olkit.client.common.exception,org.bonitasoft.web.toolkit.client.common.
exception.api,org.bonitasoft.web.toolkit.client.common.exception.http,o
rg.bonitasoft.web.toolkit.client.common.i18n,org.bonitasoft.web.toolkit
.client.common.i18n.model,org.bonitasoft.web.toolkit.client.common.json
,org.bonitasoft.web.toolkit.client.common.session,org.bonitasoft.web.to
olkit.client.common.texttemplate,org.bonitasoft.web.toolkit.client.comm
on.url,org.bonitasoft.web.toolkit.client.common.util,org.bonitasoft.web
.toolkit.client.data,org.bonitasoft.web.toolkit.client.data.item,org.bo
nitasoft.web.toolkit.client.data.item.attribute,org.bonitasoft.web.tool
kit.client.data.item.attribute.modifier,org.bonitasoft.web.toolkit.clie
nt.data.item.attribute.reader,org.bonitasoft.web.toolkit.client.data.it
em.attribute.validator,org.bonitasoft.web.toolkit.client.data.item.temp
late,org.bonitasoft.web.toolkit.client.ui,org.bonitasoft.web.toolkit.cl
ient.ui.utils,org.bonitasoft.web.toolkit.client.ui.utils.dateformat
.archive,org.bonitasoft.web.rest.server.api.bpm.message,org.bonitasoft.
web.rest.server.api.bpm.process,org.bonitasoft.web.rest.server.api.depl
oyer,org.bonitasoft.web.rest.server.api.document,org.bonitasoft.web.res
t.server.api.document.api.impl,org.bonitasoft.web.rest.server.api.exten
sion,org.bonitasoft.web.rest.server.api.form,org.bonitasoft.web.rest.se
rver.api.organization,org.bonitasoft.web.rest.server.api.organization.p
assword.validator,org.bonitasoft.web.rest.server.api.page,org.bonitasof
t.web.rest.server.api.platform,org.bonitasoft.web.rest.server.api.profi
le,org.bonitasoft.web.rest.server.api.resource,org.bonitasoft.web.rest.
server.api.system,org.bonitasoft.web.rest.server.api.tenant,org.bonitas
oft.web.rest.server.datastore,org.bonitasoft.web.rest.server.datastore.
application,org.bonitasoft.web.rest.server.datastore.applicationmenu,or
g.bonitasoft.web.rest.server.datastore.applicationpage,org.bonitasoft.w
eb.rest.server.datastore.bpm.cases,org.bonitasoft.web.rest.server.datas
tore.bpm.connector,org.bonitasoft.web.rest.server.datastore.bpm.flownod
e,org.bonitasoft.web.rest.server.datastore.bpm.flownode.archive,org.bon
itasoft.web.rest.server.datastore.bpm.flownode.archive.converter,org.bo
nitasoft.web.rest.server.datastore.bpm.process,org.bonitasoft.web.rest.
server.datastore.bpm.process.helper,org.bonitasoft.web.rest.server.data
store.converter,org.bonitasoft.web.rest.server.datastore.filter,org.bon
itasoft.web.rest.server.datastore.organization,org.bonitasoft.web.rest.
server.datastore.page,org.bonitasoft.web.rest.server.datastore.profile,
org.bonitasoft.web.rest.server.datastore.profile.entry,org.bonitasoft.w
eb.rest.server.datastore.profile.member,org.bonitasoft.web.rest.server.
datastore.system,org.bonitasoft.web.rest.server.datastore.utils,org.bon
itasoft.web.rest.server.engineclient,org.bonitasoft.web.rest.server.fra
mework,org.bonitasoft.web.rest.server.framework.api,org.bonitasoft.web.
rest.server.framework.exception,org.bonitasoft.web.rest.server.framewor
k.json,org.bonitasoft.web.rest.server.framework.search,org.bonitasoft.w
eb.rest.server.framework.servlet,org.bonitasoft.web.rest.server.framewo
rk.utils,org.bonitasoft.web.rest.server.framework.utils.converter,org.b
onitasoft.web.rest.server.framework.utils.converter.typed,org.bonitasof
t.web.rest.server.utils,org.bonitasoft.web.toolkit.server,org.bonitasof
t.web.toolkit.server.servlet,org.bonitasoft.web.toolkit.server.utils,or
g.bonitasoft.console.common.server.filter,org.bonitasoft.console.common
.server.themes,org.bonitasoft.console.common.server.themes.exception,or
g.bonitasoft.web,org.bonitasoft.web.common.model,org.bonitasoft.web.res
t.model,org.bonitasoft.web.rest.model.application,org.bonitasoft.web.re
st.model.applicationmenu,org.bonitasoft.web.rest.model.applicationpage,
org.bonitasoft.web.rest.model.bdm,org.bonitasoft.web.rest.model.bpm,org
.bonitasoft.web.rest.model.bpm.cases,org.bonitasoft.web.rest.model.bpm.
connector,org.bonitasoft.web.rest.model.bpm.flownode,org.bonitasoft.web
.rest.model.bpm.process,org.bonitasoft.web.rest.model.builder.bpm.cases
,org.bonitasoft.web.rest.model.builder.bpm.process,org.bonitasoft.web.r
est.model.builder.identity,org.bonitasoft.web.rest.model.builder.organi
sation,org.bonitasoft.web.rest.model.builder.profile,org.bonitasoft.web
.rest.model.builder.profile.entry,org.bonitasoft.web.rest.model.builder
.profile.member,org.bonitasoft.web.rest.model.document,org.bonitasoft.w
eb.rest.model.identity,org.bonitasoft.web.rest.model.monitoring.report,
org.bonitasoft.web.rest.model.platform,org.bonitasoft.web.rest.model.po
rtal.page,org.bonitasoft.web.rest.model.portal.profile,org.bonitasoft.w
eb.rest.model.system,org.bonitasoft.web.rest.model.tenant,org.bonitasof
t.web.rest.model.user,org.bonitasoft.web.toolkit.client,org.bonitasoft.
web.toolkit.client.common,org.bonitasoft.web.toolkit.client.common.exce
ption,org.bonitasoft.web.toolkit.client.common.exception.api,org.bonita
soft.web.toolkit.client.common.exception.http,org.bonitasoft.web.toolki
t.client.common.i18n,org.bonitasoft.web.toolkit.client.common.i18n.mode
l,org.bonitasoft.web.toolkit.client.common.json,org.bonitasoft.web.tool
kit.client.common.session,org.bonitasoft.web.toolkit.client.common.text
template,org.bonitasoft.web.toolkit.client.common.url,org.bonitasoft.we
b.toolkit.client.common.util,org.bonitasoft.web.toolkit.client.data,org
.bonitasoft.web.toolkit.client.data.item,org.bonitasoft.web.toolkit.cli
ent.data.item.attribute,org.bonitasoft.web.toolkit.client.data.item.att
ribute.modifier,org.bonitasoft.web.toolkit.client.data.item.attribute.r
eader,org.bonitasoft.web.toolkit.client.data.item.attribute.validator,o
rg.bonitasoft.web.toolkit.client.data.item.template,org.bonitasoft.web.
toolkit.client.ui,org.bonitasoft.web.toolkit.client.ui.utils,org.bonita
soft.web.toolkit.client.ui.utils.dateformat
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
......@@ -80,6 +80,8 @@ Export-Package: org.bonitasoft.studio.swtbot.framework,
org.bonitasoft.studio.swtbot.framework.expression,
org.bonitasoft.studio.swtbot.framework.la,
org.bonitasoft.studio.swtbot.framework.organization,
org.bonitasoft.studio.swtbot.framework.projectExplorer,
org.bonitasoft.studio.swtbot.framework.projectExplorer.organization,
org.bonitasoft.studio.swtbot.framework.rule,
org.bonitasoft.studio.swtbot.framework.widget
......
package org.bonitasoft.studio.swtbot.framework.conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
......@@ -16,7 +17,9 @@ public class ActiveWelcomePageCondition extends DefaultCondition {
@Override
public boolean test() throws Exception {
return swtGefBot.viewById("org.eclipse.ui.internal.introview").isActive();
SWTBotView view = swtGefBot.viewById("org.eclipse.ui.internal.introview");
view.setFocus();
return view.isActive();
}
@Override
......
/**
* Copyright (C) 2018 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.swtbot.framework.projectExplorer;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.swtbot.framework.BotBase;
import org.bonitasoft.studio.swtbot.framework.organization.BotManageOrganizationWizard;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.organization.OrganizationProjectExplorerBot;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
public class ProjectExplorerBot extends BotBase {
protected String projectName;
public ProjectExplorerBot(SWTGefBot bot) {
super(bot);
projectName = RepositoryManager.getInstance().getCurrentRepository().getName();
}
public BotManageOrganizationWizard newOrganization() {
getProjectExplorerTree().getTreeItem(projectName).contextMenu().menu("New").menu("Organization...").click();
return new BotManageOrganizationWizard(bot);
}
public OrganizationProjectExplorerBot organization() {
return new OrganizationProjectExplorerBot(bot);
}
public SWTBotTreeItem getProjectTreeItem() {
return getProjectExplorerTree().getTreeItem(projectName);
}
protected SWTBotTreeItem getTreeItem(SWTBotTreeItem parent, String item) {
parent.expand();
bot.waitUntilWidgetAppears(nodeAvailable(parent, item));
return parent.getNode(item);
}
protected void clickOnContextualMenu(SWTBotTreeItem node, String menu) {
bot.waitUntilWidgetAppears(contextMenuAvailable(node, menu));
node.contextMenu(menu).click();
}
protected SWTBotTree getProjectExplorerTree() {
return bot.treeWithId("org.bonitasoft.studio.application.projectExplorerTree");
}
protected ICondition nodeAvailable(SWTBotTreeItem item, String node) {
return new ICondition() {
@Override
public boolean test() throws Exception {
try {
item.getNode(node);
return true;
} catch (WidgetNotFoundException e) {
return false;
}
}
@Override
public void init(SWTBot bot) {
}
@Override
public String getFailureMessage() {
return String.format("The node %s of '%s' isn't available", node, item);
}
};
}
protected ICondition contextMenuAvailable(SWTBotTreeItem item, String menu) {
return new ICondition() {
@Override
public boolean test() throws Exception {
return item.contextMenu().menuItems().contains(menu);
}
@Override
public void init(SWTBot bot) {
}
@Override
public String getFailureMessage() {
return String.format("The menu '%s' of '%s' isn't available", menu, item);
}
};
}
}
/**
* Copyright (C) 2018 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.swtbot.framework.projectExplorer.organization;
import org.bonitasoft.studio.swtbot.framework.BotDialog;
import org.bonitasoft.studio.swtbot.framework.organization.BotManageOrganizationWizard;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.ProjectExplorerBot;
import org.bonitasoft.studio.ui.i18n.Messages;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@SuppressWarnings("restriction")
public class OrganizationProjectExplorerBot extends ProjectExplorerBot {
private static final String ORGA_EXT = ".organization";
public OrganizationProjectExplorerBot(SWTGefBot bot) {
super(bot);
}
@Override
public BotManageOrganizationWizard newOrganization() {
clickOnContextualMenu(getOrganizationFolderTreeItem(), "New...");
return new BotManageOrganizationWizard(bot);
}
public BotDialog exportOrganization() {
clickOnContextualMenu(getOrganizationFolderTreeItem(), "Export...");
return new BotDialog(bot, org.bonitasoft.studio.actors.i18n.Messages.exportOrganizationTitle);
}
public BotDialog exportOrganization(String organization) {
clickOnContextualMenu(getOrganizationTreeItem(organization), "Export...");
return new BotDialog(bot, org.bonitasoft.studio.actors.i18n.Messages.exportOrganizationTitle);
}
public BotManageOrganizationWizard openOrganization(String organization) {
clickOnContextualMenu(getOrganizationTreeItem(organization), "Open");
return new BotManageOrganizationWizard(bot);
}
public void renameOrganization(String oldName, String newName) {
clickOnContextualMenu(getOrganizationTreeItem(oldName), "Rename...");
bot.waitUntil(Conditions.shellIsActive(Messages.rename));
SWTBotShell activeShell = bot.activeShell();
bot.text().setText(newName);
bot.button(IDialogConstants.OK_LABEL).click();
bot.waitUntil(Conditions.shellCloses(activeShell));
}
public void deployOrganization(String organization, String user) {
SWTBotTreeItem organizationTreeItem = getOrganizationFolderTreeItem();
clickOnContextualMenu(getTreeItem(organizationTreeItem, addOrgaExtension(organization)), "Deploy");
bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.actors.i18n.Messages.deployOrganizationTitle));
bot.text().setText(user);
bot.button("Deploy").click();
bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.actors.i18n.Messages.deployInformationTitle));
SWTBotShell activeShell = bot.activeShell();
bot.button(IDialogConstants.OK_LABEL).click();
bot.waitUntil(Conditions.shellCloses(activeShell));
}
private SWTBotTreeItem getOrganizationFolderTreeItem() {
return getTreeItem(getProjectTreeItem(), "Organization");