Author: estherbin
Date: 2008-07-17 11:04:41 -0400 (Thu, 17 Jul 2008)
New Revision: 9164
Added:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/META-INF/MANIFEST.MF
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
Log:
ADD JUNIT
https://jira.jboss.com:8443/jira/browse/JBIDE-2010
Modified: trunk/vpe/tests/org.jboss.tools.vpe.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/META-INF/MANIFEST.MF 2008-07-17 15:03:05 UTC
(rev 9163)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/META-INF/MANIFEST.MF 2008-07-17 15:04:41 UTC
(rev 9164)
@@ -10,8 +10,14 @@
org.junit,
org.jboss.tools.common,
org.jboss.tools.vpe,
+ org.jboss.tools.jst.jsp,
org.jboss.tools.vpe.ui.test,
org.jboss.tools.jsf.vpe.jsf.test,
+ org.jboss.tools.jsf.vpe.richfaces.test,
+ org.jboss.tools.common.model,
+ org.jboss.tools.jsf.vpe.richfaces,
+ org.jboss.tools.vpe.xulrunner,
+ org.mozilla.xpcom,
org.jboss.tools.tests;bundle-version="2.0.0",
org.jboss.tools.common.model.ui;bundle-version="2.0.0"
Eclipse-LazyStart: true
Added:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java 2008-07-17
15:04:41 UTC (rev 9164)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.test;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.jsf.vpe.richfaces.test.CommonRichFacesTestCase;
+import org.jboss.tools.vpe.editor.css.ELReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+
+
+/**
+ * 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 CommonRichFacesTestCase {
+
+ /** The Constant VALUE_4. */
+ protected static final String VALUE_4 = "background:red";
+
+ /** The Constant KEY_4. */
+ protected static final String KEY_4 = "#{bean1.property2}";
+
+ /** The Constant IMPORT_PROJECT_NAME. */
+ public static final String IMPORT_PROJECT_NAME = "jsfTest";
+
+ /** The Constant KEY_3. */
+ protected static final String KEY_3 = "#{facesContext.requestPath}";
+
+ /** The Constant KEY_2. */
+ protected static final String KEY_2 = "#{beanA.property2}";
+
+ /** The Constant DIR_TEST_PAGE_NAME. */
+ protected static final String DIR_TEST_PAGE_NAME_2 =
"JBIDE/2010/page2.jsp";
+
+ /** The Constant DIR_TEST_PAGE_NAME. */
+ protected static final String DIR_TEST_PAGE_NAME = "JBIDE/2010/page.jsp";
+
+ /** The Constant KEY_1. */
+ protected static final String KEY_1 = "#{beanA.property1}";
+
+ /** 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/");
+ elValuesMap.put(KEY_2, "/path2/");
+ elValuesMap.put(KEY_3, "/facesContext/");
+ elValuesMap.put(KEY_4, VALUE_4);
+ file = (IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
+ 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);
+ }
+ }
+
+ /**
+ * 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;
+
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java 2008-07-17
15:03:05 UTC (rev 9163)
+++
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java 2008-07-17
15:04:41 UTC (rev 9164)
@@ -1,40 +1,30 @@
+/*******************************************************************************
+ * 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.test;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.vpe.editor.css.ELReferenceList;
-import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.jboss.tools.vpe.editor.util.ElService;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.ui.test.VpeTest;
/**
* <p>
- * Test case for testing service {@link ElService}
+ * 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 VpeTest {
+public class ElPreferencesTestCase extends CommonJBIDE2010Test {
- /** The Constant KEY_3. */
- private static final String KEY_3 = "#{facesContext.requestPath}";
- /** The Constant KEY_2. */
- private static final String KEY_2 = "#{beanA.property2}";
-
- /** The Constant IMPORT_PROJECT_NAME. */
- public static final String IMPORT_PROJECT_NAME = "jsfTest";
-
- /** The Constant DIR_TEST_PAGE_NAME. */
- private static final String DIR_TEST_PAGE_NAME = "JBIDE/2010/page.xhtml";
-
/**
* The Constructor.
*
@@ -46,71 +36,6 @@
}
/**
- * The Constructor.
- */
- public ElPreferencesTestCase() {
- super(ElPreferencesTestCase.class.getName());
-
- }
-
- /** The Constant KEY_1. */
- private static final String KEY_1 = "#{beanA.property1}";
-
- /** The Constant elValuesMap. */
- protected static final Map<String, String> elValuesMap = new HashMap<String,
String>();
-
- /** The file. */
- private IFile file;
-
- /**
- * Sets the up.
- *
- * @throws Exception the exception
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- elValuesMap.put(KEY_1, "/path/image/path/to/image/");
- elValuesMap.put(KEY_2, "/path2/");
- elValuesMap.put(KEY_3, "/facesContext/");
- file = (IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
- 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);
- }
- }
-
- /**
- * 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();
-
- }
-
- /**
* Test replace attribute value.
*
* @throws CoreException the core exception
Added:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
(rev 0)
+++
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java 2008-07-17
15:04:41 UTC (rev 9164)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * 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.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.jsf.vpe.richfaces.test.RichFacesComponentTest;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.xulrunner.browser.util.DOMTreeDumper;
+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 = 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());
+ final nsIDOMElement spanOne = (nsIDOMElement)
elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ assertEquals("Style attribute should be substituted", VALUE_4,
spanOne.getFirstChild().getNodeValue());
+ int i = 0;
+ DOMTreeDumper dumper = new DOMTreeDumper();
+ dumper.dumpToStream(System.out, rst);
+ // for(nsIDOMNode n:elements){
+ // final nsIDOMElement d = (nsIDOMElement)
+ // elements.get(i++).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ // System.out.println("JBIDE2010Test.testElTemplateSimple()-"+d.
+ // getAttribute("style"));
+ // }
+
+ }
+
+}
Property changes on:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
===================================================================
---
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-07-17
15:03:05 UTC (rev 9163)
+++
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-07-17
15:04:41 UTC (rev 9164)
@@ -41,7 +41,7 @@
suite.addTestSuite(VpeEditorPreferencesPageTest.class);
suite.addTestSuite(VpeTemplateManagerTest.class);
suite.addTestSuite(ElPreferencesTestCase.class);
-
+ suite.addTestSuite(JBIDE2010Test.class);
List<ImportBean> projectToImport = new ArrayList<ImportBean>();
ImportBean importBean = new ImportBean();