[jboss-svn-commits] JBoss Portal SVN: r5563 - in trunk/theme: . src/main/org/jboss/portal/test/theme/metadata src/main/org/jboss/portal/test/theme/render

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 2 16:35:35 EST 2006


Author: roy.russo at jboss.com
Date: 2006-11-02 16:35:17 -0500 (Thu, 02 Nov 2006)
New Revision: 5563

Modified:
   trunk/theme/build.xml
   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/main/org/jboss/portal/test/theme/render/TestRenderContext.java
Log:
JBPORTAL-1099 - Expanded metadata and context tests.

Modified: trunk/theme/build.xml
===================================================================
--- trunk/theme/build.xml	2006-11-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/build.xml	2006-11-02 21:35:17 UTC (rev 5563)
@@ -290,6 +290,7 @@
             <path refid="jboss.portal-server.classpath"/>
             <path refid="jboss.portal-jems.classpath"/>
             <path refid="jboss.portal-theme.classpath"/>
+            <path refid="jboss.portlet-api.classpath"/>
             <pathelement location="${build.resources}/test"/>
             <pathelement location="${build.resources}/hibernate"/>
             <pathelement location="${jboss.portal-test.root}/etc"/>

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-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestLayoutStrategySetMetaData.java	2006-11-02 21:35:17 UTC (rev 5563)
@@ -26,6 +26,7 @@
 import org.jboss.portal.common.MediaType;
 import org.jboss.portal.theme.deployment.jboss.LayoutStategyMetaDataFactory;
 import org.jboss.portal.theme.metadata.LayoutStrategyMetaData;
+import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.UnmarshallerFactory;
 import org.xml.sax.SAXException;
 
@@ -42,7 +43,7 @@
  */
 public class TestLayoutStrategySetMetaData extends TestCase
 {
-   public void testBuildLayoutStrategyMDList() throws IOException, ParserConfigurationException, SAXException
+   public void testBuildLayoutStrategyMetaData() throws IOException, ParserConfigurationException, SAXException
    {
       try
       {
@@ -91,136 +92,77 @@
       }
    }
 
-//   public void testLayoutStrategyMD() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      try
-//      {
-//         StringBuffer testString = new StringBuffer();
-//         testString.append("<portal-strategies>");
-//
-//         // no name
-//         testString.append("<set>");
-//         // for html
-//         testString.append("<strategy content-type=\"text/html\">");
-//         testString.append("<implementation>StrategyTwoHTML</implementation>");
-//         testString.append("</strategy>");
-//         // for xml
-//         testString.append("<strategy content-type=\"application/xhtml+xml\">");
-//         testString.append("<implementation>StrategyTwoXML</implementation>");
-//         testString.append("</strategy>");
-//         testString.append("</set>");
-//
-//         testString.append("</portal-strategies>");
-//
-//         Document testDoc = XML.createDocument(testString.toString());
-//         LayoutStrategyMetaData.buildLayoutStrategyMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+   public void testLayoutStrategyMetaDataNoName() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<portal-strategies>");
 
-//   public void testLayoutStrategyMD2() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      try
-//      {
-//         StringBuffer testString = new StringBuffer();
-//         testString.append("<portal-strategies>");
-//
-//         // no content type
-//         testString.append("<set name=\"StrategyOne\">");
-//         testString.append("<strategy>");
-//         testString.append("<implementation>StrategyTwoHTML</implementation>");
-//         testString.append("</strategy>");
-//         testString.append("</set>");
-//
-//         testString.append("</portal-strategies>");
-//
-//         Document testDoc = XML.createDocument(testString.toString());
-//         LayoutStrategyMetaData.buildLayoutStrategyMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+      // no name
+      testString.append("<set>");
+      // for html
+      testString.append("<strategy content-type=\"text/html\">");
+      testString.append("<implementation>StrategyTwoHTML</implementation>");
+      testString.append("</strategy>");
+      // for xml
+      testString.append("<strategy content-type=\"application/xhtml+xml\">");
+      testString.append("<implementation>StrategyTwoXML</implementation>");
+      testString.append("</strategy>");
+      testString.append("</set>");
 
-//   public void testLayoutStrategyMD3() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      try
-//      {
-//         StringBuffer testString = new StringBuffer();
-//         testString.append("<portal-strategies>");
-//
-//         // no implementation
-//         testString.append("<set>");
-//         // for html
-//         testString.append("<strategy content-type=\"text/html\">");
-////         testString.append("<implementation>StrategyTwoHTML</implementation>");
-//         testString.append("</strategy>");
-//         // for xml
-//         testString.append("<strategy content-type=\"application/xhtml+xml\">");
-//         testString.append("<implementation>StrategyTwoXML</implementation>");
-//         testString.append("</strategy>");
-//         testString.append("</set>");
-//
-//         testString.append("</portal-strategies>");
-//
-//         Document testDoc = XML.createDocument(testString.toString());
-//         LayoutStrategyMetaData.buildLayoutStrategyMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+      testString.append("</portal-strategies>");
 
-//   public void testLayoutStrategyMD4() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      try
-//      {
-//         StringBuffer testString = new StringBuffer();
-//         testString.append("<portal-strategies>");
-//
-//         // no strategy definition
-//         testString.append("<set>");
-//         testString.append("</set>");
-//
-//         testString.append("</portal-strategies>");
-//
-//         Document testDoc = XML.createDocument(testString.toString());
-//         LayoutStrategyMetaData.buildLayoutStrategyMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // 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 testLayoutStrategyMD5() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      try
-//      {
-//         StringBuffer testString = new StringBuffer();
-//         testString.append("<portal-strategies>");
-//
-//         // nothing defined
-//
-//         testString.append("</portal-strategies>");
-//
-//         Document testDoc = XML.createDocument(testString.toString());
-//         List mdList = LayoutStrategyMetaData.buildLayoutStrategyMetaDataList(testDoc.getDocumentElement());
-//         assertNotNull(mdList);
-//         assertTrue(mdList.size() == 0);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+   public void testLayoutStrategyMetaDataNoMime() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<portal-strategies>");
+
+      // no content type
+      testString.append("<set name=\"StrategyOne\">");
+      testString.append("<strategy>");
+      testString.append("<implementation>StrategyTwoHTML</implementation>");
+      testString.append("</strategy>");
+      testString.append("</set>");
+
+      testString.append("</portal-strategies>");
+
+      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)
+      {
+         // expected
+      }
+   }
+
+
+   public void testLayoutStrategyMetaDataEmpty() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<portal-strategies>");
+
+      // no strategy definition
+      testString.append("<set>");
+      testString.append("</set>");
+
+      testString.append("</portal-strategies>");
+
+      List strategies = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new LayoutStategyMetaDataFactory(), null);
+      try
+      {
+         LayoutStrategyMetaData strategyMD = (LayoutStrategyMetaData)strategies.get(0);
+         assertFalse("expected exception did not occur", true);
+      }
+      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-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalLayoutMetaData.java	2006-11-02 21:35:17 UTC (rev 5563)
@@ -25,6 +25,7 @@
 import junit.framework.TestCase;
 import org.jboss.portal.theme.deployment.jboss.PortalLayoutMetaDataFactory;
 import org.jboss.portal.theme.metadata.PortalLayoutMetaData;
