Skip to Content.
Sympa Menu

notify-dpml - r877 - in trunk/main/metro/part: api/src/test/net/dpml api/src/test/net/dpml/part/test test/src/test/net/dpml/test/part

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r877 - in trunk/main/metro/part: api/src/test/net/dpml api/src/test/net/dpml/part/test test/src/test/net/dpml/test/part
  • Date: Sun, 8 Jan 2006 14:21:28 +0100

Author: mcconnell
Date: 2006-01-08 14:21:24 +0100 (Sun, 08 Jan 2006)
New Revision: 877

Added:

trunk/main/metro/part/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
Removed:
trunk/main/metro/part/api/src/test/net/dpml/metro/
trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java
Modified:
trunk/main/metro/part/api/src/test/net/dpml/part/test/PartTestCase.java
Log:
clear checkstyle issues in metro/part/*

Modified:
trunk/main/metro/part/api/src/test/net/dpml/part/test/PartTestCase.java
===================================================================
--- trunk/main/metro/part/api/src/test/net/dpml/part/test/PartTestCase.java
2006-01-08 13:03:00 UTC (rev 876)
+++ trunk/main/metro/part/api/src/test/net/dpml/part/test/PartTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
@@ -19,19 +19,6 @@
package net.dpml.part.test;

import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.beans.Encoder;
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.beans.ExceptionListener;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
import java.beans.SimpleBeanInfo;
import java.beans.BeanDescriptor;
import java.beans.DefaultPersistenceDelegate;
@@ -47,13 +34,18 @@


/**
- * Validation of the Part datatype.
+ * Part datastructure testcase.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
*/
public class PartTestCase extends TestCase
{
+ /**
+ * Validate that the constructor throws a NPE in the event of
+ * a null controller uri argument.
+ * @exception Exception if an error occurs
+ */
public void testNullControllerURI() throws Exception
{
try
@@ -67,6 +59,11 @@
}
}

+ /**
+ * Validate that the constructor throws a NPE in the event of
+ * a null properties argument.
+ * @exception Exception if an error occurs
+ */
public void testNullProperties() throws Exception
{
try
@@ -80,21 +77,10 @@
}
}

- /*
- public void testNullDirective() throws Exception
- {
- try
- {
- Part part = new Part( new URI( "test:controller" ), new
Properties(), null );
- fail( "No NPE on null directive" );
- }
- catch( NullPointerException e )
- {
- // success
- }
- }
+ /**
+ * Test controller accessor.
+ * @exception Exception if an error occurs
*/
-
public void testControllerURI() throws Exception
{
URI uri = new URI( "link:plugin:abc/def" );
@@ -102,6 +88,10 @@
assertEquals( "uri", uri, part.getControllerURI() );
}

+ /**
+ * Test properties accessor.
+ * @exception Exception if an error occurs
+ */
public void testProperties() throws Exception
{
URI uri = new URI( "link:plugin:abc/def" );
@@ -111,6 +101,10 @@
assertEquals( "properties", properties, part.getProperties() );
}

+ /**
+ * Test directive features.
+ * @exception Exception if an error occurs
+ */
public void testDirective() throws Exception
{
URI uri = new URI( "link:plugin:abc/def" );
@@ -121,6 +115,10 @@
assertEquals( "directive", directive, part.getDirective() );
}

+ /**
+ * Test part builder.
+ * @exception Exception if an error occurs
+ */
public void testPartBuildReadWrite() throws Exception
{
String base = System.getProperty( "project.test.dir" );
@@ -140,18 +138,42 @@
assertEquals( "part", part, p );
}

+ /**
+ * Mock directive.
+ */
public static final class DemoDirective implements Directive
{
+ /**
+ * Compare this mock object with another for equality.
+ * @param other the other object
+ * @return true if equal
+ */
public boolean equals( Object other )
{
return ( other instanceof DemoDirective );
}
+
+ /**
+ * Return the instance hashcode.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ return getClass().hashCode();
+ }
}
-
+
+ /**
+ * Utility demo directive persistence delegate.
+ */
public static final class DemoDirectiveBeanInfo extends SimpleBeanInfo
{
private static final BeanDescriptor BEAN_DESCRIPTOR =
setupBeanDescriptor();

+ /**
+ * Return the bean descriptor.
+ * @return the bean descriptor
+ */
public BeanDescriptor getBeanDescriptor()
{
return BEAN_DESCRIPTOR;

Copied:
trunk/main/metro/part/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
(from rev 866,
trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java)
===================================================================
--- trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java
2006-01-06 21:32:54 UTC (rev 866)
+++
trunk/main/metro/part/test/src/test/net/dpml/test/part/PartLoadingTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2005 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.test.part;
+
+import java.io.File;
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import net.dpml.part.Directive;
+import net.dpml.part.Controller;
+
+/**
+ * Testcase validating part loading from a uri.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class PartLoadingTestCase extends TestCase
+{
+ private static final Controller CONTROLLER = Controller.STANDARD;
+
+ private URI m_uri;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ final String path = "test.part";
+ final File test = new File( System.getProperty( "project.test.dir" )
);
+ m_uri = new File( test, path ).toURI();
+ }
+
+ /**
+ * Test part loading via a controller.
+ * @exception Exception if an error occurs
+ */
+ public void testPartLoading() throws Exception
+ {
+ Directive directive = CONTROLLER.loadDirective( m_uri );
+ String classname = directive.getClass().getName();
+ assertEquals( "directive-classname",
"net.dpml.metro.data.ComponentDirective", classname );
+ }
+}

Deleted:
trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java
===================================================================
--- trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java
2006-01-08 13:03:00 UTC (rev 876)
+++ trunk/main/metro/part/test/src/test/net/dpml/test/part/PartTestCase.java
2006-01-08 13:21:24 UTC (rev 877)
@@ -1,75 +0,0 @@
-/*
- * Copyright 2005 Stephen J. McConnell.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.dpml.test.part;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.beans.Encoder;
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.beans.ExceptionListener;
-import java.beans.Expression;
-import java.beans.PersistenceDelegate;
-import java.beans.SimpleBeanInfo;
-import java.beans.BeanDescriptor;
-import java.beans.DefaultPersistenceDelegate;
-import java.net.URI;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import net.dpml.part.Part;
-import net.dpml.part.PartBuilder;
-import net.dpml.part.PartHeader;
-import net.dpml.part.Directive;
-import net.dpml.part.Controller;
-
-
-/**
- * Validation of the Part datatype.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class PartTestCase extends TestCase
-{
- private static final Controller CONTROLLER = Controller.STANDARD;
-
- private URI m_uri;
-
- public void setUp() throws Exception
- {
- final String path = "test.part";
- final File test = new File( System.getProperty( "project.test.dir" )
);
- m_uri = new File( test, path ).toURI();
- }
-
- public void testPartBuildReadWrite() throws Exception
- {
- Directive directive = CONTROLLER.loadDirective( m_uri );
- String classname = directive.getClass().getName();
- assertEquals( "directive-classname",
"net.dpml.metro.data.ComponentDirective", classname );
- }
-}




  • r877 - in trunk/main/metro/part: api/src/test/net/dpml api/src/test/net/dpml/part/test test/src/test/net/dpml/test/part, mcconnell at BerliOS, 01/08/2006

Archive powered by MHonArc 2.6.24.

Top of Page