JBoss Tools SVN: r5530 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-01-08 14:48:45 -0500 (Tue, 08 Jan 2008)
New Revision: 5530
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
Log:
junit code adjustment
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-08 18:59:01 UTC (rev 5529)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-08 19:48:45 UTC (rev 5530)
@@ -72,10 +72,13 @@
// get test page path
IFile file = (IFile) TestUtil
- .getComponentPath("JBIDE/1467/JBIDE-1467.jsp",getImportProjectName());
-
+ .getComponentPath("JBIDE/JBIDE-1467/JBIDE-1467.jsp",getImportProjectName());
+
+ assertNotNull("Could not open specified file "+file.getFullPath(), file);
+
IEditorInput input = new FileEditorInput(file);
-
+
+ assertNotNull("Editor input is null",input);
// open and get editor
JSPMultiPageEditor part = openEditor(input);
@@ -260,7 +263,6 @@
}
}
-
/**
*
* @param elements
17 years
JBoss Tools SVN: r5529 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test: resources/jsfTest/WebContent/pages/JBIDE and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-01-08 13:59:01 -0500 (Tue, 08 Jan 2008)
New Revision: 5529
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1484.jsp
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
Log:
junit code adjustment
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2008-01-08 18:59:01 UTC (rev 5529)
@@ -15,6 +15,7 @@
org.jboss.tools.common.text.ext,
org.jboss.tools.common.model,
org.jboss.tools.vpe.xulrunner,
- org.mozilla.xpcom
+ org.mozilla.xpcom,
+ org.jboss.tools.jsf.vpe.ui.test;visibility:=reexport
Eclipse-LazyStart: true
Bundle-ClassPath: jsf-test.jar
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1484.jsp
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1484.jsp (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/JBIDE-1484.jsp 2008-01-08 18:59:01 UTC (rev 5529)
@@ -0,0 +1,14 @@
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+<html>
+ <head>
+ </head>
+ <body>
+ <f:view>
+ <h:commandButton id="1" value=""></h:commandButton>
+ <h:commandButton id="2"></h:commandButton>
+ <h:commandButton id="2" value="test"></h:commandButton>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/ImportProvider.java 2008-01-08 18:59:01 UTC (rev 5529)
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.vpe.jsf.test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
-import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
-
-/**
- * @author sdzmitrovich
- *
- */
-public class ImportProvider implements IImportStructureProvider {
-
- /**
- * list of files which will not be imported
- */
- List unimportedFiles = new ArrayList();
-
- /**
- * Creates an instance of <code>ImportProvider</code>.
- */
- public ImportProvider() {
- super();
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public List getChildren(Object element) {
- File folder = (File) element;
- String[] children = folder.list();
- int childrenLength = children == null ? 0 : children.length;
- List result = new ArrayList(childrenLength);
-
- for (int i = 0; i < childrenLength; i++) {
- if (!unimportedFiles.contains(children[i]))
- result.add(new File(folder, children[i]));
- }
-
- return result;
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public InputStream getContents(Object element) {
- try {
- return new FileInputStream((File) element);
- } catch (FileNotFoundException e) {
- IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
- return null;
- }
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public String getFullPath(Object element) {
- return ((File) element).getPath();
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public String getLabel(Object element) {
-
- // Get the name - if it is empty then return the path as it is a file
- // root
- File file = (File) element;
- String name = file.getName();
- if (name.length() == 0) {
- return file.getPath();
- }
- return name;
- }
-
- /*
- * (non-Javadoc) Method declared on IImportStructureProvider
- */
- public boolean isFolder(Object element) {
- return ((File) element).isDirectory();
- }
-
- public List getUnimportedFiles() {
- return unimportedFiles;
- }
-
- public void setUnimportedFiles(List unimportedFiles) {
- this.unimportedFiles = unimportedFiles;
- }
-
-}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-01-08 18:59:01 UTC (rev 5529)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test;
+import org.eclipse.core.runtime.CoreException;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -22,25 +24,13 @@
public class JsfAllTests {
- private final static String TEST_PROJECT_PATH = "/jsfTest";
-
- private static void prepareTests() {
-
- TestJsfUtil.importJsfPages(JsfTestPlugin.getPluginResourcePath()
- + TEST_PROJECT_PATH);
-
- }
-
public static Test suite() {
- // prepare tests
- prepareTests();
TestSuite suite = new TestSuite("Tests for Vpe Jsf components"); // $NON-NLS-1$
// $JUnit-BEGIN$
-
suite.addTestSuite(JsfComponentTest.class);
suite.addTestSuite(JsfJbideTest.class);
-
+ //cleanUpTests();
// $JUnit-END$
return suite;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfComponentTest.java 2008-01-08 18:59:01 UTC (rev 5529)
@@ -10,16 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test;
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.vpe.ui.test.VpeTest;
/**
* Class for testing all jsf components
@@ -27,45 +19,15 @@
* @author sdzmitrovich
*
*/
-public class JsfComponentTest extends TestCase implements ILogListener {
+public class JsfComponentTest extends VpeTest {
- private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
- // $NON-NLS-1$
-
- // check warning log
- private final static boolean checkWarning = false;
- private Throwable exception;
-
+ //import project name
+ private static final String IMPORT_PROJECT_NAME = "jsfTest";
+
public JsfComponentTest(String name) {
- super(name);
+ super(name,IMPORT_PROJECT_NAME,JsfTestPlugin.getPluginResourcePath());
}
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- *
- * @see TestCase#setUp()
- */
-
- protected void setUp() throws Exception {
- super.setUp();
-
- Platform.addLogListener(this);
- }
-
- /**
- * Perform post-test cleanup.
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- Platform.removeLogListener(this);
- }
-
/*
* JSF HTML test cases
*/
@@ -250,44 +212,4 @@
public void testView() throws PartInitException, Throwable {
performTestForJsfComponent("components/view.jsp"); // $NON-NLS-1$
}
-
- private void performTestForJsfComponent(String componentPage)
- throws PartInitException, Throwable {
- TestJsfUtil.waitForJobs();
-
- exception = null;
-
- IFile file = (IFile) TestJsfUtil.getComponentPath(componentPage);
-
- IEditorInput input = new FileEditorInput(file);
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(input, EDITOR_ID, true);
-
- TestJsfUtil.waitForJobs();
- TestJsfUtil.delay(3000);
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors(true);
-
- if (exception != null) {
- throw exception;
- }
- }
-
- public void logging(IStatus status, String plugin) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- exception = status.getException();
- break;
- case IStatus.WARNING:
- if (checkWarning)
- exception = status.getException();
- break;
- default:
- break;
- }
-
- }
-
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfJbideTest.java 2008-01-08 18:59:01 UTC (rev 5529)
@@ -14,81 +14,39 @@
import java.util.ArrayList;
import java.util.List;
-import junit.framework.TestCase;
-
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
-
/**
* Class for testing all jsf bugs
*
* @author sdzmitrovich
*
*/
-public class JsfJbideTest extends TestCase implements ILogListener {
+public class JsfJbideTest extends VpeTest {
- private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
// type of input tag
private static final String ATTR_TYPE_VALUE = "radio";
+
+ //import project name
+
+ private static final String IMPORT_PROJECT_NAME = "jsfTest";
- // check warning log
- private final static boolean checkWarning = false;
-
- private Throwable exception;
-
public JsfJbideTest(String name) {
- super(name);
+ super(name,IMPORT_PROJECT_NAME,JsfTestPlugin.getPluginResourcePath());
}
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- *
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
-
- super.setUp();
-
- Platform.addLogListener(this);
-
- closeEditors();
- }
-
- /**
- * Perform post-test cleanup.
- *
- * @throws Exception
- *
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
-
- super.tearDown();
-
- Platform.removeLogListener(this);
-
- closeEditors();
- }
-
/*
* JBIDE's test cases
*/
@@ -108,13 +66,13 @@
public void testJBIDE_1467() throws PartInitException, Throwable {
// wait
- TestJsfUtil.waitForJobs();
+ TestUtil.waitForJobs();
// set exception
- exception = null;
+ setException(null);
// get test page path
- IFile file = (IFile) TestJsfUtil
- .getComponentPath("JBIDE/1467/JBIDE-1467.jsp");
+ IFile file = (IFile) TestUtil
+ .getComponentPath("JBIDE/1467/JBIDE-1467.jsp",getImportProjectName());
IEditorInput input = new FileEditorInput(file);
@@ -122,7 +80,7 @@
JSPMultiPageEditor part = openEditor(input);
// get dom document
- nsIDOMDocument document = getVpePageSource(part);
+ nsIDOMDocument document = getVpeVisualDocument(part);
nsIDOMElement element = document.getDocumentElement();
if (element != null) {
@@ -143,8 +101,8 @@
}
// check exception
- if (exception != null) {
- throw exception;
+ if (getException() != null) {
+ throw getException();
}
}
@@ -175,15 +133,15 @@
public void testJBIDE_1501() throws PartInitException, Throwable {
// wait
- TestJsfUtil.waitForJobs();
+ TestUtil.waitForJobs();
// set exception
- exception = null;
+ setException(null);
// _____1st Part____//
// get test page path
- IFile file = (IFile) TestJsfUtil
- .getComponentPath("JBIDE/1501/JBIDE-1501_multiple.jsp");
+ IFile file = (IFile) TestUtil
+ .getComponentPath("JBIDE/1501/JBIDE-1501_multiple.jsp",getImportProjectName());
IEditorInput input = new FileEditorInput(file);
@@ -191,7 +149,7 @@
JSPMultiPageEditor part = openEditor(input);
// get dom document
- nsIDOMDocument document = getVpePageSource(part);
+ nsIDOMDocument document = getVpeVisualDocument(part);
assertNotNull(document);
// get dom element
@@ -223,8 +181,8 @@
// _____2nd Part____//
// get test page path
- file = (IFile) TestJsfUtil
- .getComponentPath("JBIDE/1501/JBIDE-1501_size.jsp");
+ file = (IFile) TestUtil
+ .getComponentPath("JBIDE/1501/JBIDE-1501_size.jsp",getImportProjectName());
input = new FileEditorInput(file);
@@ -232,7 +190,7 @@
part = openEditor(input);
// get dom document
- document = getVpePageSource(part);
+ document = getVpeVisualDocument(part);
assertNotNull(document);
// get dom element
@@ -265,8 +223,8 @@
}
// check exception
- if (exception != null) {
- throw exception;
+ if (getException() != null) {
+ throw getException();
}
}
@@ -345,78 +303,4 @@
}
- /**
- * close all opened editors
- */
- private void closeEditors() {
-
- // wait
- TestJsfUtil.waitForJobs();
-
- // close
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors(true);
-
- }
-
- /**
- * Open JSPMultiPageEditor editor
- *
- * @param input
- * @return
- * @throws PartInitException
- */
- private JSPMultiPageEditor openEditor(IEditorInput input)
- throws PartInitException {
-
- // get editor
- JSPMultiPageEditor part = (JSPMultiPageEditor) PlatformUI
- .getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(input, EDITOR_ID, true);
-
- // wait for jobs
- TestJsfUtil.waitForJobs();
- // wait full initialization of vpe
- TestJsfUtil.delay(3000);
-
- return part;
-
- }
-
- /**
- * get xulrunner source page
- *
- * @param part -
- * JSPMultiPageEditor
- * @return nsIDOMDocument
- */
- private nsIDOMDocument getVpePageSource(JSPMultiPageEditor part) {
-
- VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
- VpeController vpeController = visualEditor.getController();
-
- // get xulRunner editor
- XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
-
- // get dom document
- nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
-
- return document;
- }
-
- public void logging(IStatus status, String plugin) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- exception = status.getException();
- break;
- case IStatus.WARNING:
- if (checkWarning)
- exception = status.getException();
- break;
- default:
- break;
- }
-
- }
-
}
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java 2008-01-08 18:55:16 UTC (rev 5528)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/TestJsfUtil.java 2008-01-08 18:59:01 UTC (rev 5529)
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.vpe.jsf.test;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-
-/**
- * Class for importing project from jar file
- *
- * @author sdzmitrovich
- *
- */
-public class TestJsfUtil {
- private static final String PROJECT_NAME = "JsfTest"; // $NON-NLS-1$
- private static final String COMPONENTS_PATH = "WebContent/pages"; // $NON-NLS-1$
-
- @SuppressWarnings("restriction")
- static void importJsfPages(String path) {
-
- if (ResourcesPlugin.getWorkspace().getRoot().findMember(
- TestJsfUtil.PROJECT_NAME) != null) {
- waitForJobs();
-
- try {
- removeProject();
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
-
- try {
-
- IOverwriteQuery overwrite = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- return ALL;
- }
- };
-
- ImportProvider importProvider = new ImportProvider();
-
- // need to remove from imported project "svn" files
- List<String> unimportedFiles = new ArrayList<String>();
- unimportedFiles.add(".svn");
-
- importProvider.setUnimportedFiles(unimportedFiles);
-
- // create import operation
- ImportOperation importOp = new ImportOperation(project
- .getFullPath(), new File(path), importProvider, overwrite);
-
- // import files just to project folder ( without old structure )
- importOp.setCreateContainerStructure(false);
-
- importOp.setContext(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell());
-
- // run import
- importOp.run(new NullProgressMonitor());
-
- } catch (InvocationTargetException ite) {
- JsfTestPlugin.getPluginLog().logError(ite.getCause());
- } catch (InterruptedException ie) {
- JsfTestPlugin.getPluginLog().logError(ie);
- }
- }
-
- /**
- *
- * @return
- * @throws CoreException
- */
- static IResource getComponentPath(String componentPage)
- throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
- if (project != null) {
- return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
-
- }
-
- return null;
- }
-
- /**
- *
- * @throws CoreException
- */
- static void removeProject() throws CoreException {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
- if (project != null) {
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
- }
- }
-
- /**
- * Process UI input but do not return for the specified time interval.
- *
- * @param waitTimeMillis
- * the number of milliseconds
- */
- public static 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 static void waitForJobs() {
- while (Job.getJobManager().currentJob() != null)
- delay(5000);
- }
-
-}
17 years
JBoss Tools SVN: r5528 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test: META-INF and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-01-08 13:55:16 -0500 (Tue, 08 Jan 2008)
New Revision: 5528
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.project
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/build.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
Was created base junit plugin in which contains functionality to import project for testing and base class.
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.classpath
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.classpath (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.classpath 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.project (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/.project 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jsf.vpe.ui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/META-INF/MANIFEST.MF 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Visual Editor Test Plugin
+Bundle-SymbolicName: org.jboss.tools.jsf.vpe.ui.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.vpe.ui.test.VPETestPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.vpe,
+ org.junit,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.jboss.tools.common,
+ org.jboss.tools.jst.jsp,
+ org.jboss.tools.common.text.ext,
+ org.jboss.tools.common.model,
+ org.jboss.tools.vpe.xulrunner,
+ org.mozilla.xpcom
+Eclipse-LazyStart: true
+Bundle-ClassPath: .
+Export-Package: org.jboss.tools.vpe.ui.test
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/build.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/build.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/build.properties 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ImportProvider.java 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
+
+/**
+ * @author sdzmitrovich
+ *
+ */
+public class ImportProvider implements IImportStructureProvider {
+
+ /**
+ * list of files which will not be imported
+ */
+ List unimportedFiles = new ArrayList();
+
+ /**
+ * Creates an instance of <code>ImportProvider</code>.
+ */
+ public ImportProvider() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public List getChildren(Object element) {
+ File folder = (File) element;
+ String[] children = folder.list();
+ int childrenLength = children == null ? 0 : children.length;
+ List result = new ArrayList(childrenLength);
+
+ for (int i = 0; i < childrenLength; i++) {
+ if (!unimportedFiles.contains(children[i]))
+ result.add(new File(folder, children[i]));
+ }
+
+ return result;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public InputStream getContents(Object element) {
+ try {
+ return new FileInputStream((File) element);
+ } catch (FileNotFoundException e) {
+ IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
+ return null;
+ }
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getFullPath(Object element) {
+ return ((File) element).getPath();
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public String getLabel(Object element) {
+
+ // Get the name - if it is empty then return the path as it is a file
+ // root
+ File file = (File) element;
+ String name = file.getName();
+ if (name.length() == 0) {
+ return file.getPath();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IImportStructureProvider
+ */
+ public boolean isFolder(Object element) {
+ return ((File) element).isDirectory();
+ }
+
+ public List getUnimportedFiles() {
+ return unimportedFiles;
+ }
+
+ public void setUnimportedFiles(List unimportedFiles) {
+ this.unimportedFiles = unimportedFiles;
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.test;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * Class for importing project from jar file
+ *
+ * @author sdzmitrovich
+ *
+ */
+public class TestUtil {
+
+ private static final String COMPONENTS_PATH = "WebContent/pages"; // $NON-NLS-1$
+
+ @SuppressWarnings("restriction")
+ static void importProjectIntoWorkspace(String path,String projectName) {
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+
+ try {
+
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
+
+ ImportProvider importProvider = new ImportProvider();
+
+ // need to remove from imported project "svn" files
+ List<String> unimportedFiles = new ArrayList<String>();
+ unimportedFiles.add(".svn");
+
+ importProvider.setUnimportedFiles(unimportedFiles);
+
+ // create import operation
+ ImportOperation importOp = new ImportOperation(project
+ .getFullPath(), new File(path), importProvider, overwrite);
+
+ // import files just to project folder ( without old structure )
+ importOp.setCreateContainerStructure(false);
+
+ importOp.setContext(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell());
+
+ // run import
+ importOp.run(new NullProgressMonitor());
+
+ } catch (InvocationTargetException ite) {
+ VPETestPlugin.getDefault().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ VPETestPlugin.getDefault().logError(ie);
+ }
+ }
+
+ /**
+ *
+ * @return
+ * @throws CoreException
+ */
+ public static IResource getComponentPath(String componentPage,String projectName)
+ throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
+
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @throws CoreException
+ */
+ static void removeProject(String projectName) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (project != null) {
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
+ }
+
+ /**
+ * Process UI input but do not return for the specified time interval.
+ *
+ * @param waitTimeMillis
+ * the number of milliseconds
+ */
+ public static 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 static void waitForJobs() {
+ while (Job.getJobManager().currentJob() != null)
+ delay(100);
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+* Copyright (c) 2007 Red Hat, Inc.
+* Distributed under license by Red Hat, Inc. All rights reserved.
+* This program is made available under the terms of the
+* Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.ui.test;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class VPETestPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.vpe.ui.test";
+
+ // The shared instance
+ private static VPETestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public VPETestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static VPETestPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2008-01-08 18:55:16 UTC (rev 5528)
@@ -0,0 +1,259 @@
+/*******************************************************************************
+* Copyright (c) 2007 Red Hat, Inc.
+* Distributed under license by Red Hat, Inc. All rights reserved.
+* This program is made available under the terms of the
+* Eclipse Public License v1.0 which accompanies this distribution,
+* and is available at http://www.eclipse.org/legal/epl-v10.html
+*
+* Contributors:
+* Red Hat, Inc. - initial API and implementation
+******************************************************************************/
+package org.jboss.tools.vpe.ui.test;
+
+
+import java.io.File;
+
+import junit.framework.TestCase;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMDocument;
+
+/**
+ * @author Max Areshkau
+ *
+ * Base Class for VPE tests
+ */
+public class VpeTest extends TestCase implements ILogListener {
+
+ /**
+ * Editor in which we open visual page
+ */
+ private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor";
+
+ /**
+ * Collects exceptions
+ */
+ private Throwable exception;
+
+ // check warning log
+ private Boolean checkWarning;
+
+ /**
+ * Contains project name with information for testing
+ */
+ private String importProjectName;
+
+ /**
+ * Contains plugin resource path
+ */
+ private String pluginResourcePath;
+ /**
+ *
+ * @param name
+ * @param importProjectName
+ */
+
+ public VpeTest(String name, String importProjectName,String pluginResourcePath) {
+ super(name);
+ setImportProjectName(importProjectName);
+ setPluginResourcePath(pluginResourcePath);
+ }
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+
+ super.setUp();
+ closeEditors();
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember(getImportProjectName()) == null) {
+ closeEditors();
+ TestUtil.importProjectIntoWorkspace((getPluginResourcePath()
+ + File.separator+getImportProjectName()),getImportProjectName());
+ }
+ Platform.addLogListener(this);
+ closeEditors();
+ }
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+
+ super.tearDown();
+ TestUtil.removeProject(getImportProjectName());
+ Platform.removeLogListener(this);
+
+ closeEditors();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus, java.lang.String)
+ */
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ setException(status.getException());
+ break;
+ case IStatus.WARNING:
+ if (getCheckWarning())
+ setException(status.getException());
+ break;
+ default:
+ break;
+ }
+
+ }
+ /**
+ * close all opened editors
+ */
+ protected void closeEditors() {
+
+ // wait
+ TestUtil.waitForJobs();
+
+ // close
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeAllEditors(true);
+
+ }
+ /**
+ * get xulrunner source page
+ *
+ * @param part -
+ * JSPMultiPageEditor
+ * @return nsIDOMDocument
+ */
+ protected nsIDOMDocument getVpeVisualDocument(JSPMultiPageEditor part) {
+
+ VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
+ VpeController vpeController = visualEditor.getController();
+
+ // get xulRunner editor
+ XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
+
+ // get dom document
+ nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
+
+ return document;
+ }
+ /**
+ * Perfoms test for some page
+ *
+ * @param componentPage
+ * @throws PartInitException
+ * @throws Throwable
+ */
+ protected void performTestForJsfComponent(String componentPage)
+ throws PartInitException, Throwable {
+ TestUtil.waitForJobs();
+
+ setException(null);
+
+ IFile file = (IFile) TestUtil.getComponentPath(componentPage,getImportProjectName());
+ IEditorInput input = new FileEditorInput(file);
+
+ TestUtil.waitForJobs();
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(input, EDITOR_ID, true);
+
+ TestUtil.waitForJobs();
+ TestUtil.delay(3000);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeAllEditors(true);
+
+ if (getException() != null) {
+ throw getException();
+ }
+ }
+ /**
+ * Open JSPMultiPageEditor editor
+ *
+ * @param input
+ * @return
+ * @throws PartInitException
+ */
+ protected JSPMultiPageEditor openEditor(IEditorInput input)
+ throws PartInitException {
+
+ // get editor
+ JSPMultiPageEditor part = (JSPMultiPageEditor) PlatformUI
+ .getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(input, EDITOR_ID, true);
+
+ // wait for jobs
+ TestUtil.waitForJobs();
+// // wait full initialization of vpe
+ TestUtil.delay(3000);
+
+ return part;
+
+ }
+ /**
+ * @return the exception
+ */
+ protected Throwable getException() {
+ return exception;
+ }
+ /**
+ * @param exception the exception to set
+ */
+ protected void setException(Throwable exception) {
+ this.exception = exception;
+ }
+ /**
+ * @return the checkWarning
+ */
+ protected Boolean getCheckWarning() {
+ return checkWarning;
+ }
+ /**
+ * @param checkWarning the checkWarning to set
+ */
+ protected void setCheckWarning(Boolean checkWarning) {
+ this.checkWarning = checkWarning;
+ }
+ /**
+ * @return the importProjectName
+ */
+ protected String getImportProjectName() {
+ return importProjectName;
+ }
+ /**
+ * @param importProjectName the importProjectName to set
+ */
+ protected void setImportProjectName(String importProjectName) {
+ this.importProjectName = importProjectName;
+ }
+ /**
+ * @return the pluginResourcePath
+ */
+ protected String getPluginResourcePath() {
+ return pluginResourcePath;
+ }
+ /**
+ * @param pluginResourcePath the pluginResourcePath to set
+ */
+ protected void setPluginResourcePath(String pluginResourcePath) {
+ this.pluginResourcePath = pluginResourcePath;
+ }
+
+}
17 years
JBoss Tools SVN: r5527 - trunk/jsf/tests.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-01-08 13:54:40 -0500 (Tue, 08 Jan 2008)
New Revision: 5527
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.ui.test/
Log:
Was created base junit plugin in which contains functionality to import project for testing and base class.
17 years
JBoss Tools SVN: r5526 - trunk/hibernatetools/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-01-08 11:12:59 -0500 (Tue, 08 Jan 2008)
New Revision: 5526
Modified:
trunk/hibernatetools/docs/reference/en/modules/ant.xml
trunk/hibernatetools/docs/reference/en/modules/codegen.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-173 - highlighting meeningful words
Modified: trunk/hibernatetools/docs/reference/en/modules/ant.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/ant.xml 2008-01-08 14:51:09 UTC (rev 5525)
+++ trunk/hibernatetools/docs/reference/en/modules/ant.xml 2008-01-08 16:12:59 UTC (rev 5526)
@@ -9,20 +9,19 @@
<property>hibernate-tools.jar</property>
</emphasis> contains the core for the <property>Hibernate Tools</property>. It is used as the
basis for both the Ant tasks described in this document and the eclipse plugins both available
- from tools.hibernate.org The <emphasis>
+ from tools.hibernate.org. The <emphasis>
<property>hibernate-tools.jar</property>
- </emphasis> is located in your eclipse plugins directory at <emphasis>
- <property>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernate-tools.jar </property>
- </emphasis>.</para>
+ </emphasis> is located in your eclipse plugins directory at
+ /plugins/org.hibernate.eclipse.x.x.x/lib/tools/hibernate-tools.jar.</para>
<para>This jar is 100% independent from the eclipse platform and can thus be used independently
of eclipse.</para>
<note>
<para>There might be incapabilities with respect to the Hibernate3.jar bundled with the tools
and your own jar. Thus to avoid any confusion it is recommended to use the hibernate3.jar
- & hibernate-annotations.jar bundled with the tools when you want to use the Ant
- tasks. Do not worry about using e.g. Hibernate 3.2 jar's with e.g. a Hibernate 3.1 project
- since the output generated will work with previous Hibernate 3 versions. </para>
+ and hibernate-annotations.jar bundled with the tools when you want to use the Ant tasks. Do
+ not worry about using e.g. Hibernate 3.2 jar's with e.g. a Hibernate 3.1 project since the
+ output generated will work with previous Hibernate 3 versions. </para>
</note>
</section>
@@ -106,8 +105,8 @@
</callout>
<callout arearefs="ht3">
- <para><literal>classpath</literal> (optional): A classpath to be used to resolve
- resources, such as mappings and usertypes. Optional, but very often required.</para>
+ <para>classpath (optional): A classpath to be used to resolve resources, such as
+ mappings and usertypes. Optional, but very often required.</para>
</callout>
<callout arearefs="ht4">
@@ -131,8 +130,9 @@
<section>
<title>Basic examples</title>
- <para>The following example shows the most basic setup for generating pojo's via
- <literal>hbm2java</literal> from a normal <emphasis>
+ <para>The following example shows the most basic setup for generating pojo's via <emphasis>
+ <property><hbm2java></property>
+ </emphasis> from a normal <emphasis>
<property>
<literal>hibernate.cfg.xml</literal>
</property>
@@ -148,7 +148,9 @@
</para>
<para>The following example is similar, but now we are performing multiple exports from the
- same configuration. We are exporting the schema via hbm2dll, generates some DAO code via <emphasis>
+ same configuration. We are exporting the schema via <emphasis>
+ <property><hbm2dll></property>
+ </emphasis>, generates some DAO code via <emphasis>
<property><hbm2dao></property>
</emphasis> and finally runs a custom code generation via <emphasis>
<property><hbmtemplate></property>
@@ -197,11 +199,10 @@
<para>Each have in common that they are able to build up a Hibernate
<literal>Configuration</literal> object from which a set of exporters can be run to generate
- various output.
-
- <note>Output can be anything, e.g. specific files, statements execution
- against a database, error reporting or anything else that can be done in java code.
- </note>
+ various output. <note>
+ <para>Output can be anything, e.g. specific files, statements execution against a database,
+ error reporting or anything else that can be done in java code.</para>
+ </note>
</para>
<para>The following section describes what the various configuration can do, plus list the
@@ -353,13 +354,17 @@
<property>persistence.xml</property>
</emphasis> packaged in a JPA compliant manner.</para>
- <para><literal><jpaconfiguration></literal> will simply just try and
- auto-configure it self based on the available classpath, e.g. look for <emphasis>
+ <para>The <emphasis>
+ <property><jpaconfiguration></property>
+ </emphasis> will simply just try and auto-configure it self based on the available
+ classpath, e.g. look for <emphasis>
<property>META-INF/persistence.xml</property>
</emphasis>.</para>
- <para>The <literal>persistenceunit</literal> attribute can be used to select a specific
- persistence unit. If no persistenceunit is specified it will automatically search for one
+ <para>The <emphasis>
+ <property>persistenceunit</property></emphasis> attribute can be used to select a specific
+ persistence unit. If no <emphasis>
+ <property>persistenceunit</property></emphasis> is specified it will automatically search for one
and if an unique one is found use it, but if multiple persistence units are available it
will error.</para>
@@ -493,7 +498,8 @@
<literal><jdbcconfiguration></literal>
</property>
</emphasis> to generate Hibernate xml mappings via
- <literal><hbm2hbmxml></literal>. The connection settings is here read from a <emphasis>
+ <emphasis>
+ <property><hbm2hbmxml></property></emphasis>. The connection settings is here read from a <emphasis>
<property>
<literal>hibernate.properties</literal>
</property>
@@ -712,7 +718,7 @@
</emphasis>.</para>
<note>
- <para>Not all conversions is implemented (contributions welcome), so some hand editing
+ <para>Not all conversions are implemented (contributions welcome), so some hand editing
might be necessary.</para>
</note>
@@ -811,6 +817,7 @@
</emphasis>. </para>
<note>
+ <title>Tip:</title>
<para> Currently the dump is simply a call to toString on each element.</para>
</note>
Modified: trunk/hibernatetools/docs/reference/en/modules/codegen.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2008-01-08 14:51:09 UTC (rev 5525)
+++ trunk/hibernatetools/docs/reference/en/modules/codegen.xml 2008-01-08 16:12:59 UTC (rev 5526)
@@ -21,7 +21,8 @@
<para>You can use the <emphasis>
<property><meta></property></emphasis> tag to e.g. tell
- <literal>hbm2java</literal> to only generate <emphasis>
+ <emphasis>
+ <property><hbm2java></property></emphasis> to only generate <emphasis>
<property>"protected"</property></emphasis> setters, have
classes always implement a certain set of interfaces or even have them
extend a certain base class and even more.</para>
17 years
JBoss Tools SVN: r5525 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-01-08 09:51:09 -0500 (Tue, 08 Jan 2008)
New Revision: 5525
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1560
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java 2008-01-07 18:15:45 UTC (rev 5524)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/popup/PopupMenuProvider.java 2008-01-08 14:51:09 UTC (rev 5525)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.hibernate.ui.veditor.editors.popup;
import org.eclipse.gef.ContextMenuProvider;
@@ -44,19 +54,22 @@
if (getViewer().getSelection() instanceof StructuredSelection){
IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
if (selection != null && selection.getFirstElement() instanceof OrmEditPart) {
- Shape shape = (Shape)((OrmEditPart)selection.getFirstElement()).getModel();
- Object first = shape.getOrmElement();
- if (first instanceof PersistentClass
- || first instanceof Property
- || first instanceof Table
- || first instanceof Column){
- action = getActionRegistry().getAction(OpenSourceAction.ACTION_ID);
- appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
- createMenuItem(getMenu(), action);
-
- action = getActionRegistry().getAction(OpenMappingAction.ACTION_ID);
- appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
- createMenuItem(getMenu(), action);
+ Object obj = ((OrmEditPart)selection.getFirstElement()).getModel();
+ if (null != obj && obj instanceof Shape) {
+ Shape shape = (Shape)obj;
+ Object first = shape.getOrmElement();
+ if (first instanceof PersistentClass
+ || first instanceof Property
+ || first instanceof Table
+ || first instanceof Column){
+ action = getActionRegistry().getAction(OpenSourceAction.ACTION_ID);
+ appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
+ createMenuItem(getMenu(), action);
+
+ action = getActionRegistry().getAction(OpenMappingAction.ACTION_ID);
+ appendToGroup(GEFActionConstants.MB_ADDITIONS, action);
+ createMenuItem(getMenu(), action);
+ }
}
}
}
17 years
JBoss Tools SVN: r5524 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferencepages.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-01-07 13:15:45 -0500 (Mon, 07 Jan 2008)
New Revision: 5524
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferencepages/ViewPreferencePage.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1483
Check for null value added
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferencepages/ViewPreferencePage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferencepages/ViewPreferencePage.java 2008-01-04 19:10:15 UTC (rev 5523)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferencepages/ViewPreferencePage.java 2008-01-07 18:15:45 UTC (rev 5524)
@@ -117,8 +117,10 @@
retval = retval && comp.performOk();
}
- // refresh the viewer
- JBossServerView.getDefault().refreshAll();
+ // refresh the viewer if it is opened
+ if (JBossServerView.getDefault() != null) {
+ JBossServerView.getDefault().refreshAll();
+ }
return retval;
}
17 years
JBoss Tools SVN: r5523 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test: META-INF and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-01-04 14:10:15 -0500 (Fri, 04 Jan 2008)
New Revision: 5523
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.classpath
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.project
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/META-INF/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/build.properties
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletstest.jar
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsTestPlugin.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/ImportFaceletsComponents.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1504
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.classpath
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.classpath (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.classpath 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.project
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.project (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/.project 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.jsf.vpe.facelets.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/META-INF/MANIFEST.MF 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test Plug-in
+Bundle-SymbolicName: org.jboss.tools.jsf.vpe.facelets.test
+Bundle-Version: 1.0.0
+Bundle-Activator: org.jboss.tools.jsf.vpe.facelets.test.FaceletsTestPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.vpe,
+ org.junit,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.jboss.tools.common
+Eclipse-LazyStart: true
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/build.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/build.properties (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/build.properties 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletstest.jar
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletstest.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsAllTests.java 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,19 @@
+package org.jboss.tools.jsf.vpe.facelets.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class FaceletsAllTests {
+
+ public static Test suite() {
+
+ TestSuite suite = new TestSuite("Tests for Vpe Facelets components"); // $NON-NLS-1$
+ // $JUnit-BEGIN$
+
+ suite.addTestSuite(FaceletsComponentTest.class);
+
+ // $JUnit-END$
+ return suite;
+
+ }
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentTest.java 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.facelets.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * Class for testing all Seam components
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class FaceletsComponentTest extends TestCase implements ILogListener {
+
+ private final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; // $NON-NLS-1$
+ private final static String TEST_PROJECT_JAR_PATH = "/faceletstest.jar"; // $NON-NLS-1$
+
+ // check warning log
+ private final static boolean checkWarning = false;
+ private Throwable exception;
+
+ public FaceletsComponentTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // TODO: Use TestSetup to create and remove project once for all tests
+ // not for every one
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember("faceletsTest") == null) {
+
+ ImportFaceletsComponents.importFaceletsPages(FaceletsTestPlugin
+ .getPluginResourcePath()
+ + TEST_PROJECT_JAR_PATH);
+
+ waitForJobs();
+ delay(5000);
+ }
+ Platform.addLogListener(this);
+ }
+
+ /**
+ * Perform post-test cleanup.
+ *
+ * @throws Exception
+ *
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (ResourcesPlugin.getWorkspace().getRoot().findMember("faceletsTest") != null) {
+ ImportFaceletsComponents.removeProject();
+ }
+ Platform.removeLogListener(this);
+ }
+
+ /**
+ * 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 (Job.getJobManager().currentJob() != null)
+ delay(5000);
+ }
+
+ public void testInsert() throws PartInitException, Throwable {
+ performTestForFaceletComponent("insert.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testDefine() throws PartInitException, Throwable {
+ performTestForFaceletComponent("define.xhtml"); // $NON-NLS-1$
+ }
+
+ public void testComposite() throws PartInitException, Throwable {
+ performTestForFaceletComponent("composition.xhtml"); // $NON-NLS-1$
+ }
+
+ private void performTestForFaceletComponent(String componentPage)
+ throws PartInitException, Throwable {
+ waitForJobs();
+
+ exception = null;
+ IPath componentPath = ImportFaceletsComponents
+ .getComponentPath(componentPage);
+
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ componentPath);
+ IEditorInput input = new FileEditorInput(file);
+
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(input, EDITOR_ID, true);
+
+ waitForJobs();
+ delay(5000);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .closeAllEditors(true);
+
+ if (exception != null) {
+ throw exception;
+ }
+ }
+
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ exception = status.getException();
+ break;
+ case IStatus.WARNING:
+ if (checkWarning)
+ exception = status.getException();
+ break;
+ default:
+ break;
+ }
+
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsTestPlugin.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsTestPlugin.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsTestPlugin.java 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,74 @@
+package org.jboss.tools.jsf.vpe.facelets.test;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+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 FaceletsTestPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.jsf.vpe.facelets.test";
+
+ // The shared instance
+ private static FaceletsTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public FaceletsTestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static FaceletsTestPlugin getDefault() {
+ 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")); // $NON-NLS-1$
+ } catch (Exception e) {
+ url = bundle.getEntry("/resources"); // $NON-NLS-1$
+ }
+ return (url == null) ? null : url.getPath();
+ }
+
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/ImportFaceletsComponents.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/ImportFaceletsComponents.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/ImportFaceletsComponents.java 2008-01-04 19:10:15 UTC (rev 5523)
@@ -0,0 +1,92 @@
+package org.jboss.tools.jsf.vpe.facelets.test;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider;
+import org.eclipse.ui.wizards.datatransfer.ImportOperation;
+
+/**
+ * Class for importing project from jar file
+ *
+ * @author dsakovich(a)exadel.com
+ *
+ */
+public class ImportFaceletsComponents {
+ private static final String PROJECT_NAME = "faceletsTest"; // $NON-NLS-1$
+ private static final String COMPONENTS_PATH = "WebContent/pages"; // $NON-NLS-1$
+
+ @SuppressWarnings("restriction")
+ static void importFaceletsPages(String path) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+ ZipLeveledStructureProvider zipStructureProvider;
+ try {
+ zipStructureProvider = new ZipLeveledStructureProvider(new ZipFile(
+ path));
+
+ IOverwriteQuery overwrite = new IOverwriteQuery() {
+ public String queryOverwrite(String pathString) {
+ return ALL;
+ }
+ };
+
+ ImportOperation importOp = new ImportOperation(project
+ .getFullPath(), zipStructureProvider.getRoot(),
+ zipStructureProvider, overwrite);
+
+ importOp.setContext(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell());
+
+ importOp.run(new NullProgressMonitor());
+ } catch (InvocationTargetException ite) {
+ FaceletsTestPlugin.getPluginLog().logError(ite.getCause());
+ } catch (InterruptedException ie) {
+ FaceletsTestPlugin.getPluginLog().logError(ie);
+ } catch (IOException e) {
+ FaceletsTestPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ /**
+ *
+ * @return
+ * @throws CoreException
+ */
+ static IPath getComponentPath(String componentPage) throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+ if (project != null) {
+ IResource resource = project.getFolder(COMPONENTS_PATH).findMember(
+ componentPage);
+ if (resource != null) {
+ return resource.getFullPath();
+ }
+
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @throws CoreException
+ */
+ static void removeProject() throws CoreException {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ PROJECT_NAME);
+ if (project != null) {
+ project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
+ new NullProgressMonitor());
+ }
+ }
+}
17 years
JBoss Tools SVN: r5521 - trunk/hibernatetools/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-01-04 12:46:57 -0500 (Fri, 04 Jan 2008)
New Revision: 5521
Modified:
trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml
trunk/hibernatetools/docs/reference/en/modules/setup.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-236 - adding highlighting
Modified: trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml 2008-01-04 17:45:51 UTC (rev 5520)
+++ trunk/hibernatetools/docs/reference/en/modules/codegenarchitecture.xml 2008-01-04 17:46:57 UTC (rev 5521)
@@ -21,9 +21,7 @@
<para>
<itemizedlist>
<listitem>
- <para>A <emphasis>
- <property>Core configuration</property>
- </emphasis> uses Hibernate Core and supports reading <emphasis>
+ <para>A Core configuration uses Hibernate Core and supports reading <emphasis>
<property>hbm.xml</property>
</emphasis> files, requires a <emphasis>
<property>hibernate.cfg.xml</property>
@@ -33,9 +31,7 @@
</listitem>
<listitem>
- <para>An <emphasis>
- <property>Annotation configuration</property>
- </emphasis> uses Hibernate Annotations and supports <emphasis>
+ <para>An Annotation configuration uses Hibernate Annotations and supports <emphasis>
<property>hbm.xml</property>
</emphasis> and annotated classes, requires a <emphasis>
<property>hibernate.cfg.xml</property>
@@ -45,9 +41,7 @@
</listitem>
<listitem>
- <para>A <emphasis>
- <property>JPA configuration</property>
- </emphasis> uses a Hibernate EntityManager and supports <emphasis>
+ <para>A JPA configuration uses a Hibernate EntityManager and supports <emphasis>
<property>hbm.xml</property>
</emphasis> and annotated classes requires that the project has a <emphasis>
<property>META-INF/persistence.xml</property>
@@ -57,9 +51,7 @@
</listitem>
<listitem>
- <para>A <emphasis>
- <property>JDBC configuration</property>
- </emphasis> uses <property>Hibernate Tools</property> reverse engineering and reads its
+ <para>A JDBC configuration uses <property>Hibernate Tools</property> reverse engineering and reads its
mappings via JDBC metadata + additional reverse engineering files (reveng.xml).
Automatically used in Eclipse when doing reverse engineering from JDBC and named
<emphasis>
Modified: trunk/hibernatetools/docs/reference/en/modules/setup.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en/modules/setup.xml 2008-01-04 17:45:51 UTC (rev 5520)
+++ trunk/hibernatetools/docs/reference/en/modules/setup.xml 2008-01-04 17:46:57 UTC (rev 5521)
@@ -69,11 +69,7 @@
<property>hibernate-tools.jar</property>
</emphasis> and associated libraries. The libraries are included in the distribution from the
Hibernate website and the Eclipse updatesite. The libraries are located in the eclipse plugins
- directory at <emphasis>
- <property>
- <literal>/plugins/org.hibernate.eclipse.x.x.x/lib/tools/.</literal>
- </property>
- </emphasis>These libraries are 100% independent from the eclipse platform. How to use these
- via ant tasks are described in the Ant chapter.</para>
+ directory at /plugins/org.hibernate.eclipse.x.x.x/lib/tools/. These libraries are 100% independent from the eclipse platform. How to use these
+ via ant tasks are described in the <link linkend="ant">Ant Tools</link> chapter.</para>
</section>
</chapter>
17 years