+import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.UnmarshallerFactory;
 
 import java.io.StringReader;
@@ -38,7 +39,6 @@
  */
 public class TestPortalLayoutMetaData extends TestCase
 {
-
    public void testBuildLayoutMetaDataList() throws Exception
    {
       try
@@ -100,62 +100,49 @@
       }
    }
 
-//   public void testBuildLayoutMetaData() throws Exception
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      testString.append("<layouts>");
-//
-//      // no name
-//      testString.append("<layout>");
-////      testString.append("<name>nodesk</name>");
-//      testString.append("<uri>/nodesk/index.jsp</uri>");
-//      testString.append("<regions>");
-//      testString.append("<region name=\"left\"/>");
-//      testString.append("<region name=\"center\"/>");
-//      testString.append("</regions>");
-//      testString.append("</layout>");
-//
-//      testString.append("</layouts>");
-//
-//      try
-//      {
-//         List layoutMDList = (List)UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(testString.toString()), new PortalLayoutMetaDataFactory(), null);
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+   public void testLayoutMetaDataNoName() throws Exception
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<layouts>");
 
-//   public void testBuildLayoutMetaData2() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      testString.append("<layouts>");
-//
-//      // no uri
-//      testString.append("<layout>");
+      // no name
+      testString.append("<layout>");
 //      testString.append("<name>nodesk</name>");
-//      testString.append("</layout>");
-//
-//      testString.append("</layouts>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         PortalLayoutMetaData.buildLayoutMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected
-//      }
-//   }
+      testString.append("<uri>/nodesk/index.jsp</uri>");
+      testString.append("<regions>");
+      testString.append("<region name=\"left\"/>");
+      testString.append("<region name=\"center\"/>");
+      testString.append("</regions>");
+      testString.append("</layout>");
 
