notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r878 - in trunk/main/metro/station: api/src/test/net/dpml/station/info server/src/test/net/dpml/station/server
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r878 - in trunk/main/metro/station: api/src/test/net/dpml/station/info server/src/test/net/dpml/station/server
- Date: Sun, 8 Jan 2006 14:43:30 +0100
Author: mcconnell
Date: 2006-01-08 14:43:28 +0100 (Sun, 08 Jan 2006)
New Revision: 878
Modified:
trunk/main/metro/station/api/src/test/net/dpml/station/info/AbstractTestCase.java
trunk/main/metro/station/api/src/test/net/dpml/station/info/ApplicationDescriptorTestCase.java
trunk/main/metro/station/api/src/test/net/dpml/station/info/RegistryDescriptorTestCase.java
trunk/main/metro/station/api/src/test/net/dpml/station/info/StartupPolicyTestCase.java
trunk/main/metro/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
Log:
resolve metro/station checkstyle issues
Modified:
trunk/main/metro/station/api/src/test/net/dpml/station/info/AbstractTestCase.java
===================================================================
---
trunk/main/metro/station/api/src/test/net/dpml/station/info/AbstractTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
+++
trunk/main/metro/station/api/src/test/net/dpml/station/info/AbstractTestCase.java
2006-01-08 13:43:28 UTC (rev 878)
@@ -27,18 +27,15 @@
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.beans.Encoder;
import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.beans.ExceptionListener;
-import java.beans.Expression;
import java.util.Properties;
import junit.framework.TestCase;
/**
- * The ModuleDirective class describes a module data-structure.
+ * AbstractTestCase.
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
*/
Modified:
trunk/main/metro/station/api/src/test/net/dpml/station/info/ApplicationDescriptorTestCase.java
===================================================================
---
trunk/main/metro/station/api/src/test/net/dpml/station/info/ApplicationDescriptorTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
+++
trunk/main/metro/station/api/src/test/net/dpml/station/info/ApplicationDescriptorTestCase.java
2006-01-08 13:43:28 UTC (rev 878)
@@ -44,6 +44,10 @@
private ApplicationDescriptor m_descriptor;
+ /**
+ * Test-case setup.
+ * @exception Exception if a setup error occurs
+ */
public void setUp() throws Exception
{
m_base = "test";
@@ -62,6 +66,11 @@
m_startup, m_shutdown, m_properties, m_config.toASCIIString() );
}
+ /**
+ * Validate that the application descriptor constructor throws
+ * an NPE is supplied with a null codebase uri.
+ * @exception Exception if a error occurs
+ */
public void testNullCodeBase() throws Exception
{
try
@@ -78,47 +87,83 @@
}
}
+ /**
+ * Test codebase uri spec accessor.
+ * @exception Exception if a error occurs
+ */
public void testCodeBaseURISpec() throws Exception
{
String spec = m_codebase.toASCIIString();
assertEquals( "codebase-spec", spec,
m_descriptor.getCodeBaseURISpec() );
}
+ /**
+ * Test codebase uri accessor.
+ * @exception Exception if a error occurs
+ */
public void testCodeBaseURI() throws Exception
{
assertEquals( "codebase", m_codebase, m_descriptor.getCodeBaseURI()
);
}
+ /**
+ * Test startup timeout accessor.
+ * @exception Exception if a error occurs
+ */
public void testStartupTimout() throws Exception
{
assertEquals( "startup-timeout", m_startup,
m_descriptor.getStartupTimeout() );
}
+ /**
+ * Test shutdown timeout accessor.
+ * @exception Exception if a error occurs
+ */
public void testShutdownTimout() throws Exception
{
assertEquals( "shutdown-timeout", m_shutdown,
m_descriptor.getShutdownTimeout() );
}
+ /**
+ * Test title accessor.
+ * @exception Exception if a error occurs
+ */
public void testTitle() throws Exception
{
assertEquals( "title", m_title, m_descriptor.getTitle() );
}
+ /**
+ * Test policy accessor.
+ * @exception Exception if a error occurs
+ */
public void testPolicy() throws Exception
{
assertEquals( "policy", m_policy, m_descriptor.getStartupPolicy() );
}
+ /**
+ * Test value directives accessor.
+ * @exception Exception if a error occurs
+ */
public void testValueDirectives() throws Exception
{
assertEquals( "values", m_values.length,
m_descriptor.getValueDirectives().length );
}
+ /**
+ * Test descriptor serialization.
+ * @exception Exception if a error occurs
+ */
public void testSerialization() throws Exception
{
doSerializationTest( m_descriptor );
}
+ /**
+ * Test descriptor encoding and decoding.
+ * @exception Exception if a error occurs
+ */
public void testXMLEncoding() throws Exception
{
doEncodingTest( m_descriptor, "application.xml" );
Modified:
trunk/main/metro/station/api/src/test/net/dpml/station/info/RegistryDescriptorTestCase.java
===================================================================
---
trunk/main/metro/station/api/src/test/net/dpml/station/info/RegistryDescriptorTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
+++
trunk/main/metro/station/api/src/test/net/dpml/station/info/RegistryDescriptorTestCase.java
2006-01-08 13:43:28 UTC (rev 878)
@@ -20,23 +20,25 @@
import java.util.Arrays;
import java.util.Properties;
-import java.net.URI;
import net.dpml.transit.info.ValueDirective;
import net.dpml.station.info.RegistryDescriptor.Entry;
/**
- * Test ApplicationDescriptor class.
+ * Test the RegistryDescriptor class.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public final class RegistryDescriptorTestCase extends AbstractTestCase
{
- Entry[] m_entries = new Entry[3];
-
+ private Entry[] m_entries = new Entry[3];
private RegistryDescriptor m_descriptor;
+ /**
+ * Test-case setup.
+ * @exception Exception if a setup error occurs
+ */
public void setUp() throws Exception
{
m_entries[0] =
@@ -61,6 +63,10 @@
m_descriptor = new RegistryDescriptor( m_entries );
}
+ /**
+ * Validate that the registry descriptor constructor throws
+ * an NPE is supplied with a null entries argument.
+ */
public void testNullEntries()
{
try
@@ -74,11 +80,15 @@
}
}
+ /**
+ * Validate that the registry descriptor constructor throws
+ * an NPE is supplied with a null array entry.
+ */
public void testNullEntry()
{
try
{
- new RegistryDescriptor( new Entry[]{ null } );
+ new RegistryDescriptor( new Entry[]{null} );
fail( "No NPE" );
}
catch( NullPointerException e )
@@ -87,6 +97,10 @@
}
}
+ /**
+ * Test entries accessor.
+ * @exception Exception if a error occurs
+ */
public void testEntries() throws Exception
{
Entry[] entries = m_descriptor.getEntries();
@@ -96,11 +110,19 @@
}
}
+ /**
+ * Test registry serialization.
+ * @exception Exception if a error occurs
+ */
public void testSerialization() throws Exception
{
doSerializationTest( m_descriptor );
}
+ /**
+ * Test registry encoding/decoding cycle.
+ * @exception Exception if a error occurs
+ */
public void testXMLEncoding() throws Exception
{
doEncodingTest( m_descriptor, "registry.xml" );
Modified:
trunk/main/metro/station/api/src/test/net/dpml/station/info/StartupPolicyTestCase.java
===================================================================
---
trunk/main/metro/station/api/src/test/net/dpml/station/info/StartupPolicyTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
+++
trunk/main/metro/station/api/src/test/net/dpml/station/info/StartupPolicyTestCase.java
2006-01-08 13:43:28 UTC (rev 878)
@@ -18,8 +18,6 @@
package net.dpml.station.info;
-import java.net.URI;
-
/**
* Test StartupPolicy class.
*
@@ -28,30 +26,50 @@
*/
public final class StartupPolicyTestCase extends AbstractTestCase
{
+ /**
+ * Test DISABLED startup policy parse method.
+ * @exception Exception if an error occurs
+ */
public void testParseDisabled() throws Exception
{
StartupPolicy policy = StartupPolicy.parse( "disabled" );
assertEquals( "disabled", policy, StartupPolicy.DISABLED );
}
+ /**
+ * Test MANUAL startup policy parse method.
+ * @exception Exception if an error occurs
+ */
public void testParseManual() throws Exception
{
StartupPolicy policy = StartupPolicy.parse( "manual" );
assertEquals( "manual", policy, StartupPolicy.MANUAL );
}
+ /**
+ * Test AUTOMATIC startup policy parse method.
+ * @exception Exception if an error occurs
+ */
public void testParseAutomatic() throws Exception
{
StartupPolicy policy = StartupPolicy.parse( "automatic" );
assertEquals( "automatic", policy, StartupPolicy.AUTOMATIC );
}
+ /**
+ * Test policy serialization.
+ * @exception Exception if an error occurs
+ */
public void testSerialization() throws Exception
{
StartupPolicy policy = StartupPolicy.AUTOMATIC;
doSerializationTest( policy );
}
+ /**
+ * Test policy encoding/decoding cycle.
+ * @exception Exception if an error occurs
+ */
public void testXMLEncoding() throws Exception
{
StartupPolicy policy = StartupPolicy.AUTOMATIC;
Modified:
trunk/main/metro/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
===================================================================
---
trunk/main/metro/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
+++
trunk/main/metro/station/server/src/test/net/dpml/station/server/RemoteApplicationRegistryTestCase.java
2006-01-08 13:43:28 UTC (rev 878)
@@ -48,11 +48,15 @@
private URL m_url;
private Logger m_logger = new LoggingAdapter( "registry" );
+ /**
+ * Test-case setup.
+ * @exception Exception if a setup error occurs
+ */
public void setUp() throws Exception
{
Artifact artifact = Artifact.createArtifact(
"local:xml:dpml/station/registry-test" );
URL url = artifact.toURL();
- File file = (File) url.getContent( new Class[]{ File.class } );
+ File file = (File) url.getContent( new Class[]{File.class} );
if( file.exists() )
{
file.delete();
@@ -60,12 +64,20 @@
m_url = url;
}
+ /**
+ * Test-case tear-down.
+ * @exception Exception if an error occurs
+ */
public void tearDown() throws Exception
{
- File file = (File) m_url.getContent( new Class[]{ File.class } );
+ File file = (File) m_url.getContent( new Class[]{File.class} );
file.deleteOnExit();
}
+ /**
+ * Initial registry polulation count.
+ * @exception Exception if an error occurs
+ */
public void testRegistryInitialCount() throws Exception
{
RemoteApplicationRegistry registry =
@@ -74,6 +86,10 @@
assertEquals( "inital-count", 0, n );
}
+ /**
+ * Initial add operation.
+ * @exception Exception if an error occurs
+ */
public void testApplicationAddition() throws Exception
{
ApplicationDescriptor profile =
@@ -88,6 +104,10 @@
assertEquals( "single-count", 1, n );
}
+ /**
+ * Initial remove operation.
+ * @exception Exception if an error occurs
+ */
public void testApplicationRemoval() throws Exception
{
ApplicationDescriptor profile =
@@ -103,6 +123,10 @@
assertEquals( "empty-count", 0, n );
}
+ /**
+ * Initial registry storage.
+ * @exception Exception if an error occurs
+ */
public void testRegistryStorage() throws Exception
{
ApplicationDescriptor profileOne =
@@ -129,6 +153,10 @@
assertEquals( "double-count-after-restore", 2, n );
}
+ /**
+ * Initial registry storage update.
+ * @exception Exception if an error occurs
+ */
public void testRegistryUpdate() throws Exception
{
ApplicationDescriptor profileOne =
@@ -151,6 +179,10 @@
assertEquals( "updated profile", profileTwo, updated );
}
+ /**
+ * Initial get operation.
+ * @exception Exception if an error occurs
+ */
public void testGetApplicationDescriptors() throws Exception
{
ApplicationDescriptor profileOne =
@@ -173,6 +205,10 @@
assertEquals( "count", 2, entries.length );
}
+ /**
+ * Initial invalid key.
+ * @exception Exception if an error occurs
+ */
public void testInvalidKey() throws Exception
{
ApplicationDescriptor profile =
@@ -194,6 +230,10 @@
}
}
+ /**
+ * Initial duplicate key.
+ * @exception Exception if an error occurs
+ */
public void testDuplicateKey() throws Exception
{
ApplicationDescriptor profile =
@@ -215,6 +255,10 @@
}
}
+ /**
+ * Initial registry listener.
+ * @exception Exception if an error occurs
+ */
public void testListeners() throws Exception
{
ApplicationDescriptor profile =
@@ -234,12 +278,23 @@
registry.removeApplicationDescriptor( "batman" );
}
+ /**
+ * Mock listener class.
+ */
private class MockRegistryListener implements RegistryListener
{
+ /**
+ * Profile addition notification.
+ * @param event the event
+ */
public void profileAdded( RegistryEvent event )
{
}
+ /**
+ * Profile removal notification.
+ * @param event the event
+ */
public void profileRemoved( RegistryEvent event )
{
}
- r878 - in trunk/main/metro/station: api/src/test/net/dpml/station/info server/src/test/net/dpml/station/server, mcconnell at BerliOS, 01/08/2006
Archive powered by MHonArc 2.6.24.