Skip to Content.
Sympa Menu

notify-dpml - r1539 - in trunk/main/metro: model model/etc model/etc/data model/etc/data/components model/etc/data/parts model/etc/data/types model/src/test/net/dpml/metro model/src/test/net/dpml/metro/builder runtime/etc/data runtime/src/test/net/dpml/metro

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1539 - in trunk/main/metro: model model/etc model/etc/data model/etc/data/components model/etc/data/parts model/etc/data/types model/src/test/net/dpml/metro model/src/test/net/dpml/metro/builder runtime/etc/data runtime/src/test/net/dpml/metro
  • Date: Wed, 5 Jul 2006 10:00:54 +0200

Author: mcconnell
Date: 2006-07-05 10:00:14 +0200 (Wed, 05 Jul 2006)
New Revision: 1539

Added:
trunk/main/metro/model/etc/
trunk/main/metro/model/etc/data/
trunk/main/metro/model/etc/data/components/
trunk/main/metro/model/etc/data/components/array.xml
trunk/main/metro/model/etc/data/components/lookup.xml
trunk/main/metro/model/etc/data/components/minimal-component.xml
trunk/main/metro/model/etc/data/components/symbolic-entry.xml
trunk/main/metro/model/etc/data/parts/
trunk/main/metro/model/etc/data/parts/test.xml
trunk/main/metro/model/etc/data/types/
trunk/main/metro/model/etc/data/types/example-1.xml
trunk/main/metro/model/src/test/net/dpml/metro/builder/
trunk/main/metro/model/src/test/net/dpml/metro/builder/ArrayTestCase.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/LookupTestCase.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/MinimalTestCase.java

trunk/main/metro/model/src/test/net/dpml/metro/builder/SymbolicTestCase.java
trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
Removed:
trunk/main/metro/runtime/etc/data/components/
trunk/main/metro/runtime/etc/data/parts/
trunk/main/metro/runtime/etc/data/types/
trunk/main/metro/runtime/src/test/net/dpml/metro/builder/
Log:
move data management testcases into model project

Added: trunk/main/metro/model/etc/data/components/array.xml
===================================================================
--- trunk/main/metro/model/etc/data/components/array.xml 2006-07-05
07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/components/array.xml 2006-07-05
08:00:14 UTC (rev 1539)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<component xmlns="@COMPONENT-XSD-URI@"
+ type="net.dpml.test.array.ArrayTestComponent"
+ name="array"
+ lifestyle="thread"
+ collection="system"
+ activation="system">
+ <context>
+ <entry key="values" class="[Ljava.lang.String;">
+ <param class="Hello"/>
+ <param class="World"/>
+ </entry>
+ </context>
+</component>
+

Added: trunk/main/metro/model/etc/data/components/lookup.xml
===================================================================
--- trunk/main/metro/model/etc/data/components/lookup.xml 2006-07-05
07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/components/lookup.xml 2006-07-05
08:00:14 UTC (rev 1539)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<component xmlns="@COMPONENT-XSD-URI@"
+ type="net.dpml.test.array.ArrayTestComponent">
+ <context>
+ <entry key="test" lookup="acme.Widget"/>
+ </context>
+</component>
+

Added: trunk/main/metro/model/etc/data/components/minimal-component.xml
===================================================================
--- trunk/main/metro/model/etc/data/components/minimal-component.xml
2006-07-05 07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/components/minimal-component.xml
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<component xmlns="@COMPONENT-XSD-URI@" name="widget" type="acme.Widget"/>

Added: trunk/main/metro/model/etc/data/components/symbolic-entry.xml
===================================================================
--- trunk/main/metro/model/etc/data/components/symbolic-entry.xml
2006-07-05 07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/components/symbolic-entry.xml
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+
+<component xmlns="@COMPONENT-XSD-URI@"
+ type="net.dpml.test.array.ArrayTestComponent"
+ name="array"
+ lifestyle="thread"
+ collection="system"
+ activation="system">
+ <context>
+ <entry key="test" value="${dpml.prefs}/abc"/>
+ </context>
+</component>
+

