[jboss-svn-commits] JBL Code SVN: r26794 - in labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src: test and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jun 1 08:10:58 EDT 2009


Author: lkrzyzanek
Date: 2009-06-01 08:10:57 -0400 (Mon, 01 Jun 2009)
New Revision: 26794

Added:
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2.txt
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2result.txt
Modified:
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverter.java
   labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverterTest.java
Log:
added test, corrected surrounding <p> 

Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverter.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverter.java	2009-05-31 17:12:42 UTC (rev 26793)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverter.java	2009-06-01 12:10:57 UTC (rev 26794)
@@ -38,8 +38,8 @@
   public String convert(String text) {
     StringWriter sw = new StringWriter();
     setWriter(sw);
-    render("<p>" + text + "</p>");
-    return sw.toString();
+    render(text);
+    return "<p>" + sw.toString() + "</p>";
   }
 
   @Override

Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverterTest.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverterTest.java	2009-05-31 17:12:42 UTC (rev 26793)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/java/org/jboss/labs/clearspace/plugin/nfm/converter/BBCodeConverterTest.java	2009-06-01 12:10:57 UTC (rev 26794)
@@ -2,8 +2,11 @@
 
 import static org.junit.Assert.assertEquals;
 
+import java.io.BufferedInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
+import org.apache.commons.io.IOUtils;
 import org.jboss.portal.format.parser.bbcode.BBCodeParser;
 import org.junit.Before;
 import org.junit.Test;
@@ -25,14 +28,22 @@
 
   @Test
   public void testConvert() throws IOException {
-    assertEquals("<strong>bold</strong>", converter.convert("[b]bold[/b]"));
-    assertEquals("<em>italic</em>", converter.convert("[i]italic[/i]"));
-    assertEquals("<span style=\"text-decoration: underline;\">underline</span>", converter.convert("[u]underline[/u]"));
-    assertEquals("<span style=\"color: red\">color</span>", converter.convert("[color=red]color[/color]"));
-    assertEquals("<span style=\"font-size: 7px; line-height: normal\">size7</span>", converter.convert("[size=7]size7[/size]"));
-    assertEquals("<pre __jive_macro_name=\"quote\" class=\"jive_text_macro jive_macro_quote\">quote</pre>", converter.convert("[quote]quote[/quote]"));
-    assertEquals("<pre __default_attr=\"java\" __jive_macro_name=\"code\" class=\"jive_text_macro jive_macro_code\">code</pre>", converter.convert("[code]code[/code]"));
-    assertEquals("<a href=\"www.jboss.org\">www.jboss.org</a>", converter.convert("[url]www.jboss.org[/url]"));
+    assertEquals("<p><strong>bold</strong></p>", converter.convert("[b]bold[/b]"));
+    assertEquals("<p><em>italic</em></p>", converter.convert("[i]italic[/i]"));
+    assertEquals("<p><span style=\"text-decoration: underline;\">underline</span></p>", converter.convert("[u]underline[/u]"));
+    assertEquals("<p><span style=\"color: red\">color</span></p>", converter.convert("[color=red]color[/color]"));
+    assertEquals("<p><span style=\"font-size: 7px; line-height: normal\">size7</span></p>", converter.convert("[size=7]size7[/size]"));
+    assertEquals("<p><pre __jive_macro_name=\"quote\" class=\"jive_text_macro jive_macro_quote\">quote</pre></p>", converter.convert("[quote]quote[/quote]"));
+    assertEquals("<p><pre __default_attr=\"java\" __jive_macro_name=\"code\" class=\"jive_text_macro jive_macro_code\">code</pre></p>", converter.convert("[code]code[/code]"));
+    assertEquals("<p><a href=\"www.jboss.org\">www.jboss.org</a></p>", converter.convert("[url]www.jboss.org[/url]"));
+    String message1 = getContent("/bbcodetest2.txt");
+    String message1Result = getContent("/bbcodetest2result.txt");
+    assertEquals(message1Result, converter.convert(message1));
   }
+  
+  private String getContent(String path) throws IOException {
+    InputStream is = BBCodeConverterTest.class.getResourceAsStream(path);
+    return IOUtils.toString(new BufferedInputStream(is));
+  }
 
 }

