Author: rec Date: Fri Feb 15 10:32:32 2013 New Revision: 1446500 URL: http://svn.apache.org/r1446500 Log: [UIMA-2553] Maven plugin to generate component descriptors from uimaFIT annotations at build time https://issues.apache.org/jira/browse/UIMA-2553 - Added simple integration test
Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml (with props) uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml (with props) uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java (with props) uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh (with props) uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml (with props) Modified: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/pom.xml Modified: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/pom.xml?rev=1446500&r1=1446499&r2=1446500&view=diff ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/pom.xml (original) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/pom.xml Fri Feb 15 10:32:32 2013 @@ -128,6 +128,40 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>maven-invoker-plugin</artifactId> + <configuration> + <debug>true</debug> + <projectsDirectory>src/it</projectsDirectory> + <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + <pomIncludes> + <pomInclude>*/pom.xml</pomInclude> + </pomIncludes> + <postBuildHookScript>verify</postBuildHookScript> + <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> + <settingsFile>src/it/settings.xml</settingsFile> + <goals> + <goal>clean</goal> + <goal>test-compile</goal> + </goals> + </configuration> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>install</goal> + <goal>run</goal> + </goals> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.4</version> + </dependency> + </dependencies> + </plugin> </plugins> <pluginManagement> <plugins> Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml?rev=1446500&view=auto ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml (added) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml Fri Feb 15 10:32:32 2013 @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.uima.fit.maven.it</groupId> + <artifactId>default</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>Test for default configuration</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.uima</groupId> + <artifactId>uimafit</artifactId> + <version>@pom.version@</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.uima</groupId> + <artifactId>uimafit-maven-plugin</artifactId> + <version>@pom.version@</version> + <configuration> + <componentVendor>Apache UIMA</componentVendor> + <componentCopyright>Copyright by the respective authors.</componentCopyright> + </configuration> + <executions> + <execution> + <id>default</id> + <phase>process-classes</phase> + <goals> + <goal>enhance</goal> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/pom.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml?rev=1446500&view=auto ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml (added) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml Fri Feb 15 10:32:32 2013 @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier"> + <frameworkImplementation>org.apache.uima.java</frameworkImplementation> + <primitive>true</primitive> + <annotatorImplementationName>TestAnnotator</annotatorImplementationName> + <analysisEngineMetaData> + <name>TestAnnotator</name> + <version>1.0-SNAPSHOT</version> + <vendor>Apache UIMA</vendor> + <copyright>Copyright by the respective authors.</copyright> + <configurationParameters> + <configurationParameter> + <name>value1</name> + <description>Parameter value 1.</description> + <type>String</type> + <multiValued>false</multiValued> + <mandatory>true</mandatory> + </configurationParameter> + </configurationParameters> + <configurationParameterSettings/> + <typeSystemDescription/> + <fsIndexCollection/> + <capabilities/> + <operationalProperties> + <modifiesCas>true</modifiesCas> + <multipleDeploymentAllowed>true</multipleDeploymentAllowed> + <outputsNewCASes>false</outputsNewCASes> + </operationalProperties> + </analysisEngineMetaData> +</analysisEngineDescription> Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/reference/TestAnnotator.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java?rev=1446500&view=auto ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java (added) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java Fri Feb 15 10:32:32 2013 @@ -0,0 +1,19 @@ +import org.apache.uima.analysis_component.JCasAnnotator_ImplBase; +import org.apache.uima.analysis_engine.AnalysisEngineProcessException; +import org.apache.uima.fit.descriptor.ConfigurationParameter; +import org.apache.uima.jcas.JCas; + +public class TestAnnotator extends JCasAnnotator_ImplBase { + + /** + * Parameter value 1. + */ + public static final String PARAM_VALUE_1 = "value1"; + @ConfigurationParameter(name = PARAM_VALUE_1, mandatory=true) + private String value1; + + @Override + public void process(JCas aJCas) throws AnalysisEngineProcessException { + // Nothing to do + } +} Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/src/main/java/TestAnnotator.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh?rev=1446500&view=auto ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh (added) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh Fri Feb 15 10:32:32 2013 @@ -0,0 +1,22 @@ +import java.io.*; +import java.util.*; +import java.util.regex.*; +import org.apache.commons.io.*; + +try +{ + String reference = IOUtils.toString(new File(basedir, "reference/TestAnnotator.xml").toURI().toURL()); + String actual = IOUtils.toString(new File(basedir, "target/generated-sources/uimafit/TestAnnotator.xml").toURI().toURL()); + + if (!reference.equals(actual)) { + System.out.println("Actual descriptor does not match expected descriptor"); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/default/verify.bsh ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml URL: http://svn.apache.org/viewvc/uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml?rev=1446500&view=auto ============================================================================== --- uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml (added) +++ uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml Fri Feb 15 10:32:32 2013 @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<settings> + <profiles> + <profile> + <id>it-repo</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <repositories> + <repository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> +</settings> \ No newline at end of file Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: uima/sandbox/uimafit/trunk/uimafit-maven-plugin/src/it/settings.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml