|
From: David C. <dc...@us...> - 2005-11-13 15:47:11
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5059/src/org/rubypeople/rdt/internal/core/util Added Files: ShamJobScheduler.java TS_Util.java TC_EclipseJobScheduler.java Log Message: Scan project SymbolIndex on startup/project open asynchronously. --- NEW FILE: TS_Util.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.util; import junit.framework.Test; import junit.framework.TestSuite; public class TS_Util extends TestSuite { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTestSuite(TC_EclipseJobScheduler.class); return suite; } } --- NEW FILE: TC_EclipseJobScheduler.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.util; import junit.framework.Assert; import junit.framework.TestCase; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; public class TC_EclipseJobScheduler extends TestCase { public void testSchedule() throws Exception { TestJob job = new TestJob(); EclipseJobScheduler scheduler = new EclipseJobScheduler(); scheduler.schedule(job); job.join(); job.assertRun(); } private static class TestJob extends Job { public TestJob() { super("test Job"); } private boolean ran; protected IStatus run(IProgressMonitor monitor) { ran = true; return Status.OK_STATUS; } public void assertRun() { Assert.assertTrue("expected to Run", ran); } } } --- NEW FILE: ShamJobScheduler.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.util; import java.util.ArrayList; import java.util.List; import junit.framework.Assert; import org.eclipse.core.runtime.jobs.Job; public class ShamJobScheduler implements IJobScheduler { private List scheduledJobs = new ArrayList(); public void assertScheduled(Job expectedJob) { Assert.assertTrue("Expected " + expectedJob + " to be scheduled", scheduledJobs.contains(expectedJob)); } public void schedule(Job job) { scheduledJobs.add(job); } } |