[CVS spice] Completed test coverage for instrument package.

mauro-yCVjj/[email protected] 20 Jun 2004 16:32:07 -0000
Newsgroups gmane.comp.java.spice.cvs
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>spice/components/alchemist/src/test/org/codehaus/spice/alchemist/instrument</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt><a href="#file1"><span id="added">NonConfigurableMockAvalonInstrumentManager.java</span></a></tt></td><td align="right" id="added">+22</td><td></td><td nowrap="nowrap" align="right">added 1.1</td></tr>
<tr class="alt"><td><tt><a href="#file2">DNAInstrumentManagerTestCase.java</a></tt></td><td align="right" id="added">+15</td><td align="right" id="removed">-4</td><td nowrap="nowrap" align="center">1.1 -&gt; 1.2</td></tr>
<tr><td></td><td align="right" id="added">+37</td><td align="right" id="removed">-4</td><td></td></tr>
</table>
<small id="info">1 added + 1 modified, total 2 files</small><br />
<pre class="comment">
Completed test coverage for instrument package.
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added">spice/components/alchemist/src/test/org/codehaus/spice/alchemist/instrument<br /></span>
<div class="fileheader" id="added"><big><b>NonConfigurableMockAvalonInstrumentManager.java</b></big> <small id="info">added at 1.1</small></div>
<pre class="diff"><small id="info">diff -N NonConfigurableMockAvalonInstrumentManager.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ NonConfigurableMockAvalonInstrumentManager.java	20 Jun 2004 16:32:07 -0000	1.1
@@ -0,0 +1,22 @@
</small></pre><pre class="diff" id="added">+/*
+ * Copyright (C) The Spice Group. All rights reserved.
+ *
+ * This software is published under the terms of the Spice
+ * Software License version 1.1, a copy of which has been included
+ * with this distribution in the LICENSE.txt file.
+ */
+package org.codehaus.spice.alchemist.instrument;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+
+class NonConfigurableMockAvalonInstrumentManager extends MockAvalonInstrumentManager {
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure( Configuration arg0 ) throws ConfigurationException {
+        throw new ConfigurationException( "Not Configurable" );
+    }
+
+}
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">spice/components/alchemist/src/test/org/codehaus/spice/alchemist/instrument<br /></span>
<div class="fileheader"><big><b>DNAInstrumentManagerTestCase.java</b></big> <small id="info">1.1 -&gt; 1.2</small></div>
<pre class="diff"><small id="info">diff -u -r1.1 -r1.2
--- DNAInstrumentManagerTestCase.java	20 Jun 2004 13:38:03 -0000	1.1
+++ DNAInstrumentManagerTestCase.java	20 Jun 2004 16:32:07 -0000	1.2
@@ -11,6 +11,7 @@
</small></pre><pre class="diff" id="context"> import junit.framework.TestCase;
 import org.apache.avalon.framework.logger.Jdk14Logger;
 import org.codehaus.dna.Configuration;
</pre><pre class="diff" id="added">+import org.codehaus.dna.ConfigurationException;
</pre><pre class="diff" id="context"> import org.codehaus.dna.impl.DefaultConfiguration;
 import org.codehaus.spice.alchemist.logger.DNALogger;
 import org.codehaus.spice.alchemist.logger.MockLogger;
</pre><pre class="diff"><small id="info">@@ -22,7 +23,7 @@
</small></pre><pre class="diff" id="context">             new DNAInstrumentManager( null );
             fail("Expected NPE");
         } catch ( NullPointerException e ) {
</pre><pre class="diff" id="removed">-            assertEquals( "<span id="removedchars">e.getMessage()</span>", "manager", e.getMessage() );
</pre><pre class="diff" id="added">+            assertEquals( "<span id="addedchars">NPE&nbsp;message</span>", "manager", e.getMessage() );
</pre><pre class="diff" id="context">         }
     }
 
</pre><pre class="diff"><small id="info">@@ -33,7 +34,7 @@
</small></pre><pre class="diff" id="context">         assertEquals( "registerInstrumentable()", "registerInstrumentable", avalonManager.getMethodCalled() );               
     }
 
</pre><pre class="diff" id="removed">-    public void test<span id="removedchars">DNALifecycleMethods</span>WithAvalonManager() throws Exception {
</pre><pre class="diff" id="added">+    public void test<span id="addedchars">Lifecycle</span>WithAvalonManager() throws Exception {
</pre><pre class="diff" id="context">         MockAvalonInstrumentManager mockManager = new MockAvalonInstrumentManager();
         DNAInstrumentManager dnaManager = new DNAInstrumentManager( mockManager );
         dnaManager.initialize();
</pre><pre class="diff"><small id="info">@@ -46,7 +47,7 @@
</small></pre><pre class="diff" id="context">         assertEquals( "dispose()", "dispose", mockManager.getMethodCalled() );               
     }
 
</pre><pre class="diff" id="removed">-    public void test<span id="removedchars">DNALifecycleMethods</span>WithNonAvalonManager() throws Exception {
</pre><pre class="diff" id="added">+    public void test<span id="addedchars">Lifecycle</span>WithNonAvalonManager() throws Exception {
</pre><pre class="diff" id="context">         MockDNAInstrumentManager mockManager = new MockDNAInstrumentManager();
         DNAInstrumentManager dnaManager = new DNAInstrumentManager( mockManager );
         dnaManager.initialize();
</pre><pre class="diff"><small id="info">@@ -59,8 +60,18 @@
</small></pre><pre class="diff" id="context">         assertNull( "dispose()", mockManager.getMethodCalled() );               
     }
     
</pre><pre class="diff" id="added">+    public void testConfigureWithNonConfigurableAvalonManager() throws Exception {
+        DNAInstrumentManager dnaManager = new DNAInstrumentManager( new NonConfigurableMockAvalonInstrumentManager() );
+        try {
+            dnaManager.configure( createDNAConfiguration() );
+            fail( "Expected ConfigurationException" );
+        } catch ( ConfigurationException e ) {
+            assertEquals( "NPE message", "Not Configurable", e.getMessage() );
+        }
+    }
+    
</pre><pre class="diff" id="context">     private Configuration createDNAConfiguration() {
</pre><pre class="diff" id="removed">-        return new DefaultConfiguration(<span id="removedchars">"","",""</span>);
</pre><pre class="diff" id="added">+        return new DefaultConfiguration(<span id="addedchars">&nbsp;"",&nbsp;"",&nbsp;""&nbsp;</span>);
</pre><pre class="diff" id="context">     }
 
     private DNALogger createDNALogger()
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -&gt; email">CVSspam</a> 0.2.8</small></center>
</body></html>