[CVS jcontainer] Renamed org.jcontainer.loom -> org.codehaus.loom
mauro-yCVjj/[email protected] Mon, 19 Apr 2004 17:24:14 -0500
| Newsgroups | gmane.comp.java.jcontainer.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>jcontainer/loom/engine/src/test/org</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>jcontainer/loom/components/logger/<a href="#file1"><span id="removed">config2.xml</span></a></tt></td><td></td><td align="right" id="removed">-29</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config2.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file2"><span id="removed">config1.xml</span></a></tt></td><td></td><td align="right" id="removed">-6</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a> removed</td></tr>
<tr><td><tt> /<a href="#file3"><span id="removed">LogManagerTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-215</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/LogManagerTestCase.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file4"><span id="removed">config3.xml</span></a></tt></td><td></td><td align="right" id="removed">-30</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config3.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr><td><tt>codehaus/loom/components/extension/<a href="#file5"><span id="added">TestExtensionManager.java</span></a></tt></td><td align="right" id="added">+113</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/extension/TestExtensionManager.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file6"><span id="added">ComparatorTestCase.java</span></a></tt></td><td align="right" id="added">+243</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/extension/ComparatorTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>jcontainer/loom/components/assembler/<a href="#file7"><span id="removed">assembly1.xml</span></a></tt></td><td></td><td align="right" id="removed">-20</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/assembly1.xml?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file8"><span id="removed">AssemblerTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-356</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.17&content-type=text/vnd.viewcvs-markup">1.17</a> removed</td></tr>
<tr><td><tt> /<a href="#file9"><span id="removed">assembly2.xml</span></a></tt></td><td></td><td align="right" id="removed">-26</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/assembly2.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr class="alt"><td><tt>codehaus/loom/components/assembler/data/<a href="#file10"><span id="added">Component2.java</span></a></tt></td><td align="right" id="added">+19</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component2.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file11"><span id="added">Component3.java</span></a></tt></td><td align="right" id="added">+57</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component3.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file12"><span id="added">Service1.java</span></a></tt></td><td align="right" id="added">+18</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Service1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file13"><span id="added">Component4.java</span></a></tt></td><td align="right" id="added">+58</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component4.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file14"><span id="added">Listener1.java</span></a></tt></td><td align="right" id="added">+15</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Listener1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file15"><span id="added">Component1.java</span></a></tt></td><td align="right" id="added">+28</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>codehaus/loom/components/application/<a href="#file16"><span id="added">MockApplicationContext.java</span></a></tt></td><td align="right" id="added">+87</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/application/MockApplicationContext.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file17"><span id="added">ApplicationTestCase.java</span></a></tt></td><td align="right" id="added">+356</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/application/ApplicationTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>codehaus/loom/components/logger/<a href="#file18"><span id="added">config3.xml</span></a></tt></td><td align="right" id="added">+30</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config3.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file19"><span id="added">config1.xml</span></a></tt></td><td align="right" id="added">+6</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file20"><span id="added">config2.xml</span></a></tt></td><td align="right" id="added">+29</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config2.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file21"><span id="added">LogManagerTestCase.java</span></a></tt></td><td align="right" id="added">+217</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/LogManagerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>jcontainer/loom/components/extension/<a href="#file22"><span id="removed">TestExtensionManager.java</span></a></tt></td><td></td><td align="right" id="removed">-113</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/extension/TestExtensionManager.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a> removed</td></tr>
<tr><td><tt> /<a href="#file23"><span id="removed">ComparatorTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-242</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/extension/ComparatorTestCase.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a> removed</td></tr>
<tr class="alt"><td><tt>jcontainer/loom/components/assembler/data/<a href="#file24"><span id="removed">Component4.java</span></a></tt></td><td></td><td align="right" id="removed">-58</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component4.java?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr><td><tt> /<a href="#file25"><span id="removed">Component1.java</span></a></tt></td><td></td><td align="right" id="removed">-28</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component1.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file26"><span id="removed">Component3.java</span></a></tt></td><td></td><td align="right" id="removed">-57</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component3.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> removed</td></tr>
<tr><td><tt> /<a href="#file27"><span id="removed">Component2.java</span></a></tt></td><td></td><td align="right" id="removed">-19</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component2.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file28"><span id="removed">Listener1.java</span></a></tt></td><td></td><td align="right" id="removed">-15</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Listener1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a> removed</td></tr>
<tr><td><tt> /<a href="#file29"><span id="removed">Service1.java</span></a></tt></td><td></td><td align="right" id="removed">-18</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Service1.java?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a> removed</td></tr>
<tr class="alt"><td><tt>codehaus/loom/components/assembler/<a href="#file30"><span id="added">AssemblerTestCase.java</span></a></tt></td><td align="right" id="added">+357</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/AssemblerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file31"><span id="added">assembly2.xml</span></a></tt></td><td align="right" id="added">+26</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/assembly2.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file32"><span id="added">assembly1.xml</span></a></tt></td><td align="right" id="added">+20</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/assembly1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt>jcontainer/loom/components/application/<a href="#file33"><span id="removed">ApplicationTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-355</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/application/ApplicationTestCase.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a> removed</td></tr>
<tr class="alt"><td><tt> /<a href="#file34"><span id="removed">MockApplicationContext.java</span></a></tt></td><td></td><td align="right" id="removed">-87</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/application/MockApplicationContext.java?rev=1.11&content-type=text/vnd.viewcvs-markup">1.11</a> removed</td></tr>
<tr><td><tt>codehaus/loom/components/util/verifier/<a href="#file35"><span id="added">VerifierTestCase.java</span></a></tt></td><td align="right" id="added">+233</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/util/verifier/VerifierTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>jcontainer/loom/components/util/verifier/<a href="#file36"><span id="removed">VerifierTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-232</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/util/verifier/VerifierTestCase.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a> removed</td></tr>
<tr><td><tt>codehaus/loom/components/configuration/merger/<a href="#file37"><span id="added">ConfigurationMergerTestCase.java</span></a></tt></td><td align="right" id="added">+191</td><td></td><td nowrap="nowrap" align="right">added <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/configuration/merger/ConfigurationMergerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>jcontainer/loom/components/configuration/merger/<a href="#file38"><span id="removed">ConfigurationMergerTestCase.java</span></a></tt></td><td></td><td align="right" id="removed">-189</td><td nowrap="nowrap"><a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/configuration/merger/ConfigurationMergerTestCase.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a> removed</td></tr>
<tr><td></td><td align="right" id="added">+2103</td><td align="right" id="removed">-2095</td><td></td></tr>
</table>
<small id="info">19 added + 19 removed, total 38 files</small><br />
<pre class="comment">
Renamed org.jcontainer.loom -> org.codehaus.loom
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/logger">logger</a><br /></span>
<div class="fileheader" id="removed"><big><b>config2.xml</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config2.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N config2.xml
--- config2.xml 15 Feb 2004 21:45:04 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
</small></pre><pre class="diff" id="removed">-<logs version="1.1">
- <!-- see http://jakarta.apache.org/avalon/excalibur/logger/index.html -->
- <factories>
- <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
- </factories>
-
- <categories>
- <category name="" log-level="DEBUG">
- <log-target id-ref="default"/>
- </category>
-
- <category name="myBlock" log-level="DEBUG">
- <log-target id-ref="myBlock"/>
- </category>
- </categories>
-
- <targets>
- <file id="default">
- <filename>${app.home}/logs/default.log</filename>
- <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format>
- <append>true</append>
- </file>
- <file id="myBlock">
- <filename>${app.home}/logs/myBlock.log</filename>
- <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format>
- <append>true</append>
- </file>
- </targets>
-</logs>
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/logger">logger</a><br /></span>
<div class="fileheader" id="removed"><big><b>config1.xml</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N config1.xml
--- config1.xml 18 Jul 2003 01:04:54 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,6 +0,0 @@
</small></pre><pre class="diff" id="removed">-<logs version="1.0">
- <category name="" target="default-target" priority="DEBUG"/>
- <category name="myBlock" target="myBlock-target" priority="DEBUG"/>
- <log-target name="default-target" location="/logs/default.log"/>
- <log-target name="myBlock-target" location="/logs/myBlock.log"/>
-</logs>
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/logger">logger</a><br /></span>
<div class="fileheader" id="removed"><big><b>LogManagerTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/LogManagerTestCase.java?rev=1.18&content-type=text/vnd.viewcvs-markup">1.18</a></small></div>
<pre class="diff"><small id="info">diff -N LogManagerTestCase.java
--- LogManagerTestCase.java 18 Apr 2004 23:09:53 -0000 1.18
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,215 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.logger;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-
-import org.apache.avalon.phoenix.BlockContext;
-import org.apache.avalon.phoenix.metadata.BlockListenerMetaData;
-import org.apache.avalon.phoenix.metadata.BlockMetaData;
-import org.apache.avalon.phoenix.metadata.SarMetaData;
-
-import junit.framework.TestCase;
-import org.codehaus.spice.loggerstore.LoggerStore;
-import org.codehaus.spice.salt.io.FileUtil;
-import org.codehaus.dna.Configuration;
-import org.codehaus.dna.Logger;
-import org.codehaus.dna.impl.ConfigurationUtil;
-import org.codehaus.dna.impl.ConsoleLogger;
-import org.codehaus.dna.impl.ContainerUtil;
-import org.jcontainer.loom.interfaces.LogManager;
-import org.xml.sax.InputSource;
-
-/**
- * An basic test case for the LogManager.
- *
- * @author Peter Donald
- * @version $Revision: 1.18 $ $Date: 2004/04/18 23:09:53 $
- */
-public class LogManagerTestCase
- extends TestCase
-{
- private static final String DEFAULT_LOGFILE = "logs" +
- File.separator +
- "default.log";
- private static final String BLOCK_LOGFILE = "logs" +
- File.separator +
- "myBlock.log";
- private File m_baseDirectory;
-
- protected void setUp()
- throws Exception
- {
- m_baseDirectory = generateDirectory();
- //Because log4j does not guarentee dir creation ;(
- final File logDir = new File( m_baseDirectory, "logs" );
- logDir.mkdirs();
- }
-
- private LogManager createLogManager()
- {
- final DefaultLogManager logManager = new DefaultLogManager();
- ContainerUtil.enableLogging( logManager, new ConsoleLogger() );
- return logManager;
- }
-
- public void testBasic()
- throws Exception
- {
- runtTestForConfigFile( 1 );
- }
-
- public void testExcaliburLogger()
- throws Exception
- {
- runtTestForConfigFile( 2 );
- }
-
- public void testLog4jVersion()
- throws Exception
- {
- runtTestForConfigFile( 3 );
- }
-
- private void runtTestForConfigFile( final int index )
- throws Exception
- {
- final LoggerStore hierarchy = createHierarchy( index );
- final Logger rootLogger = hierarchy.getLogger();
- runLoggerTest( rootLogger, DEFAULT_LOGFILE );
-
- final Logger childLogger = hierarchy.getLogger( "myBlock" );
- runLoggerTest( childLogger, BLOCK_LOGFILE );
- }
-
- private void runLoggerTest( final Logger logger,
- final String logfile )
- {
- final long before = getFileSize( logfile );
- logger.warn( "Danger Will Robinson, Danger!" );
- final long after = getFileSize( logfile );
-
- assertFileGrew( logfile, before, after );
- }
-
- private void assertFileGrew( final String logfile,
- final long before,
- final long after )
- {
- assertTrue( "Did " +
- logfile +
- " file grow?, Before: " +
- before +
- ", After: " +
- after,
- before < after );
- }
-
- private long getFileSize( final String filename )
- {
- final File file = new File( m_baseDirectory, filename );
- final StringBuffer sb = new StringBuffer();
- try
- {
- final FileReader fr = new FileReader( file );
- int c = 0;
- while( c != -1 )
- {
- c = fr.read();
- sb.append( Character.forDigit( c, 10 ) );
- }
- }
- catch( Exception e )
- {
- e.printStackTrace();
- }
- return sb.length();
- }
-
- private LoggerStore createHierarchy( final int index )
- throws Exception
- {
- final Configuration logs = loadConfig( "config" + index + ".xml" );
- final LogManager logManager = createLogManager();
- final SarMetaData sarMetaData =
- new SarMetaData( "test",
- m_baseDirectory,
- new BlockMetaData[0],
- new BlockListenerMetaData[0] );
- cleanHomeDirectory( sarMetaData );
-
- //make sure directory is created else log4j will fail.
- if( 3 == index )
- {
- final File file =
- new File( m_baseDirectory.getAbsolutePath() +
- File.separator +
- "logs" );
- file.mkdirs();
- }
-
- final HashMap context = new HashMap();
- context.put( BlockContext.APP_NAME, sarMetaData.getName() );
- context.put( BlockContext.APP_HOME_DIR,
- sarMetaData.getHomeDirectory() );
- context.put( "classloader", getClass().getClassLoader() );
-
- final LoggerStore store =
- logManager.createHierarchy( logs,
- sarMetaData.getHomeDirectory(),
- sarMetaData.getHomeDirectory(),
- context );
- return store;
- }
-
- private void cleanHomeDirectory( final SarMetaData sarMetaData )
- throws IOException
- {
- final File homeDirectory = sarMetaData.getHomeDirectory();
- FileUtil.deleteDirectory( homeDirectory );
- homeDirectory.mkdirs();
- }
-
- private Configuration loadConfig( final String config )
- throws Exception
- {
- final InputStream resource =
- getClass().getResourceAsStream( config );
- return ConfigurationUtil.buildFromXML( new InputSource( resource ) );
- }
-
- private static final File generateDirectory()
- throws IOException
- {
- final File baseDirectory = getBaseDirectory();
- final File dir =
- File.createTempFile( "mgtest", ".tmp", baseDirectory )
- .getCanonicalFile();
- dir.delete();
- dir.mkdirs();
- assertTrue( "dir.exists()", dir.exists() );
- return dir;
- }
-
- private static final File getBaseDirectory()
- {
- final String tempDir = System.getProperty( "java.io.tmpdir" );
- final String baseDir = System.getProperty( "basedir", tempDir );
-
- final File base = new File( baseDir ).getAbsoluteFile();
- final String pathname =
- base + File.separator + "target" + File.separator + "test-data";
- final File dir = new File( pathname );
- dir.mkdirs();
- return dir;
- }
-}
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/logger">logger</a><br /></span>
<div class="fileheader" id="removed"><big><b>config3.xml</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/logger/config3.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N config3.xml
--- config3.xml 15 Feb 2004 21:45:04 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
</small></pre><pre class="diff" id="removed">-<logs version="log4j">
-
- <appender name="DEFAULT" class="org.apache.log4j.FileAppender">
- <param name="File" value="${app.home}/logs/default.log"/>
- <param name="Append" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%p [%c] - %m%n"/>
- </layout>
- </appender>
-
- <appender name="MYBLOCK_FILE" class="org.apache.log4j.FileAppender">
- <param name="File" value="${app.home}/logs/myBlock.log"/>
- <param name="Append" value="false"/>
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%p [%c] - %m%n"/>
- </layout>
- </appender>
-
- <root>
- <priority value="debug"/>
- <appender-ref ref="DEFAULT"/>
- </root>
-
- <logger name="myBlock">
- <priority value="debug"/>
- <appender-ref ref="MYBLOCK_FILE"/>
- </logger>
-</logs>
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/extension">extension</a><br /></span>
<div class="fileheader" id="added"><big><b>TestExtensionManager.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/extension/TestExtensionManager.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N TestExtensionManager.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TestExtensionManager.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,113 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of the JContainer Group nor the name "Loom" nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software
+ * itself, if and wherever such third-party acknowledgments
+ * normally appear.
+ *
+ * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
+ * must not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [email protected]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+package org.codehaus.loom.components.extension;
+
+import org.codehaus.loom.components.extensions.pkgmgr.ExtensionManager;
+import org.codehaus.loom.components.extensions.pkgmgr.OptionalPackage;
+import org.codehaus.loom.extension.Extension;
+
+/**
+ * a class to help test sorting of ExtensionManager.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+class TestExtensionManager
+ implements ExtensionManager
+{
+ private final OptionalPackage[] m_optionalPackages;
+
+ public TestExtensionManager( final OptionalPackage[] optionalPackages )
+ {
+ m_optionalPackages = optionalPackages;
+ }
+
+ public OptionalPackage[] getOptionalPackages( final Extension extension )
+ {
+ return m_optionalPackages;
+ }
+}
</pre></div>
<hr /><a name="file6" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/extension">extension</a><br /></span>
<div class="fileheader" id="added"><big><b>ComparatorTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/extension/ComparatorTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N ComparatorTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ComparatorTestCase.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,243 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of the JContainer Group nor the name "Loom" nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software
+ * itself, if and wherever such third-party acknowledgments
+ * normally appear.
+ *
+ * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
+ * must not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [email protected]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+package org.codehaus.loom.components.extension;
+
+import java.io.File;
+import junit.framework.TestCase;
+
+import org.codehaus.loom.components.extensions.pkgmgr.ExtensionManager;
+import org.codehaus.loom.components.extensions.pkgmgr.OptionalPackage;
+import org.codehaus.loom.components.extensions.pkgmgr.impl.DelegatingExtensionManager;
+import org.codehaus.loom.extension.Extension;
+
+/**
+ * A basic test case for comparator.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+public class ComparatorTestCase
+ extends TestCase
+{
+ private static final String NAME = "Extension1";
+ private static final String VENDOR1 = "Vendor1";
+ private static final String VENDOR2 = "Vendor2";
+
+ public ComparatorTestCase( final String name )
+ {
+ super( name );
+ }
+
+ public void testAllNull()
+ {
+ runCompareTest( null, null, null, null, VENDOR1, VENDOR2 );
+ }
+
+ public void testSpecNonNullV1()
+ {
+ runCompareTest( "1.0", null, "1.1", null, VENDOR2, VENDOR1 );
+ }
+
+ public void testSpecNonNullV2()
+ {
+ runCompareTest( "1.1", null, "1.0", null, VENDOR1, VENDOR2 );
+ }
+
+ public void testSpecNonNullV3()
+ {
+ runCompareTest( "1.1", null, "1.1", null, VENDOR1, VENDOR2 );
+ }
+
+ public void testSpec1Null()
+ {
+ runCompareTest( null, null, "1.1", null, VENDOR2, VENDOR1 );
+ }
+
+ public void testSpec2Null()
+ {
+ runCompareTest( "1.1", null, null, null, VENDOR1, VENDOR2 );
+ }
+
+ public void testImplNull()
+ {
+ runCompareTest( "1.0", null, "1.0", null, VENDOR1, VENDOR2 );
+ }
+
+ public void testImplNonNullV1()
+ {
+ runCompareTest( "1.0", "1.1", "1.0", "1.0", VENDOR1, VENDOR2 );
+ }
+
+ public void testImplNonNullV2()
+ {
+ runCompareTest( "1.0", "1.0", "1.0", "1.1", VENDOR2, VENDOR1 );
+ }
+
+ public void testImplNonNullV3()
+ {
+ runCompareTest( "1.0", "1.1", "1.0", "1.1", VENDOR1, VENDOR2 );
+ }
+
+ public void testImpl1Null()
+ {
+ runCompareTest( "1.0", null, "1.0", "1.1", VENDOR2, VENDOR1 );
+ }
+
+ public void testImpl2Null()
+ {
+ runCompareTest( "1.0", "1.1", "1.0", null, VENDOR1, VENDOR2 );
+ }
+
+ private void runCompareTest( final String specVersion1,
+ final String implVersion1,
+ final String specVersion2,
+ final String implVersion2,
+ final String vendor1,
+ final String vendor2 )
+ {
+ final ExtensionManager manager =
+ createExtensionManager( specVersion1,
+ implVersion1,
+ specVersion2,
+ implVersion2 );
+ final OptionalPackage[] pkgs = getOptionalPackages( manager );
+
+ assertEquals( "pkgs.length", 2, pkgs.length );
+
+ final Extension extension1 = pkgs[ 0 ].getAvailableExtensions()[ 0 ];
+ final Extension extension2 = pkgs[ 1 ].getAvailableExtensions()[ 0 ];
+ assertEquals( "pkgs[0].vendor",
+ vendor1,
+ extension1.getImplementationVendor() );
+ assertEquals( "pkgs[1].vendor",
+ vendor2,
+ extension2.getImplementationVendor() );
+ }
+
+ private OptionalPackage[] getOptionalPackages(
+ final ExtensionManager manager )
+ {
+ return manager.getOptionalPackages(
+ new Extension( NAME, null, null, null, null, null, null ) );
+ }
+
+ private ExtensionManager createExtensionManager( final String specVersion1,
+ final String implVersion1,
+ final String specVersion2,
+ final String implVersion2 )
+ {
+ final OptionalPackage optionalPackage1 =
+ createPackage( VENDOR1, specVersion1, implVersion1 );
+ final OptionalPackage optionalPackage2 =
+ createPackage( VENDOR2, specVersion2, implVersion2 );
+ final OptionalPackage[] pkgs =
+ new OptionalPackage[]{optionalPackage1, optionalPackage2};
+ return createExtensionManager( pkgs );
+ }
+
+ private OptionalPackage createPackage( final String vendor,
+ final String specVersion,
+ final String implVersion )
+ {
+ final Extension extension = new Extension( NAME,
+ specVersion, null,
+ implVersion, vendor, null,
+ null );
+ final File file = new File( "." );
+ final Extension[] available = new Extension[]{extension};
+ final Extension[] required = new Extension[ 0 ];
+ return new OptionalPackage( file, available, required );
+ }
+
+ private ExtensionManager createExtensionManager(
+ final OptionalPackage[] packages )
+ {
+ final TestExtensionManager manager =
+ new TestExtensionManager( packages );
+ return new DelegatingExtensionManager( new ExtensionManager[]{manager} );
+ }
+}
</pre></div>
<hr /><a name="file7" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="removed"><big><b>assembly1.xml</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/assembly1.xml?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -N assembly1.xml
--- assembly1.xml 5 Nov 2003 03:42:12 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<!DOCTYPE assembly PUBLIC "-//LOOM/Assembly DTD Version 1.0//EN"
- "http://jcontainer.codehaus.org/loom/assembly_1.0.dtd">
-
-<assembly>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component1"
- name="c1">
- <provide name="c2"
- role="org.jcontainer.loom.components.assembler.data.Service1"/>
- </block>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component2"
- name="c2">
- <proxy disable="true"/>
- </block>
-
- <listener class="org.jcontainer.loom.components.assembler.data.Listener1"
- name="l1"/>
-</assembly>
</pre></div>
<hr /><a name="file8" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="removed"><big><b>AssemblerTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/AssemblerTestCase.java?rev=1.17&content-type=text/vnd.viewcvs-markup">1.17</a></small></div>
<pre class="diff"><small id="info">diff -N AssemblerTestCase.java
--- AssemblerTestCase.java 18 Apr 2004 23:09:52 -0000 1.17
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,356 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.TestCase;
-import org.codehaus.dna.Configuration;
-import org.codehaus.dna.ConfigurationException;
-import org.codehaus.dna.impl.ConsoleLogger;
-import org.codehaus.dna.impl.DefaultConfiguration;
-import org.jcontainer.loom.components.assembler.data.Component1;
-import org.jcontainer.loom.components.assembler.data.Component2;
-import org.jcontainer.loom.components.assembler.data.Component3;
-import org.jcontainer.loom.components.assembler.data.Listener1;
-import org.jcontainer.loom.components.assembler.data.Service1;
-import org.jcontainer.loom.components.deployer.PhoenixProfileBuilder;
-import org.jcontainer.loom.components.util.ConfigurationBuilder;
-import org.jcontainer.loom.components.util.metadata.DependencyDirective;
-import org.jcontainer.loom.components.util.profile.ComponentProfile;
-import org.jcontainer.loom.components.util.profile.PartitionProfile;
-import org.jcontainer.loom.interfaces.ContainerConstants;
-import org.jcontainer.loom.interfaces.LoomException;
-import org.xml.sax.InputSource;
-
-/**
- * An basic test case for the LogManager.
- *
- * @author Peter Donald
- * @author <a href="mailto:[email protected]">Peter Royal</a>
- * @version $Revision: 1.17 $ $Date: 2004/04/18 23:09:52 $
- */
-public class AssemblerTestCase
- extends TestCase
-{
- public void testBasic()
- throws Exception
- {
- final PartitionProfile partitionProfile = assembleSar( "assembly1.xml" );
- final ComponentProfile[] blocks =
- partitionProfile.getPartition( ContainerConstants.BLOCK_PARTITION ).
- getComponents();
- assertEquals( "Block Count", 2, blocks.length );
-
- final ComponentProfile block1 = blocks[0];
- final ComponentProfile block2 = blocks[1];
- final DependencyDirective[] dependencies1 = block1.getTemplate()
- .getDependencies();
- final DependencyDirective[] dependencies2 = block2.getTemplate()
- .getDependencies();
-
- assertEquals( "Block1 getImplementationKey",
- Component1.class.getName(),
- block1.getTemplate().getImplementationKey() );
- assertEquals( "Block1 getName", "c1", block1.getTemplate().getName() );
- assertEquals( "Block1 getDependencies count",
- 1, dependencies1.length );
- assertEquals( "Block1 dep1 name",
- "c2",
- dependencies1[0].getProviderName() );
- assertEquals( "Block1 dep1 role",
- Service1.class.getName(), dependencies1[0].getKey() );
- assertTrue( "Block1 getBlockInfo non null",
- null != block1.getInfo() );
- assertEquals( "Block1 isDisableProxy",
- false,
- isProxyDisabled( block1 ) );
-
- assertEquals( "Block2 getImplementationKey",
- Component2.class.getName(),
- block2.getTemplate().getImplementationKey() );
- assertEquals( "Block2 getName", "c2", block2.getTemplate().getName() );
- assertEquals( "Block2 getDependencies count",
- 0, dependencies2.length );
- assertTrue( "Block2 getBlockInfo non null",
- null != block2.getInfo() );
- assertEquals( "Block2 isDisableProxy",
- true,
- isProxyDisabled( block2 ) );
-
- final ComponentProfile[] listeners =
- partitionProfile.getPartition( ContainerConstants.LISTENER_PARTITION ).
- getComponents();
- final ComponentProfile listener = listeners[0];
-
- assertEquals( "Listener Count", 1, listeners.length );
- assertEquals( "Listener1 getImplementationKey",
- Listener1.class.getName(),
- listener.getTemplate().getImplementationKey() );
- assertEquals( "Listener1 getName",
- "l1",
- listener.getTemplate().getName() );
- }
-
- private boolean isProxyDisabled( final ComponentProfile block2 )
- {
- return block2.getTemplate().isDisableProxy();
- }
-
- public void testComplex()
- throws Exception
- {
- final PartitionProfile partitionProfile = assembleSar( "assembly2.xml" );
- final ComponentProfile[] blocks =
- partitionProfile.getPartition( ContainerConstants.BLOCK_PARTITION )
- .getComponents();
- assertEquals( "Block Count", 4, blocks.length );
-
- final ComponentProfile block1 = blocks[0];
- final ComponentProfile block2 = blocks[1];
- final ComponentProfile block3 = blocks[2];
- final ComponentProfile block4 = blocks[3];
- final DependencyDirective[] dependencies1 = block1.getTemplate()
- .getDependencies();
- final DependencyDirective[] dependencies2 = block2.getTemplate()
- .getDependencies();
- final DependencyDirective[] dependencies3 = block3.getTemplate()
- .getDependencies();
- final DependencyDirective[] dependencies4 = block4.getTemplate()
- .getDependencies();
-
- assertEquals( "Block1 getImplementationKey",
- Component2.class.getName(),
- block1.getTemplate().getImplementationKey() );
- assertEquals( "Block1 getName",
- "c2a",
- block1.getTemplate().getName() );
- assertEquals( "Block1 getDependencies count",
- 0, dependencies1.length );
- assertTrue( "Block2 getBlockInfo non null",
- null != block1.getInfo() );
- assertEquals( "Block1 isDisableProxy",
- false,
- isProxyDisabled( block1 ) );
-
- assertEquals( "Block2 getImplementationKey",
- Component2.class.getName(),
- block2.getTemplate().getImplementationKey() );
- assertEquals( "Block2 getName",
- "c2b",
- block2.getTemplate().getName() );
- assertEquals( "Block2 getDependencies count",
- 0, dependencies2.length );
- assertTrue( "Block2 getBlockInfo non null",
- null != block2.getInfo() );
- assertEquals( "Block2 isDisableProxy",
- false,
- isProxyDisabled( block2 ) );
-
- assertEquals( "Block3 getImplementationKey",
- Component2.class.getName(),
- block3.getTemplate().getImplementationKey() );
- assertEquals( "Block3 getName",
- "c2c",
- block3.getTemplate().getName() );
- assertEquals( "Block3 getDependencies count",
- 0, dependencies3.length );
- assertTrue( "Block3 getBlockInfo non null",
- null != block3.getInfo() );
- assertEquals( "Block3 isDisableProxy",
- false,
- isProxyDisabled( block3 ) );
-
- assertEquals( "Block4 getImplementationKey",
- Component3.class.getName(),
- block4.getTemplate().getImplementationKey() );
- assertEquals( "Block4 getName", "c3", block4.getTemplate().getName() );
- assertEquals( "Block4 getDependencies count",
- 3, dependencies4.length );
- final DependencyDirective dependency1 = dependencies4[0];
- final DependencyDirective dependency2 = dependencies4[1];
- final DependencyDirective dependency3 = dependencies4[2];
- assertEquals( "Block4 dep1 name",
- "c2a",
- dependency1.getProviderName() );
- assertEquals( "Block4 dep1 role",
- Service1.class.getName(), dependency1.getKey() );
- assertEquals( "Block4 dep1 name",
- "c2b",
- dependency2.getProviderName() );
- assertEquals( "Block4 dep1 role",
- Service1.class.getName(), dependency2.getKey() );
- assertEquals( "Block4 dep1 name",
- "c2c",
- dependency3.getProviderName() );
- assertEquals( "Block4 dep1 role",
- Service1.class.getName(), dependency3.getKey() );
- assertTrue( "Block4 getBlockInfo non null",
- null != block4.getInfo() );
- assertEquals( "Block4 isDisableProxy",
- false,
- isProxyDisabled( block4 ) );
- }
-
- public void testBuildDependencies()
- throws Exception
- {
- final DefaultConfiguration[] provides = new DefaultConfiguration[2];
- final String name0 = "Cheese";
- final String role0 = "market.Cheddar";
- final String name1 = "Bleu";
- final String role1 = "market.blue";
-
- provides[0] = new DefaultConfiguration( "provide", "", "" );
- provides[0].setAttribute( "name", name0 );
- provides[0].setAttribute( "role", role0 );
- provides[1] = new DefaultConfiguration( "provide", "", "" );
- provides[1].setAttribute( "name", name1 );
- provides[1].setAttribute( "role", role1 );
-
- final Assembler assembler = new Assembler();
- final DependencyDirective[] directives = assembler.buildDependencies( provides );
-
- assertEquals( provides.length, directives.length );
- assertEquals( name0, directives[0].getProviderName() );
- assertEquals( name1, directives[1].getProviderName() );
- assertEquals( role0, directives[0].getKey() );
- assertEquals( role1, directives[1].getKey() );
- }
-
- public void testBuildDependency()
- throws Exception
- {
- final String name = "Blah";
- final String alias = name;
- final String role = "com.biz.Service";
- final Assembler assembler = new Assembler();
- final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
- provide.setAttribute( "name", name );
- provide.setAttribute( "role", role );
- final DependencyDirective directive =
- assembler.buildDependency( provide );
- assertEquals( "name", name, directive.getProviderName() );
- assertEquals( "role", role, directive.getKey() );
- assertEquals( "alias", alias, directive.getAlias() );
- }
-
- public void testBuildDependencyThatSpecifiesAlias()
- throws Exception
- {
- final String name = "Blah";
- final String alias = "Blee";
- final String role = "com.biz.Service";
- final Assembler assembler = new Assembler();
- final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
- provide.setAttribute( "name", name );
- provide.setAttribute( "role", role );
- provide.setAttribute( "alias", alias );
- final DependencyDirective directive =
- assembler.buildDependency( provide );
- assertEquals( "name", name, directive.getProviderName() );
- assertEquals( "role", role, directive.getKey() );
- assertEquals( "alias", alias, directive.getAlias() );
- }
-
- public void testBuildDependencyThatMissesName()
- throws Exception
- {
- final Assembler assembler = new Assembler();
- final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
- provide.setAttribute( "role", "com.biz.Service" );
- try
- {
- assembler.buildDependency( provide );
- }
- catch( final ConfigurationException ce )
- {
- return;
- }
- fail( "Expected ConfigurationException due to missing name" );
- }
-
- public void testBuildDependencyThatMissesRole()
- throws Exception
- {
- final Assembler assembler = new Assembler();
- final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
- provide.setAttribute( "name", "MyService" );
- try
- {
- assembler.buildDependency( provide );
- }
- catch( final ConfigurationException ce )
- {
- return;
- }
- fail( "Expected ConfigurationException due to missing role" );
- }
-
- protected PartitionProfile assembleSar( final String config )
- throws Exception
- {
- final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
- final URL resource = getClass().getResource( config );
- assertNotNull( "Config resource: " + config, resource );
- final ConsoleLogger logger = new ConsoleLogger();
- final Configuration assembly =
- ConfigurationBuilder.build( new InputSource( resource.toExternalForm() ),
- ConfigurationBuilder.ASSEMBLY_SCHEMA,
- logger );
- final Map parameters = new HashMap();
- parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
- parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
- parameters.put( ContainerConstants.CONFIG_DESCRIPTOR,
- new DefaultConfiguration( "config", "", "" ) );
- parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
- getClass().getClassLoader() );
-
- assembler.enableLogging( logger );
-
- return assembler.buildProfile( parameters );
- }
-
- public void testMalformedBlockListener()
- throws Exception
- {
- final DefaultConfiguration listener = new DefaultConfiguration( "listner", "", "" );
- final DefaultConfiguration config = new DefaultConfiguration( "config",
- "",
- "" );
- final Assembler assembler = new Assembler();
-
- try
- {
- assembler.buildBlockListener( listener, config );
- fail( "buildBlockListner allowed no 'name' attribute" );
- }
- catch( LoomException e )
- {
- assertEquals( "Malformed listener entry in assembly.xml at \"\". " +
- "(Reason: Attribute named name not specified.).",
- e.getMessage() );
- }
-
- listener.setAttribute( "name", "foo" );
-
- try
- {
- assembler.buildBlockListener( listener, config );
- fail( "buildBlockListner allowed no 'class' attribute" );
- }
- catch( LoomException e )
- {
- assertEquals( "Malformed listener entry in assembly.xml at \"\". " +
- "(Reason: Attribute named class not specified.).",
- e.getMessage() );
- }
- }
-}
</pre></div>
<hr /><a name="file9" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="removed"><big><b>assembly2.xml</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/assembly2.xml?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N assembly2.xml
--- assembly2.xml 5 Nov 2003 03:32:33 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,26 +0,0 @@
</small></pre><pre class="diff" id="removed">-<?xml version="1.0"?>
-<!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
- "http://jcontainer.codehaus.org/loom/assembly_1.0.dtd">
-
-<assembly>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component2"
- name="c2a"/>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component2"
- name="c2b"/>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component2"
- name="c2c"/>
-
- <block class="org.jcontainer.loom.components.assembler.data.Component3"
- name="c3">
- <provide name="c2a"
- role="org.jcontainer.loom.components.assembler.data.Service1"/>
- <provide name="c2b"
- role="org.jcontainer.loom.components.assembler.data.Service1"/>
- <provide name="c2c"
- role="org.jcontainer.loom.components.assembler.data.Service1"/>
- </block>
-
-</assembly>
</pre></div>
<hr /><a name="file10" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Component2.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component2.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Component2.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Component2.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,19 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+/**
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ * @dna.component
+ * @dna.service type="Service1"
+ */
+public class Component2
+ implements Service1
+{
+}
</pre></div>
<hr /><a name="file11" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Component3.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component3.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Component3.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Component3.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,57 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+import java.util.Arrays;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+/**
+ * A test component.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ * @dna.component
+ */
+public class Component3
+ implements Serviceable
+{
+ /**
+ * @dna.dependency type="Service1[]"
+ */
+ public void service( final ServiceManager manager )
+ throws ServiceException
+ {
+ final Service1[] services =
+ (Service1[])manager.lookup( Service1[].class.getName() );
+ System.out.println( "Passed the following services: " +
+ Arrays.asList( services ) );
+ if( 3 != services.length )
+ {
+ final String message =
+ "Expected to get 3 services but got " + services.length;
+ throw new ServiceException( Service1[].class.getName(), message );
+ }
+
+ checkEntry( services, 0 );
+ checkEntry( services, 1 );
+ checkEntry( services, 2 );
+ }
+
+ private void checkEntry( final Service1[] services, final int index )
+ throws ServiceException
+ {
+ if( null == services[ index ] )
+ {
+ final String message = "Expected non null service entry for " +
+ index;
+ throw new ServiceException( Service1[].class.getName(), message );
+ }
+ }
+}
</pre></div>
<hr /><a name="file12" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Service1.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Service1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Service1.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Service1.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,18 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+/**
+ * A test service.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+public interface Service1
+{
+}
</pre></div>
<hr /><a name="file13" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Component4.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component4.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Component4.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Component4.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,58 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+/**
+ * A test component.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ * @dna.component
+ */
+public class Component4
+ implements Serviceable
+{
+ /**
+ * @dna.dependency type="Service1{}"
+ */
+ public void service( final ServiceManager manager )
+ throws ServiceException
+ {
+ final Map services =
+ (Map)manager.lookup( Service1.class.getName() + "{}" );
+ System.out.println( "Passed the following services: " +
+ services.keySet() );
+ if( 3 != services.size() )
+ {
+ final String message =
+ "Expected to get 3 services but got " + services.size();
+ throw new ServiceException( Service1.class.getName() + "{}",
+ message );
+ }
+
+ final Iterator iterator = services.keySet().iterator();
+ while( iterator.hasNext() )
+ {
+ final String key = (String)iterator.next();
+ final Service1 service1 = (Service1)services.get( key );
+ if( null == service1 )
+ {
+ final String message = "Expected non null service entry for " +
+ key;
+ throw new ServiceException( Service1[].class.getName(),
+ message );
+ }
+ }
+ }
+}
</pre></div>
<hr /><a name="file14" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Listener1.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Listener1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Listener1.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Listener1.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,15 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+/**
+ * @author <a href="mailto:[email protected]">peter royal</a>
+ */
+public class Listener1
+{
+}
</pre></div>
<hr /><a name="file15" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/!
loom/engine/src/test/org/codehaus/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="added"><big><b>Component1.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/data/Component1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Component1.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Component1.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,28 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler.data;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+
+/**
+ * @dna.component
+ */
+public class Component1
+ implements Serviceable
+{
+ /**
+ * @dna.dependency type="Service1"
+ */
+ public void service( final ServiceManager manager )
+ throws ServiceException
+ {
+ manager.lookup( Service1.class.getName() );
+ }
+}
</pre></div>
<hr /><a name="file16" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/application">application</a><br /></span>
<div class="fileheader" id="added"><big><b>MockApplicationContext.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/application/MockApplicationContext.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N MockApplicationContext.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MockApplicationContext.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,87 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.application;
+
+import java.io.File;
+import java.io.InputStream;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.excalibur.instrument.InstrumentManager;
+import org.codehaus.loom.components.instrument.NoopInstrumentManager;
+import org.codehaus.loom.components.util.profile.PartitionProfile;
+import org.codehaus.loom.interfaces.ApplicationContext;
+import org.codehaus.spice.alchemist.LoggerAlchemist;
+
+/**
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+class MockApplicationContext
+ implements ApplicationContext
+{
+ private final PartitionProfile m_sarMetaData;
+ private final org.codehaus.dna.Logger m_logger;
+
+ public MockApplicationContext( final PartitionProfile sarMetaData,
+ final org.codehaus.dna.Logger logger )
+ {
+ m_sarMetaData = sarMetaData;
+ m_logger = logger;
+ }
+
+ public PartitionProfile getPartitionProfile()
+ {
+ return m_sarMetaData;
+ }
+
+ public void requestShutdown()
+ {
+ //ignore
+ }
+
+ public void exportObject( String name, Object object )
+ throws Exception
+ {
+ //ignore
+ }
+
+ public void unexportObject( String name )
+ throws Exception
+ {
+ //ignore
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return getClass().getClassLoader();
+ }
+
+ public InputStream getResourceAsStream( final String name )
+ {
+ return getClass().getClassLoader().getResourceAsStream( name );
+ }
+
+ public File getHomeDirectory()
+ {
+ return new File( "." );
+ }
+
+ public Logger getLogger( String name )
+ {
+ return LoggerAlchemist.toAvalonLogger( m_logger );
+ }
+
+ public InstrumentManager getInstrumentManager()
+ {
+ return new NoopInstrumentManager();
+ }
+
+ public String getInstrumentableName( String component )
+ {
+ return component;
+ }
+}
</pre></div>
<hr /><a name="file17" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/application">application</a><br /></span>
<div class="fileheader" id="added"><big><b>ApplicationTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/application/ApplicationTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N ApplicationTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ApplicationTestCase.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,356 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.application;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import junit.framework.TestCase;
+import org.codehaus.dna.Configuration;
+import org.codehaus.dna.impl.ConsoleLogger;
+import org.codehaus.dna.impl.DefaultConfiguration;
+import org.codehaus.loom.components.application.DefaultApplication;
+import org.codehaus.loom.components.assembler.data.Component1;
+import org.codehaus.loom.components.assembler.data.Component2;
+import org.codehaus.loom.components.assembler.data.Component3;
+import org.codehaus.loom.components.assembler.data.Component4;
+import org.codehaus.loom.components.assembler.data.Service1;
+import org.codehaus.loom.components.deployer.PhoenixProfileBuilder;
+import org.codehaus.loom.components.util.ConfigurationBuilder;
+import org.codehaus.loom.components.util.info.ComponentInfo;
+import org.codehaus.loom.components.util.info.DependencyDescriptor;
+import org.codehaus.loom.components.util.info.ServiceDescriptor;
+import org.codehaus.loom.components.util.metadata.ComponentTemplate;
+import org.codehaus.loom.components.util.metadata.DependencyDirective;
+import org.codehaus.loom.components.util.metadata.PartitionTemplate;
+import org.codehaus.loom.components.util.profile.ComponentProfile;
+import org.codehaus.loom.components.util.profile.PartitionProfile;
+import org.codehaus.loom.interfaces.ContainerConstants;
+import org.xml.sax.InputSource;
+
+/**
+ * An basic test case for the Application.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+public class ApplicationTestCase
+ extends TestCase
+{
+ private static final Class S1_TYPE = Service1.class;
+ private static final Class C1_TYPE = Component1.class;
+ private static final Class C2_TYPE = Component2.class;
+ private static final Class C3_TYPE = Component3.class;
+ private static final Class C4_TYPE = Component4.class;
+
+ private static final String S1_NAME = S1_TYPE.getName();
+ private static final String C1_NAME = C1_TYPE.getName();
+ private static final String C2_NAME = C2_TYPE.getName();
+ private static final String C3_NAME = C3_TYPE.getName();
+ private static final String C4_NAME = C4_TYPE.getName();
+
+ private static final String S1_ARRAY_NAME = S1_NAME +
+ DependencyDescriptor.ARRAY_POSTFIX;
+ private static final String S1_MAP_NAME = S1_NAME +
+ DependencyDescriptor.MAP_POSTFIX;
+
+ private static final ComponentInfo C1 =
+ new ComponentInfo( C1_TYPE,
+ ServiceDescriptor.EMPTY_SET,
+ new DependencyDescriptor[]{
+ new DependencyDescriptor( S1_NAME,
+ S1_NAME,
+ false )},
+ null );
+
+ private static final ComponentInfo C2 =
+ new ComponentInfo( C2_TYPE,
+ new ServiceDescriptor[]{
+ new ServiceDescriptor( S1_NAME )},
+ DependencyDescriptor.EMPTY_SET,
+ null );
+
+ private static final ComponentInfo C3 =
+ new ComponentInfo( C3_TYPE,
+ ServiceDescriptor.EMPTY_SET,
+ new DependencyDescriptor[]{
+ new DependencyDescriptor( S1_ARRAY_NAME,
+ S1_ARRAY_NAME,
+ false )},
+ null );
+
+ private static final ComponentInfo C4 =
+ new ComponentInfo( C4_TYPE,
+ ServiceDescriptor.EMPTY_SET,
+ new DependencyDescriptor[]{
+ new DependencyDescriptor( S1_MAP_NAME,
+ S1_MAP_NAME,
+ false )},
+ null );
+
+ public void testBasic()
+ throws Exception
+ {
+ final ComponentTemplate md1 =
+ new ComponentTemplate( "c1",
+ C1_NAME,
+ new DependencyDirective[]{
+ new DependencyDirective( S1_NAME,
+ "c2",
+ "c2" )},
+ null,
+ null,
+ false );
+ final ComponentProfile cp1 = new ComponentProfile( C1, md1 );
+ final ComponentTemplate md2 =
+ new ComponentTemplate( "c2",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ true );
+ final ComponentProfile cp2 = new ComponentProfile( C2, md2 );
+ final PartitionTemplate blockPartitionMD =
+ new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
+ new String[]{
+ ContainerConstants.LISTENER_PARTITION},
+ PartitionTemplate.EMPTY_SET,
+ new ComponentTemplate[]{md1, md2} );
+ final PartitionTemplate listenerPartitionMD =
+ new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
+ new String[ 0 ],
+ PartitionTemplate.EMPTY_SET,
+ ComponentTemplate.EMPTY_SET );
+ final PartitionTemplate partitionMD =
+ new PartitionTemplate( "test",
+ new String[ 0 ],
+ new PartitionTemplate[]{blockPartitionMD,
+ listenerPartitionMD},
+ ComponentTemplate.EMPTY_SET );
+
+ final PartitionProfile blockPartitionProfile =
+ new PartitionProfile( blockPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ new ComponentProfile[]{cp1, cp2} );
+ final PartitionProfile listenerPartitionProfile =
+ new PartitionProfile( listenerPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ ComponentProfile.EMPTY_SET );
+ final PartitionProfile partitionProfile =
+ new PartitionProfile( partitionMD,
+ new PartitionProfile[]{blockPartitionProfile,
+ listenerPartitionProfile},
+ ComponentProfile.EMPTY_SET );
+ runApplicationTest( partitionProfile );
+ }
+
+ public void testArrayAssembly()
+ throws Exception
+ {
+ final DependencyDirective[] c3Deps =
+ new DependencyDirective[]{new DependencyDirective( S1_ARRAY_NAME,
+ "c2a",
+ "c2a" ),
+ new DependencyDirective( S1_ARRAY_NAME,
+ "c2b",
+ "c2b" ),
+ new DependencyDirective( S1_ARRAY_NAME,
+ "c2c",
+ "c2c" )};
+ final ComponentTemplate md3 =
+ new ComponentTemplate( "c3",
+ C3_NAME,
+ c3Deps,
+ null,
+ null,
+ false );
+ final ComponentProfile cp3 = new ComponentProfile( C3, md3 );
+ final ComponentTemplate md2a =
+ new ComponentTemplate( "c2a",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2a = new ComponentProfile( C2, md2a );
+ final ComponentTemplate md2b =
+ new ComponentTemplate( "c2b",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2b = new ComponentProfile( C2, md2b );
+ final ComponentTemplate md2c =
+ new ComponentTemplate( "c2c",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2c = new ComponentProfile( C2, md2c );
+
+ final PartitionTemplate blockPartitionMD =
+ new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
+ new String[]{
+ ContainerConstants.LISTENER_PARTITION},
+ PartitionTemplate.EMPTY_SET,
+ new ComponentTemplate[]{md3,
+ md2a,
+ md2b,
+ md2c} );
+ final PartitionTemplate listenerPartitionMD =
+ new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
+ new String[ 0 ],
+ PartitionTemplate.EMPTY_SET,
+ ComponentTemplate.EMPTY_SET );
+ final PartitionTemplate partitionMD =
+ new PartitionTemplate( "test",
+ new String[ 0 ],
+ new PartitionTemplate[]{blockPartitionMD,
+ listenerPartitionMD},
+ ComponentTemplate.EMPTY_SET );
+
+ final PartitionProfile blockPartitionProfile =
+ new PartitionProfile( blockPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ new ComponentProfile[]{cp3,
+ cp2a,
+ cp2b,
+ cp2c} );
+ final PartitionProfile listenerPartitionProfile =
+ new PartitionProfile( listenerPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ ComponentProfile.EMPTY_SET );
+ final PartitionProfile partitionProfile =
+ new PartitionProfile( partitionMD,
+ new PartitionProfile[]{blockPartitionProfile,
+ listenerPartitionProfile},
+ ComponentProfile.EMPTY_SET );
+ runApplicationTest( partitionProfile );
+ }
+
+ public void testMapAssembly()
+ throws Exception
+ {
+ final DependencyDirective[] c4Deps =
+ new DependencyDirective[]{new DependencyDirective( S1_MAP_NAME,
+ "c2a",
+ "c2a" ),
+ new DependencyDirective( S1_MAP_NAME,
+ "c2b",
+ "c2b" ),
+ new DependencyDirective( S1_MAP_NAME,
+ "c2c",
+ "anAlias" )};
+ final ComponentTemplate md4 =
+ new ComponentTemplate( "c4",
+ C4_NAME,
+ c4Deps,
+ null,
+ null,
+ false );
+ final ComponentProfile cp4 = new ComponentProfile( C4, md4 );
+ final ComponentTemplate md2a =
+ new ComponentTemplate( "c2a",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2a = new ComponentProfile( C2, md2a );
+ final ComponentTemplate md2b =
+ new ComponentTemplate( "c2b",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2b = new ComponentProfile( C2, md2b );
+ final ComponentTemplate md2c =
+ new ComponentTemplate( "c2c",
+ C2_NAME,
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentProfile cp2c = new ComponentProfile( C2, md2c );
+
+ final PartitionTemplate blockPartitionMD =
+ new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
+ new String[]{
+ ContainerConstants.LISTENER_PARTITION},
+ PartitionTemplate.EMPTY_SET,
+ new ComponentTemplate[]{md4,
+ md2a,
+ md2b,
+ md2c} );
+ final PartitionTemplate listenerPartitionMD =
+ new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
+ new String[ 0 ],
+ PartitionTemplate.EMPTY_SET,
+ ComponentTemplate.EMPTY_SET );
+ final PartitionTemplate partitionMD =
+ new PartitionTemplate( "test",
+ new String[ 0 ],
+ new PartitionTemplate[]{blockPartitionMD,
+ listenerPartitionMD},
+ ComponentTemplate.EMPTY_SET );
+
+ final PartitionProfile blockPartitionProfile =
+ new PartitionProfile( blockPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ new ComponentProfile[]{cp4,
+ cp2a,
+ cp2b,
+ cp2c} );
+ final PartitionProfile listenerPartitionProfile =
+ new PartitionProfile( listenerPartitionMD,
+ PartitionProfile.EMPTY_SET,
+ ComponentProfile.EMPTY_SET );
+ final PartitionProfile partitionProfile =
+ new PartitionProfile( partitionMD,
+ new PartitionProfile[]{blockPartitionProfile,
+ listenerPartitionProfile},
+ ComponentProfile.EMPTY_SET );
+ runApplicationTest( partitionProfile );
+ }
+
+ private void runApplicationTest( final PartitionProfile sarMetaData )
+ throws Exception
+ {
+ final DefaultApplication application = new DefaultApplication();
+ application.enableLogging( new ConsoleLogger() );
+ final MockApplicationContext context =
+ new MockApplicationContext( sarMetaData, new ConsoleLogger() );
+ application.setApplicationContext( context );
+ application.initialize();
+ application.dispose();
+ }
+
+ protected PartitionProfile assembleSar( final String config )
+ throws Exception
+ {
+ final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
+ final URL resource = getClass().getResource( config );
+ assertNotNull( "Config resource: " + config, resource );
+ final Configuration assembly =
+ ConfigurationBuilder.build(
+ new InputSource( resource.toExternalForm() ),
+ ConfigurationBuilder.ASSEMBLY_SCHEMA,
+ new ConsoleLogger() );
+ final Map parameters = new HashMap();
+ parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
+ parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
+ parameters.put( ContainerConstants.CONFIG_DESCRIPTOR,
+ new DefaultConfiguration( "config", "", "" ) );
+ parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
+ getClass().getClassLoader() );
+ return assembler.buildProfile( parameters );
+ }
+}
</pre></div>
<hr /><a name="file18" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/logger">logger</a><br /></span>
<div class="fileheader" id="added"><big><b>config3.xml</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config3.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N config3.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ config3.xml 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,30 @@
</small></pre><pre class="diff" id="added">+<logs version="log4j">
+
+ <appender name="DEFAULT" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${app.home}/logs/default.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%p [%c] - %m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="MYBLOCK_FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${app.home}/logs/myBlock.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%p [%c] - %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <priority value="debug"/>
+ <appender-ref ref="DEFAULT"/>
+ </root>
+
+ <logger name="myBlock">
+ <priority value="debug"/>
+ <appender-ref ref="MYBLOCK_FILE"/>
+ </logger>
+</logs>
</pre></div>
<hr /><a name="file19" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/logger">logger</a><br /></span>
<div class="fileheader" id="added"><big><b>config1.xml</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N config1.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ config1.xml 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,6 @@
</small></pre><pre class="diff" id="added">+<logs version="1.0">
+ <category name="" target="default-target" priority="DEBUG"/>
+ <category name="myBlock" target="myBlock-target" priority="DEBUG"/>
+ <log-target name="default-target" location="/logs/default.log"/>
+ <log-target name="myBlock-target" location="/logs/myBlock.log"/>
+</logs>
</pre></div>
<hr /><a name="file20" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/logger">logger</a><br /></span>
<div class="fileheader" id="added"><big><b>config2.xml</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/config2.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N config2.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ config2.xml 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,29 @@
</small></pre><pre class="diff" id="added">+<logs version="1.1">
+ <!-- see http://jakarta.apache.org/avalon/excalibur/logger/index.html -->
+ <factories>
+ <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
+ </factories>
+
+ <categories>
+ <category name="" log-level="DEBUG">
+ <log-target id-ref="default"/>
+ </category>
+
+ <category name="myBlock" log-level="DEBUG">
+ <log-target id-ref="myBlock"/>
+ </category>
+ </categories>
+
+ <targets>
+ <file id="default">
+ <filename>${app.home}/logs/default.log</filename>
+ <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format>
+ <append>true</append>
+ </file>
+ <file id="myBlock">
+ <filename>${app.home}/logs/myBlock.log</filename>
+ <format>%{time:dd/MM/yy hh:mm:ss} %5.5{priority} %{category}: %{message}\n%{throwable}</format>
+ <append>true</append>
+ </file>
+ </targets>
+</logs>
</pre></div>
<hr /><a name="file21" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/logger">logger</a><br /></span>
<div class="fileheader" id="added"><big><b>LogManagerTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/logger/LogManagerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N LogManagerTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LogManagerTestCase.java 19 Apr 2004 22:24:07 -0000 1.1
@@ -0,0 +1,217 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.logger;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+
+import org.apache.avalon.phoenix.BlockContext;
+import org.apache.avalon.phoenix.metadata.BlockListenerMetaData;
+import org.apache.avalon.phoenix.metadata.BlockMetaData;
+import org.apache.avalon.phoenix.metadata.SarMetaData;
+
+import junit.framework.TestCase;
+
+import org.codehaus.loom.components.logger.DefaultLogManager;
+import org.codehaus.loom.interfaces.LogManager;
+import org.codehaus.spice.loggerstore.LoggerStore;
+import org.codehaus.spice.salt.io.FileUtil;
+import org.codehaus.dna.Configuration;
+import org.codehaus.dna.Logger;
+import org.codehaus.dna.impl.ConfigurationUtil;
+import org.codehaus.dna.impl.ConsoleLogger;
+import org.codehaus.dna.impl.ContainerUtil;
+import org.xml.sax.InputSource;
+
+/**
+ * An basic test case for the LogManager.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:07 $
+ */
+public class LogManagerTestCase
+ extends TestCase
+{
+ private static final String DEFAULT_LOGFILE = "logs" +
+ File.separator +
+ "default.log";
+ private static final String BLOCK_LOGFILE = "logs" +
+ File.separator +
+ "myBlock.log";
+ private File m_baseDirectory;
+
+ protected void setUp()
+ throws Exception
+ {
+ m_baseDirectory = generateDirectory();
+ //Because log4j does not guarentee dir creation ;(
+ final File logDir = new File( m_baseDirectory, "logs" );
+ logDir.mkdirs();
+ }
+
+ private LogManager createLogManager()
+ {
+ final DefaultLogManager logManager = new DefaultLogManager();
+ ContainerUtil.enableLogging( logManager, new ConsoleLogger() );
+ return logManager;
+ }
+
+ public void testBasic()
+ throws Exception
+ {
+ runtTestForConfigFile( 1 );
+ }
+
+ public void testExcaliburLogger()
+ throws Exception
+ {
+ runtTestForConfigFile( 2 );
+ }
+
+ public void testLog4jVersion()
+ throws Exception
+ {
+ runtTestForConfigFile( 3 );
+ }
+
+ private void runtTestForConfigFile( final int index )
+ throws Exception
+ {
+ final LoggerStore hierarchy = createHierarchy( index );
+ final Logger rootLogger = hierarchy.getLogger();
+ runLoggerTest( rootLogger, DEFAULT_LOGFILE );
+
+ final Logger childLogger = hierarchy.getLogger( "myBlock" );
+ runLoggerTest( childLogger, BLOCK_LOGFILE );
+ }
+
+ private void runLoggerTest( final Logger logger,
+ final String logfile )
+ {
+ final long before = getFileSize( logfile );
+ logger.warn( "Danger Will Robinson, Danger!" );
+ final long after = getFileSize( logfile );
+
+ assertFileGrew( logfile, before, after );
+ }
+
+ private void assertFileGrew( final String logfile,
+ final long before,
+ final long after )
+ {
+ assertTrue( "Did " +
+ logfile +
+ " file grow?, Before: " +
+ before +
+ ", After: " +
+ after,
+ before < after );
+ }
+
+ private long getFileSize( final String filename )
+ {
+ final File file = new File( m_baseDirectory, filename );
+ final StringBuffer sb = new StringBuffer();
+ try
+ {
+ final FileReader fr = new FileReader( file );
+ int c = 0;
+ while( c != -1 )
+ {
+ c = fr.read();
+ sb.append( Character.forDigit( c, 10 ) );
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ return sb.length();
+ }
+
+ private LoggerStore createHierarchy( final int index )
+ throws Exception
+ {
+ final Configuration logs = loadConfig( "config" + index + ".xml" );
+ final LogManager logManager = createLogManager();
+ final SarMetaData sarMetaData =
+ new SarMetaData( "test",
+ m_baseDirectory,
+ new BlockMetaData[0],
+ new BlockListenerMetaData[0] );
+ cleanHomeDirectory( sarMetaData );
+
+ //make sure directory is created else log4j will fail.
+ if( 3 == index )
+ {
+ final File file =
+ new File( m_baseDirectory.getAbsolutePath() +
+ File.separator +
+ "logs" );
+ file.mkdirs();
+ }
+
+ final HashMap context = new HashMap();
+ context.put( BlockContext.APP_NAME, sarMetaData.getName() );
+ context.put( BlockContext.APP_HOME_DIR,
+ sarMetaData.getHomeDirectory() );
+ context.put( "classloader", getClass().getClassLoader() );
+
+ final LoggerStore store =
+ logManager.createHierarchy( logs,
+ sarMetaData.getHomeDirectory(),
+ sarMetaData.getHomeDirectory(),
+ context );
+ return store;
+ }
+
+ private void cleanHomeDirectory( final SarMetaData sarMetaData )
+ throws IOException
+ {
+ final File homeDirectory = sarMetaData.getHomeDirectory();
+ FileUtil.deleteDirectory( homeDirectory );
+ homeDirectory.mkdirs();
+ }
+
+ private Configuration loadConfig( final String config )
+ throws Exception
+ {
+ final InputStream resource =
+ getClass().getResourceAsStream( config );
+ return ConfigurationUtil.buildFromXML( new InputSource( resource ) );
+ }
+
+ private static final File generateDirectory()
+ throws IOException
+ {
+ final File baseDirectory = getBaseDirectory();
+ final File dir =
+ File.createTempFile( "mgtest", ".tmp", baseDirectory )
+ .getCanonicalFile();
+ dir.delete();
+ dir.mkdirs();
+ assertTrue( "dir.exists()", dir.exists() );
+ return dir;
+ }
+
+ private static final File getBaseDirectory()
+ {
+ final String tempDir = System.getProperty( "java.io.tmpdir" );
+ final String baseDir = System.getProperty( "basedir", tempDir );
+
+ final File base = new File( baseDir ).getAbsoluteFile();
+ final String pathname =
+ base + File.separator + "target" + File.separator + "test-data";
+ final File dir = new File( pathname );
+ dir.mkdirs();
+ return dir;
+ }
+}
</pre></div>
<hr /><a name="file22" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/extension">extension</a><br /></span>
<div class="fileheader" id="removed"><big><b>TestExtensionManager.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/extension/TestExtensionManager.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a></small></div>
<pre class="diff"><small id="info">diff -N TestExtensionManager.java
--- TestExtensionManager.java 31 Mar 2004 03:39:04 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,113 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. Neither the name of the JContainer Group nor the name "Loom" nor
- * the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software
- * itself, if and wherever such third-party acknowledgments
- * normally appear.
- *
- * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
- * must not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [email protected]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-package org.jcontainer.loom.components.extension;
-
-import org.jcontainer.loom.extension.Extension;
-import org.jcontainer.loom.components.extensions.pkgmgr.ExtensionManager;
-import org.jcontainer.loom.components.extensions.pkgmgr.OptionalPackage;
-
-/**
- * a class to help test sorting of ExtensionManager.
- *
- * @author Peter Donald
- * @version $Revision: 1.8 $ $Date: 2004/03/31 03:39:04 $
- */
-class TestExtensionManager
- implements ExtensionManager
-{
- private final OptionalPackage[] m_optionalPackages;
-
- public TestExtensionManager( final OptionalPackage[] optionalPackages )
- {
- m_optionalPackages = optionalPackages;
- }
-
- public OptionalPackage[] getOptionalPackages( final Extension extension )
- {
- return m_optionalPackages;
- }
-}
</pre></div>
<hr /><a name="file23" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/extension">extension</a><br /></span>
<div class="fileheader" id="removed"><big><b>ComparatorTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/extension/ComparatorTestCase.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a></small></div>
<pre class="diff"><small id="info">diff -N ComparatorTestCase.java
--- ComparatorTestCase.java 31 Mar 2004 03:39:04 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,242 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. Neither the name of the JContainer Group nor the name "Loom" nor
- * the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software
- * itself, if and wherever such third-party acknowledgments
- * normally appear.
- *
- * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
- * must not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [email protected]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-package org.jcontainer.loom.components.extension;
-
-import java.io.File;
-import junit.framework.TestCase;
-import org.jcontainer.loom.extension.Extension;
-import org.jcontainer.loom.components.extensions.pkgmgr.ExtensionManager;
-import org.jcontainer.loom.components.extensions.pkgmgr.OptionalPackage;
-import org.jcontainer.loom.components.extensions.pkgmgr.impl.DelegatingExtensionManager;
-
-/**
- * A basic test case for comparator.
- *
- * @author Peter Donald
- * @version $Revision: 1.8 $ $Date: 2004/03/31 03:39:04 $
- */
-public class ComparatorTestCase
- extends TestCase
-{
- private static final String NAME = "Extension1";
- private static final String VENDOR1 = "Vendor1";
- private static final String VENDOR2 = "Vendor2";
-
- public ComparatorTestCase( final String name )
- {
- super( name );
- }
-
- public void testAllNull()
- {
- runCompareTest( null, null, null, null, VENDOR1, VENDOR2 );
- }
-
- public void testSpecNonNullV1()
- {
- runCompareTest( "1.0", null, "1.1", null, VENDOR2, VENDOR1 );
- }
-
- public void testSpecNonNullV2()
- {
- runCompareTest( "1.1", null, "1.0", null, VENDOR1, VENDOR2 );
- }
-
- public void testSpecNonNullV3()
- {
- runCompareTest( "1.1", null, "1.1", null, VENDOR1, VENDOR2 );
- }
-
- public void testSpec1Null()
- {
- runCompareTest( null, null, "1.1", null, VENDOR2, VENDOR1 );
- }
-
- public void testSpec2Null()
- {
- runCompareTest( "1.1", null, null, null, VENDOR1, VENDOR2 );
- }
-
- public void testImplNull()
- {
- runCompareTest( "1.0", null, "1.0", null, VENDOR1, VENDOR2 );
- }
-
- public void testImplNonNullV1()
- {
- runCompareTest( "1.0", "1.1", "1.0", "1.0", VENDOR1, VENDOR2 );
- }
-
- public void testImplNonNullV2()
- {
- runCompareTest( "1.0", "1.0", "1.0", "1.1", VENDOR2, VENDOR1 );
- }
-
- public void testImplNonNullV3()
- {
- runCompareTest( "1.0", "1.1", "1.0", "1.1", VENDOR1, VENDOR2 );
- }
-
- public void testImpl1Null()
- {
- runCompareTest( "1.0", null, "1.0", "1.1", VENDOR2, VENDOR1 );
- }
-
- public void testImpl2Null()
- {
- runCompareTest( "1.0", "1.1", "1.0", null, VENDOR1, VENDOR2 );
- }
-
- private void runCompareTest( final String specVersion1,
- final String implVersion1,
- final String specVersion2,
- final String implVersion2,
- final String vendor1,
- final String vendor2 )
- {
- final ExtensionManager manager =
- createExtensionManager( specVersion1,
- implVersion1,
- specVersion2,
- implVersion2 );
- final OptionalPackage[] pkgs = getOptionalPackages( manager );
-
- assertEquals( "pkgs.length", 2, pkgs.length );
-
- final Extension extension1 = pkgs[ 0 ].getAvailableExtensions()[ 0 ];
- final Extension extension2 = pkgs[ 1 ].getAvailableExtensions()[ 0 ];
- assertEquals( "pkgs[0].vendor",
- vendor1,
- extension1.getImplementationVendor() );
- assertEquals( "pkgs[1].vendor",
- vendor2,
- extension2.getImplementationVendor() );
- }
-
- private OptionalPackage[] getOptionalPackages(
- final ExtensionManager manager )
- {
- return manager.getOptionalPackages(
- new Extension( NAME, null, null, null, null, null, null ) );
- }
-
- private ExtensionManager createExtensionManager( final String specVersion1,
- final String implVersion1,
- final String specVersion2,
- final String implVersion2 )
- {
- final OptionalPackage optionalPackage1 =
- createPackage( VENDOR1, specVersion1, implVersion1 );
- final OptionalPackage optionalPackage2 =
- createPackage( VENDOR2, specVersion2, implVersion2 );
- final OptionalPackage[] pkgs =
- new OptionalPackage[]{optionalPackage1, optionalPackage2};
- return createExtensionManager( pkgs );
- }
-
- private OptionalPackage createPackage( final String vendor,
- final String specVersion,
- final String implVersion )
- {
- final Extension extension = new Extension( NAME,
- specVersion, null,
- implVersion, vendor, null,
- null );
- final File file = new File( "." );
- final Extension[] available = new Extension[]{extension};
- final Extension[] required = new Extension[ 0 ];
- return new OptionalPackage( file, available, required );
- }
-
- private ExtensionManager createExtensionManager(
- final OptionalPackage[] packages )
- {
- final TestExtensionManager manager =
- new TestExtensionManager( packages );
- return new DelegatingExtensionManager( new ExtensionManager[]{manager} );
- }
-}
</pre></div>
<hr /><a name="file24" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Component4.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component4.java?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N Component4.java
--- Component4.java 29 Nov 2003 13:44:30 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,58 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-/**
- * A test component.
- *
- * @author Peter Donald
- * @version $Revision: 1.2 $ $Date: 2003/11/29 13:44:30 $
- * @dna.component
- */
-public class Component4
- implements Serviceable
-{
- /**
- * @dna.dependency type="Service1{}"
- */
- public void service( final ServiceManager manager )
- throws ServiceException
- {
- final Map services =
- (Map)manager.lookup( Service1.class.getName() + "{}" );
- System.out.println( "Passed the following services: " +
- services.keySet() );
- if( 3 != services.size() )
- {
- final String message =
- "Expected to get 3 services but got " + services.size();
- throw new ServiceException( Service1.class.getName() + "{}",
- message );
- }
-
- final Iterator iterator = services.keySet().iterator();
- while( iterator.hasNext() )
- {
- final String key = (String)iterator.next();
- final Service1 service1 = (Service1)services.get( key );
- if( null == service1 )
- {
- final String message = "Expected non null service entry for " +
- key;
- throw new ServiceException( Service1[].class.getName(),
- message );
- }
- }
- }
-}
</pre></div>
<hr /><a name="file25" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Component1.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component1.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a></small></div>
<pre class="diff"><small id="info">diff -N Component1.java
--- Component1.java 16 Oct 2003 14:45:54 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-/**
- * @dna.component
- */
-public class Component1
- implements Serviceable
-{
- /**
- * @dna.dependency type="Service1"
- */
- public void service( final ServiceManager manager )
- throws ServiceException
- {
- manager.lookup( Service1.class.getName() );
- }
-}
</pre></div>
<hr /><a name="file26" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Component3.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component3.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a></small></div>
<pre class="diff"><small id="info">diff -N Component3.java
--- Component3.java 29 Nov 2003 13:44:30 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,57 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-import java.util.Arrays;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-
-/**
- * A test component.
- *
- * @author Peter Donald
- * @version $Revision: 1.3 $ $Date: 2003/11/29 13:44:30 $
- * @dna.component
- */
-public class Component3
- implements Serviceable
-{
- /**
- * @dna.dependency type="Service1[]"
- */
- public void service( final ServiceManager manager )
- throws ServiceException
- {
- final Service1[] services =
- (Service1[])manager.lookup( Service1[].class.getName() );
- System.out.println( "Passed the following services: " +
- Arrays.asList( services ) );
- if( 3 != services.length )
- {
- final String message =
- "Expected to get 3 services but got " + services.length;
- throw new ServiceException( Service1[].class.getName(), message );
- }
-
- checkEntry( services, 0 );
- checkEntry( services, 1 );
- checkEntry( services, 2 );
- }
-
- private void checkEntry( final Service1[] services, final int index )
- throws ServiceException
- {
- if( null == services[ index ] )
- {
- final String message = "Expected non null service entry for " +
- index;
- throw new ServiceException( Service1[].class.getName(), message );
- }
- }
-}
</pre></div>
<hr /><a name="file27" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Component2.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Component2.java?rev=1.3&content-type=text/vnd.viewcvs-markup">1.3</a></small></div>
<pre class="diff"><small id="info">diff -N Component2.java
--- Component2.java 29 Nov 2003 13:44:30 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-/**
- * @author Peter Donald
- * @version $Revision: 1.3 $ $Date: 2003/11/29 13:44:30 $
- * @dna.component
- * @dna.service type="Service1"
- */
-public class Component2
- implements Service1
-{
-}
</pre></div>
<hr /><a name="file28" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Listener1.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Listener1.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N Listener1.java
--- Listener1.java 5 Nov 2003 03:42:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-/**
- * @author <a href="mailto:[email protected]">peter royal</a>
- */
-public class Listener1
-{
-}
</pre></div>
<hr /><a name="file29" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/assembler">assembler</a>/<a href="http://xstream.cvs.codehaus.org!
/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data">data</a><br /></span>
<div class="fileheader" id="removed"><big><b>Service1.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/assembler/data/Service1.java?rev=1.2&content-type=text/vnd.viewcvs-markup">1.2</a></small></div>
<pre class="diff"><small id="info">diff -N Service1.java
--- Service1.java 29 Nov 2003 13:44:30 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,18 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.assembler.data;
-
-/**
- * A test service.
- *
- * @author Peter Donald
- * @version $Revision: 1.2 $ $Date: 2003/11/29 13:44:30 $
- */
-public interface Service1
-{
-}
</pre></div>
<hr /><a name="file30" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="added"><big><b>AssemblerTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/AssemblerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N AssemblerTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AssemblerTestCase.java 19 Apr 2004 22:24:08 -0000 1.1
@@ -0,0 +1,357 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.assembler;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+import org.codehaus.dna.Configuration;
+import org.codehaus.dna.ConfigurationException;
+import org.codehaus.dna.impl.ConsoleLogger;
+import org.codehaus.dna.impl.DefaultConfiguration;
+import org.codehaus.loom.components.assembler.Assembler;
+import org.codehaus.loom.components.assembler.data.Component1;
+import org.codehaus.loom.components.assembler.data.Component2;
+import org.codehaus.loom.components.assembler.data.Component3;
+import org.codehaus.loom.components.assembler.data.Listener1;
+import org.codehaus.loom.components.assembler.data.Service1;
+import org.codehaus.loom.components.deployer.PhoenixProfileBuilder;
+import org.codehaus.loom.components.util.ConfigurationBuilder;
+import org.codehaus.loom.components.util.metadata.DependencyDirective;
+import org.codehaus.loom.components.util.profile.ComponentProfile;
+import org.codehaus.loom.components.util.profile.PartitionProfile;
+import org.codehaus.loom.interfaces.ContainerConstants;
+import org.codehaus.loom.interfaces.LoomException;
+import org.xml.sax.InputSource;
+
+/**
+ * An basic test case for the LogManager.
+ *
+ * @author Peter Donald
+ * @author <a href="mailto:[email protected]">Peter Royal</a>
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:08 $
+ */
+public class AssemblerTestCase
+ extends TestCase
+{
+ public void testBasic()
+ throws Exception
+ {
+ final PartitionProfile partitionProfile = assembleSar( "assembly1.xml" );
+ final ComponentProfile[] blocks =
+ partitionProfile.getPartition( ContainerConstants.BLOCK_PARTITION ).
+ getComponents();
+ assertEquals( "Block Count", 2, blocks.length );
+
+ final ComponentProfile block1 = blocks[0];
+ final ComponentProfile block2 = blocks[1];
+ final DependencyDirective[] dependencies1 = block1.getTemplate()
+ .getDependencies();
+ final DependencyDirective[] dependencies2 = block2.getTemplate()
+ .getDependencies();
+
+ assertEquals( "Block1 getImplementationKey",
+ Component1.class.getName(),
+ block1.getTemplate().getImplementationKey() );
+ assertEquals( "Block1 getName", "c1", block1.getTemplate().getName() );
+ assertEquals( "Block1 getDependencies count",
+ 1, dependencies1.length );
+ assertEquals( "Block1 dep1 name",
+ "c2",
+ dependencies1[0].getProviderName() );
+ assertEquals( "Block1 dep1 role",
+ Service1.class.getName(), dependencies1[0].getKey() );
+ assertTrue( "Block1 getBlockInfo non null",
+ null != block1.getInfo() );
+ assertEquals( "Block1 isDisableProxy",
+ false,
+ isProxyDisabled( block1 ) );
+
+ assertEquals( "Block2 getImplementationKey",
+ Component2.class.getName(),
+ block2.getTemplate().getImplementationKey() );
+ assertEquals( "Block2 getName", "c2", block2.getTemplate().getName() );
+ assertEquals( "Block2 getDependencies count",
+ 0, dependencies2.length );
+ assertTrue( "Block2 getBlockInfo non null",
+ null != block2.getInfo() );
+ assertEquals( "Block2 isDisableProxy",
+ true,
+ isProxyDisabled( block2 ) );
+
+ final ComponentProfile[] listeners =
+ partitionProfile.getPartition( ContainerConstants.LISTENER_PARTITION ).
+ getComponents();
+ final ComponentProfile listener = listeners[0];
+
+ assertEquals( "Listener Count", 1, listeners.length );
+ assertEquals( "Listener1 getImplementationKey",
+ Listener1.class.getName(),
+ listener.getTemplate().getImplementationKey() );
+ assertEquals( "Listener1 getName",
+ "l1",
+ listener.getTemplate().getName() );
+ }
+
+ private boolean isProxyDisabled( final ComponentProfile block2 )
+ {
+ return block2.getTemplate().isDisableProxy();
+ }
+
+ public void testComplex()
+ throws Exception
+ {
+ final PartitionProfile partitionProfile = assembleSar( "assembly2.xml" );
+ final ComponentProfile[] blocks =
+ partitionProfile.getPartition( ContainerConstants.BLOCK_PARTITION )
+ .getComponents();
+ assertEquals( "Block Count", 4, blocks.length );
+
+ final ComponentProfile block1 = blocks[0];
+ final ComponentProfile block2 = blocks[1];
+ final ComponentProfile block3 = blocks[2];
+ final ComponentProfile block4 = blocks[3];
+ final DependencyDirective[] dependencies1 = block1.getTemplate()
+ .getDependencies();
+ final DependencyDirective[] dependencies2 = block2.getTemplate()
+ .getDependencies();
+ final DependencyDirective[] dependencies3 = block3.getTemplate()
+ .getDependencies();
+ final DependencyDirective[] dependencies4 = block4.getTemplate()
+ .getDependencies();
+
+ assertEquals( "Block1 getImplementationKey",
+ Component2.class.getName(),
+ block1.getTemplate().getImplementationKey() );
+ assertEquals( "Block1 getName",
+ "c2a",
+ block1.getTemplate().getName() );
+ assertEquals( "Block1 getDependencies count",
+ 0, dependencies1.length );
+ assertTrue( "Block2 getBlockInfo non null",
+ null != block1.getInfo() );
+ assertEquals( "Block1 isDisableProxy",
+ false,
+ isProxyDisabled( block1 ) );
+
+ assertEquals( "Block2 getImplementationKey",
+ Component2.class.getName(),
+ block2.getTemplate().getImplementationKey() );
+ assertEquals( "Block2 getName",
+ "c2b",
+ block2.getTemplate().getName() );
+ assertEquals( "Block2 getDependencies count",
+ 0, dependencies2.length );
+ assertTrue( "Block2 getBlockInfo non null",
+ null != block2.getInfo() );
+ assertEquals( "Block2 isDisableProxy",
+ false,
+ isProxyDisabled( block2 ) );
+
+ assertEquals( "Block3 getImplementationKey",
+ Component2.class.getName(),
+ block3.getTemplate().getImplementationKey() );
+ assertEquals( "Block3 getName",
+ "c2c",
+ block3.getTemplate().getName() );
+ assertEquals( "Block3 getDependencies count",
+ 0, dependencies3.length );
+ assertTrue( "Block3 getBlockInfo non null",
+ null != block3.getInfo() );
+ assertEquals( "Block3 isDisableProxy",
+ false,
+ isProxyDisabled( block3 ) );
+
+ assertEquals( "Block4 getImplementationKey",
+ Component3.class.getName(),
+ block4.getTemplate().getImplementationKey() );
+ assertEquals( "Block4 getName", "c3", block4.getTemplate().getName() );
+ assertEquals( "Block4 getDependencies count",
+ 3, dependencies4.length );
+ final DependencyDirective dependency1 = dependencies4[0];
+ final DependencyDirective dependency2 = dependencies4[1];
+ final DependencyDirective dependency3 = dependencies4[2];
+ assertEquals( "Block4 dep1 name",
+ "c2a",
+ dependency1.getProviderName() );
+ assertEquals( "Block4 dep1 role",
+ Service1.class.getName(), dependency1.getKey() );
+ assertEquals( "Block4 dep1 name",
+ "c2b",
+ dependency2.getProviderName() );
+ assertEquals( "Block4 dep1 role",
+ Service1.class.getName(), dependency2.getKey() );
+ assertEquals( "Block4 dep1 name",
+ "c2c",
+ dependency3.getProviderName() );
+ assertEquals( "Block4 dep1 role",
+ Service1.class.getName(), dependency3.getKey() );
+ assertTrue( "Block4 getBlockInfo non null",
+ null != block4.getInfo() );
+ assertEquals( "Block4 isDisableProxy",
+ false,
+ isProxyDisabled( block4 ) );
+ }
+
+ public void testBuildDependencies()
+ throws Exception
+ {
+ final DefaultConfiguration[] provides = new DefaultConfiguration[2];
+ final String name0 = "Cheese";
+ final String role0 = "market.Cheddar";
+ final String name1 = "Bleu";
+ final String role1 = "market.blue";
+
+ provides[0] = new DefaultConfiguration( "provide", "", "" );
+ provides[0].setAttribute( "name", name0 );
+ provides[0].setAttribute( "role", role0 );
+ provides[1] = new DefaultConfiguration( "provide", "", "" );
+ provides[1].setAttribute( "name", name1 );
+ provides[1].setAttribute( "role", role1 );
+
+ final Assembler assembler = new Assembler();
+ final DependencyDirective[] directives = assembler.buildDependencies( provides );
+
+ assertEquals( provides.length, directives.length );
+ assertEquals( name0, directives[0].getProviderName() );
+ assertEquals( name1, directives[1].getProviderName() );
+ assertEquals( role0, directives[0].getKey() );
+ assertEquals( role1, directives[1].getKey() );
+ }
+
+ public void testBuildDependency()
+ throws Exception
+ {
+ final String name = "Blah";
+ final String alias = name;
+ final String role = "com.biz.Service";
+ final Assembler assembler = new Assembler();
+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
+ provide.setAttribute( "name", name );
+ provide.setAttribute( "role", role );
+ final DependencyDirective directive =
+ assembler.buildDependency( provide );
+ assertEquals( "name", name, directive.getProviderName() );
+ assertEquals( "role", role, directive.getKey() );
+ assertEquals( "alias", alias, directive.getAlias() );
+ }
+
+ public void testBuildDependencyThatSpecifiesAlias()
+ throws Exception
+ {
+ final String name = "Blah";
+ final String alias = "Blee";
+ final String role = "com.biz.Service";
+ final Assembler assembler = new Assembler();
+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
+ provide.setAttribute( "name", name );
+ provide.setAttribute( "role", role );
+ provide.setAttribute( "alias", alias );
+ final DependencyDirective directive =
+ assembler.buildDependency( provide );
+ assertEquals( "name", name, directive.getProviderName() );
+ assertEquals( "role", role, directive.getKey() );
+ assertEquals( "alias", alias, directive.getAlias() );
+ }
+
+ public void testBuildDependencyThatMissesName()
+ throws Exception
+ {
+ final Assembler assembler = new Assembler();
+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
+ provide.setAttribute( "role", "com.biz.Service" );
+ try
+ {
+ assembler.buildDependency( provide );
+ }
+ catch( final ConfigurationException ce )
+ {
+ return;
+ }
+ fail( "Expected ConfigurationException due to missing name" );
+ }
+
+ public void testBuildDependencyThatMissesRole()
+ throws Exception
+ {
+ final Assembler assembler = new Assembler();
+ final DefaultConfiguration provide = new DefaultConfiguration( "provide", "", "" );
+ provide.setAttribute( "name", "MyService" );
+ try
+ {
+ assembler.buildDependency( provide );
+ }
+ catch( final ConfigurationException ce )
+ {
+ return;
+ }
+ fail( "Expected ConfigurationException due to missing role" );
+ }
+
+ protected PartitionProfile assembleSar( final String config )
+ throws Exception
+ {
+ final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
+ final URL resource = getClass().getResource( config );
+ assertNotNull( "Config resource: " + config, resource );
+ final ConsoleLogger logger = new ConsoleLogger();
+ final Configuration assembly =
+ ConfigurationBuilder.build( new InputSource( resource.toExternalForm() ),
+ ConfigurationBuilder.ASSEMBLY_SCHEMA,
+ logger );
+ final Map parameters = new HashMap();
+ parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
+ parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
+ parameters.put( ContainerConstants.CONFIG_DESCRIPTOR,
+ new DefaultConfiguration( "config", "", "" ) );
+ parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
+ getClass().getClassLoader() );
+
+ assembler.enableLogging( logger );
+
+ return assembler.buildProfile( parameters );
+ }
+
+ public void testMalformedBlockListener()
+ throws Exception
+ {
+ final DefaultConfiguration listener = new DefaultConfiguration( "listner", "", "" );
+ final DefaultConfiguration config = new DefaultConfiguration( "config",
+ "",
+ "" );
+ final Assembler assembler = new Assembler();
+
+ try
+ {
+ assembler.buildBlockListener( listener, config );
+ fail( "buildBlockListner allowed no 'name' attribute" );
+ }
+ catch( LoomException e )
+ {
+ assertEquals( "Malformed listener entry in assembly.xml at \"\". " +
+ "(Reason: Attribute named name not specified.).",
+ e.getMessage() );
+ }
+
+ listener.setAttribute( "name", "foo" );
+
+ try
+ {
+ assembler.buildBlockListener( listener, config );
+ fail( "buildBlockListner allowed no 'class' attribute" );
+ }
+ catch( LoomException e )
+ {
+ assertEquals( "Malformed listener entry in assembly.xml at \"\". " +
+ "(Reason: Attribute named class not specified.).",
+ e.getMessage() );
+ }
+ }
+}
</pre></div>
<hr /><a name="file31" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="added"><big><b>assembly2.xml</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/assembly2.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N assembly2.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ assembly2.xml 19 Apr 2004 22:24:08 -0000 1.1
@@ -0,0 +1,26 @@
</small></pre><pre class="diff" id="added">+<?xml version="1.0"?>
+<!DOCTYPE assembly PUBLIC "-//PHOENIX/Assembly DTD Version 1.0//EN"
+ "http://jcontainer.codehaus.org/loom/assembly_1.0.dtd">
+
+<assembly>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component2"
+ name="c2a"/>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component2"
+ name="c2b"/>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component2"
+ name="c2c"/>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component3"
+ name="c3">
+ <provide name="c2a"
+ role="org.codehaus.loom.components.assembler.data.Service1"/>
+ <provide name="c2b"
+ role="org.codehaus.loom.components.assembler.data.Service1"/>
+ <provide name="c2c"
+ role="org.codehaus.loom.components.assembler.data.Service1"/>
+ </block>
+
+</assembly>
</pre></div>
<hr /><a name="file32" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/assembler">assembler</a><br /></span>
<div class="fileheader" id="added"><big><b>assembly1.xml</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/assembler/assembly1.xml?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N assembly1.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ assembly1.xml 19 Apr 2004 22:24:08 -0000 1.1
@@ -0,0 +1,20 @@
</small></pre><pre class="diff" id="added">+<?xml version="1.0"?>
+<!DOCTYPE assembly PUBLIC "-//LOOM/Assembly DTD Version 1.0//EN"
+ "http://jcontainer.codehaus.org/loom/assembly_1.0.dtd">
+
+<assembly>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component1"
+ name="c1">
+ <provide name="c2"
+ role="org.codehaus.loom.components.assembler.data.Service1"/>
+ </block>
+
+ <block class="org.codehaus.loom.components.assembler.data.Component2"
+ name="c2">
+ <proxy disable="true"/>
+ </block>
+
+ <listener class="org.codehaus.loom.components.assembler.data.Listener1"
+ name="l1"/>
+</assembly>
</pre></div>
<hr /><a name="file33" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/application">application</a><br /></span>
<div class="fileheader" id="removed"><big><b>ApplicationTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/application/ApplicationTestCase.java?rev=1.19&content-type=text/vnd.viewcvs-markup">1.19</a></small></div>
<pre class="diff"><small id="info">diff -N ApplicationTestCase.java
--- ApplicationTestCase.java 18 Apr 2004 23:09:52 -0000 1.19
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,355 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.application;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import junit.framework.TestCase;
-import org.codehaus.dna.Configuration;
-import org.codehaus.dna.impl.ConsoleLogger;
-import org.codehaus.dna.impl.DefaultConfiguration;
-import org.jcontainer.loom.components.assembler.data.Component1;
-import org.jcontainer.loom.components.assembler.data.Component2;
-import org.jcontainer.loom.components.assembler.data.Component3;
-import org.jcontainer.loom.components.assembler.data.Component4;
-import org.jcontainer.loom.components.assembler.data.Service1;
-import org.jcontainer.loom.components.deployer.PhoenixProfileBuilder;
-import org.jcontainer.loom.components.util.ConfigurationBuilder;
-import org.jcontainer.loom.components.util.info.ComponentInfo;
-import org.jcontainer.loom.components.util.info.DependencyDescriptor;
-import org.jcontainer.loom.components.util.info.ServiceDescriptor;
-import org.jcontainer.loom.components.util.metadata.ComponentTemplate;
-import org.jcontainer.loom.components.util.metadata.DependencyDirective;
-import org.jcontainer.loom.components.util.metadata.PartitionTemplate;
-import org.jcontainer.loom.components.util.profile.ComponentProfile;
-import org.jcontainer.loom.components.util.profile.PartitionProfile;
-import org.jcontainer.loom.interfaces.ContainerConstants;
-import org.xml.sax.InputSource;
-
-/**
- * An basic test case for the Application.
- *
- * @author Peter Donald
- * @version $Revision: 1.19 $ $Date: 2004/04/18 23:09:52 $
- */
-public class ApplicationTestCase
- extends TestCase
-{
- private static final Class S1_TYPE = Service1.class;
- private static final Class C1_TYPE = Component1.class;
- private static final Class C2_TYPE = Component2.class;
- private static final Class C3_TYPE = Component3.class;
- private static final Class C4_TYPE = Component4.class;
-
- private static final String S1_NAME = S1_TYPE.getName();
- private static final String C1_NAME = C1_TYPE.getName();
- private static final String C2_NAME = C2_TYPE.getName();
- private static final String C3_NAME = C3_TYPE.getName();
- private static final String C4_NAME = C4_TYPE.getName();
-
- private static final String S1_ARRAY_NAME = S1_NAME +
- DependencyDescriptor.ARRAY_POSTFIX;
- private static final String S1_MAP_NAME = S1_NAME +
- DependencyDescriptor.MAP_POSTFIX;
-
- private static final ComponentInfo C1 =
- new ComponentInfo( C1_TYPE,
- ServiceDescriptor.EMPTY_SET,
- new DependencyDescriptor[]{
- new DependencyDescriptor( S1_NAME,
- S1_NAME,
- false )},
- null );
-
- private static final ComponentInfo C2 =
- new ComponentInfo( C2_TYPE,
- new ServiceDescriptor[]{
- new ServiceDescriptor( S1_NAME )},
- DependencyDescriptor.EMPTY_SET,
- null );
-
- private static final ComponentInfo C3 =
- new ComponentInfo( C3_TYPE,
- ServiceDescriptor.EMPTY_SET,
- new DependencyDescriptor[]{
- new DependencyDescriptor( S1_ARRAY_NAME,
- S1_ARRAY_NAME,
- false )},
- null );
-
- private static final ComponentInfo C4 =
- new ComponentInfo( C4_TYPE,
- ServiceDescriptor.EMPTY_SET,
- new DependencyDescriptor[]{
- new DependencyDescriptor( S1_MAP_NAME,
- S1_MAP_NAME,
- false )},
- null );
-
- public void testBasic()
- throws Exception
- {
- final ComponentTemplate md1 =
- new ComponentTemplate( "c1",
- C1_NAME,
- new DependencyDirective[]{
- new DependencyDirective( S1_NAME,
- "c2",
- "c2" )},
- null,
- null,
- false );
- final ComponentProfile cp1 = new ComponentProfile( C1, md1 );
- final ComponentTemplate md2 =
- new ComponentTemplate( "c2",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- true );
- final ComponentProfile cp2 = new ComponentProfile( C2, md2 );
- final PartitionTemplate blockPartitionMD =
- new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
- new String[]{
- ContainerConstants.LISTENER_PARTITION},
- PartitionTemplate.EMPTY_SET,
- new ComponentTemplate[]{md1, md2} );
- final PartitionTemplate listenerPartitionMD =
- new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
- new String[ 0 ],
- PartitionTemplate.EMPTY_SET,
- ComponentTemplate.EMPTY_SET );
- final PartitionTemplate partitionMD =
- new PartitionTemplate( "test",
- new String[ 0 ],
- new PartitionTemplate[]{blockPartitionMD,
- listenerPartitionMD},
- ComponentTemplate.EMPTY_SET );
-
- final PartitionProfile blockPartitionProfile =
- new PartitionProfile( blockPartitionMD,
- PartitionProfile.EMPTY_SET,
- new ComponentProfile[]{cp1, cp2} );
- final PartitionProfile listenerPartitionProfile =
- new PartitionProfile( listenerPartitionMD,
- PartitionProfile.EMPTY_SET,
- ComponentProfile.EMPTY_SET );
- final PartitionProfile partitionProfile =
- new PartitionProfile( partitionMD,
- new PartitionProfile[]{blockPartitionProfile,
- listenerPartitionProfile},
- ComponentProfile.EMPTY_SET );
- runApplicationTest( partitionProfile );
- }
-
- public void testArrayAssembly()
- throws Exception
- {
- final DependencyDirective[] c3Deps =
- new DependencyDirective[]{new DependencyDirective( S1_ARRAY_NAME,
- "c2a",
- "c2a" ),
- new DependencyDirective( S1_ARRAY_NAME,
- "c2b",
- "c2b" ),
- new DependencyDirective( S1_ARRAY_NAME,
- "c2c",
- "c2c" )};
- final ComponentTemplate md3 =
- new ComponentTemplate( "c3",
- C3_NAME,
- c3Deps,
- null,
- null,
- false );
- final ComponentProfile cp3 = new ComponentProfile( C3, md3 );
- final ComponentTemplate md2a =
- new ComponentTemplate( "c2a",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2a = new ComponentProfile( C2, md2a );
- final ComponentTemplate md2b =
- new ComponentTemplate( "c2b",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2b = new ComponentProfile( C2, md2b );
- final ComponentTemplate md2c =
- new ComponentTemplate( "c2c",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2c = new ComponentProfile( C2, md2c );
-
- final PartitionTemplate blockPartitionMD =
- new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
- new String[]{
- ContainerConstants.LISTENER_PARTITION},
- PartitionTemplate.EMPTY_SET,
- new ComponentTemplate[]{md3,
- md2a,
- md2b,
- md2c} );
- final PartitionTemplate listenerPartitionMD =
- new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
- new String[ 0 ],
- PartitionTemplate.EMPTY_SET,
- ComponentTemplate.EMPTY_SET );
- final PartitionTemplate partitionMD =
- new PartitionTemplate( "test",
- new String[ 0 ],
- new PartitionTemplate[]{blockPartitionMD,
- listenerPartitionMD},
- ComponentTemplate.EMPTY_SET );
-
- final PartitionProfile blockPartitionProfile =
- new PartitionProfile( blockPartitionMD,
- PartitionProfile.EMPTY_SET,
- new ComponentProfile[]{cp3,
- cp2a,
- cp2b,
- cp2c} );
- final PartitionProfile listenerPartitionProfile =
- new PartitionProfile( listenerPartitionMD,
- PartitionProfile.EMPTY_SET,
- ComponentProfile.EMPTY_SET );
- final PartitionProfile partitionProfile =
- new PartitionProfile( partitionMD,
- new PartitionProfile[]{blockPartitionProfile,
- listenerPartitionProfile},
- ComponentProfile.EMPTY_SET );
- runApplicationTest( partitionProfile );
- }
-
- public void testMapAssembly()
- throws Exception
- {
- final DependencyDirective[] c4Deps =
- new DependencyDirective[]{new DependencyDirective( S1_MAP_NAME,
- "c2a",
- "c2a" ),
- new DependencyDirective( S1_MAP_NAME,
- "c2b",
- "c2b" ),
- new DependencyDirective( S1_MAP_NAME,
- "c2c",
- "anAlias" )};
- final ComponentTemplate md4 =
- new ComponentTemplate( "c4",
- C4_NAME,
- c4Deps,
- null,
- null,
- false );
- final ComponentProfile cp4 = new ComponentProfile( C4, md4 );
- final ComponentTemplate md2a =
- new ComponentTemplate( "c2a",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2a = new ComponentProfile( C2, md2a );
- final ComponentTemplate md2b =
- new ComponentTemplate( "c2b",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2b = new ComponentProfile( C2, md2b );
- final ComponentTemplate md2c =
- new ComponentTemplate( "c2c",
- C2_NAME,
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentProfile cp2c = new ComponentProfile( C2, md2c );
-
- final PartitionTemplate blockPartitionMD =
- new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
- new String[]{
- ContainerConstants.LISTENER_PARTITION},
- PartitionTemplate.EMPTY_SET,
- new ComponentTemplate[]{md4,
- md2a,
- md2b,
- md2c} );
- final PartitionTemplate listenerPartitionMD =
- new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
- new String[ 0 ],
- PartitionTemplate.EMPTY_SET,
- ComponentTemplate.EMPTY_SET );
- final PartitionTemplate partitionMD =
- new PartitionTemplate( "test",
- new String[ 0 ],
- new PartitionTemplate[]{blockPartitionMD,
- listenerPartitionMD},
- ComponentTemplate.EMPTY_SET );
-
- final PartitionProfile blockPartitionProfile =
- new PartitionProfile( blockPartitionMD,
- PartitionProfile.EMPTY_SET,
- new ComponentProfile[]{cp4,
- cp2a,
- cp2b,
- cp2c} );
- final PartitionProfile listenerPartitionProfile =
- new PartitionProfile( listenerPartitionMD,
- PartitionProfile.EMPTY_SET,
- ComponentProfile.EMPTY_SET );
- final PartitionProfile partitionProfile =
- new PartitionProfile( partitionMD,
- new PartitionProfile[]{blockPartitionProfile,
- listenerPartitionProfile},
- ComponentProfile.EMPTY_SET );
- runApplicationTest( partitionProfile );
- }
-
- private void runApplicationTest( final PartitionProfile sarMetaData )
- throws Exception
- {
- final DefaultApplication application = new DefaultApplication();
- application.enableLogging( new ConsoleLogger() );
- final MockApplicationContext context =
- new MockApplicationContext( sarMetaData, new ConsoleLogger() );
- application.setApplicationContext( context );
- application.initialize();
- application.dispose();
- }
-
- protected PartitionProfile assembleSar( final String config )
- throws Exception
- {
- final PhoenixProfileBuilder assembler = new PhoenixProfileBuilder();
- final URL resource = getClass().getResource( config );
- assertNotNull( "Config resource: " + config, resource );
- final Configuration assembly =
- ConfigurationBuilder.build(
- new InputSource( resource.toExternalForm() ),
- ConfigurationBuilder.ASSEMBLY_SCHEMA,
- new ConsoleLogger() );
- final Map parameters = new HashMap();
- parameters.put( ContainerConstants.ASSEMBLY_NAME, "test" );
- parameters.put( ContainerConstants.ASSEMBLY_DESCRIPTOR, assembly );
- parameters.put( ContainerConstants.CONFIG_DESCRIPTOR,
- new DefaultConfiguration( "config", "", "" ) );
- parameters.put( ContainerConstants.ASSEMBLY_CLASSLOADER,
- getClass().getClassLoader() );
- return assembler.buildProfile( parameters );
- }
-}
</pre></div>
<hr /><a name="file34" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/application">application</a><br /></span>
<div class="fileheader" id="removed"><big><b>MockApplicationContext.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/application/MockApplicationContext.java?rev=1.11&content-type=text/vnd.viewcvs-markup">1.11</a></small></div>
<pre class="diff"><small id="info">diff -N MockApplicationContext.java
--- MockApplicationContext.java 18 Apr 2004 23:09:52 -0000 1.11
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,87 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.application;
-
-import java.io.File;
-import java.io.InputStream;
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.excalibur.instrument.InstrumentManager;
-import org.codehaus.spice.alchemist.LoggerAlchemist;
-import org.jcontainer.loom.components.instrument.NoopInstrumentManager;
-import org.jcontainer.loom.components.util.profile.PartitionProfile;
-import org.jcontainer.loom.interfaces.ApplicationContext;
-
-/**
- * @author Peter Donald
- * @version $Revision: 1.11 $ $Date: 2004/04/18 23:09:52 $
- */
-class MockApplicationContext
- implements ApplicationContext
-{
- private final PartitionProfile m_sarMetaData;
- private final org.codehaus.dna.Logger m_logger;
-
- public MockApplicationContext( final PartitionProfile sarMetaData,
- final org.codehaus.dna.Logger logger )
- {
- m_sarMetaData = sarMetaData;
- m_logger = logger;
- }
-
- public PartitionProfile getPartitionProfile()
- {
- return m_sarMetaData;
- }
-
- public void requestShutdown()
- {
- //ignore
- }
-
- public void exportObject( String name, Object object )
- throws Exception
- {
- //ignore
- }
-
- public void unexportObject( String name )
- throws Exception
- {
- //ignore
- }
-
- public ClassLoader getClassLoader()
- {
- return getClass().getClassLoader();
- }
-
- public InputStream getResourceAsStream( final String name )
- {
- return getClass().getClassLoader().getResourceAsStream( name );
- }
-
- public File getHomeDirectory()
- {
- return new File( "." );
- }
-
- public Logger getLogger( String name )
- {
- return LoggerAlchemist.toAvalonLogger( m_logger );
- }
-
- public InstrumentManager getInstrumentManager()
- {
- return new NoopInstrumentManager();
- }
-
- public String getInstrumentableName( String component )
- {
- return component;
- }
-}
</pre></div>
<hr /><a name="file35" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engin!
e/src/test/org/codehaus/loom/components/util/verifier">verifier</a><br /></span>
<div class="fileheader" id="added"><big><b>VerifierTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/util/verifier/VerifierTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N VerifierTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ VerifierTestCase.java 19 Apr 2004 22:24:08 -0000 1.1
@@ -0,0 +1,233 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The JContainer Group. All rights reserved.
+ *
+ * This software is published under the terms of the JContainer
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.loom.components.util.verifier;
+
+import junit.framework.TestCase;
+import org.codehaus.dna.impl.ConsoleLogger;
+import org.codehaus.loom.components.assembler.data.Component1;
+import org.codehaus.loom.components.assembler.data.Component2;
+import org.codehaus.loom.components.assembler.data.Component3;
+import org.codehaus.loom.components.assembler.data.Service1;
+import org.codehaus.loom.components.util.info.ComponentInfo;
+import org.codehaus.loom.components.util.info.DependencyDescriptor;
+import org.codehaus.loom.components.util.info.ServiceDescriptor;
+import org.codehaus.loom.components.util.metadata.ComponentTemplate;
+import org.codehaus.loom.components.util.metadata.DependencyDirective;
+import org.codehaus.loom.components.util.metadata.PartitionTemplate;
+import org.codehaus.loom.components.util.profile.ComponentProfile;
+import org.codehaus.loom.components.util.profile.PartitionProfile;
+import org.codehaus.loom.components.util.verifier.SarVerifier;
+import org.codehaus.loom.interfaces.ContainerConstants;
+
+/**
+ * An basic test case for the LogManager.
+ *
+ * @author Peter Donald
+ * @version $Revision: 1.1 $ $Date: 2004/04/19 22:24:08 $
+ */
+public class VerifierTestCase
+ extends TestCase
+{
+ public void testBasic()
+ throws Exception
+ {
+ final DependencyDirective dependency =
+ new DependencyDirective( Service1.class.getName(),
+ "c2",
+ Service1.class.getName() );
+ final ComponentTemplate c1MetaData =
+ new ComponentTemplate( "c1",
+ Component1.class.getName(),
+ new DependencyDirective[]{dependency},
+ null,
+ null,
+ false );
+ final ComponentTemplate c2MetaData =
+ new ComponentTemplate( "c2",
+ Component2.class.getName(),
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final PartitionTemplate listenerMetaData =
+ new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
+ new String[ 0 ],
+ PartitionTemplate.EMPTY_SET,
+ ComponentTemplate.EMPTY_SET );
+ final PartitionTemplate blockMetaData =
+ new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
+ new String[]{
+ ContainerConstants.LISTENER_PARTITION},
+ PartitionTemplate.EMPTY_SET,
+ new ComponentTemplate[]{c1MetaData,
+ c2MetaData} );
+ final PartitionTemplate metaData =
+ new PartitionTemplate( "assembly1",
+ new String[ 0 ],
+ new PartitionTemplate[]{blockMetaData,
+ listenerMetaData},
+ ComponentTemplate.EMPTY_SET );
+ final ComponentInfo c1Info =
+ new ComponentInfo( Component1.class,
+ ServiceDescriptor.EMPTY_SET,
+ new DependencyDescriptor[]{
+ new DependencyDescriptor(
+ Service1.class.getName(),
+ Service1.class.getName(),
+ false )},
+ null );
+ final ComponentInfo c2Info =
+ new ComponentInfo( Component2.class,
+ new ServiceDescriptor[]{
+ new ServiceDescriptor(
+ Service1.class.getName() )},
+ DependencyDescriptor.EMPTY_SET,
+ null );
+ final ComponentProfile c1Profile =
+ new ComponentProfile( c1Info, c1MetaData );
+ final ComponentProfile c2Profile =
+ new ComponentProfile( c2Info, c2MetaData );
+ final PartitionProfile blockProfile =
+ new PartitionProfile( blockMetaData,
+ PartitionProfile.EMPTY_SET,
+ new ComponentProfile[]{c1Profile, c2Profile} );
+ final PartitionProfile listenerProfile =
+ new PartitionProfile( listenerMetaData,
+ PartitionProfile.EMPTY_SET,
+ ComponentProfile.EMPTY_SET );
+ final PartitionProfile profile =
+ new PartitionProfile( metaData,
+ new PartitionProfile[]{blockProfile,
+ listenerProfile},
+ ComponentProfile.EMPTY_SET );
+ verify( profile );
+ }
+
+ public void testComplex()
+ throws Exception
+ {
+ final DependencyDirective dependency1 =
+ new DependencyDirective(
+ Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
+ "c2a",
+ Service1.class.getName() );
+ final DependencyDirective dependency2 =
+ new DependencyDirective(
+ Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
+ "c2b",
+ Service1.class.getName() );
+ final DependencyDirective dependency3 =
+ new DependencyDirective(
+ Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
+ "c2c",
+ Service1.class.getName() );
+ final ComponentTemplate c3MetaData =
+ new ComponentTemplate( "c3",
+ Component3.class.getName(),
+ new DependencyDirective[]{dependency1,
+ dependency2,
+ dependency3},
+ null,
+ null,
+ false );
+ final ComponentTemplate c2aMetaData =
+ new ComponentTemplate( "c2a",
+ Component2.class.getName(),
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentTemplate c2bMetaData =
+ new ComponentTemplate( "c2b",
+ Component2.class.getName(),
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final ComponentTemplate c2cMetaData =
+ new ComponentTemplate( "c2c",
+ Component2.class.getName(),
+ DependencyDirective.EMPTY_SET,
+ null,
+ null,
+ false );
+ final PartitionTemplate listenerMetaData =
+ new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
+ new String[ 0 ],
+ PartitionTemplate.EMPTY_SET,
+ ComponentTemplate.EMPTY_SET );
+ final PartitionTemplate blockMetaData =
+ new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
+ new String[]{
+ ContainerConstants.LISTENER_PARTITION},
+ PartitionTemplate.EMPTY_SET,
+ new ComponentTemplate[]{c2aMetaData,
+ c2bMetaData,
+ c2cMetaData,
+ c3MetaData} );
+ final PartitionTemplate metaData =
+ new PartitionTemplate( "assembly1",
+ new String[ 0 ],
+ new PartitionTemplate[]{blockMetaData,
+ listenerMetaData},
+ ComponentTemplate.EMPTY_SET );
+
+ final ComponentInfo c3Info =
+ new ComponentInfo( Component3.class,
+ ServiceDescriptor.EMPTY_SET,
+ new DependencyDescriptor[]{
+ new DependencyDescriptor(
+ Service1.class.getName() +
+ DependencyDescriptor.ARRAY_POSTFIX,
+ Service1.class.getName() +
+ DependencyDescriptor.ARRAY_POSTFIX,
+ false )},
+ null );
+ final ComponentInfo c2Info =
+ new ComponentInfo( Component2.class,
+ new ServiceDescriptor[]{
+ new ServiceDescriptor(
+ Service1.class.getName() )},
+ DependencyDescriptor.EMPTY_SET,
+ null );
+ final ComponentProfile c3Profile =
+ new ComponentProfile( c3Info, c3MetaData );
+ final ComponentProfile c2aProfile =
+ new ComponentProfile( c2Info, c2aMetaData );
+ final ComponentProfile c2bProfile =
+ new ComponentProfile( c2Info, c2bMetaData );
+ final ComponentProfile c2cProfile =
+ new ComponentProfile( c2Info, c2cMetaData );
+ final PartitionProfile blockProfile =
+ new PartitionProfile( blockMetaData,
+ PartitionProfile.EMPTY_SET,
+ new ComponentProfile[]{c3Profile,
+ c2aProfile,
+ c2bProfile,
+ c2cProfile} );
+ final PartitionProfile listenerProfile =
+ new PartitionProfile( listenerMetaData,
+ PartitionProfile.EMPTY_SET,
+ ComponentProfile.EMPTY_SET );
+ final PartitionProfile profile =
+ new PartitionProfile( metaData,
+ new PartitionProfile[]{blockProfile,
+ listenerProfile},
+ ComponentProfile.EMPTY_SET );
+ verify( profile );
+ }
+
+ private void verify( final PartitionProfile profile )
+ throws Exception
+ {
+ final ClassLoader classLoader = getClass().getClassLoader();
+ final SarVerifier verifier = new SarVerifier();
+ verifier.enableLogging( new ConsoleLogger() );
+ verifier.verifySar( profile, classLoader );
+ }
+}
</pre></div>
<hr /><a name="file36" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/util">util</a>/<a href="http://xstream.cvs.codehaus.org/jcontaine!
r/loom/engine/src/test/org/jcontainer/loom/components/util/verifier">verifier</a><br /></span>
<div class="fileheader" id="removed"><big><b>VerifierTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/util/verifier/VerifierTestCase.java?rev=1.4&content-type=text/vnd.viewcvs-markup">1.4</a></small></div>
<pre class="diff"><small id="info">diff -N VerifierTestCase.java
--- VerifierTestCase.java 18 Apr 2004 23:09:52 -0000 1.4
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,232 +0,0 @@
</small></pre><pre class="diff" id="removed">-/*
- * Copyright (C) The JContainer Group. All rights reserved.
- *
- * This software is published under the terms of the JContainer
- * Software License version 1.1, a copy of which has been included
- * with this distribution in the LICENSE.txt file.
- */
-package org.jcontainer.loom.components.util.verifier;
-
-import junit.framework.TestCase;
-import org.codehaus.dna.impl.ConsoleLogger;
-import org.jcontainer.loom.components.assembler.data.Component1;
-import org.jcontainer.loom.components.assembler.data.Component2;
-import org.jcontainer.loom.components.assembler.data.Component3;
-import org.jcontainer.loom.components.assembler.data.Service1;
-import org.jcontainer.loom.components.util.info.ComponentInfo;
-import org.jcontainer.loom.components.util.info.DependencyDescriptor;
-import org.jcontainer.loom.components.util.info.ServiceDescriptor;
-import org.jcontainer.loom.components.util.metadata.ComponentTemplate;
-import org.jcontainer.loom.components.util.metadata.DependencyDirective;
-import org.jcontainer.loom.components.util.metadata.PartitionTemplate;
-import org.jcontainer.loom.components.util.profile.ComponentProfile;
-import org.jcontainer.loom.components.util.profile.PartitionProfile;
-import org.jcontainer.loom.interfaces.ContainerConstants;
-
-/**
- * An basic test case for the LogManager.
- *
- * @author Peter Donald
- * @version $Revision: 1.4 $ $Date: 2004/04/18 23:09:52 $
- */
-public class VerifierTestCase
- extends TestCase
-{
- public void testBasic()
- throws Exception
- {
- final DependencyDirective dependency =
- new DependencyDirective( Service1.class.getName(),
- "c2",
- Service1.class.getName() );
- final ComponentTemplate c1MetaData =
- new ComponentTemplate( "c1",
- Component1.class.getName(),
- new DependencyDirective[]{dependency},
- null,
- null,
- false );
- final ComponentTemplate c2MetaData =
- new ComponentTemplate( "c2",
- Component2.class.getName(),
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final PartitionTemplate listenerMetaData =
- new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
- new String[ 0 ],
- PartitionTemplate.EMPTY_SET,
- ComponentTemplate.EMPTY_SET );
- final PartitionTemplate blockMetaData =
- new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
- new String[]{
- ContainerConstants.LISTENER_PARTITION},
- PartitionTemplate.EMPTY_SET,
- new ComponentTemplate[]{c1MetaData,
- c2MetaData} );
- final PartitionTemplate metaData =
- new PartitionTemplate( "assembly1",
- new String[ 0 ],
- new PartitionTemplate[]{blockMetaData,
- listenerMetaData},
- ComponentTemplate.EMPTY_SET );
- final ComponentInfo c1Info =
- new ComponentInfo( Component1.class,
- ServiceDescriptor.EMPTY_SET,
- new DependencyDescriptor[]{
- new DependencyDescriptor(
- Service1.class.getName(),
- Service1.class.getName(),
- false )},
- null );
- final ComponentInfo c2Info =
- new ComponentInfo( Component2.class,
- new ServiceDescriptor[]{
- new ServiceDescriptor(
- Service1.class.getName() )},
- DependencyDescriptor.EMPTY_SET,
- null );
- final ComponentProfile c1Profile =
- new ComponentProfile( c1Info, c1MetaData );
- final ComponentProfile c2Profile =
- new ComponentProfile( c2Info, c2MetaData );
- final PartitionProfile blockProfile =
- new PartitionProfile( blockMetaData,
- PartitionProfile.EMPTY_SET,
- new ComponentProfile[]{c1Profile, c2Profile} );
- final PartitionProfile listenerProfile =
- new PartitionProfile( listenerMetaData,
- PartitionProfile.EMPTY_SET,
- ComponentProfile.EMPTY_SET );
- final PartitionProfile profile =
- new PartitionProfile( metaData,
- new PartitionProfile[]{blockProfile,
- listenerProfile},
- ComponentProfile.EMPTY_SET );
- verify( profile );
- }
-
- public void testComplex()
- throws Exception
- {
- final DependencyDirective dependency1 =
- new DependencyDirective(
- Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
- "c2a",
- Service1.class.getName() );
- final DependencyDirective dependency2 =
- new DependencyDirective(
- Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
- "c2b",
- Service1.class.getName() );
- final DependencyDirective dependency3 =
- new DependencyDirective(
- Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
- "c2c",
- Service1.class.getName() );
- final ComponentTemplate c3MetaData =
- new ComponentTemplate( "c3",
- Component3.class.getName(),
- new DependencyDirective[]{dependency1,
- dependency2,
- dependency3},
- null,
- null,
- false );
- final ComponentTemplate c2aMetaData =
- new ComponentTemplate( "c2a",
- Component2.class.getName(),
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentTemplate c2bMetaData =
- new ComponentTemplate( "c2b",
- Component2.class.getName(),
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final ComponentTemplate c2cMetaData =
- new ComponentTemplate( "c2c",
- Component2.class.getName(),
- DependencyDirective.EMPTY_SET,
- null,
- null,
- false );
- final PartitionTemplate listenerMetaData =
- new PartitionTemplate( ContainerConstants.LISTENER_PARTITION,
- new String[ 0 ],
- PartitionTemplate.EMPTY_SET,
- ComponentTemplate.EMPTY_SET );
- final PartitionTemplate blockMetaData =
- new PartitionTemplate( ContainerConstants.BLOCK_PARTITION,
- new String[]{
- ContainerConstants.LISTENER_PARTITION},
- PartitionTemplate.EMPTY_SET,
- new ComponentTemplate[]{c2aMetaData,
- c2bMetaData,
- c2cMetaData,
- c3MetaData} );
- final PartitionTemplate metaData =
- new PartitionTemplate( "assembly1",
- new String[ 0 ],
- new PartitionTemplate[]{blockMetaData,
- listenerMetaData},
- ComponentTemplate.EMPTY_SET );
-
- final ComponentInfo c3Info =
- new ComponentInfo( Component3.class,
- ServiceDescriptor.EMPTY_SET,
- new DependencyDescriptor[]{
- new DependencyDescriptor(
- Service1.class.getName() +
- DependencyDescriptor.ARRAY_POSTFIX,
- Service1.class.getName() +
- DependencyDescriptor.ARRAY_POSTFIX,
- false )},
- null );
- final ComponentInfo c2Info =
- new ComponentInfo( Component2.class,
- new ServiceDescriptor[]{
- new ServiceDescriptor(
- Service1.class.getName() )},
- DependencyDescriptor.EMPTY_SET,
- null );
- final ComponentProfile c3Profile =
- new ComponentProfile( c3Info, c3MetaData );
- final ComponentProfile c2aProfile =
- new ComponentProfile( c2Info, c2aMetaData );
- final ComponentProfile c2bProfile =
- new ComponentProfile( c2Info, c2bMetaData );
- final ComponentProfile c2cProfile =
- new ComponentProfile( c2Info, c2cMetaData );
- final PartitionProfile blockProfile =
- new PartitionProfile( blockMetaData,
- PartitionProfile.EMPTY_SET,
- new ComponentProfile[]{c3Profile,
- c2aProfile,
- c2bProfile,
- c2cProfile} );
- final PartitionProfile listenerProfile =
- new PartitionProfile( listenerMetaData,
- PartitionProfile.EMPTY_SET,
- ComponentProfile.EMPTY_SET );
- final PartitionProfile profile =
- new PartitionProfile( metaData,
- new PartitionProfile[]{blockProfile,
- listenerProfile},
- ComponentProfile.EMPTY_SET );
- verify( profile );
- }
-
- private void verify( final PartitionProfile profile )
- throws Exception
- {
- final ClassLoader classLoader = getClass().getClassLoader();
- final SarVerifier verifier = new SarVerifier();
- verifier.enableLogging( new ConsoleLogger() );
- verifier.verifySar( profile, classLoader );
- }
-}
</pre></div>
<hr /><a name="file37" /><div class="file">
<span class="pathname" id="added"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus">codehaus</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom
/components/configuration">configuration</a>/<a href="http://xstream.cvs.codehaus.org/jco!
ntainer/loom/engine/src/test/org/codehaus/loom/components/configuration/merger">merger</a><br /></span>
<div class="fileheader" id="added"><big><b>ConfigurationMergerTestCase.java</b></big> <small id="info">added at <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/codehaus/loom/components/configuration/merger/ConfigurationMergerTestCase.java?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N ConfigurationMergerTestCase.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ConfigurationMergerTestCase.java 19 Apr 2004 22:24:08 -0000 1.1
@@ -0,0 +1,191 @@
</small></pre><pre class="diff" id="added">+/* ====================================================================
+ * JContainer Software License, version 1.1
+ *
+ * Copyright (c) 2003, JContainer Group. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of the JContainer Group nor the name "Loom" nor
+ * the names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ * JContainer Loom includes code from the Apache Software Foundation
+ *
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software
+ * itself, if and wherever such third-party acknowledgments
+ * normally appear.
+ *
+ * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
+ * must not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [email protected]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+package org.codehaus.loom.components.configuration.merger;
+
+import junit.framework.TestCase;
+import org.codehaus.dna.impl.ConfigurationUtil;
+import org.codehaus.dna.impl.DefaultConfiguration;
+import org.codehaus.loom.components.configuration.merger.ConfigurationMerger;
+import org.codehaus.loom.components.configuration.merger.ConfigurationSplitter;
+
+/**
+ * @author Peter Royal
+ */
+public class ConfigurationMergerTestCase
+ extends TestCase
+{
+ public void testAttributeOnlyMerge()
+ throws Exception
+ {
+ final DefaultConfiguration result = new DefaultConfiguration( "a", "",
+ "" );
+ result.setAttribute( "a", "1" );
+
+ final DefaultConfiguration base = new DefaultConfiguration( "a", "",
+ "" );
+ base.setAttribute( "a", "2" );
+
+ final DefaultConfiguration layer =
+ new DefaultConfiguration( "a", "", "" );
+ layer.setAttribute( "a", "1" );
+
+ assertTrue(
+ ConfigurationUtil.equals( result,
+ ConfigurationMerger.merge( layer, base ) ) );
+ assertTrue( ConfigurationUtil.equals( layer,
+ ConfigurationSplitter.split(
+ result,
+ base ) ) );
+ }
+
+ public void testAddChild()
+ throws Exception
+ {
+ final DefaultConfiguration result =
+ new DefaultConfiguration( "a", "", "" );
+ result.addChild( new DefaultConfiguration( "kid1", "", "" ) );
+ result.addChild( new DefaultConfiguration( "kid2", "", "" ) );
+
+ final DefaultConfiguration base =
+ new DefaultConfiguration( "a", "", "" );
+ base.addChild( new DefaultConfiguration( "kid1", "", "" ) );
+
+ final DefaultConfiguration layer = new DefaultConfiguration( "a", "",
+ "" );
+ layer.addChild( new DefaultConfiguration( "kid2", "", "" ) );
+ assertTrue(
+ ConfigurationUtil.equals( result,
+ ConfigurationMerger.merge( layer, base ) ) );
+ assertTrue( ConfigurationUtil.equals( layer,
+ ConfigurationSplitter.split(
+ result,
+ base ) ) );
+ }
+
+ public void testOverrideChild()
+ throws Exception
+ {
+ final DefaultConfiguration result = new DefaultConfiguration( "a", "",
+ "" );
+ final DefaultConfiguration rkid1 = new DefaultConfiguration( "kid1",
+ "",
+ "" );
+ rkid1.setAttribute( "test", "1" );
+ result.addChild( rkid1 );
+
+ final DefaultConfiguration base = new DefaultConfiguration( "a", "",
+ "" );
+ final DefaultConfiguration bkid1 = new DefaultConfiguration( "kid1",
+ "",
+ "" );
+ bkid1.setAttribute( "test", "0" );
+ base.addChild( bkid1 );
+
+ final DefaultConfiguration layer = new DefaultConfiguration( "a", "",
+ "" );
+ final DefaultConfiguration lkid1 = new DefaultConfiguration( "kid1",
+ "",
+ "" );
+ lkid1.setAttribute( "test", "1" );
+ layer.addChild( lkid1 );
+
+ assertTrue( !ConfigurationUtil.equals( result,
+ ConfigurationMerger.merge(
+ layer,
+ base ) ) );
+
+ lkid1.setAttribute( "excalibur-configuration:merge", "true" );
+
+ assertTrue(
+ ConfigurationUtil.equals( result,
+ ConfigurationMerger.merge( layer, base ) ) );
+ assertTrue( ConfigurationUtil.equals( layer,
+ ConfigurationSplitter.split(
+ result,
+ base ) ) );
+ }
+}
</pre></div>
<hr /><a name="file38" /><div class="file">
<span class="pathname" id="removed"><a href="http://xstream.cvs.codehaus.org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine">engine</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src">src</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test">test</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org">org</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer">jcontainer</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom">loom</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components">components</a>/<a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jco
ntainer/loom/components/configuration">configuration</a>/<a href="http://xstream.cvs.code!
haus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/configuration/merger">merger</a><br /></span>
<div class="fileheader" id="removed"><big><b>ConfigurationMergerTestCase.java</b></big> <small id="info">removed after <a href="http://xstream.cvs.codehaus.org/jcontainer/loom/engine/src/test/org/jcontainer/loom/components/configuration/merger/ConfigurationMergerTestCase.java?rev=1.8&content-type=text/vnd.viewcvs-markup">1.8</a></small></div>
<pre class="diff"><small id="info">diff -N ConfigurationMergerTestCase.java
--- ConfigurationMergerTestCase.java 18 Apr 2004 23:09:53 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,189 +0,0 @@
</small></pre><pre class="diff" id="removed">-/* ====================================================================
- * JContainer Software License, version 1.1
- *
- * Copyright (c) 2003, JContainer Group. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. Neither the name of the JContainer Group nor the name "Loom" nor
- * the names of its contributors may be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- *
- * JContainer Loom includes code from the Apache Software Foundation
- *
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1997-2003 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software
- * itself, if and wherever such third-party acknowledgments
- * normally appear.
- *
- * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation"
- * must not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact [email protected]
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-package org.jcontainer.loom.components.configuration.merger;
-
-import junit.framework.TestCase;
-import org.codehaus.dna.impl.ConfigurationUtil;
-import org.codehaus.dna.impl.DefaultConfiguration;
-
-/**
- * @author Peter Royal
- */
-public class ConfigurationMergerTestCase
- extends TestCase
-{
- public void testAttributeOnlyMerge()
- throws Exception
- {
- final DefaultConfiguration result = new DefaultConfiguration( "a", "",
- "" );
- result.setAttribute( "a", "1" );
-
- final DefaultConfiguration base = new DefaultConfiguration( "a", "",
- "" );
- base.setAttribute( "a", "2" );
-
- final DefaultConfiguration layer =
- new DefaultConfiguration( "a", "", "" );
- layer.setAttribute( "a", "1" );
-
- assertTrue(
- ConfigurationUtil.equals( result,
- ConfigurationMerger.merge( layer, base ) ) );
- assertTrue( ConfigurationUtil.equals( layer,
- ConfigurationSplitter.split(
- result,
- base ) ) );
- }
-
- public void testAddChild()
- throws Exception
- {
- final DefaultConfiguration result =
- new DefaultConfiguration( "a", "", "" );
- result.addChild( new DefaultConfiguration( "kid1", "", "" ) );
- result.addChild( new DefaultConfiguration( "kid2", "", "" ) );
-
- final DefaultConfiguration base =
- new DefaultConfiguration( "a", "", "" );
- base.addChild( new DefaultConfiguration( "kid1", "", "" ) );
-
- final DefaultConfiguration layer = new DefaultConfiguration( "a", "",
- "" );
- layer.addChild( new DefaultConfiguration( "kid2", "", "" ) );
- assertTrue(
- ConfigurationUtil.equals( result,
- ConfigurationMerger.merge( layer, base ) ) );
- assertTrue( ConfigurationUtil.equals( layer,
- ConfigurationSplitter.split(
- result,
- base ) ) );
- }
-
- public void testOverrideChild()
- throws Exception
- {
- final DefaultConfiguration result = new DefaultConfiguration( "a", "",
- "" );
- final DefaultConfiguration rkid1 = new DefaultConfiguration( "kid1",
- "",
- "" );
- rkid1.setAttribute( "test", "1" );
- result.addChild( rkid1 );
-
- final DefaultConfiguration base = new DefaultConfiguration( "a", "",
- "" );
- final DefaultConfiguration bkid1 = new DefaultConfiguration( "kid1",
- "",
- "" );
- bkid1.setAttribute( "test", "0" );
- base.addChild( bkid1 );
-
- final DefaultConfiguration layer = new DefaultConfiguration( "a", "",
- "" );
- final DefaultConfiguration lkid1 = new DefaultConfiguration( "kid1",
- "",
- "" );
- lkid1.setAttribute( "test", "1" );
- layer.addChild( lkid1 );
-
- assertTrue( !ConfigurationUtil.equals( result,
- ConfigurationMerger.merge(
- layer,
- base ) ) );
-
- lkid1.setAttribute( "excalibur-configuration:merge", "true" );
-
- assertTrue(
- ConfigurationUtil.equals( result,
- ConfigurationMerger.merge( layer, base ) ) );
- assertTrue( ConfigurationUtil.equals( layer,
- ConfigurationSplitter.split(
- result,
- base ) ) );
- }
-}
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.8</small></center>
</body></html>