public GaeSdkClasspathContainerPage() { super( "App Engine SDK", "App Engine SDK", AppEngineCorePlugin.getDefault().getImageDescriptor(GaeImages.APP_ENGINE_DEPLOY_LARGE), GaePreferences.getSdkManager(), GaeSdkContainer.CONTAINER_ID, GaePreferencePage.ID); }
/** Tests that an expanded SDK gets replaced with the specified SDK container. */ public void testExecute() throws CoreException { final GaeSdk defaultSdk = GaePreferences.getDefaultSdk(); // Set the project's classpath contain the expanded container ClasspathUtilities.setRawClasspath(javaProject, defaultSdk.getClasspathEntries()); PluginTestUtils.waitForIdle(); final GaeSdk oldSdk = GaeSdk.findSdkFor(javaProject); ResourcesPlugin.getWorkspace() .run( new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { try { AppEngineUpdateProjectSdkCommand command = new AppEngineUpdateProjectSdkCommand( javaProject, oldSdk, defaultSdk, UpdateType.DEFAULT_CONTAINER, null); command.execute(); } catch (FileNotFoundException e) { throw new CoreException( StatusUtilities.newErrorStatus(e, AppEngineCorePlugin.PLUGIN_ID)); } catch (BackingStoreException e) { throw new CoreException( StatusUtilities.newErrorStatus(e, AppEngineCorePlugin.PLUGIN_ID)); } } }, null); PluginTestUtils.waitForIdle(); IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); // Ensure that the entries were collapsed back into a single container entry assertEquals(1, rawClasspath.length); assertEquals(GaeSdkContainer.CONTAINER_PATH, rawClasspath[0].getPath()); assertEquals(IClasspathEntry.CPE_CONTAINER, rawClasspath[0].getEntryKind()); }