You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by re...@apache.org on 2020/02/02 17:45:35 UTC

[uima-uimafit] branch sync-v2-into-master created (now e3bfc80)

This is an automated email from the ASF dual-hosted git repository.

rec pushed a change to branch sync-v2-into-master
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git.


      at e3bfc80  Merge branch 'master-v2' into sync-v2-into-master

This branch includes the following new commits:

     new e3bfc80  Merge branch 'master-v2' into sync-v2-into-master

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[uima-uimafit] 01/01: Merge branch 'master-v2' into sync-v2-into-master

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rec pushed a commit to branch sync-v2-into-master
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit e3bfc80d80631575a6cff2f3067c85558426cce3
Merge: a8ec6f7 ac9faeb
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Sun Feb 2 18:45:27 2020 +0100

    Merge branch 'master-v2' into sync-v2-into-master
    
    * master-v2:
      [UIMA-6184] Move code quality profiles to parent POM
      [UIMA-6184] Move code quality profiles to parent POM
      [UIMA-6184] Move code quality profiles to parent POM
      [UIMA-6155] uimaFIT JCasIterable.iterator() destroys ResourceManager
      [UIMA-5807] Support PEARs in AnalysisEngineFactory
    
    % Conflicts:
    %	uimafit-core/pom.xml
    %	uimafit-core/src/test/java/org/apache/uima/fit/pipeline/JCasIterableTest.java
    %	uimafit-legacy-support/marker-file-identifying-api-compatibility-check
    %	uimafit-parent/pom.xml

 ...marker-file-identifying-api-compatibility-check |   0
 uimafit-core/pom.xml                               |   5 +
 .../uima/fit/factory/AnalysisEngineFactory.java    |  40 +++++
 .../fit/factory/ConfigurationParameterFactory.java |  26 +++
 .../uima/fit/internal/ResourceManagerFactory.java  |   6 +
 .../org/apache/uima/fit/pipeline/JCasIterable.java |  61 +++----
 .../org/apache/uima/fit/pipeline/JCasIterator.java | 137 ++++++++++++---
 .../fit/factory/AnalysisEngineFactoryTest.java     |  28 ++++
 .../apache/uima/fit/pipeline/JCasIterableTest.java | 121 +++++++++++---
 uimafit-core/src/test/resources/pear/DateTime.pear | Bin 0 -> 23719 bytes
 ...arker-file-identifying-api-compatibility-check} |   0
 uimafit-parent/pom.xml                             | 184 ++-------------------
 ...marker-file-identifying-api-compatibility-check |   0
 13 files changed, 353 insertions(+), 255 deletions(-)

diff --cc uimafit-core/pom.xml
index 1465f68,ba72d05..1dcace5
--- a/uimafit-core/pom.xml
+++ b/uimafit-core/pom.xml
@@@ -79,6 -77,35 +79,11 @@@
        <artifactId>assertj-core</artifactId>
        <scope>test</scope>
      </dependency>
+     <dependency>
+       <groupId>org.mockito</groupId>
+       <artifactId>mockito-core</artifactId>
+       <scope>test</scope>
+     </dependency>
 -    <dependency>
 -      <groupId>log4j</groupId>
 -      <artifactId>log4j</artifactId>
 -      <version>1.2.15</version>
 -      <scope>test</scope>
 -      <exclusions>
 -        <exclusion>
 -          <artifactId>jmxtools</artifactId>
 -          <groupId>com.sun.jdmk</groupId>
 -        </exclusion>
 -        <exclusion>
 -          <artifactId>jmxri</artifactId>
 -          <groupId>com.sun.jmx</groupId>
 -        </exclusion>
 -        <exclusion>
 -          <artifactId>jms</artifactId>
 -          <groupId>javax.jms</groupId>
 -        </exclusion>
 -        <exclusion>
 -          <artifactId>mail</artifactId>
 -          <groupId>javax.mail</groupId>
 -        </exclusion>
 -      </exclusions>
 -    </dependency>
    </dependencies>
    <licenses>
      <license>