Added: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2.txt
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2.txt	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2.txt	2009-06-01 12:10:57 UTC (rev 26794)
@@ -0,0 +1,32 @@
+At present jboss-web takes one security-domain and potentially many virtual-host configurations such that one webapp is deployed to many virtual hosts with the same security domain.  For websites with multiple regions, it often makes sense to use DIFFERENT security domains for each virtual host.
+
+Today we can have only
+
+jboss-web
+  security-association
+  virtual-host
+
+Ideally we could have
+
+jboss-web
+    virtual-host
+         security-association
+    virtual-host
+         security-association
+
+Or:
+
+jboss-web
+    security-association
+    virtual-host
+         security-association
+    virtual-host
+         security-association
+
+where the virtual host security-associations would override the parent.
+
+In tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.xml the  performDeployInternal happens ALREADY for each hostname.  At present it uses ONE SecurityAssociationValve for all virtual hosts and the securityassociationvalve is configured with the metaData.getSecurityDomain().  This could instead be a seperate SecurityAssociationValve for each host with the securitydomain as an argument (used to flush the authentication cache).  Elsewhere, the ENC/security/security-domain is used.  This instead could be the ENC/security/vhost/security-domain or securityMgr (they ultimately are the same thing in server/src/main/org/jboss/web/AbstractWebDeployer).  
+
+The trickiest piece isn't the server code, this would require some refactoring but doing the descriptor in an adequate but backward compatible way. <virtual-host>hostname</virtual-host> becomes <host><virtual-host>xxx</virtual-host><security-domain>domain</security-domain></host> or something like that.  Ideally it would be <virtual-host><hostname>xxx</hostname><security-domain>xxx</security-domain></virtual-host> for clarity.
+
+Thoughts?  (Sh/C)ould this be done?  Accepted if done by someone else?  If so could it make the 4.2 branch or possibly somewhere in 5 + 4.2 backport?
\ No newline at end of file


Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2result.txt
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2result.txt	                        (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2result.txt	2009-06-01 12:10:57 UTC (rev 26794)
@@ -0,0 +1 @@
+<p>At present jboss-web takes one security-domain and potentially many virtual-host configurations such that one webapp is deployed to many virtual hosts with the same security domain.  For websites with multiple regions, it often makes sense to use DIFFERENT security domains for each virtual host.</p><p></p><p>Today we can have only</p><p></p><p>jboss-web</p><p>  security-association</p><p>  virtual-host</p><p></p><p>Ideally we could have</p><p></p><p>jboss-web</p><p>    virtual-host</p><p>         security-association</p><p>    virtual-host</p><p>         security-association</p><p></p><p>Or:</p><p></p><p>jboss-web</p><p>    security-association</p><p>    virtual-host</p><p>         security-association</p><p>    virtual-host</p><p>         security-association</p><p></p><p>where the virtual host security-associations would override the parent.</p><p></p><p>In tomcat/src/main/org/jboss/web/tomcat/service/TomcatDeployer.xml the  performDeployInternal happens ALREADY for ea!
 ch hostname.  At present it uses ONE SecurityAssociationValve for all virtual hosts and the securityassociationvalve is configured with the metaData.getSecurityDomain().  This could instead be a seperate SecurityAssociationValve for each host with the securitydomain as an argument (used to flush the authentication cache).  Elsewhere, the ENC/security/security-domain is used.  This instead could be the ENC/security/vhost/security-domain or securityMgr (they ultimately are the same thing in server/src/main/org/jboss/web/AbstractWebDeployer).  </p><p></p><p>The trickiest piece isn't the server code, this would require some refactoring but doing the descriptor in an adequate but backward compatible way. <virtual-host>hostname</virtual-host> becomes <virtual-host>xxx</virtual-host><security-domain>domain</security-domain> or something like that.  Ideally it would be <virtual-host>xxx<security-domain>xxx</security-domain></virtual-host> for clarity.</p><p></p><p>Thoughts?  (Sh/C)!
 ould this be done?  Accepted if done by someone else?  If so could it 
make the 4.2 branch or possibly somewhere in 5 + 4.2 backport?</p>
\ No newline at end of file


Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/test/resources/bbcodetest2result.txt
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the jboss-svn-commits mailing list