notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1985 - in trunk/main/metro: . testing testing/plus testing/plus/etc testing/plus/etc/data testing/plus/src testing/plus/src/main testing/plus/src/main/org testing/plus/src/main/org/acme testing/plus/src/main/org/acme/reference testing/plus/src/test testing/plus/src/test/net testing/plus/src/test/net/dpml testing/plus/src/test/net/dpml/part testing/plus/src/test/net/dpml/part/composition
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1985 - in trunk/main/metro: . testing testing/plus testing/plus/etc testing/plus/etc/data testing/plus/src testing/plus/src/main testing/plus/src/main/org testing/plus/src/main/org/acme testing/plus/src/main/org/acme/reference testing/plus/src/test testing/plus/src/test/net testing/plus/src/test/net/dpml testing/plus/src/test/net/dpml/part testing/plus/src/test/net/dpml/part/composition
- Date: Mon, 23 Apr 2007 18:28:35 +0200
Author: mcconnell
Date: 2007-04-23 18:28:35 +0200 (Mon, 23 Apr 2007)
New Revision: 1985
Added:
trunk/main/metro/testing/
trunk/main/metro/testing/plus/
trunk/main/metro/testing/plus/etc/
trunk/main/metro/testing/plus/etc/data/
trunk/main/metro/testing/plus/etc/data/reference.xml
trunk/main/metro/testing/plus/project.xml
trunk/main/metro/testing/plus/src/
trunk/main/metro/testing/plus/src/main/
trunk/main/metro/testing/plus/src/main/org/
trunk/main/metro/testing/plus/src/main/org/acme/
trunk/main/metro/testing/plus/src/main/org/acme/reference/
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
trunk/main/metro/testing/plus/src/test/
trunk/main/metro/testing/plus/src/test/net/
trunk/main/metro/testing/plus/src/test/net/dpml/
trunk/main/metro/testing/plus/src/test/net/dpml/part/
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
trunk/main/metro/testing/sample/
trunk/main/metro/testing/test/
Removed:
trunk/main/metro/sample/
trunk/main/metro/test/
Modified:
trunk/main/metro/module.xml
Log:
restructure tests and samples under a common directory
Modified: trunk/main/metro/module.xml
===================================================================
--- trunk/main/metro/module.xml 2007-04-23 16:26:11 UTC (rev 1984)
+++ trunk/main/metro/module.xml 2007-04-23 16:28:35 UTC (rev 1985)
@@ -11,11 +11,12 @@
</dependencies>
<project file="part/project.xml"/>
- <project file="sample/project.xml"/>
+ <project file="testing/sample/project.xml"/>
<project file="appliance/project.xml"/>
<project file="main/project.xml"/>
<project file="connector/project.xml"/>
- <project file="test/project.xml"/>
+ <project file="testing/test/project.xml"/>
+ <project file="testing/plus/project.xml"/>
<project file="station/project.xml"/>
</module>
Added: trunk/main/metro/testing/plus/etc/data/reference.xml
===================================================================
--- trunk/main/metro/testing/plus/etc/data/reference.xml 2007-04-23
16:26:11 UTC (rev 1984)
+++ trunk/main/metro/testing/plus/etc/data/reference.xml 2007-04-23
16:28:35 UTC (rev 1985)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<part xmlns="dpml:part">
+
+ <component xmlns="dpml:metro"
class="org.acme.reference.AggregatingComponent" name="reference">
+ <parts>
+ <part key="hello" uri="link:part:dpml/metro/dpml-metro-blade">
+ <param key="message" value="OK"/>
+ </part>
+ </parts>
+ </component>
+
+</part>
Added: trunk/main/metro/testing/plus/project.xml
===================================================================
--- trunk/main/metro/testing/plus/project.xml 2007-04-23 16:26:11 UTC (rev
1984)
+++ trunk/main/metro/testing/plus/project.xml 2007-04-23 16:28:35 UTC (rev
1985)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project xmlns="dpml:library" name="dpml-metro-test-plus" export="false">
+
+ <info title="DPML Metro Test Suite 2"/>
+
+ <types>
+ <type id="jar" test="true"/>
+ </types>
+
+ <dependencies>
+ <runtime>
+ <include ref="dpml/metro/dpml-metro-sample"/>
+ </runtime>
+ <test>
+ <include ref="org/apache/ant/ant-junit"/>
+ </test>
+ </dependencies>
+
+</project>
+
Added:
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
===================================================================
---
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
2007-04-23 16:26:11 UTC (rev 1984)
+++
trunk/main/metro/testing/plus/src/main/org/acme/reference/AggregatingComponent.java
2007-04-23 16:28:35 UTC (rev 1985)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005 Stephen 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 org.acme.reference;
+
+import dpml.util.PID;
+
+import java.net.URI;
+
+import net.dpml.annotation.Component;
+import net.dpml.annotation.Services;
+
+import static net.dpml.annotation.LifestylePolicy.SINGLETON;
+
+import net.dpml.util.Logger;
+
+import org.acme.Hello;
+
+/**
+ * Sample component used in testing aggregation by reference.
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+@Component( lifestyle=SINGLETON )
+public class AggregatingComponent
+{
+ private Parts m_parts;
+
+ public interface Parts
+ {
+ Hello getHello();
+ }
+
+ public AggregatingComponent( Parts parts ) throws Exception
+ {
+ m_parts = parts;
+ }
+
+ public String getMessage()
+ {
+ Hello hello = m_parts.getHello();
+ return hello.getMessage();
+ }
+}
Added:
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
===================================================================
---
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
2007-04-23 16:26:11 UTC (rev 1984)
+++
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/AbstractTestCase.java
2007-04-23 16:28:35 UTC (rev 1985)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2007 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.part.composition;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import net.dpml.lang.Strategy;
+import net.dpml.lang.TypeCastException;
+
+/**
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class AbstractTestCase extends TestCase
+{
+ static
+ {
+ System.setProperty(
+ "handler:dpml:metro",
+ "net.dpml.runtime.ComponentStrategyHandler" );
+ }
+
+ protected <T>T load( Class<T> type, String path ) throws Exception
+ {
+ return load( type, path, null );
+ }
+
+ protected <T>T load( Class<T> type, String path, String name ) throws
Exception
+ {
+ ClassLoader classloader = getClass().getClassLoader();
+ File dir = new File( System.getProperty( "project.test.dir" ) );
+ File file = new File( dir, path );
+ try
+ {
+ Strategy strategy = Strategy.load( classloader, null,
file.toURI(), name );
+ return strategy.getContentForClass( type );
+ }
+ catch( TypeCastException e )
+ {
+ String report = e.getReport();
+ System.out.println( report );
+ throw e;
+ }
+ }
+}
Added:
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
===================================================================
---
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
2007-04-23 16:26:11 UTC (rev 1984)
+++
trunk/main/metro/testing/plus/src/test/net/dpml/part/composition/ReferenceTestCase.java
2007-04-23 16:28:35 UTC (rev 1985)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2006 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.part.composition;
+
+import org.acme.reference.AggregatingComponent;
+
+/**
+ *
+ * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
+ * @version @PROJECT-VERSION@
+ */
+public class ReferenceTestCase extends AbstractTestCase
+{
+ public void testComponent() throws Exception
+ {
+ AggregatingComponent component =
+ load( AggregatingComponent.class, "reference.xml", null );
+ String message = component.getMessage();
+ assertEquals( "message", "OK", message );
+ }
+}
Copied: trunk/main/metro/testing/sample (from rev 1957,
trunk/main/metro/sample)
Copied: trunk/main/metro/testing/test (from rev 1957, trunk/main/metro/test)
- r1985 - in trunk/main/metro: . testing testing/plus testing/plus/etc testing/plus/etc/data testing/plus/src testing/plus/src/main testing/plus/src/main/org testing/plus/src/main/org/acme testing/plus/src/main/org/acme/reference testing/plus/src/test testing/plus/src/test/net testing/plus/src/test/net/dpml testing/plus/src/test/net/dpml/part testing/plus/src/test/net/dpml/part/composition, mcconnell at BerliOS, 04/23/2007
Archive powered by MHonArc 2.6.24.