[jboss-svn-commits] JBoss Portal SVN: r5593 - in trunk/theme: . src/main/org/jboss/portal/test/theme src/main/org/jboss/portal/test/theme/metadata src/resources/test/xml
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 7 12:04:58 EST 2006
Author: roy.russo at jboss.com
Date: 2006-11-07 12:04:54 -0500 (Tue, 07 Nov 2006)
New Revision: 5593
Modified:
trunk/theme/build.xml
trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalLayoutMetaData.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalThemeMetaData.java
trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java
trunk/theme/src/resources/test/xml/portal-themes.xml
Log:
JBPORTAL-1099 - theme tests fixed; added xerces to classpath, fixed xml reader.
Modified: trunk/theme/build.xml
===================================================================
--- trunk/theme/build.xml 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/build.xml 2006-11-07 17:04:54 UTC (rev 5593)
@@ -277,6 +277,7 @@
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
+ <path refid="apache.xerces.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
<path refid="apache.ant.classpath"/>
<path refid="apache.log4j.classpath"/>
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestHelper.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -58,7 +58,6 @@
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.bind.Unmarshaller;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -153,7 +152,7 @@
return renderSets;
}
- private static String createRenderSetDescriptor()
+ private static Reader createRenderSetDescriptor()
throws IOException, SAXException, ParserConfigurationException
{
StringBuffer testString = new StringBuffer();
@@ -178,8 +177,7 @@
testString.append("</portal-renderSet>");
- return testString.toString();
- //return new StringReader(testString.toString());
+ return new StringReader(testString.toString());
}
public static PortalLayoutMetaData createLayoutMD() throws Exception
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/TestLayoutServiceImpl.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -74,11 +74,13 @@
layoutService.start();
runtimeContext = TestHelper.createRuntimeContext();
+
LoaderResource res = new CLLoader().getResource("xml/portal-layouts.xml");
assertNotNull("Layout xml could not be loaded", res);
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ Unmarshaller unmarshaller = null;
+ unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ portalLayouts = (List)unmarshaller.unmarshal(res.asInputStream(), new PortalLayoutMetaDataFactory(), null);
- portalLayouts = (List)unmarshaller.unmarshal(res.asInputStream(), new PortalLayoutMetaDataFactory(), null);
for (Iterator i = portalLayouts.iterator(); i.hasNext();)
{
PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)i.next();
@@ -126,11 +128,11 @@
PortalLayout layout = layoutService.getLayout("nodesk", true);
assertTrue(layout.getLayoutInfo().getName().equals("nodesk"));
assertTrue(layout.getLayoutInfo().getURI().equals("/nodesk/index.jsp"));
- assertTrue(layout.getLayoutInfo().getRegionNames().size() == 0);
+ assertTrue(layout.getLayoutInfo().getRegionNames().size() == 2);
layout = layoutService.getLayout("phalanx", true);
assertTrue(layout.getLayoutInfo().getName().equals("phalanx"));
- assertNull(layout.getLayoutInfo().getURI());
+ assertNotNull(layout.getLayoutInfo().getURI());
layout = layoutService.getLayout("generic", true);
assertTrue(layout.getLayoutInfo().getName().equals("generic"));
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -92,7 +92,7 @@
}
}
- public void testLayoutStrategyMetaDataNoName()
+ public void testLayoutStrategyMetaDataNoName() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<portal-strategies>");
@@ -111,18 +111,12 @@
testString.append("</portal-strategies>");
- try
- {
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
+ List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
+ LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
+ assertNull(strategyMD.getName());
}
- public void testLayoutStrategyMetaDataNoMime()
+ public void testLayoutStrategyMetaDataNoMime() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<portal-strategies>");
@@ -149,7 +143,7 @@
}
- public void testLayoutStrategyMetaDataEmpty()
+ public void testLayoutStrategyMetaDataEmpty() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<portal-strategies>");
@@ -160,13 +154,13 @@
testString.append("</portal-strategies>");
-
+ List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
try
{
- List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
+ LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
assertFalse("expected exception did not occur", true);
}
- catch (JBossXBException e)
+ catch (IndexOutOfBoundsException ioe)
{
// expected
}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalLayoutMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalLayoutMetaData.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalLayoutMetaData.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -100,7 +100,7 @@
}
}
- public void testLayoutMetaDataNoName()
+ public void testLayoutMetaDataNoName() throws Exception
{
StringBuffer testString = new StringBuffer();
testString.append("<layouts>");
@@ -117,19 +117,12 @@
testString.append("</layouts>");
- try
- {
- List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
-
+ List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutMDList.get(0);
+ assertTrue(layoutMD.getName() == null);
}
- public void testLayoutMetaDataNoURI()
+ public void testLayoutMetaDataNoURI() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<layouts>");
@@ -141,18 +134,12 @@
// testString.append("<uri>/nodesk/index.jsp</uri>");
testString.append("</layouts>");
- try
- {
- List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
+ List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
+ PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutMDList.get(0);
+ assertTrue(layoutMD.getURI() == null);
}
- public void testLayoutMetaDataNoRegions()
+ public void testLayoutMetaDataNoRegions() throws Exception
{
StringBuffer testString = new StringBuffer();
testString.append("<layouts>");
@@ -162,22 +149,11 @@
testString.append("<uri>/nodesk/index.jsp</uri>");
testString.append("</layout>");
testString.append("</layouts>");
- try
- {
- List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
-
-/*
+ List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
assertNotNull(layoutMDList);
PortalLayoutMetaData layoutMD = (PortalLayoutMetaData)layoutMDList.get(0);
assertNotNull(layoutMD.getRegionNames());
assertTrue(layoutMD.getRegionNames().size() == 0);
-*/
}
// What in the world does this do?
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalThemeMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalThemeMetaData.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalThemeMetaData.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -117,7 +117,7 @@
}
}
- public void testThemeMetaDataNoName()
+ public void testThemeMetaDataNoName() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<themes>");
@@ -130,18 +130,13 @@
testString.append("</theme>");
testString.append("</themes>");
- try
- {
- List themes = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalThemeMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
+
+ List themes = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalThemeMetaDataFactory(), null);
+ PortalThemeMetaData meta = (PortalThemeMetaData)themes.get(0);
+ assertTrue(meta.getName() == null);
}
- public void testThemeMetaDataNoLinks()
+ public void testThemeMetaDataNoLinks() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
testString.append("<themes>");
@@ -153,13 +148,9 @@
testString.append("</themes>");
- try
- {
- List themes = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalThemeMetaDataFactory(), null);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
+ List themes = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalThemeMetaDataFactory(), null);
+ PortalThemeMetaData meta = (PortalThemeMetaData)themes.get(0);
+ assertTrue(meta.getLinks().size() == 0);
+ assertTrue(meta.getScripts().size() == 0);
}
}
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java 2006-11-07 17:04:54 UTC (rev 5593)
@@ -131,7 +131,7 @@
}
}
- public void testRenderSetMetaDataNoMime()
+ public void testRenderSetMetaDataNoMime() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
// no content type attribute in the set
@@ -158,7 +158,7 @@
}
}
- public void testRenderSetMetaDataNoWindowRenderer()
+ public void testRenderSetMetaDataNoWindowRenderer() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
// no window renderer defined in the set
@@ -173,36 +173,26 @@
testString.append("</renderSet>");
testString.append("</portal-renderSet>");
- try
- {
- List setList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new RenderSetMetaDataFactory(), null);
- assertTrue("Expected exception did not occur", false);
- }
- catch (JBossXBException ex)
- {
- // expected
- }
-/*
+ List setList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new RenderSetMetaDataFactory(), null);
RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.get(0);
RendererSetMetaData rendererSetMD = (RendererSetMetaData)renderSetMD.getRendererSet().get(0);
assertTrue(rendererSetMD.getWindowRenderer() == null);
-*/
}
- public void testRenderSetMetaDataEmpty()
+ public void testRenderSetMetaDataEmpty() throws JBossXBException
{
StringBuffer testString = new StringBuffer();
// empty render set descriptor
testString.append("<portal-renderSet>");
testString.append("</portal-renderSet>");
-
+ List setList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new RenderSetMetaDataFactory(), null);
try
{
- List setList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new RenderSetMetaDataFactory(), null);
+ RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.get(0);
assertFalse("expected exception did not occur", true);
}
- catch (JBossXBException ex)
+ catch (IndexOutOfBoundsException ioe)
{
// expected
}
Modified: trunk/theme/src/resources/test/xml/portal-themes.xml
===================================================================
--- trunk/theme/src/resources/test/xml/portal-themes.xml 2006-11-07 16:30:42 UTC (rev 5592)
+++ trunk/theme/src/resources/test/xml/portal-themes.xml 2006-11-07 17:04:54 UTC (rev 5593)
@@ -31,7 +31,6 @@
<theme>
<name>Nphalanx</name>
<link rel="stylesheet" id="main_css" href="/themes/phalanx/portal_style.css" type="text/css"/>
- <link rel="shortcut icon" href="/themes/phalanx/images/favicon.ico"/>
</theme>
<theme>
<name>mission-critical</name>
More information about the jboss-svn-commits
mailing list