Methods Summary |
---|
protected void | doTestSampleProject(java.lang.String name)Tests the sample project with the given name
try {
StubSampleProjectWizard newProjCreator = new StubSampleProjectWizard(
name, getOsSdkLocation());
newProjCreator.init(null, null);
newProjCreator.performFinish();
IProject iproject = validateProjectExists(name);
validateNoProblems(iproject);
}
catch (CoreException e) {
fail("Unexpected exception when creating sample project: " + e.toString());
}
|
private org.eclipse.core.resources.IProject | getIProject(java.lang.String name)
IProject iproject = ResourcesPlugin.getWorkspace().getRoot()
.getProject(name);
return iproject;
|
public void | testApiDemos()
doTestSampleProject("ApiDemos");
|
public void | testHelloActivity()
doTestSampleProject("HelloActivity");
|
public void | testLunarLander()
doTestSampleProject("LunarLander");
|
public void | testNotePad()
doTestSampleProject("NotePad");
|
public void | testSkeletonApp()
doTestSampleProject("SkeletonApp");
|
public void | testSnake()
doTestSampleProject("Snake");
|
private void | validateNoProblems(org.eclipse.core.resources.IProject iproject)
waitForBuild(iproject);
assertFalse(ProjectHelper.hasError(iproject, true));
|
private org.eclipse.core.resources.IProject | validateProjectExists(java.lang.String name)
IProject iproject = getIProject(name);
assertTrue(iproject.exists());
assertTrue(iproject.isOpen());
return iproject;
|
private void | waitForBuild(org.eclipse.core.resources.IProject iproject)Waits for build to complete.
final BuiltProjectDeltaVisitor deltaVisitor = new BuiltProjectDeltaVisitor(iproject);
IResourceChangeListener newBuildListener = new IResourceChangeListener() {
public void resourceChanged(IResourceChangeEvent event) {
try {
event.getDelta().accept(deltaVisitor);
}
catch (CoreException e) {
fail();
}
}
};
iproject.getWorkspace().addResourceChangeListener(newBuildListener,
IResourceChangeEvent.POST_BUILD);
// poll build listener to determine when build is done
// loop max of 1200 times * 50 ms = 60 seconds
final int maxWait = 1200;
for (int i=0; i < maxWait; i++) {
if (deltaVisitor.isProjectBuilt()) {
return;
}
try {
Thread.sleep(50);
}
catch (InterruptedException e) {
}
if (Display.getCurrent() != null) {
Display.getCurrent().readAndDispatch();
}
}
sLogger.log(Level.SEVERE, "expected build event never happened?");
fail("expected build event never happened for " + iproject.getName());
|