Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2613 - in development/main/test: components components/acme components/acme-plus components/plus components/plus/src components/plus/src/main/net/dpml/test/acme/plus components/plus/src/main/net/dpml/test/acme/state components/simple components/simple/src unit unit/plus unit/plus/src/test/net/dpml/test/acme/plus unit/simple

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: r2613 - in development/main/test: components components/acme components/acme-plus components/plus components/plus/src components/plus/src/main/net/dpml/test/acme/plus components/plus/src/main/net/dpml/test/acme/state components/simple components/simple/src unit unit/plus unit/plus/src/test/net/dpml/test/acme/plus unit/simple
  • Date: Thu, 19 May 2005 02:02:08 +0000

Author: mcconnell AT dpml.net
Date: Thu May 19 02:02:06 2005
New Revision: 2613

Added:
development/main/test/components/plus/
- copied from r2605, development/main/test/components/acme-plus/
development/main/test/components/plus/build.xml
- copied, changed from r2612,
development/main/test/components/acme-plus/build.xml
development/main/test/components/plus/src/
- copied from r2612, development/main/test/components/acme-plus/src/

development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagedComponent.java
- copied, changed from r2605,
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagedComponent.java

development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagingContainer.java
- copied, changed from r2605,
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagingContainer.java
development/main/test/components/simple/
- copied from r2604, development/main/test/components/acme/
development/main/test/components/simple/build.xml
- copied, changed from r2612,
development/main/test/components/acme/build.xml
development/main/test/components/simple/src/
- copied from r2612, development/main/test/components/acme/src/

development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/ManagementTestCase.java
Removed:
development/main/test/components/acme/
development/main/test/components/acme-plus/

development/main/test/components/plus/src/main/net/dpml/test/acme/state/ManagedComponent.java

development/main/test/components/plus/src/main/net/dpml/test/acme/state/ManagingContainer.java
Modified:
development/main/test/components/index.xml
development/main/test/unit/index.xml
development/main/test/unit/plus/build.xml
development/main/test/unit/simple/build.xml
Log:
reshuffle to make things clearer and add the state management testcases

Modified: development/main/test/components/index.xml
==============================================================================
--- development/main/test/components/index.xml (original)
+++ development/main/test/components/index.xml Thu May 19 02:02:06 2005
@@ -4,10 +4,10 @@

<import index="../index.xml"/>

- <project basedir="acme">
+ <project basedir="simple">
<info>
<group>dpml/test</group>
- <name>dpml-test-acme</name>
+ <name>dpml-test-simple</name>
<types>
<type>jar</type>
<type>part</type>
@@ -18,10 +18,10 @@
</plugins>
</project>

- <project basedir="acme-plus">
+ <project basedir="plus">
<info>
<group>dpml/test</group>
- <name>dpml-test-acme-plus</name>
+ <name>dpml-test-plus</name>
<types>
<type>jar</type>
<type>part</type>

Copied: development/main/test/components/plus/build.xml (from r2612,
development/main/test/components/acme-plus/build.xml)
==============================================================================
--- development/main/test/components/acme-plus/build.xml (original)
+++ development/main/test/components/plus/build.xml Thu May 19 02:02:06
2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-test-acme-plus" default="install" basedir="."
+<project name="dpml-test-plus" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core">

@@ -10,8 +10,8 @@
<types xmlns="plugin:dpml/composition/dpml-composition-builder">
<type class="net.dpml.test.acme.plus.ConfigurableComponent"
threadsafe="true"/>
<type class="net.dpml.test.acme.plus.ConfigurableContainer"
threadsafe="true"/>
- <type class="net.dpml.test.acme.state.ManagedComponent"
threadsafe="true"/>
- <type class="net.dpml.test.acme.state.ManagingContainer"
threadsafe="true"/>
+ <type class="net.dpml.test.acme.plus.ManagedComponent"
threadsafe="true"/>
+ <type class="net.dpml.test.acme.plus.ManagingContainer"
threadsafe="true"/>
</types>
</target>


Copied:
development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagedComponent.java
(from r2605,
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagedComponent.java)
==============================================================================
---
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagedComponent.java
(original)
+++
development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagedComponent.java
Thu May 19 02:02:06 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.test.acme.state;
+package net.dpml.test.acme.plus;

import java.net.URI;
import java.net.URISyntaxException;

Copied:
development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagingContainer.java
(from r2605,
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagingContainer.java)
==============================================================================
---
development/main/test/components/acme-plus/src/main/net/dpml/test/acme/state/ManagingContainer.java
(original)
+++
development/main/test/components/plus/src/main/net/dpml/test/acme/plus/ManagingContainer.java
Thu May 19 02:02:06 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.test.acme.state;
+package net.dpml.test.acme.plus;

import java.net.URI;
import java.util.logging.Logger;

