[CVS spice] Added a simple test/example

sjoberg-yCVjj/[email protected] 20 Oct 2005 15:37:21 -0000
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/components/jervlet/src/test/org/codehaus/spice/jervlet/containers/jetty/pico</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1">GroovyJettyContainerBuilderTestCase.java</a></tt></td><td align="right" id="added">+51</td><td></td><td nowrap="nowrap" align="center">1.3 -&gt; 1.4</td></tr>
</table>
<pre class="comment">
Added a simple test/example
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">spice/components/jervlet/src/test/org/codehaus/spice/jervlet/containers/jetty/pico<br /></span>
<div class="fileheader"><big><b>GroovyJettyContainerBuilderTestCase.java</b></big> <small id="info">1.3 -&gt; 1.4</small></div>
<pre class="diff"><small id="info">diff -u -r1.3 -r1.4
--- GroovyJettyContainerBuilderTestCase.java	19 Oct 2005 19:40:33 -0000	1.3
+++ GroovyJettyContainerBuilderTestCase.java	20 Oct 2005 15:37:21 -0000	1.4
@@ -40,12 +40,63 @@
</small></pre><pre class="diff" id="context">       "../../testdata/webapps/pico";
 
     /**
</pre><pre class="diff" id="added">+     * A simple test
+     *
+     * @throws CompilationFailedException if the groovy script couldn't be compiled
+     */
+    public void testSimple() throws CompilationFailedException
+    {
+        System.out.println( "\n----- testSimple() -----\n" );
+        final Reader script = new StringReader(
+          "package org.codehaus.spice.jervlet.containers.jetty.pico\n" +
+          "import org.picocontainer.defaults.DefaultPicoContainer\n" +
+          "import org.codehaus.spice.jervlet.containers.jetty.pico.GroovyJettyContainerBuilder\n" +
+          "import org.codehaus.spice.jervlet.containers.jetty.pico.PicoJettyContainer\n" +
+          "import org.codehaus.spice.jervlet.impl.pico.PicoInstantiator\n" +
+          "import org.codehaus.spice.jervlet.impl.StandardServletInstantiator\n" +
+          "import org.codehaus.spice.jervlet.impl.Pinger\n" +
+
+          "def pico = new DefaultPicoContainer()\n" +
+          "def pinger = new Pinger()\n" +
+          "pinger.ping( '' +  System.currentTimeMillis() )\n" +
+          "pico.registerComponentInstance( pinger )\n" +
+
+          "def builder = new GroovyJettyContainerBuilder()\n" +
+          "def instantiator = new PicoInstantiator( pico )\n" +
+          "def webServer = builder.picoJettyContainer()\n" +
+          "{\n" +
+              "httpListener( port:'16842' )\n" +
+
+              "context( webPath:'pico',\n" +
+                       "warPath:'" + m_picoWebapp + "',\n" +
+                       "instantiator:instantiator )\n" +
+
+              "context( webPath:'plain',\n" +
+                       "warPath:'" + m_plainWebapp + "',\n" +
+                       "instantiator: new StandardServletInstantiator() )\n" +
+          "}\n" +
+
+          "webServer.start()\n" +
+          "webServer.stop()" );
+
+        doGroovy( new InputStream()
+                      {
+                          public int read() throws IOException
+                          {
+                             return script.read();
+                          }
+                      } );
+        assertEquals( "", "" );
+    }
+
+    /**
</pre><pre class="diff" id="context">      * Test various parts of &lt;code&gt;GroovyJettyContainerBuilder&lt;/code&gt;
      *
      * @throws CompilationFailedException if the groovy script couldn't be compiled
      */
     public void testContainerBuilder() throws CompilationFailedException
     {
</pre><pre class="diff" id="added">+        System.out.println( "\n----- testContainerBuilder() -----\n" );
</pre><pre class="diff" id="context">         final Reader script = new StringReader(
           "package org.codehaus.spice.jervlet.containers.jetty.pico\n" +
           "import org.picocontainer.defaults.DefaultPicoContainer\n" +
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.8</small></center>
</body></html>