ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1697395 - in /ctakes/trunk/ctakes-dictionary-lookup-fast/src: main/java/org/apache/ctakes/dictionary/lookup2/util/ test/java/org/apache/ctakes/dictionary/lookup2/ae/ test/java/org/apache/ctakes/dictionary/lookup2/util/
Date Mon, 24 Aug 2015 13:49:48 GMT
Author: seanfinan
Date: Mon Aug 24 13:49:47 2015
New Revision: 1697395

URL: http://svn.apache.org/r1697395
Log:
Added Check for user-specified umls credentials in "default" lookup engine tests.  Tests will
be skipiped if credentials are not provided.

Added:
    ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserTester.java
Modified:
    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java
    ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/ae/TestDictionaryLoadResources.java

Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java?rev=1697395&r1=1697394&r2=1697395&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java
Mon Aug 24 13:49:47 2015
@@ -48,8 +48,8 @@ public enum UmlsUserApprover {
    // environment, matches old
    private final static String UMLSADDR_PARAM = "ctakes.umlsaddr";
    private final static String UMLSVENDOR_PARAM = "ctakes.umlsvendor";
-   private final static String UMLSUSER_PARAM = "ctakes.umlsuser";
-   private final static String UMLSPW_PARAM = "ctakes.umlspw";
+   final static String UMLSUSER_PARAM = "ctakes.umlsuser";
+   final static String UMLSPW_PARAM = "ctakes.umlspw";
 
    // properties, matches new
    private final static String URL_PARAM = "umlsUrl";

Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/ae/TestDictionaryLoadResources.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/ae/TestDictionaryLoadResources.java?rev=1697395&r1=1697394&r2=1697395&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/ae/TestDictionaryLoadResources.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/ae/TestDictionaryLoadResources.java
Mon Aug 24 13:49:47 2015
@@ -1,5 +1,7 @@
 package org.apache.ctakes.dictionary.lookup2.ae;
 
+import org.apache.ctakes.dictionary.lookup2.util.UmlsUserTester;
+import org.apache.log4j.Logger;
 import org.apache.uima.UIMAException;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -15,14 +17,23 @@ import static org.junit.Assert.fail;
 
 public class TestDictionaryLoadResources {
 
+   static private final Logger LOGGER = Logger.getLogger( "TestDictionaryLoadResources" );
+
 
    static private final String TEST_TEXT
          = "The quick red fox jumped over cTAKES.  Allie had a little lamb; little lamb.";
 
    static private final String TEST_CUSTOM_DESC = "org/apache/ctakes/dictionary/lookup/fast/TestcTakesHsql.xml";
 
+   /**
+    *
+    */
    @Test
    public void testDefaultLookupDescription() {
+      if ( !UmlsUserTester.canTestUmlsUser() ) {
+         LOGGER.warn( "No UMLS User or Pass specified, cannot test Default Lookup Description"
);
+         return;
+      }
       final JCas jcas = createTestJCas();
       try {
          //Test had to use custom test config otherwise we'll have to save our umls credentials.
@@ -50,6 +61,10 @@ public class TestDictionaryLoadResources
 
    @Test
    public void testOverlapLookupDescription() {
+      if ( !UmlsUserTester.canTestUmlsUser() ) {
+         LOGGER.warn( "No UMLS User or Pass specified, cannot test Overlap Lookup Description"
);
+         return;
+      }
       final JCas jcas = createTestJCas();
       try {
          //Test had to use custom test config otherwise we'll have to save our umls credentials.

Added: ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserTester.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserTester.java?rev=1697395&view=auto
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserTester.java
(added)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/test/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserTester.java
Mon Aug 24 13:49:47 2015
@@ -0,0 +1,30 @@
+package org.apache.ctakes.dictionary.lookup2.util;
+
+import org.apache.ctakes.utils.env.EnvironmentVariable;
+import org.apache.log4j.Logger;
+
+import static org.apache.ctakes.dictionary.lookup2.util.UmlsUserApprover.UMLSPW_PARAM;
+import static org.apache.ctakes.dictionary.lookup2.util.UmlsUserApprover.UMLSUSER_PARAM;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 8/24/2015
+ */
+final public class UmlsUserTester {
+
+   static private final Logger LOGGER = Logger.getLogger( "UmlsUserTester" );
+
+   private UmlsUserTester() {
+   }
+
+   static public boolean canTestUmlsUser() {
+      String user = EnvironmentVariable.getEnv( UMLSUSER_PARAM, null );
+      if ( user == null || user.equals( EnvironmentVariable.NOT_PRESENT ) ) {
+         return false;
+      }
+      String pass = EnvironmentVariable.getEnv( UMLSPW_PARAM, null );
+      return pass != null && !pass.equals( EnvironmentVariable.NOT_PRESENT );
+   }
+
+}



Mime
View raw message