summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory Amerson2014-05-22 14:35:14 (EDT)
committerNick Sandonato2014-05-22 14:35:46 (EDT)
commitfb4f94a89ca998d3427dbf4df4a83e9c0bdc1a8e (patch)
treed254ecdd4efefd897702b596296bbd36cb8a07c4
parent473a366f9645b1a3eac32c0d105c66ad69844b97 (diff)
downloadwebtools.sourceediting.tests-fb4f94a89ca998d3427dbf4df4a83e9c0bdc1a8e.zip
webtools.sourceediting.tests-fb4f94a89ca998d3427dbf4df4a83e9c0bdc1a8e.tar.gz
webtools.sourceediting.tests-fb4f94a89ca998d3427dbf4df4a83e9c0bdc1a8e.tar.bz2
[432978] Support nested at_begin varsv201405221842
Signed-off-by: Gregory Amerson <gregory.amerson@liferay.com>
-rw-r--r--tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java18
-rw-r--r--tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_432978/WebContent/test2.jsp25
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
index 47d3c16..a58d11d 100644
--- a/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
+++ b/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/translation/JSPJavaTranslatorCoreTest.java
@@ -755,7 +755,9 @@ public class JSPJavaTranslatorCoreTest extends TestCase {
waitForBuildAndValidation(project);
IFile file = project.getFile("/WebContent/test.jsp");
+ IFile file2= project.getFile("/WebContent/test2.jsp");
IDOMModel structuredModel = null;
+ IDOMModel structuredModel2 = null;
try {
structuredModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(file);
@@ -769,10 +771,26 @@ public class JSPJavaTranslatorCoreTest extends TestCase {
// the extra variable should only be declared once in the translated text
assertEquals( 2, translation.split( "java.lang.Integer extra" ).length );
+
+ structuredModel2 = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(file2);
+
+ ModelHandlerForJSP.ensureTranslationAdapterFactory(structuredModel2);
+
+ JSPTranslationAdapter translationAdapter2 = (JSPTranslationAdapter) structuredModel2.getDocument().getAdapterFor(IJSPTranslation.class);
+
+ final String translation2 = translationAdapter2.getJSPTranslation().getJavaText();
+
+ assertTrue( translation2.indexOf( "extra" ) != -1 );
+
+ // the extra variable should be declared twice because of the nested atbegin tags
+ assertEquals( 3, translation2.split( "java.lang.Integer extra" ).length );
}
finally {
if (structuredModel != null)
structuredModel.releaseFromRead();
+
+ if (structuredModel2 != null)
+ structuredModel2.releaseFromRead();
}
}
}
diff --git a/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_432978/WebContent/test2.jsp b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_432978/WebContent/test2.jsp
new file mode 100644
index 0000000..268f93d
--- /dev/null
+++ b/tests/org.eclipse.jst.jsp.core.tests/testfiles/bug_432978/WebContent/test2.jsp
@@ -0,0 +1,25 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%@ taglib uri="http://eclipse.org/test" prefix="test" %>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+
+<c:choose>
+ <c:when test="true">
+ <test:atbegin>
+ </test:atbegin>
+ </c:when>
+ <c:otherwise>
+ <test:atbegin>
+ </test:atbegin>
+ </c:otherwise>
+</c:choose>
+
+</body>
+</html> \ No newline at end of file