Skip to Content.
Sympa Menu

notify-dpml - r1422 - in trunk/main/lang/process: etc etc/test src/test/net/dpml/lang/process

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: r1422 - in trunk/main/lang/process: etc etc/test src/test/net/dpml/lang/process
  • Date: Mon, 1 May 2006 18:48:49 +0200

Author: mcconnell
Date: 2006-05-01 18:48:46 +0200 (Mon, 01 May 2006)
New Revision: 1422

Modified:
trunk/main/lang/process/etc/process.xsd
trunk/main/lang/process/etc/test/sample.xml

trunk/main/lang/process/src/test/net/dpml/lang/process/ProcessXsdTestCase.java
Log:
add support for include/exclude selection criteria when using dir-based
products

Modified: trunk/main/lang/process/etc/process.xsd
===================================================================
--- trunk/main/lang/process/etc/process.xsd 2006-05-01 08:40:59 UTC (rev
1421)
+++ trunk/main/lang/process/etc/process.xsd 2006-05-01 16:48:46 UTC (rev
1422)
@@ -38,17 +38,6 @@
</simpleContent>
</complexType>

- <!-- crteria: applies a processing constraint on a product -->
- <!--
- <complexType name="CriteriaType">
- <complexContent>
- <extension base="anyType">
- <attribute name="id" type="string" use="required"/>
- </extension>
- </complexContent>
- </complexType>
- -->
-
<complexType name="DirectoryType">
<complexContent>
<extension base="this:ProductType">
@@ -60,11 +49,6 @@
<complexType name="FileType">
<complexContent>
<extension base="this:ProductType">
- <!--
- <sequence>
- <element ref="this:CriteriaType" minOccurs="0" maxOccurs="1"/>
- </sequence>
- -->
<attribute name="type" type="string" use="required"/>
</extension>
</complexContent>
@@ -104,21 +88,36 @@
</complexType>

<complexType name="ProducesType">
- <sequence>
- <element name="output" type="this:OutputType" minOccurs="0"
maxOccurs="unbounded"/>
- </sequence>
- <attribute name="policy" type="this:PolicyType"/>
+ <attribute name="id" type="string" use="required"/>
</complexType>

<complexType name="DependencyType">
- <attribute name="id" type="string"/>
+ <attribute name="id" type="string" use="required"/>
</complexType>

<complexType name="InputType">
- <attribute name="id" type="string"/>
- <attribute name="policy" type="this:PolicyType"/>
+ <attribute name="id" type="string" use="required"/>
+ <attribute name="policy" type="this:PolicyType" default="optional"/>
</complexType>

+ <complexType name="Selection">
+ <complexContent>
+ <extension base="this:InputType">
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element name="include" type="this:SelectorType"/>
+ <element name="exclude" type="this:SelectorType"/>
+ </choice>
+ <attribute name="defaultIncludes" type="string"/>
+ <attribute name="defaultExcludes" type="string"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="SelectorType">
+ <attribute name="name" type="string"/>
+ <attribute name="filter" type="boolean" default="true"/>
+ </complexType>
+
<complexType name="OutputType">
<attribute name="id" type="string"/>
</complexType>

Modified: trunk/main/lang/process/etc/test/sample.xml
===================================================================
--- trunk/main/lang/process/etc/test/sample.xml 2006-05-01 08:40:59 UTC (rev
1421)
+++ trunk/main/lang/process/etc/test/sample.xml 2006-05-01 16:48:46 UTC (rev
1422)
@@ -1,5 +1,7 @@
<?xml version="1.0"?>
-<configuration xmlns="@PROJECT-XSD-URI@">
+<configuration xmlns="@PROJECT-XSD-URI@"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+ xmlns:this="@PROJECT-XSD-URI@">

<!-- client products -->

@@ -53,33 +55,31 @@

<process name="prepare-main"
class="net.dpml.tools.process.PrepareMainProcess">
<consumes>
- <input id="etc.main" policy="optional"/>
- <input id="src.main" policy="optional"/>
+ <input xsi:type="Selection" id="etc.main" policy="optional">
+ <include name="*.*"/>
+ <exclude name=""/>
+ </input>
+ <input xsi:type="Selection" id="src.main" policy="optional">
+ <include name="*.*"/>
+ <exclude name=""/>
+ </input>
</consumes>
- <produces>
- <output id="target.build.main.dir"/>
- </produces>
+ <produces id="target.build.main.dir"/>
</process>

<process name="prepare-test"
class="net.dpml.tools.process.PrepareTestProcess">
<consumes policy="conditional">
<input id="target.build.main.dir" policy="optional"/>
- <input id="etc.test" policy="optional"/>
<input id="src.test" policy="optional"/>
</consumes>
- <produces>
- <output id="target.build.test.dir"/>
- <output id="target.test.dir"/>
- </produces>
+ <produces id="target.build.test.dir"/>
</process>

<process name="compile-main"
class="net.dpml.tools.process.CompileMainProcess" implicit="true">
<consumes>
<input id="target.build.main.dir" policy="conditional"/>
</consumes>
- <produces>
- <output id="target.classes.main.dir"/>
- </produces>
+ <produces id="target.classes.main.dir"/>
</process>

<process name="compile-test"
class="net.dpml.tools.process.CompileTestProcess" implicit="true">
@@ -87,20 +87,30 @@
<input id="target.classes.main.dir" policy="optional"/>
<input id="target.build.test.dir" policy="conditional"/>
</consumes>
- <produces>
- <output id="target.classes.test.dir"/>
- </produces>
+ <produces id="target.classes.test.dir"/>
</process>

