Changed over f:loadBundle variable support to use the Sybase LoadBundleUtil to find the bundle:
- moved LoadBundleUtil from jsf.common.ui to jsf.core
- changed code over to use LoadBundleUtil
- added regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=144525 solved indirectly with this fix.
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/AllTests.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/AllTests.java
index 4ad5271..2a07cd4 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/AllTests.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/AllTests.java
@@ -20,6 +20,7 @@
import org.eclipse.jst.jsf.validation.el.tests.jsp.BeanPropertyResolutionTestCase;
import org.eclipse.jst.jsf.validation.el.tests.jsp.BeanVariableResolutionTestCase;
import org.eclipse.jst.jsf.validation.el.tests.jsp.BuiltInSymbolsTestCase;
+import org.eclipse.jst.jsf.validation.el.tests.jsp.DataTableResolutionTestCase;
import org.eclipse.jst.jsf.validation.el.tests.jsp.GreaterThanEqTestCase;
import org.eclipse.jst.jsf.validation.el.tests.jsp.GreaterThanTestCase;
import org.eclipse.jst.jsf.validation.el.tests.jsp.JSPFunctionsTestCase;
@@ -59,6 +60,7 @@
suite.addTestSuite(BeanPropertyResolutionTestCase.class);
suite.addTestSuite(BeanVariableResolutionTestCase.class);
suite.addTestSuite(LoadBundleResolutionTestCase.class);
+ suite.addTestSuite(DataTableResolutionTestCase.class);
suite.addTestSuite(BuiltInSymbolsTestCase.class);
suite.addTestSuite(AssignabilityTestCase.class);
suite.addTestSuite(JSPFunctionsTestCase.class);
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
index 3c3a08c..7641255 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/base/BaseTestCase.java
@@ -115,6 +115,7 @@
"/testdata/classes/Bundle.properties.data");
_jdtTestEnv.addResourceFile("src", new ByteArrayInputStream(resource.toBytes()),
"beans", "Bundle.properties");
+
}
protected void tearDown() throws Exception
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
index 763653d..f81e9f0 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/jsp/LoadBundleResolutionTestCase.java
@@ -1,9 +1,12 @@
package org.eclipse.jst.jsf.validation.el.tests.jsp;
+import java.io.ByteArrayInputStream;
import java.util.List;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jst.jsf.common.internal.types.TypeConstants;
+import org.eclipse.jst.jsf.test.util.TestFileResource;
+import org.eclipse.jst.jsf.validation.el.tests.ELValidationTestPlugin;
import org.eclipse.jst.jsf.validation.el.tests.base.SingleJSPTestCase;
import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
@@ -19,50 +22,67 @@
_srcFileName = "/testdata/jsps/loadBundleResolution.jsp.data";
_destFileName = "/loadBundleResolution.jsp";
super.setUp();
+
+ // add a resource bundle to the default package to test regression on bug 144525
+ TestFileResource resource = new TestFileResource();
+ resource = new TestFileResource();
+ resource.load(ELValidationTestPlugin.getDefault().getBundle(),
+ "/testdata/classes/Bundle.properties.data");
+ _jdtTestEnv.addResourceFile("src", new ByteArrayInputStream(resource.toBytes()),
+ "", "Bundle.properties");
+
}
public void testSanity()
{
- assertEquals("bundle.bundleProp2", getELText(_structuredDocument,972));
- assertEquals("bundle.bundleProp1 && myBean.stringProperty", getELText(_structuredDocument,1024));
- assertEquals("empty bundle", getELText(_structuredDocument,1101));
- assertEquals("empty bundle.bundleProp2", getELText(_structuredDocument,1147));
- assertEquals("bundle.bundleProp2 + 5", getELText(_structuredDocument,1205));
- assertEquals("bundleProp2", getELText(_structuredDocument,1258));
- assertEquals("bundle.x.y", getELText(_structuredDocument,1300));
-
- assertEquals("-bundle.bundleProp1", getELText(_structuredDocument,1368));
- assertEquals("bundle.bundleProp3", getELText(_structuredDocument,1421));
- assertEquals("msg", getELText(_structuredDocument,1473));
- assertEquals("bundle.x", getELText(_structuredDocument,1510));
+ assertEquals("bundle.bundleProp2", getELText(_structuredDocument,1031));
+ assertEquals("noPackageBundle.bundleProp2", getELText(_structuredDocument,1080));
+ assertEquals("bundle.bundleProp1 && myBean.stringProperty", getELText(_structuredDocument,1141));
+ assertEquals("empty bundle", getELText(_structuredDocument,1218));
+ assertEquals("empty bundle.bundleProp2", getELText(_structuredDocument,1264));
+ assertEquals("bundle.bundleProp2 + 5", getELText(_structuredDocument,1322));
+ assertEquals("bundleProp2", getELText(_structuredDocument,1375));
+ assertEquals("bundle.x.y", getELText(_structuredDocument,1417));
+ assertEquals("noPackageBundle.x.y", getELText(_structuredDocument,1458));
+
+ assertEquals("-bundle.bundleProp1", getELText(_structuredDocument,1535));
+ assertEquals("bundle.bundleProp3", getELText(_structuredDocument,1588));
+ assertEquals("msg", getELText(_structuredDocument,1640));
+ assertEquals("bundle.x", getELText(_structuredDocument,1677));
+ assertEquals("noPackageBundle.notAProperty", getELText(_structuredDocument,1716));
}
public void testNoErrorExprs()
{
- assertNoError(972, TypeConstants.TYPE_STRING);
- assertNoError(1024, Signature.SIG_BOOLEAN);
- assertNoError(1101, Signature.SIG_BOOLEAN);
- assertNoError(1147, Signature.SIG_BOOLEAN);
- assertNoError(1205, Signature.SIG_LONG);
- //assertNoError(1258, TypeConstants.TYPE_STRING);
- assertNoError(1300, TypeConstants.TYPE_STRING);
+ assertNoError(1031, TypeConstants.TYPE_STRING);
+ assertNoError(1080, TypeConstants.TYPE_STRING);
+ assertNoError(1141, Signature.SIG_BOOLEAN);
+ assertNoError(1218, Signature.SIG_BOOLEAN);
+ assertNoError(1264, Signature.SIG_BOOLEAN);
+ assertNoError(1322, Signature.SIG_LONG);
+ //assertNoError(1375, TypeConstants.TYPE_STRING);
+ assertNoError(1417, TypeConstants.TYPE_STRING);
+ assertNoError(1458, TypeConstants.TYPE_STRING);
}
public void testWarningExprs()
{
- List list = assertSemanticWarning(1368, Signature.SIG_LONG, 1);
+ List list = assertSemanticWarning(1535, Signature.SIG_LONG, 1);
assertContainsProblem(list, DiagnosticFactory.UNARY_OP_STRING_CONVERSION_NOT_GUARANTEED_ID);
- list = assertSemanticWarning(1421, null, 1);
+ list = assertSemanticWarning(1588, null, 1);
assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
- list = assertSemanticWarning(1473, null, 1);
+ list = assertSemanticWarning(1640, null, 1);
assertContainsProblem(list, DiagnosticFactory.VARIABLE_NOT_FOUND_ID);
- list = assertSemanticWarning(1510, null, 1);
+ list = assertSemanticWarning(1677, null, 1);
+ assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
+
+ list = assertSemanticWarning(1716, null, 1);
assertContainsProblem(list, DiagnosticFactory.MEMBER_NOT_FOUND_ID);
}
-
+
public void testErrorExprs()
{
// no error
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/util/CreateTestCaseForJSP.java b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/util/CreateTestCaseForJSP.java
index 3e21015..e534abc 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/util/CreateTestCaseForJSP.java
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/src/org/eclipse/jst/jsf/validation/el/tests/util/CreateTestCaseForJSP.java
@@ -24,7 +24,7 @@
*/
public class CreateTestCaseForJSP extends TestCase
{
- private final static String jspFile = "dataTableResolution";
+ private final static String jspFile = "loadBundleResolution";
private static IFile file;
private static IStructuredModel model;
diff --git a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/testdata/jsps/loadBundleResolution.jsp.data b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/testdata/jsps/loadBundleResolution.jsp.data
index 16683f5..58879c9 100644
--- a/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/testdata/jsps/loadBundleResolution.jsp.data
+++ b/jsf/tests/org.eclipse.jst.jsf.validation.el.tests/testdata/jsps/loadBundleResolution.jsp.data
@@ -22,23 +22,27 @@
<f:view>
<f:loadBundle var="bundle" basename="beans.Bundle"/>
<f:loadBundle var="msg" basename="TestMessages"/>
+ <f:loadBundle var="noPackageBundle" basename="Bundle"/>
<h1>JSP Page</h1>
<!-- no errors -->
<h:outputText value="#{bundle.bundleProp2}"/>
+ <h:outputText value="#{noPackageBundle.bundleProp2}"/>
<h:outputText value="#{bundle.bundleProp1 && myBean.stringProperty}"/>
<h:outputText value="#{empty bundle}"/>
<h:outputText value="#{empty bundle.bundleProp2}"/>
<h:outputText value="#{bundle.bundleProp2 + 5}"/>
<h:outputText value="#{bundleProp2}"/>
<h:outputText value="#{bundle.x.y}"/>
+ <h:outputText value="#{noPackageBundle.x.y}"/>
<!-- warnings -->
<h:outputText value="#{-bundle.bundleProp1}"/>
<h:outputText value="#{bundle.bundleProp3}"/>
<h:outputText value="#{msg}"/>
<h:outputText value="#{bundle.x}"/>
-
+ <h:outputText value="#{noPackageBundle.notAProperty}"/>
+
<!-- errors -->
</f:view>