notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1460 - in trunk/main/metro/runtime: etc/data/components src/test/net/dpml/metro/builder
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1460 - in trunk/main/metro/runtime: etc/data/components src/test/net/dpml/metro/builder
- Date: Thu, 25 May 2006 09:10:46 +0200
Author: mcconnell
Date: 2006-05-25 09:10:36 +0200 (Thu, 25 May 2006)
New Revision: 1460
Added:
trunk/main/metro/runtime/etc/data/components/symbolic-entry.xml
trunk/main/metro/runtime/src/test/net/dpml/metro/builder/SymbolicTestCase.java
Log:
add symbolic entry testcase
Added: trunk/main/metro/runtime/etc/data/components/symbolic-entry.xml
===================================================================
--- trunk/main/metro/runtime/etc/data/components/symbolic-entry.xml
2006-05-25 07:08:50 UTC (rev 1459)
+++ trunk/main/metro/runtime/etc/data/components/symbolic-entry.xml
2006-05-25 07:10:36 UTC (rev 1460)
@@ -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/runtime/src/test/net/dpml/metro/builder/SymbolicTestCase.java
===================================================================
---
trunk/main/metro/runtime/src/test/net/dpml/metro/builder/SymbolicTestCase.java
2006-05-25 07:08:50 UTC (rev 1459)
+++
trunk/main/metro/runtime/src/test/net/dpml/metro/builder/SymbolicTestCase.java
2006-05-25 07:10:36 UTC (rev 1460)
@@ -0,0 +1,89 @@
+/*
+ * 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 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() );
+ }
+ }
+ }
+}
+
+
+
- r1460 - in trunk/main/metro/runtime: etc/data/components src/test/net/dpml/metro/builder, mcconnell at BerliOS, 05/25/2006
Archive powered by MHonArc 2.6.24.