Author: ijd
Date: Mon Nov 25 20:18:50 2013
New Revision: 1545389

URL: http://svn.apache.org/r1545389
Log:
Patch for JENA-596 contributed by Shane St Clair

Added:
    
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOption.java
    
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptionsConfigurationException.java
Modified:
    jena/trunk/jena-maven-tools/pom.xml
    
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenMojo.java
    
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptions.java
    
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/Source.java
    
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SchemagenOptionsTest.java
    
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceParameterTest.java
    
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceTest.java

Modified: jena/trunk/jena-maven-tools/pom.xml
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/pom.xml?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- jena/trunk/jena-maven-tools/pom.xml (original)
+++ jena/trunk/jena-maven-tools/pom.xml Mon Nov 25 20:18:50 2013
@@ -33,7 +33,7 @@
       <name>Apache Snapshot Repository</name>
       <url>http://repository.apache.org/snapshots</url>
       <releases>
-  <enabled>false</enabled>
+        <enabled>false</enabled>
       </releases>
     </repository>
   </repositories>
@@ -59,21 +59,45 @@
     </license>
   </licenses>
   <scm>
-    <connection>FIXME 
scm:[email protected]:ephemerian/schemagen-maven.git</connection>
-    <url>FIXME https://github.com/ephemerian/schemagen-maven</url>
+    
<connection>scm:svn:http://svn.apache.org/repos/asf/jena/tags/jena-2.11.1-SNAPSHOT/jena-maven-tools</connection>
+    
<developerConnection>scm:svn:http://svn.apache.org/repos/asf/jena/tags/jena-2.11.1-SNAPSHOT/jena-maven-tools</developerConnection>
+    
<url>https://svn.apache.org/repos/asf/jena/tags/jena-2.11.1-SNAPSHOT/jena-maven-tools</url>
   </scm>
   <organization>
     <name>Apache</name>
     <url>http://www.apache.org</url>
   </organization>
   <properties>
-    <jenaCoreVersion>2.11.0</jenaCoreVersion>
+    <jenaCoreVersion>2.11.1-SNAPSHOT</jenaCoreVersion>
     <version>${project.version}</version>
   </properties>
   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <configuration>
+          <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
+          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+        </configuration>
+        <executions>
+          <execution>
+            <id>mojo-descriptor</id>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+          <!-- if you want to generate help goal -->
+          <execution>
+            <id>help-goal</id>
+            <goals>
+              <goal>helpmojo</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>    
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-javadoc-plugin</artifactId>
         <configuration>
           <version>true</version>
@@ -85,7 +109,6 @@
           <bottom>Licenced under the Apache License, Version 2.0</bottom>
         </configuration>
       </plugin>
-
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-invoker-plugin</artifactId>
@@ -121,6 +144,18 @@
   </build>
   <dependencies>
     <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>3.2</version>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-utils</artifactId>
+        </exclusion>
+      </exclusions>      
+      <scope>provided</scope>
+    </dependency>  
+    <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
       <version>3.1.1</version>

Modified: 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenMojo.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenMojo.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenMojo.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenMojo.java
 Mon Nov 25 20:18:50 2013
@@ -30,6 +30,9 @@ import jena.schemagen.SchemagenOptions.O
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
 import org.codehaus.plexus.util.DirectoryScanner;
 
 import com.hp.hpl.jena.rdf.model.Resource;
@@ -42,11 +45,8 @@ import com.hp.hpl.jena.rdf.model.Resourc
  * </p>
  *
  * @author Ian Dickinson, Epimorphics (mailto:[email protected])
- *
- * Maven Mojo options
- * @goal translate
- * @phase generate-sources
 */