Added: trunk/main/metro/model/etc/data/parts/test.xml
===================================================================
--- trunk/main/metro/model/etc/data/parts/test.xml 2006-07-05 07:51:40
UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/parts/test.xml 2006-07-05 08:00:14
UTC (rev 1539)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<component xmlns="@COMPONENT-XSD-URI@" name="widget" type="acme.Widget">
+ <parts>
+ <import key="test" uri="artifact:part:org/acme/acme-Widget#1.2.3"/>
+ </parts>
+</component>
+

Added: trunk/main/metro/model/etc/data/types/example-1.xml
===================================================================
--- trunk/main/metro/model/etc/data/types/example-1.xml 2006-07-05 07:51:40
UTC (rev 1538)
+++ trunk/main/metro/model/etc/data/types/example-1.xml 2006-07-05 08:00:14
UTC (rev 1539)
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<type xmlns="@TYPE-XSD-URI@"
+ xmlns:state="@STATE-XSD-URI@">
+
+ <info name="test"
+ class="net.dpml.test.part.ExampleComponent"
+ version="0.0.0"
+ lifestyle="thread"
+ collection="system"
+ threadsafe="unknown"/>
+
+ <services>
+ <service class="net.dpml.test.part.ColorManager" version="1.0.0"/>
+ </services>
+
+ <context>
+ <entry key="color" class="java.awt.Color" optional="false"/>
+ </context>
+
+ <state xmlns="@STATE-XSD-URI@"/>
+
+ <parts/>
+
+</type>

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/ArrayTestCase.java
===================================================================
--- trunk/main/metro/model/src/test/net/dpml/metro/builder/ArrayTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/src/test/net/dpml/metro/builder/ArrayTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005-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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.component.Directive;
+import net.dpml.lang.Value;
+
+import net.dpml.metro.info.PartReference;
+import net.dpml.metro.data.ContextDirective;
+import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.ValueDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Default array argument in context.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class ArrayTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testExampleOne() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "components/array.xml" );
+ URI uri = example.toURI();
+ ComponentDirective component = m_builder.loadComponentDirective( uri
);
+ ContextDirective context = component.getContextDirective();
+ PartReference[] entries = context.getDirectives();
+ if( entries.length != 1 )
+ {
+ fail( "Invalid entries length - expected 1, found " +
entries.length );
+ }
+ else
+ {
+ PartReference entry = entries[0];
+ String key = entry.getKey();
+ Directive directive = entry.getDirective();
+ if( directive instanceof ValueDirective )
+ {
+ ValueDirective value = (ValueDirective) directive;
+ String base = value.getBaseValue();
+ String method = value.getMethodName();
+ String target = value.getTargetExpression();
+ Value[] values = value.getValues();
+ //System.out.println( "# TARGET: " + target );
+ //System.out.println( "# METHOD: " + method );
+ //System.out.println( "# BASE: " + base );
+ //System.out.println( "# VALUES: " + values.length );
+ }
+ else
+ {
+ fail( "Expected ValueDirective, found " +
directive.getClass().getName() );
+ }
+ }
+ }
+}
+
+
+

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/ImportTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005 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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.metro.data.ComponentDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Test component import.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class ImportTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testComponentLoading() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "parts/test.xml" );
+ URI uri = example.toURI();
+ ComponentDirective directive = m_builder.loadComponentDirective( uri
);
+ }
+}
+
+
+

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/LookupTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/LookupTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/LookupTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2005 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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.component.Directive;
+
+import net.dpml.metro.info.PartReference;
+import net.dpml.metro.data.ContextDirective;
+import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.LookupDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Default state machine test-case.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class LookupTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testLookup() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "components/lookup.xml" );
+ URI uri = example.toURI();
+ ComponentDirective component = m_builder.loadComponentDirective( uri
);
+ ContextDirective context = component.getContextDirective();
+ PartReference[] entries = context.getDirectives();
+ if( entries.length != 1 )
+ {
+ fail( "Invalid entries length - expected 1, found " +
entries.length );
+ }
+ else
+ {
+ PartReference entry = entries[0];
+ String key = entry.getKey();
+ Directive directive = entry.getDirective();
+ if( directive instanceof LookupDirective )
+ {
+ LookupDirective value = (LookupDirective) directive;
+ String classname = value.getServiceClassname();
+ assertNotNull( "classname", classname );
+ assertEquals( "classname", "acme.Widget", classname );
+ }
+ else
+ {
+ fail( "Expected LookupDirective, found " +
directive.getClass().getName() );
+ }
+ }
+ }
+}
+
+
+

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/MinimalTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/MinimalTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/MinimalTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2005 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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.metro.data.ComponentDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Default state machine test-case.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class MinimalTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testComponentLoading() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "components/minimal-component.xml" );
+ URI uri = example.toURI();
+ ComponentDirective directive = m_builder.loadComponentDirective( uri
);
+ }
+}
+
+
+

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/SymbolicTestCase.java
===================================================================
---
trunk/main/metro/model/src/test/net/dpml/metro/builder/SymbolicTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++
trunk/main/metro/model/src/test/net/dpml/metro/builder/SymbolicTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005-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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.component.Directive;
+
+import net.dpml.metro.info.PartReference;
+import net.dpml.metro.data.ContextDirective;
+import net.dpml.metro.data.ComponentDirective;
+import net.dpml.metro.data.ValueDirective;
+
+import junit.framework.TestCase;
+
+/**
+ * Default state machine test-case.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class SymbolicTestCase extends TestCase
+{
+ private ComponentDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testSymbolicValue() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "components/symbolic-entry.xml" );
+ URI uri = example.toURI();
+ ComponentDirective component = m_builder.loadComponentDirective( uri
);
+ ContextDirective context = component.getContextDirective();
+ PartReference[] entries = context.getDirectives();
+ if( entries.length != 1 )
+ {
+ fail( "Invalid entries length - expected 1, found " +
entries.length );
+ }
+ else
+ {
+ PartReference entry = entries[0];
+ String key = entry.getKey();
+ Directive directive = entry.getDirective();
+ if( directive instanceof ValueDirective )
+ {
+ ValueDirective value = (ValueDirective) directive;
+ String base = value.getBaseValue();
+ assertEquals( "value", "${dpml.prefs}/abc", base );
+ }
+ else
+ {
+ fail( "Expected ValueDirective, found " +
directive.getClass().getName() );
+ }
+ }
+ }
+}
+
+
+

Added:
trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
===================================================================
--- trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
2006-07-05 07:51:40 UTC (rev 1538)
+++ trunk/main/metro/model/src/test/net/dpml/metro/builder/TypesTestCase.java
2006-07-05 08:00:14 UTC (rev 1539)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2005-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.metro.builder;
+
+import java.io.File;
+import java.net.URI;
+
+import net.dpml.metro.info.Type;
+import net.dpml.metro.info.ContextDescriptor;
+import net.dpml.metro.info.EntryDescriptor;
+
+import junit.framework.TestCase;
+
+/**
+ * Default state machine test-case.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ */
+public class TypesTestCase extends TestCase
+{
+ private ComponentTypeDecoder m_builder;
+
+ /**
+ * Testcase setup.
+ * @exception Exception if a setup error occurs
+ */
+ public void setUp() throws Exception
+ {
+ m_builder = new ComponentTypeDecoder();
+ }
+
+ /**
+ * List the state graph.
+ * @exception Exception if an error occurs
+ */
+ public void testExampleOne() throws Exception
+ {
+ String testPath = System.getProperty( "project.test.dir" );
+ File test = new File( testPath );
+ File example = new File( test, "types/example-1.xml" );
+ URI uri = example.toURI();
+ Type type = m_builder.loadType( uri );
+ ContextDescriptor context = type.getContextDescriptor();
+ EntryDescriptor[] entries = context.getEntryDescriptors();
+ if( entries.length != 1 )
+ {
+ fail( "Invalid entries length - expected 1, found " +
entries.length );
+ }
+ else
+ {
+ EntryDescriptor entry = entries[0];
+ String key = entry.getKey();
+ String classname = entry.getClassname();
+ boolean optional = entry.isOptional();
+ assertEquals( "key", "color", key );
+ assertEquals( "classname", "java.awt.Color", classname );
+ assertFalse( "optional", optional );
+ }
+ }
+}
+
+
+




  • r1539 - in trunk/main/metro: model model/etc model/etc/data model/etc/data/components model/etc/data/parts model/etc/data/types model/src/test/net/dpml/metro model/src/test/net/dpml/metro/builder runtime/etc/data runtime/src/test/net/dpml/metro, mcconnell at BerliOS, 07/05/2006

Archive powered by MHonArc 2.6.24.

Top of Page