List of usage examples for org.apache.commons.io FileUtils readLines
public static List readLines(File file, String encoding) throws IOException
From source file:net.fabricmc.installer.installer.MultiMCInstaller.java
private static boolean isValidInstance(File instanceDir, String requiredVersion) throws IOException { File instanceConfig = new File(instanceDir, "instance.cfg"); if (!instanceConfig.exists()) { return false; }//from w w w .j ava2 s . c o m List<String> lines = FileUtils.readLines(instanceConfig, Charset.defaultCharset()); String mcVersion = findIntendedVersion(lines); if (mcVersion.equals(requiredVersion)) { return true; } return false; }
From source file:com.clov4r.moboplayer.android.nil.codec.SubtitleJni.java
/** * ?????/*w w w. jav a2 s. c o m*/ * * @param filePath * @param index * @return */ public int openSubtitleFile_2(String filePath, int index, int subtiltle_index) { String charSet = getFilecharset(new File(filePath)); if (!charSet.equals("UTF-8")) { try { String tempPath = filePath.substring(0, filePath.length() - 4) + "mobo_temp_utf-8.srt"; File tempFile = new File(tempPath); if (!tempFile.exists()) { FileUtils.writeLines(tempFile, "UTF-8", FileUtils.readLines(new File(filePath), charSet)); } return openSubtitleFileInJNI2(tempPath, index, subtiltle_index); } catch (Exception e) { e.printStackTrace(); } } return openSubtitleFileInJNI2(filePath, index, subtiltle_index); }
From source file:de.tudarmstadt.ukp.dkpro.tc.crfsuite.CRFSuiteOutcomeIDReport.java
private List<String> getTestData() throws Exception { File storage = getContext().getStorageLocation(CRFSuiteTestTask.TEST_TASK_INPUT_KEY_TEST_DATA, AccessMode.READONLY); File testFile = new File(storage.getAbsolutePath() + "/" + CRFSuiteAdapter.getInstance().getFrameworkFilename(AdapterNameEntries.featureVectorsFile)); List<String> readLines = FileUtils.readLines(testFile, "UTF-8"); return readLines; }
From source file:eu.sisob.uma.crawler.ResearchersCrawlers.CrawlerDepartamentsV3Controller.java
public CrawlerDepartamentsV3Controller(String storageFolder, File data_dir, List<String> subjects) throws Exception { super(storageFolder, false); wronk_link_keywords = new ArrayList<String>(); link_keywords = new ArrayList<String>(); link_departments_keywords = new ArrayList<String>(); link_subdepartment_keywords = new ArrayList<String>(); link_departments_type_keywords = new ArrayList<Map.Entry<String, String>>(); interesting_urls_detected = new TreeMap<String, List<CandidateTypeURL>>(); setKeyWordSeparator("/"); /**//from ww w . j av a2 s . c om * ADDING KEYWORDS, ALL KEYWORD ARE PASSED THROUGH getCanonicalName function * Departments type key may have got many values separated by keyword_separator */ List<String> lst = null; File f = null; try { f = new File(data_dir, DEPARTMENTS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addListLinkKeyWordsOfDepartmentsList(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, SUBDEPARTMENTS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addListLinkKeyWordsOfSubDepartmentsList(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, KEYWORDS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addListLinkKeyWords(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, WRONG_KEYWORDS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); this.addListLinkWrongKeyWords(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } //Add subjects for (String subject : subjects) { String canonice_subject = ""; for (String sub_subject : subject.split(keyword_separator)) { if (Character.isLetter(sub_subject.charAt(0))) addListLinkKeyWordsOfSubDepartmentsList(String.valueOf(sub_subject.charAt(0))); canonice_subject += keyword_separator + CandidateTypeURL.getCanonicalName(sub_subject); } addListLinkKeyWordsOfDepartmentsType(subject, canonice_subject.substring(1)); } addPluraliceWords(this.getLstLinkKeyWordsOfDepartmentsType()); if (CrawlerTrace.isTraceUrlsActive()) { try { String[] filenames = { WRONG_URLS_RESULT_TAG, KEYWORDS_RESULT_TAG, WRONG_KEYWORDS_RESULT_TAG, SUBDEPARTMENTS_RESULT_TAG, DEPARTMENTS_RESULT_TAG, DEPARTMENT_OF_RESULT_TAG }; crawler_trace = new CrawlerTrace(storageFolder, filenames); } catch (Exception ex) { Logger.getLogger("error").error(ex.getMessage(), ex); crawler_trace = null; } } else { crawler_trace = null; } }
From source file:com.cws.esolutions.security.main.PasswordUtility.java
public static void main(final String[] args) { final String methodName = PasswordUtility.CNAME + "#main(final String[] args)"; if (DEBUG) {// ww w .j a v a2 s . c o m DEBUGGER.debug("Value: {}", methodName); } if (args.length == 0) { HelpFormatter usage = new HelpFormatter(); usage.printHelp(PasswordUtility.CNAME, options, true); System.exit(1); } BufferedReader bReader = null; BufferedWriter bWriter = null; try { // load service config first !! SecurityServiceInitializer.initializeService(PasswordUtility.SEC_CONFIG, PasswordUtility.LOG_CONFIG, false); if (DEBUG) { DEBUGGER.debug("Options options: {}", options); for (String arg : args) { DEBUGGER.debug("Value: {}", arg); } } CommandLineParser parser = new PosixParser(); CommandLine commandLine = parser.parse(options, args); if (DEBUG) { DEBUGGER.debug("CommandLineParser parser: {}", parser); DEBUGGER.debug("CommandLine commandLine: {}", commandLine); DEBUGGER.debug("CommandLine commandLine.getOptions(): {}", (Object[]) commandLine.getOptions()); DEBUGGER.debug("CommandLine commandLine.getArgList(): {}", commandLine.getArgList()); } final SecurityConfigurationData secConfigData = PasswordUtility.svcBean.getConfigData(); final SecurityConfig secConfig = secConfigData.getSecurityConfig(); final PasswordRepositoryConfig repoConfig = secConfigData.getPasswordRepo(); final SystemConfig systemConfig = secConfigData.getSystemConfig(); if (DEBUG) { DEBUGGER.debug("SecurityConfigurationData secConfig: {}", secConfigData); DEBUGGER.debug("SecurityConfig secConfig: {}", secConfig); DEBUGGER.debug("RepositoryConfig secConfig: {}", repoConfig); DEBUGGER.debug("SystemConfig systemConfig: {}", systemConfig); } if (commandLine.hasOption("encrypt")) { if ((StringUtils.isBlank(repoConfig.getPasswordFile())) || (StringUtils.isBlank(repoConfig.getSaltFile()))) { System.err.println("The password/salt files are not configured. Entries will not be stored!"); } File passwordFile = FileUtils.getFile(repoConfig.getPasswordFile()); File saltFile = FileUtils.getFile(repoConfig.getSaltFile()); if (DEBUG) { DEBUGGER.debug("File passwordFile: {}", passwordFile); DEBUGGER.debug("File saltFile: {}", saltFile); } final String entryName = commandLine.getOptionValue("entry"); final String username = commandLine.getOptionValue("username"); final String password = commandLine.getOptionValue("password"); final String salt = RandomStringUtils.randomAlphanumeric(secConfig.getSaltLength()); if (DEBUG) { DEBUGGER.debug("String entryName: {}", entryName); DEBUGGER.debug("String username: {}", username); DEBUGGER.debug("String password: {}", password); DEBUGGER.debug("String salt: {}", salt); } final String encodedSalt = PasswordUtils.base64Encode(salt); final String encodedUserName = PasswordUtils.base64Encode(username); final String encryptedPassword = PasswordUtils.encryptText(password, salt, secConfig.getSecretAlgorithm(), secConfig.getIterations(), secConfig.getKeyBits(), secConfig.getEncryptionAlgorithm(), secConfig.getEncryptionInstance(), systemConfig.getEncoding()); final String encodedPassword = PasswordUtils.base64Encode(encryptedPassword); if (DEBUG) { DEBUGGER.debug("String encodedSalt: {}", encodedSalt); DEBUGGER.debug("String encodedUserName: {}", encodedUserName); DEBUGGER.debug("String encodedPassword: {}", encodedPassword); } if (commandLine.hasOption("store")) { try { new File(passwordFile.getParent()).mkdirs(); new File(saltFile.getParent()).mkdirs(); boolean saltFileExists = (saltFile.exists()) ? true : saltFile.createNewFile(); if (DEBUG) { DEBUGGER.debug("saltFileExists: {}", saltFileExists); } // write the salt out first if (!(saltFileExists)) { throw new IOException("Unable to create salt file"); } boolean passwordFileExists = (passwordFile.exists()) ? true : passwordFile.createNewFile(); if (!(passwordFileExists)) { throw new IOException("Unable to create password file"); } if (commandLine.hasOption("replace")) { File[] files = new File[] { saltFile, passwordFile }; if (DEBUG) { DEBUGGER.debug("File[] files: {}", (Object) files); } for (File file : files) { if (DEBUG) { DEBUGGER.debug("File: {}", file); } String currentLine = null; File tmpFile = new File(FileUtils.getTempDirectory() + "/" + "tmpFile"); if (DEBUG) { DEBUGGER.debug("File tmpFile: {}", tmpFile); } bReader = new BufferedReader(new FileReader(file)); bWriter = new BufferedWriter(new FileWriter(tmpFile)); while ((currentLine = bReader.readLine()) != null) { if (!(StringUtils.equals(currentLine.trim().split(",")[0], entryName))) { bWriter.write(currentLine + System.getProperty("line.separator")); bWriter.flush(); } } bWriter.close(); FileUtils.deleteQuietly(file); FileUtils.copyFile(tmpFile, file); FileUtils.deleteQuietly(tmpFile); } } FileUtils.writeStringToFile(saltFile, entryName + "," + encodedUserName + "," + encodedSalt + System.getProperty("line.separator"), true); FileUtils.writeStringToFile(passwordFile, entryName + "," + encodedUserName + "," + encodedPassword + System.getProperty("line.separator"), true); } catch (IOException iox) { ERROR_RECORDER.error(iox.getMessage(), iox); } } System.out.println("Entry Name " + entryName + " stored."); } if (commandLine.hasOption("decrypt")) { String saltEntryName = null; String saltEntryValue = null; String decryptedPassword = null; String passwordEntryName = null; if ((StringUtils.isEmpty(commandLine.getOptionValue("entry")) && (StringUtils.isEmpty(commandLine.getOptionValue("username"))))) { throw new ParseException("No entry or username was provided to decrypt."); } if (StringUtils.isEmpty(commandLine.getOptionValue("username"))) { throw new ParseException("no entry provided to decrypt"); } String entryName = commandLine.getOptionValue("entry"); String username = commandLine.getOptionValue("username"); if (DEBUG) { DEBUGGER.debug("String entryName: {}", entryName); DEBUGGER.debug("String username: {}", username); } File passwordFile = FileUtils.getFile(repoConfig.getPasswordFile()); File saltFile = FileUtils.getFile(repoConfig.getSaltFile()); if (DEBUG) { DEBUGGER.debug("File passwordFile: {}", passwordFile); DEBUGGER.debug("File saltFile: {}", saltFile); } if ((!(saltFile.canRead())) || (!(passwordFile.canRead()))) { throw new IOException( "Unable to read configured password/salt file. Please check configuration and/or permissions."); } for (String lineEntry : FileUtils.readLines(saltFile, systemConfig.getEncoding())) { saltEntryName = lineEntry.split(",")[0]; if (DEBUG) { DEBUGGER.debug("String saltEntryName: {}", saltEntryName); } if (StringUtils.equals(saltEntryName, entryName)) { saltEntryValue = PasswordUtils.base64Decode(lineEntry.split(",")[2]); break; } } if (StringUtils.isEmpty(saltEntryValue)) { throw new SecurityException("No entries were found that matched the provided information"); } for (String lineEntry : FileUtils.readLines(passwordFile, systemConfig.getEncoding())) { passwordEntryName = lineEntry.split(",")[0]; if (DEBUG) { DEBUGGER.debug("String passwordEntryName: {}", passwordEntryName); } if (StringUtils.equals(passwordEntryName, saltEntryName)) { String decodedPassword = PasswordUtils.base64Decode(lineEntry.split(",")[2]); decryptedPassword = PasswordUtils.decryptText(decodedPassword, saltEntryValue, secConfig.getSecretAlgorithm(), secConfig.getIterations(), secConfig.getKeyBits(), secConfig.getEncryptionAlgorithm(), secConfig.getEncryptionInstance(), systemConfig.getEncoding()); break; } } if (StringUtils.isEmpty(decryptedPassword)) { throw new SecurityException("No entries were found that matched the provided information"); } System.out.println(decryptedPassword); } else if (commandLine.hasOption("encode")) { System.out.println(PasswordUtils.base64Encode((String) commandLine.getArgList().get(0))); } else if (commandLine.hasOption("decode")) { System.out.println(PasswordUtils.base64Decode((String) commandLine.getArgList().get(0))); } } catch (IOException iox) { ERROR_RECORDER.error(iox.getMessage(), iox); System.err.println("An error occurred during processing: " + iox.getMessage()); System.exit(1); } catch (ParseException px) { ERROR_RECORDER.error(px.getMessage(), px); System.err.println("An error occurred during processing: " + px.getMessage()); System.exit(1); } catch (SecurityException sx) { ERROR_RECORDER.error(sx.getMessage(), sx); System.err.println("An error occurred during processing: " + sx.getMessage()); System.exit(1); } catch (SecurityServiceException ssx) { ERROR_RECORDER.error(ssx.getMessage(), ssx); System.exit(1); } finally { try { if (bReader != null) { bReader.close(); } if (bWriter != null) { bReader.close(); } } catch (IOException iox) { } } System.exit(0); }
From source file:eu.sisob.uma.crawler.ResearchersCrawlers.CrawlerResearchesPagesV3Controller.java
public CrawlerResearchesPagesV3Controller(String storageFolder, File data_dir, List<ResearcherNameInfo> researchers) throws Exception { super(storageFolder, false); interesting_urls_detected = new TreeMap<String, List<CandidateTypeURL>>(); may_be_interesting_urls_detected = new TreeMap<String, List<CandidateTypeURL>>(); link_wrong_keywords = new ArrayList<String>(); link_keywords = new ArrayList<String>(); link_staff_keywords = new ArrayList<String>(); link_substaff_keywords = new ArrayList<String>(); researcher_names_info_to_search = new ArrayList<ResearcherNameInfo>(); List<String> lst = null; File f = null;//www . j a v a 2 s .c om try { f = new File(data_dir, STAFFLIST_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addLinkKeyWordsOfStaffList(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, SUBSTAFFLIST_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addLinkKeyWordsOfSubStaffList(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, KEYWORDS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); addListLinkKeyWords(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } try { f = new File(data_dir, WRONG_KEYWORDS_RESULT_TAG + ".keywords"); lst = FileUtils.readLines(f, "UTF-8"); for (String keyword : lst) { keyword = CandidateTypeURL.getCanonicalName(keyword); this.addListLinkWrongKeyWords(keyword); } } catch (Exception ex) { ProjectLogger.LOGGER.error(ex); } for (ResearcherNameInfo researcher_name_info : researchers) { researcher_name_info.first_name = CandidateTypeURL.getCanonicalName(researcher_name_info.first_name); researcher_name_info.last_name = CandidateTypeURL.getCanonicalName(researcher_name_info.last_name); researcher_name_info.initial = CandidateTypeURL.getCanonicalName(researcher_name_info.initial); researcher_name_info.whole_name = CandidateTypeURL.getCanonicalName(researcher_name_info.whole_name); addLinkResearchesNames(researcher_name_info); for (String sub_last_name : researcher_name_info.last_name.split(" ")) { if (Character.isLetter(sub_last_name.charAt(0))) addLinkKeyWordsOfSubStaffList(String.valueOf(sub_last_name.charAt(0))); } } clearInterestingUrlsDetected(); if (CrawlerTrace.isTraceUrlsActive()) { try { String[] filenames = { WRONG_URLS_RESULT_TAG, KEYWORDS_RESULT_TAG, WRONG_KEYWORDS_RESULT_TAG, STAFFLIST_RESULT_TAG, SUBSTAFFLIST_RESULT_TAG }; crawler_trace = new CrawlerTrace(storageFolder, filenames); } catch (Exception ex) { Logger.getLogger("error").error(ex.getMessage(), ex); crawler_trace = null; } } else { crawler_trace = null; } }
From source file:io.fabric8.vertx.maven.plugin.SPICombineTest.java
@Test public void testCombine() throws Exception { File jar1 = new File("target/testCombine1.jar"); File jar2 = new File("target/testCombine2.jar"); File jar3 = new File("target/testCombine3.jar"); JavaArchive jarArchive1 = ShrinkWrap.create(JavaArchive.class); jarArchive1.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl"); jarArchive1.as(ZipExporter.class).exportTo(jar1, true); JavaArchive jarArchive2 = ShrinkWrap.create(JavaArchive.class); jarArchive2.addAsServiceProvider("com.test.demo.DemoSPI", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); jarArchive2.addAsServiceProvider("com.test.demo.DemoSP2", "com.test.demo.DemoSPI2.impl.DemoSPI2Impl2"); jarArchive2.as(ZipExporter.class).exportTo(jar2, true); JavaArchive jarArchive3 = ShrinkWrap.create(JavaArchive.class); jarArchive3.addClass(SPICombineTest.class); jarArchive3.as(ZipExporter.class).exportTo(jar3, true); Set<Artifact> artifacts = new LinkedHashSet<>(); Artifact a1 = new DefaultArtifact("org.acme", "a1", "1.0", "compile", "jar", "", null); a1.setFile(jar1);//from ww w.j ava 2 s .c o m Artifact a2 = new DefaultArtifact("org.acme", "a2", "1.0", "compile", "jar", "", null); a2.setFile(jar2); Artifact a3 = new DefaultArtifact("org.acme", "a3", "1.0", "compile", "jar", "", null); a3.setFile(jar3); artifacts.add(a1); artifacts.add(a2); artifacts.add(a3); MavenProject project = new MavenProject(); project.setVersion("1.0"); project.setArtifactId("foo"); AbstractVertxMojo mojo = new AbstractVertxMojo() { @Override public void execute() throws MojoExecutionException, MojoFailureException { } }; mojo.setLog(new SystemStreamLog()); Build build = new Build(); build.setOutputDirectory("target/junk"); project.setBuild(build); ServiceFileCombinationConfig config = new ServiceFileCombinationConfig().setProject(project) .setArtifacts(artifacts).setArchive(ServiceUtils.getDefaultFatJar()).setMojo(mojo); combiner.doCombine(config); File merged = new File("target/junk/META-INF/services/com.test.demo.DemoSPI"); assertThat(merged).isFile(); List<String> lines = FileUtils.readLines(merged, "UTF-8"); assertThat(lines).containsExactly("com.test.demo.DemoSPI.impl.DemoSPIImpl", "com.test.demo.DemoSPI.impl.DemoSPIImpl2"); Stream.of(jar1, jar2, jar3, new File("target/junk")).forEach(FileUtils::deleteQuietly); }
From source file:com.github.stagirs.lingvo.build.MorphStateMachineBuilder.java
private static Set<String> getSuffixes() throws IOException { Set<String> suffixes = new HashSet(); for (String line : FileUtils.readLines(new File("dict.opcorpora.plain"), "utf-8")) { if (line.isEmpty()) { continue; }//from w w w . ja v a 2 s . c om Lemma lemma = Lemma.parse(line); WordForm norm = lemma.getNorm(); for (WordForm raw : lemma.getItems()) { int[] com = getCommon(norm.getWord(), raw.getWord()); for (int j = com[1]; j < raw.getWord().length(); j++) { suffixes.add(raw.getWord().substring(j)); } } } return suffixes; }
From source file:ee.ria.xroad.asyncdb.AsyncLogWriterBehavior.java
License:asdf
/** * Tests whether the entry is correctly written into async log. * * @throws Exception - when writing entry into async log fails. *///from w w w . j a v a2s . c o m @Test public void shouldWriteCorrectlyToAsyncLog() throws Exception { // Initialize String lastSendResult1 = "OK"; int requestSendCount1 = 0; Date receivedTime1 = new Date(1292509011); ClientId client1 = ClientId.create("EE", "GOV", "client1"); ServiceId service1 = ServiceId.create("EE", "GOV", "client1", null, "service1"); RequestInfo request1 = new RequestInfo(0, "d41d8cd98f00b204e9800998ecf8427e", receivedTime1, null, client1, "EE27001010001", service1); AsyncLogWriter logWriter1 = new AsyncLogWriter(service1.getClientId()); String lastSendResult2 = "NOK"; int requestSendCount2 = 7; Date receivedTime2 = new Date(1292509311); Date removedTime2 = new Date(1292509321); ClientId client2 = ClientId.create("EE", "GOV", "client2"); ServiceId service2 = ServiceId.create("EE", "GOV", "client2", null, "service2"); RequestInfo request2 = new RequestInfo(1, "tab\tnewline\nbackslash\\asdfs", receivedTime2, removedTime2, client2, "EE27001010002", service2); AsyncLogWriter logWriter2 = new AsyncLogWriter(service2.getClientId()); // Write logWriter1.appendToLog(request1, lastSendResult1, requestSendCount1); logWriter2.appendToLog(request2, lastSendResult2, requestSendCount2); // Validate List<String> logFileLines = FileUtils.readLines(new File(ASYNC_LOG_PATH), StandardCharsets.UTF_8); assertEquals(2, logFileLines.size()); String[] firstLineData = logFileLines.get(0).split(Character.toString(AsyncLogWriter.FIELD_SEPARATOR)); assertEquals(AsyncDBTestUtil.LOG_FILE_FIELDS, firstLineData.length); assertTrue(StringUtils.isNotBlank(firstLineData[FIELD_LOGGING_TIME])); assertEquals("1292509", firstLineData[FIELD_RECEIVED_TIME]); assertEquals("0", firstLineData[FIELD_REMOVED_TIME]); assertEquals("OK", firstLineData[FIELD_SENDING_RESULT]); assertEquals("0", firstLineData[FIELD_FIRST_REQUEST_SEND_COUNT]); assertEquals("EE/GOV/client1", firstLineData[FIELD_PROVIDER_NAME]); assertEquals(client1.toString(), firstLineData[FIELD_SENDER]); assertEquals("EE27001010001", firstLineData[FIELD_USER]); assertEquals(service1.toString(), firstLineData[FIELD_SERVICE]); assertEquals("d41d8cd98f00b204e9800998ecf8427e", firstLineData[FIELD_ID]); String[] secondLineData = logFileLines.get(1).split(Character.toString(AsyncLogWriter.FIELD_SEPARATOR)); assertEquals(AsyncDBTestUtil.LOG_FILE_FIELDS, secondLineData.length); assertTrue(StringUtils.isNotBlank(secondLineData[FIELD_LOGGING_TIME])); assertEquals("1292509", secondLineData[FIELD_RECEIVED_TIME]); assertEquals("1292509", secondLineData[FIELD_REMOVED_TIME]); assertEquals("NOK", secondLineData[FIELD_SENDING_RESULT]); assertEquals("7", secondLineData[FIELD_FIRST_REQUEST_SEND_COUNT]); assertEquals("EE/GOV/client2", secondLineData[FIELD_PROVIDER_NAME]); assertEquals(client2.toString(), secondLineData[FIELD_SENDER]); assertEquals("EE27001010002", secondLineData[FIELD_USER]); assertEquals(service2.toString(), secondLineData[FIELD_SERVICE]); String expectedSecondId = StringEscapeUtils.escapeJava("tab\tnewline\nbackslash\\asdfs"); assertEquals(expectedSecondId, secondLineData[FIELD_ID]); }
From source file:de.tudarmstadt.ukp.dkpro.tc.crfsuite.CRFSuiteOutcomeIDReport.java
private List<String> getGoldAndPredictions() throws Exception { File storage = getContext().getStorageLocation(CRFSuiteTestTask.TEST_TASK_OUTPUT_KEY, AccessMode.READONLY); File predictionFile = new File(storage.getAbsolutePath() + "/" + CRFSuiteAdapter.getInstance().getFrameworkFilename(AdapterNameEntries.predictionsFile)); List<String> readLines = FileUtils.readLines(predictionFile, "UTF-8"); return readLines; }