+@Mojo(name="translate", defaultPhase=LifecyclePhase.GENERATE_SOURCES)
 public class SchemagenMojo
     extends AbstractMojo
 {
@@ -70,7 +70,7 @@ public class SchemagenMojo
      * Target directory
      * @parameter property="project.build.directory"
      */
-    private static String projectBuildDir;
+    public static String projectBuildDir;
 
     /** Return the value of <code>${project.build.directory}</code> */
     public static String getProjectBuildDir() {
@@ -121,30 +121,34 @@ public class SchemagenMojo
 
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        // set the default defaults
-        defaultOptions = new SchemagenOptions.DefaultSchemagenOptions();
-
-        getLog().info( "Starting schemagen execute() ...");
-
-        // next process the various options specs
-        if( fileOptions != null ){
-            for (Source p: fileOptions) {
-                if (p.isDefaultOptions()) {
-                    handleDefaultOptions( p );
-                }
-                else {
-                    handleOption( p );
+        try {
+            // set the default defaults
+            defaultOptions = new SchemagenOptions(getDefaultOutputDir());
+            getLog().info( "Starting schemagen execute() ...");
+
+            // next process the various options specs
+            if( fileOptions != null ){
+                for (Source s: fileOptions) {
+                    if (s.isDefaultOptions()) {
+                        handleDefaultOptions( s );
+                    }
+                    else {
+                        handleOption( s );
+                    }
                 }
             }
-        }
 
-        if( defaultOptions == null ){
-            handleDefaultOptions( new Source() );
-        }
+            if( defaultOptions == null ){
+                handleDefaultOptions( new Source() );
+            }
 
-        // then the files themselves
-        for (String fileName: matchFileNames()) {
-            processFile( fileName );
+            // then the files themselves
+            for (String fileName: matchFileNames()) {
+                processFile( fileName );
+            }            
+        } catch (SchemagenOptionsConfigurationException e) {
+            throw new MojoExecutionException(
+                    "Error during default schemagen options creation", e);
         }
     }
 
@@ -187,12 +191,16 @@ public class SchemagenMojo
      * Handle the default options by creating a default options object and 
assigning
      * the options values from the given source object.
      * @param defOptionsSource The source object containing the default options
+     * @throws SchemagenOptionsConfigurationException 
      */
-    protected void handleDefaultOptions( Source defOptionsSource ) {
+    protected void handleDefaultOptions( Source defOptionsSource )
+            throws SchemagenOptionsConfigurationException {
+        SchemagenOptions defSo = new SchemagenOptions(getDefaultOutputDir(),
+                defOptionsSource);
         if (defaultOptions != null) {
-            defOptionsSource.setParent( defaultOptions );
+            defSo.setParent( defaultOptions );
         }
-        defaultOptions = defOptionsSource;
+        defaultOptions = defSo;
     }
 
     /**
@@ -200,11 +208,13 @@ public class SchemagenMojo
      * by attaching the default options and indexing.
      *
      * @param optionSpec Specification of the options for a given file
+     * @throws SchemagenOptionsConfigurationException 
      */
-    protected void handleOption( Source optionSpec ) {
-        if (optionSpec.getFileName() != null) {
-            optionSpec.setParent( getDefaultOptions() );
-            optIndex.put( optionSpec.getFileName(), optionSpec );
+    protected void handleOption( Source optionSpec ) throws 
SchemagenOptionsConfigurationException {
+        SchemagenOptions so = new SchemagenOptions(getDefaultOutputDir(), 
optionSpec);
+        if (optionSpec.getInput() != null && !optionSpec.getInput().isEmpty()) 
{
+            so.setParent( getDefaultOptions() );
+            optIndex.put( optionSpec.getInput(), so );
         }
         else {
             getLog().info( "ignoring <source> element because the fileName is 
not specified" );
@@ -214,9 +224,10 @@ public class SchemagenMojo
     /**
      * Delegate the processing of the given file to schemagen itself
      * @param fileName
+     * @throws SchemagenOptionsConfigurationException 
      */
     protected void processFile( String fileName )
-        throws MojoExecutionException
+        throws MojoExecutionException, SchemagenOptionsConfigurationException
     {
         //fix windows paths
         if( File.separator.equals("\\") ){
@@ -232,7 +243,7 @@ public class SchemagenMojo
         // the name of the input file, and link it to the defaults
         String soFileName;
         if (so == null) {
-            so = new Source();
+            so = new SchemagenOptions(getDefaultOutputDir());
             soFileName = fileName;
             so.setParent( getDefaultOptions() );
         } else {
@@ -329,6 +340,9 @@ public class SchemagenMojo
         }
     }
 
+    protected String getDefaultOutputDir(){
+        return projectBuildDir + GENERATED_SOURCES;
+    }
 
     /***********************************/
     /* Inner classes                   */

Added: 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOption.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOption.java?rev=1545389&view=auto
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOption.java
 (added)
+++ 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOption.java
 Mon Nov 25 20:18:50 2013
@@ -0,0 +1,18 @@
+package org.openjena.tools.schemagen;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import jena.schemagen.SchemagenOptions;
+
+/**
+ * Annotation to designate linkages between Maven configured properties
+ * in Source and options in SchemagenOptions.  
+ */
+@Target(ElementType.METHOD)
+@Retention(value = RetentionPolicy.RUNTIME)
+public @interface SchemagenOption {
+    SchemagenOptions.OPT opt();
+}

Modified: 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptions.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptions.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptions.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptions.java
 Mon Nov 25 20:18:50 2013
@@ -16,7 +16,8 @@ package org.openjena.tools.schemagen;
 // Imports
 ///////////////
 
-import java.util.*;
+import java.lang.reflect.Method;
+import java.util.List;
 
 import jena.schemagen;
 import jena.schemagen.OptionDefinition;
@@ -24,7 +25,9 @@ import jena.schemagen.OptionDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.hp.hpl.jena.rdf.model.*;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.ResourceFactory;
 
 
 /**
@@ -60,12 +63,30 @@ public class SchemagenOptions
     /** The parent options for this options instance */
     private SchemagenOptions parent;
 
-    /***********************************/
     /* Constructors                    */
-    /***********************************/
 
-    public SchemagenOptions() {
+    public SchemagenOptions() throws SchemagenOptionsConfigurationException {
+        this(null, null);
+    }
+
+    public SchemagenOptions(String defaultOutputDir)
+            throws SchemagenOptionsConfigurationException {
+        this(defaultOutputDir, null);
+    }
+
+    public SchemagenOptions(String defaultOutputDir, Source options)
+            throws SchemagenOptionsConfigurationException {
         super( new String[]{} );
+
+        //set output to default, source options may override
+        if (defaultOutputDir != null) {
+            setOption( OPT.OUTPUT, defaultOutputDir );
+        }
+        
+        //set schemagen options from Maven plugin config Source
+        if (options != null) {
+            configure(options);
+        }
     }
 
     /***********************************/
@@ -169,6 +190,38 @@ public class SchemagenOptions
     /* Internal implementation methods */
     /***********************************/
 
+    /**
+     * Configure SchemagenOptions from Source object
+     * @param options Options from Maven configuration
+     * @throws SchemagenOptionsConfigurationException 
+     */
+    protected void configure(Source options) throws 
SchemagenOptionsConfigurationException {
+        for(Method method : options.getClass().getMethods()) {
+            SchemagenOption schemagenOptionAnnotation =
+                    method.getAnnotation(SchemagenOption.class);
+            if (schemagenOptionAnnotation != null) {
+                Object optionValue = null;
+                try {
+                    optionValue = method.invoke(options);
+                } catch (Exception e) {
+                    throw new SchemagenOptionsConfigurationException(e);
+                }
+                OPT option = schemagenOptionAnnotation.opt();
+                if (optionValue != null) {
+                    if (optionValue instanceof String) {
+                        setOption(option, (String) optionValue);    
+                    } else if (optionValue instanceof Boolean) {
+                        setOption(option, (Boolean) optionValue);              
          
+                    } else {
+                        throw new IllegalArgumentException("Schemagen options 
of type "
+                                + optionValue.getClass().getCanonicalName()
+                                + " are not allowed");
+                    }
+                }
+            }
+        }
+    }
+    
     protected OPT asOption( String optString ) {
         return OPT.valueOf( optString );
     }
@@ -240,18 +293,4 @@ public class SchemagenOptions
         return (l.isEmpty() && hasParent()) ? getParent().getAllValues( option 
) : l;
     }
 
-    /***********************************/
-    /* Inner class definitions         */
-    /***********************************/
-
-    /**
-     * Default options for schemagen if no other options are specified
-     */
-    public static class DefaultSchemagenOptions
-        extends SchemagenOptions
-    {
-        public DefaultSchemagenOptions() {
-            setOption( OPT.OUTPUT, SchemagenMojo.getProjectBuildDir() + 
SchemagenMojo.GENERATED_SOURCES );
-        }
-    }
 }
\ No newline at end of file

Added: 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptionsConfigurationException.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptionsConfigurationException.java?rev=1545389&view=auto
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptionsConfigurationException.java
 (added)
+++ 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/SchemagenOptionsConfigurationException.java
 Mon Nov 25 20:18:50 2013
@@ -0,0 +1,9 @@
+package org.openjena.tools.schemagen;
+
+public class SchemagenOptionsConfigurationException extends Exception {
+    private static final long serialVersionUID = -133784377465911397L;
+    
+    public SchemagenOptionsConfigurationException(Throwable cause){
+        super(cause);
+    }
+}

Modified: 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/Source.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/Source.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/Source.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/main/java/org/openjena/tools/schemagen/Source.java
 Mon Nov 25 20:18:50 2013
@@ -12,254 +12,477 @@
 
 package org.openjena.tools.schemagen;
 
+import jena.schemagen.SchemagenOptions.OPT;
 
-
-// Imports
-///////////////
-
+import org.apache.maven.plugins.annotations.Parameter;
 
 /**
  * <p>Simple container object to hold the per-source configuration
- * values from the <code>pom.xml</code>.</p>
+ * values from the <code>pom.xml</code>.</p> Source objects are used
+ * configure SchemagenOptions object during plugin execution.
+ * 
+ * Use Parameter annotations on fields to designate Maven properties and
+ * SchemagenOption annotations on getters to designate SchemagenOptions
+ * destination options. 
  *
  * @author Ian Dickinson, Epimorphics (mailto:[email protected])
+ * @author Shane StClair, Axiom Alaska (mailto:[email protected]) 
  */
-public class Source
-    extends SchemagenOptions
-{
-    /***********************************/
-    /* Constants                       */
-    /***********************************/
+public class Source {
+    /** Name of default options element */
+    public static final String DEFAULT_OPTIONS_ELEM = "default";
+
+    @Parameter(property="config-file")
+    private String configFile;
+
+    @Parameter(property="no-comments")
+    private Boolean noComments;
+
+    @Parameter
+    private String input;
+
+    @Parameter(property="lang-daml")
+    private Boolean langDaml;
+
+    @Parameter(property="lang-owl")
+    private Boolean langOwl;
+
+    @Parameter(property="lang-rdfs")
+    private Boolean langRdfs;
+
+    @Parameter
+    private String output;
+
+    @Parameter
+    private String header;
+
+    @Parameter
+    private String footer;
+
+    @Parameter
+    private String root;
+
+    @Parameter
+    private String marker;
+
+    @Parameter(property="package-name")
+    private String packageName;
+
+    @Parameter
+    private Boolean ontology;
+
+    @Parameter(property="classname")
+    private String className;
+    
+    @Parameter(property="classdec")
+    private String classDec;
+
+    @Parameter
+    private String namespace;
+
+    @Parameter
+    private String declarations;
+
+    @Parameter(property="property-section")
+    private String propertySection;
+
+    @Parameter(property="class-section")
+    private String classSection;
+
+    @Parameter(property="individuals-section")
+    private String individualsSection;
+
+    @Parameter(property="noproperties")
+    private Boolean noProperties;    
+
+    @Parameter(property="noclasses")
+    private Boolean noClasses;    
+
+    @Parameter(property="noindividuals")
+    private Boolean noIndividuals;
+
+    @Parameter(property="noheader")
+    private Boolean noHeader;    
+
+    @Parameter(property="prop-template")
+    private String propTemplate;
+
+    @Parameter(property="classtemplate")
+    private String classTemplate;
+
+    @Parameter(property="individualtemplate")
+    private String individualTemplate;
 
-    /***********************************/
-    /* Static variables                */
-    /***********************************/
+    @Parameter(property="uc-names")
+    private Boolean ucNames;
 
+    @Parameter
+    private String include;
 
-    /***********************************/
-    /* Instance variables              */
-    /***********************************/
+    @Parameter(property="classname-suffix")
+    private String classNameSuffix;
 
-    /***********************************/
-    /* Constructors                    */
-    /***********************************/
+    @Parameter
+    private String encoding;
 
-    /***********************************/
-    /* External signature methods      */
-    /***********************************/
+    @Parameter
+    private Boolean help;
 
-    public String getFileName() {
-        return getStringOption( OPT.INPUT );
+    @Parameter
+    private Boolean dos;    
+
+    @Parameter(property="use-inf")
+    private Boolean useInf;
+
+    @Parameter(property="strict-individuals")
+    private Boolean strictIndividuals;
+
+    @Parameter(property="include-source")
+    private Boolean includeSource;
+
+    @Parameter(property="no-strict")
+    private Boolean noStrict;    
+
+    @SchemagenOption(opt=OPT.CONFIG_FILE)
+    public String getConfigFile() {
+        return configFile;
     }
 
-    /** @parameter expr="config-file" */
-    public void setConfigFile( String arg ) {
-        setOption( OPT.CONFIG_FILE, arg );
+    @SchemagenOption(opt=OPT.NO_COMMENTS)
+    public Boolean isNoComments() {
+        return noComments;
     }
 
-    /** @parameter expr="no-comments" */
-    public void setNoComments( String arg ) {
-        setOption( OPT.NO_COMMENTS, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.INPUT)
+    public String getInput() {
+        return input;
     }
 
-    /** @parameter expr="input" */
-    public void setInput( String arg ) {
-        setOption( OPT.INPUT, arg );
+    @SchemagenOption(opt=OPT.LANG_DAML)
+    public Boolean isLangDaml() {
+        return langDaml;
     }
 
-    /** @parameter expr="lang-daml" */
-    public void setLangDaml( String arg ) {
-        setOption( OPT.LANG_DAML, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.LANG_OWL)
+    public Boolean isLangOwl() {
+        return langOwl;
     }
 
-    /** @parameter expr="lang-owl" */
-    public void setLangOwl( String arg ) {
-        setOption( OPT.LANG_OWL, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.LANG_RDFS)    
+    public Boolean isLangRdfs() {
+        return langRdfs;
     }
 
-    /** @parameter expr="lang-rdfs" */
-    public void setLangRdfs( String arg ) {
-        setOption( OPT.LANG_RDFS, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.OUTPUT)
+    public String getOutput() {
+        return output;
     }
 
-    /** @parameter expr="output" */
-    public void setOutput( String arg ) {
-        setOption( OPT.OUTPUT, arg );
+    @SchemagenOption(opt=OPT.HEADER)
+    public String getHeader() {
+        return header;
     }
 
-    /** @parameter expr="header" */
-    public void setHeader( String arg ) {
-        setOption( OPT.HEADER, arg );
+    @SchemagenOption(opt=OPT.FOOTER)
+    public String getFooter() {
+        return footer;
     }
 
-    /** @parameter expr="footer" */
-    public void setFooter( String arg ) {
-        setOption( OPT.FOOTER, arg );
+    @SchemagenOption(opt=OPT.ROOT)
+    public String getRoot() {
+        return root;
     }
 
-    /** @parameter expr="root" */
-    public void setRoot( String arg ) {
-        setOption( OPT.ROOT, arg );
+    @SchemagenOption(opt=OPT.MARKER)
+    public String getMarker() {
+        return marker;
     }
 
-    /** @parameter expr="marker" */
-    public void setMarker( String arg ) {
-        setOption( OPT.MARKER, arg );
+    @SchemagenOption(opt=OPT.PACKAGENAME)
+    public String getPackageName() {
+        return packageName;
     }
 
-    /** @parameter expr="package-name" */
-    public void setPackageName( String arg ) {
-        setOption( OPT.PACKAGENAME, arg );
+    @SchemagenOption(opt=OPT.ONTOLOGY)
+    public Boolean isOntology() {
+        return ontology;
     }
 
-    /** @parameter expr="ontology" */
-    public void setOntology( String arg ) {
-        setOption( OPT.ONTOLOGY, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.CLASSNAME)
+    public String getClassName() {
+        return className;
     }
 
-    /** @parameter expr="classname" */
-    public void setClassName( String arg ) {
-        setOption( OPT.CLASSNAME, arg );
+    @SchemagenOption(opt=OPT.CLASSDEC)
+    public String getClassDec() {
+        return classDec;
     }
 
-    /** @parameter expr="classdec" */
-    public void setClassDec( String arg ) {
-        setOption( OPT.CLASSDEC, arg );
+    @SchemagenOption(opt=OPT.NAMESPACE)
+    public String getNamespace() {
+        return namespace;
     }
 
-    /** @parameter expr="namespace" */
-    public void setNamespace( String arg ) {
-        setOption( OPT.NAMESPACE, arg );
+    @SchemagenOption(opt=OPT.DECLARATIONS)
+    public String getDeclarations() {
+        return declarations;
     }
 
-    /** @parameter expr="declarations" */
-    public void setDeclarations( String arg ) {
-        setOption( OPT.DECLARATIONS, arg );
+    @SchemagenOption(opt=OPT.PROPERTY_SECTION)
+    public String getPropertySection() {
+        return propertySection;
     }
 
-    /** @parameter expr="property-section" */
-    public void setPropertySection( String arg ) {
-        setOption( OPT.PROPERTY_SECTION, arg );
+    @SchemagenOption(opt=OPT.CLASS_SECTION)
+    public String getClassSection() {
+        return classSection;
     }
 
-    /** @parameter expr="class-section" */
-    public void setClassSection( String arg ) {
-        setOption( OPT.CLASS_SECTION, arg );
+    @SchemagenOption(opt=OPT.INDIVIDUALS_SECTION)
+    public String getIndividualsSection() {
+        return individualsSection;
     }
 
-    /** @parameter expr="individuals-section" */
-    public void setIndividualsSection( String arg ) {
-        setOption( OPT.INDIVIDUALS_SECTION, arg );
+    @SchemagenOption(opt=OPT.NOPROPERTIES)
+    public Boolean isNoProperties() {
+        return noProperties;
     }
 
-    /** @parameter expr="noproperties" */
-    public void setNoProperties( String arg ) {
-        setOption( OPT.NOPROPERTIES, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.NOCLASSES)
+    public Boolean isNoClasses() {
+        return noClasses;
     }
 
-    /** @parameter expr="noclasses" */
-    public void setNoClasses( String arg ) {
-        setOption( OPT.NOCLASSES, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.NOINDIVIDUALS)
+    public Boolean isNoIndividuals() {
+        return noIndividuals;
     }
 
-    /** @parameter expr="noindividuals" */
-    public void setNoIndividuals( String arg ) {
-        setOption( OPT.NOINDIVIDUALS, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.NOHEADER)
+    public Boolean isNoHeader() {
+        return noHeader;
     }
 
-    /** @parameter expr="noheader" */
-    public void setNoHeader( String arg ) {
-        setOption( OPT.NOHEADER, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.PROP_TEMPLATE)
+    public String getPropTemplate() {
+        return propTemplate;
     }
 
-    /** @parameter expr="prop-template" */
-    public void setPropTemplate( String arg ) {
-        setOption( OPT.PROP_TEMPLATE, arg );
+    @SchemagenOption(opt=OPT.CLASS_TEMPLATE)
+    public String getClassTemplate() {
+        return classTemplate;
     }
 
-    /** @parameter expr="classttemplate" */
-    public void setClassTemplate( String arg ) {
-        setOption( OPT.CLASS_TEMPLATE, arg );
+    @SchemagenOption(opt=OPT.INDIVIDUAL_TEMPLATE)
+    public String getIndividualTemplate() {
+        return individualTemplate;
     }
 
-    /** @parameter expr="individualttemplate" */
-    public void setIndividualTemplate( String arg ) {
-        setOption( OPT.INDIVIDUAL_TEMPLATE, arg );
+    @SchemagenOption(opt=OPT.UC_NAMES)
+    public Boolean isUcNames() {
+        return ucNames;
     }
 
-    /** @parameter expr="uc-names" */
-    public void setUcNames( String arg ) {
-        setOption( OPT.UC_NAMES, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.INCLUDE)
+    public String getInclude() {
+        return include;
     }
 
-    /** @parameter expr="include" */
-    public void setInclude( String arg ) {
-        setOption( OPT.INCLUDE, arg );
+    @SchemagenOption(opt=OPT.CLASSNAME_SUFFIX)
+    public String getClassNameSuffix() {
+        return classNameSuffix;
     }
 
-    /** @parameter expr="classname-suffix" */
-    public void setClassNameSuffix( String arg ) {
-        setOption( OPT.CLASSNAME_SUFFIX, arg );
+    @SchemagenOption(opt=OPT.ENCODING)
+    public String getEncoding() {
+        return encoding;
     }
 
-    /** @parameter expr="encoding" */
-    public void setEncoding( String arg ) {
-        setOption( OPT.ENCODING, arg );
+    @SchemagenOption(opt=OPT.HELP)
+    public Boolean isHelp() {
+        return help;
     }
 
-    /** @parameter expr="help" */
-    public void setHelp( String arg ) {
-        setOption( OPT.HELP, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.DOS)
+    public Boolean isDos() {
+        return dos;
     }
 
-    /** @parameter expr="dos" */
-    public void setDos( String arg ) {
-        setOption( OPT.DOS, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.USE_INF)
+    public Boolean isUseInf() {
+        return useInf;
     }
 
-    /** @parameter expr="use-inf" */
-    public void setUseInf( String arg ) {
-        setOption( OPT.USE_INF, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.STRICT_INDIVIDUALS)
+    public Boolean isStrictIndividuals() {
+        return strictIndividuals;
     }
 
-    /** @parameter expr="strict-individuals" */
-    public void setStrictIndividuals( String arg ) {
-        setOption( OPT.STRICT_INDIVIDUALS, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.INCLUDE_SOURCE)
+    public Boolean isIncludeSource() {
+        return includeSource;
     }
 
-    /** @parameter expr="include-source" */
-    public void setIncludeSource( String arg ) {
-        setOption( OPT.INCLUDE_SOURCE, trueArg( arg ) );
+    @SchemagenOption(opt=OPT.NO_STRICT)
+    public Boolean isNoStrict() {
+        return noStrict;
     }
 
-    /** @parameter expr="no-strict" */
-    public void setNoStrict( String arg ) {
-        setOption( OPT.NO_STRICT, trueArg( arg ) );
+    public void setConfigFile(String configFile) {
+        this.configFile = configFile;
     }
 
+    public void setNoComments(Boolean noComments) {
+        this.noComments = noComments;
+    }
+    
+    public void setInput(String input) {
+        this.input = input;
+    }
 
-    /**
-     * Return true if this source actually represents the default options
-     * element
-     *
-     * @return True for the default options
-     */
-    public boolean isDefaultOptions() {
-        return getFileName().equals( SchemagenMojo.DEFAULT_OPTIONS_ELEM );
+    public void setLangDaml(Boolean langDaml) {
+        this.langDaml = langDaml;
+    }
+
+    public void setLangOwl(Boolean langOwl) {
+        this.langOwl = langOwl;
+    }
+
+    public void setLangRdfs(Boolean langRdfs) {
+        this.langRdfs = langRdfs;
+    }
+
+    public void setOutput(String output) {
+        this.output = output;
+    }
+
+    public void setHeader(String header) {
+        this.header = header;
+    }
+
+    public void setFooter(String footer) {
+        this.footer = footer;
+    }
+
+    public void setRoot(String root) {
+        this.root = root;
+    }
+
+    public void setMarker(String marker) {
+        this.marker = marker;
+    }
+
+    public void setPackageName(String packageName) {
+        this.packageName = packageName;
+    }
+
+    public void setOntology(Boolean ontology) {
+        this.ontology = ontology;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public void setClassDec(String classDec) {
+        this.classDec = classDec;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    public void setDeclarations(String declarations) {
+        this.declarations = declarations;
+    }
+
+    public void setPropertySection(String propertySection) {
+        this.propertySection = propertySection;
+    }
+
+    public void setClassSection(String classSection) {
+        this.classSection = classSection;
+    }
+
+    public void setIndividualsSection(String individualsSection) {
+        this.individualsSection = individualsSection;
+    }
+
+    public void setNoProperties(Boolean noProperties) {
+        this.noProperties = noProperties;
     }
 
+    public void setNoClasses(Boolean noClasses) {
+        this.noClasses = noClasses;
+    }
 
-    /***********************************/
-    /* Internal implementation methods */
-    /***********************************/
+    public void setNoIndividuals(Boolean noIndividuals) {
+        this.noIndividuals = noIndividuals;
+    }
 
-    private boolean trueArg( String arg ) {
-        return !"false".equals( arg );
+    public void setNoHeader(Boolean noHeader) {
+        this.noHeader = noHeader;
     }
 
-    /***********************************/
-    /* Inner class definitions         */
-    /***********************************/
+    public void setPropTemplate(String propTemplate) {
+        this.propTemplate = propTemplate;
+    }
 
-}
+    public void setClassTemplate(String classTemplate) {
+        this.classTemplate = classTemplate;
+    }
 
+    public void setIndividualTemplate(String individualTemplate) {
+        this.individualTemplate = individualTemplate;
+    }
+
+    public void setUcNames(Boolean ucNames) {
+        this.ucNames = ucNames;
+    }
+
+    public void setInclude(String include) {
+        this.include = include;
+    }
+
+    public void setClassNameSuffix(String classNameSuffix) {
+        this.classNameSuffix = classNameSuffix;
+    }
+
+    public void setEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
+    public void setHelp(Boolean help) {
+        this.help = help;
+    }
+
+    public void setDos(Boolean dos) {
+        this.dos = dos;
+    }
+
+    public void setUseInf(Boolean useInf) {
+        this.useInf = useInf;
+    }
+
+    public void setStrictIndividuals(Boolean strictIndividuals) {
+        this.strictIndividuals = strictIndividuals;
+    }
+
+    public void setIncludeSource(Boolean includeSource) {
+        this.includeSource = includeSource;
+    }
+
+    public void setNoStrict(Boolean noStrict) {
+        this.noStrict = noStrict;
+    }
+
+    /**
+     * Return true if this source actually represents the default options
+     * element
+     *
+     * @return True for the default options
+     */
+    public boolean isDefaultOptions() {
+        return input.equals( DEFAULT_OPTIONS_ELEM );
+    }
+}
\ No newline at end of file

Modified: 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SchemagenOptionsTest.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SchemagenOptionsTest.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SchemagenOptionsTest.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SchemagenOptionsTest.java
 Mon Nov 25 20:18:50 2013
@@ -69,18 +69,20 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#getParent()}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetParent() {
+    public void testGetParent() throws SchemagenOptionsConfigurationException {
         SchemagenOptions so = new SchemagenOptions();
         assertNull( so.getParent() );
     }
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#setParent(org.openjena.tools.schemagen.SchemagenOptions)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testSetParent() {
+    public void testSetParent() throws SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -89,9 +91,10 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#hasParent()}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testHasParent() {
+    public void testHasParent() throws SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -101,15 +104,16 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#getOption(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetOption0() {
+    public void testGetOption0() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         assertNull( so0.getOption( OPT.CLASS_SECTION ));
     }
 
     @Test
-    public void testGetOption1() {
+    public void testGetOption1() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -117,14 +121,14 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetOption2() {
+    public void testGetOption2() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.CLASS_SECTION, "test123" );
         assertEquals( "test123", so0.getOption( OPT.CLASS_SECTION 
).asLiteral().getString() );
     }
 
     @Test
-    public void testGetOption3() {
+    public void testGetOption3() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -133,7 +137,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetOption4() {
+    public void testGetOption4() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -142,7 +146,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetOption5() {
+    public void testGetOption5() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -153,9 +157,10 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#setOption(java.lang.String, 
java.lang.String)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testSetOptionStringString() {
+    public void testSetOptionStringString() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( "CLASS_SECTION", "test123" );
         assertEquals( "test123", so0.getOption( OPT.CLASS_SECTION 
).asLiteral().getString() );
@@ -163,24 +168,26 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#asOption(java.lang.String)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testAsOption() {
+    public void testAsOption() throws SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         assertSame( OPT.DOS, so0.asOption( "DOS" ));
     }
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#isTrue(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testIsTrueOPT0() {
+    public void testIsTrueOPT0() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         assertFalse( so0.isTrue( OPT.DOS ));
     }
 
     @Test
-    public void testIsTrueOPT1() {
+    public void testIsTrueOPT1() throws SchemagenOptionsConfigurationException 
{
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.DOS, true );
         assertTrue( so0.isTrue( OPT.DOS ));
@@ -188,22 +195,23 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#hasValue(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testHasValueOPT0() {
+    public void testHasValueOPT0() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         assertFalse( so0.hasValue( OPT.CLASS_SECTION ));
     }
 
     @Test
-    public void testHasValueOPT1() {
+    public void testHasValueOPT1() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.CLASS_SECTION, "foo" );
         assertTrue( so0.hasValue( OPT.CLASS_SECTION ));
     }
 
     @Test
-    public void testHasValueOPT2() {
+    public void testHasValueOPT2() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -213,22 +221,23 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#getValue(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetValueOPT0() {
+    public void testGetValueOPT0() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         assertNull( so0.getValue( OPT.CLASS_SECTION ));
     }
 
     @Test
-    public void testGetValueOPT1() {
+    public void testGetValueOPT1() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.CLASS_SECTION, "foo" );
         assertEquals( "foo", so0.getValue( OPT.CLASS_SECTION 
).asLiteral().getString() );
     }
 
     @Test
-    public void testGetValueOPT2() {
+    public void testGetValueOPT2() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -237,7 +246,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetValueOPT3() {
+    public void testGetValueOPT3() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -248,15 +257,16 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#hasResourceValue(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testHasResourceValueOPT0() {
+    public void testHasResourceValueOPT0() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         assertFalse( so0.hasResourceValue( OPT.ROOT ));
     }
 
     @Test
-    public void testHasResourceValueOPT1() {
+    public void testHasResourceValueOPT1() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         Resource r = ResourceFactory.createResource( "http://example.org/foo"; 
);
         so0.setOption( OPT.ROOT, r );
@@ -264,7 +274,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testHasResourceValueOPT2() {
+    public void testHasResourceValueOPT2() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -275,15 +285,16 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#getResource(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetResourceOPT0() {
+    public void testGetResourceOPT0() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         assertNull( so0.getResource( OPT.ROOT ));
     }
 
     @Test
-    public void testGetResourceValueOPT1() {
+    public void testGetResourceValueOPT1() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         Resource r = ResourceFactory.createResource( "http://example.org/foo"; 
);
         so0.setOption( OPT.ROOT, r );
@@ -291,7 +302,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetResourceValueOPT2() {
+    public void testGetResourceValueOPT2() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -301,7 +312,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetResourceValueOPT3() {
+    public void testGetResourceValueOPT3() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );
@@ -314,9 +325,10 @@ public class SchemagenOptionsTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.SchemagenOptions#getAllValues(jena.schemagen.SchemagenOptions.OPT)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetAllValuesOPT0() {
+    public void testGetAllValuesOPT0() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         List<String> l = so0.getAllValues( OPT.INCLUDE );
         assertNotNull( l );
@@ -324,7 +336,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetAllValuesOPT1() {
+    public void testGetAllValuesOPT1() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.INCLUDE, "foo" );
         List<String> l = so0.getAllValues( OPT.INCLUDE );
@@ -334,7 +346,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetAllValuesOPT2() {
+    public void testGetAllValuesOPT2() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         so0.setOption( OPT.INCLUDE, "foo" );
         so0.setOption( OPT.INCLUDE, "bar" );
@@ -346,7 +358,7 @@ public class SchemagenOptionsTest
     }
 
     @Test
-    public void testGetAllValuesOPT3() {
+    public void testGetAllValuesOPT3() throws 
SchemagenOptionsConfigurationException {
         SchemagenOptions so0 = new SchemagenOptions();
         SchemagenOptions so1 = new SchemagenOptions();
         so0.setParent( so1 );

Modified: 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceParameterTest.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceParameterTest.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceParameterTest.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceParameterTest.java
 Mon Nov 25 20:18:50 2013
@@ -100,12 +100,14 @@ public class SourceParameterTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.Source#getFileName()}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testGetOption() {
+    public void testGetOption() throws SchemagenOptionsConfigurationException {
         Source s = new Source();
         setParamValue( s );
-        assertEquals( optionName, expected, s.getOption( option 
).asLiteral().getValue() );
+        SchemagenOptions so = new SchemagenOptions(null, s);
+        assertEquals( optionName, expected, so.getOption( option 
).asLiteral().getValue() );
     }
 
 
@@ -243,97 +245,97 @@ public class SourceParameterTest
 
             // Boolean options
             case DOS:
-                s.setDos( optionName );
+                s.setDos( true );
 
                 expected = true;
                 break;
 
             case HELP:
-                s.setHelp( optionName );
+                s.setHelp( true );
 
                 expected = true;
                 break;
 
             case INCLUDE_SOURCE:
-                s.setIncludeSource( optionName );
+                s.setIncludeSource( true );
 
                 expected = true;
                 break;
 
             case LANG_DAML:
-                s.setLangDaml( optionName );
+                s.setLangDaml( true );
 
                 expected = true;
                 break;
 
             case LANG_OWL:
-                s.setLangOwl( optionName );
+                s.setLangOwl( true );
 
                 expected = true;
                 break;
 
             case LANG_RDFS:
-                s.setLangRdfs( optionName );
+                s.setLangRdfs( true );
 
                 expected = true;
                 break;
 
             case NOCLASSES:
-                s.setNoClasses( optionName );
+                s.setNoClasses( true );
 
                 expected = true;
                 break;
 
             case NOHEADER:
-                s.setNoHeader( optionName );
+                s.setNoHeader( true );
 
                 expected = true;
                 break;
 
             case NOINDIVIDUALS:
-                s.setNoIndividuals( optionName );
+                s.setNoIndividuals( true );
 
                 expected = true;
                 break;
 
             case NOPROPERTIES:
-                s.setNoProperties( optionName );
+                s.setNoProperties( true );
 
                 expected = true;
                 break;
 
             case NO_COMMENTS:
-                s.setNoComments( optionName );
+                s.setNoComments( true );
 
                 expected = true;
                 break;
 
             case NO_STRICT:
-                s.setNoStrict( optionName );
+                s.setNoStrict( true );
 
                 expected = true;
                 break;
 
             case ONTOLOGY:
-                s.setOntology( optionName );
+                s.setOntology( true );
 
                 expected = true;
                 break;
 
             case STRICT_INDIVIDUALS:
-                s.setStrictIndividuals( optionName );
+                s.setStrictIndividuals( true );
 
                 expected = true;
                 break;
 
             case UC_NAMES:
-                s.setUcNames( optionName );
+                s.setUcNames( true );
 
                 expected = true;
                 break;
 
             case USE_INF:
-                s.setUseInf( optionName );
+                s.setUseInf( true );
 
                 expected = true;
                 break;

Modified: 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceTest.java
URL: 
http://svn.apache.org/viewvc/jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceTest.java?rev=1545389&r1=1545388&r2=1545389&view=diff
==============================================================================
--- 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceTest.java
 (original)
+++ 
jena/trunk/jena-maven-tools/src/test/java/org/openjena/tools/schemagen/SourceTest.java
 Mon Nov 25 20:18:50 2013
@@ -23,6 +23,7 @@ import java.util.List;
 import jena.schemagen.SchemagenOptions.OPT;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -68,28 +69,32 @@ public class SourceTest
 
     /**
      * Test method for {@link 
org.openjena.tools.schemagen.Source#setInput(java.lang.String)}.
+     * @throws SchemagenOptionsConfigurationException 
      */
     @Test
-    public void testSetInput0() {
-        Source s = new Source();
-        List<String> values = s.getAllValues( OPT.INPUT );
+    public void testSetInput0() throws SchemagenOptionsConfigurationException {
+        SchemagenOptions so = new SchemagenOptions(null, new Source()); 
+        List<String> values = so.getAllValues( OPT.INPUT );
         assertListMatch( new String[] {}, new String[] {}, 0, values );
     }
 
     @Test
-    public void testSetInput1() {
-        Source s = new Source();
+    public void testSetInput1() throws SchemagenOptionsConfigurationException {
+        Source s = new Source();        
         s.setInput( "__file1" );
-        List<String> values = s.getAllValues( OPT.INPUT );
+        SchemagenOptions so = new SchemagenOptions(null, s);        
+        List<String> values = so.getAllValues( OPT.INPUT );
         assertListMatch( new String[] {"__file1"}, new String[] {}, 1, values 
);
     }
 
     @Test
-    public void testSetInput2() {
-        Source s = new Source();
+    @Ignore //jena-maven-tools doesn't support multiple inputs as of now
+    public void testSetInput2() throws SchemagenOptionsConfigurationException {
+        Source s = new Source();        
         s.setInput( "__file1" );
         s.setInput( "__file2" );
-        List<String> values = s.getAllValues( OPT.INPUT );
+        SchemagenOptions so = new SchemagenOptions(null, s);        
+        List<String> values = so.getAllValues( OPT.INPUT );
         assertListMatch( new String[] {"__file1", "__file2"}, new String[] {}, 
2, values );
     }
 


Reply via email to