+ <process name="prepare-junit"
class="net.dpml.tools.process.PrepareJUnitProcess">
+ <dependencies>
+ <include id="prepare-test"/>
+ </dependencies>
+ <consumes policy="conditional">
+ <input id="etc.test" policy="optional"/>
+ </consumes>
+ <produces id="target.test.dir"/>
+ </process>
+
<process name="junit" class="net.dpml.tools.process.JunitProcess">
+ <dependencies>
+ <include id="prepare-junit"/>
+ <include id="compile-test"/>
+ </dependencies>
<consumes>
<input id="target.test.dir" policy="optional"/>
<input id="target.classes.test.dir" policy="conditional"/>
<input id="target.classes.main.dir"/>
</consumes>
- <produces>
- <output id="target.reports.test.dir"/>
- </produces>
+ <produces id="target.reports.test.dir"/>
</process>

<process name="jar" class="net.dpml.tools.process.JarProcess">
@@ -110,9 +120,7 @@
<consumes>
<input id="target.build.main.dir" policy="conditional"/>
</consumes>
- <produces>
- <output id="target.deliverables.jar"/>
- </produces>
+ <produces id="target.deliverables.jar"/>
</process>

<process name="rmic" class="net.dpml.tools.process.RMICProcess">
@@ -128,9 +136,7 @@
<consumes>
<input id="target.classes.main.dir" policy="optional"/>
</consumes>
- <produces>
- <output id="target.deliverables.part"/>
- </produces>
+ <produces id="target.deliverables.part"/>
</process>

</configuration>

Modified:
trunk/main/lang/process/src/test/net/dpml/lang/process/ProcessXsdTestCase.java
===================================================================
---
trunk/main/lang/process/src/test/net/dpml/lang/process/ProcessXsdTestCase.java
2006-05-01 08:40:59 UTC (rev 1421)
+++
trunk/main/lang/process/src/test/net/dpml/lang/process/ProcessXsdTestCase.java
2006-05-01 16:48:46 UTC (rev 1422)
@@ -136,8 +136,7 @@
for( int i=0; i<implicits.length; i++ )
{
Element implicit = implicits[i];
- String name = ElementHelper.getAttribute( implicit, "name" );
- System.out.println( "# process: " + name );
+ reportProcess( implicit );
}
System.out.println( "" );
}
@@ -158,8 +157,8 @@
Element[] processors = (Element[]) list.toArray( new Element[0] );
for( int i=0; i<processors.length; i++ )
{
- String name = ElementHelper.getAttribute( processors[i], "name"
);
- System.out.println( "# process: " + name );
+ Element process = processors[i];
+ reportProcess( process );
}
System.out.println( "" );
}
@@ -178,8 +177,8 @@
Element[] processors = (Element[]) list.toArray( new Element[0] );
for( int i=0; i<processors.length; i++ )
{
- String name = ElementHelper.getAttribute( processors[i], "name"
);
- System.out.println( "# process: " + name );
+ Element process = processors[i];
+ reportProcess( process );
}
}

@@ -272,41 +271,31 @@
{
String key = keys[i];
Element process = (Element) m_processes.get( key );
- String[] ids = getProcessProductionIDs( process );
- for( int j=0; j<ids.length; j++ )
+ String productionId = getProcessProductionID( process );
+ if( id.equals( productionId ) )
{
- String productionId = ids[j];
- if( id.equals( productionId ) )
+ getImpliedProcesses( list, process );
+ if( !list.contains( process ) )
{
- getImpliedProcesses( list, process );
- if( !list.contains( process ) )
- {
- list.add( process );
- }
+ list.add( process );
}
}
}
}

- private String[] getProcessProductionIDs( Element process )
+ private String getProcessProductionID( Element process )
{
- Element[] outputs = getOutputElements( process );
- String[] result = new String[ outputs.length ];
- for( int i=0; i<outputs.length; i++ )
+ Element produces = ElementHelper.getChild( process, "produces" );
+ if( null == produces )
{
- Element output = outputs[i];
- String out = ElementHelper.getAttribute( output, "id" );
- result[i] = out;
+ return null;
}
- return result;
+ else
+ {
+ return ElementHelper.getAttribute( produces, "id" );
+ }
}

- private Element[] getOutputElements( Element process )
- {
- Element outputs = ElementHelper.getChild( process, "produces" );
- return ElementHelper.getChildren( outputs );
- }
-
private Element[] getInputElements( Element process )
{
Element consumes = ElementHelper.getChild( process, "consumes" );
@@ -332,21 +321,25 @@
}
}
Element produces = ElementHelper.getChild( process, "produces" );
- Element[] outputs = ElementHelper.getChildren( produces );
- for( int i=0; i<outputs.length; i++ )
+ if( null != produces )
{
- Element output = outputs[i];
- String id = ElementHelper.getAttribute( output, "id" );
+ String id = ElementHelper.getAttribute( produces, "id" );
Element product = (Element) m_products.get( id );
if( null == product )
{
final String error =
- "Output element:\n"
- + DecodingException.list( output )
+ "Output production assertion:\n"
+ + DecodingException.list( produces )
+ "\n references an unknown product: "
+ id;
fail( error );
}
}
}
+
+ private void reportProcess( Element process )
+ {
+ String id = ElementHelper.getAttribute( process, "name" );
+ System.out.println( "# process: " + id );
+ }
}




  • r1422 - in trunk/main/lang/process: etc etc/test src/test/net/dpml/lang/process, mcconnell at BerliOS, 05/01/2006

Archive powered by MHonArc 2.6.24.

Top of Page