blob: 769162ce71e55970bf01291a08233b33a79f7918 [file] [log] [blame]
/*****************************************************************************
* 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);
// }
}