diff --cc uimafit-core/src/test/java/org/apache/uima/fit/pipeline/JCasIterableTest.java
index e9bb13b,c45f1fa..f557f5f
--- a/uimafit-core/src/test/java/org/apache/uima/fit/pipeline/JCasIterableTest.java
+++ b/uimafit-core/src/test/java/org/apache/uima/fit/pipeline/JCasIterableTest.java
@@@ -18,15 -18,21 +18,21 @@@
   */
  package org.apache.uima.fit.pipeline;
  
 -import static org.apache.uima.UIMAFramework.newDefaultResourceManager;
  import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
  import static org.apache.uima.fit.factory.CollectionReaderFactory.createReaderDescription;
 -import static org.apache.uima.fit.factory.ExternalResourceFactory.createExternalResourceDescription;
 +import static org.apache.uima.fit.factory.ExternalResourceFactory.createResourceDescription;
- import static org.apache.uima.fit.pipeline.SimplePipeline.iteratePipeline;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertNotNull;
+ import static org.apache.uima.fit.internal.ResourceManagerFactory.getResourceManagerCreator;
++import static org.apache.uima.fit.internal.ResourceManagerFactory.newResourceManager;
+ import static org.apache.uima.fit.internal.ResourceManagerFactory.setResourceManagerCreator;
+ import static org.assertj.core.api.Assertions.assertThat;
  import static org.junit.Assert.assertTrue;
+ import static org.mockito.Mockito.never;
+ import static org.mockito.Mockito.spy;
+ import static org.mockito.Mockito.times;
+ import static org.mockito.Mockito.verify;
  
  import java.io.IOException;
+ import java.util.Iterator;
  
  import org.apache.uima.UimaContext;
  import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@@ -58,22 -89,53 +89,53 @@@ public class JCasIterableTest 
    }
  
    @Test
