You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by al...@apache.org on 2017/12/04 17:39:43 UTC

svn commit: r1817108 - in /ctakes/trunk: ctakes-ytex-uima/pom.xml ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java ctakes-ytex/pom.xml pom.xml

Author: alexz
Date: Mon Dec  4 17:39:43 2017
New Revision: 1817108

URL: http://svn.apache.org/viewvc?rev=1817108&view=rev
Log:
CTAKES-488: fix ytex-uima integration-tests except SenseDisambiguatorAnnotatorTest"

Modified:
    ctakes/trunk/ctakes-ytex-uima/pom.xml
    ctakes/trunk/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java
    ctakes/trunk/ctakes-ytex/pom.xml
    ctakes/trunk/pom.xml

Modified: ctakes/trunk/ctakes-ytex-uima/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex-uima/pom.xml?rev=1817108&r1=1817107&r2=1817108&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex-uima/pom.xml (original)
+++ ctakes/trunk/ctakes-ytex-uima/pom.xml Mon Dec  4 17:39:43 2017
@@ -179,7 +179,13 @@
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-surefire-plugin</artifactId>
 				<configuration>
-					<skip>true</skip>
+					<excludes>
+						<exclude>**/DBCollectionReaderTest*</exclude>
+						<exclude>**/DBConsumerTest*</exclude>
+						<exclude>**/DictionaryLookupAnnotatorTest*</exclude>
+						<exclude>**/SenseDisambiguatorAnnotatorTest*</exclude>
+						<exclude>**/SparseDataExporterTest*</exclude>
+					</excludes>
 				</configuration>
 				<executions>
 					<execution>
@@ -189,7 +195,6 @@
 							<goal>test</goal>
 						</goals>
 						<configuration>
-							<skip>false</skip>
 							<forkMode>always</forkMode>
 							<systemPropertyVariables>
 								<log4j.configuration>file:${project.basedir}/src/test/resources/log4j.properties</log4j.configuration>
@@ -199,7 +204,7 @@
 							<forkCount>1</forkCount>
 							<reuseForks>false</reuseForks>
 							<forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
-							<additionalClasspathElements>
+							<!-- additionalClasspathElements>
 								<additionalClasspathElement>${project.basedir}/../ctakes-assertion-res/src/main/resources</additionalClasspathElement>
 								<additionalClasspathElement>${project.basedir}/../ctakes-assertion-zoner-res/src/main/resources</additionalClasspathElement>
 								<additionalClasspathElement>${project.basedir}/../ctakes-chunker-res/src/main/resources</additionalClasspathElement>
@@ -217,11 +222,33 @@
 								<additionalClasspathElement>${project.basedir}/../ctakes-smoking-status-res/src/main/resources</additionalClasspathElement>
 								<additionalClasspathElement>${project.basedir}/../ctakes-temporal-res/src/main/resources</additionalClasspathElement>
 								<additionalClasspathElement>${project.basedir}/../ctakes-ytex-res/src/main/resources</additionalClasspathElement>
-							</additionalClasspathElements>
+							</additionalClasspathElements -->
 						</configuration>
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-failsafe-plugin</artifactId>
+				<version>${maven-failsafe-plugin.version}</version>
+				<configuration>
+					<includes>
+						<include>**/DBCollectionReaderTest</include>
+						<include>**/DBConsumerTest</include>
+						<include>**/DictionaryLookupAnnotatorTest</include>
+						<!-- TODO: include>**/SenseDisambiguatorAnnotatorTest</include -->
+						<include>**/SparseDataExporterTest</include>
+					</includes>
+				</configuration>
+				<executions>
+					<execution>
+						<goals>
+							<goal>integration-test</goal>
+							<goal>verify</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
 			<plugin>
 				<artifactId>maven-clean-plugin</artifactId>
 				<configuration>

Modified: ctakes/trunk/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java?rev=1817108&r1=1817107&r2=1817108&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java (original)
+++ ctakes/trunk/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java Mon Dec  4 17:39:43 2017
@@ -18,39 +18,26 @@
  */
 package org.apache.ctakes.ytex.tools;
 
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import gov.nih.nlm.nls.lvg.Api.LvgCmdApi;
+import org.apache.ctakes.core.nlp.tokenizer.Token;
+import org.apache.ctakes.core.nlp.tokenizer.TokenizerPTB;
+import org.apache.ctakes.ytex.kernel.KernelContextHolder;
+import org.apache.ctakes.ytex.umls.dao.UMLSDao;
+import org.apache.ctakes.ytex.umls.model.UmlsAuiFirstWord;
+import org.apache.log4j.Logger;
 import org.springframework.transaction.PlatformTransactionManager;
 import org.springframework.transaction.support.TransactionTemplate;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
-import org.apache.ctakes.core.nlp.tokenizer.Token;
-import org.apache.ctakes.core.nlp.tokenizer.TokenizerPTB;
-import org.apache.ctakes.ytex.kernel.KernelContextHolder;
-import org.apache.ctakes.ytex.umls.dao.UMLSDao;
-import org.apache.ctakes.ytex.umls.model.UmlsAuiFirstWord;
 
