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/04/10 15:25:17 UTC

[uima-uimafit] branch UIMA-6214-Method-signature-clash-in-ExternalResourceFactory updated (ef979ed -> 1f1d4d8)

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

rec pushed a change to branch UIMA-6214-Method-signature-clash-in-ExternalResourceFactory
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git.


    from ef979ed  [UIMA-6214] Method signature class in ExternalResourceFactory
     add 1a32b8e  [No Jira Issue Yet] Unit test illustrating error when binding resources to aggregates with nested dependent AEs. This error doesn't happen with uimaj-core-2.10.4 and uima-uimafit-2.4.0.
     add 7137a02  [No Issue] Minor improvement of unit test illustrating error when binding resources to aggregates with nested dependent AEs.
     new 1f1d4d8  [UIMA-6214] Method signature class in ExternalResourceFactory

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.


Summary of changes:
 .../fit/factory/ExternalResourceFactoryTest.java   | 61 +++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)


[uima-uimafit] 01/01: [UIMA-6214] Method signature class in ExternalResourceFactory

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

rec pushed a commit to branch UIMA-6214-Method-signature-clash-in-ExternalResourceFactory
in repository https://gitbox.apache.org/repos/asf/uima-uimafit.git

commit 1f1d4d8a8e2e526c873892bb8040fc57e9ad1833
Merge: ef979ed 7137a02
Author: Richard Eckart de Castilho <re...@apache.org>
AuthorDate: Fri Apr 10 17:25:06 2020 +0200

    [UIMA-6214] Method signature class in ExternalResourceFactory
    
    * Merge branch '3.0.x' of https://github.com/mjunsilo/uima-uimafit into UIMA-6214-Method-signature-clash-in-ExternalResourceFactory
    * This merge brings in the unit test provided by Mario Juric with the original bug report
    
    # Conflicts:
    #	uimafit-core/src/test/java/org/apache/uima/fit/factory/ExternalResourceFactoryTest.java

 .../fit/factory/ExternalResourceFactoryTest.java   | 61 +++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --cc uimafit-core/src/test/java/org/apache/uima/fit/factory/ExternalResourceFactoryTest.java
index 7c03ca3,fc9af78..6bc7b2f
--- a/uimafit-core/src/test/java/org/apache/uima/fit/factory/ExternalResourceFactoryTest.java
+++ b/uimafit-core/src/test/java/org/apache/uima/fit/factory/ExternalResourceFactoryTest.java
@@@ -22,10 -22,7 +22,13 @@@ package org.apache.uima.fit.factory
  import static java.util.Arrays.asList;
  import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngine;
  import static org.apache.uima.fit.factory.AnalysisEngineFactory.createEngineDescription;
 -import static org.apache.uima.fit.factory.ExternalResourceFactory.*;
 +import static org.apache.uima.fit.factory.ExternalResourceFactory.bindResource;
 +import static org.apache.uima.fit.factory.ExternalResourceFactory.bindResourceOnceWithoutNested;
 +import static org.apache.uima.fit.factory.ExternalResourceFactory.createNamedResourceDescription;
 +import static org.apache.uima.fit.factory.ExternalResourceFactory.createResourceDescription;
++import static org.apache.uima.fit.factory.ExternalResourceFactory.createSharedResourceDescription;
++import static org.apache.uima.fit.factory.JCasFactory.createJCas;
++import static org.apache.uima.fit.pipeline.SimplePipeline.runPipeline;
  import static org.junit.Assert.assertEquals;
  import static org.junit.Assert.assertFalse;
  import static org.junit.Assert.assertNotNull;
@@@ -350,7 -350,56 +355,61 @@@ public class ExternalResourceFactoryTes
      ae.process(ae.newJCas());
      ae.collectionProcessComplete();
    }
-   
+ 
+   @Test
 -  public void testNestedAggregateBinding() throws CASException, ResourceInitializationException, AnalysisEngineProcessException {
 -    ExternalResourceDescription resourceDescription = createSharedResourceDescription("", DummyResource.class);
 -//    ExternalResourceDescription resourceDescription = createExternalResourceDescription(DummyResource.class, ""); // This works with UIMA 2.10.4 and uimaFit 2.4.0
++  public void testNestedAggregateBinding() throws Exception {
++    ExternalResourceDescription resourceDescription = createSharedResourceDescription("",
++            DummyResource.class);
++
+     AggregateBuilder builder = new AggregateBuilder();
 -    AnalysisEngineDescription analysisEngineDescription = AnalysisEngineFactory.createEngineDescription(ResourceDependent.class);
 -    builder.add(analysisEngineDescription);
++    builder.add(createEngineDescription(ResourceDependent.class));
+     AnalysisEngineDescription aggregateDescription = builder.createAggregateDescription();
++
+     bindResource(aggregateDescription, DummyResource.RESOURCE_KEY, resourceDescription);
 -    JCas jCas = JCasFactory.createJCas();
++
++    JCas jCas = createJCas();
+     jCas.setDocumentText("Hello");
 -    SimplePipeline.runPipeline(jCas, aggregateDescription);
++
++    runPipeline(jCas, aggregateDescription);
+     int count = 0;
 -    for(AnalyzedText annotation: JCasUtil.select(jCas, AnalyzedText.class)) {
 -      Assert.assertEquals("World", annotation.getText());
++    for (AnalyzedText annotation : JCasUtil.select(jCas, AnalyzedText.class)) {
++      assertEquals("World", annotation.getText());
+       count++;
+     }
 -    Assert.assertEquals(1, count);
++
++    assertEquals(1, count);
+   }
+ 
+   public static class DummyResource implements SharedResourceObject {
+ 
 -      public static final String RESOURCE_KEY = "DummyResource";
++    public static final String RESOURCE_KEY = "DummyResource";
+ 
 -      public DummyResource() { }
 -
 -      @Override
 -      public void load(DataResource aData) throws ResourceInitializationException {
++    public DummyResource() {
++    }
+ 
 -      }
++    @Override
++    public void load(DataResource aData) throws ResourceInitializationException {
++      // Nothing to do
++    }
+ 
 -      public String getText() {
 -          return "World";
 -      }
++    public String getText() {
++      return "World";
++    }
+   }
+ 
+   public static class ResourceDependent extends JCasAnnotator_ImplBase {
+ 
+       @ExternalResource(key = DummyResource.RESOURCE_KEY)
+       private DummyResource dummyResource;
+ 
+       @Override
+       public void process(JCas aJCas) throws AnalysisEngineProcessException {
+         // Just marking up that the AE was executed as expected, so that it can be verified.
+         AnalyzedText annotation = new AnalyzedText(aJCas, 0, aJCas.getDocumentText().length());
+         annotation.setText(dummyResource.getText());
+         annotation.addToIndexes();
+       }
+   }
    
    private static void bindResources(AnalysisEngineDescription desc) throws Exception {
      bindResource(desc, ResourceWithAssert.class);