-   public void testResourceSharing() throws Exception {
-     ThreeDocsReader.resource = null;
-     GetTextAE.resource = null;
-     
+   public void thatResourceCanBeShared() throws Exception {
 -    ExternalResourceDescription res = createExternalResourceDescription(DummySharedResource.class);
 +    ExternalResourceDescription res = createResourceDescription(DummySharedResource.class);
-     for (@SuppressWarnings("unused") JCas jcas : iteratePipeline(
+     
+     consume(new JCasIterable(
              createReaderDescription(ThreeDocsReader.class, "resource", res),
-             createEngineDescription(GetTextAE.class, "resource", res))) {
-     }
+             createEngineDescription(GetTextAE.class, "resource", res)));
      
-     assertNotNull(ThreeDocsReader.resource);
-     assertNotNull(GetTextAE.resource);
-     assertTrue(ThreeDocsReader.resource == GetTextAE.resource);
+     assertThat(ThreeDocsReader.resource)
+           .isNotNull()
+           .isEqualTo(GetTextAE.resource);
+   }
+   
+   @Test 
+   public void thatSharedResourceManagerIsNotDestroyed() throws Exception {
 -    ResourceManager resMgr = spy(newDefaultResourceManager());
++    ResourceManager resMgr = spy(newResourceManager());
      
-     ThreeDocsReader.resource = null;
-     GetTextAE.resource = null;
+     consume(new JCasIterable(resMgr,
+             createReaderDescription(ThreeDocsReader.class),
+             createEngineDescription(GetTextAE.class)));
+     
+     verify(resMgr, never()).destroy();
+   }
+ 
+   /**
+    * Mind that returning a singleton resource manager from {@link ResourceManagerFactory} is
+    * generally a bad idea exactly because it gets destroyed on a regular basis. For this
+    * reason, it is called {@link ResourceManagerFactory#newResourceManager()} and not 
+    * {@code getResourceManager()}.
+    */
+   @Test 
+   public void thatInternallyCreatedResourceManagerIsDestroyed() throws Exception {
 -    ResourceManager resMgr = spy(newDefaultResourceManager());
++    ResourceManager resMgr = spy(newResourceManager());
+     setResourceManagerCreator(() -> resMgr); 
+     
+     consume(new JCasIterable(
+             createReaderDescription(ThreeDocsReader.class),
+             createEngineDescription(GetTextAE.class)));
+     
+     verify(resMgr, times(1)).destroy();
+   }
+ 
+   private static void consume(Iterable<?> aIterable)
+   {
+     Iterator<?> i = aIterable.iterator();
+     while (i.hasNext()) {
+       i.next();
+     }
    }
   
    public static final class DummySharedResource extends Resource_ImplBase {
diff --cc uimafit-parent/pom.xml
index ca363ce,d43006c..55892b7
--- a/uimafit-parent/pom.xml
+++ b/uimafit-parent/pom.xml
@@@ -23,26 -4,33 +23,28 @@@
      <groupId>org.apache.uima</groupId>
      <artifactId>parent-pom</artifactId>
      <relativePath />
-     <version>13</version>
+     <version>14-SNAPSHOT</version>
    </parent>
    <artifactId>uimafit-parent</artifactId>
 -  <version>2.5.0-SNAPSHOT</version>
 +  <version>3.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Apache UIMA uimaFIT - Parent</name>
    <url>${uimaWebsiteUrl}</url>
    <inceptionYear>2012</inceptionYear>
    <properties>
 -    <spring.version>3.2.16.RELEASE</spring.version>
 -    <uima.version>2.10.3</uima.version>
 +    <spring.version>4.3.22.RELEASE</spring.version>
 +    <uima.version>3.0.2</uima.version>
 +    <slf4j.version>1.7.26</slf4j.version>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
-     <compat.previous.version>2.4.0</compat.previous.version>
 -    <!-- 
 -     BACKWARD_COMPATIBLE_IMPLEMENTER - patch version (=.=.+)
 -     BACKWARD_COMPATIBLE_USER        - minor version (=.+.0)
 -     NON_BACKWARD_COMPATIBLE         - major version (+.0.0)
 -    -->
 -    <compat.level>BACKWARD_COMPATIBLE_USER</compat.level>
+     <api_check_oldVersion>2.4.0</api_check_oldVersion>
+     
+     <japicmp.postAnalysisScript>${project.basedir}/../uimafit-parent/src/main/groovy/api-report.groovy</japicmp.postAnalysisScript>
    </properties>
 -  <!--
 -    - Only required while uimaFIT depends on unreleased versions of UIMA.
 -    -->
    <repositories>
 +    <!--
 +      - For UIMA/uimaFIT SNAPSHOTs
 +    -->
      <repository>
        <id>apache.snapshots</id>
        <name>Apache Snapshot Repository</name>
@@@ -87,19 -72,19 +89,24 @@@
          <version>4.12</version>
        </dependency>
        <dependency>
 +        <groupId>xmlunit</groupId>
 +        <artifactId>xmlunit</artifactId>
 +        <version>1.6</version>
 +      </dependency>
 +      <dependency>
          <groupId>org.assertj</groupId>
          <artifactId>assertj-core</artifactId>
 -        <version>3.10.0</version>
 +        <version>3.12.2</version>
        </dependency>
        <dependency>
+         <groupId>org.mockito</groupId>
+         <artifactId>mockito-core</artifactId>
+         <version>3.2.4</version>
+       </dependency>
+       <dependency>
 -        <groupId>commons-lang</groupId>
 -        <artifactId>commons-lang</artifactId>
 -        <version>2.6</version>
 +        <groupId>org.apache.commons</groupId>
 +        <artifactId>commons-lang3</artifactId>
 +        <version>3.8.1</version>
        </dependency>
        <dependency>
          <groupId>commons-io</groupId>
@@@ -237,19 -202,13 +244,16 @@@
          <plugin>
            <groupId>org.apache.rat</groupId>
            <artifactId>apache-rat-plugin</artifactId>
 +          <version>0.13</version>
-           <configuration>
-             <consoleOutput>true</consoleOutput>
-           </configuration>
            <executions>
              <execution>
                <id>default-cli</id>
                <configuration>
-                 <excludes>
+                 <excludes combine.children="append">
                    <!-- Plain documentation -->
                    <exclude>README*</exclude>
 +                  <!-- GitHub templates -->
 +                  <exclude>.github/**</exclude>
                    <!-- Release files -->
                    <exclude>RELEASE_NOTES*</exclude>
                    <exclude>issuesFixed/**</exclude>
@@@ -334,172 -289,83 +338,4 @@@
        </plugins>
      </pluginManagement>
    </build>
--  <profiles>
-     <profile>
-       <id>spotbugs</id>
-       <build>
-         <plugins>
-           <plugin>
-             <groupId>com.github.spotbugs</groupId>
-             <artifactId>spotbugs-maven-plugin</artifactId>
-             <version>3.1.12.2</version>
-             <executions>
-               <execution>
-                 <id>default</id>
-                 <phase>verify</phase>
-                 <goals>
-                   <goal>check</goal>
-                 </goals>
-                 <configuration>
-                   <failOnError>false</failOnError>
-                 </configuration>
-               </execution>
-             </executions>
-           </plugin>
-         </plugins>
-       </build>
-     </profile>
--    <profile>
--      <id>enforce-compatibility</id>
--      <activation>
--        <file>
-           <exists>.activate-enforce-compatibility</exists>
 -          <exists>marker-file-identifying-api-compatibility-check</exists>
--        </file>
--      </activation>
 -      <properties>
 -        <japicmp.postAnalysisScript>${project.basedir}/../uimafit-parent/src/main/groovy/api-report.groovy</japicmp.postAnalysisScript>
 -      </properties>
--      <build>
--        <pluginManagement>
--          <plugins>
--            <plugin>
-               <groupId>org.apache.rat</groupId>
-               <artifactId>apache-rat-plugin</artifactId>
 -              <artifactId>maven-enforcer-plugin</artifactId>
 -              <dependencies>
 -                <dependency>
 -                  <groupId>org.semver</groupId>
 -                  <artifactId>enforcer-rule</artifactId>
 -                  <version>0.9.33</version>
 -                </dependency>
 -              </dependencies>
--              <executions>
--                <execution>
-                   <id>default-cli</id>
 -                  <id>enforce-compatibility</id>
 -                  <phase>verify</phase>
 -                  <goals>
 -                    <goal>enforce</goal>
 -                  </goals>
--                  <configuration>
-                     <excludes combine.children="append">
-                       <exclude>**/api-change-report/**/*.*</exclude>
-                     </excludes>
 -                    <rules>
 -                      <requireBackwardCompatibility implementation="org.semver.enforcer.RequireBackwardCompatibility">
 -                        <previousVersion>${api_check_oldVersion}</previousVersion>
 -                        <dumpDetails>true</dumpDetails>
 -                        <compatibilityType>${compat.level}</compatibilityType>
 -                      </requireBackwardCompatibility>
 -                    </rules>
--                  </configuration>
--                </execution>
--              </executions>
--            </plugin>
-           </plugins>
-         </pluginManagement>
- 
-         <plugins>
-           <!-- https://siom79.github.io/japicmp/MavenPlugin.html -->
-           <plugin>
-             <groupId>com.github.siom79.japicmp</groupId>
-             <artifactId>japicmp-maven-plugin</artifactId>
-             <version>0.13.1</version>
-             <configuration>
-               <oldVersion>
-                 <dependency>
-                   <groupId>${project.groupId}</groupId>
-                   <artifactId>${project.artifactId}</artifactId>
-                   <version>${compat.previous.version}</version>
-                 </dependency>
-               </oldVersion>
-               <parameter>
-                 <onlyModified>true</onlyModified>
-                 <!-- filter out classes with impl in their package or class name -->
-                 <postAnalysisScript>${project.basedir}/../uimafit-parent/src/main/groovy/api-report.groovy</postAnalysisScript>
-               </parameter>
-             </configuration>
-             <executions>
-               <execution>
-                 <phase>verify</phase>
-                 <goals>
-                   <goal>cmp</goal>
-                 </goals>
-               </execution>
-             </executions>
-           </plugin>
- 
-           <!-- This copy is to have the api change report included in the source distribution -->
-           <plugin>
-             <artifactId>maven-antrun-plugin</artifactId>
-             <executions>
-               <execution>
-                 <id>copy-API-change-report</id>
-                 <phase>install</phase>  <!-- must follow verify -->
-                 <goals>
-                   <goal>run</goal>
-                 </goals>
-                 <configuration>
-                   <target>
-                     <taskdef name="if" classname="net.sf.antcontrib.logic.IfTask" />
-                     <if>
-                       <available file="${project.build.directory}/japicmp/" />
-                       <then>
-                         <copy toDir="${basedir}/api-change-report">
-                           <fileset dir="${project.build.directory}/japicmp" />
-                         </copy>
-                       </then>
-                     </if>
-                   </target>
-                 </configuration>
-               </execution>
-             </executions>
-           </plugin>
-         </plugins>
-       </build>
-     </profile>
-     <profile>
-       <id>m2e</id>
-       <activation>
-         <property>
-           <name>m2e.version</name>
-         </property>
-       </activation>
-       <build>
-         <pluginManagement>
-           <plugins>
-             <!--
-               - This plugin's configuration is used to store Eclipse m2e settings only.
-               - It has no influence on the Maven build itself.
-             -->
 -            
 -            <!-- https://siom79.github.io/japicmp/MavenPlugin.html -->
--            <plugin>
-               <groupId>org.eclipse.m2e</groupId>
-               <artifactId>lifecycle-mapping</artifactId>
-               <version>1.0.0</version>
 -              <groupId>com.github.siom79.japicmp</groupId>
 -              <artifactId>japicmp-maven-plugin</artifactId>
--              <configuration>
-                 <lifecycleMappingMetadata>
-                   <pluginExecutions>
-                     <pluginExecution>
-                       <pluginExecutionFilter>
-                         <groupId>org.codehaus.gmaven</groupId>
-                         <artifactId>gmaven-plugin</artifactId>
-                         <versionRange>[1.5,)</versionRange>
-                         <goals>
-                           <goal>execute</goal>
-                         </goals>
-                       </pluginExecutionFilter>
-                       <action>
-                         <ignore />
-                       </action>
-                     </pluginExecution>
-                     <pluginExecution>
-                       <pluginExecutionFilter>
-                         <groupId>org.apache.maven.plugins</groupId>
-                         <artifactId>maven-plugin-plugin</artifactId>
-                         <versionRange>[3.5.2,)</versionRange>
-                         <goals>
-                           <goal>descriptor</goal>
-                           <goal>helpmojo</goal>
-                         </goals>
-                       </pluginExecutionFilter>
-                       <action>
-                         <ignore />
-                       </action>
-                     </pluginExecution>
-                   </pluginExecutions>
-                 </lifecycleMappingMetadata>
 -                <parameter combine.children="append">
 -                  <breakBuildBasedOnSemanticVersioning>true</breakBuildBasedOnSemanticVersioning>
 -                  <reportOnlyFilename>true</reportOnlyFilename>
 -                </parameter>
--              </configuration>
--            </plugin>
--          </plugins>
--        </pluginManagement>
--      </build>
--    </profile>
--  </profiles>
  </project>