Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2204 - in development/main/metro: . automation/control/src/main/net/dpml/automation/model composition/control/src/main/net/dpml/composition/models composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/testing composition/unit/src/main/net/dpml/composition/unit

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2204 - in development/main/metro: . automation/control/src/main/net/dpml/automation/model composition/control/src/main/net/dpml/composition/models composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/testing composition/unit/src/main/net/dpml/composition/unit
  • Date: Mon, 04 Apr 2005 06:12:01 -0400

Author: mcconnell AT dpml.net
Date: Mon Apr 4 06:12:01 2005
New Revision: 2204

Added:

development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
Modified:

development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java

development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java

development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
development/main/metro/composition/testing/unit/ (props changed)
development/main/metro/composition/testing/unit/build.xml

development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionHelper.java
development/main/metro/index.xml
Log:
more housekeeping

Modified:
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
==============================================================================
---
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
(original)
+++
development/main/metro/automation/control/src/main/net/dpml/automation/model/Model.java
Mon Apr 4 06:12:01 2005
@@ -39,4 +39,7 @@

Controller getController();

+ Object resolve() throws Exception;
+
+ void release( Object object );
}

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/StandardComponentModel.java
Mon Apr 4 06:12:01 2005
@@ -174,6 +174,16 @@
}
}

