Test section 01, #0001: a basic inheritance test
<cdl:cdl> <cdl:configuration> <WebServer> <hostname>localhost</hostname> <port>80</port> </WebServer> </cdl:configuration> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>
Test section 01, #0002: a cascading inheritance test
<cdl:cdl> <cdl:configuration> <WebServer> <hostname>localhost</hostname> <port>80</port> </WebServer> <Tomcat extends="WebServer"> <port>8080</port> </Tomcat> </cdl:configuration> <cdl:system> <MyServer extends="Tomcat"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname>www.cddlm.org</hostname> <port>8080</port> </MyServer> </cdl:system>
Test section 01, #0003: property order
<cdl:cdl> <cdl:configuration> <list1> <a>1</a> <b>2</b> </list1> </cdl:configuration> <cdl:system> <list2 extends="list1"> <c>3</c> <a>4</a> </list2> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <list2> <a>4</a> <b>2</b> <c>3</c> </list2> </cdl:system>
Test section 01, #0004: no "deep" inheritance
<cdl:cdl> <cdl:configuration> <AppPlatform> <WebServer> <hostname>localhost</hostname> <port>80</port> </WebServer> <ApplicationServer> <hostname>localhost</hostname> <port>8080</port> </ApplicationServer> <DatabaseServer> <hostname>localhost</hostname> <port>6000</port> </DatabaseServer> </AppPlatform> </cdl:configuration> <cdl:system> <MyApp extends="AppPlatform"> <WebServer> <hostname>www.example.com</hostname> </WebServer> <ApplicationServer/> </MyApp> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyApp> <WebServer> <hostname>www.example.com</hostname> </WebServer> <ApplicationServer/> <DatabaseServer> <hostname>localhost</hostname> <port>6000</port> </DatabaseServer> </MyApp> </cdl:system>
Test section 01, #0005: multiple @cdl:extends in a tree
<cdl:cdl> <cdl:configuration> <WebServer> <hostname>localhost</hostname> <port>80</port> </WebServer> <AppPlatform> <WebServer extends="WebServer"/> <ApplicationServer> <hostname>localhost</hostname> <port>8080</port> </ApplicationServer> <DatabaseServer> <hostname>localhost</hostname> <port>6000</port> </DatabaseServer> </AppPlatform> </cdl:configuration> <cdl:system> <MyApp extends="AppPlatform"> <WebServer extends="WebServer"> <hostname>www.example.com</hostname> </WebServer> </MyApp> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyApp> <WebServer> <hostname>www.example.com</hostname> <port>80</port> </WebServer> <ApplicationServer> <hostname>localhost</hostname> <port>8080</port> </ApplicationServer> <DatabaseServer> <hostname>localhost</hostname> <port>6000</port> </DatabaseServer> </MyApp> </cdl:system>
Namespace-based inheritance: check that you can inherit something
<cdl:cdl tns="nap:velvet+underground+european+sun"> <cdl:configuration> <tns:Component/> </cdl:configuration> <cdl:system> <tns:Extension extends="tns:Component"/> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system tns="nap:velvet+underground+european+sun"> <tns:Extension/> </cdl:system>
Test section 01, #INVALID-0001: failure case: a dangling link
<cdl:cdl> <cdl:configuration> <b extends="c"/> </cdl:configuration> <cdl:system> <a extends="b"/> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 01, #INVALID-0002: failure case: It is only allowable to extend a configuration node, not a system node.
<cdl:cdl> <cdl:system> <b/> <a extends="b"/> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 01, #INVALID-0003: failure case: Even in a default namespace, you have to give a full qname to whatever you are extending. That is, the default xmlns does not propagate to extends attributes.
<cdl:cdl xmlns="urn:uri:webapps"> <null:a> <null:b>100</null:b> </null:a> <cdl:system> <null:a2> <null:b>200</null:b> <null:a3 extends="a"> <null:b>300</null:b> </null:a3> </null:a2> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 02, #0001: basic reference resolution
<cdl:cdl> <cdl:configuration> <a> <b> <c>100</c> </b> <d ref="b"/> <e ref="b/c"/> <f ref="./b"/> <g ref="./b/c"/> <h ref="/b"/> <i ref="/b/c"/> <j> <k ref="../b/c"/> <l ref="/b/c"/> </j> </a> </cdl:configuration> <cdl:system> <a1 extends="a"/> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <a1> <b> <c>100</c> </b> <d> <c>100</c> </d> <e>100</e> <f> <c>100</c> </f> <g>100</g> <h> <c>100</c> </h> <i>100</i> <j> <k>100</k> <l>100</l> </j> </a1> </cdl:system>
Test section 02, #0002: basic reference resolution AFTER prototype resolution
<cdl:cdl> <cdl:configuration> <a> <b> <c>100</c> </b> <d ref="b"/> <e ref="b/c"/> <f ref="./b"/> <g ref="./b/c"/> <h ref="/b"/> <i ref="/b/c"/> <j> <k ref="../b/c"/> <l ref="/b/c"/> </j> </a> </cdl:configuration> <cdl:system> <a1 extends="a"> <b><c>200</c></b> </a1> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <a1> <b> <c>200</c> </b> <d> <c>200</c> </d> <e>200</e> <f> <c>200</c> </f> <g>200</g> <h> <c>200</c> </h> <i>200</i> <j> <k>200</k> <l>200</l> </j> </a1> </cdl:system>
Test section 02, #0003: cascading reference resolution
<cdl:cdl> <cdl:system> <a> <b> <c>100</c> <d ref="c"/> </b> <e ref="b"/> <f ref="e"/> </a> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <a> <b> <c>100</c> <d>100</d> </b> <e> <c>100</c> <d>100</d> </e> <f> <c>100</c> <d>100</d> </f> </a> </cdl:system>
In-system relative resolution.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="hostname"/> <user ref="hostname/../toplevel"/> <toplevel>username</toplevel> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <hostname>localhost</hostname> <database>localhost</database> <user>username</user> <toplevel>username</toplevel> </app> </cdl:system>
In-system absolute resolution.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="/app/hostname"/> <user ref="/toplevel"/> </app> <toplevel>username</toplevel> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <hostname>localhost</hostname> <database>localhost</database> <user>username</user> </app> <toplevel>username</toplevel> </cdl:system>
In-system relative path resolution.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <user ref="../toplevel"/> </app> <toplevel>username</toplevel> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> <toplevel>username</toplevel> </cdl:system>
In-configuration refroot-relative resolution of the "." node.
<cdl:cdl> <cdl:configuration> <toplevel>username</toplevel> </cdl:configuration> <cdl:system> <app> <user ref="." refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
QName in refroot
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:configuration> <test1:toplevel> <value>username</value> </test1:toplevel> </cdl:configuration> <cdl:system> <app> <user ref="value" refroot="test1:toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
QName in refroot and in reference to resolve
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:configuration> <test1:toplevel> <test1:value>username</test1:value> </test1:toplevel> </cdl:configuration> <cdl:system> <app> <user ref="test1:value" refroot="test1:toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
QName in refroot and in reference to resolve, with a different prefix in the system from the configuration
<cdl:cdl> <cdl:configuration test1="http://cddlm.org/test1.cdl"> <test1:toplevel> <test1:value>username</test1:value> </test1:toplevel> </cdl:configuration> <cdl:system t1="http://cddlm.org/test1.cdl"> <app> <user ref="t1:value" refroot="t1:toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
Verify that resolution occurs after extends processing. Either all things get extended, or everything that needs to be extended must be extended before reference processing.
<cdl:cdl> <cdl:configuration> <secondary> <nested> <value>12</value> </nested> </secondary> <toplevel extends="secondary"/> </cdl:configuration> <cdl:system> <app> <user ref="nested/value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>12</user> </app> </cdl:system>
Chained references. That is, we resolve to something that is itself a resolution point.
<cdl:cdl> <cdl:configuration> <secondary> <nested> <value>12</value> </nested> </secondary> <toplevel ref="/nested/value" refroot="secondary"/> </cdl:configuration> <cdl:system> <app> <user ref="." refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>12</user> </app> </cdl:system>
Verify that QName Resolution can be relative to the refroot.
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:configuration> <toplevel> <test1:value>username</test1:value> </toplevel> </cdl:configuration> <cdl:system> <app> <user ref="test1:value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
Interaction of extends and resolves.
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:configuration> <node> <test1:value>username</test1:value> </node> <toplevel extends="node"> </toplevel> </cdl:configuration> <cdl:system> <app> <user ref="test1:value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>username</user> </app> </cdl:system>
Interaction of extends and resolves #2. Here a reference in an extended node is only resolvable after extension takes place.
<cdl:cdl> <cdl:configuration> <node> <value ref="newvalue"/> </node> <toplevel extends="node"> <newvalue>newvalue</newvalue> </toplevel> </cdl:configuration> <cdl:system> <app> <user ref="value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>newvalue</user> </app> </cdl:system>
Interaction of extends and resolves. This test asserts that a refroot qname is resolved in the context of the original namespace, not that of the node into which any extends has taken place. That is: "extends" doesnt break any absolute references you have elsewhere
<cdl:cdl> <cdl:configuration> <p1:local p1="http://cddlm.org/prefix1"> <newvalue>prefix1</newvalue> </p1:local> <!-- this is in a different namespace, even though the prefix is the same --> <p1:local p1="http://cddlm.org/prefix2"> <newvalue>prefix2</newvalue> </p1:local> <node p1="http://cddlm.org/prefix1"> <value ref="/newvalue" refroot="p1:local"/> </node> <toplevel extends="node" p1="http://cddlm.org/prefix2"> </toplevel> </cdl:configuration> <cdl:system> <app> <user ref="value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user>prefix1</user> </app> </cdl:system>
when copying a reference, retain all attributes of the original except for cdl:ref and cdl:refroot
<cdl:cdl> <cdl:system> <source attribute="value" ref="/dest"/> <dest>dest</dest> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <source attribute="value">dest</source> <dest>dest</dest> </cdl:system>
when copying a reference, retain all attributes of the original except for cdl:ref and cdl:refroot
<cdl:cdl> <cdl:system> <source ref="/dest"/> <dest attribute="value">dest</dest> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <source>dest</source> <dest attribute="value">dest</dest> </cdl:system>
when copying a reference, retain all attributes of the original except for cdl:ref and cdl:refroot
<cdl:cdl> <cdl:configuration> <dest attr2="attr2"> <nested1 attr="value">nested1</nested1> <nested2 attr="value2">nested2</nested2> <nested3 lazy="true">nested3</nested3> <nested3 lazy="false">nested3-2</nested3> </dest> </cdl:configuration> <cdl:system> <source attribute="value" ref="/" refroot="dest"/> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <source attribute="value"> <nested1 attr="value">nested1</nested1> <nested2 attr="value2">nested2</nested2> <nested3 lazy="true">nested3</nested3> <nested3 lazy="false">nested3-2</nested3> </source> </cdl:system>
when copying a reference, retain all attributes of the original except for cdl:ref and cdl:refroot
<cdl:cdl> <cdl:configuration> <dest> Text1 <nested1 attr="value">nested1</nested1> Text2 <nested2 attr="value2">nested2</nested2> Text3 </dest> </cdl:configuration> <cdl:system> <source ref="/" refroot="dest"/> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <source> Text1 <nested1 attr="value">nested1</nested1> Text2 <nested2 attr="value2">nested2</nested2> Text3 </source> </cdl:system>
Non-resolvable reference
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="hostname2"/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Recursive reference which asks for the parent.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database> <server ref=".."/> </database> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Indirect recursive reference
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname ref="database"/> <database ref="hostname"/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
illegal inclusion of text under a reference
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="hostname">illegal text</database> </app> </cdl:system> </cdl:cdl>
Resolution must fail
illegal inclusion of comment under a reference
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="hostname"><!-- illegal text --></database> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Go too far up the tree and then down again. The reference is there, but only if you allow an excessive number of .. operations
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="../../hostname2"/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Invalid namespace in the refroot; this must not resolve
<cdl:cdl> <cdl:configuration test1="http://cddlm.org/test1.cdl"> <test1:toplevel> <value>username</value> </test1:toplevel> </cdl:configuration> <cdl:system t1="http://cddlm.org/test2.cdl"> <app> <user ref="value" refroot="t1:toplevel"/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
There are two nodes called "toplevel", one under configuration, one under system, which means that cdl:refroot will not know which way to go. It should fail.
<cdl:cdl> <cdl:configuration> <toplevel>username</toplevel> <toplevel>clash</toplevel> </cdl:configuration> <cdl:system> <app> <user ref="." refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
A reference with a trailing space. This is not valid by the schemas, but may slip past non validating things
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="hostname "/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
A reference with double slashes.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database ref="something//else "/> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Recursive reference which implicitly asks for the parent
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database> <server ref="../../database"/> </database> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Recursive reference which asks for the root
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <hostname>localhost</hostname> <database> <server ref="/"/> </database> </app> </cdl:system> </cdl:cdl>
Resolution must fail
Verify that toplevel elements in a cdl:system note are not reference roots, unlike cdl:configuration children.
<cdl:cdl> <cdl:configuration> </cdl:configuration> <cdl:system> <app> <user ref="/" refroot="toplevel"/> </app> <toplevel>username</toplevel> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 03, #0001: type annotations
<cdl:cdl xsd="http://www.w3.org/2001/XMLSchema"> <cdl:configuration> <WebServer> <hostname type="xsd:string" use="required"/> <port type="xsd:positiveInteger">80</port> </WebServer> </cdl:configuration> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname type="xsd:string" use="required"> www.cddlm.org </hostname> <port type="xsd:positiveInteger">80</port> </MyServer> </cdl:system>
Test section 04, #0001: import
<cdl:cdl> <cdl:import location="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>
Test section 04, #0002: chained import Two documents are provided as imports, one importing the other. Both have to be imported for the description to parse
<cdl:cdl> <cdl:import location="http://cddlm.org/test2.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>
Test section 04, #0003: relative chained import Two documents are provided as imports, one importing the other. The reference used for the second import is relative. This is an informative test, as the specification doesn't actually say anything about relative URLs
<cdl:cdl> <cdl:import location="http://cddlm.org/chain-source.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>
Test section 04, Invalid #0001: import a URL that is not valid. We use a file: URL so that no attempts to hit the network are made
<cdl:cdl> <cdl:import location="file://tmp/nonexistent-file/on/most/systems.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 04, #0002: recursive import The document we import imports itself. This should inevitably fail somehow, even if it is graceless. Spinning forever is not an acceptable option.
<cdl:cdl> <cdl:import location="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 04, invalid #0003: chained recursive import Two documents are provided as imports, each importing the other. This should fail.
<cdl:cdl> <cdl:import location="http://cddlm.org/test2.cdl"/> <cdl:system> <MyServer extends="WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Resolution must fail
Test section 05, #0001: an empty document
<cdl:cdl> <cdl:types/> <cdl:configuration/> <cdl:system/> </cdl:cdl>
Must resolve to
<cdl:system/>
Test section 05, #0002: Documentation element
<cdl:cdl other="http://ggf.org/"> <cdl:documentation>Documentation is allowed here <other:including>nested elements</other:including> <localtype>in NULL namespace</localtype> </cdl:documentation> <cdl:types> <cdl:documentation>Documentation is allowed here</cdl:documentation> </cdl:types> <cdl:configuration> <cdl:documentation>Documentation is allowed here</cdl:documentation> </cdl:configuration> <cdl:system> <cdl:documentation>Documentation is allowed here</cdl:documentation> </cdl:system> <other:unknown> <cdl:documentation>Documentation is allowed here</cdl:documentation> </other:unknown> <local> <cdl:documentation>Documentation is allowed here</cdl:documentation> </local> </cdl:cdl>
Must resolve to
<cdl:system/>
Test section 05, #0003: extra elements are allowed at the tail of a doc
<cdl:cdl artifact="antlib:org.apache.maven.artifact.ant"> <!-- xsi:schemaLocation="http://gridforge.org/cddlm/xml/2004/07/30/ cddlm.xsd" --> <!-- <import/> --> <cdl:types/> <cdl:configuration/> <cdl:system/> <!-- This is sneakin in in the other XML at the end of the CDL XSD; a fragment of the CDDLM build file in the appropriate namespace --> <artifact:dependencies pathID="axis.classpath"> <artifact:localRepository location="${basedir}/target/local-repo"/> <artifact:dependency artifactID="xercesImpl" groupID="xerces" version="${xerces.version}"/> <artifact:dependency artifactID="xmlParserAPIs" groupID="xerces" version="${xerces.version}"/> </artifact:dependencies> </cdl:cdl>
Must resolve to
<cdl:system/>
Lazy references.
<cdl:cdl> <cdl:configuration> <toplevel> <value lazy="true"/> </toplevel> </cdl:configuration> <cdl:system> <app> <user ref="value" refroot="toplevel"/> </app> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <app> <user lazy="true" ref="value" refroot="toplevel"/> </app> </cdl:system>
Test section 06, #0002: lazy references
<cdl:cdl> <cdl:configuration> <WebServer> <hostname lazy="true"/> <port>80</port> </WebServer> <Proxy> <hostname lazy="true"/> <command/> <redirectTo/> </Proxy> <MySystemTemplate> <hostname ref="MonitorProxy/hostname"/> <MonitorProxy extends="Proxy"> <command>monitor</command> <redirectTo ref="../CacheProxy/hostname"/> </MonitorProxy> <CacheProxy extends="Proxy"> <command>cache</command> <redirectTo ref="../WebServer/hostname"/> </CacheProxy> <WebServer extends="WebServer"/> </MySystemTemplate> </cdl:configuration> <cdl:system> <System1 extends="MySystemTemplate"/> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system> <System1> <hostname ref="MonitorProxy/hostname"/> <MonitorProxy> <hostname lazy="true"/> <command>monitor</command> <redirectTo ref="../CacheProxy/hostname"/> </MonitorProxy> <CacheProxy> <hostname lazy="true"/> <command>cache</command> <redirectTo ref="../WebServer/hostname"/> </CacheProxy> <WebServer> <hostname lazy="true"/> <port>80</port> </WebServer> </System1> </cdl:system>
Complex Example. This tests import, extends and static references, plus attributes the latter are used for some binding things in the SmartFrog impl.
<cdl:cdl c2="http://smartfrog.org/smartfrog/services/cddlm/cdl/c2/components.cdl" cdl="http://www.gridforum.org/namespaces/2005/02/cddlm/CDL-1.0" demo="http://smartfrog.org/services/cdl/demo/" sf="http://www.gridforum.org/cddlm/smartfrog/2005/02" sfi="http://smartfrog.org/types/2006/01/"> <cdl:documentation> Echo something </cdl:documentation> <cdl:import location="http://smartfrog.org/services/cdl/demo/"/> <cdl:system> <echo extends="demo:echo"> <demo:message>Test message</demo:message> <demo:gui>true</demo:gui> </echo> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system c2="http://smartfrog.org/smartfrog/services/cddlm/cdl/c2/components.cdl" demo="http://smartfrog.org/services/cdl/demo/" sfi="http://smartfrog.org/types/2006/01/"> <echo> <sfClass type="trimmed">org.smartfrog.services.cddlm.cdl.demo.EchoImpl</sfClass> <c2:CommandPath>org.smartfrog.services.cddlm.cdl.demo.EchoImpl</c2:CommandPath> <demo:message type="trimmed">Test message</demo:message> <demo:gui type="boolean">true</demo:gui> </echo> </cdl:system>
Import with a namespace defined: extends from outside
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer extends="test1:WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>
Import with a namespace defined: references from outside
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer> <hostname ref="hostname" refroot="test1:WebServer"/> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>localhost</hostname> </MyServer> </cdl:system>
Import with a namespace defined: references from inside. Here the test is that stuff inside a document can use references that are not in the namespace, because of course they don't know it.
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer> <hostname ref="hostname" refroot="test1:WebServer"/> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>data/value</hostname> </MyServer> </cdl:system>
Import with a namespace defined: references from inside. Here the test is that stuff inside a document can use references that are not in the namespace, because of course they don't know it.
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer> <hostname ref="hostname" refroot="test1:WebServer"/> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>data/hostname</hostname> </MyServer> </cdl:system>
Import with a namespace defined: extends from outside
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer extends="test1:WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system t2="http://cddlm.org/test2.cdl" test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>data/hostname</hostname> <port>80</port> </MyServer> </cdl:system>
chained import. The first import is into a namespace, the second is imported into the first. This test encodes the expectation that when the nested document will be imported into the same namespace as the outer one.
<cdl:cdl test1="http://cddlm.org/test1.cdl"> <cdl:import location="http://cddlm.org/test1.cdl" namespace="http://cddlm.org/test1.cdl"/> <cdl:system> <MyServer extends="test1:WebServer"> <hostname>www.cddlm.org</hostname> </MyServer> </cdl:system> </cdl:cdl>
Must resolve to
<cdl:system test1="http://cddlm.org/test1.cdl"> <MyServer> <hostname>www.cddlm.org</hostname> <port>80</port> </MyServer> </cdl:system>