Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 97960 Details for
Bug 116487
create performance test harness
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
6 performance tests
clipboard.txt (text/plain), 31.80 KB, created by
Jingwen 'Owen' Ou
on 2008-04-29 08:28:02 EDT
(
hide
)
Description:
6 performance tests
Filename:
MIME Type:
Creator:
Jingwen 'Owen' Ou
Created:
2008-04-29 08:28:02 EDT
Size:
31.80 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.tests >Index: src/org/eclipse/mylyn/tasks/tests/performance/TaskFormPagePerformanceTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/TaskFormPagePerformanceTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/TaskFormPagePerformanceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/TaskFormPagePerformanceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,96 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import org.eclipse.mylyn.internal.tasks.core.LocalTask; >+import org.eclipse.mylyn.internal.tasks.ui.editors.TaskPlanningEditor; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.tasks.ui.TasksUiUtil; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.test.performance.PerformanceTestCase; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+ >+public class TaskFormPagePerformanceTest extends PerformanceTestCase { >+ >+ private static final String REP_TYPE = "bugzilla"; >+ >+ private static final String REPURL = "http://somewhere"; >+ >+ private static final String MOCK_LABEL = "label"; >+ >+ private static final String DESCRIPTION = "summary"; >+ >+ @Override >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ } >+ >+ @Override >+ protected void tearDown() throws Exception { >+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false); >+ TasksUiPlugin.getRepositoryManager().clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath()); >+ TasksUiPlugin.getTaskListManager().resetTaskList(); >+ TasksUiPlugin.getTaskListManager().saveTaskList(); >+ super.tearDown(); >+ >+ } >+ >+ public void testAddTextEditorPerformance() throws Throwable { >+ //users helper >+ TaskRepository repository = new TaskRepository(REP_TYPE, REPURL); >+ >+ //system helper >+ Display display = PlatformUI.getWorkbench().getDisplay(); >+ Shell shell = new Shell(display); >+ Composite composite = new Composite(shell, SWT.NULL); >+ >+ //users helper >+ String text = "Mylyn Performance Test"; >+ >+ //user helper >+ boolean TRUE = true; >+ >+ //user helper >+ int style = SWT.FLAT; >+ >+ //parameter types and args >+ Class<?>[] parameterTypes = new Class[] {TaskRepository.class, Composite.class, String.class, boolean.class, >+ int.class}; >+ Object[] args = new Object[] { repository, composite, text, TRUE, style }; >+ >+ //initialize object, use its subclass instead since TaskFormPage.addTextEditor() will not initialise in line 356 >+ LocalTask task = new LocalTask("1", MOCK_LABEL); >+ task.setSummary(DESCRIPTION); >+ TasksUiPlugin.getTaskListManager().getTaskList().addTask(task); >+ TasksUiUtil.openEditor(task, false, true); >+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ assertTrue(page.getActiveEditor() instanceof TaskEditor); >+ TaskEditor taskEditor = (TaskEditor) page.getActiveEditor(); >+ assertTrue(taskEditor.getActivePageInstance() instanceof TaskPlanningEditor); >+ TaskPlanningEditor editor = (TaskPlanningEditor) taskEditor.getActivePageInstance(); >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ PrivateAccessor.invoke(editor, "addTextEditor", parameterTypes, args); >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ >+ } >+ >+} >Index: src/org/eclipse/mylyn/tasks/tests/performance/PrivateAccessor.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/PrivateAccessor.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/PrivateAccessor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/PrivateAccessor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,313 @@ >+/* >+ * The JUnit-addons Software License, Version 1.0 >+ * (based on the Apache Software License, Version 1.1) >+ * >+ * Copyright (c) 2002-2003 Vladimir R. Bossicard. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in >+ * the documentation and/or other materials provided with the >+ * distribution. >+ * >+ * 3. The end-user documentation included with the redistribution, if >+ * any, must include the following acknowlegement: >+ * "This product includes software developed by Vladimir R. >+ * Bossicard as well as other contributors >+ * (http://junit-addons.sourceforge.net/)." >+ * Alternately, this acknowlegement may appear in the software itself, >+ * if and wherever such third-party acknowlegements normally appear. >+ * >+ * 4. The name "JUnit-addons" must not be used to endorse or promote >+ * products derived from this software without prior written >+ * permission. For written permission, please contact >+ * vbossica@users.sourceforge.net. >+ * >+ * 5. Products derived from this software may not be called "JUnit-addons" >+ * nor may "JUnit-addons" appear in their names without prior written >+ * permission of the project managers. >+ * >+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED >+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES >+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR >+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF >+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT >+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ * ====================================================================== >+ * >+ * This software consists of voluntary contributions made by many >+ * individuals. For more information on the JUnit-addons Project, please >+ * see <http://junit-addons.sourceforge.net/>. >+ */ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import java.lang.reflect.Field; >+import java.lang.reflect.InvocationTargetException; >+import java.lang.reflect.Method; >+ >+/** >+ * Utility class to bypass the Java modifiers security and access protected and >+ * private fields and methods. >+ * >+ * <h4>Note</h4> >+ * >+ * When specifying parameter types, use <code>int.class</>, >+ * <code>double.class</>, <code>short.class</>, <code>long.class</>, >+ * <code>float.class</> and <code>char.class</> for primitive types.<p> >+ * >+ * Example: To set the value of an object <code>obj</> to 100 via the method >+ * <code>setValue()</>: >+ * <pre> >+ * PrivateAccessor.invoke( obj, "setValue", new Class[]{int.class}, new Object[]{new Integer( 100 )} ); >+ * </pre> >+ * >+ * @version $Revision: 1.5 $ $Date: 2003/03/21 06:13:49 $ >+ * @author <a href="mailto:vbossica@users.sourceforge.net">Vladimir R. Bossicard</a> >+ */ >+public class PrivateAccessor { >+ >+ private PrivateAccessor() { >+ } >+ >+ /** >+ * Returns the value of the field on the specified object. The name >+ * parameter is a <code>String</code> specifying the simple name of the >+ * desired field.<p> >+ * >+ * The object is first searched for any matching field. If no matching >+ * field is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchFieldException if a field with the specified name is >+ * not found. >+ */ >+ public static Object getField(Object object, >+ String name) >+ throws NoSuchFieldException { >+ if (object == null) { >+ throw new IllegalArgumentException("Invalid null object argument"); >+ } >+ for (Class<?> cls = object.getClass(); >+ cls != null; >+ cls = cls.getSuperclass()) { >+ try { >+ Field field = cls.getDeclaredField(name); >+ field.setAccessible(true); >+ return field.get(object); >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ } >+ throw new NoSuchFieldException("Could get value for field " + >+ object.getClass().getName() + "." + name); >+ } >+ >+ /** >+ * Returns the value of the field on the specified class. The name >+ * parameter is a <code>String</code> specifying the simple name of the >+ * desired field.<p> >+ * >+ * The class is first searched for any matching field. If no matching >+ * field is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchFieldException if a field with the specified name is >+ * not found. >+ */ >+ public static Object getField(Class<?> cls, >+ String name) >+ throws NoSuchFieldException { >+ if (cls == null) { >+ throw new IllegalArgumentException("Invalid null cls argument"); >+ } >+ Class<?> base = cls; >+ while (base != null) { >+ try { >+ Field field = base.getDeclaredField(name); >+ field.setAccessible(true); >+ return field.get(base); >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ base = base.getSuperclass(); >+ } >+ throw new NoSuchFieldException("Could get value for static field " + >+ cls.getName() + "." + name); >+ } >+ >+ /** >+ * Sets the field represented by the name value on the specified object >+ * argument to the specified new value. The new value is automatically >+ * unwrapped if the underlying field has a primitive type.<p> >+ * >+ * The object is first searched for any matching field. If no matching >+ * field is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchFieldException if a field with the specified name is >+ * not found. >+ */ >+ public static void setField(Object object, >+ String name, >+ Object value) >+ throws NoSuchFieldException { >+ if (object == null) { >+ throw new IllegalArgumentException("Invalid null object argument"); >+ } >+ for (Class<?> cls = object.getClass(); >+ cls != null; >+ cls = cls.getSuperclass()) { >+ try { >+ Field field = cls.getDeclaredField(name); >+ field.setAccessible(true); >+ field.set(object, value); >+ return; >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ } >+ throw new NoSuchFieldException("Could set value for field " + >+ object.getClass().getName() + "." + name); >+ } >+ >+ /** >+ * Sets the field represented by the name value on the specified class >+ * argument to the specified new value. The new value is automatically >+ * unwrapped if the underlying field has a primitive type.<p> >+ * >+ * The class is first searched for any matching field. If no matching >+ * field is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchFieldException if a field with the specified name is >+ * not found. >+ */ >+ public static void setField(Class<?> cls, >+ String name, >+ Object value) >+ throws NoSuchFieldException { >+ if (cls == null) { >+ throw new IllegalArgumentException("Invalid null cls argument"); >+ } >+ Class<?> base = cls; >+ while (base != null) { >+ try { >+ Field field = base.getDeclaredField(name); >+ field.setAccessible(true); >+ field.set(base, value); >+ return; >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ base = base.getSuperclass(); >+ } >+ throw new NoSuchFieldException("Could set value for static field " + >+ cls.getName() + "." + name); >+ } >+ >+ /** >+ * Invokes the method represented by the name value on the specified object >+ * with the specified parameters. Individual parameters are automatically >+ * unwrapped to match primitive formal parameters, and both primitive and >+ * reference parameters are subject to widening conversions as necessary. >+ * The value returned by the method is automatically wrapped in an object >+ * if it has a primitive type.<p> >+ * >+ * The object is first searched for any matching method. If no matching >+ * method is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchMethodException if a matching method is not found or >+ * if the name is "<init>"or "<clinit>". >+ */ >+ public static Object invoke(Object object, >+ String name, >+ Class<?> parameterTypes[], >+ Object args[]) >+ throws Throwable { >+ if (object == null) { >+ throw new IllegalArgumentException("Invalid null object argument"); >+ } >+ Class<?> cls = object.getClass(); >+ while (cls != null) { >+ try { >+ Method method = cls.getDeclaredMethod(name, >+ parameterTypes); >+ method.setAccessible(true); >+ return method.invoke(object, args); >+ } catch (InvocationTargetException e) { >+ /* if the method throws an exception, it is embedded into an >+ * InvocationTargetException. */ >+ throw e.getTargetException(); >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ cls = cls.getSuperclass(); >+ } >+ throw new NoSuchMethodException("Failed method invocation: " + >+ object.getClass().getName() + "." + name + "()"); >+ } >+ >+ /** >+ * Invokes the method represented by the name value on the specified class >+ * with the specified parameters. Individual parameters are automatically >+ * unwrapped to match primitive formal parameters, and both primitive and >+ * reference parameters are subject to widening conversions as necessary. >+ * The value returned by the method is automatically wrapped in an object >+ * if it has a primitive type.<p> >+ * >+ * The class is first searched for any matching method. If no matching >+ * class is found, the superclasses are recursively searched. >+ * >+ * @exception NoSuchMethodException if a matching method is not found or >+ * if the name is "<init>"or "<clinit>". >+ */ >+ public static Object invoke(Class<?> cls, >+ String name, >+ Class<?> parameterTypes[], >+ Object args[]) >+ throws Throwable { >+ if (cls == null) { >+ throw new IllegalArgumentException("Invalid null cls argument"); >+ } >+ Class<?> base = cls; >+ while (base != null) { >+ try { >+ Method method = base.getDeclaredMethod(name, >+ parameterTypes); >+ method.setAccessible(true); >+ return method.invoke(base, args); >+ } catch (InvocationTargetException e) { >+ /* if the method throws an exception, it is embedded into an >+ * InvocationTargetException. */ >+ throw (Exception) e.getTargetException(); >+ } catch (Exception ex) { >+ /* in case of an exception, we will throw a new >+ * NoSuchFieldException object */ >+ ; >+ } >+ base = base.getSuperclass(); >+ } >+ throw new NoSuchMethodException("Failed static method invocation: " + >+ cls.getName() + "." + name + "()"); >+ } >+ >+} >Index: src/org/eclipse/mylyn/tasks/tests/performance/SwtUtilPerformanceTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/SwtUtilPerformanceTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/SwtUtilPerformanceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/SwtUtilPerformanceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,143 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import java.io.File; >+import java.util.Collection; >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.mylyn.internal.tasks.ui.ITaskListNotificationProvider; >+import org.eclipse.mylyn.internal.tasks.ui.SwtUtil; >+import org.eclipse.mylyn.internal.tasks.ui.TaskListNotificationManager; >+import org.eclipse.mylyn.internal.tasks.ui.SwtUtil.IFadeListener; >+import org.eclipse.mylyn.internal.tasks.ui.notifications.AbstractNotification; >+import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotificationReminder; >+import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter; >+import org.eclipse.mylyn.tasks.core.AbstractTask; >+import org.eclipse.mylyn.tasks.core.TaskList; >+import org.eclipse.mylyn.tasks.tests.TaskTestUtil; >+import org.eclipse.mylyn.tasks.ui.TaskListManager; >+import org.eclipse.mylyn.tasks.ui.TasksUiPlugin; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.test.performance.PerformanceTestCase; >+import org.eclipse.ui.PlatformUI; >+ >+public class SwtUtilPerformanceTest extends PerformanceTestCase { >+ >+ private SwtUtil.FadeJob fadeJob; >+ >+ private Shell shell; >+ >+ private IFadeListener fadeListener; >+ >+ @Override >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ //system helper >+ Display display = PlatformUI.getWorkbench().getDisplay(); >+ shell = new Shell(display); >+ >+ //user helper >+ fadeListener = new IFadeListener() { >+ public void faded(Shell shell, int alpha) { >+ // ignore >+ } >+ }; >+ } >+ >+ @Override >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ fadeJob = null; >+ shell = null; >+ fadeListener = null; >+ } >+ >+ public void testFadeJobFadeInRunPerformance() throws Throwable { >+ >+ //parameter types and args >+ Class<?>[] parameterTypes = new Class[] { IProgressMonitor.class }; >+ Object[] args = new Object[] { new NullProgressMonitor() }; >+ >+ for (int i = 0; i < 10; i++) { >+ fadeJob = SwtUtil.fadeIn(shell, fadeListener); >+ startMeasuring(); >+ PrivateAccessor.invoke(fadeJob, "run", parameterTypes, args); >+ stopMeasuring(); >+ fadeJob = null; >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+ >+ public void testFadeJobFadeOutRunPerformance() throws Throwable { >+ >+ //parameter types and args >+ Class<?>[] parameterTypes = new Class[] { IProgressMonitor.class }; >+ Object[] args = new Object[] { new NullProgressMonitor() }; >+ >+ //only known to put fadeJob in a for because the status in fadeJob >+ for (int i = 0; i < 10; i++) { >+ fadeJob = SwtUtil.fadeOut(shell, fadeListener); >+ startMeasuring(); >+ PrivateAccessor.invoke(fadeJob, "run", parameterTypes, args); >+ stopMeasuring(); >+ fadeJob = null; >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+ >+ public void testTaskListNotificationPopupPerformance() { >+ //read task list >+ final String TASK_LIST_4000 = "testdata/performance/tasklist-4000.xml.zip"; >+ final File file = TaskTestUtil.getLocalFile(TASK_LIST_4000); >+ TaskListManager taskListManager = TasksUiPlugin.getTaskListManager(); >+ TaskList taskList = taskListManager.getTaskList(); >+ taskList.reset(); >+ final TaskListWriter taskListWriter = taskListManager.getTaskListWriter(); >+ taskListWriter.readTaskList(taskList, file, TasksUiPlugin.getTaskDataManager()); >+ >+ //notification, lacking INCOMING_NOTIFICATION_PROVIDER >+ TaskListNotificationManager taskListNotificationManager = new TaskListNotificationManager(); >+ taskListNotificationManager.addNotificationProvider(REMINDER_NOTIFICATION_PROVIDER); >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ taskListNotificationManager.showPopup(); >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+ >+ private static ITaskListNotificationProvider REMINDER_NOTIFICATION_PROVIDER = new ITaskListNotificationProvider() { >+ >+ public Set<AbstractNotification> getNotifications() { >+ Collection<AbstractTask> allTasks = TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks(); >+ Set<AbstractNotification> reminders = new HashSet<AbstractNotification>(); >+ for (AbstractTask task : allTasks) { >+ if (task.isPastReminder() && !task.isReminded()) { >+ reminders.add(new TaskListNotificationReminder(task)); >+ task.setReminded(true); >+ } >+ } >+ return reminders; >+ } >+ }; >+ >+} >Index: src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTitleFromUrlPerformaceTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTitleFromUrlPerformaceTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTitleFromUrlPerformaceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/RetrieveTitleFromUrlPerformaceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.mylyn.internal.tasks.ui.RetrieveTitleFromUrlJob; >+import org.eclipse.test.performance.PerformanceTestCase; >+ >+public class RetrieveTitleFromUrlPerformaceTest extends PerformanceTestCase { >+ >+ public void testRetrievePerformance() throws InterruptedException, InvocationTargetException { >+ final String url = "http://eclipse.org/mylyn"; >+ >+ RetrieveTitleFromUrlJob job = new RetrieveTitleFromUrlJob(url) { >+ >+ @Override >+ public void setTitle(String title) { >+ >+ } >+ }; >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ job.run(new NullProgressMonitor()); >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ >+ } >+} >Index: src/org/eclipse/mylyn/tasks/tests/performance/AbstractRepositorySettingsPagePerformanceTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/AbstractRepositorySettingsPagePerformanceTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/AbstractRepositorySettingsPagePerformanceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/AbstractRepositorySettingsPagePerformanceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,83 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import org.eclipse.jface.preference.StringFieldEditor; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnectorUi; >+import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi; >+import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.test.performance.PerformanceTestCase; >+import org.eclipse.ui.PlatformUI; >+ >+public class AbstractRepositorySettingsPagePerformanceTest extends PerformanceTestCase { >+ >+ public void testCreateControl() { >+ MockRepositorySettingsPage page = new MockRepositorySettingsPage(new MockRepositoryConnectorUi()); >+ page.setNeedsEncoding(true); >+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ page.createControl(shell); >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+ >+ private class MockRepositorySettingsPage extends AbstractRepositorySettingsPage { >+ >+ public MockRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) { >+ super("title", "summary", repositoryUi); >+ } >+ >+ @Override >+ protected void createAdditionalControls(Composite parent) { >+ // ignore >+ } >+ >+ @Override >+ protected boolean isValidUrl(String name) { >+ // ignore >+ return false; >+ } >+ >+ @Override >+ protected void validateSettings() { >+ // ignore >+ } >+ >+ Button getAnonymousButton() { >+ return anonymousButton; >+ } >+ >+ StringFieldEditor getUserNameEditor() { >+ return repositoryUserNameEditor; >+ } >+ >+ StringFieldEditor getPasswordEditor() { >+ return repositoryPasswordEditor; >+ } >+ >+ Composite getParent() { >+ return compositeContainer; >+ } >+ >+ @Override >+ protected Validator getValidator(TaskRepository repository) { >+ // ignore >+ return null; >+ } >+ } >+} >Index: src/org/eclipse/mylyn/tasks/tests/performance/TaskRepositoriesExternalizerPerformanceTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/tasks/tests/performance/TaskRepositoriesExternalizerPerformanceTest.java >diff -N src/org/eclipse/mylyn/tasks/tests/performance/TaskRepositoriesExternalizerPerformanceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/tasks/tests/performance/TaskRepositoriesExternalizerPerformanceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,95 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.tasks.tests.performance; >+ >+import java.io.File; >+import java.util.HashSet; >+import java.util.Set; >+ >+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoriesExternalizer; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.test.performance.PerformanceTestCase; >+ >+public class TaskRepositoriesExternalizerPerformanceTest extends PerformanceTestCase { >+ >+ private Set<TaskRepository> taskRepositories = new HashSet<TaskRepository>(); >+ >+ private static final String REP_TYPE = "bugzilla"; >+ >+ private static final String REPURL = "http://somewhere"; >+ >+ private static final String TIMEZONE = "test time zone"; >+ >+ private static final String VERSION = "test version"; >+ >+ private static final String ENCODING = "test encoding"; >+ >+ private static final String TIMESTAMP = "test time stamp"; >+ >+ //although not practical to have 4000 TaskRepository, only for crashing purpose >+ private static final int N = 4000; >+ >+ @Override >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ //mocking N TaskRepository >+ for (int i = 0; i < N; i++) { >+ TaskRepository temp = new TaskRepository(REP_TYPE, REPURL + i); >+ temp.setTimeZoneId(TIMEZONE + i); >+ temp.setVersion(VERSION + i); >+ temp.setCharacterEncoding(ENCODING + i); >+ temp.setSynchronizationTimeStamp(TIMESTAMP + i); >+ taskRepositories.add(temp); >+ } >+ } >+ >+ @Override >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ >+ taskRepositories.clear(); >+ } >+ >+ public void testWriteRepositoriesFromXMLPerformance() { >+ TaskRepositoriesExternalizer externalizer = new TaskRepositoriesExternalizer(); >+ String path = "repositories.xml"; >+ File file = new File(path); >+ file.deleteOnExit(); >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ externalizer.writeRepositoriesToXML(taskRepositories, file); >+ stopMeasuring(); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+ >+ public void testReadRepositoriesFromXMLPerformance() { >+ TaskRepositoriesExternalizer externalizer = new TaskRepositoriesExternalizer(); >+ String path = "repositories.xml"; >+ File file = new File(path); >+ file.deleteOnExit(); >+ externalizer.writeRepositoriesToXML(taskRepositories, file); >+ taskRepositories.clear(); >+ >+ for (int i = 0; i < 10; i++) { >+ startMeasuring(); >+ taskRepositories = externalizer.readRepositoriesFromXML(file); >+ stopMeasuring(); >+ >+ assertEquals(N, taskRepositories.size()); >+ } >+ >+ commitMeasurements(); >+ assertPerformance(); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 116487
:
83034
|
83035
|
92635
|
92636
|
92637
|
92638
|
92639
|
92640
|
92641
|
92642
|
92643
|
92644
|
95149
|
95791
|
95792
|
96692
|
96728
| 97960 |
146251