+ public Object resolve() throws Exception
+ {
+ return getController().resolve( this );
+ }
+
+ public void release( Object object )
+ {
+ getController().release( object );
+ }
+
public String getLifestylePolicy()
{
return m_lifestyle;

Modified:
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
==============================================================================
---
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
(original)
+++
development/main/metro/composition/testing/acme/src/main/net/dpml/composition/testing/DefaultWidget.java
Mon Apr 4 06:12:01 2005
@@ -72,7 +72,7 @@
int width = m_context.getWidth();
int height = m_context.getHeight( 5024 );

- m_logger.debug(
+ m_logger.info(
foo
+ " established with a width of "
+ width

Modified: development/main/metro/composition/testing/unit/build.xml
==============================================================================
--- development/main/metro/composition/testing/unit/build.xml (original)
+++ development/main/metro/composition/testing/unit/build.xml Mon Apr 4
06:12:01 2005
@@ -5,24 +5,20 @@

<transit:import uri="artifact:template:dpml/magic/standard"/>

- <target name="init" depends="standard.init">
- <x:filter key="dpml-system-impl" feature="plugin"
token="SYSTEM-PLUGIN-URI"/>
- <x:property key="dpml-composition-testing-acme" feature="uri"
type="part" name="acme.part"/>
- <filter token="ACME-PART-URI" value="${acme.part}"/>
- </target>
-
<target name="build" depends="standard.build">

- <!--
- Setup a component dealing with experimental part handling.
- -->
+ <!-- simple component -->
<component xmlns="plugin:dpml/composition/dpml-composition-builder"
- name="gizmo"
- class="net.dpml.composition.testing.CompositeGizmo"
- dest="target/test/acme-gizmo.part">
- <parts>
- <component name="widget" uri="${acme.part}"/>
- </parts>
+ name="widget" class="net.dpml.composition.testing.DefaultWidget"
+ dest="target/test/acme-simple.part" >
+ <context>
+ <entry key="foo" value="bar"/>
+ <entry key="width" value="12"/>
+ <entry key="height" value="100"/>
+ <entry key="name" value="urn:metro:name"/>
+ <entry key="partition" value="urn:metro:partition"/>
+ <entry key="workingDirectory" value="acme/workspace"/>
+ </context>
</component>

</target>

Added:
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
==============================================================================
--- (empty file)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/composition/testing/SimpleTestCase.java
Mon Apr 4 06:12:01 2005
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ * Copyright 1999-2004 The Apache Software Foundation
+ *
+ * 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.composition.testing;
+
+import java.net.URI;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import net.dpml.automation.model.Model;
+import net.dpml.composition.unit.CompositionHelper;
+
+/**
+ * Test a simple component case.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Id: AbstractDescriptorTestCase.java 1556 2005-01-22 12:43:42Z
niclas $
+ */
+public class SimpleTestCase extends TestCase
+{
+ private static final String PATH = "acme-simple.part";
+
+ private CompositionHelper m_helper;
+
+ public void setUp() throws Exception
+ {
+ Hashtable map = new Hashtable();
+ map.put( "urn:transit.debug.policy", "true" );
+ m_helper = new CompositionHelper( map );
+ }
+
+ public void testSimple() throws Exception
+ {
+ URI uri = m_helper.toURI( PATH );
+ Model model = m_helper.getCompositionManager().addPart( uri );
+ Widget widget = (Widget) model.resolve();
+ widget.doWidgetTypeStuff();
+ model.release( widget );
+ }
+}

Modified:
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionHelper.java
==============================================================================
---
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionHelper.java
(original)
+++
development/main/metro/composition/unit/src/main/net/dpml/composition/unit/CompositionHelper.java
Mon Apr 4 06:12:01 2005
@@ -52,9 +52,33 @@
public class CompositionHelper
{
//------------------------------------------------------------------
+ // static
+ //------------------------------------------------------------------
+
+ public static File getTestWorkingDir()
+ {
+ String dir = System.getProperty( "project.test.dir" );
+ if( null == dir )
+ {
+ final String error =
+ "System property 'project.test.dir' is undefined.";
+ throw new IllegalStateException( error );
+ }
+ try
+ {
+ return new File( dir ).getCanonicalFile();
+ }
+ catch( IOException e )
+ {
+ return new File( dir );
+ }
+ }
+
+ //------------------------------------------------------------------
// state
//------------------------------------------------------------------

+ private SystemContext m_system;
private CompositionManager m_manager;

//------------------------------------------------------------------
@@ -71,10 +95,15 @@
this( base, new Hashtable() );
}

+ public CompositionHelper( Map map ) throws Exception
+ {
+ this( getTestWorkingDir(), map );
+ }
+
public CompositionHelper( File base, Map map ) throws Exception
{
- SystemContext system = createSystemContext( map, base );
- m_manager = new CompositionManager( system );
+ m_system = createSystemContext( map, base );
+ m_manager = new CompositionManager( m_system );
}

//------------------------------------------------------------------
@@ -86,6 +115,20 @@
return m_manager;
}

+ public URI toURI( String path )
+ {
+ try
+ {
+ File base = m_system.getWorkingDirectory();
+ File target = new File( base, path );
+ return target.toURI();
+ }
+ catch( Throwable e )
+ {
+ return null;
+ }
+ }
+
/**
* Setup the system context.
*
@@ -106,25 +149,6 @@
return factory.createSystemContext( criteria );
}

- public static File getTestWorkingDir()
- {
- String dir = System.getProperty( "project.test.dir" );
- if( null == dir )
- {
- final String error =
- "System property 'project.test.dir' is undefined.";
- throw new IllegalStateException( error );
- }
- try
- {
- return new File( dir ).getCanonicalFile();
- }
- catch( IOException e )
- {
- return new File( dir );
- }
- }
-
private static final URI SYSTEM_PLUGIN_URI = createStaticURI(
"@SYSTEM-PLUGIN-URI@" );

private static URI createStaticURI( String path )

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Mon Apr 4 06:12:01 2005
@@ -478,7 +478,7 @@

<project basedir="composition/unit">
<info>
- <group>dpml/test</group>
+ <group>dpml/tools</group>
<name>dpml-composition-unit</name>
<version>1.0.0</version>
<status>SNAPSHOT</status>
@@ -520,11 +520,12 @@
<version>1.0.0</version>
<status>SNAPSHOT</status>
<types>
- <type>jar</type>
+ <type>test</type>
</types>
</info>
<dependencies>
- <include key="dpml-composition-unit"/>
+ <include key="dpml-composition-testing-acme"/>
+ <include key="dpml-composition-unit" runtime="false"/>
</dependencies>
<plugins>
<include key="dpml-composition-builder"/>



  • svn commit: r2204 - in development/main/metro: . automation/control/src/main/net/dpml/automation/model composition/control/src/main/net/dpml/composition/models composition/testing/acme/src/main/net/dpml/composition/testing composition/testing/unit composition/testing/unit/src/test/net/dpml/composition/testing composition/unit/src/main/net/dpml/composition/unit, mcconnell, 04/03/2005

Archive powered by MHonArc 2.6.24.

Top of Page