notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r880 - in trunk/main: metro/test/src/test/net/dpml/metro/runtime/test transit/core/src/test/net/dpml/transit transit/core/src/test/net/dpml/transit/info transit/core/src/test/net/dpml/transit/test
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r880 - in trunk/main: metro/test/src/test/net/dpml/metro/runtime/test transit/core/src/test/net/dpml/transit transit/core/src/test/net/dpml/transit/info transit/core/src/test/net/dpml/transit/test
- Date: Sun, 8 Jan 2006 22:16:03 +0100
Author: mcconnell
Date: 2006-01-08 22:15:57 +0100 (Sun, 08 Jan 2006)
New Revision: 880
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CategoriesTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentHandlerTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentModelTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ConfigTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextModelTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/DisposalTestCase.java
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/HardCollectionPolicyTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/PropertiesPluginTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/AbstractTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/CacheDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/CodeBaseDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/ContentDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/HostDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/LayoutDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/ProxyDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/TransitDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/info/ValueDirectiveTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/test/AbstractEncodingTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/test/ArtifactTestCase.java
trunk/main/transit/core/src/test/net/dpml/transit/test/ConstructTestCase.java
Log:
checkstyle improvements
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/AppTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -41,6 +41,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part defintion 'application.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "application.part";
@@ -51,6 +56,7 @@
/**
* Validate composite instantiation and in particular that the color
* assigned to the child component has been overriden by the parent.
+ * @exception Exception if an unexpected error occurs
*/
public void testApplication() throws Exception
{
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CategoriesTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CategoriesTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CategoriesTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -41,6 +41,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part defintion 'categories.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "categories.part";
@@ -49,13 +54,14 @@
}
/**
- * Test that the component initial state is inactive.
+ * Load the categories component.
+ * @exception Exception if an unexpected error occurs
*/
public void testCategories() throws Exception
{
Component component = CONTROLLER.createComponent( m_uri );
Provider instance = component.getProvider();
- CategoriesComponent startable = (CategoriesComponent)
instance.getValue( false );
+ CategoriesComponent instance = (CategoriesComponent)
instance.getValue( false );
component.deactivate();
}
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentHandlerTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentHandlerTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentHandlerTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -40,6 +40,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part defintion 'example.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "example.part";
@@ -49,6 +54,7 @@
/**
* Test that the component initial state is inactive.
+ * @exception Exception if an unexpected error occurs
*/
public void testHandlerInitialState() throws Exception
{
@@ -60,6 +66,7 @@
/**
* Test that the component exposes itself as active following activation
* and inactive following deactivation.
+ * @exception Exception if an unexpected error occurs
*/
public void testActivationDeactivationCycle() throws Exception
{
@@ -71,8 +78,8 @@
}
/**
- * Test that an IllegalStateException is thrown if a client attempts to
- * access an Provider from an inactive component.
+ * Test self activation on access.
+ * @exception Exception if an unexpected error occurs
*/
public void testProviderAquisitionInInactiveState() throws Exception
{
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentModelTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentModelTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ComponentModelTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -47,6 +47,11 @@
private MutableComponentModel m_model;
+ /**
+ * Testcase setup during which the part defintion 'example.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "example.part";
@@ -55,24 +60,40 @@
m_model = (MutableComponentModel) CONTROLLER.createModel( uri );
}
+ /**
+ * Test the component name.
+ * @exception Exception if an unexpected error occurs
+ */
public void testName() throws Exception
{
String name = "example"; // from build.xml's component directive
assertEquals( "name", name, m_model.getName() );
}
+ /**
+ * Test the component path.
+ * @exception Exception if an unexpected error occurs
+ */
public void testContextPath() throws Exception
{
String path = "/example";
assertEquals( "path", path, m_model.getContextPath() );
}
+ /**
+ * Test the component implementation classname.
+ * @exception Exception if an unexpected error occurs
+ */
public void testImplementationClassName() throws Exception
{
String classname = ExampleComponent.class.getName();
assertEquals( "classname", classname,
m_model.getImplementationClassName() );
}
+ /**
+ * Test the component activation policy.
+ * @exception Exception if an unexpected error occurs
+ */
public void testActivationPolicy() throws Exception
{
assertEquals( "initial-activation", ActivationPolicy.STARTUP,
m_model.getActivationPolicy() );
@@ -81,11 +102,19 @@
assertEquals( "mutated-activation", policy,
m_model.getActivationPolicy() );
}
+ /**
+ * Test the component lifestyle policy.
+ * @exception Exception if an unexpected error occurs
+ */
public void testLifestylePolicy() throws Exception
{
assertEquals( "initial-lifestyle", LifestylePolicy.THREAD,
m_model.getLifestylePolicy() );
}
+ /**
+ * Test the component collection policy.
+ * @exception Exception if an unexpected error occurs
+ */
public void testCollectionPolicy() throws Exception
{
assertEquals( "initial-collection", CollectionPolicy.SYSTEM,
m_model.getCollectionPolicy() );
@@ -94,12 +123,20 @@
assertEquals( "mutated-collection", policy,
m_model.getCollectionPolicy() );
}
+ /**
+ * Test the component part keys.
+ * @exception Exception if an unexpected error occurs
+ */
public void testPartKeys() throws Exception
{
String[] keys = m_model.getPartKeys();
assertEquals( "parts-length", 0, keys.length );
}
+ /**
+ * Test an unknown part request failure.
+ * @exception Exception if an unexpected error occurs
+ */
public void testUnknownPart() throws Exception
{
try
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/CompositeTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -45,6 +45,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part definition 'composite.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "composite.part";
@@ -55,6 +60,7 @@
/**
* Validate composite instantiation and in particular that the color
* assigned to the child component has been overriden by the parent.
+ * @exception Exception if an unexpected error occurs
*/
public void testComposite() throws Exception
{
@@ -70,6 +76,7 @@
/**
* Validate composite instantiation with an overloader parent context.
+ * @exception Exception if an unexpected error occurs
*/
public void testOverloadedComposite() throws Exception
{
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ConfigTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ConfigTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ConfigTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -30,7 +30,7 @@
import net.dpml.test.config.ConfigurableComponent;
/**
- * Contains a series of tests dealing with dynamic component lifecycles.
+ * Validation of component configuration aspects.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -41,6 +41,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part definition 'config.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "config.part";
@@ -49,7 +54,9 @@
}
/**
- * Test that the component initial state is inactive.
+ * Test the the component properly exposed the configuration
+ * declared within the part defintion.
+ * @exception Exception if an unexpected error occurs
*/
public void testCategories() throws Exception
{
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextModelTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextModelTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextModelTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -38,7 +38,7 @@
import net.dpml.test.ExampleComponent;
/**
- * Test aspects of the component model implementation.
+ * Test aspects of the component context model implementation.
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
@@ -46,6 +46,11 @@
{
private ComponentModel m_model;
+ /**
+ * Testcase setup during which the part definition 'example.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "example.part";
@@ -54,6 +59,10 @@
m_model = (ComponentModel) Controller.STANDARD.createModel( uri );
}
+ /**
+ * Test context model inital state and subsequent context model updating.
+ * @exception Exception if an unexpected error occurs
+ */
public void testContextModel() throws Exception
{
MutableContextModel context = (MutableContextModel)
m_model.getContextModel();
@@ -72,12 +81,20 @@
assertEquals( "color-2", Color.BLUE, result.resolve() );
}
+ /**
+ * Test model vaidation (with cause for concern).
+ * @exception Exception if an unexpected error occurs
+ */
public void testValidationWithoutCause() throws Exception
{
ContextModel context = m_model.getContextModel();
context.validate();
}
+ /**
+ * Test model vaidation (with cause for concern).
+ * @exception Exception if an unexpected error occurs
+ */
public void testValidationWithCause() throws Exception
{
MutableContextModel context = (MutableContextModel)
m_model.getContextModel();
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/ContextTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -41,6 +41,12 @@
private ContextTestComponent m_value;
private Context m_context;
+ /**
+ * Testcase setup during which the part definition 'context.part'
+ * is established as a file uri and the context test component is
+ * established.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "context.part";
@@ -52,23 +58,40 @@
m_context = m_value.getContext();
}
+ /**
+ * Test the initial component state using both the assigned colour value
+ * the a default supplied value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testColor() throws Exception
{
assertEquals( "color/1", Color.RED, m_context.getColor() );
assertEquals( "color/2", Color.YELLOW, m_context.getOptionalColor(
Color.YELLOW ) );
}
+ /**
+ * Test the passing of a null as a default argument (allowed).
+ * @exception Exception if an unexpected error occurs
+ */
public void testNullColor() throws Exception
{
assertEquals( "color-null", null, m_context.getOptionalColor( null )
);
}
+ /**
+ * Test access to an integer context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testInteger() throws Exception
{
assertEquals( "int/1", 0, m_context.getInteger() );
assertEquals( "int/2", 999, m_context.getOptionalInteger( 999 ) );
}
+ /**
+ * Test access to an short context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testShort() throws Exception
{
short s1 = 0;
@@ -77,6 +100,10 @@
assertEquals( "short/2", s2, m_context.getOptionalShort( s2 ) );
}
+ /**
+ * Test access to an long context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testLong() throws Exception
{
long v1 = 0;
@@ -85,6 +112,10 @@
assertEquals( "long/2", v2, m_context.getOptionalLong( v2 ) );
}
+ /**
+ * Test access to an byte context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testByte() throws Exception
{
byte v1 = 0;
@@ -93,6 +124,10 @@
assertEquals( "byte/2", v2, m_context.getOptionalByte( v2 ) );
}
+ /**
+ * Test access to an double context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testDouble() throws Exception
{
double v1 = 0;
@@ -103,6 +138,10 @@
assertEquals( "double/2", v2, m_context.getOptionalDouble( v2 ),
delta );
}
+ /**
+ * Test access to an float context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testFloat() throws Exception
{
float v1 = 0.5f;
@@ -112,6 +151,10 @@
assertEquals( "float/2", v2, m_context.getOptionalFloat( v2 ), delta
);
}
+ /**
+ * Test access to an char context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testChar() throws Exception
{
char v1 = 'x';
@@ -120,12 +163,20 @@
assertEquals( "char/2", v2, m_context.getOptionalChar( v2 ) );
}
+ /**
+ * Test access to an boolean context value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testBoolean() throws Exception
{
assertEquals( "boolean/1", true, m_context.getBoolean() );
assertEquals( "boolean/2", false, m_context.getOptionalBoolean(
false ) );
}
+ /**
+ * Test access to an context value declared via a symbolic reference.
+ * @exception Exception if an unexpected error occurs
+ */
public void testWorkSymbolicReference() throws Exception
{
final File test = new File( System.getProperty( "user.dir" ) );
@@ -135,6 +186,10 @@
assertEquals( "file/3", somewhere, m_context.getOptionalFile(
somewhere ) );
}
+ /**
+ * Test access to a uri context value declared via a symbolic reference.
+ * @exception Exception if an unexpected error occurs
+ */
public void testURISymbolicReference() throws Exception
{
URI foo = new URI( "foo:bar" );
@@ -143,11 +198,19 @@
assertEquals( "uri", foo, m_context.getOptionalURI( foo ) );
}
+ /**
+ * Test access to an system defined symbolic name.
+ * @exception Exception if an unexpected error occurs
+ */
public void testNameSymbolicReference() throws Exception
{
assertEquals( "name", "context", m_context.getName() );
}
+ /**
+ * Test access to an system defined symbolic value.
+ * @exception Exception if an unexpected error occurs
+ */
public void testPathSymbolicReference() throws Exception
{
assertEquals( "path", "/context", m_context.getPath() );
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/DisposalTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/DisposalTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/DisposalTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -38,6 +38,11 @@
private URI m_uri;
+ /**
+ * Testcase setup during which the part defintion 'example.part'
+ * is established as a file uri.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "example.part";
@@ -45,6 +50,10 @@
m_uri = new File( test, path ).toURI();
}
+ /**
+ * Test component handler disposal.
+ * @exception Exception if an unexpected error occurs
+ */
public void testHandlerDisposal() throws Exception
{
Component component = CONTROLLER.createComponent( m_uri );
Modified:
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/HardCollectionPolicyTestCase.java
===================================================================
---
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/HardCollectionPolicyTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/metro/test/src/test/net/dpml/metro/runtime/test/HardCollectionPolicyTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -38,6 +38,10 @@
private URI m_uri;
+ /**
+ * Testcase setup.
+ * @exception Exception if an unexpected error occurs
+ */
public void setUp() throws Exception
{
final String path = "example-4.part";
@@ -45,6 +49,13 @@
m_uri = new File( test, path ).toURI();
}
+ /**
+ * Test the HARD collection policy through the creation of two components
+ * followed by a gc run and validating of the number of references
remaining in
+ * memory (which according to the HARD collection policy will remain as
2).
+ *
+ * @exception Exception if an unexpected error occurs
+ */
public void testCollection() throws Exception
{
Component component = CONTROLLER.createComponent( m_uri );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/PropertiesPluginTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/PropertiesPluginTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/PropertiesPluginTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -36,6 +36,10 @@
{
private PropertiesPlugin m_plugin;
+ /**
+ * Test case setup.
+ * @exception Exception if an error occurs during setup.
+ */
protected void setUp() throws Exception
{
Properties props = new Properties();
@@ -44,43 +48,69 @@
m_plugin = new PropertiesPlugin( props );
}
- public void testArtifact()
- throws Exception
+ /**
+ * Test artifact name accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testArtifactName() throws Exception
{
Artifact artifact = Artifact.createArtifact( m_plugin.getURI() );
assertEquals( "Artifact name", "dpml-metro-cli", artifact.getName()
);
+ }
+ /**
+ * Test artifact uri accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testArtifactToURI() throws Exception
+ {
+ Artifact artifact = Artifact.createArtifact( m_plugin.getURI() );
URI uri = URI.create(
"artifact:plugin:dpml/metro/dpml-metro-cli#123" );
assertEquals( "Artifact URI", uri, artifact.toURI() );
}
- public void testDomain()
- throws Exception
+ /**
+ * Test artifact domain accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testDomain() throws Exception
{
assertEquals( "Domain", "net.dpml",
m_plugin.getSpecificationNamespace() );
}
- public void testVersion()
- throws Exception
+ /**
+ * Test artifact version accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testVersion() throws Exception
{
assertEquals( "Version", "1.0", m_plugin.getSpecificationVersion() );
}
- public void testClassname()
- throws Exception
+ /**
+ * Test artifact classname accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testClassname() throws Exception
{
assertEquals( "Classname", "net.dpml.metro.Metro",
m_plugin.getClassname() );
}
- public void testInterface()
- throws Exception
+ /**
+ * Test artifact interfaces accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testInterface() throws Exception
{
// TODO: Fix a better sample
assertEquals( "Interface", null, m_plugin.getInterface() );
}
- public void testApiDependencies()
- throws Exception
+ /**
+ * Test artifact PUBLIC dependencies accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testPublicDependencies() throws Exception
{
URI[] facts = m_plugin.getDependencies( Category.PUBLIC );
assertEquals( "API deps", 4, facts.length );
@@ -95,8 +125,11 @@
assertEquals( "API Artifact URI", uri, facts[3] );
}
- public void testSpiDependencies()
- throws Exception
+ /**
+ * Test artifact PROTECTED dependencies accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testProtectedDependencies() throws Exception
{
URI[] facts = m_plugin.getDependencies( Category.PROTECTED );
assertEquals( "SPI deps", 2, facts.length );
@@ -107,8 +140,11 @@
assertEquals( "SPI Artifact URI", uri, facts[1] );
}
- public void testImplDependencies()
- throws Exception
+ /**
+ * Test artifact PRIVATE dependencies accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testPrivateDependencies() throws Exception
{
URI[] facts = m_plugin.getDependencies( Category.PRIVATE );
assertEquals( "Impl deps", 5, facts.length );
@@ -125,8 +161,11 @@
assertEquals( "Impl Artifact URI", uri, facts[4] );
}
- public void testAllDependencies()
- throws Exception
+ /**
+ * Test artifact dependencies accessor.
+ * @exception Exception if an error occurs during setup.
+ */
+ public void testAllDependencies() throws Exception
{
URI[] facts = m_plugin.getDependencies();
assertEquals( "All deps", 11, facts.length );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/AbstractTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/AbstractTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/AbstractTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -46,6 +46,11 @@
{
public static final Properties PROPERTIES = new Properties();
+ /**
+ * Test serialization of the supplied object.
+ * @param object the object to serialize
+ * @exception Exception is an error occurs
+ */
public void doSerializationTest( Object object )
throws Exception
{
@@ -64,6 +69,12 @@
assertEquals( "hash", object.hashCode(), serialized.hashCode() );
}
+ /**
+ * Test encoding of the supplied object.
+ * @param object the object to encode
+ * @return the result of decoding the encoded form of the supplied object
+ * @exception Exception is an error occurs
+ */
public Object doEncodingTest( Object object, String filename ) throws
Exception
{
String base = System.getProperty( "project.test.dir" );
@@ -94,5 +105,4 @@
assertEquals( "hash", object.hashCode(), result.hashCode() );
return result;
}
-
}
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/CacheDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/CacheDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/CacheDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -37,6 +37,10 @@
private ContentDirective[] m_content;
private CacheDirective m_directive;
+ /**
+ * Test case setup.
+ * @exception Exception if an error occurs during setup.
+ */
public void setUp() throws Exception
{
m_cache = "${dpml.data}/cache";
@@ -51,46 +55,82 @@
m_cache, m_cacheLayout, m_local, m_localLayout, m_layouts,
m_hosts, m_content );
}
+ /**
+ * Test cache accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testCache() throws Exception
{
assertEquals( "cache", m_cache, m_directive.getCache() );
}
+ /**
+ * Test cache layout accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testCacheLayout() throws Exception
{
assertEquals( "layout", m_cacheLayout, m_directive.getCacheLayout()
);
}
+ /**
+ * Test local path accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testLocal() throws Exception
{
assertEquals( "local", m_local, m_directive.getLocal() );
}
+ /**
+ * Test local layout accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testLocalLayout() throws Exception
{
assertEquals( "layout", m_localLayout, m_directive.getLocalLayout()
);
}
+ /**
+ * Test layouts accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testLayouts() throws Exception
{
assertEquals( "layouts", m_layouts,
m_directive.getLayoutDirectives() );
}
+ /**
+ * Test hosts accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testHosts() throws Exception
{
assertEquals( "hosts", m_hosts, m_directive.getHostDirectives() );
}
+ /**
+ * Test content handler accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testContent() throws Exception
{
assertEquals( "content", m_content,
m_directive.getContentDirectives() );
}
+ /**
+ * Test directive serialization.
+ * @exception Exception if an error occurs during setup.
+ */
public void testSerialization() throws Exception
{
doSerializationTest( m_directive );
}
+ /**
+ * Test directive encoding.
+ * @exception Exception if an error occurs during setup.
+ */
public void testEncoding() throws Exception
{
CacheDirective result = (CacheDirective) doEncodingTest(
m_directive, "cache.xml" );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/CodeBaseDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/CodeBaseDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/CodeBaseDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -31,6 +31,10 @@
protected String m_codebase;
protected ValueDirective[] m_values;
+ /**
+ * Test case setup.
+ * @exception Exception if an error occurs during setup.
+ */
public void setUp() throws Exception
{
m_codebase = "link:test:whatever";
@@ -39,12 +43,20 @@
m_values = new ValueDirective[]{v1, v2};
}
+ /**
+ * Test codebase uri spec accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testGetCodeBaseURISpec() throws Exception
{
CodeBaseDirective directive = new CodeBaseDirective( m_codebase,
m_values );
assertEquals( "codebase-spec", m_codebase,
directive.getCodeBaseURISpec() );
}
+ /**
+ * Test codebase uri accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testGetCodeBaseURI() throws Exception
{
URI uri = new URI( m_codebase );
@@ -52,12 +64,20 @@
assertEquals( "codebase-spec", uri, directive.getCodeBaseURI() );
}
+ /**
+ * Test value directive accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testGetValues() throws Exception
{
CodeBaseDirective directive = new CodeBaseDirective( m_codebase,
m_values );
assertEquals( "values", m_values, directive.getValueDirectives() );
}
+ /**
+ * Test invalid usage of null codebase in constructor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testNullCodebaseInConstructor() throws Exception
{
try
@@ -71,6 +91,10 @@
}
}
+ /**
+ * Test invalid usage of null value in constructor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testNullValuesInConstructor() throws Exception
{
try
@@ -84,12 +108,20 @@
}
}
+ /**
+ * Test serialization.
+ * @exception Exception if an error occurs during setup.
+ */
public void testSerialization() throws Exception
{
CodeBaseDirective directive = new CodeBaseDirective( m_codebase,
m_values );
doSerializationTest( directive );
}
+ /**
+ * Test encoding.
+ * @exception Exception if an error occurs during setup.
+ */
public void testEncoding() throws Exception
{
CodeBaseDirective directive = new CodeBaseDirective( m_codebase,
m_values );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/ContentDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/ContentDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/ContentDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -31,6 +31,10 @@
private String m_id = "test";
private String m_title = "title";
+ /**
+ * Test id accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testID() throws Exception
{
ContentDirective directive =
@@ -39,6 +43,10 @@
assertEquals( "id", m_id, directive.getID() );
}
+ /**
+ * Test title accessor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testTitle() throws Exception
{
ContentDirective directive =
@@ -47,6 +55,10 @@
assertEquals( "title", m_title, directive.getTitle() );
}
+ /**
+ * Test illegal null id in constructor.
+ * @exception Exception if an error occurs during setup.
+ */
public void testNullID() throws Exception
{
try
@@ -61,6 +73,10 @@
}
}
+ /**
+ * Test null title.
+ * @exception Exception if an error occurs during setup.
+ */
public void testNullTitle() throws Exception
{
ContentDirective directive =
@@ -68,6 +84,10 @@
assertEquals( "title", m_id, directive.getTitle() );
}
+ /**
+ * Test serialization.
+ * @exception Exception if an error occurs during setup.
+ */
public void testSerialization() throws Exception
{
ContentDirective directive =
@@ -75,6 +95,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test encoding.
+ * @exception Exception if an error occurs during setup.
+ */
public void testEncoding() throws Exception
{
ContentDirective directive =
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/HostDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/HostDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/HostDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -40,6 +40,10 @@
private String m_scheme = "";
private String m_prompt = "";
+ /**
+ * Test id accessor.
+ * @exception Exception if an error occurs
+ */
public void testID() throws Exception
{
HostDirective directive =
@@ -49,6 +53,10 @@
assertEquals( "id", m_id, directive.getID() );
}
+ /**
+ * Test priority accessor.
+ * @exception Exception if an error occurs
+ */
public void testPriority() throws Exception
{
HostDirective directive =
@@ -58,6 +66,10 @@
assertEquals( "priority", m_priority, directive.getPriority() );
}
+ /**
+ * Test host accessor.
+ * @exception Exception if an error occurs
+ */
public void testHost() throws Exception
{
HostDirective directive =
@@ -67,6 +79,10 @@
assertEquals( "host", m_host, directive.getHost() );
}
+ /**
+ * Test index accessor.
+ * @exception Exception if an error occurs
+ */
public void testIndex() throws Exception
{
HostDirective directive =
@@ -76,6 +92,10 @@
assertEquals( "index", m_index, directive.getIndex() );
}
+ /**
+ * Test username accessor.
+ * @exception Exception if an error occurs
+ */
public void testUsername() throws Exception
{
HostDirective directive =
@@ -85,6 +105,10 @@
assertEquals( "username", m_username, directive.getUsername() );
}
+ /**
+ * Test password accessor.
+ * @exception Exception if an error occurs
+ */
public void testPassword() throws Exception
{
HostDirective directive =
@@ -94,6 +118,10 @@
assertEquals( "password", m_password, directive.getPassword() );
}
+ /**
+ * Test layout accessor.
+ * @exception Exception if an error occurs
+ */
public void testLayout() throws Exception
{
HostDirective directive =
@@ -103,6 +131,10 @@
assertEquals( "layout", m_layout, directive.getLayout() );
}
+ /**
+ * Test enabled accessor.
+ * @exception Exception if an error occurs
+ */
public void testEnabled() throws Exception
{
HostDirective directive =
@@ -117,6 +149,10 @@
assertFalse( "enabled", directive.getEnabled() );
}
+ /**
+ * Test trusted accessor.
+ * @exception Exception if an error occurs
+ */
public void testTrusted() throws Exception
{
HostDirective directive =
@@ -131,6 +167,10 @@
assertFalse( "trusted", directive.getTrusted() );
}
+ /**
+ * Test scheme accessor.
+ * @exception Exception if an error occurs
+ */
public void testScheme() throws Exception
{
HostDirective directive =
@@ -140,6 +180,10 @@
assertEquals( "scheme", m_scheme, directive.getScheme() );
}
+ /**
+ * Test prompt accessor.
+ * @exception Exception if an error occurs
+ */
public void testPrompt() throws Exception
{
HostDirective directive =
@@ -149,6 +193,10 @@
assertEquals( "prompt", m_prompt, directive.getPrompt() );
}
+ /**
+ * Test invalid null id in constructor.
+ * @exception Exception if an error occurs
+ */
public void testNullID() throws Exception
{
try
@@ -165,6 +213,10 @@
}
}
+ /**
+ * Test null host in constructor.
+ * @exception Exception if an error occurs
+ */
public void testNullHost() throws Exception
{
try
@@ -181,6 +233,10 @@
}
}
+ /**
+ * Test null layout in constructor.
+ * @exception Exception if an error occurs
+ */
public void testNullLayout() throws Exception
{
try
@@ -197,6 +253,10 @@
}
}
+ /**
+ * Test serialization.
+ * @exception Exception if an error occurs
+ */
public void testSerialization() throws Exception
{
HostDirective directive =
@@ -206,6 +266,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test encoding.
+ * @exception Exception if an error occurs
+ */
public void testEncoding() throws Exception
{
HostDirective directive =
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/LayoutDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/LayoutDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/LayoutDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -31,6 +31,10 @@
private String m_id = "test";
private String m_title = "title";
+ /**
+ * Test id accessor.
+ * @exception Exception if an error occurs
+ */
public void testID() throws Exception
{
LayoutDirective directive =
@@ -39,6 +43,10 @@
assertEquals( "id", m_id, directive.getID() );
}
+ /**
+ * Test title accessor.
+ * @exception Exception if an error occurs
+ */
public void testTitle() throws Exception
{
LayoutDirective directive =
@@ -47,6 +55,10 @@
assertEquals( "title", m_title, directive.getTitle() );
}
+ /**
+ * Test invalid null id in constructor.
+ * @exception Exception if an error occurs
+ */
public void testNullID() throws Exception
{
try
@@ -61,6 +73,10 @@
}
}
+ /**
+ * Test null title in constructor.
+ * @exception Exception if an error occurs
+ */
public void testNullTitle() throws Exception
{
LayoutDirective directive =
@@ -68,6 +84,10 @@
assertEquals( "title", m_id, directive.getTitle() );
}
+ /**
+ * Test serailization.
+ * @exception Exception if an error occurs
+ */
public void testSerialization() throws Exception
{
LayoutDirective directive =
@@ -75,6 +95,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test encoding.
+ * @exception Exception if an error occurs
+ */
public void testEncoding() throws Exception
{
LayoutDirective directive =
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/ProxyDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/ProxyDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/ProxyDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -33,6 +33,10 @@
private String m_username;
private char[] m_password;
+ /**
+ * Test case setup.
+ * @exception Exception if an error occurs
+ */
public void setUp() throws Exception
{
m_host = "http://localhost:1234";
@@ -41,30 +45,50 @@
m_password = new char[]{'r','o','b','i','n'};
}
+ /**
+ * Test proxy host accessor.
+ * @exception Exception if an error occurs
+ */
public void testHost() throws Exception
{
ProxyDirective directive = new ProxyDirective( m_host, m_excludes,
m_username, m_password );
assertEquals( "host", m_host, directive.getHost() );
}
+ /**
+ * Test proxy excludes accessor.
+ * @exception Exception if an error occurs
+ */
public void testExcludes() throws Exception
{
ProxyDirective directive = new ProxyDirective( m_host, m_excludes,
m_username, m_password );
assertEquals( "excludes", m_excludes, directive.getExcludes() );
}
+ /**
+ * Test proxy username accessor.
+ * @exception Exception if an error occurs
+ */
public void testUsername() throws Exception
{
ProxyDirective directive = new ProxyDirective( m_host, m_excludes,
m_username, m_password );
assertEquals( "username", m_username, directive.getUsername() );
}
+ /**
+ * Test proxy password accessor.
+ * @exception Exception if an error occurs
+ */
public void testPassword() throws Exception
{
ProxyDirective directive = new ProxyDirective( m_host, m_excludes,
m_username, m_password );
assertEquals( "password", m_password, directive.getPassword() );
}
+ /**
+ * Test allowanble null arguments.
+ * @exception Exception if an error occurs
+ */
public void testAllowableNullArguments() throws Exception
{
String host = "http://localhost:1234";
@@ -78,6 +102,10 @@
assertEquals( "password", password, directive.getPassword() );
}
+ /**
+ * Test illegal null host argument combination.
+ * @exception Exception if an error occurs
+ */
public void testNullHost() throws Exception
{
String host = null;
@@ -95,6 +123,10 @@
}
}
+ /**
+ * Test classic serialization.
+ * @exception Exception if an error occurs
+ */
public void testClassicSerialization() throws Exception
{
String host = "http://localhost:1234";
@@ -105,6 +137,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test classic encoding.
+ * @exception Exception if an error occurs
+ */
public void testClassicEncoding() throws Exception
{
String host = "http://localhost:1234";
@@ -116,6 +152,10 @@
assertEquals( "encoded", directive, result );
}
+ /**
+ * Test serailization with null fields.
+ * @exception Exception if an error occurs
+ */
public void testNullSerialization() throws Exception
{
String host = "http://localhost:1234";
@@ -126,6 +166,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test encoding with null fields.
+ * @exception Exception if an error occurs
+ */
public void testNullEncoding() throws Exception
{
String host = "http://localhost:1234";
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/TransitDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/TransitDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/TransitDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -32,6 +32,10 @@
private ProxyDirective m_proxy;
private TransitDirective m_directive;
+ /**
+ * Test case setup.
+ * @exception Exception if an error occurs
+ */
public void setUp() throws Exception
{
m_proxy =
@@ -47,22 +51,37 @@
m_proxy, m_cache );
}
-
+ /**
+ * Test proxy directive accessor.
+ * @exception Exception if an error occurs
+ */
public void testProxyDirective() throws Exception
{
assertEquals( "proxy", m_proxy, m_directive.getProxyDirective() );
}
+ /**
+ * Test cache directive accessor.
+ * @exception Exception if an error occurs
+ */
public void testCacheDirective() throws Exception
{
assertEquals( "cache", m_cache, m_directive.getCacheDirective() );
}
+ /**
+ * Test directive serialization.
+ * @exception Exception if an error occurs
+ */
public void testSerialization() throws Exception
{
doSerializationTest( m_directive );
}
+ /**
+ * Test directive encoding.
+ * @exception Exception if an error occurs
+ */
public void testEncoding() throws Exception
{
TransitDirective result = (TransitDirective) doEncodingTest(
m_directive, "transit.xml" );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/info/ValueDirectiveTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/info/ValueDirectiveTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/info/ValueDirectiveTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -31,10 +31,10 @@
*/
public final class ValueDirectiveTestCase extends AbstractTestCase
{
-
/**
* Validate the creation of a value directrive using a single null
argument
* and the resolution of the value by a Construct to a null.
+ * @exception Exception if an error occurs
*/
public void testNullValue() throws Exception
{
@@ -54,6 +54,7 @@
* Validate the creation of a value directrive using a single non-null
* String argument and the resolution of the value by a construct to the
* same value.
+ * @exception Exception if an error occurs
*/
public void testValue() throws Exception
{
@@ -74,6 +75,7 @@
* String argument that is itself a symbolic reference, and confirm that
* and the resolution of the value by a construct returns the expected
* resolve symbol.
+ * @exception Exception if an error occurs
*/
public void testSymbolicValue() throws Exception
{
@@ -87,6 +89,7 @@
/**
* Validate the ValueDirective( String target, String value )
constructor.
+ * @exception Exception if an error occurs
*/
public void testTargetValueConstructor() throws Exception
{
@@ -104,6 +107,7 @@
/**
* Validate the ValueDirective( String target, String method, String
value ) constructor.
+ * @exception Exception if an error occurs
*/
public void testTargetMethodValueConstructor() throws Exception
{
@@ -122,6 +126,7 @@
/**
* Validate the ValueDirective( String target, ValueDirective[] args )
constructor.
+ * @exception Exception if an error occurs
*/
public void testTargetValuesConstructor() throws Exception
{
@@ -142,6 +147,7 @@
/**
* Validate the ValueDirective( String target, String method,
ValueDirective[] args ) constructor.
+ * @exception Exception if an error occurs
*/
public void testTargetMethodValuesConstructor() throws Exception
{
@@ -161,6 +167,9 @@
assertEquals( "resolved", new File( new File( "." ), "test" ),
construct.resolve() );
}
+ /**
+ * Validate equality operation.
+ */
public void testEquals()
{
ValueDirective base = new ValueDirective( "java.io.File", "." );
@@ -180,6 +189,10 @@
}
}
+ /**
+ * Test serialization.
+ * @exception Exception if an error occurs
+ */
public void testSerialization() throws Exception
{
String target = "java.io.File";
@@ -190,6 +203,10 @@
doSerializationTest( directive );
}
+ /**
+ * Test encoding.
+ * @exception Exception if an error occurs
+ */
public void testEncoding() throws Exception
{
String target = "java.io.File";
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/test/AbstractEncodingTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/AbstractEncodingTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/test/AbstractEncodingTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -38,13 +38,20 @@
import junit.framework.TestCase;
/**
- * EntryDescriptorTestCase does XYZ
+ * AbstractEncodingTestCase.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id: EntryDescriptorTestCase.java 2387 2005-04-23 19:12:58Z
mcconnell AT dpml.net $
*/
public abstract class AbstractEncodingTestCase extends TestCase
{
+ /**
+ * Utility operation to encode and decode an supplied object using an
intermidiate file.
+ * @param object the object to enciode
+ * @param filename the intermidiate filename resolved relative to the
target/test directory
+ * @return the result of decoding the encoded structure
+ * @exception Exception if an error occurs
+ */
public Object executeEncodingTest( Object object, String filename )
throws Exception
{
File test = new File( "target/test" );
@@ -73,8 +80,17 @@
return result;
}
+ /**
+ * Internal persitance delage for the URI class.
+ */
public static class URIPersistenceDelegate extends
DefaultPersistenceDelegate
{
+ /**
+ * Create an expression using an existing uri.
+ * @param old the old uri
+ * @param encoder the encoder
+ * @return the expression
+ */
public Expression instantiate( Object old, Encoder encoder )
{
URI uri = (URI) old;
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/test/ArtifactTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/ArtifactTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/test/ArtifactTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -25,22 +25,26 @@
import net.dpml.transit.Artifact;
/**
- * Create of a new Artifact test case.
+ * Artifact test case.
*
* @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
* @version $Id: ArtifactTestCase.java 2900 2005-06-22 19:10:15Z
mcconnell AT dpml.net $
*/
public class ArtifactTestCase extends TestCase
{
- /**
- * Constructor for ArtifactReferenceTest.
- * @param name the test name
- */
+ /**
+ * Constructor for ArtifactReferenceTest.
+ * @param name the test name
+ */
public ArtifactTestCase( String name )
{
super( name );
}
+ /**
+ * Test invalid null path argument.
+ * @exception Exception if an unexpected error occurs
+ */
public void testNullPathConstructor() throws Exception
{
try
@@ -54,6 +58,10 @@
}
}
+ /**
+ * Test invalid protocol in artifact specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testMissingProtocol() throws Exception
{
try
@@ -67,6 +75,10 @@
}
}
+ /**
+ * Test invalid group specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testBadGroup() throws Exception
{
try
@@ -80,6 +92,10 @@
}
}
+ /**
+ * Test invalid group specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testAnotherBadGroup() throws Exception
{
try
@@ -93,6 +109,10 @@
}
}
+ /**
+ * Test invalid version specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testBadVersion() throws Exception
{
try
@@ -107,12 +127,20 @@
}
}
+ /**
+ * Test full specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testFullSpec() throws Exception
{
Artifact artifact = Artifact.createArtifact(
"artifact:jar:group/sub-group/name#version");
verify( artifact, "group/sub-group", "name", "jar", "version" );
}
+ /**
+ * Test leading slash in specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testLeadingSlash() throws Exception
{
try
@@ -120,10 +148,17 @@
String form = "artifact:jar:/group/sub-group/name#version";
Artifact artifact = Artifact.createArtifact( form );
fail( "illegal format not caught: " + artifact );
- } catch( IllegalArgumentException e )
- {}
+ }
+ catch( IllegalArgumentException e )
+ {
+ // success
+ }
}
+ /**
+ * Test invalid missing type in specification.
+ * @exception Exception if an unexpected error occurs
+ */
public void testMissingType() throws Exception
{
String form = "artifact:group/sub-group/name#version";
@@ -131,16 +166,27 @@
{
Artifact artifact = Artifact.createArtifact( form );
fail( "illegal format not caught: " + artifact );
- } catch( IllegalArgumentException e )
- {}
+ }
+ catch( IllegalArgumentException e )
+ {
+ // success
+ }
}
+ /**
+ * Test null version.
+ * @exception Exception if an unexpected error occurs
+ */
public void testNullVersion() throws Exception
{
Artifact artifact = Artifact.createArtifact(
"artifact:jar:group/sub-group/name");
verify( artifact, "group/sub-group", "name", "jar", null );
}
+ /**
+ * Test null version and null type.
+ * @exception Exception if an unexpected error occurs
+ */
public void testNullVersionAndNullType() throws Exception
{
String form = "artifact:group/sub-group/name";
@@ -148,10 +194,17 @@
{
Artifact artifact = Artifact.createArtifact( form );
fail( "illegal format not caught: " + artifact );
- } catch( IllegalArgumentException e )
- {}
+ }
+ catch( IllegalArgumentException e )
+ {
+ // success
+ }
}
+ /**
+ * Test missing group.
+ * @exception Exception if an unexpected error occurs
+ */
public void testMissingGroup() throws Exception
{
try
@@ -165,6 +218,10 @@
}
}
+ /**
+ * Test missing group without type.
+ * @exception Exception if an unexpected error occurs
+ */
public void testMissingGroupWithoutType() throws Exception
{
try
@@ -178,12 +235,20 @@
}
}
+ /**
+ * Test zero length version.
+ * @exception Exception if an unexpected error occurs
+ */
public void testZeroLengthVersion() throws Exception
{
Artifact artifact = Artifact.createArtifact(
"artifact:jar:group/sub-group/name#");
verify( artifact, "group/sub-group", "name", "jar", null );
}
+ /**
+ * Test url external form.
+ * @exception Exception if an unexpected error occurs
+ */
public void testExternalForm() throws Exception
{
final String spec = "artifact:jar:group/sub-group/name#version";
@@ -191,6 +256,10 @@
assertEquals( artifact.toString(), spec );
}
+ /**
+ * Test internal reference.
+ * @exception Exception if an unexpected error occurs
+ */
public void testInternalReference1() throws Exception
{
final String spec = "artifact:jar:group/sub-group/name#version";
@@ -199,6 +268,10 @@
assertEquals( spec, artifact.toString() );
}
+ /**
+ * Test internal reference.
+ * @exception Exception if an unexpected error occurs
+ */
public void testInternalReference2() throws Exception
{
final String spec = "artifact:jar:group/sub-group/name#version";
@@ -207,6 +280,10 @@
assertEquals( spec, artifact.toString() );
}
+ /**
+ * Test external form.
+ * @exception Exception if an unexpected error occurs
+ */
public void testExternalFormWithNonDefaultType() throws Exception
{
final String spec = "artifact:block:group/sub-group/name#version";
@@ -214,6 +291,10 @@
assertEquals( spec, spec, artifact.toString() );
}
+ /**
+ * Test equality operation.
+ * @exception Exception if an unexpected error occurs
+ */
public void testEquality() throws Exception
{
final String spec = "artifact:jar:group/sub-group/name#version";
@@ -222,6 +303,10 @@
assertTrue( spec, artifact1.equals( artifact2 ) );
}
+ /**
+ * Test equality operation.
+ * @exception Exception if an unexpected error occurs
+ */
public void testInequality() throws Exception
{
final String spec1 = "artifact:jar:group/sub-group/name#version";
@@ -231,6 +316,10 @@
assertFalse( artifact1.equals( artifact2 ) );
}
+ /**
+ * Test equality operation.
+ * @exception Exception if an unexpected error occurs
+ */
public void testInequalityOnType() throws Exception
{
final String spec1 = "artifact:jar:group/sub-group/name#version";
@@ -240,6 +329,10 @@
assertFalse( artifact1.equals( artifact2 ) );
}
+ /**
+ * Test comparability.
+ * @exception Exception if an unexpected error occurs
+ */
public void testComparability1() throws Exception
{
final String spec1 = "artifact:jar:aaa/name";
@@ -253,6 +346,10 @@
assertTrue( artifact2.compareTo( artifact2 ) == 0 );
}
+ /**
+ * Test comparability.
+ * @exception Exception if an unexpected error occurs
+ */
public void testComparability2() throws Exception
{
final String spec1 = "artifact:jar:aaa/name";
@@ -268,6 +365,14 @@
assertTrue( artifact2.compareTo( artifact4 ) == 0 );
}
+ /**
+ * Utility method to verify an artifact.
+ * @param artifact the artifact to verify
+ * @param group the group
+ * @param name the name
+ * @param type the type
+ * @param version the version
+ */
public void verify( Artifact artifact, String group, String name, String
type, String version )
{
assertEquals( "group", group, artifact.getGroup() );
@@ -292,6 +397,10 @@
}
}
+ /**
+ * Utility method to list an artifact to console.
+ * @param artifact the artifact to verify
+ */
public void list( Artifact artifact )
{
System.out.println( "GROUP: " + artifact.getGroup() );
Modified:
trunk/main/transit/core/src/test/net/dpml/transit/test/ConstructTestCase.java
===================================================================
---
trunk/main/transit/core/src/test/net/dpml/transit/test/ConstructTestCase.java
2006-01-08 20:00:37 UTC (rev 879)
+++
trunk/main/transit/core/src/test/net/dpml/transit/test/ConstructTestCase.java
2006-01-08 21:15:57 UTC (rev 880)
@@ -37,6 +37,10 @@
*/
public class ConstructTestCase extends AbstractEncodingTestCase
{
+ /**
+ * Test creation of a simple construct.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testSimpleConstruct() throws Exception
{
Construct construct = new Construct( "fred" );
@@ -49,6 +53,10 @@
assertEquals( "simple construct value", value, "fred" );
}
+ /**
+ * Test creation of a construct using a null value.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testNullArgConstruct() throws Exception
{
Construct construct = new Construct( Date.class.getName(), (String)
null );
@@ -56,6 +64,10 @@
assertEquals( "isa-data", value.getClass(), Date.class );
}
+ /**
+ * Test creation of a construct using a primitive type.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testPrimitiveConstruct() throws Exception
{
Construct construct = new Construct( "int", "10" );
@@ -64,6 +76,10 @@
assertEquals( "isa-Integer", Integer.class, value.getClass() );
}
+ /**
+ * Test creation of a construct using a single typed argument.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testSingleArgConstruct() throws Exception
{
Construct construct = new Construct( File.class.getName(), "abc" );
@@ -72,24 +88,10 @@
assertEquals( "file", value, new File( "abc" ) );
}
- /*
- public void testMultiArgConstruct() throws Exception
- {
- Value a = new Construct( File.class.getName(), "aaa" );
- Value b = new Construct( File.class.getName(), "${java.io.tmpdir}" );
- java.beans.XMLEncoder encoder = new java.beans.XMLEncoder(
System.out );
- encoder.writeObject( b );
- encoder.close();
- Value c = new Construct( Context.class.getName(), new Value[]{a, b}
);
-
- Object value = c.resolve();
- assertEquals( "isa-context", value.getClass(), Context.class );
- Context context = (Context) value;
- assertEquals( "file-a", context.getA(), new File( "aaa" ) );
- assertEquals( "file-b", context.getB(), new File(
System.getProperty( "java.io.tmpdir" ) ) );
- }
+ /**
+ * Test creation of a construct using a multiple primitate arguments.
+ * @exception Exception if an unexpected error occurs.
*/
-
public void testPrimitiveMultiArgConstruct() throws Exception
{
Value a = new Construct( "int", "100" );
@@ -110,6 +112,10 @@
}
}
+ /**
+ * Test creation of a construct using a static method operator.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testStaticMethod() throws Exception
{
Value v = new Construct( Context2.class.getName(), "create", new
Value[0] );
@@ -127,7 +133,11 @@
fail( "context2 logical return value is not 'true'" );
}
}
-
+
+ /**
+ * Test creation of a construct using a static field operator.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testStaticField() throws Exception
{
Value v = new Construct( Color.class.getName(), "RED", (String) null
);
@@ -135,6 +145,10 @@
assertEquals( "color", Color.RED, value );
}
+ /**
+ * Test creation of a composite construct using a static field operator.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testStaticFieldInComposite() throws Exception
{
Value v = new Construct( Color.class.getName(), "RED", new Value[0]
);
@@ -142,6 +156,10 @@
assertEquals( "color", Color.RED, value );
}
+ /**
+ * Test creation of a construct using a symbolic reference.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testSymbolicReference() throws Exception
{
Map map = new Hashtable();
@@ -152,6 +170,10 @@
assertEquals( "value", file, value );
}
+ /**
+ * Test creation of a construct using a typed symbolic reference.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testTypedSymbolicReference() throws Exception
{
Map map = new Hashtable();
@@ -177,6 +199,10 @@
}
}
+ /**
+ * Test construct encoding.
+ * @exception Exception if an unexpected error occurs.
+ */
public void testEncoding() throws Exception
{
Value number = new Construct( "int", "${number}" );
@@ -186,53 +212,88 @@
assertEquals( "encoding", construct, result );
}
+ /**
+ * Mock class.
+ */
public static class Context
{
private File m_a;
private File m_b;
+ /**
+ * Creation of a mock composite argument object.
+ * @param a the primary argument
+ * @param b the secondary argument
+ */
public Context( File a, File b )
{
m_a = a;
m_b = b;
}
+ /**
+ * Return the primary argument.
+ * @return the primary argument value
+ */
public File getA()
{
return m_a;
}
+ /**
+ * Return the secondary argument.
+ * @return the secondary argument value
+ */
public File getB()
{
return m_b;
}
}
+ /**
+ * Another mock class.
+ */
public static class Context2
{
private int m_number;
private boolean m_logical;
+ /**
+ * Static constructor method.
+ * @return an instance
+ */
public static Context2 create()
{
return new Context2( 100, true );
}
+ /**
+ * Creation of a mock object using primiative arguments.
+ * @param number a primitive number
+ * @param logical a boolean value
+ */
public Context2( int number, boolean logical )
{
m_number = number;
m_logical = logical;
}
+ /**
+ * Return the number.
+ * @return the number
+ */
public int getNumber()
{
return m_number;
}
+ /**
+ * Return the boolean.
+ * @return the boolean
+ */
public boolean getLogical()
{
return m_logical;
}
}
-
}
- r880 - in trunk/main: metro/test/src/test/net/dpml/metro/runtime/test transit/core/src/test/net/dpml/transit transit/core/src/test/net/dpml/transit/info transit/core/src/test/net/dpml/transit/test, mcconnell at BerliOS, 01/08/2006
Archive powered by MHonArc 2.6.24.