use of org.python.pydev.ui.wizards.project.NewProjectNameAndLocationWizardPage in project Pydev by fabioz.
the class AppEngineConfigWizardPageTestWorkbench method testCreateLaunchAndDebugGoogleAppProject.
public void testCreateLaunchAndDebugGoogleAppProject() throws Exception {
final Display display = Display.getDefault();
final Boolean[] executed = new Boolean[] { false };
display.syncExec(new Runnable() {
@Override
public void run() {
final Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Composite pageContainer = new Composite(shell, 0);
AppEngineWizard appEngineWizard = new AppEngineWizard();
appEngineWizard.setContainer(new IWizardContainer() {
@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
runnable.run(new NullProgressMonitor());
}
@Override
public void updateWindowTitle() {
throw new RuntimeException("Not implemented");
}
@Override
public void updateTitleBar() {
throw new RuntimeException("Not implemented");
}
@Override
public void updateMessage() {
throw new RuntimeException("Not implemented");
}
@Override
public void updateButtons() {
throw new RuntimeException("Not implemented");
}
@Override
public void showPage(IWizardPage page) {
throw new RuntimeException("Not implemented");
}
@Override
public Shell getShell() {
throw new RuntimeException("Not implemented");
}
@Override
public IWizardPage getCurrentPage() {
return null;
}
});
appEngineWizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
appEngineWizard.addPages();
appEngineWizard.createPageControls(pageContainer);
IWizardPage[] pages = appEngineWizard.getPages();
NewProjectNameAndLocationWizardPage nameAndLocation = (NewProjectNameAndLocationWizardPage) pages[0];
AppEngineConfigWizardPage appEnginePage = (AppEngineConfigWizardPage) pages[1];
assertFalse(nameAndLocation.isPageComplete());
nameAndLocation.setProjectName("AppEngineTest");
assertTrue(nameAndLocation.isPageComplete());
assertFalse(appEnginePage.isPageComplete());
appEnginePage.setAppEngineLocationFieldValue(TestDependent.GOOGLE_APP_ENGINE_LOCATION + "invalid_path_xxx");
assertFalse(appEnginePage.isPageComplete());
appEnginePage.setAppEngineLocationFieldValue(TestDependent.GOOGLE_APP_ENGINE_LOCATION);
assertTrue(appEnginePage.isPageComplete());
assertTrue(appEngineWizard.performFinish());
IProject createdProject = appEngineWizard.getCreatedProject();
PythonNature nature = PythonNature.getPythonNature(createdProject);
Map<String, String> expected = new HashMap<String, String>();
expected.put(AppEngineConstants.GOOGLE_APP_ENGINE_VARIABLE, new File(TestDependent.GOOGLE_APP_ENGINE_LOCATION).getAbsolutePath());
IPythonPathNature pythonPathNature = nature.getPythonPathNature();
try {
assertEquals(expected, pythonPathNature.getVariableSubstitution());
String projectExternalSourcePath = pythonPathNature.getProjectExternalSourcePath(false);
assertTrue(projectExternalSourcePath.indexOf(AppEngineConstants.GOOGLE_APP_ENGINE_VARIABLE) != -1);
projectExternalSourcePath = pythonPathNature.getProjectExternalSourcePath(true);
assertTrue(projectExternalSourcePath.indexOf(AppEngineConstants.GOOGLE_APP_ENGINE_VARIABLE) == -1);
} catch (Exception e) {
throw new RuntimeException(e);
}
// goToManual();
executed[0] = true;
}
});
assertTrue(executed[0]);
}
Aggregations