Author: akazakov
Date: 2011-08-09 21:01:41 -0400 (Tue, 09 Aug 2011)
New Revision: 33746
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamCoreTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamInternationalTestSetup.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/lib/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/META-INF/beans.xml
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project
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/international/BundleModelTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamResourceBundlesTest.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/servlet/SeamServletValidationTest.java
Log:
https://issues.jboss.org/browse/JBIDE-9394
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.classpath
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.classpath 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.classpath 2011-08-10
01:01:41 UTC (rev 33746)
@@ -2,10 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="lib" path="lib/cdi-api.jar"/>
- <classpathentry kind="lib" path="lib/javax.inject.jar"/>
- <classpathentry kind="lib"
path="lib/jboss-interceptor-api.jar"/>
- <classpathentry kind="lib" path="lib/seam-servlet-impl.jar"/>
- <classpathentry kind="lib" path="lib/seam-servlet-api.jar"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con"
path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project 2011-08-10
01:01:41 UTC (rev 33746)
@@ -6,6 +6,16 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -27,8 +37,13 @@
</buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
<nature>org.jboss.tools.cdi.core.cdinature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.jboss.tools.jsf.jsfnature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
Deleted:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/META-INF/beans.xml
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/META-INF/beans.xml 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/META-INF/beans.xml 2011-08-10
01:01:41 UTC (rev 33746)
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<beans>
-</beans>
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-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -31,11 +31,10 @@
TestSuite suiteAll = new TestSuite("Seam Core Tests");
- suiteAll.addTestSuite(SeamResourceBundlesTest.class);
- suiteAll.addTestSuite(BundleModelTest.class);
-
TestSuite suite = new TestSuite("Seam Core Project Tests");
suite.addTestSuite(SeamServletValidationTest.class);
+ suite.addTestSuite(SeamResourceBundlesTest.class);
+ suite.addTestSuite(BundleModelTest.class);
suiteAll.addTest(new SeamCoreTestSetup(suite));
suite = new TestSuite("Seam Persistence Project Tests");
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/BundleModelTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/BundleModelTest.java 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/BundleModelTest.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -2,17 +2,16 @@
import java.util.Set;
-import org.jboss.tools.cdi.core.test.tck.TCKTest;
import org.jboss.tools.cdi.seam.core.international.BundleModelFactory;
import org.jboss.tools.cdi.seam.core.international.IBundle;
import org.jboss.tools.cdi.seam.core.international.IBundleModel;
import org.jboss.tools.cdi.seam.core.international.ILocalizedValue;
import org.jboss.tools.cdi.seam.core.international.IProperty;
-public class BundleModelTest extends TCKTest {
+public class BundleModelTest extends SeamCoreTest {
public void testBundleModel() throws Exception {
- IBundleModel bundleModel = BundleModelFactory.getBundleModel(tckProject);
+ IBundleModel bundleModel = BundleModelFactory.getBundleModel(getTestProject());
assertNotNull(bundleModel);
Set<String> bundles = bundleModel.getAllAvailableBundles();
@@ -31,7 +30,5 @@
value = property.getValue();
assertNotNull(value);
assertEquals("About this example application", value.getValue());
-
}
-
-}
+}
\ No newline at end of file
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamCoreTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamCoreTest.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamCoreTest.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.cdi.seam.core.test.international;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.cdi.seam.core.test.SeamCoreTestSetup;
+import org.jboss.tools.jst.jsp.test.TestUtil;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SeamCoreTest extends TestCase {
+
+ protected IProject project;
+
+ protected IProject getTestProject() throws Exception {
+ if(project==null) {
+ project =
ResourcesPlugin.getWorkspace().getRoot().getProject(SeamCoreTestSetup.PROJECT_NAME);
+ if(!project.exists()) {
+ project = ResourcesUtils.importProject(SeamCoreTestSetup.PLUGIN_ID,
SeamCoreTestSetup.PROJECT_PATH);
+ TestUtil.waitForValidation();
+ }
+ }
+ return project;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamCoreTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamInternationalTestSetup.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamInternationalTestSetup.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamInternationalTestSetup.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.cdi.seam.core.test.international;
+
+import java.io.File;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+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.Platform;
+import org.jboss.tools.cdi.core.test.tck.TCKTest;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.osgi.framework.Bundle;
+
+public class SeamInternationalTestSetup extends TestSetup {
+
+ protected static String LIB_SUFFIX = "/lib";
+ 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";
+
+ public static final String PLUGIN_ID = "org.jboss.tools.cdi.seam.core.test";
+
+ protected IProject project;
+
+ public SeamInternationalTestSetup(Test test) {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ project = TCKTest.importPreparedProject("/");
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ // 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());
+ }
+ }
+
+ private boolean setUpSeamInternationalLibraryAndResourceBundle() throws Exception {
+ Bundle b = Platform.getBundle(PLUGIN_ID);
+ String projectPath = project.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 + TCKTest.WEB_CONTENT_SUFFIX +
TCKTest.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 + TCKTest.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 + TCKTest.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 + TCKTest.WEB_CONTENT_SUFFIX
+ + SEAM_INTERNATIONAL_PAGE_SUFFIX);
+ if (!FileUtil.copyFile(seamInternationalPageFrom, seamInternationalPageTo))
+ return false;
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ return true;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ project.delete(true, true, null);
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamInternationalTestSetup.java
___________________________________________________________________
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/international/SeamResourceBundlesTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamResourceBundlesTest.java 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/international/SeamResourceBundlesTest.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -10,24 +10,17 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.core.test.international;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.FileLocator;
-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.cdi.seam.core.international.el.CDIInternationalMessagesELResolver;
-import org.jboss.tools.cdi.seam.core.test.CDISeamCoreAllTests;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.common.text.ext.util.Utils;
-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.text.ext.hyperlink.ELHyperlink;
import org.jboss.tools.jst.text.ext.hyperlink.ELHyperlinkDetector;
@@ -35,19 +28,11 @@
import org.jboss.tools.jst.text.ext.test.HyperlinkTestUtil.TestHyperlink;
import org.jboss.tools.jst.text.ext.test.HyperlinkTestUtil.TestRegion;
import org.jboss.tools.jst.web.kb.PageContextFactory;
-import org.osgi.framework.Bundle;
/**
* @author Victor Rubezhny
*/
-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";
+public class SeamResourceBundlesTest extends SeamCoreTest {
private ContentAssistantTestCase caTest = new ContentAssistantTestCase();
private static final String PAGE_NAME =
"WebContent/seam-international.xhtml";
@@ -56,49 +41,25 @@
private String[] germanResourceBundleNameProperties = new String[]
{"bundles.messages.de_home_header", "bundles.messages.de_home_body",
"bundles.messages.de_home_note"};
private String[] textDefaultResourceBundleNameProperties = new String[]
{"home_header", "home_body", "home_note"};
private String[] textGermanResourceBundleNameProperties = new String[]
{"de_home_header", "de_home_body", "de_home_note"};
-
- boolean bReadyForTesting = false;
- String errMessage = null;
-
- public SeamResourceBundlesTest () {
- super();
-
- boolean setupOK = true;
- // Set up seam-international.jar library into the project's WEB-INF/lib folder
- try {
- setupOK = setUpSeamInternationalLibraryAndResourceBundle();
- if (!setupOK)
- errMessage = "Cannot set up SEAM International module and resource bundles into
a test project";
- } catch (Exception e) {
- setupOK = false;
- errMessage = "Cannot set up SEAM International module and resource bundles into a
test project: "
- + e.getLocalizedMessage();
- }
-
- if (!setupOK)
- return;
-
- // Test that seam-international module is successfully installed on the CDI project
- setupOK = CDICorePlugin.getCDI(tckProject, true).getExtensionManager()
- .isCDIExtensionAvailable(CDISeamCorePlugin.CDI_INTERNATIONAL_RUNTIME_EXTENTION);
- if (!setupOK)
- errMessage = "SEAM International module is not installed or incorrectly
installed";
-
- bReadyForTesting = setupOK;
+
+ /**
+ * Test that seam-international module is successfully installed on the CDI project
+ * @throws Exception
+ */
+ public void testExtension() throws Exception {
+ assertTrue("SEAM International module is not installed or incorrectly
installed", CDICorePlugin.getCDI(getTestProject(),
true).getExtensionManager().isCDIExtensionAvailable(CDISeamCorePlugin.CDI_INTERNATIONAL_RUNTIME_EXTENTION));
}
-
/**
* The method checks if CDIInternationalMessagesELResolver present among the EL
Resolvers,
* then if the required resolver found uses it to retrieve and test proposals for bundle
and their properties
+ * @throws Exception
*/
- public void testCDIInternationalMessages () {
- assertTrue(errMessage, bReadyForTesting);
-
- IFile page = tckProject.getFile(PAGE_NAME);
+ public void testCDIInternationalMessages () throws Exception {
+ IFile page = getTestProject().getFile(PAGE_NAME);
assertTrue("Test page not found: " + PAGE_NAME, (page != null &&
page.exists()));
ELContext elContext = PageContextFactory.createPageContext(page);
-
+
ELResolver[] elResolvers = elContext.getElResolvers();
ELResolver cdiInternationalModuleResolver = null;
if (elResolvers != null) {
@@ -110,19 +71,19 @@
}
}
assertNotNull("Seam International module resolver is not set up on the
project", cdiInternationalModuleResolver);
-
+
List<TextProposal> bundleProposals =
cdiInternationalModuleResolver.getProposals(elContext, "value=\"#{", 1);
assertTrue("Seam International module resolver didn't return proposals for
bundles",
(bundleProposals != null && bundleProposals.size() > 0));
proposalsExist(bundleProposals, resourceBundleNames);
-
+
List<TextProposal> bundlePropertyProposals =
cdiInternationalModuleResolver.getProposals(elContext,
"value=\"#{bundles.messages.", 1);
assertTrue("Seam International module resolver didn't return proposals for
bundles",
(bundlePropertyProposals != null && bundlePropertyProposals.size() > 0));
proposalsExist(bundlePropertyProposals, textDefaultResourceBundleNameProperties);
proposalsExist(bundlePropertyProposals, textGermanResourceBundleNameProperties);
}
-
+
public void proposalsExist(List<TextProposal> res, String[] proposals) {
TextProposal[] result = res.toArray(new TextProposal[res.size()]);
for (int i = 0; i < proposals.length; i++) {
@@ -130,7 +91,7 @@
assertTrue("Proposal " + proposals[i] + " not found!",
found ); //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
public boolean compareTextProposal(String proposal, TextProposal[] proposals){
for (int i = 0; i < proposals.length; i++) {
String replacementString = proposals[i].getReplacementString().toLowerCase();
@@ -139,67 +100,32 @@
replacementString = Utils.trimQuotes(replacementString);
if (replacementString.equalsIgnoreCase(proposal)) return true;
-
+
}
return false;
}
/**
* The method tests CA on CDI Seam International Module Resource Bundles
+ * @throws Exception
*/
- public void testResourceBundles() {
- assertTrue(errMessage, bReadyForTesting);
-
+ public void testResourceBundles() throws Exception {
// Perform CA test
+ caTest.setProject(getTestProject());
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);
}
-
+
/**
* The method tests CA on CDI Seam International Module Resource Bundles
*/
public void testSeamInternationalHyperlinks() throws Exception {
- assertTrue(errMessage, bReadyForTesting);
-
// Perform Hyperlink test
ArrayList<TestRegion> regionList = new ArrayList<TestRegion>();
regionList.add(new TestRegion(381, 15, new TestHyperlink[]{new
TestHyperlink(ELHyperlink.class, "Open bundle 'messages'", null)}));
regionList.add(new TestRegion(398, 10, new TestHyperlink[]{new
TestHyperlink(ELHyperlink.class, "Open property 'home_header' of bundle
'messages'", null)}));
-
- HyperlinkTestUtil.checkRegions(tckProject, PAGE_NAME, regionList, new
ELHyperlinkDetector());
- }
-
- 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;
-
- TestUtil.validate(tckProject);
-
- caTest.setProject(tckProject);
- return true;
+ HyperlinkTestUtil.checkRegions(getTestProject(), PAGE_NAME, regionList, new
ELHyperlinkDetector());
}
}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/servlet/SeamServletValidationTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/servlet/SeamServletValidationTest.java 2011-08-10
00:42:25 UTC (rev 33745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/servlet/SeamServletValidationTest.java 2011-08-10
01:01:41 UTC (rev 33746)
@@ -10,39 +10,16 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.core.test.servlet;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import junit.framework.TestCase;
-
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
-import org.jboss.tools.cdi.seam.core.test.SeamCoreTestSetup;
-import org.jboss.tools.jst.jsp.test.TestUtil;
-import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.cdi.seam.core.test.international.SeamCoreTest;
import org.jboss.tools.tests.AbstractResourceMarkerTest;
/**
* @author Alexey Kazakov
*/
-public class SeamServletValidationTest extends TestCase {
+public class SeamServletValidationTest extends SeamCoreTest {
- protected IProject project;
-
- public IProject getTestProject() throws IOException, CoreException,
InvocationTargetException, InterruptedException {
- if(project==null) {
- project =
ResourcesPlugin.getWorkspace().getRoot().getProject(SeamCoreTestSetup.PROJECT_NAME);
- if(!project.exists()) {
- project = ResourcesUtils.importProject(SeamCoreTestSetup.PLUGIN_ID,
SeamCoreTestSetup.PROJECT_PATH);
- TestUtil.waitForValidation();
- }
- }
- return project;
- }
-
/**
* CDI validator should ignore injection points annotated
@RequestParam/@HeaderParam/@CookieParam
* See
https://issues.jboss.org/browse/JBIDE-9389