|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2004, 2007 Mylyn project committers and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
*******************************************************************************/ |
| 8 |
|
| 9 |
package org.eclipse.mylyn.tasks.tests.performance; |
| 10 |
|
| 11 |
import org.eclipse.mylyn.tasks.core.AbstractTask; |
| 12 |
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryTask; |
| 13 |
import org.eclipse.test.performance.PerformanceTestCase; |
| 14 |
|
| 15 |
/** |
| 16 |
* @author Steffen Pingel |
| 17 |
*/ |
| 18 |
public class TaskContainerTest extends PerformanceTestCase { |
| 19 |
|
| 20 |
int counter; |
| 21 |
|
| 22 |
private void addChildren(AbstractTask parent, int[] childCount, int depth) { |
| 23 |
for (int i = 0; i < childCount[depth]; i++) { |
| 24 |
MockRepositoryTask task = new MockRepositoryTask("task", ++counter + ""); |
| 25 |
parent.internalAddChild(task); |
| 26 |
if (depth < childCount.length - 1) { |
| 27 |
addChildren(task, childCount, depth + 1); |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
public void testContains() { |
| 33 |
MockRepositoryTask task = new MockRepositoryTask(++counter + ""); |
| 34 |
addChildren(task, new int[] { 1000, 10, 2 }, 0); |
| 35 |
|
| 36 |
for (int i = 0; i < 10; i++) { |
| 37 |
startMeasuring(); |
| 38 |
task.contains("handle"); |
| 39 |
stopMeasuring(); |
| 40 |
} |
| 41 |
|
| 42 |
commitMeasurements(); |
| 43 |
assertPerformance(); |
| 44 |
} |
| 45 |
|
| 46 |
} |