Commit 36733a4d authored by Adrien's avatar Adrien Committed by Romain Bioteau

feat(project explorer) test diagram actions from explorer (#1419)

parent e6b6f609
......@@ -26,8 +26,6 @@ import static org.bonitasoft.studio.common.jface.databinding.validator.Validator
import static org.bonitasoft.studio.common.jface.databinding.validator.ValidatorFactory.reservedRESTAPIKeywordsValidator;
import static org.bonitasoft.studio.common.jface.databinding.validator.ValidatorFactory.utf8InputValidator;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -35,6 +33,7 @@ import java.util.Set;
import org.bonitasoft.studio.common.Messages;
import org.bonitasoft.studio.common.diagram.Identifier;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.SWTBotConstants;
import org.bonitasoft.studio.common.jface.databinding.DialogSupport;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
......@@ -97,15 +96,10 @@ public class OpenNameAndVersionDialog extends Dialog {
}
protected Set<String> listExistingFileNames(final IRepositoryStore<?> diagramStore) {
final Set<String> result = new HashSet<String>();
final Set<String> result = new HashSet<>();
if (diagramStore.getResource() != null) {
final String[] files = diagramStore.getResource().getLocation().toFile().list(new FilenameFilter() {
@Override
public boolean accept(final File arg0, final String arg1) {
return arg1.endsWith(".proc");
}
});
final String[] files = diagramStore.getResource().getLocation().toFile()
.list((arg0, arg1) -> arg1.endsWith(".proc"));
for (final String f : files) {
result.add(f);
}
......@@ -115,7 +109,7 @@ public class OpenNameAndVersionDialog extends Dialog {
protected Set<Identifier> computeProcessIdentifiers(
final IRepositoryStore<? extends IRepositoryFileStore> diagramStore) {
final Set<Identifier> result = new HashSet<Identifier>();
final Set<Identifier> result = new HashSet<>();
for (final IRepositoryFileStore irepStore : diagramStore.getChildren()) {
try {
result.addAll(newHashSet(
......@@ -128,14 +122,7 @@ public class OpenNameAndVersionDialog extends Dialog {
}
private Function<AbstractProcess, Identifier> toIdentifier() {
return new Function<AbstractProcess, Identifier>() {
@Override
public Identifier apply(final AbstractProcess input) {
return new Identifier(input.getName(), input.getVersion());
}
};
return input -> new Identifier(input.getName(), input.getVersion());
}
protected List<Identifier> existingProcessIdentifiers() {
......@@ -176,6 +163,7 @@ public class OpenNameAndVersionDialog extends Dialog {
nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
final Text nameText = new Text(res, SWT.BORDER);
nameText.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, "org.bonitasoft.studio.common.diagram.dialog.name.text");
nameText.setLayoutData(
GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(10, 0).create());
final ISWTObservableValue observeNameText = SWTObservables.observeText(nameText, SWT.Modify);
......
......@@ -19,6 +19,7 @@ import java.util.List;
import org.bonitasoft.studio.common.Messages;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.jface.SWTBotConstants;
import org.bonitasoft.studio.common.jface.databinding.DialogSupport;
import org.bonitasoft.studio.common.repository.model.IRepositoryStore;
import org.bonitasoft.studio.model.process.AbstractProcess;
......@@ -42,10 +43,11 @@ import org.eclipse.swt.widgets.Text;
public class OpenNameAndVersionForDiagramDialog extends OpenNameAndVersionDialog {
private final List<ProcessesNameVersion> pools = new ArrayList<ProcessesNameVersion>();
private final List<ProcessesNameVersion> pools = new ArrayList<>();
private DataBindingContext dbc;
public OpenNameAndVersionForDiagramDialog(final Shell parentShell, final MainProcess diagram, final IRepositoryStore<?> diagramStore) {
public OpenNameAndVersionForDiagramDialog(final Shell parentShell, final MainProcess diagram,
final IRepositoryStore<?> diagramStore) {
super(parentShell, diagram, diagramStore);
for (final AbstractProcess pool : ModelHelper.getAllProcesses(diagram)) {
pools.add(new ProcessesNameVersion(pool));
......@@ -92,6 +94,8 @@ public class OpenNameAndVersionForDiagramDialog extends OpenNameAndVersionDialog
poolNameLabel.setText(Messages.name);
final Text poolNameText = new Text(pnvCompo, SWT.BORDER);
poolNameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).create());
poolNameText.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY,
"org.bonitasoft.studio.common.diagram.dialog.poolName.text");
final ISWTObservableValue observePoolNameText = SWTObservables.observeText(poolNameText, SWT.Modify);
ControlDecorationSupport.create(dbc.bindValue(observePoolNameText,
......@@ -111,11 +115,13 @@ public class OpenNameAndVersionForDiagramDialog extends OpenNameAndVersionDialog
null), SWT.LEFT);
if (isForceNameUpdate()) {
final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(pnv.getAbstractProcess(), observePoolNameText, observePoolVersionText);
final MustUpdateValidator mustUpdateValidator = new MustUpdateValidator(pnv.getAbstractProcess(),
observePoolNameText, observePoolVersionText);
dbc.addValidationStatusProvider(mustUpdateValidator);
ControlDecorationSupport.create(mustUpdateValidator, SWT.LEFT);
}
final MultiValidator processesNameVersionUnicityValidator = new ProcessesNameVersionUnicityValidator(pnv.getAbstractProcess(), observePoolNameText,
final MultiValidator processesNameVersionUnicityValidator = new ProcessesNameVersionUnicityValidator(
pnv.getAbstractProcess(), observePoolNameText,
observePoolVersionText, existingProcessIdentifiers(), pools);
dbc.addValidationStatusProvider(processesNameVersionUnicityValidator);
ControlDecorationSupport.create(processesNameVersionUnicityValidator, SWT.LEFT);
......
......@@ -83,6 +83,7 @@ Export-Package: org.bonitasoft.studio.swtbot.framework,
org.bonitasoft.studio.swtbot.framework.projectExplorer,
org.bonitasoft.studio.swtbot.framework.projectExplorer.bdm,
org.bonitasoft.studio.swtbot.framework.projectExplorer.la,
org.bonitasoft.studio.swtbot.framework.projectExplorer.diagram,
org.bonitasoft.studio.swtbot.framework.projectExplorer.organization,
org.bonitasoft.studio.swtbot.framework.rule,
org.bonitasoft.studio.swtbot.framework.widget
......
......@@ -10,11 +10,9 @@ package org.bonitasoft.studio.swtbot.framework.diagram;
import org.bonitasoft.studio.swtbot.framework.BotBase;
import org.bonitasoft.studio.swtbot.framework.SWTBotTestUtil;
import org.bonitasoft.studio.swtbot.framework.draw.BotGefFormDiagramEditor;
import org.bonitasoft.studio.swtbot.framework.draw.BotGefProcessDiagramEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
/**
* Process diagram perspective.
......@@ -24,7 +22,6 @@ import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
public class BotProcessDiagramPerspective extends BotBase {
public static String FORM_ID = "org.bonitasoft.studio.diagram.form.custom.part.CustomFormDiagram";
public static String FORM_EX_ID = "org.bonitasoft.studio.diagram.form.custom.ex.part.FormDiagramEditorEx";
public BotProcessDiagramPerspective(final SWTGefBot bot) {
super(bot);
......@@ -54,24 +51,6 @@ public class BotProcessDiagramPerspective extends BotBase {
return new BotTreeView(bot);
}
public BotGefFormDiagramEditor activeFormDiagramEditor() {
bot.waitUntil(new DefaultCondition() {
@Override
public boolean test() throws Exception {
final String id = BotProcessDiagramPerspective.this.bot.activeEditor().getReference().getId();
return FORM_ID.equals(id) || FORM_EX_ID.equals(id);
}
@Override
public String getFailureMessage() {
return "No active form editor. Active editor id = "
+ BotProcessDiagramPerspective.this.bot.activeEditor().getReference().getId();
}
});
return new BotGefFormDiagramEditor(bot);
}
public void closeActiveDiagram() {
BotProcessDiagramPerspective.this.bot.activeEditor().close();
}
......
......@@ -16,14 +16,18 @@ package org.bonitasoft.studio.swtbot.framework.projectExplorer;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.swtbot.framework.BotBase;
import org.bonitasoft.studio.swtbot.framework.bdm.DefineBdmWizardBot;
import org.bonitasoft.studio.swtbot.framework.diagram.BotProcessDiagramPerspective;
import org.bonitasoft.studio.swtbot.framework.organization.BotManageOrganizationWizard;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.bdm.BDMProjectExplorerBot;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.diagram.DiagramProjectExplorerBot;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.la.LivingApplicationProjectExplorerBot;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.organization.OrganizationProjectExplorerBot;
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.exceptions.WidgetNotFoundException;
......@@ -38,6 +42,16 @@ public class ProjectExplorerBot extends BotBase {
public ProjectExplorerBot(SWTGefBot bot) {
super(bot);
projectName = RepositoryManager.getInstance().getCurrentRepository().getName();
showExplorerView();
}
public void showExplorerView() {
SWTBotView explorerView = bot.viewById("org.bonitasoft.studio.application.project.explorer");
if (explorerView == null) {
throw new IllegalStateException("Project explorer view is not present");
}
explorerView.show();
explorerView.setFocus();
}
public BotManageOrganizationWizard newOrganization() {
......@@ -60,6 +74,13 @@ public class ProjectExplorerBot extends BotBase {
projectTreeItem.contextMenu().menu("New").menu("Application descriptor").click();
}
public BotProcessDiagramPerspective newDiagram() {
SWTBotTreeItem projectTreeItem = getProjectTreeItem();
bot.waitUntil(contextMenuAvailable(projectTreeItem, "New"));
projectTreeItem.contextMenu().menu("New").menu("Diagram").click();
return new BotProcessDiagramPerspective(bot);
}
public OrganizationProjectExplorerBot organization() {
return new OrganizationProjectExplorerBot(bot);
}
......@@ -72,6 +93,10 @@ public class ProjectExplorerBot extends BotBase {
return new LivingApplicationProjectExplorerBot(bot);
}
public DiagramProjectExplorerBot diagram() {
return new DiagramProjectExplorerBot(bot);
}
public SWTBotTreeItem getProjectTreeItem() {
return getProjectExplorerTree().getTreeItem(projectName);
}
......@@ -91,7 +116,7 @@ public class ProjectExplorerBot extends BotBase {
return bot.treeWithId("org.bonitasoft.studio.application.projectExplorerTree");
}
protected ICondition nodeAvailable(SWTBotTreeItem item, String node) {
public ICondition nodeAvailable(SWTBotTreeItem item, String node) {
return new ICondition() {
@Override
......@@ -115,7 +140,7 @@ public class ProjectExplorerBot extends BotBase {
};
}
protected ICondition contextMenuAvailable(SWTBotTreeItem item, String menu) {
public ICondition contextMenuAvailable(SWTBotTreeItem item, String menu) {
return new ICondition() {
private List<String> menuItems;
......@@ -137,12 +162,14 @@ public class ProjectExplorerBot extends BotBase {
};
}
public void waitUntilActiveEditorTitleIs(String title) {
public void waitUntilActiveEditorTitleIs(String title, Optional<String> extension) {
bot.waitUntil(new ICondition() {
String expectedTitle = extension.isPresent() ? title + extension.get() : title;
@Override
public boolean test() throws Exception {
return Objects.equals(bot.activeEditor().getTitle(), title + ".xml");
return Objects.equals(bot.activeEditor().getTitle(), expectedTitle);
}
@Override
......@@ -152,7 +179,7 @@ public class ProjectExplorerBot extends BotBase {
@Override
public String getFailureMessage() {
String actualTitle = bot.activeEditor().getTitle();
return String.format("The active editor title should be %s instead of %s", title + ".xml", actualTitle);
return String.format("The active editor title should be %s instead of %s", expectedTitle, actualTitle);
}
});
}
......
/**
* 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.diagram;
import org.bonitasoft.studio.swtbot.framework.diagram.BotProcessDiagramPerspective;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.ProjectExplorerBot;
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.SWTBotText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@SuppressWarnings("restriction")
public class DiagramProjectExplorerBot extends ProjectExplorerBot {
public DiagramProjectExplorerBot(SWTGefBot bot) {
super(bot);
}
@Override
public BotProcessDiagramPerspective newDiagram() {
clickOnContextualMenu(getDiagramFolderTreeItem(), "New");
return new BotProcessDiagramPerspective(bot);
}
public BotProcessDiagramPerspective openDiagram(String diagramName, String version) {
clickOnContextualMenu(getDiagramTreeItem(diagramName, version), "Open");
return new BotProcessDiagramPerspective(bot);
}
/**
* Duplicate a diagram. The behavior is to add '-copy' at the end of the original name.
* WARNING: It doesn't work if the diagram to duplicate has several pools (pool Text have all the same id..)
*/
public void duplicateDiagram(String diagramName, String version) {
clickOnContextualMenu(getDiagramTreeItem(diagramName, version), "Duplicate...");
bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.common.Messages.openNameAndVersionDialogTitle));
SWTBotShell activeShell = bot.activeShell();
activeShell.setFocus();
bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.name.text").setText(diagramName + "-copy");
SWTBotText poolText = bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.poolName.text");
poolText.setText(poolText.getText() + "-copy");
bot.button(IDialogConstants.OK_LABEL).click();
bot.waitUntil(Conditions.shellCloses(activeShell));
}
public void renameDiagram(String oldDiagramName, String newDiagramName, String version, String newPoolName) {
clickOnContextualMenu(getDiagramTreeItem(oldDiagramName, version), "Rename...");
bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.common.Messages.openNameAndVersionDialogTitle));
SWTBotShell activeShell = bot.activeShell();
activeShell.setFocus();
bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.name.text").setText(newDiagramName);
bot.textWithId("org.bonitasoft.studio.common.diagram.dialog.poolName.text").setText(newPoolName);
bot.button(IDialogConstants.OK_LABEL).click();
bot.waitUntil(Conditions.shellCloses(activeShell));
}
public void deleteDiagram(String diagramName, String version) {
clickOnContextualMenu(getDiagramTreeItem(diagramName, version), "Delete");
}
public void deploy(String diagramName, String version) {
clickOnContextualMenu(getDiagramTreeItem(diagramName, version), "Deploy");
bot.waitUntil(Conditions.shellIsActive(org.bonitasoft.studio.engine.i18n.Messages.deployDoneTitle));
SWTBotShell activeShell = bot.activeShell();
activeShell.setFocus();
bot.button(IDialogConstants.OK_LABEL).click();
bot.waitUntil(Conditions.shellCloses(activeShell));
}
private SWTBotTreeItem getDiagramFolderTreeItem() {
return getTreeItem(getProjectTreeItem(), "Diagrams");
}
public SWTBotTreeItem getDiagramTreeItem(String diagramName, String version) {
SWTBotTreeItem diagramFolderTreeItem = getDiagramFolderTreeItem();
return getTreeItem(diagramFolderTreeItem, getDiagramFilename(diagramName, version));
}
private String getDiagramFilename(String diagram, String version) {
return String.format("%s-%s.proc", diagram, version);
}
}
......@@ -73,6 +73,7 @@ import org.bonitasoft.studio.tests.expressionEditor.TestPatternExpressionViewer;
import org.bonitasoft.studio.tests.iteration.MultiInstantiationIT;
import org.bonitasoft.studio.tests.processzoo.examples.TestWebPurchase;
import org.bonitasoft.studio.tests.projectExplorer.ProjectExplorerBdmIT;
import org.bonitasoft.studio.tests.projectExplorer.ProjectExplorerDiagramIT;
import org.bonitasoft.studio.tests.projectExplorer.ProjectExplorerLivingApplicationIT;
import org.bonitasoft.studio.tests.projectExplorer.ProjectExplorerOrganizationIT;
import org.bonitasoft.studio.tests.properties.CallActivityMappingIT;
......@@ -86,6 +87,10 @@ import org.junit.runners.Suite;
@RunWith(BonitaSuite.class)
@Suite.SuiteClasses({
ProjectExplorerDiagramIT.class,
ProjectExplorerOrganizationIT.class,
ProjectExplorerBdmIT.class,
ProjectExplorerLivingApplicationIT.class,
DiagramTests.class,
OpenExistingApplicationIT.class,
TestMenus.class,
......@@ -149,9 +154,6 @@ import org.junit.runners.Suite;
BPMNGatewayExportImportTest.class,
BPMNEventSubProcessExportImportTest.class,
OrganizationCreationTest.class,
ProjectExplorerOrganizationIT.class,
ProjectExplorerBdmIT.class,
ProjectExplorerLivingApplicationIT.class
})
public class SWTBotTestSuite {
......
......@@ -16,11 +16,18 @@ package org.bonitasoft.studio.tests.applicationDescriptor;
import static org.junit.Assert.assertEquals;
import java.util.List;
import java.util.stream.Collectors;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.la.LivingApplicationPlugin;
import org.bonitasoft.studio.la.application.handler.NewApplicationHandler;
import org.bonitasoft.studio.la.application.repository.ApplicationFileStore;
import org.bonitasoft.studio.la.application.repository.ApplicationRepositoryStore;
import org.bonitasoft.studio.swtbot.framework.application.BotApplicationWorkbenchWindow;
import org.bonitasoft.studio.swtbot.framework.la.OpenApplicationWizardBot;
import org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule;
import org.bonitasoft.studio.ui.util.StringIncrementer;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
......@@ -35,12 +42,15 @@ public class OpenExistingApplicationIT {
private final SWTGefBot bot = new SWTGefBot();
private boolean initPref;
private RepositoryAccessor repositoryAccessor;
@Rule
public SWTGefBotRule botRule = new SWTGefBotRule(bot);
@Before
public void init() {
repositoryAccessor = new RepositoryAccessor();
repositoryAccessor.init();
initPref = LivingApplicationPlugin.getDefault().getPreferenceStore()
.getBoolean(NewApplicationHandler.DO_NOT_SHOW_HELP_MESSAGE_DIALOG);
LivingApplicationPlugin.getDefault().getPreferenceStore()
......@@ -56,44 +66,52 @@ public class OpenExistingApplicationIT {
@Test
public void should_create_and_open_applications() {
final BotApplicationWorkbenchWindow workBenchBot = new BotApplicationWorkbenchWindow(bot);
createApplications(workBenchBot);
String applicationName1 = createApplication(workBenchBot);
String applicationName2 = createApplication(workBenchBot);
workBenchBot.openApplication().select(NewApplicationHandler.DEFAULT_FILE_NAME + ".xml").finish();
workBenchBot.openApplication().select(applicationName1 + ".xml").finish();
final SWTBotEditor app1Editor = bot.activeEditor();
assertEquals(NewApplicationHandler.DEFAULT_FILE_NAME + ".xml", app1Editor.getTitle());
assertEquals(applicationName1 + ".xml", app1Editor.getTitle());
app1Editor.close();
workBenchBot.openApplication()
.select(NewApplicationHandler.DEFAULT_FILE_NAME + ".xml", NewApplicationHandler.DEFAULT_FILE_NAME + "1.xml")
.select(applicationName1 + ".xml", applicationName2 + ".xml")
.finish();
assertEquals(2, bot.editors().size());
deleteApplications(workBenchBot);
deleteApplications(workBenchBot, applicationName1 + ".xml", applicationName2 + ".xml");
}
@Test
public void should_rename_file_using_open_menu() {
final BotApplicationWorkbenchWindow workBenchBot = new BotApplicationWorkbenchWindow(bot);
workBenchBot.newApplicationDescriptorFile();
String appName = createApplication(workBenchBot);
OpenApplicationWizardBot openApplicationWizardBot = workBenchBot.openApplication();
openApplicationWizardBot.select(NewApplicationHandler.DEFAULT_FILE_NAME + ".xml");
openApplicationWizardBot.select(appName + ".xml");
openApplicationWizardBot.rename("custom_name").select("custom_name.xml").finish();
workBenchBot.deleteApplicationDescriptor()
.select("custom_name.xml")
.delete();
}
private void deleteApplications(BotApplicationWorkbenchWindow workBenchBot) {
private void deleteApplications(BotApplicationWorkbenchWindow workBenchBot, String... applications) {
workBenchBot.deleteApplicationDescriptor()
.select(NewApplicationHandler.DEFAULT_FILE_NAME + ".xml", NewApplicationHandler.DEFAULT_FILE_NAME + "1.xml")
.select(applications)
.delete();
}
private void createApplications(BotApplicationWorkbenchWindow workBenchBot) {
private String createApplication(BotApplicationWorkbenchWindow workBenchBot) {
String newName = findNewApplicationName();
workBenchBot.newApplicationDescriptorFile();
bot.activeEditor().close();
return newName;
}
workBenchBot.newApplicationDescriptorFile();
bot.activeEditor().close();
private String findNewApplicationName() {
List<String> existingApplicationNameList = repositoryAccessor.getRepositoryStore(ApplicationRepositoryStore.class)
.getChildren().stream().map(ApplicationFileStore::getDisplayName).collect(Collectors.toList());
String newName = StringIncrementer.getIncrementedString(NewApplicationHandler.DEFAULT_FILE_NAME,
existingApplicationNameList);
return newName;
}
}
......@@ -17,19 +17,15 @@ package org.bonitasoft.studio.tests.projectExplorer;
import static org.assertj.core.api.Assertions.assertThat;
import org.bonitasoft.engine.bdm.model.field.FieldType;
import org.bonitasoft.engine.session.APISession;
import org.bonitasoft.studio.businessobject.core.repository.BusinessObjectModelRepositoryStore;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.engine.BOSEngineManager;
import org.bonitasoft.studio.swtbot.framework.bdm.DefineBdmWizardBot;
import org.bonitasoft.studio.swtbot.framework.projectExplorer.ProjectExplorerBot;
import org.bonitasoft.studio.swtbot.framework.rule.SWTGefBotRule;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -38,32 +34,17 @@ import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
public class ProjectExplorerBdmIT {
private static BOSEngineManager engineManager;
private static APISession session;
private SWTGefBot bot = new SWTGefBot();
private RepositoryAccessor repositoryAccessor;
@Rule
public SWTGefBotRule botRule = new SWTGefBotRule(bot);
@BeforeClass
public static void init() throws Exception {
engineManager = BOSEngineManager.getInstance();
session = engineManager.loginDefaultTenant(new NullProgressMonitor());
}
@AfterClass
public static void resetPreference() {
if (session != null) {
engineManager.logoutDefaultTenant(session);
}
}
@Before
public void initRepository() throws Exception {