Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus')
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractModelCreation.java275
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java94
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractQuickIndexCreationTest.java55
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractUniqueIndexCreationTest.java55
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOPapyrusModelCreation.java210
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOQuickIndexCreationTest.java53
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOUniqueIndexCreationTest.java50
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelper.java146
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelperMerger.java164
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/IPapyrusModelCreation.java70
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ModelConstructor.java177
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PapyrusModelCreation.java69
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusQuickIndexCreationTest.java53
-rwxr-xr-xcdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusUniqueIndexCreationTest.java53
14 files changed, 1524 insertions, 0 deletions
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractModelCreation.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractModelCreation.java
new file mode 100755
index 00000000..b0adadd0
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractModelCreation.java
@@ -0,0 +1,275 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.papyrus.infra.architecture.ArchitectureDescriptionUtils;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceMultiException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.uml.diagram.wizards.command.NewPapyrusModelCommand;
+import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
+import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
+import org.eclipse.papyrus.uml.tools.commands.ApplyProfileCommand;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @author VL222926
+ *
+ */
+public abstract class AbstractModelCreation implements IPapyrusModelCreation {
+
+
+ protected ServicesRegistry servicesRegistry;
+
+ protected ModelSet modelSet;
+
+
+ public ModelSet getModelSet() {
+ return this.modelSet;
+ }
+
+ private URI diURi = null;
+
+ private Resource umlResource;
+
+ private Model rootModel;
+
+ private List<String> profilesToApply;
+
+ protected void createModelSet(final String folderName, final String modelName, final List<String> profilesToApply) throws IOException, ServiceException {
+ if (null == profilesToApply) {
+ this.profilesToApply = Collections.emptyList();
+ } else {
+ this.profilesToApply = profilesToApply;
+ }
+ servicesRegistry = createServicesRegistry();
+ Assert.isNotNull(servicesRegistry);
+
+
+ this.modelSet = servicesRegistry.getService(ModelSet.class);
+ Assert.isNotNull(this.modelSet);
+
+
+
+ diURi = createBaseURI();
+ if (null == diURi) {
+ diURi = URI.createPlatformResourceURI(folderName, true);
+ } else {
+ diURi = diURi.appendSegment(folderName);
+ }
+ diURi = diURi.appendSegment(modelName);
+ diURi = diURi.appendFileExtension(DiModel.MODEL_FILE_EXTENSION);
+
+ RecordingCommand command = new NewPapyrusModelCommand(this.modelSet, diURi);
+
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(command);
+ modelSet.save(new NullProgressMonitor());
+ final URI umlURi = diURi.trimFileExtension().appendFileExtension("uml");
+ umlResource = modelSet.getResource(umlURi, true);
+
+
+ // create the architecture context
+ ArchitectureDescriptionUtils helper = new ArchitectureDescriptionUtils(modelSet);
+
+
+ final String contextId;
+ final List<String> viewpointsIds = new ArrayList<String>();
+ if (profilesToApply.contains("SysML 1.4")) {
+ contextId = "org.eclipse.papyrus.sysml.architecture.SysML14";
+ viewpointsIds.add("org.eclipse.papyrus.sysml14.standard.modeling");
+ } else {
+ // we assume we are in pure UML
+ contextId = "org.eclipse.papyrus.infra.services.edit.TypeContext";
+ viewpointsIds.add("org.eclipse.papyrus.uml.analysis");
+ viewpointsIds.add("org.eclipse.papyrus.uml.design");
+ }
+ // CompoundCommand cc = new CompoundCommand();
+ // final Command cmd1 = helper.switchArchitectureContextId(contextId);
+ // cc.append(cmd1);
+ String[] stringsViewPointIds = new String[viewpointsIds.size()];
+ stringsViewPointIds = viewpointsIds.toArray(stringsViewPointIds);
+ // final Command cmd2 = helper.switchArchitectureViewpointIds(stringsViewPointIds);
+ // cc.append(cmd2);
+
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(helper.createNewModel(contextId, stringsViewPointIds));
+ modelSet.save(new NullProgressMonitor());
+
+
+ Assert.isNotNull(umlResource);
+ final Model model = (Model) umlResource.getContents().get(0);
+ // UMLFactory.eINSTANCE.createModel();
+ // model.setName(modelName);
+
+ RecordingCommand rc = new RecordingCommand(modelSet.getTransactionalEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ model.setName(modelName);
+ // umlResource.getContents().add(model);
+ }
+ };
+
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(rc);
+ rootModel = model;
+ initServicesRegistry(servicesRegistry);// we need to have a root in the model to init it!?!?
+
+
+ modelSet.save(new NullProgressMonitor());
+ if (this.profilesToApply.size() > 0) {
+ applyRequiredProfilesFromName(getProfilesToApply());
+ modelSet.save(new NullProgressMonitor());
+ }
+
+
+ }
+
+ protected void createModelSet(final String folderName, final String modelName) throws IOException, ServiceException {
+ createModelSet(folderName, modelName, Collections.<String> emptyList());
+
+ }
+
+ protected void applyRequiredProfilesFromName(final List<String> profileNames) {
+ if (profileNames.size() >= 0) {
+ final List<Profile> profilesToApply = new ArrayList<Profile>();
+ for (final String current : profileNames) {
+ IRegisteredProfile profile = RegisteredProfile.getRegisteredProfile(current);
+ org.junit.Assert.assertNotNull(profile);
+ URI uri = profile.getUri();
+ Resource resource = modelSet.getResource(uri, true);
+ Profile profileToApply = (Profile) resource.getContents().get(0);
+ org.junit.Assert.assertNotNull(profileToApply);
+ profilesToApply.add(profileToApply);
+ }
+ applyRequiredProfiles(profilesToApply);
+ }
+ }
+
+ protected void applyRequiredProfiles(final List<Profile> profiles) {
+ if (profiles.size() > 0) {
+ final CompoundCommand cc = new CompoundCommand("Apply Profiles");
+ for (Profile current : profiles) {
+ cc.append(new ApplyProfileCommand(rootModel, current, modelSet.getTransactionalEditingDomain()));
+ }
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(cc);
+ org.junit.Assert.assertTrue(profiles.size() <= rootModel.getAppliedProfiles().size());
+ }
+ }
+
+ protected List<String> getProfilesToApply() {
+ return this.profilesToApply;
+ }
+
+ /**
+ * @throws ServiceMultiException
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.IPapyrusModelCreation#disposeAll()
+ *
+ */
+ @Override
+ public void disposeAll() throws ServiceMultiException {
+ this.modelSet.unload();
+ this.modelSet = null;
+ this.servicesRegistry.disposeRegistry();
+ this.servicesRegistry = null;
+ }
+
+ /**
+ * @return
+ */
+ protected abstract URI createBaseURI();
+
+ /**
+ *
+ *
+ * TODO : duplicated code from CreateModelWizard
+ *
+ *
+ * @return
+ */
+ protected ServicesRegistry createServicesRegistry() {
+ ServicesRegistry result = null;
+
+ try {
+ result = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ } catch (ServiceException e) {
+ // couldn't create the registry? Fatal problem
+ // Activator.log.error(e); //TODO
+ }
+
+ try {
+ // have to create the model set and populate it with the DI model
+ // before initializing other services that actually need the DI
+ // model, such as the SashModel Manager service
+ result.startServicesByClassKeys(ModelSet.class);
+ } catch (ServiceException ex) {
+ // Ignore this exception: some services may not have been loaded,
+ // which is probably normal at this point
+ }
+
+ return result;
+ }
+
+ /**
+ *
+ *
+ * TODO : duplicated code from CreateModelWizard
+ *
+ *
+ * @return
+ */
+ protected void initServicesRegistry(ServicesRegistry registry) throws ServiceException {
+ try {
+ registry.startRegistry();
+ } catch (ServiceException ex) {
+ // Ignore this exception: some services may not have been loaded,
+ // which is probably normal at this point
+ }
+
+ registry.getService(IPageManager.class);
+ }
+
+ public ServicesRegistry getServicesRegistry() {
+ return this.servicesRegistry;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.IPapyrusModelCreation#getModelRoot()
+ *
+ * @return
+ */
+ @Override
+ public Model getModelRoot() {
+ return this.rootModel;
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java
new file mode 100755
index 00000000..43cf7f5a
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.sysml14.service.types.util.SysMLServiceTypeUtil;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author VL222926
+ *
+ */
+public abstract class AbstractPerfTest extends AbstractPapyrusTest {
+
+
+
+
+ protected void runCreation(List<String> profilesToApply, IHintedType elementTypeToCreate, final int nbElementsToCreate) throws Exception {
+ IPapyrusModelCreation helper = createPapyrusModelCreation();
+ if(null==profilesToApply) {
+ profilesToApply = Collections.<String>emptyList();
+ }
+ final ExecutionTimeHelper timeHelper = createTimeExecutionHelper(nbElementsToCreate, elementTypeToCreate);
+ ModelConstructor<IPapyrusModelCreation> test = new ModelConstructor<IPapyrusModelCreation>(helper, timeHelper);
+ test.createElementsInModel(Long.toString(System.currentTimeMillis()), nbElementsToCreate, elementTypeToCreate, profilesToApply);
+ timeHelper.toString();
+ }
+
+ protected abstract IPapyrusModelCreation createPapyrusModelCreation();
+
+ protected abstract ExecutionTimeHelper createTimeExecutionHelper(final int nbElementsToCreate, IHintedType elementType);
+
+
+//
+// @Test
+// public void create_100_Classes() throws Exception {
+// runCreation(null, UMLElementTypes.CLASS, 100);
+// }
+//
+// @Test
+// public void create_1000_Classes() throws Exception {
+// runCreation(null, UMLElementTypes.CLASS, 1000);
+// }
+
+ @Test
+ public void create_10000_Classes() throws Exception {
+ runCreation(null, UMLElementTypes.CLASS, 10000);
+ }
+
+
+// @Test
+// public void create_1000_Blocks() throws Exception {
+// Object value = ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_BLOCK);
+// Assert.assertTrue(value instanceof IHintedType);
+// runCreation(Collections.<String> singletonList("SysML 1.4"), (IHintedType) value, 1000);
+// }
+
+ @Test
+ public void create_10000_Blocks() throws Exception {
+ Object value = ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_BLOCK);
+ Assert.assertTrue(value instanceof IHintedType);
+ runCreation(Collections.<String> singletonList("SysML 1.4"), (IHintedType) value, 10000);
+ }
+
+// @Test
+// public void create_50000_Blocks() throws Exception {
+// Object value = ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_BLOCK);
+// Assert.assertTrue(value instanceof IHintedType);
+// runCreation(Collections.<String> singletonList("SysML 1.4"), (IHintedType) value, 50000);
+// }
+
+
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractQuickIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractQuickIndexCreationTest.java
new file mode 100755
index 00000000..0aa91cb0
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractQuickIndexCreationTest.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry;
+import org.eclipse.papyrus.uml.tools.utils.internal.preferences.NameElementNamingStrategyPreferenceInitializer;
+import org.eclipse.papyrus.uml.tools.utils.internal.preferences.NamedElementIndexNamingStrategyEnum;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+
+/**
+ * @author VL222926
+ *
+ */
+public abstract class AbstractQuickIndexCreationTest extends AbstractPerfTest {
+
+ protected static final ExecutionTimeHelperMerger merger = new ExecutionTimeHelperMerger("Time for creation with quick index");
+
+ @BeforeClass
+ public static final void initTest() {
+ // we need to initialize it before usingUMLElementTypes.CLASS, because, it is Papyrus that fills the GMF registry used by UMLElementTypes.CLASS.
+ // without doing that, the value will be null
+ ElementTypeSetConfigurationRegistry.getInstance();
+
+ IPreferenceStore store = org.eclipse.papyrus.uml.tools.utils.Activator.getDefault().getPreferenceStore();
+ store.setValue(NameElementNamingStrategyPreferenceInitializer.NAMED_ELEMENT_INDEX_INITIALIZATION, NamedElementIndexNamingStrategyEnum.QUICK_INDEX_INITIALIZATION.toString());
+ }
+
+
+ @AfterClass
+ public static final void endTest() {
+ IPreferenceStore store = org.eclipse.papyrus.uml.tools.utils.Activator.getDefault().getPreferenceStore();
+ store.setToDefault(NameElementNamingStrategyPreferenceInitializer.NAMED_ELEMENT_INDEX_INITIALIZATION);
+
+ if (merger.isFull()) {
+ System.out.println(merger.toString());
+ }
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractUniqueIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractUniqueIndexCreationTest.java
new file mode 100755
index 00000000..1d6501dc
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractUniqueIndexCreationTest.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry;
+import org.eclipse.papyrus.uml.tools.utils.internal.preferences.NameElementNamingStrategyPreferenceInitializer;
+import org.eclipse.papyrus.uml.tools.utils.internal.preferences.NamedElementIndexNamingStrategyEnum;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+
+/**
+ * @author VL222926
+ *
+ */
+public abstract class AbstractUniqueIndexCreationTest extends AbstractPerfTest {
+
+ protected static final ExecutionTimeHelperMerger merger = new ExecutionTimeHelperMerger("Time for creation with unique index");
+
+
+ @BeforeClass
+ public static final void initTest() {
+
+ // we need to initialize it before usingUMLElementTypes.CLASS, because, it is Papyrus that fills the GMF registry used by UMLElementTypes.CLASS.
+ // without doing that, the value will be null
+ ElementTypeSetConfigurationRegistry.getInstance();
+ IPreferenceStore store = org.eclipse.papyrus.uml.tools.utils.Activator.getDefault().getPreferenceStore();
+ store.setValue(NameElementNamingStrategyPreferenceInitializer.NAMED_ELEMENT_INDEX_INITIALIZATION, NamedElementIndexNamingStrategyEnum.UNIQUE_INDEX_INITIALIZATION.toString());
+ }
+
+
+ @AfterClass
+ public static final void endTest() {
+ IPreferenceStore store = org.eclipse.papyrus.uml.tools.utils.Activator.getDefault().getPreferenceStore();
+ store.setToDefault(NameElementNamingStrategyPreferenceInitializer.NAMED_ELEMENT_INDEX_INITIALIZATION);
+ if (merger.isFull()) {
+ System.out.println(merger.toString());
+ }
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOPapyrusModelCreation.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOPapyrusModelCreation.java
new file mode 100755
index 00000000..c07e9b14
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOPapyrusModelCreation.java
@@ -0,0 +1,210 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
+import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
+import org.eclipse.emf.cdo.internal.explorer.AbstractElement;
+import org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutImpl;
+import org.eclipse.emf.cdo.internal.explorer.repositories.CDORepositoryImpl;
+import org.eclipse.emf.cdo.internal.explorer.repositories.RemoteCDORepository;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.tcp.TCPUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.security.IPasswordCredentialsProvider;
+import org.eclipse.net4j.util.security.PasswordCredentialsProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceMultiException;
+
+/**
+ * @author VL222926
+ *
+ */
+public class CDOPapyrusModelCreation extends AbstractModelCreation {
+
+ private static final String HOST_AND_PORT = "localhost:2036";
+
+ private static final String USER_NAME = "Administrator";
+
+ private static final String PASSWORD = "0000";
+
+
+ private CDOSession session;
+ private CDOCheckout checkout;
+ private CDORepository repository;
+ private CDOTransaction transaction;
+
+ final String PAPYRUS_CDO_SECURED_REPOSITORY = "PapyrusCDOSecuredRepository";
+
+
+
+ public final void connect() throws Exception {
+ connect(getHostAndPort(), getUser(), getPassword());
+ }
+
+ /**
+ * @return
+ */
+ private String getPassword() {
+ return PASSWORD;
+ }
+
+ /**
+ * @return
+ */
+ private String getUser() {
+ return USER_NAME;
+ }
+
+ /**
+ * @return
+ */
+ private String getHostAndPort() {
+ return HOST_AND_PORT;
+ }
+
+ private void connect(final String serverURI, final String login, final String password) throws Exception {
+ try {
+ // Prepare container
+ final IManagedContainer container = ContainerUtil.createContainer();
+ Net4jUtil.prepareContainer(container); // Register Net4j factories
+ TCPUtil.prepareContainer(container); // Register TCP factories
+ CDONet4jUtil.prepareContainer(container); // Register CDO factories
+ container.activate();
+
+ // Create connector
+ final IConnector connector = TCPUtil.getConnector(container, serverURI);
+
+ // Create configuration
+ final CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
+ configuration.setConnector(connector);
+ configuration.setRepositoryName(PAPYRUS_CDO_SECURED_REPOSITORY);
+ final IPasswordCredentialsProvider credentialsProvider = new PasswordCredentialsProvider(login, password);
+ configuration.setCredentialsProvider(credentialsProvider);
+
+ final Properties properties = new Properties();
+
+ properties.setProperty(AbstractElement.PROP_TYPE, CDORepository.TYPE_REMOTE);
+ properties.setProperty(AbstractElement.PROP_LABEL, PAPYRUS_CDO_SECURED_REPOSITORY);
+ properties.setProperty(CDORepositoryImpl.PROP_NAME, PAPYRUS_CDO_SECURED_REPOSITORY);
+ properties.setProperty(RemoteCDORepository.PROP_CONNECTOR_TYPE, "tcp"); //$NON-NLS-1$
+ // TODO : is it serverURI?
+ properties.setProperty(RemoteCDORepository.PROP_CONNECTOR_DESCRIPTION, serverURI);
+
+ repository = CDOExplorerUtil.getRepositoryManager().addRepository(properties, credentialsProvider.getCredentials());
+ repository.connect();
+
+ // Open session
+ session = configuration.openNet4jSession();
+
+ this.checkout = createCheckout("PapyrusPerfoTestCheckout"); //$NON-NLS-1$
+
+
+ } catch (final Exception e) {
+ throw e;
+ }
+
+ }
+
+ private CDOCheckout createCheckout(final String checkoutName) {
+ final Properties properties = new Properties();
+ properties.setProperty(AbstractElement.PROP_TYPE, CDOCheckout.TYPE_ONLINE_HISTORICAL);
+ properties.setProperty(AbstractElement.PROP_LABEL, checkoutName);
+ properties.setProperty(CDOCheckoutImpl.PROP_REPOSITORY, this.repository.getID());
+ properties.setProperty(CDOCheckoutImpl.PROP_BRANCH_ID, Integer.toString(CDOBranch.MAIN_BRANCH_ID));
+ properties.setProperty(CDOCheckoutImpl.PROP_TIME_STAMP, Long.toString(CDOBranchPoint.UNSPECIFIED_DATE));
+ properties.setProperty(CDOCheckoutImpl.PROP_READ_ONLY, Boolean.toString(false));
+
+ final CDOCheckout checkout = CDOExplorerUtil.getCheckoutManager().addCheckout(properties);
+ checkout.open();
+ return checkout;
+ }
+
+ /**
+ * Gets the running session.
+ *
+ * @return the running session
+ */
+ protected CDOSession getSession() {
+ return this.session;
+ }
+
+
+
+ public CDOTransaction getOpenTransaction() {
+ if (transaction != null) {
+ return transaction;
+ }
+
+ transaction = session.openTransaction(this.modelSet);
+
+
+ return transaction;
+ }
+
+
+ public void closeTransaction() {
+ if (null != this.transaction) {
+ this.transaction.close();
+ }
+ transaction = null;// TODO : probably missing in QS
+ }
+
+
+ /**
+ * @see org.eclipse.papyrus.cdo.perfo.tests.impl.IPapyrusModelCreation#initPapyrusEnvironnement(java.lang.String, java.lang.String, List<String>)
+ *
+ * @param folderName
+ * @param modelName
+ * @throws Exception
+ */
+ @Override
+ public void initPapyrusEnvironnement(final String folderName, final String modelName, final List<String> profilesName) throws Exception {
+ connect();
+ createModelSet(folderName, modelName, profilesName);
+ }
+
+
+ protected URI createBaseURI() {
+ URI uri = URI.createURI("cdo.checkout://1/home");
+ return uri.appendSegment(getUser());
+
+ }
+
+ /**
+ * @throws ServiceMultiException
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.IPapyrusModelCreation#disposeAll()
+ *
+ */
+ @Override
+ public void disposeAll() throws ServiceMultiException {
+ closeTransaction();
+ super.disposeAll();
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOQuickIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOQuickIndexCreationTest.java
new file mode 100755
index 00000000..d500cdce
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOQuickIndexCreationTest.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+
+/**
+ * @author VL222926
+ *
+ */
+public class CDOQuickIndexCreationTest extends AbstractQuickIndexCreationTest {
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createPapyrusModelCreation()
+ *
+ * @return
+ */
+ @Override
+ protected IPapyrusModelCreation createPapyrusModelCreation() {
+ return new CDOPapyrusModelCreation();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createTimeExecutionHelper(int, IHintedType)
+ *
+ * @param nbClasses
+ * @return
+ */
+ @Override
+ protected ExecutionTimeHelper createTimeExecutionHelper(int nbClasses, IHintedType elementType) {
+ final String id = elementType.getId();
+ ExecutionTimeHelper helper = new ExecutionTimeHelper("CDO Project: Create " + nbClasses + " " + id + " with quick Index.", ExecutionTimeHelper.CDO_TYPE, nbClasses, id);
+ merger.addTimeHelper(helper);
+ return helper;
+ }
+
+
+
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOUniqueIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOUniqueIndexCreationTest.java
new file mode 100755
index 00000000..55739ab6
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/CDOUniqueIndexCreationTest.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+
+/**
+ * @author VL222926
+ *
+ */
+public class CDOUniqueIndexCreationTest extends AbstractUniqueIndexCreationTest {
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createPapyrusModelCreation()
+ *
+ * @return
+ */
+ @Override
+ protected IPapyrusModelCreation createPapyrusModelCreation() {
+ return new CDOPapyrusModelCreation();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createTimeExecutionHelper(int, IHintedType)
+ *
+ * @param nbClasses
+ * @return
+ */
+ @Override
+ protected ExecutionTimeHelper createTimeExecutionHelper(int nbClasses, IHintedType elementType) {
+ final String id = elementType.getId();
+ ExecutionTimeHelper helper = new ExecutionTimeHelper("CDO Project: Create " + nbClasses + " " + id + " with Unique Index.", ExecutionTimeHelper.CDO_TYPE, nbClasses, id);
+ merger.addTimeHelper(helper);
+ return helper;
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelper.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelper.java
new file mode 100755
index 00000000..038e1168
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelper.java
@@ -0,0 +1,146 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.eclipse.osgi.framework.util.ArrayMap;
+import org.junit.Assert;
+
+/**
+ * @author VL222926
+ *
+ */
+public class ExecutionTimeHelper {
+
+ public static final String STEP_1 = "Step 1 : Creating Model Set";
+ public static final String STEP_2 = "Step 2 : Creating elements";
+ public static final String STEP_3 = "Step 3 : Saving the model";
+ public static final String STEP_4 = "Step 4 : Accessing Element";
+ public static final String STEP_5 = "Step 5 : Accessing 5 000th Element";
+ public static final String STEP_6 = "Step 6 : Get stereotype application on 5 000th Element";
+ public static final String STEP_7 = "Step 7 : Add 100 elements to the root of the resource";
+
+
+ public static final String CDO_TYPE = "CDO Type";
+
+ public static final String Papyrus_TYPE = "Papyrus Type";
+
+ private String title;
+
+ private String type;
+
+ private int nbElementToCreate;
+
+ private Map<String, List<Long>> count = new HashMap<String, List<Long>>();
+
+ private List<Long> currentList = null;
+
+ private static final String NEWLINE = "\n";
+
+ private String createdElement;
+
+ public String getElementType() {
+ return this.createdElement;
+ }
+
+ public ExecutionTimeHelper(final String title, final String type, final int nbElementToCreate, String createdElement) {
+ this.title = title;
+ this.type = type;
+ this.nbElementToCreate = nbElementToCreate;
+ this.createdElement = createdElement;
+ }
+
+ public void startCounting(final String step) {
+ Assert.assertNull("The stop method has not been called", currentList);
+ currentList = new LinkedList<Long>();
+ count.put(step, currentList);
+ currentList.add(System.currentTimeMillis());
+ }
+
+
+ public void top() {
+ currentList.add(System.currentTimeMillis());
+ }
+
+ public void stop() {
+ currentList.add(System.currentTimeMillis());
+ currentList = null;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("------");
+ builder.append(title);
+ builder.append("------");
+ builder.append(NEWLINE);
+ final Iterator<Entry<String, List<Long>>> iter = count.entrySet().iterator();
+ while (iter.hasNext()) {
+ final Entry<String, List<Long>> current = iter.next();
+ builder.append("# ");
+ builder.append(current.getKey());
+ builder.append(NEWLINE);
+ builder.append("## ");
+ for (int i = 0; i < current.getValue().size() - 1; i++) {
+ long diff = current.getValue().get(i + 1) - current.getValue().get(i);
+ builder.append(diff);
+ builder.append(NEWLINE);
+ }
+ builder.append(NEWLINE);
+ builder.append(NEWLINE);
+ }
+
+ return builder.toString();
+ }
+
+
+ public Map<String, List<Long>> getCount() {
+ return this.count;
+ }
+
+
+ public List<Long> getValuesForStep(final String step) {
+ return this.count.get(step);
+ }
+
+
+ /**
+ * @return
+ */
+ public int getNbCreation() {
+ return this.nbElementToCreate;
+ }
+
+}
+
+
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelperMerger.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelperMerger.java
new file mode 100755
index 00000000..7c7316e9
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ExecutionTimeHelperMerger.java
@@ -0,0 +1,164 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import junit.framework.Assert;
+
+/**
+ * @author VL222926
+ *
+ */
+public class ExecutionTimeHelperMerger {
+
+ private String testResultDescription;
+
+ public ExecutionTimeHelperMerger(final String testResultDescription) {
+ this.testResultDescription = testResultDescription;
+ }
+
+ // nb elements created, elementTypeID, execution
+ private Map<Integer, Map<String, List<ExecutionTimeHelper>>> timeHelperMap = new HashMap<Integer, Map<String, List<ExecutionTimeHelper>>>();
+
+
+
+ public void addTimeHelper(final ExecutionTimeHelper helper) {
+ int nbCreatedElement = helper.getNbCreation();
+ Map<String, List<ExecutionTimeHelper>> subMap = timeHelperMap.get(Integer.valueOf(nbCreatedElement));
+ if (null == subMap) {
+ subMap = new HashMap<String, List<ExecutionTimeHelper>>();
+ subMap.put(helper.getElementType(), new ArrayList<ExecutionTimeHelper>());
+ timeHelperMap.put(Integer.valueOf(nbCreatedElement), subMap);
+ }
+
+ List<ExecutionTimeHelper> helpers = subMap.get(helper.getElementType());
+ if (null == helpers) {
+ helpers = new ArrayList<ExecutionTimeHelper>();
+ subMap.put(helper.getElementType(), helpers);
+ }
+ helpers.add(helper);
+ }
+
+ public boolean isFull() {
+ final Iterator<Entry<Integer, Map<String, List<ExecutionTimeHelper>>>> iter = timeHelperMap.entrySet().iterator();
+ while (iter.hasNext()) {
+ final Entry<Integer, Map<String, List<ExecutionTimeHelper>>> current = iter.next();
+ final Map<String, List<ExecutionTimeHelper>> curr = current.getValue();
+ final Iterator<Entry<String, List<ExecutionTimeHelper>>> iter2 = curr.entrySet().iterator();
+ while (iter2.hasNext()) {
+ if (2 != iter2.next().getValue().size()) {
+ return false;
+ }
+ }
+
+ }
+ return true;
+ }
+
+
+ /**
+ * @see java.lang.Object#toString()
+ *
+ * @return
+ */
+ @Override
+ public String toString() {
+ final List<Integer> keys = new ArrayList<Integer>(timeHelperMap.keySet());
+ Collections.sort(keys);
+
+ final StringBuilder builder = new StringBuilder(testResultDescription);
+ builder.append("\n");
+ for (int i = 0; i < keys.size(); i++) {
+ ExecutionTimeHelper papyrusTimeHelper;
+ ExecutionTimeHelper CDOTimeHelper;
+ Map<String, List<ExecutionTimeHelper>> subMap = timeHelperMap.get(keys.get(i));
+ final Iterator<Entry<String, List<ExecutionTimeHelper>>> subIter = subMap.entrySet().iterator();
+ while (subIter.hasNext()) {
+ final Entry<String, List<ExecutionTimeHelper>> current = subIter.next();
+
+ List<ExecutionTimeHelper> helpers = current.getValue();
+ if (ExecutionTimeHelper.CDO_TYPE.equals(helpers.get(0).getType())) {
+ CDOTimeHelper = helpers.get(0);
+ papyrusTimeHelper = helpers.get(1);
+ } else {
+ CDOTimeHelper = helpers.get(1);
+ papyrusTimeHelper = helpers.get(0);
+ }
+
+
+ builder.append("Creating " + keys.get(i) + " " + current.getKey());
+ builder.append("\n");
+
+ builder.append(" ");
+ builder.append("\t");
+ builder.append(ExecutionTimeHelper.Papyrus_TYPE);
+ builder.append("\t");
+ builder.append(ExecutionTimeHelper.CDO_TYPE);
+ builder.append("\n");
+
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_1, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_2, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_3, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_4, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_5, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_6, papyrusTimeHelper, CDOTimeHelper));
+ builder.append(createStepsRows(ExecutionTimeHelper.STEP_7, papyrusTimeHelper, CDOTimeHelper));
+
+ }
+ }
+ return builder.toString();
+ }
+
+
+ private String createStepsRows(final String step, final ExecutionTimeHelper papyrusHelper, final ExecutionTimeHelper cdoHelper) {
+ final StringBuilder builder = new StringBuilder(step);
+ builder.append("\t");
+ builder.append(" ");
+ builder.append("\t");
+ builder.append(" ");
+ builder.append("\n");
+
+ builder.append(createValueList(papyrusHelper.getValuesForStep(step), cdoHelper.getValuesForStep(step)));
+ builder.append("\n");
+
+ return builder.toString();
+ }
+
+ private String createValueList(final List<Long> papyrusValues, final List<Long> cdoValues) {
+ if (papyrusValues != null && cdoValues != null) {
+ final StringBuilder builder = new StringBuilder();
+ org.junit.Assert.assertEquals(papyrusValues.size(), cdoValues.size());
+ for (int i = 0; i < papyrusValues.size() - 1; i++) {
+ builder.append(" ");
+ builder.append("\t");
+ builder.append(Long.valueOf(papyrusValues.get(i + 1) - papyrusValues.get(i)) + "ms");
+ builder.append("\t");
+ builder.append(Long.valueOf(cdoValues.get(i + 1) - cdoValues.get(i)) + "ms");
+ builder.append("\n");
+ }
+ return builder.toString();
+ }
+ return "";
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/IPapyrusModelCreation.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/IPapyrusModelCreation.java
new file mode 100755
index 00000000..1c86f498
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/IPapyrusModelCreation.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceMultiException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.uml2.uml.Model;
+
+/**
+ * @author VL222926
+ *
+ */
+public interface IPapyrusModelCreation {
+
+ /**
+ * This methods creates:
+ * <ul>
+ * <li>the Papyrus service registry</li>
+ * <li>the ModelSet</li>
+ * <li>all the required Papyrus files (uml, notation, di and others)</li>
+ *
+ * </ul>
+ *
+ * @param folderName
+ * the name of the folder where the files will be created
+ * @param modelName
+ * the name of the root model
+ * @param profilesName TODO
+ * @throws Exception
+ */
+ public void initPapyrusEnvironnement(final String folderName, final String modelName, List<String> profilesName) throws Exception;
+
+ /**
+ *
+ * @return
+ * the created {@link ModelSet} or <code>null</code>
+ */
+ public ModelSet getModelSet();
+
+ /**
+ *
+ * @return
+ * the created {@link ServicesRegistry} or <code>null</code>
+ */
+ public ServicesRegistry getServicesRegistry();
+
+ public void disposeAll() throws ServiceMultiException;
+
+ public Model getModelRoot();
+
+
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ModelConstructor.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ModelConstructor.java
new file mode 100755
index 00000000..14402ff6
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/ModelConstructor.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ * @author VL222926
+ *
+ */
+public class ModelConstructor<T extends IPapyrusModelCreation> {
+
+ private T creationHelper;
+
+ protected ExecutionTimeHelper timeHelper;
+
+ public ModelConstructor(final T creationHelper, final ExecutionTimeHelper timeHelper) {
+ this.creationHelper = creationHelper;
+ this.timeHelper = timeHelper;
+ }
+
+
+ /**
+ * r
+ *
+ * @param folderName
+ * @param nbElementsToCreate
+ * @param elementType
+ * @param profilesName
+ * @throws Exception
+ */
+ public void createElementsInModel(final String folderName, int nbElementsToCreate, IHintedType elementType, List<String> profilesName) throws Exception {
+
+ String modelName = Long.toString(System.currentTimeMillis());
+
+ // creating model set
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_1);
+ this.creationHelper.initPapyrusEnvironnement(folderName, modelName, profilesName);
+ timeHelper.stop();
+
+ Assert.isNotNull(creationHelper.getServicesRegistry());
+ Assert.isNotNull(creationHelper.getModelSet());
+
+ // creating classes
+ final Model model = this.creationHelper.getModelRoot();
+ final ModelSet modelSet = this.creationHelper.getModelSet();
+
+
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(model);
+ int modulo = 100;
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_2);
+ for (int i = 0; i < nbElementsToCreate; i++) {
+ CreateElementRequest request = new CreateElementRequest(modelSet.getTransactionalEditingDomain(), model, elementType);
+ final ICommand cmd = provider.getEditCommand(request);
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(GMFtoEMFCommandWrapper.wrap(cmd));
+ if (i % modulo == 0) {
+ timeHelper.top();
+ }
+ }
+
+ timeHelper.stop();
+
+ // saving the models
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_3);
+ try {
+ modelSet.save(new NullProgressMonitor());
+ // modelSet.
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ timeHelper.stop();
+
+
+ // accessing to an element
+ List<String> names = Arrays.asList(elementType.getId().split("\\."));
+ Collections.reverse(names);
+ String name = names.get(0);
+ int i = 0;
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_4);
+ while (i + modulo <= nbElementsToCreate) {
+ i = i + modulo;
+ final NamedElement element = model.getMember(name + i);
+ // TODO !
+ Assert.isNotNull(element);
+ if (profilesName.size() > 0) {
+ Assert.isTrue(element.getAppliedStereotypes().size() > 0);
+ }
+ timeHelper.top();
+ }
+
+ timeHelper.stop();
+
+ name = name + "5000";
+ NamedElement element = null;
+ if (nbElementsToCreate > 5000) {
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_5);
+ for (int j = 0; j < 100; j++) {// we do it 100 times
+ element = model.getMember(name);
+ }
+ timeHelper.stop();
+ }
+
+ if (nbElementsToCreate > 5000) {
+
+ if (profilesName.size() > 0) {
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_6);
+ for (int j = 0; j < 100; j++) {// we do it 100 times
+ element.getAppliedStereotypes();
+ }
+ timeHelper.stop();
+ }
+ }
+
+ final Resource res = element.eResource();
+ Assert.isNotNull(res);
+ timeHelper.startCounting(ExecutionTimeHelper.STEP_7);
+ for (int k = 0; k < 100; k++) {
+ final EObject newModel = UMLFactory.eINSTANCE.createModel();
+ RecordingCommand rc = new RecordingCommand(modelSet.getTransactionalEditingDomain()) {
+
+ @Override
+ protected void doExecute() {
+ res.getContents().add(newModel);
+
+ }
+ };
+ modelSet.getTransactionalEditingDomain().getCommandStack().execute(rc);
+ }
+ timeHelper.stop();
+ try {
+ modelSet.save(new NullProgressMonitor());
+ // modelSet.
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ this.creationHelper.disposeAll();
+ }
+
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PapyrusModelCreation.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PapyrusModelCreation.java
new file mode 100755
index 00000000..d03092ca
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PapyrusModelCreation.java
@@ -0,0 +1,69 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.core.services.ServiceMultiException;
+
+/**
+ * @author VL222926
+ *
+ */
+public class PapyrusModelCreation extends AbstractModelCreation {
+
+ /**
+ * @see org.eclipse.papyrus.cdo.perfo.tests.impl.IPapyrusModelCreation#initPapyrusEnvironnement(java.lang.String, java.lang.String, List<String>)
+ *
+ * @param folderName
+ * @param modelName
+ * @throws Exception
+ */
+ @Override
+ public void initPapyrusEnvironnement(String folderName, String modelName, List<String> profilesName) throws Exception {
+ createProject(folderName);
+ createModelSet(folderName, modelName, profilesName);
+ }
+
+ private void createProject(final String projectName) throws CoreException {
+ IProgressMonitor progressMonitor = new NullProgressMonitor();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(projectName);
+ project.create(progressMonitor);
+ project.open(progressMonitor);
+ }
+
+
+
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractModelCreation#createBaseURI()
+ *
+ * @return
+ */
+ @Override
+ protected URI createBaseURI() {
+ return null;
+ }
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusQuickIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusQuickIndexCreationTest.java
new file mode 100755
index 00000000..0e452435
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusQuickIndexCreationTest.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+
+/**
+ * @author VL222926
+ *
+ */
+public class PurePapyrusQuickIndexCreationTest extends AbstractQuickIndexCreationTest {
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createPapyrusModelCreation()
+ *
+ * @return
+ */
+ @Override
+ protected IPapyrusModelCreation createPapyrusModelCreation() {
+ return new PapyrusModelCreation();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createTimeExecutionHelper(int, IHintedType)
+ *
+ * @param nbClasses
+ * @return
+ */
+ @Override
+ protected ExecutionTimeHelper createTimeExecutionHelper(int nbClasses, IHintedType elementType) {
+ final String id = elementType.getId();
+
+ ExecutionTimeHelper helper = new ExecutionTimeHelper("Papyrus Project: Create " + nbClasses + " " + id + " with quick Index.", ExecutionTimeHelper.Papyrus_TYPE, nbClasses, id);
+ merger.addTimeHelper(helper);
+ return helper;
+ }
+
+
+
+}
diff --git a/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusUniqueIndexCreationTest.java b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusUniqueIndexCreationTest.java
new file mode 100755
index 00000000..4ef3ae1f
--- /dev/null
+++ b/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/PurePapyrusUniqueIndexCreationTest.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.cdo.benchmarks.tests;
+
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+
+/**
+ * @author VL222926
+ *
+ */
+public class PurePapyrusUniqueIndexCreationTest extends AbstractUniqueIndexCreationTest {
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createPapyrusModelCreation()
+ *
+ * @return
+ */
+ @Override
+ protected IPapyrusModelCreation createPapyrusModelCreation() {
+ return new PapyrusModelCreation();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.cdo.benchmarks.tests.AbstractPerfTest#createTimeExecutionHelper(int, IHintedType)
+ *
+ * @param nbClasses
+ * @return
+ */
+ @Override
+ protected ExecutionTimeHelper createTimeExecutionHelper(int nbClasses, IHintedType elementType) {
+ final String id = elementType.getId();
+
+ ExecutionTimeHelper helper = new ExecutionTimeHelper("Papyrus Project: Create " + nbClasses + " " + id + " with unique Index.", ExecutionTimeHelper.Papyrus_TYPE, nbClasses, id);
+ merger.addTimeHelper(helper);
+ return helper;
+ }
+
+
+
+}

Back to the top