Author: estherbin
Date: 2008-08-06 09:22:15 -0400 (Wed, 06 Aug 2008)
New Revision: 9571
Removed:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java
Log:
Move test cases from *.vpe.test to the vpe.ui.test package.
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java 2008-08-06
13:19:04 UTC (rev 9570)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java 2008-08-06
13:22:15 UTC (rev 9571)
@@ -1,140 +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.vpe.ui.test;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.resources.IFile;
-import org.jboss.tools.vpe.editor.css.ELReferenceList;
-import org.jboss.tools.vpe.editor.css.ResourceReference;
-
-
-/**
- * The common test case for the all test cases related to the <a
- * href="https://jira.jboss.com:8443/jira/browse/JBIDE-2010"
- * >JBIDE-2010</a>issue.
- */
-public abstract class CommonJBIDE2010Test extends VpeTest {
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String DIR_TEST_PAGE_NAME_3 =
"JBIDE/2010/page3.xhtml"; //$NON-NLS-1$
-
- /** The Constant VALUE_5. */
- protected static final String VALUE_5 = "world"; //$NON-NLS-1$
-
- /** The Constant KEY_5. */
- protected static final String KEY_5 = "#{bean1.property3}"; //$NON-NLS-1$
-
- /** The Constant VALUE_4. */
- protected static final String VALUE_4 = "background: red"; //$NON-NLS-1$
-
- /** The Constant KEY_4. */
- protected static final String KEY_4 = "#{bean1.property2}"; //$NON-NLS-1$
-
- /** The Constant IMPORT_PROJECT_NAME. */
- public static final String IMPORT_PROJECT_NAME = "jsfTest"; //$NON-NLS-1$
-
- /** The Constant KEY_3. */
- protected static final String KEY_3 = "#{facesContext.requestPath}";
//$NON-NLS-1$
-
- /** The Constant KEY_2. */
- protected static final String KEY_2 = "#{beanA.property2}"; //$NON-NLS-1$
-
- /** The Constant DIR_TEST_PAGE_NAME. */
- protected static final String DIR_TEST_PAGE_NAME_2 =
"JBIDE/2010/page2.jsp"; //$NON-NLS-1$
-
- /** The Constant DIR_TEST_PAGE_NAME. */
- protected static final String DIR_TEST_PAGE_NAME = "JBIDE/2010/page.jsp";
//$NON-NLS-1$
-
- /** The Constant KEY_1. */
- protected static final String KEY_1 = "#{beanA.property1}"; //$NON-NLS-1$
-
- /** The Constant elValuesMap. */
- protected static final Map<String, String> elValuesMap = new HashMap<String,
String>();
-
- /** The file. */
- protected IFile file;
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public CommonJBIDE2010Test(String name) {
- super(name);
-
- }
-
- /**
- * Sets the up.
- *
- * @throws Exception the exception
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- elValuesMap.put(KEY_1, "/path/image/path/to/image/"); //$NON-NLS-1$
- elValuesMap.put(KEY_2, "/path2/"); //$NON-NLS-1$
- elValuesMap.put(KEY_3, "/facesContext/"); //$NON-NLS-1$
- elValuesMap.put(KEY_4, VALUE_4);
- elValuesMap.put(KEY_5, VALUE_5);
- file = (IFile) TestUtil.getComponentPath(getOpenPageName(),
getOpenProjectName());
- ResourceReference[] entries = new ResourceReference[elValuesMap.size()];
- int i = 0;
- for (Entry<String, String> string : elValuesMap.entrySet()) {
-
- entries[i] = new ResourceReference(string.getKey(),
ResourceReference.PROJECT_SCOPE);
- entries[i].setProperties(string.getValue());
- i++;
-
-
- }
- setValues(entries);
- }
-
-
- protected String getOpenPageName(){
- return DIR_TEST_PAGE_NAME;
- }
-
- protected String getOpenProjectName(){
- return IMPORT_PROJECT_NAME;
- }
- /**
- * Sets the values.
- *
- * @param key the key
- * @param value the value
- * @param scope the scope
- * @param entries the entries
- */
- protected void setValues(ResourceReference[] entries) {
- ELReferenceList.getInstance().setAllResources(file, entries);
- }
-
- /**
- * Tear down.
- *
- * @throws Exception the exception
- */
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- ELReferenceList.getInstance().setAllResources(this.file, new
ResourceReference[0]);
- this.file = null;
-
- }
-
-}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java 2008-08-06
13:19:04 UTC (rev 9570)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java 2008-08-06
13:22:15 UTC (rev 9571)
@@ -1,75 +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.vpe.ui.test;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.vpe.editor.util.ElService;
-
-/**
- * <p>
- * Test case for testing service {@link ElService}
- * <p>
- * See <a
href="http://jira.jboss.com/jira/browse/JBIDE-2010">JBIDE-20...
issue
- *
- */
-public class ElPreferencesTestCase extends CommonJBIDE2010Test {
-
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public ElPreferencesTestCase(String name) {
- super(name);
-
- }
-
- /**
- * Test replace attribute value.
- *
- * @throws CoreException the core exception
- */
- public void testReplaceAttributeValue() throws CoreException {
- String string1 = "#{beanA.property1}/images/smalle.gif"; //$NON-NLS-1$
- String replacedValue = ElService.getInstance().replaceEl(file, string1);
-
- assertEquals("Should be equals " + elValuesMap.get(KEY_1) +
"/images/smalle.gif", replacedValue, elValuesMap.get(KEY_1) //$NON-NLS-1$
//$NON-NLS-2$
- + "/images/smalle.gif"); //$NON-NLS-1$
-
- }
-
- /**
- * Test replace attribute value2.
- *
- * @throws CoreException the core exception
- */
- public void testReplaceAttributeValue2() throws CoreException {
- String string1 =
"#{beanA.property1}/images/#{beanA.property2}/path2/#{facesContext.requestPath}/smalle.gif";
//$NON-NLS-1$
-
- final String replacedValue = ElService.getInstance().replaceEl(file, string1);
- final String check = elValuesMap.get(KEY_1) + "/images/" +
elValuesMap.get(KEY_2) + "/path2/" + elValuesMap.get(KEY_3) //$NON-NLS-1$
//$NON-NLS-2$
- + "/smalle.gif"; //$NON-NLS-1$
- assertEquals("Should be equals " + check, check, replacedValue);
//$NON-NLS-1$
-
- }
-
- /**
- * Test replace not in set.
- */
- public void testReplaceNotInSet() {
- String string1 = "#{requestScope}/smalle.gif"; //$NON-NLS-1$
-
- assertEquals("Should be equals", string1,
ElService.getInstance().replaceEl(file, string1)); //$NON-NLS-1$
- }
-}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java 2008-08-06
13:19:04 UTC (rev 9570)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java 2008-08-06
13:22:15 UTC (rev 9571)
@@ -1,93 +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.vpe.ui.test;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-
-
-/**
- * Test case for testing
https://jira.jboss.com:8443/jira/browse/JBIDE-2010
- * issue.
- *
- * @author Eugeny Stherbin
- */
-public class JBIDE2010Test extends CommonJBIDE2010Test {
-
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public JBIDE2010Test(String name) {
- super(name);
- }
-
- /**
- * Test el template simple.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void testElTemplateSimple() throws CoreException, Throwable {
- final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_2,
- IMPORT_PROJECT_NAME));
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "td" elements
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
-
- assertEquals("Count of divs should be equals 1", 1, elements.size());
//$NON-NLS-1$
- final nsIDOMElement spanOne = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted", VALUE_4,
spanOne.getFirstChild().getNodeValue()); //$NON-NLS-1$
-
- }
-
-
- /**
- * Test el template simple.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void testElTemplateSimple2() throws CoreException, Throwable {
- final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_3,
- IMPORT_PROJECT_NAME));
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "td" elements
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_P);
-
- assertEquals("Value should be equals", 1, elements.size());
//$NON-NLS-1$
- final nsIDOMElement pOne = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- // DOMTreeDumper d = new DOMTreeDumper();
- // d.dumpToStream(System.out, rst);
-// assertEquals("Value should be equals", "Hello "+VALUE_5,
pOne.getFirstChild().getFirstChild().getNodeValue());
- assertTrue("Value should be
contains",pOne.getAttribute(HTML.ATTR_STYLE).startsWith(VALUE_4)); //$NON-NLS-1$
-
- }
-
-}
Deleted:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java 2008-08-06
13:19:04 UTC (rev 9570)
+++
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java 2008-08-06
13:22:15 UTC (rev 9571)
@@ -1,184 +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.vpe.ui.test;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.SelectionUtil;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Node;
-
-
-/**
- * Test case for testing <a
- *
href="https://jira.jboss.org/jira/browse/JBIDE-2582"> JBIDE-2582
</a> issue
- *
- * @author Evgenij Stherbin
- */
-public class JBIDE2582Test extends CommonJBIDE2010Test {
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String PAGE_1 = "JBIDE/2582/page1.xhtml";
//$NON-NLS-1$
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String PAGE_2 = "JBIDE/2582/page2.xhtml";
//$NON-NLS-1$
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public JBIDE2582Test(String name) {
- super(name);
-
- }
-
- /**
- * Test rs substitution.
- *
- * @throws Throwable the throwable
- */
- public void _testRsSubstitution() throws Throwable {
- final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent(file);
-
- assertNotNull(rst);
-
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
-
- assertEquals("Size should be equals 1", 1, elements.size());
//$NON-NLS-1$
-
- final nsIDOMElement spanOne = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted",
"Hello", spanOne.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- /**
- * _test resource substitution in text.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void _testResourceSubstitutionInText() throws CoreException, Throwable {
- final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(PAGE_2, getOpenProjectName()));
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- // DOMTreeDumper dumper = new DOMTreeDumper();
- // dumper.dumpToStream(System.out, rst);
- TestUtil.findAllElementsByName(rst, elements, "H3"); //$NON-NLS-1$
- assertEquals("Size should be equals 1", 1, elements.size());
//$NON-NLS-1$
-
- final nsIDOMElement h3one = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted",
"Hello", h3one.getFirstChild().getFirstChild().getNodeValue()); //$NON-NLS-1$
//$NON-NLS-2$
-
- // There are the label:#{msg.header}f
-
- TestUtil.findAllElementsByName(rst, elements, "SPAN"); //$NON-NLS-1$
- assertEquals("Size should be equals 1", 4, elements.size());
//$NON-NLS-1$
- final nsIDOMElement pOne = ((nsIDOMElement)
elements.get(2).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
-
- assertEquals(
- "Style attribute should be substituted", "There are the
label:Hello Demo Application", pOne.getFirstChild().getNodeValue()); //$NON-NLS-1$
//$NON-NLS-2$
-
- }
-
- /**
- * Test selection with resource string.
- *
- * @throws CoreException the core exception
- */
- @SuppressWarnings("restriction")
- public void testSelectionWithResourceString() throws CoreException {
- IFile lfile = (IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName());
- IEditorInput input = new FileEditorInput(lfile);
- // open and get editor
- JSPMultiPageEditor part = openEditor(input);
-
- // get controller
- VpeController controller = getVpeController(part);
- assertNotNull(controller);
-
- // get dommapping
- VpeDomMapping domMapping = controller.getDomMapping();
-
- assertNotNull(domMapping);
-
- // get source map
- Map<Node, VpeNodeMapping> sourceMap = domMapping.getSourceMap();
- assertNotNull(sourceMap);
-
- // get collection of VpeNodeMapping
- Collection<VpeNodeMapping> mappings = sourceMap.values();
- assertNotNull(mappings);
-
- // get xulrunner editor
- XulRunnerEditor xulRunnerEditor = controller.getXulRunnerEditor();
- assertNotNull(xulRunnerEditor);
-
- int start =
controller.getPageContext().getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(
- "#{msg.hello_message}"); //$NON-NLS-1$
-
- assertTrue("Should be gt that 100", start > 100); //$NON-NLS-1$
-
- IStructuredModel model;
- model = StructuredModelManager.getModelManager()
-
.getExistingModelForRead(controller.getSourceEditor().getTextViewer().getDocument());
- IDOMDocument document = null;
- document = ((IDOMModel) model).getDocument();
- ;
- org.w3c.dom.NodeList nodeList =
document.getElementsByTagName("h:outputText"); //$NON-NLS-1$
-
- assertNotNull("Can't be null", nodeList); //$NON-NLS-1$
- assertTrue("Size should be great that 0", nodeList.getLength() > 0);
//$NON-NLS-1$
-
- final Node elementNode = nodeList.item(0);
-
- SelectionUtil.setSourceSelection(controller.getPageContext(), elementNode, 0,
0);
-
- nsIDOMNode node =
SelectionUtil.getLastSelectedNode(controller.getPageContext());
-
- assertEquals("Node names should be equals", "Hello",
node.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- /**
- * Gets the open page name.
- *
- * @return the open page name
- */
- protected String getOpenPageName() {
- return PAGE_1;
- }
-
-}