Author: estherbin
Date: 2008-08-11 06:06:22 -0400 (Mon, 11 Aug 2008)
New Revision: 9635
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
Test case for the JBIDE-2594
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-08-08
18:59:21 UTC (rev 9634)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2008-08-11
10:06:22 UTC (rev 9635)
@@ -33,6 +33,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2505Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2582Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2584Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2594Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide1467Test;
@@ -86,6 +87,7 @@
suite.addTestSuite(ElPreferencesTestCase.class);
suite.addTestSuite(JBIDE2010Test.class);
suite.addTestSuite(JBIDE2582Test.class);
+ suite.addTestSuite(JBIDE2594Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java 2008-08-11
10:06:22 UTC (rev 9635)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.jbide;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jsf.vpe.jsf.test.CommonJBIDE2010Test;
+import org.jboss.tools.vpe.editor.css.GlobalELReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
+import org.jboss.tools.vpe.editor.util.ElService;
+
+/**
+ * Test case for testing global El expression substitution
+ * @author Evgenij Stherbin
+ *
+ */
+public class JBIDE2594Test extends CommonJBIDE2010Test {
+
+ /**
+ *
+ */
+ protected static final String KEY_6 = "#{global.value1}"; //$NON-NLS-1$
+ protected Map<String, String> globalElMap = new HashMap<String,
String>();
+
+ /**
+ * @param name
+ */
+ public JBIDE2594Test(String name) {
+ super(name);
+ }
+
+
+
+
+ public void testReplaceGlobalElVariable(){
+ String replaceString= KEY_6+"images/test.gif"; //$NON-NLS-1$
+ String replacedString = ElService.getInstance().replaceEl(file, replaceString);
+
+ assertEquals("Should be equals " + globalElMap.get(KEY_6) +
"images/test.gif", replacedString, globalElMap.get(KEY_6) //$NON-NLS-1$
//$NON-NLS-2$
+ + "images/test.gif"); //$NON-NLS-1$
+ }
+
+ /**
+ * Test replace attribute value.
+ *
+ * @throws CoreException the core exception
+ */
+ public void testOverrideLocalVariable() throws CoreException {
+ String string1 = KEY_1+"/images/smalle.gif"; //$NON-NLS-1$
+ String replacedValue = ElService.getInstance().replaceEl(file, string1);
+
+ assertEquals("Should be equals " + globalElMap.get(KEY_1) +
"/images/smalle.gif", replacedValue, globalElMap.get(KEY_1) //$NON-NLS-1$
//$NON-NLS-2$
+ + "/images/smalle.gif"); //$NON-NLS-1$
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ IPath path = Platform.getLocation();
+
+ assertNotNull("Path can't be null",path); //$NON-NLS-1$
+
+ globalElMap.put(KEY_1, "/override/global/value/"); //$NON-NLS-1$
+ globalElMap.put(KEY_6, "/global/value1/"); //$NON-NLS-1$
+
+ ResourceReference[] entries = new ResourceReference[globalElMap.size()];
+ int i = 0;
+ for (Entry<String, String> string : globalElMap.entrySet()) {
+
+ entries[i] = new ResourceReference(string.getKey(),
ResourceReference.GLOBAL_SCOPE);
+ entries[i].setProperties(string.getValue());
+ i++;
+ }
+ setGlobalValues(entries, path);
+
+
+ }
+
+
+ protected void setGlobalValues(ResourceReference[] entries,IPath path) {
+ GlobalELReferenceList.getInstance().setAllResources(path, entries);
+ }
+
+
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2594Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native