Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1942 - in development/main/metro: . unit/src/main/net/dpml/metro/unit

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1942 - in development/main/metro: . unit/src/main/net/dpml/metro/unit
  • Date: Fri, 04 Mar 2005 08:47:11 +0100

Author: niclas
Date: Fri Mar 4 08:47:11 2005
New Revision: 1942

Added:

development/main/metro/unit/src/main/net/dpml/metro/unit/TestConfigurationBuilder.java
(contents, props changed)

development/main/metro/unit/src/main/net/dpml/metro/unit/TestParametersBuilder.java
(contents, props changed)
Modified:
development/main/metro/index.xml
development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
Log:
Added explicit unit testing support for creation of Parameters and
Configuration instances.

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Fri Mar 4 08:47:11 2005
@@ -274,12 +274,16 @@
</info>
<dependencies>
<include key="dpml-composition-spi"/>
+ <include key="dpml-composition-impl" build="false"/>
+ <include key="dpml-configuration-api"/>
+ <include key="dpml-configuration-impl"/>
<include key="dpml-context-api"/>
<include key="dpml-context-impl"/>
- <include key="dpml-util-exception"/>
- <include key="dpml-composition-impl" build="false"/>
+ <include key="dpml-parameters-api"/>
+ <include key="dpml-parameters-impl"/>
<include key="dpml-service-api"/>
<include key="dpml-system-impl" build="false"/>
+ <include key="dpml-util-exception"/>
<include key="junit"/>
</dependencies>
</project>

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestConfigurationBuilder.java
==============================================================================
--- (empty file)
+++
development/main/metro/unit/src/main/net/dpml/metro/unit/TestConfigurationBuilder.java
Fri Mar 4 08:47:11 2005
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ * Copyright 2005 Niclas Hedhman
+ *
+ * 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.metro.unit;
+
+import net.dpml.configuration.impl.DefaultConfigurationBuilder;
+
+public class TestConfigurationBuilder extends DefaultConfigurationBuilder
+{
+}
\ No newline at end of file

Modified:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
==============================================================================
--- development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
(original)
+++ development/main/metro/unit/src/main/net/dpml/metro/unit/TestLogger.java
Fri Mar 4 08:47:11 2005
@@ -1,4 +1,5 @@
/*
+ * Copyright 2004 Stephen J. McConnell.
* Copyright 2005 Niclas Hedhman
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,6 +19,7 @@

package net.dpml.metro.unit;

+import java.io.PrintStream;
import java.util.Map;

import net.dpml.context.ContextException;
@@ -55,21 +57,15 @@
public static final int LEVEL_DISABLED = 5;

private final int m_logLevel;
-
- /**
- * Creates a new ConsoleLogger with the priority set to DEBUG.
- */
- public TestLogger()
- {
- this( LEVEL_DEBUG );
- }
+ private final PrintStream m_output;

/**
* Creates a new ConsoleLogger.
* @param logLevel log level typecode
*/
- public TestLogger( final int logLevel )
+ public TestLogger( PrintStream outputTo, final int logLevel )
{
+ m_output = outputTo;
m_logLevel = logLevel;
}

@@ -93,12 +89,12 @@
{
if( m_logLevel <= LEVEL_DEBUG )
{
- System.out.print( "[DEBUG] " );
- System.out.println( message );
+ m_output.print( "[DEBUG] " );
+ m_output.println( message );

if( null != throwable )
{
- throwable.printStackTrace( System.out );
+ throwable.printStackTrace( m_output );
}
}
}
@@ -133,12 +129,12 @@
{
if( m_logLevel <= LEVEL_INFO )
{
- System.out.print( "[INFO] " );
- System.out.println( message );
+ m_output.print( "[INFO] " );
+ m_output.println( message );

if( null != throwable )
{
- throwable.printStackTrace( System.out );
+ throwable.printStackTrace( m_output );
}
}
}
@@ -173,12 +169,12 @@
{
if( m_logLevel <= LEVEL_WARN )
{
- System.out.print( "[WARNING] " );
- System.out.println( message );
+ m_output.print( "[WARNING] " );
+ m_output.println( message );

if( null != throwable )
{
- throwable.printStackTrace( System.out );
+ throwable.printStackTrace( m_output );
}
}
}
@@ -213,12 +209,12 @@
{
if( m_logLevel <= LEVEL_ERROR )
{
- System.out.print( "[ERROR] " );
- System.out.println( message );
+ m_output.print( "[ERROR] " );
+ m_output.println( message );

if( null != throwable )
{
- throwable.printStackTrace( System.out );
+ throwable.printStackTrace( m_output );
}
}
}
@@ -253,12 +249,12 @@
{
if( m_logLevel <= LEVEL_FATAL )
{
- System.out.print( "[FATAL ERROR] " );
- System.out.println( message );
+ m_output.print( "[FATAL ERROR] " );
+ m_output.println( message );

if( null != throwable )
{
- throwable.printStackTrace( System.out );
+ throwable.printStackTrace( m_output );
}
}
}

Added:
development/main/metro/unit/src/main/net/dpml/metro/unit/TestParametersBuilder.java
==============================================================================
--- (empty file)
+++
development/main/metro/unit/src/main/net/dpml/metro/unit/TestParametersBuilder.java
Fri Mar 4 08:47:11 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ * Copyright 2005 Niclas Hedhman
+ *
+ * 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.metro.unit;
+
+import java.util.Map;
+
+import net.dpml.configuration.Configuration;
+
+import net.dpml.lang.NullArgumentException;
+
+import net.dpml.parameters.ParameterException;
+import net.dpml.parameters.Parameters;
+
+import net.dpml.parameters.impl.DefaultParameters;
+
+public class TestParametersBuilder
+{
+ /** Creates a Parameters object from the provided Map instance.
+ * @return a Parameters instance containing all the key/value pairs of
+ * the java.util.Map, mapped to name/value pairs in the
Parameters
+ * instance 1:1.
+ */
+ public static Parameters buildFromMap( Map map )
+ {
+ return new DefaultParameters( map );
+ }
+
+ /** Builds a Parameters object from the configuration object.
+ * @return a Parameters instance containing all the &lt;parameter&gt;
+ * elements of the provided Configuration instance.
+ */
+ public static Parameters buildFromConfiguration( Configuration conf )
+ throws ParameterException, NullArgumentException
+ {
+ return DefaultParameters.fromConfiguration( conf );
+ }
+}
\ No newline at end of file



  • svn commit: r1942 - in development/main/metro: . unit/src/main/net/dpml/metro/unit, niclas, 03/04/2005

Archive powered by MHonArc 2.6.24.

Top of Page