Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2610 - in development/main/test/unit/simple: . src/test/net/dpml/test/acme

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: r2610 - in development/main/test/unit/simple: . src/test/net/dpml/test/acme
  • Date: Thu, 19 May 2005 01:19:24 +0000

Author: mcconnell AT dpml.net
Date: Thu May 19 01:18:36 2005
New Revision: 2610

Added:

development/main/test/unit/simple/src/test/net/dpml/test/acme/ExampleTestCase.java
Modified:
development/main/test/unit/simple/build.xml
Log:
add examples testcase

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 01:18:36 2005
@@ -65,6 +65,63 @@
</context>
</component>

+ <!--
+ Example component.
+ -->
+ <component dest="target/test/acme-example-one.part"
+ xmlns="plugin:dpml/composition/dpml-composition-builder"
+ type="net.dpml.test.acme.ExampleComponent"
+ name="demo">
+ <context>
+ <value key="dimension" class="net.dpml.test.acme.DimensionValue">
+ <param class="int" value="2"/>
+ <param class="int" value="5"/>
+ </value>
+ </context>
+ </component>
+
+ <!--
+ Example component using a nested dimension component.
+ -->
+ <component dest="target/test/acme-example-two.part"
+ xmlns="plugin:dpml/composition/dpml-composition-builder"
+ type="net.dpml.test.acme.ExampleComponent"
+ name="demo">
+ <context>
+ <component key="dimension"
type="net.dpml.test.acme.DimensionComponent">
+ <context>
+ <value key="width" value="12"/>
+ <value key="height" value="100"/>
+ </context>
+ </component>
+ </context>
+ </component>
+
+ <!--
+ Example component using an internal part.
+ -->
+ <component dest="target/test/acme-example-three.part"
+ xmlns="plugin:dpml/composition/dpml-composition-builder"
+ type="net.dpml.test.acme.ExampleContainer"
+ name="demo">
+ <parts>
+ <component name="dimension"
type="net.dpml.test.acme.DimensionComponent"/>
+ </parts>
+ </component>
+
+ <!--
+ Example component using a part by reference.
+ -->
+ <x:property key="dpml-test-acme" 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"
+ name="demo">
+ <parts>
+ <part key="dimension" uri="${acme.uri}"/>
+ </parts>
+ </component>
+
</target>

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

Added:
development/main/test/unit/simple/src/test/net/dpml/test/acme/ExampleTestCase.java
==============================================================================
--- (empty file)
+++
development/main/test/unit/simple/src/test/net/dpml/test/acme/ExampleTestCase.java
Thu May 19 01:18:36 2005
@@ -0,0 +1,95 @@
+/*
+ * 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;
+
+import java.net.URI;
+import java.util.Hashtable;
+import java.util.Map.Entry;
+
+import junit.framework.TestCase;
+
+import net.dpml.parts.model.Model;
+import net.dpml.parts.model.Component;
+import net.dpml.parts.control.Controller;
+
+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 ExampleTestCase extends TestCase
+{
+ /**
+ * Test the construction of the example component and the invocation of
+ * an operation on the example service interface.
+ */
+ public void testExampleUsingValue() throws Exception
+ {
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( "acme-example-one.part" );
+ Model model = helper.getCompositionManager().getModel( uri,
"example" );
+ Example example = (Example) model.getProvider().resolve();
+ example.doMyStuff();
+ }
+
+ /**
+ * Test the construction of the example component using a
+ * component declared inside the context of the target
+ * component.
+ */
+ public void testExampleUsingComponent() throws Exception
+ {
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( "acme-example-two.part" );
+ Model model = helper.getCompositionManager().getModel( uri,
"example" );
+ Example example = (Example) model.getProvider().resolve();
+ example.doMyStuff();
+ }
+
+ /**
+ * Test the construction of the example component using a
+ * component declared as a part of an enclosing component.
+ */
+ public void testExampleUsingContainer() throws Exception
+ {
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( "acme-example-three.part" );
+ Model model = helper.getCompositionManager().getModel( uri,
"example" );
+ Example example = (Example) model.getProvider().resolve();
+ example.doMyStuff();
+ }
+
+ /**
+ * Test the construction of the example component using a
+ * component declared as a part of an enclosing component using
+ * a part reference.
+ */
+ public void testExampleUsingPartReference() throws Exception
+ {
+ CompositionHelper helper = new CompositionHelper();
+ URI uri = helper.toURI( "acme-example-four.part" );
+ Model model = helper.getCompositionManager().getModel( uri,
"example" );
+ Example example = (Example) model.getProvider().resolve();
+ example.doMyStuff();
+ }
+}



  • svn commit: r2610 - in development/main/test/unit/simple: . src/test/net/dpml/test/acme, mcconnell, 05/18/2005

Archive powered by MHonArc 2.6.24.

Top of Page