Author: yradtsevich
Date: 2010-02-25 08:24:40 -0500 (Thu, 25 Feb 2010)
New Revision: 20484
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ChangeMessageBundleTest_JBIDE5818.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2582Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3441Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3734Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4373Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestOpenOnForXhtmlFiles_JBIDE5577.java
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/build.properties
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsHTMLComponentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeAllTests.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5837
Make possible to run VPE JUnit tests one by one
- Fail-fast behavior has been implemented in the ProjectsLoader.
- plugin.xml of the org.jboss.tools.struts.vpe.struts.test has been added to source and
binary builds (build.properties changed).
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ChangeMessageBundleTest_JBIDE5818.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ChangeMessageBundleTest_JBIDE5818.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/ChangeMessageBundleTest_JBIDE5818.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -71,7 +73,7 @@
* with {@code newContent} and saves it.
*/
private TextEditor replaceFileContent(final String path,
- final String newContent) throws CoreException {
+ final String newContent) throws CoreException, IOException {
IFile elementPageFile = (IFile) TestUtil.getResource(path,
JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(elementPageFile);
TextEditor editor = (TextEditor)
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2582Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2582Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2582Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -13,6 +13,7 @@
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -119,9 +120,11 @@
* Test selection with resource string.
*
* @throws CoreException the core exception
+ * @throws IOException
*/
@SuppressWarnings("restriction")
- public void testSelectionWithResourceString() throws CoreException {
+ public void testSelectionWithResourceString()
+ throws CoreException, IOException {
IFile lfile = (IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName());
IEditorInput input = new FileEditorInput(lfile);
// open and get editor
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2624Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -14,6 +14,7 @@
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -51,7 +52,7 @@
super(name);
}
- public void testJBide2624() throws CoreException {
+ public void testJBide2624() throws CoreException, IOException {
// get test page path
setException(null);
IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME, //$NON-NLS-1$
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3441Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3441Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3441Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import junit.framework.Assert;
import org.eclipse.core.resources.IFile;
@@ -80,7 +82,7 @@
}
private VpeController openPageInVpe(final String pageName) throws CoreException,
- PartInitException {
+ PartInitException, IOException {
IFile elementPageFile = (IFile) TestUtil.getComponentPath(
pageName, JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(elementPageFile);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3734Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3734Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3734Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
@@ -88,7 +90,7 @@
}
private VpeController openTestPage() throws CoreException,
- PartInitException {
+ PartInitException, IOException {
IFile ifile = (IFile) TestUtil.getComponentPath(TEST_FOLDER_PATH + TEST_FILE_NAME,
JsfAllTests.IMPORT_PROJECT_NAME);
IEditorInput input = new FileEditorInput(ifile);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4373Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4373Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4373Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorPart;
@@ -40,7 +42,7 @@
/**
* OpenOn test for Custom elements
*/
- public void testCorrectCustomElements() throws CoreException {
+ public void testCorrectCustomElements() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"correctCustomTags.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 13, 8);
@@ -61,7 +63,8 @@
/**
* test openOn for undefined template
*/
- public void testIncorrectCustomElements() throws CoreException {
+ public void testIncorrectCustomElements()
+ throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"incorrectCustomTags.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 9, 6);
@@ -80,9 +83,11 @@
/**
* test open on for following case <h:outputText value="#{msg.greeting}"
/>
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForMessageBundlesInJSFElements() throws CoreException{
- VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"testOutputText.xhtml"); //$NON-NLS-1$
+ public void testOpenOnForMessageBundlesInJSFElements()
+ throws CoreException, IOException{
+ VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"testOutputText.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 13,
30);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
nsIDOMNode domNode = vpeController.getDomMapping().getNearVisualNode(sourceNode);
@@ -93,8 +98,10 @@
/**
* test open on for following case #{msg.prompt}
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForTextNodesMessageBundles() throws CoreException{
+ public void testOpenOnForTextNodesMessageBundles()
+ throws CoreException, IOException{
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"testOutputText.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 12,
15);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -109,8 +116,9 @@
* in facelets' ui:composition template (VpeCompositionTemplate).
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnforFacelets() throws CoreException {
+ public void testOpenOnforFacelets() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"inputName.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 10, 38);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -125,8 +133,9 @@
* in facelets' ui:decorate template (VpeDecorateTemplate).
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForUiDecorate() throws CoreException {
+ public void testOpenOnForUiDecorate() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"ui-decorate.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 11, 33);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -141,8 +150,9 @@
* in facelets' ui:define template (VpeDefineTemplate).
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForUiDefine() throws CoreException {
+ public void testOpenOnForUiDefine() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"ui-define.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 6, 40);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -157,8 +167,9 @@
* in JSTL's c:import template (JstlImportTemplate).
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForCImport() throws CoreException {
+ public void testOpenOnForCImport() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"c-import.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 12, 25);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -173,8 +184,9 @@
* in Seam's s:decorate template (SeamDecorateTemplate).
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForSDecorate() throws CoreException {
+ public void testOpenOnForSDecorate() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"s-decorate.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 11, 33);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -188,8 +200,9 @@
* Test openOn mechanism for VpeIncludeTemplate in ajax4jsf a4j:include.
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForA4JInclude() throws CoreException {
+ public void testOpenOnForA4JInclude() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"a4j-include.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 15, 55);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -203,8 +216,9 @@
* Test openOn mechanism for VpeIncludeTemplate in facelets' ui:include.
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForUiInclude() throws CoreException {
+ public void testOpenOnForUiInclude() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"ui-include-relative.xhtml"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 13, 27);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -218,8 +232,9 @@
* Test openOn mechanism for VpeIncludeTemplate in jsp's jsp:directive.include.
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForJspDirectiveInclude() throws CoreException {
+ public void testOpenOnForJspDirectiveInclude() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"jsp-directive-include-relative.jsp"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 13, 46);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -233,8 +248,9 @@
* Test openOn mechanism for VpeIncludeTemplate in jsp's jsp:include.
*
* @throws CoreException
+ * @throws IOException
*/
- public void testOpenOnForJspInclude() throws CoreException {
+ public void testOpenOnForJspInclude() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_CUSTOM_FACELETS_PROJECT,
"jsp-include-relative.jsp"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 13, 36);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
@@ -252,7 +268,7 @@
* @author mareshkau
*/
- public void testOpenOnForHREF() throws CoreException {
+ public void testOpenOnForHREF() throws CoreException, IOException {
VpeController vpeController = openInVpe(JsfAllTests.IMPORT_PROJECT_NAME,
"JBIDE/5183/a.html"); //$NON-NLS-1$
int position =
TestUtil.getLinePositionOffcet(vpeController.getSourceEditor().getTextViewer(), 5, 41);
Node sourceNode =
SelectionUtil.getNodeBySourcePosition(vpeController.getSourceEditor(), position);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
@@ -233,9 +235,11 @@
* @param linePosition
* @return
* @throws CoreException
+ * @throws IOException
*/
private ICompletionProposal[] checkOfCAByStartString(String caName, String
testPagePath,
- String partOfString, int lineIndex, int linePosition) throws CoreException {
+ String partOfString, int lineIndex, int linePosition)
+ throws CoreException, IOException {
return this.checkOfCAByStartString(caName, testPagePath, partOfString, lineIndex,
linePosition,true);
}
@@ -249,10 +253,11 @@
* @param isCheck
* @return
* @throws CoreException
+ * @throws IOException
*/
private ICompletionProposal[] checkOfCAByStartString(String caName, String
testPagePath,
- String partOfString, int lineIndex, int linePosition,boolean isCheck) throws
CoreException {
+ String partOfString, int lineIndex, int linePosition,boolean isCheck) throws
CoreException, IOException {
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(testPagePath,
JsfAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestOpenOnForXhtmlFiles_JBIDE5577.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestOpenOnForXhtmlFiles_JBIDE5577.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestOpenOnForXhtmlFiles_JBIDE5577.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+import java.io.IOException;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorInput;
@@ -36,7 +38,7 @@
super(name);
}
- public void testOpenOnForXhtmlFiles() throws CoreException {
+ public void testOpenOnForXhtmlFiles() throws CoreException, IOException {
/*
* Open index.html
*/
Modified: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/build.properties
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/build.properties 2010-02-24
22:54:57 UTC (rev 20483)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/build.properties 2010-02-25
13:24:40 UTC (rev 20484)
@@ -1,11 +1,13 @@
bin.includes = META-INF/,\
resources/,\
struts-test.jar,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml
jars.compile.order = struts-test.jar
src.includes = src/,\
resources/,\
META-INF/,\
- build.properties
+ build.properties,\
+ plugin.xml
source.struts-test.jar = src/
output.struts-test.jar = bin/
Modified:
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsHTMLComponentTest.java
===================================================================
---
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsHTMLComponentTest.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsHTMLComponentTest.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,12 +10,7 @@
******************************************************************************/
package org.jboss.tools.struts.vpe.struts.test;
-import java.util.HashMap;
-
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.jboss.tools.vpe.ui.test.ProjectsLoader;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -55,35 +50,7 @@
}
public void testImage() throws Throwable {
- /*
- * XXX temporary code is used to debug Struts tests on Hudson.
- * It must be removed when the problem with the failing tests is resolved.
- */
- StringBuilder debugInfo = new StringBuilder();
- debugInfo.append("projectNameToPath = ")
- .append(ProjectsLoader.getInstance().getProjectNameToPath())
- .append(";\n");
-
- IProject project = ProjectsLoader.getInstance().getProject(IMPORT_PROJECT_NAME);
- assertNotNull(debugInfo.toString(), project);
- debugInfo.append("project = ").append(project).append(";\n")
- .append("project.exists() =
").append(project.exists()).append(";\n")
- .append("project.isOpen() =
").append(project.isOpen()).append(";\n");
-
- IFolder folder = project.getFolder("WebContent/pages");
- assertNotNull(debugInfo.toString(), folder);
- debugInfo.append("folder = ").append(folder).append(";\n")
- .append("folder.exists() =
").append(folder.exists()).append(";\n");
-
- IFile testFile = (IFile) folder.findMember("components/html/image.jsp");
- assertNotNull(debugInfo.toString(), testFile);
- debugInfo.append("testFile = ").append(folder).append(";\n")
- .append("testFile.exists() =
").append(testFile.exists()).append(";\n");
-
- performTestForVpeComponent(testFile);
- fail(debugInfo.toString());
-
- //
performTestForVpeComponent((IFile)TestUtil.getComponentPath("components/html/image.jsp",
IMPORT_PROJECT_NAME)); //$NON-NLS-1$
+ performTestForVpeComponent((IFile)TestUtil.getComponentPath("components/html/image.jsp",
IMPORT_PROJECT_NAME)); //$NON-NLS-1$
}
public void testImg() throws Throwable {
@@ -91,10 +58,6 @@
}
public void testLink() throws Throwable {
- // XXX wait is added just to check if the test will fail on Hudson.
- // Most probably it is not needed.
- TestUtil.waitForIdle();
-
performTestForVpeComponent((IFile)TestUtil.getComponentPath("components/html/link.jsp",
IMPORT_PROJECT_NAME)); //$NON-NLS-1$
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,9 +10,13 @@
******************************************************************************/
package org.jboss.tools.vpe.ui.test;
+import java.io.IOException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import junit.framework.Assert;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -20,8 +24,6 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.test.util.JobUtils;
@@ -38,11 +40,35 @@
private static final String TEST_PROJECT_ELEMENT = "testProject";
private static final String TEST_PROJECT_PATH_ATTRIBUTE = "path";
private static final String TEST_PROJECT_NAME_ATTRIBUTE = "name";
- private Map<String, String> projectNameToPath;
+ private Map<String, ProjectLocation> projectNameToLocation;
private static ProjectsLoader instance = null;
private ProjectsLoader() {
- loadProjectPaths();
+ /*
+ * Load project names and paths to them from the extensions of
+ * {@link VpeAllTests#VPE_TEST_EXTENTION_POINT_ID}. And store
+ * loaded data in {@link #projectNameToLocation}.
+ */
+ projectNameToLocation = new HashMap<String, ProjectLocation>();
+ IExtension[] extensions = VPETestPlugin.getDefault().getVpeTestExtensions();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] confElements = extension
+ .getConfigurationElements();
+ for (IConfigurationElement configurationElement : confElements) {
+ if (TEST_PROJECT_ELEMENT.equals(
+ configurationElement.getName())) {
+ Bundle bundle = Platform.getBundle(
+ configurationElement.getNamespaceIdentifier());
+ String name = configurationElement.getAttribute(
+ TEST_PROJECT_NAME_ATTRIBUTE);
+ String path = configurationElement.getAttribute(
+ TEST_PROJECT_PATH_ATTRIBUTE);
+
+ projectNameToLocation.put(name,
+ new ProjectLocation(bundle, path));
+ }
+ }
+ }
}
/**
@@ -60,17 +86,48 @@
* Returns instance of {@link IProject} by {@code projectName}.
* If the project does not exist in the workspace, imports it from the
* resources specified by extensions of {@code org.jboss.tools.vpe.ui.tests}
- * extension point. Returns {@code null} if the project is not declared in
- * the extensions.
+ * extension point.
+ * <p>
+ * This method has <i>fail-fast</i> behavior. It never returns {@code
null}.
+ * It throws exceptions in the cases if the project is not defined,
+ * can not be opened, etc.
*/
- public IProject getProject(String projectName) {
+ public IProject getProject(String projectName) throws IOException {
IProject project = getExistingProject(projectName);
if (project == null) {
- String projectPath = projectNameToPath.get(projectName);
- if (projectPath != null) {
- project = ResourcesUtils.importProjectIntoWorkspace(
+ ProjectLocation location = projectNameToLocation.get(projectName);
+ if (location == null) {
+ throw new RuntimeException(
+ "Project '" + project + "' is not defined.");
+ }
+
+ Bundle bundle = location.getBundle();
+ if (bundle == null) {
+ throw new NullPointerException(
+ "Owning bundle of '" + project + "' is null.");
+ }
+
+ URL rootEntry = bundle.getEntry("/");
+ if (rootEntry == null) {
+ throw new NullPointerException(
+ "Root entry to the bundle with id='"
+ + bundle.getBundleId() + "' cannot be resolved.");
+ }
+
+ URL resolvedRootEntry = FileLocator.resolve(rootEntry);
+ String pluginRoot = resolvedRootEntry.getPath();
+ if (pluginRoot.equals("")) {
+ throw new RuntimeException("Path to '" + resolvedRootEntry
+ + "' does not exist.");
+ }
+
+ String projectPath = pluginRoot + location.getPath();
+ project = ResourcesUtils.importProjectIntoWorkspace(
projectPath, projectName);
+ if (project == null) {
+ throw new RuntimeException("Project by the path='" + projectPath
+ + "' cannot be imported.");
}
}
@@ -92,41 +149,6 @@
}
/**
- * Loads project names and paths to them from the extensions of
- * {@link VpeAllTests#VPE_TEST_EXTENTION_POINT_ID}. And stores
- * loaded data in {@link #projectNameToPath}.
- */
- private void loadProjectPaths() {
- projectNameToPath = new HashMap<String, String>();
- IExtensionRegistry extensionRepository = Platform
- .getExtensionRegistry();
-
- IExtensionPoint extensionPoint = extensionRepository
- .getExtensionPoint(VpeAllTests.VPE_TEST_EXTENTION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
- for (IExtension extension : extensions) {
- IConfigurationElement[] confElements = extension
- .getConfigurationElements();
- for (IConfigurationElement configurationElement : confElements) {
- if (TEST_PROJECT_ELEMENT.equals(configurationElement.getName())) {
- try {
- Bundle bundle = Platform.getBundle(configurationElement
- .getNamespaceIdentifier());
-
- String pluginRoot = FileLocator
- .resolve(bundle.getEntry("/")).getPath();
- String name = configurationElement.getAttribute(TEST_PROJECT_NAME_ATTRIBUTE);
- String path = configurationElement.getAttribute(TEST_PROJECT_PATH_ATTRIBUTE);
- projectNameToPath.put(name, pluginRoot + path);
- } catch (Exception e) {
- VPETestPlugin.getDefault().logError(e);
- }
- }
- }
- }
- }
-
- /**
* Removes the project with the {@code projectName} from the workspace.
*
* @param projectName the project name
@@ -168,13 +190,30 @@
removeProject(project);
}
}
-
- /*
- * XXX This temporary method is used to debug Struts tests on Hudson.
- * It must be removed when the problem with the failing tests is resolved.
+
+ /**
+ * Stores the {@code path} to a project and the owning {@code bundle}.
+ *
+ * @author Yahor Radtsevich (yradtsevich)
*/
- @Deprecated
- public Map<String, String> getProjectNameToPath() {
- return projectNameToPath;
+ private class ProjectLocation {
+ private Bundle bundle;
+ private String path;
+
+ public ProjectLocation(Bundle bundle, String path) {
+ this.bundle = bundle;
+ this.path = path;
+ }
+ public Bundle getBundle() {
+ return bundle;
+ }
+ public String getPath() {
+ return path;
+ }
+
+ public String toString() {
+ return String.format("(%s, %s)",
+ bundle == null ? null : bundle.getLocation(), path);
+ }
}
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.ui.test;
import java.io.File;
+import java.io.IOException;
import java.util.List;
import junit.framework.Assert;
@@ -66,20 +67,20 @@
* @return the component path
*
* @throws CoreException the core exception
+ * @throws IOException
*/
public static IResource getComponentPath(String componentPage,
- String projectName) throws CoreException {
+ String projectName) throws CoreException, IOException {
IProject project = ProjectsLoader.getInstance().getProject(projectName);
if (project != null) {
return project.getFolder(COMPONENTS_PATH).findMember(componentPage);
-
}
return null;
}
public static IResource getResource(String path,
- String projectName) throws CoreException {
+ String projectName) throws CoreException, IOException {
IProject project = ProjectsLoader.getInstance().getProject(projectName);
if (project != null) {
return project.findMember(path);
@@ -97,9 +98,10 @@
* @return the web content path
*
* @throws CoreException the core exception
+ * @throws IOException
*/
public static IResource getWebContentPath(String componentPage,
- String projectName) throws CoreException {
+ String projectName) throws CoreException, IOException {
IProject project = ProjectsLoader.getInstance().getProject(projectName);
if (project != null) {
return project.getFolder(WEBCONTENT_PATH).findMember(componentPage);
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VPETestPlugin.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -10,12 +10,11 @@
******************************************************************************/
package org.jboss.tools.vpe.ui.test;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.common.log.BaseUIPlugin;
-import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
@@ -25,6 +24,8 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.vpe.ui.test";
+
+ public static final String VPE_TEST_EXTENTION_POINT_ID =
"org.jboss.tools.vpe.ui.tests"; //$NON-NLS-1$
// The shared instance
private static VPETestPlugin plugin;
@@ -62,15 +63,14 @@
return plugin;
}
- 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();
+ /**
+ * Returns all extensions of {@value #VPE_TEST_EXTENTION_POINT_ID}
+ */
+ public IExtension[] getVpeTestExtensions() {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = extensionRegistry
+ .getExtensionPoint(VPE_TEST_EXTENTION_POINT_ID);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ return extensions;
}
-}
\ No newline at end of file
+}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeAllTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeAllTests.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeAllTests.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -17,8 +17,6 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
@@ -30,7 +28,6 @@
public class VpeAllTests {
public static final String TESTS_ELEMENT = "tests";
- public static final String VPE_TEST_EXTENTION_POINT_ID =
"org.jboss.tools.vpe.ui.tests"; //$NON-NLS-1$
public static final String TEST_SUITE_PARAM = "testSuite"; //$NON-NLS-1$
public static final String METHOD_SUITE_NAME = "suite"; //$NON-NLS-1$
public static final String VPE_TEST_PROJECT_NAME = "vpeTest"; //$NON-NLS-1$
@@ -38,12 +35,7 @@
public static Test suite() {
TestSuite result = new TestSuite();
- IExtensionRegistry extensionRepository = Platform
- .getExtensionRegistry();
-
- IExtensionPoint extensionPoint = extensionRepository
- .getExtensionPoint(VPE_TEST_EXTENTION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
+ IExtension[] extensions = VPETestPlugin.getDefault().getVpeTestExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] confElements = extension
.getConfigurationElements();
@@ -71,5 +63,4 @@
return result;
}
-
}
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-02-24
22:54:57 UTC (rev 20483)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2010-02-25
13:24:40 UTC (rev 20484)
@@ -13,6 +13,7 @@
package org.jboss.tools.vpe.ui.test;
+import java.io.IOException;
import java.util.Collection;
import java.util.Map;
@@ -350,9 +351,10 @@
*
* @return VpeController
* @throws CoreException
+ * @throws IOException
*/
- protected VpeController openInVpe(String projectName, String fileName) throws
CoreException
- {
+ protected VpeController openInVpe(String projectName, String fileName)
+ throws CoreException, IOException {
// get test page path
final IFile file =
(IFile) TestUtil.getComponentPath(fileName, projectName);