GrobidProperties { public static void setGrobidPropertiesPath(final String pGrobidPropertiesPath) { if (StringUtils.isBlank(pGrobidPropertiesPath)) throw new GrobidPropertyException("Cannot set property '" + pGrobidPropertiesPath + "' to null or empty."); File grobidPropPath = new File(pGrobidPropertiesPath); if (!grobidPropPath.exists()) { throw new GrobidPropertyException("Could not read grobid.properties, the file '" + pGrobidPropertiesPath + "' does not exist."); } try { GROBID_PROPERTY_PATH = grobidPropPath.getCanonicalFile(); } catch (IOException e) { throw new GrobidPropertyException("Cannot set grobid home path to the given one '" + pGrobidPropertiesPath + "', because it does not exist."); } } GrobidProperties(); static void reset(); static GrobidProperties getInstance(); static GrobidProperties getInstance(GrobidHomeFinder grobidHomeFinder); static void reload(); static Properties getProps(); static File get_GROBID_HOME_PATH(); static File getGrobidHomePath(); static void set_GROBID_HOME_PATH(final String pGROBID_HOME_PATH); static File getGrobidPropertiesPath(); static void setGrobidPropertiesPath(final String pGrobidPropertiesPath); static void setPropertyValue(final String pkey, final String pValue); static String getVersion(); static File getTempPath(); static void setNativeLibraryPath(final String nativeLibPath); static File getNativeLibraryPath(); static String getDeLFTPath(); static String getDeLFTFilePath(); static boolean isDeLFTRedirectOutput(); static String getGluttonHost(); static Integer getGluttonPort(); static boolean useELMo(); static String getProxyHost(); static void setProxyHost(final String host); static Integer getProxyPort(); static void setCrossrefMailto(final String mailto); static String getCrossrefMailto(); static void setCrossrefToken(final String token); static String getCrossrefToken(); static void setProxyPort(final String port); static Integer getPdfToXMLMemoryLimitMb(); static Integer getPdfToXMLTimeoutMs(); static Integer getNBThreads(); static Integer getPdfBlocksMax(); static Integer getPdfTokensMax(); static void setNBThreads(final String nbThreads); static Boolean isUseLanguageId(); static String getLanguageDetectorFactory(); static void setUseLanguageId(final String useLanguageId); static String getSentenceDetectorFactory(); static Boolean isResourcesInHome(); static void setResourcesInHome(final String resourceInHome); static void loadPdf2XMLPath(); static File getPdfToXMLPath(); static GrobidCRFEngine getGrobidCRFEngine(final String modelName); static GrobidCRFEngine getGrobidCRFEngine(final GrobidModel model); static GrobidCRFEngine getGrobidCRFEngine(); static File getModelPath(final GrobidModel model); static File getModelPath(); static File getTemplatePath(final File resourcesDir, final GrobidModel model); static File getEvalCorpusPath(final File resourcesDir, final GrobidModel model); static File getCorpusPath(final File resourcesDir, final GrobidModel model); static String getLexiconPath(); static File getLanguageDetectionResourcePath(); static int getMaxPoolConnections(); static int getPoolMaxWait(); static GrobidConsolidationService getConsolidationService(); static void setConsolidationService(String service); static Boolean isContextExecutionServer(); static void setContextExecutionServer(Boolean state); static void setVersion(final String version); static String getPythonVirtualEnv(); static void setPythonVirtualEnv(String pythonVirtualEnv); static final Logger LOGGER; static final String FILE_ENDING_TEI_HEADER; static final String FILE_ENDING_TEI_FULLTEXT; }
@Test(expected = GrobidPropertyException.class) public void testSetGrobidProperties_NullPath_shouldThrowException() { GrobidProperties.setGrobidPropertiesPath(null); }
@Test(expected = GrobidPropertyException.class) public void testSetGrobidProperties_PathFileNotExisting() { GrobidProperties.setGrobidPropertiesPath("/NotExistingPath"); }