diff options
Diffstat (limited to 'plugins/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java')
-rwxr-xr-x | plugins/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/plugins/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java b/plugins/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java new file mode 100755 index 00000000..769162ce --- /dev/null +++ b/plugins/cdo/benchmarks/org.eclipse.papyrus.cdo.benchmarks/src/org/eclipse/papyrus/cdo/benchmarks/tests/AbstractPerfTest.java @@ -0,0 +1,92 @@ +/***************************************************************************** + * 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-v10.html + * + * 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); +// } + + + +} |