[CVS spice] wqork in progress

paul-yCVjj/[email protected] 27 Jul 2005 13:05:27 -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/impl/pico</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1"><span id="added">AnotherTestCase.java</span></a></tt></td><td align="right" id="added">+53</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr>
</table>
<pre class="comment">
wqork in progress
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added">spice/components/jervlet/src/test/org/codehaus/spice/jervlet/impl/pico<br /></span>
<div class="fileheader" id="added"><big><b>AnotherTestCase.java</b></big> <small id="info">added at 1.1</small></div>
<pre class="diff"><small id="info">diff -N AnotherTestCase.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ AnotherTestCase.java	27 Jul 2005 13:05:27 -0000	1.1
@@ -0,0 +1,53 @@
</small></pre><pre class="diff" id="added">+package org.codehaus.spice.jervlet.impl.pico;
+
+import groovy.lang.Binding;
+import groovy.lang.GroovyClassLoader;
+import groovy.lang.GroovyCodeSource;
+import groovy.lang.Script;
+import junit.framework.TestCase;
+import org.codehaus.groovy.runtime.InvokerHelper;
+import org.codehaus.groovy.control.CompilationFailedException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+public class AnotherTestCase extends TestCase {
+    public void testContainerCanBeBuiltWithParent() throws CompilationFailedException {
+        final Reader script = new StringReader("" +
+                "package org.codehaus.spice.jervlet.impl.pico\n" +
+                "import org.codehaus.spice.jervlet.impl.pico.NanoGroovyWebContainerBuilder\n" +
+                "import org.picocontainer.defaults.DefaultPicoContainer\n" +
+                "def pc = new DefaultPicoContainer()\n" +
+                "pc.registerComponentInstance(String.class, \"Foo\")\n" +
+                "def builder = new NanoGroovyWebContainerBuilder()\n" +
+                "def webServer = builder.picoEnabledWebServer(pico:pc, host:\"localhost\", port:8099) {\n" +
+                "    webApp(warPath:\"foo/bar\")\n" +
+                "    webApp {\n" +
+                "      servlet(context:\"/foo\", servletClass:\"foo.bar.AServlet\")\n" +
+                "    }\n" +
+                "}\n" +
+                "webServer.start()\n"
+                );
+        doGroovy(new InputStream() {
+            public int read() throws IOException {
+                return script.read();
+            }
+        });
+        assertEquals("", "");
+    }
+
+    protected void doGroovy(InputStream is) throws CompilationFailedException {
+        Script groovyScript = null;
+        GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader());
+        GroovyCodeSource groovyCodeSource = new GroovyCodeSource(is, "nanocontainer.groovy", "groovyGeneratedForNanoContainer");
+        Class scriptClass = loader.parseClass(groovyCodeSource);
+        groovyScript = InvokerHelper.createScript(scriptClass, null);
+        Binding binding = new Binding();
+        groovyScript.setBinding(binding);
+        Object result = groovyScript.run();
+    }
+
+
+}
</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>