-   public void testBuildLayoutMetaData3() throws Exception
+      testString.append("</layouts>");
+
+      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() throws JBossXBException
    {
       StringBuffer testString = new StringBuffer();
       testString.append("<layouts>");
+
+      // no uri
+      testString.append("<layout>");
+      testString.append("<name>nodesk</name>");
+      testString.append("</layout>");
+// testString.append("<uri>/nodesk/index.jsp</uri>");
+      testString.append("</layouts>");
+
+      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() throws Exception
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<layouts>");
       // no regions
       testString.append("<layout>");
       testString.append("<name>nodesk</name>");
@@ -169,7 +156,9 @@
       assertTrue(layoutMD.getRegionNames().size() == 0);
    }
 
-   public void testBuildLayoutMetaData4() throws Exception
+   // What in the world does this do?
+/*
+   public void testLayoutMetaData4() throws Exception
    {
       StringBuffer testString = new StringBuffer();
       testString.append("<layouts>");
@@ -186,4 +175,5 @@
       assertNotNull(layoutMD.getClassName());
       assertEquals("org.jboss.portal.theme.impl.JSPLayout", layoutMD.getClassName());
    }
+*/
 }
\ No newline at end of file

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-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestPortalThemeMetaData.java	2006-11-02 21:35:17 UTC (rev 5563)
@@ -27,11 +27,9 @@
 import org.jboss.portal.theme.metadata.PortalThemeMetaData;
 import org.jboss.portal.theme.metadata.ThemeLinkMetaData;
 import org.jboss.portal.theme.metadata.ThemeScriptMetaData;
+import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.UnmarshallerFactory;
-import org.xml.sax.SAXException;
 
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.IOException;
 import java.io.StringReader;
 import java.util.List;
 
@@ -55,7 +53,7 @@
 public class TestPortalThemeMetaData extends TestCase
 {
 
-   public void testBuildThemeMetaDataList() throws IOException, ParserConfigurationException, SAXException
+   public void testBuildThemeMetaDataList() throws JBossXBException
    {
       try
       {
@@ -119,53 +117,40 @@
       }
    }
 
-//   public void testThemeMetaData() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      testString.append("<themes>");
-//
-//      // no name defined
-//      testString.append("<theme>");
-////      testString.append("<name>industrial</name>");
-//      testString.append("<link rel=\"stylesheet\" id=\"main_css\" href=\"/themes/industrial/portal_style.css\" type=\"text/css\" />");
-//      testString.append("<link rel=\"shortcut icon\" href=\"/themes/industrial/images/favicon.ico\" />");
-//      testString.append("</theme>");
-//
-//      testString.append("</themes>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         PortalThemeMetaData.buildThemeMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (ThemeException e)
-//      {
-//         // expected
-//      }
-//   }
+   public void testThemeMetaDataNoName() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<themes>");
 
-//   public void testThemeMetaData2() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      testString.append("<themes>");
-//
-//      // no link, no script defined
-//      testString.append("<theme>");
+      // no name defined
+      testString.append("<theme>");
 //      testString.append("<name>industrial</name>");
-//      testString.append("</theme>");
-//
-//      testString.append("</themes>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         PortalThemeMetaData.buildThemeMetaDataList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (ThemeException e)
-//      {
-//         // expected
-//      }
-//   }
+      testString.append("<link rel=\"stylesheet\" id=\"main_css\" href=\"/themes/industrial/portal_style.css\" type=\"text/css\" />");
+      testString.append("<link rel=\"shortcut icon\" href=\"/themes/industrial/images/favicon.ico\" />");
+      testString.append("</theme>");
+
+      testString.append("</themes>");
+
+      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() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      testString.append("<themes>");
+
+      // no link, no script defined
+      testString.append("<theme>");
+      testString.append("<name>industrial</name>");
+      testString.append("</theme>");
+
+      testString.append("</themes>");
+
+      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-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/metadata/TestRenderSetMetaData.java	2006-11-02 21:35:17 UTC (rev 5563)
@@ -27,6 +27,7 @@
 import org.jboss.portal.theme.deployment.jboss.RenderSetMetaDataFactory;
 import org.jboss.portal.theme.metadata.RenderSetMetaData;
 import org.jboss.portal.theme.metadata.RendererSetMetaData;
+import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.UnmarshallerFactory;
 import org.xml.sax.SAXException;
 
@@ -130,98 +131,70 @@
       }
    }
 