-import gov.nih.nlm.nls.lvg.Api.LvgCmdApi;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.*;
+import java.net.URL;
+import java.util.*;
 
 /**
  * setup umls_aui_fword table
@@ -59,7 +46,9 @@ import gov.nih.nlm.nls.lvg.Api.LvgCmdApi
  * 
  */
 public class SetupAuiFirstWord {
-	private static final Log log = LogFactory.getLog(SetupAuiFirstWord.class);
+
+	static private final Logger LOGGER = Logger.getLogger(SetupAuiFirstWord.class);
+	
 	// private static final Pattern nonWord = Pattern.compile("\\W");
 	private TokenizerPTB tokenizer;
 	private LvgCmdApi lvgCmd;
@@ -102,18 +91,16 @@ public class SetupAuiFirstWord {
 		try {
 			URL uri = this.getClass().getClassLoader()
 					.getResource("org/apache/ctakes/lvg/data/config/lvg.properties");
-			if (log.isInfoEnabled())
-				log.info("loading lvg.properties from:" + uri.getPath());
+			LOGGER.info("loading lvg.properties from:" + uri.getPath());
 			File f = new File(uri.getPath());
+			LOGGER.info(f.getAbsolutePath());
 			String configDir = f.getParentFile().getAbsolutePath();
 			String lvgDir = configDir.substring(0, configDir.length()
 					- "data/config".length());
 			System.setProperty("user.dir", lvgDir);
 			lvgCmd = new LvgCmdApi("-f:l:b", f.getAbsolutePath());
 		} catch (Exception e) {
-			log.warn(
-					"could not initialize lvg - will not create a stemmed dictionary.",
-					e);
+			LOGGER.warn("could not initialize lvg - will not create a stemmed dictionary.", e);
 		}
 	}
 
@@ -135,13 +122,13 @@ public class SetupAuiFirstWord {
 					.getResourceAsStream(
 							"ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml");
 			if(isLvgAnno == null) {
-				log.warn("classpath:ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, attempting to load from file system");
+				LOGGER.warn("classpath:ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, attempting to load from file system");
 				File f = new File("../ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml");
 				if(f.exists())
 					isLvgAnno = new BufferedInputStream(new FileInputStream(f));
 			} 
 			if (isLvgAnno == null) {
-				log.warn("ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, using empty exclusion set");
+				LOGGER.warn("ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, using empty exclusion set");
 			} else {
 				DocumentBuilderFactory dbFactory = DocumentBuilderFactory
 						.newInstance();
@@ -215,32 +202,29 @@ public class SetupAuiFirstWord {
 					try {
 						UmlsAuiFirstWord fw = this.tokenizeStr(aui, str);
 						if (fw == null)
-							log.error("Error tokenizing aui=" + aui + ", str="
+							LOGGER.error("Error tokenizing aui=" + aui + ", str="
 									+ str);
 						else if (fw.getFword().length() > 70)
-							log.debug("fword too long: aui=" + aui + ", str="
+							LOGGER.debug("fword too long: aui=" + aui + ", str="
 									+ fw.getFword());
 						else if (fw.getTokenizedStr().length() > 250)
-							log.debug("string too long: aui=" + aui + ", str="
+							LOGGER.debug("string too long: aui=" + aui + ", str="
 									+ str);
 						else {
-							if (log.isDebugEnabled())
-								log.debug("aui=" + aui + ", fw=" + fw);
+							LOGGER.debug("aui=" + aui + ", fw=" + fw);
 							listFword.add(fw);
 						}
 					} catch (Exception e) {
-						log.error("Error tokenizing aui=" + aui + ", str="
-								+ str, e);
+						LOGGER.error("Error tokenizing aui=" + aui + ", str=" + str, e);
 					}
 				} else {
-					log.debug("Skipping aui because str to long: aui=" + aui
-							+ ", str=" + str);
+					LOGGER.debug("Skipping aui because str to long: aui=" + aui + ", str=" + str);
 				}
 			}
 			// batch insert
 			if (listFword.size() > 0) {
 				umlsDao.insertAuiFirstWord(listFword);
-				log.info("inserted " + listFword.size() + " rows");
+				LOGGER.info("inserted " + listFword.size() + " rows");
 			}
 		} while (listAuiStr.size() > 0);
 	}
@@ -334,7 +318,7 @@ public class SetupAuiFirstWord {
 		if (out != null)
 			output = out.split("\\|");
 		else {
-			log.warn("mutateToString returned null for: " + word);
+			LOGGER.warn("mutateToString returned null for: " + word);
 		}
 
 		if ((output != null) && (output.length >= 2)

Modified: ctakes/trunk/ctakes-ytex/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-ytex/pom.xml?rev=1817108&r1=1817107&r2=1817108&view=diff
==============================================================================
--- ctakes/trunk/ctakes-ytex/pom.xml (original)
+++ ctakes/trunk/ctakes-ytex/pom.xml Mon Dec  4 17:39:43 2017
@@ -331,7 +331,7 @@
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-failsafe-plugin</artifactId>
-				<version>2.20.1</version>
+				<version>${maven-failsafe-plugin.version}</version>
 				<configuration>
 					<includes>
 						<include>**/ConceptDaoTest</include>

Modified: ctakes/trunk/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/pom.xml?rev=1817108&r1=1817107&r2=1817108&view=diff
==============================================================================
--- ctakes/trunk/pom.xml (original)
+++ ctakes/trunk/pom.xml Mon Dec  4 17:39:43 2017
@@ -122,6 +122,7 @@
 		<mastif.version>1.4</mastif.version>
 		<maven-antrun-plugin.version>1.6</maven-antrun-plugin.version>
 		<maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
+		<maven-failsafe-plugin.version>2.20.1</maven-failsafe-plugin.version>
 		<maven-surefire-plugin.version>2.12.1</maven-surefire-plugin.version>
 		<maven-war-plugin.version>2.4</maven-war-plugin.version>
 		<mysql-connector.version>5.1.26</mysql-connector.version>