Author: scabanovich
Date: 2011-12-09 14:57:40 -0500 (Fri, 09 Dec 2011)
New Revision: 37189
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Tests are added.
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml 2011-12-09
19:57:03 UTC (rev 37188)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/projects/JSF2ComponentsValidator/WebContent/WEB-INF/faces-config.xml 2011-12-09
19:57:40 UTC (rev 37189)
@@ -2,6 +2,7 @@
<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+
<managed-bean>
<managed-bean-name>person</managed-bean-name>
<managed-bean-class>demo.Person</managed-bean-class>
@@ -18,9 +19,23 @@
<to-view-id>/pages/greeting.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>pages/inputname2.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/*</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>/pages/greeting3.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>greeting</from-outcome>
+ <to-view-id>pages/greeting.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
<application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- <locale-config/>
+ <action-listener>actionListener</action-listener>
</application>
<factory/>
<lifecycle/>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-12-09
19:57:03 UTC (rev 37188)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JsfAllTests.java 2011-12-09
19:57:40 UTC (rev 37189)
@@ -24,6 +24,7 @@
import org.jboss.tools.jsf.test.refactoring.MessagePropertyRefactoringTest;
import org.jboss.tools.jsf.test.refactoring.MethodRefactoringTest;
import org.jboss.tools.jsf.test.validation.ELValidatorTest;
+import org.jboss.tools.jsf.test.validation.FacesConfigValidatorTest;
import org.jboss.tools.jsf.test.validation.JSF2ComponentsInClassFolderTest;
import org.jboss.tools.jsf.test.validation.JSF2ComponentsValidatorTest;
import org.jboss.tools.jsf.test.validation.WebContentTest;
@@ -83,7 +84,8 @@
new String[] { "JSFKickStartOldFormat" })); //$NON-NLS-1$
suite.addTest(new ValidationProjectTestSetup(new TestSuite(
JSF2ComponentsValidatorTest.class,
- JSF2ComponentsInClassFolderTest.class), "org.jboss.tools.jsf.test",
//$NON-NLS-1$
+ JSF2ComponentsInClassFolderTest.class,
+ FacesConfigValidatorTest.class), "org.jboss.tools.jsf.test", //$NON-NLS-1$
new String[] { "projects/JSF2ComponentsValidator" }, //$NON-NLS-1$
new String[] { "JSF2ComponentsValidator" })); //$NON-NLS-1$
suite.addTest(new ProjectImportTestSetup(new TestSuite(
Added:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java 2011-12-09
19:57:40 UTC (rev 37189)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.test.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.MessageFormat;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
+import org.jboss.tools.jsf.model.JSFConstants;
+import org.jboss.tools.jsf.web.validation.JSFValidationMessage;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class FacesConfigValidatorTest extends TestCase {
+
+ public static String PROJECT_NAME = "JSF2ComponentsValidator"; //$NON-NLS-1$
+ private IProject project;
+
+ public FacesConfigValidatorTest() {
+ super("JSF 2 Components Validator Test"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ }
+
+ public void testNavigation() throws Exception {
+ ValidationFramework.getDefault().validate(new IProject[] {project}, false, false, new
NullProgressMonitor());
+ IResource resource =
project.findMember("/WebContent/WEB-INF/faces-config.xml"); //$NON-NLS-1$
+ assertTrue(resource.exists());
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource,
NLS.bind(JSFValidationMessage.VIEW_ID_NO_SLASH, JSFConstants.ATT_FROM_VIEW_ID), 23);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource,
NLS.bind(JSFValidationMessage.TO_VIEW_ID_STAR, JSFConstants.ATT_TO_VIEW_ID), 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource,
NLS.bind(JSFValidationMessage.VIEW_NOT_EXISTS, JSFConstants.ATT_TO_VIEW_ID,
"/pages/greeting3.xhtml"), 30);
+ AbstractResourceMarkerTest.assertMarkerIsCreated(resource,
NLS.bind(JSFValidationMessage.VIEW_ID_NO_SLASH, JSFConstants.ATT_TO_VIEW_ID), 34);
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/FacesConfigValidatorTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain