[jbosstools-commits] JBoss Tools SVN: r17523 - in trunk/jst/tests/org.jboss.tools.jst.web.kb.test: src/org/jboss/tools/jst/web/kb/test and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 10 20:26:00 EDT 2009


Author: akazakov
Date: 2009-09-10 20:26:00 -0400 (Thu, 10 Sep 2009)
New Revision: 17523

Modified:
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/.classpath
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java
Log:
Added some new tests for KB plug-in.

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/.classpath
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/.classpath	2009-09-10 23:03:27 UTC (rev 17522)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/TestKbModel/.classpath	2009-09-11 00:26:00 UTC (rev 17523)
@@ -8,10 +8,10 @@
 			<attribute name="owner.project.facets" value="jst.web"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.6.0_04">
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
 		<attributes>
 			<attribute name="owner.project.facets" value="jst.java"/>
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
-</classpath>
+</classpath>
\ No newline at end of file

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java	2009-09-10 23:03:27 UTC (rev 17522)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java	2009-09-11 00:26:00 UTC (rev 17523)
@@ -13,6 +13,8 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
 /**
  * @author Alexey Kazakov
  */
@@ -20,7 +22,10 @@
 
 	public static Test suite() {
 		TestSuite suite = new TestSuite(JstWebKbAllTests.class.getName());
-		suite.addTest(WebKbTest.suite());
+		suite.addTest(new ProjectImportTestSetup(new TestSuite(WebKbTest.class),
+				"org.jboss.tools.jst.web.kb.test",
+				new String[]{"projects/TestKbModel"},
+				new String[]{"TestKbModel"}));
 		suite.addTestSuite(KbModelTest.class);
 		return suite;
 	}

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java	2009-09-10 23:03:27 UTC (rev 17522)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/WebKbTest.java	2009-09-11 00:26:00 UTC (rev 17523)
@@ -10,20 +10,47 @@
  ******************************************************************************/ 
 package org.jboss.tools.jst.web.kb.test;
 
-import junit.framework.Test;
 import junit.framework.TestCase;
-import junit.framework.TestSuite;
 
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.internal.taglib.CustomTagLibAttribute;
+import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
+import org.jboss.tools.jst.web.kb.taglib.ICustomTagLibrary;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+
 /**
  * @author Alexey Kazakov
  */
 public class WebKbTest extends TestCase {
 
-	public void testKb() {
-		//TODO
+	private IProject testProject;
+	private static final String[] CUSTOM_TAG_LIB_URIS = {"http://richfaces.org/a4j", "http://richfaces.org/rich", "http://java.sun.com/jsf/core", "http://java.sun.com/jsf/html", "http://java.sun.com/jsf/facelets", "http://www.w3.org/1999/xhtml/facelets", "http://jboss.com/products/seam/taglib", "http://java.sun.com/JSP/Page", "http://struts.apache.org/tags-html", "taglibs/componentExtension.xml"};
+
+	protected void setUp() throws Exception {
+		if(testProject==null) {
+			testProject = ProjectImportTestSetup.loadProject("TestKbModel");
+			JobUtils.waitForIdle();
+			JobUtils.delay(2000);
+		}
 	}
 
-	public static Test suite() {
-		return new TestSuite(WebKbTest.class);
+	public void testCustomTagLibs() {
+		ICustomTagLibrary[] libs = CustomTagLibManager.getInstance().getLibraries();
+		for (ICustomTagLibrary lib : libs) {
+			boolean found = false;
+			for (String uri : CUSTOM_TAG_LIB_URIS) {
+				if(uri.equals(lib.getURI())) {
+					found = true;
+					break;
+				}
+			}
+			assertTrue("Custom tag lib " + lib.getURI() + " is not loaded.", found);
+		}
 	}
-}
\ No newline at end of file
+
+	public void testCustomExtensions() {
+		CustomTagLibAttribute[] attributes = CustomTagLibManager.getInstance().getComponentExtensions();
+		assertNotNull("Can't load component extensions.", attributes);
+		assertFalse("Can't load component extensions.", attributes.length==0);
+	}}
\ No newline at end of file



More information about the jbosstools-commits mailing list