Author: svasilyev
Date: 2007-10-19 12:24:10 -0400 (Fri, 19 Oct 2007)
New Revision: 4389
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
Log:
org.jboss.tools.jsf.vpe.richfaces.test improvement
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-19
15:53:58 UTC (rev 4388)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/META-INF/MANIFEST.MF 2007-10-19
16:24:10 UTC (rev 4389)
@@ -9,5 +9,6 @@
org.jboss.tools.vpe,
org.junit,
org.eclipse.core.resources,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.jboss.tools.common
Eclipse-LazyStart: true
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-19
15:53:58 UTC (rev 4388)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/Activator.java 2007-10-19
16:24:10 UTC (rev 4389)
@@ -14,14 +14,15 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class Activator extends AbstractUIPlugin {
+public class Activator extends BaseUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID =
"org.jboss.tools.jsf.vpe.richfaces.test";
@@ -41,8 +42,8 @@
* @see
org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
+ super.start(context);
+ plugin = this;
}
/*
@@ -51,8 +52,8 @@
* @see
org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
+ plugin = null;
+ super.stop(context);
}
/**
@@ -61,18 +62,22 @@
* @return the shared instance
*/
public static Activator getDefault() {
- return plugin;
+ return plugin;
}
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
public static String getPluginResourcePath() {
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- URL url = null;
- try {
- url = bundle == null ? null : FileLocator.resolve(bundle
- .getEntry("/resources"));
- } catch (Exception e) {
- url = bundle.getEntry("/resources");
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+ URL url = null;
+ try {
+ url = bundle == null ? null : FileLocator.resolve(bundle
+ .getEntry("/resources"));
+ } catch (Exception e) {
+ url = bundle.getEntry("/resources");
+ }
+ return (url == null) ? null : url.getPath();
}
- return (url == null) ? null : url.getPath();
- }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-19
15:53:58 UTC (rev 4388)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/ImportRichFacesComponents.java 2007-10-19
16:24:10 UTC (rev 4389)
@@ -36,75 +36,76 @@
*
*/
public class ImportRichFacesComponents {
- private static final String PROJECT_NAME = "richFacesTest";
- private static final String COMPONENTS_PATH = "WebContent/pages";
+ private static final String PROJECT_NAME = "RichFacesTest"; // $NON-NLS-1$
+ private static final String COMPONENTS_PATH = "WebContent/pages"; //
$NON-NLS-1$
@SuppressWarnings("restriction")
- public static boolean importRichFacesPages(String path) {
- boolean result = false;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- ZipLeveledStructureProvider zipStructureProvider;
- try {
- zipStructureProvider = new ZipLeveledStructureProvider(new ZipFile(
- path));
+ public static boolean importRichFacesPages(String path) {
+ boolean result = false;
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ ZipLeveledStructureProvider zipStructureProvider;
+ try {
+ zipStructureProvider =
+ new ZipLeveledStructureProvider(new ZipFile(path));
- IOverwriteQuery overwrite = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return ALL;
- }
- };
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
- ImportOperation importOp = new ImportOperation(project
- .getFullPath(), zipStructureProvider.getRoot(),
- zipStructureProvider, overwrite);
+ ImportOperation importOp = new ImportOperation(
+ project.getFullPath(),
+ zipStructureProvider.getRoot(),
+ zipStructureProvider,
+ overwrite);
- importOp.setContext(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell());
+ importOp.setContext(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
- importOp.run(new NullProgressMonitor());
- result = true;
+ importOp.run(new NullProgressMonitor());
+ result = true;
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
+ } catch (InvocationTargetException ite) {
+ Activator.getPluginLog().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ Activator.getPluginLog().logError(ie);
+ } catch (IOException e) {
+ Activator.getPluginLog().logError(e);
+ }
+ return result;
}
- return result;
- }
/**
- *
- * @return
- * @throws CoreException
- */
+ *
+ * @return
+ * @throws CoreException
+ */
public static Collection<IPath> getComponentsPaths() throws CoreException {
- Collection<IPath> result = null;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- if (project != null) {
- IFolder folder = project.getFolder(COMPONENTS_PATH);
- IResource[] resources = folder.members();
- if (resources != null && resources.length > 0) {
- result = new ArrayList<IPath>(resources.length);
- for (IResource res : resources) {
- result.add(res.getFullPath());
+ Collection<IPath> result = null;
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ if (project != null) {
+ IFolder folder = project.getFolder(COMPONENTS_PATH);
+ IResource[] resources = folder.members();
+ if (resources != null && resources.length > 0) {
+ result = new ArrayList<IPath>(resources.length);
+ for (IResource res : resources) {
+ result.add(res.getFullPath());
+ }
+ }
}
- }
+ return result;
}
- return result;
- }
/**
*
* @throws CoreException
*/
public static void removeProject() throws CoreException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = workspace.getRoot().getProject(PROJECT_NAME);
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
- }
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject(PROJECT_NAME);
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-19
15:53:58 UTC (rev 4388)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentTest.java 2007-10-19
16:24:10 UTC (rev 4389)
@@ -34,118 +34,114 @@
*/
public class RichFacesComponentTest extends TestCase implements ILogListener {
- private final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor";
- private final static String TEST_PROJECT_JAR_PATH = "/richFacesTest.jar";
-
- // check warning log
- private final static boolean checkWarning = false;
- private boolean failureLog;
- private Collection<IPath> components = null;
+ private final static String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
+ private final static String TEST_PROJECT_JAR_PATH = "/richFacesTest.jar"; //
$NON-NLS-1$
- public RichFacesComponentTest(String name) {
- super(name);
- }
+ // check warning log
+ private final static boolean checkWarning = false;
+ private boolean failureLog;
+ private Collection<IPath> components = null;
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- *
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- if (ImportRichFacesComponents.importRichFacesPages(Activator
- .getPluginResourcePath()
- + TEST_PROJECT_JAR_PATH)) {
- components = ImportRichFacesComponents.getComponentsPaths();
+ public RichFacesComponentTest(String name) {
+ super(name);
}
- failureLog = false;
- waitForJobs();
- Platform.addLogListener(this);
- waitForJobs();
- delay(5000);
- }
- /**
- * Perform post-test cleanup.
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- ImportRichFacesComponents.removeProject();
- waitForJobs();
- Platform.removeLogListener(this);
- }
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (ImportRichFacesComponents.importRichFacesPages(Activator
+ .getPluginResourcePath() + TEST_PROJECT_JAR_PATH)) {
+ components = ImportRichFacesComponents.getComponentsPaths();
+ }
+ failureLog = false;
+ waitForJobs();
+ Platform.addLogListener(this);
+ waitForJobs();
+ delay(5000);
+ }
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- private void delay(long waitTimeMillis) {
- Display display = Display.getCurrent();
- if (display != null) {
- long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
- while (System.currentTimeMillis() < endTimeMillis) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- display.update();
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ ImportRichFacesComponents.removeProject();
+ waitForJobs();
+ Platform.removeLogListener(this);
}
- // Otherwise, perform a simple sleep.
- else {
- try {
- Thread.sleep(waitTimeMillis);
- } catch (InterruptedException e) {
- // Ignored.
- }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ private void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
}
- }
- /**
- * Wait until all background tasks are complete.
- */
- public void waitForJobs() {
- while (Platform.getJobManager().currentJob() != null)
- delay(5000);
- }
+ /**
+ * Wait until all background tasks are complete.
+ */
+ public void waitForJobs() {
+ while (Platform.getJobManager().currentJob() != null)
+ delay(5000);
+ }
- public void testRichFacesComponent() throws PartInitException {
- waitForJobs();
-
- for (IPath componentPath : components) {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
- componentPath);
- IEditorInput input = new FileEditorInput(file);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage().openEditor(input, EDITOR_ID, true);
+ public void testRichFacesComponent() throws PartInitException {
+ waitForJobs();
- waitForJobs();
- delay(3000);
- PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage().closeAllEditors(true);
- }
- assertEquals(failureLog, false);
- }
+ for (IPath componentPath : components) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(componentPath);
+ IEditorInput input = new FileEditorInput(file);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input,
EDITOR_ID, true);
- public void logging(IStatus status, String plugin) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- failureLog = true;
- break;
- case IStatus.WARNING:
- if (checkWarning)
- failureLog = true;
- break;
- default:
- break;
+ waitForJobs();
+ delay(3000);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(true);
+ }
+ assertEquals(failureLog, false);
}
- }
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ failureLog = true;
+ break;
+ case IStatus.WARNING:
+ if (checkWarning)
+ failureLog = true;
+ break;
+ default:
+ break;
+ }
+ }
+
}
Show replies by date