-//   public void testRenderSetMD2() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      // no content type attribute in the set
-//      testString.append("<portal-renderSet>");
-//      testString.append("<renderSet name=\"divRenderer\">");
-//      testString.append("<set>");
-//      testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
+   public void testRenderSetMetaDataNoMime() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      // no content type attribute in the set
+      testString.append("<portal-renderSet>");
+      testString.append("<renderSet name=\"divRenderer\">");
+      testString.append("<set>");
+      testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
+      testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
+      testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
+      testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
+      testString.append("</set>");
+      testString.append("</renderSet>");
+      testString.append("</portal-renderSet>");
+      try
+      {
+         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);
+         assertFalse("expected exception did not occur", true);
+      }
+      catch (JBossXBException e)
+      {
+         // expected
+      }
+   }
+
+   public void testRenderSetMetaDataNoWindowRenderer() throws JBossXBException
+   {
+      StringBuffer testString = new StringBuffer();
+      // no window renderer defined in the set
+      testString.append("<portal-renderSet>");
+      testString.append("<renderSet name=\"divRenderer\">");
+      testString.append("<set content-type=\"text/html\">");
+      testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
 //      testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
-//      testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
-//      testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
-//      testString.append("</set>");
-//      testString.append("</renderSet>");
-//      testString.append("</portal-renderSet>");
-//
-//      try
-//      {
-//         Document  testDoc = XML.createDocument(testString.toString());
-//         RenderSetMetaData.buildRenderSetMDList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected!
-//      }
-//   }
+      testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
+      testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
+      testString.append("</set>");
+      testString.append("</renderSet>");
+      testString.append("</portal-renderSet>");
 
-//   public void testRenderSetMD3() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      // no window renderer defined in the set
-//      testString.append("<portal-renderSet>");
-//      testString.append("<renderSet name=\"divRenderer\">");
-//      testString.append("<set content-type=\"text/html\">");
-//      testString.append("<region-renderer>DivRegionRenderer</region-renderer>");
-////      testString.append("<window-renderer>DivWindowRenderer</window-renderer>");
-//      testString.append("<portlet-renderer>DivPortletRenderer</portlet-renderer>");
-//      testString.append("<decoration-renderer>DivDecorationRenderer</decoration-renderer>");
-//      testString.append("</set>");
-//      testString.append("</renderSet>");
-//      testString.append("</portal-renderSet>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         RenderSetMetaData.buildRenderSetMDList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // 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 testRenderSetMD4() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      // empty render set descriptor
-//      testString.append("<portal-renderSet>");
-//      testString.append("</portal-renderSet>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         List renderSetMDList = RenderSetMetaData.buildRenderSetMDList(testDoc.getDocumentElement());
-//         assertNotNull(renderSetMDList);
-//         assertTrue(renderSetMDList.size() == 0);
-//      }
-//      catch (LayoutException e)
-//      {
-//         assertFalse("unexpected exception occured" + e.getMessage(), true);
-//      }
-//   }
-//
-//   public void testRenderSetMD5() throws IOException, ParserConfigurationException, SAXException
-//   {
-//      StringBuffer testString = new StringBuffer();
-//      // no window renderer defined in the set
-//      testString.append("<portal-renderSet>");
-//      testString.append("<renderSet name=\"divRenderer\">");
-//      testString.append("</renderSet>");
-//      testString.append("</portal-renderSet>");
-//
-//      try
-//      {
-//         Document testDoc = XML.createDocument(testString.toString());
-//         RenderSetMetaData.buildRenderSetMDList(testDoc.getDocumentElement());
-//         assertFalse("expected exception did not occur", true);
-//      }
-//      catch (LayoutException e)
-//      {
-//         // expected!
-//      }
-//   }
+   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
+      {
+         RenderSetMetaData renderSetMD = (RenderSetMetaData)setList.get(0);
+         assertFalse("expected exception did not occur", true);
+      }
+      catch (IndexOutOfBoundsException ioe)
+      {
+         // expected
+      }
+   }
 }

Modified: trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java	2006-11-02 19:09:00 UTC (rev 5562)
+++ trunk/theme/src/main/org/jboss/portal/test/theme/render/TestRenderContext.java	2006-11-02 21:35:17 UTC (rev 5563)
@@ -83,6 +83,7 @@
       windowContext = new WindowContext(windowName, windowID, regionName, order);
       markupResult = TestHelper.createWindowResult("title", "content");
 
+/*
       navCtx = new AttributeResolver()
       {
          public Set getKeys()
@@ -100,6 +101,7 @@
       };
 
       navCtx.setAttribute(windowID + "_window", windowNavigationalState);
+*/
       markupResult.addWindowContext(windowContext);
       streamInfo = new HTTPStreamInfo(MediaType.HTML, "utf-8");
 //      markupResult.setStreamInfo(streamInfo);




More information about the jboss-svn-commits mailing list