Copied: development/main/test/components/simple/build.xml (from r2612,
development/main/test/components/acme/build.xml)
==============================================================================
--- development/main/test/components/acme/build.xml (original)
+++ development/main/test/components/simple/build.xml Thu May 19 02:02:06
2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-test-acme" default="install" basedir="."
+<project name="dpml-test-simple" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core">


Modified: development/main/test/unit/index.xml
==============================================================================
--- development/main/test/unit/index.xml (original)
+++ development/main/test/unit/index.xml Thu May 19 02:02:06 2005
@@ -13,7 +13,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-test-acme"/>
+ <include key="dpml-test-simple"/>
<include key="dpml-composition-unit"/>
<include key="ant-junit"/>
</dependencies>
@@ -31,7 +31,7 @@
</types>
</info>
<dependencies>
- <include key="dpml-test-acme-plus"/>
+ <include key="dpml-test-plus"/>
<include key="dpml-composition-unit"/>
<include key="ant-junit"/>
</dependencies>

Modified: development/main/test/unit/plus/build.xml
==============================================================================
--- development/main/test/unit/plus/build.xml (original)
+++ development/main/test/unit/plus/build.xml Thu May 19 02:02:06 2005
@@ -7,6 +7,7 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="build" depends="standard.build">
+
<!--
Configuration examples.
-->
@@ -27,6 +28,23 @@
</component>
</parts>
</component>
+
+ <!--
+ State management examples.
+ -->
+ <component dest="target/test/managed-component.part"
+ xmlns="plugin:dpml/composition/dpml-composition-builder"
+ type="net.dpml.test.acme.plus.ManagedComponent"
+ name="component"/>
+ <component dest="target/test/managing-container.part"
+ xmlns="plugin:dpml/composition/dpml-composition-builder"
+ type="net.dpml.test.acme.plus.ManagingContainer"
+ name="container">
+ <parts>
+ <component key="test"
type="net.dpml.test.acme.plus.ManagedComponent"/>
+ </parts>
+ </component>
+
</target>

<target name="package" depends="build"/>

Added:
development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/ManagementTestCase.java
==============================================================================
--- (empty file)
+++
development/main/test/unit/plus/src/test/net/dpml/test/acme/plus/ManagementTestCase.java
Thu May 19 02:02:06 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.test.acme.plus;
+
+import java.net.URI;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Map.Entry;
+
+import junit.framework.TestCase;
+
+import net.dpml.composition.unit.CompositionHelper;
+
+import net.dpml.parts.control.Manager;
+import net.dpml.parts.model.Component;
+import net.dpml.parts.model.Model;
+import net.dpml.parts.state.State;
+
+/**
+ * Test a simple component case.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta
+ * Library</a>
+ */
+public class ManagementTestCase extends TestCase
+{
+ public void tearDown()
+ {
+ System.gc();
+ }
+
+
+ /**
+ * Test the construction of the example component and the invocation of
+ * the provided controller via </code>the
net.dpml.parts.state.StateManager</code> interface
+ */
+ public void testManagedComponent() throws Exception
+ {
+ Component component = getComponent( "managed-component.part" );
+ component.initialize();
+ List list = new LinkedList();
+ while ( false == list.contains( component.getState() ) )
+ {
+ State state = component.getState();
+ list.add( state );
+ String[] transitions = state.getTransitionNames();
+ for( int i=0; i<transitions.length; i++ )
+ {
+ String name = transitions[i];
+ component.apply( name );
+ break;
+ }
+ }
+ component.terminate();
+ }
+
+ public void testManagingContainer() throws Exception
+ {
+ Component component = getComponent( "managing-container.part" );
+ try
+ {
+ component.initialize();
+ }
+ finally
+ {
+ component.terminate();
+ }
+ }
+
+ Component getComponent( String path ) throws Exception
+ {
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( path );
+ Model model = helper.getCompositionManager().getModel( uri );
+ return model.getController().getComponent( null, model, this );
+ }
+}

Modified: development/main/test/unit/simple/build.xml
==============================================================================
--- development/main/test/unit/simple/build.xml (original)
+++ development/main/test/unit/simple/build.xml Thu May 19 02:02:06 2005
@@ -112,7 +112,7 @@
<!--
Example component using a part by reference.
-->
- <x:property key="dpml-test-acme" feature="uri" type="part"
name="acme.uri"/>
+ <x:property key="dpml-test-simple" feature="uri" type="part"
name="acme.uri"/>
<component dest="target/test/acme-example-four.part"
xmlns="plugin:dpml/composition/dpml-composition-builder"
type="net.dpml.test.acme.ExampleContainer"



  • svn commit: r2613 - in development/main/test: components components/acme components/acme-plus components/plus components/plus/src components/plus/src/main/net/dpml/test/acme/plus components/plus/src/main/net/dpml/test/acme/state components/simple components/simple/src unit unit/plus unit/plus/src/test/net/dpml/test/acme/plus unit/simple, mcconnell, 05/18/2005

Archive powered by MHonArc 2.6.24.

Top of Page