Author: vrubezhny
Date: 2011-07-22 07:21:06 -0400 (Fri, 22 Jul 2011)
New Revision: 33134
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages.properties
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages_de.properties
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.xhtml
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/SeamResourceBundlesTest.java
Log:
JBIDE-9087
Support of Bundles bean in CDI projects with Seam International module.
JUnit Test Case for Content Assist on bundles and their properties for Seam 3
International Module is added
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/META-INF/MANIFEST.MF 2011-07-22
10:46:36 UTC (rev 33133)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/META-INF/MANIFEST.MF 2011-07-22
11:21:06 UTC (rev 33134)
@@ -13,5 +13,10 @@
org.jboss.tools.tests,
org.eclipse.core.runtime;bundle-version="3.7.0",
org.jboss.tools.cdi.core,
- org.jboss.tools.jst.jsp.base.test
+ org.jboss.tools.jst.jsp.base.test,
+ org.jboss.tools.cdi.core.test;bundle-version="1.2.0",
+ org.jboss.tools.common;bundle-version="3.3.0",
+ org.eclipse.ui;bundle-version="3.7.0",
+ org.jboss.tools.common.base.test;bundle-version="3.3.0",
+ org.eclipse.jface.text;bundle-version="3.7.0"
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages.properties
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages.properties 2011-07-22
11:21:06 UTC (rev 33134)
@@ -0,0 +1,3 @@
+home_header=About this example application
+home_body=This sample application demonstrates how easy it is to develop stateful web
applications using Java EE 6 augmented with portable Seam modules. Just register, login,
and book a room to see the future of Java EE in action. Throughout the application
you'll see notes in the sidebar that explain how this platform helps you meet
enterprise application requirements.
+home_note=Note: Please do NOT enter personal information or your credit card number in
this sample application.
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages_de.properties
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages_de.properties
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages_de.properties 2011-07-22
11:21:06 UTC (rev 33134)
@@ -0,0 +1,3 @@
+de_home_header=�ber dieses Beispiel-Anwendung
+de_home_body=Dieses Beispiel demonstriert, wie einfach es ist, EE-Module zu entwickeln
stateful Web-Applikationen mit Java 6 mit tragbaren Augmented Seam. Just register, login,
and book a room to see the future of Java EE in action. Einfach registrieren, einloggen,
und buchen Sie ein Zimmer zum Handeln sieht die Zukunft von Java EE in. Throughout the
application you'll see notes in the sidebar that explain how this platform helps you
meet enterprise application requirements. W�hrend der Anwendung, die Sie in der
Seitenleiste sehen Noten, die erkl�ren, wie diese Plattform hilft Ihnen, Enterprise
Application Anforderungen.
+de_home_note=HINWEIS: Bitte keine pers�nlichen Daten oder Ihre Kreditkartennummer in
dieser Beispielanwendung in Kraft.
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/messages_de.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.xhtml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.xhtml
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.xhtml 2011-07-22
11:21:06 UTC (rev 33134)
@@ -0,0 +1,11 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:h="http://java.sun.com/jsf/html">
+
+ <ui:define name="body">
+ <h:outputText value="#{bundles.messages.home_header}"/>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/resources/seam-international.xhtml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java 2011-07-22
10:46:36 UTC (rev 33133)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java 2011-07-22
11:21:06 UTC (rev 33134)
@@ -19,6 +19,7 @@
* @author Alexey Kazakov
*/
public class CDISeamCoreAllTests {
+ protected static String PLUGIN_ID = "org.jboss.tools.cdi.seam.core.test";
public static Test suite() {
JavaModelManager.getIndexManager().disable();
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/SeamResourceBundlesTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/SeamResourceBundlesTest.java 2011-07-22
10:46:36 UTC (rev 33133)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/SeamResourceBundlesTest.java 2011-07-22
11:21:06 UTC (rev 33134)
@@ -10,13 +10,101 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.core.test;
-import junit.framework.TestCase;
+import java.io.File;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.cdi.seam.core.CDISeamCorePlugin;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jst.jsp.test.TestUtil;
+import org.jboss.tools.jst.jsp.test.ca.ContentAssistantTestCase;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.test.util.JobUtils;
+import org.osgi.framework.Bundle;
+
/**
* @author Alexey Kazakov
+ * @author Victor Rubezhny
*/
-public class SeamResourceBundlesTest extends TestCase {
+public class SeamResourceBundlesTest extends TCKTest {
+ protected static final String SEAM_INTERNATIONAL_LIB_SUFFIX =
"/seam-international.jar";
+ protected static final String SEAM_INTERNATIONAL_PAGE_SUFFIX =
"/seam-international.xhtml";
+ protected static final String DEFAULT_RESOURCE_BUNDLE_SUFFIX =
"/messages.properties";
+ protected static final String DE_RESOURCE_BUNDLE_SUFFIX =
"/messages_de.properties";
+ protected static final String RESOURCES_SUFFIX = "/resources";
+
+ protected static String LIB_SUFFIX = "/lib";
+ private ContentAssistantTestCase caTest = new ContentAssistantTestCase();
+ private static final String PAGE_NAME =
"WebContent/seam-international.xhtml";
+ private String[] resourceBundleNames = new String[] {"bundles.messages"};
+ private String[] defaultResourceBundleNameProperties = new String[]
{"bundles.messages.home_header", "bundles.messages.home_body",
"bundles.messages.home_note"};
+ private String[] germanResourceBundleNameProperties = new String[]
{"bundles.messages.de_home_header", "bundles.messages.de_home_body",
"bundles.messages.de_home_note"};
+
public void testResourceBundles() {
+ // Set up seam-international.jar library into the project's WEB-INF/lib folder
+ try {
+ assertTrue("Cannot set up SEAM International module and resource bundles into a
test project",
+ setUpSeamInternationalLibraryAndResourceBundle());
+ } catch (Exception e) {
+ fail("Cannot set up SEAM International module and resource bundles into a test
project: "
+ + e.getLocalizedMessage());
+ }
+
+ // Test that seam-international module is successfully installed on the CDI project
+ assertTrue("SEAM International module is not installed or incorrectly
installed",
+ CDICorePlugin.getCDI(tckProject, true).getExtensionManager()
+ .isCDIExtensionAvailable(CDISeamCorePlugin.CDI_INTERNATIONAL_RUNTIME_EXTENTION));
+
+ // Perform CA test
+ caTest.checkProposals(PAGE_NAME, "value=\"#{", 9, resourceBundleNames,
false);
+ caTest.checkProposals(PAGE_NAME, "value=\"#{bundles.messages.", 26,
defaultResourceBundleNameProperties, false);
+ caTest.checkProposals(PAGE_NAME, "value=\"#{bundles.messages.", 26,
germanResourceBundleNameProperties, false);
+
}
+
+ private boolean setUpSeamInternationalLibraryAndResourceBundle() throws Exception {
+ Bundle b = Platform.getBundle(CDISeamCoreAllTests.PLUGIN_ID);
+ String projectPath = tckProject.getLocation().toOSString();
+ String resourcePath = FileLocator.resolve(b.getEntry(RESOURCES_SUFFIX)).getFile();
+
+ File seamInternationalLibFrom = new File(resourcePath +
SEAM_INTERNATIONAL_LIB_SUFFIX);
+ File seamInternationalLibTo = new File(projectPath + WEB_CONTENT_SUFFIX +
WEB_INF_SUFFIX
+ + LIB_SUFFIX + SEAM_INTERNATIONAL_LIB_SUFFIX);
+ if (!FileUtil.copyFile(seamInternationalLibFrom, seamInternationalLibTo))
+ return false;
+
+ File defaultResourceBundleFrom = new File(resourcePath +
DEFAULT_RESOURCE_BUNDLE_SUFFIX);
+ File defaultResourceBundleTo = new File(projectPath + JAVA_SOURCE_SUFFIX +
DEFAULT_RESOURCE_BUNDLE_SUFFIX);
+ if (!FileUtil.copyFile(defaultResourceBundleFrom, defaultResourceBundleTo))
+ return false;
+
+ File germanResourceBundleFrom = new File(resourcePath + DE_RESOURCE_BUNDLE_SUFFIX);
+ File germanResourceBundleTo = new File(projectPath + JAVA_SOURCE_SUFFIX +
DE_RESOURCE_BUNDLE_SUFFIX);
+ if (!FileUtil.copyFile(germanResourceBundleFrom, germanResourceBundleTo))
+ return false;
+
+ File seamInternationalPageFrom = new File(resourcePath +
SEAM_INTERNATIONAL_PAGE_SUFFIX);
+ File seamInternationalPageTo = new File(projectPath + WEB_CONTENT_SUFFIX
+ + SEAM_INTERNATIONAL_PAGE_SUFFIX);
+ if (!FileUtil.copyFile(seamInternationalPageFrom, seamInternationalPageTo))
+ return false;
+
+ ValidatorManager.setStatus(ValidatorManager.RUNNING);
+ tckProject.refreshLocal(IResource.DEPTH_INFINITE, null);
+ JobUtils.waitForIdle();
+ tckProject.build(IncrementalProjectBuilder.CLEAN_BUILD, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ tckProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ TestUtil.waitForValidation();
+
+ caTest.setProject(tckProject);
+ return true;
+ }
}
\ No newline at end of file