in.readstring java_Java Files.readFileIntoString方法代碼示例

本文整理匯總了Java中org.eclipse.xtext.util.Files.readFileIntoString方法的典型用法代碼示例。如果您正苦於以下問題:Java Files.readFileIntoString方法的具體用法?Java Files.readFileIntoString怎麽用?Java Files.readFileIntoString使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.xtext.util.Files的用法示例。

在下文中一共展示了Files.readFileIntoString方法的20個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: checkGenerateApp

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Check the App is generated successfully

*

* @param file Name to check

* @return true if the app is well generated

*/

public boolean checkGenerateApp(String fileName){

try{

//extract log

String text = Files.readFileIntoString(path +fileName);

//CHECK IF Server app generated successfully.

//OR Client app generated successfully.

Matcher m = Pattern.compile("((.*?)Server app generated successfully.)").matcher(text);

Matcher m2 = Pattern.compile("((.*?)Client app generated successfully.)").matcher(text);

while(m.find() | m2.find()) return true;

return false;

} catch (Exception e){

return false;

}

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:24,

示例2: checkCompileApp

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Check the App is compiled successfully

*

* @param file Name to check

* @return true if the app is well compiled

*/

public boolean checkCompileApp(String fileName) throws FileNotFoundException{

try{

//extract log

String text = Files.readFileIntoString(path + fileName);

//CHECK IF BUILD FAILED THEN false

Matcher m1 = Pattern.compile("((.*?)BUILD FAILED)").matcher(text);

Matcher m2 = Pattern.compile("((.*?)BUILD FAILURE)").matcher(text);

while(m1.find() | m2.find()) return false;

return true;

} catch (Exception e){

return false;

}

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:23,

示例3: checkBuildApp

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Check the App is build successfully

*

* @param jDirectory Name of the folder

*/

public boolean checkBuildApp(String fileName){

try{

String text = Files.readFileIntoString(path+fileName);

//CHECK IF BUILD FAILED THEN false

Matcher m = Pattern.compile("((.*?)APPLICATION FAILED TO START)").matcher(text);

Matcher m2 = Pattern.compile("((.*?)BUILD FAILED)").matcher(text);

Matcher m3 = Pattern.compile("((.*?)BUILD FAILURE)").matcher(text);

while(m.find() | m2.find() | m3.find()) return false;

return true;

} catch (Exception e){

return false;

}

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:21,

示例4: extractCoverageIntstructions

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return coverageInstructions from Jacoco

*

* @param jDirectory Name of the folder

* @return String coverage of instructions

*

*/

public String extractCoverageIntstructions(String fileName){

String resultsTests = DEFAULT_NOT_FOUND_VALUE;

try{

_log.info("ça passe !");

String text = Files.readFileIntoString(path+JACOCOPATH+fileName);

Matcher m1 = Pattern.compile("Total

(.*?)(.*?) %"

+ "

(.*?)(.*?) %").matcher(text);

Matcher m2 = Pattern.compile("Total

(.*?)(.*?)%"

+ "

(.*?)(.*?)%").matcher(text);

while(m1.find()) return resultsTests = m1.group(2).toString();

while(m2.find()) return resultsTests = m2.group(2).toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:27,

示例5: extractCoverageBranches

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return coverageBranches from Jacoco

*

* @param jDirectory Name of the folder

* @return String coverage of Branches

*

*/

public String extractCoverageBranches(String fileName){

String resultsTests = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+JACOCOPATH+fileName);

Matcher m1 = Pattern.compile("Total

(.*?)(.*?) %"

+ "

(.*?)(.*?) %").matcher(text);

Matcher m2 = Pattern.compile("Total

(.*?)(.*?)%"

+ "

(.*?)(.*?)%").matcher(text);

while(m1.find()) return resultsTests = m1.group(4).toString();

while(m2.find()) return resultsTests = m2.group(4).toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:25,

示例6: extractJSCoverageStatements

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Retrieves the percentage of Javascript Statements Coverage

*

* @param fileName File containing the percentage.

* @return The percentage of Statement Coverage (Javascript)

*/

public String extractJSCoverageStatements(String fileName){

String result = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?)

(\r*?)(\n*?)"

+ "(.*?)(.*?)(\r*?)(\n*?)"

+ "(.*?)Statements(\r*?)(\n*?)"

+ "(.*?)(.*?)(\r*?)(\n*?)"

+ "(.*?)

").matcher(text);

while(m1.find()) return m1.group(5).toString();

} catch(Exception e){

_log.error("Exception: "+e.getMessage());

}

return result;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:22,

示例7: extractJSCoverageBranches

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Retrieves the percentage of Javascript Branches Coverage

*

* @param fileName File containing the percentage.

* @return The percentage of Branches Coverage (Javascript)

*/

public String extractJSCoverageBranches(String fileName){

String result = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?)

(\r*?)(\n*?)"

+ "(.*?)(.*?)(\r*?)(\n*?)"

+ "(.*?)Branches(\r*?)(\n*?)"

+ "(.*?)(.*?)(\r*?)(\n*?)"

+ "(.*?)

").matcher(text);

while(m1.find()) return m1.group(5).toString();

} catch(Exception e){

_log.error("Exception: "+e.getMessage());

}

return result;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:22,

示例8: extractStacktraces

​點讚 3

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return stacktraces

*

* @param jDirectory Name of the folder

* @return String of stacktraces

*

*/

public String extractStacktraces(String fileName){

String stacktraces = "";

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(Exception(.*?)\\n)").matcher(text);

Matcher m2 = Pattern.compile("(Caused by(.*?)\\n)").matcher(text);

Matcher m3 = Pattern.compile("((.*?)\\[ERROR\\](.*))").matcher(text);

Matcher m4 = Pattern.compile("(ERROR:(.*?)\\n)").matcher(text);

Matcher m5 = Pattern.compile("(error:(.*?)^)").matcher(text);

Matcher m6 = Pattern.compile("(Error parsing reference:(.*?) is not a valid repository/tag)").matcher(text);

while(m1.find()) stacktraces = stacktraces + m1.group().toString() + "\n";

while(m2.find()) stacktraces = stacktraces + m2.group().toString() + "\n";

while(m3.find()) stacktraces = stacktraces + m3.group().toString() + "\n";

while(m4.find()) stacktraces = stacktraces + m4.group().toString() + "\n";

while(m5.find()) stacktraces = stacktraces + m5.group().toString() + "\n";

while(m6.find()) stacktraces = stacktraces + m6.group(1).toString() + "\n";

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return stacktraces;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:31,

示例9: getRepoName

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Tries to obtain repository name from the provided directory by reading git config in

* {@code currendDir/.git/config}

*

* @return string with repo name or {@code null}

*/

private static String getRepoName(File currentDir) {

File gitFolder = new File(currentDir, ".git");

if (!gitFolder.isDirectory()) {

if (LOGGER.isDebugEnabled())

LOGGER.debug("No '.git' folder at " + currentDir.getAbsolutePath());

return null;

}

File config = new File(gitFolder, "config");

if (!config.isFile()) {

if (LOGGER.isDebugEnabled())

LOGGER.debug("No 'config' file at " + gitFolder.getAbsolutePath());

return null;

}

try {

String configStr = Files.readFileIntoString(config.getAbsolutePath());

Config cfg = new Config();

cfg.fromText(configStr);

String originURL = cfg.getString("remote", "origin", "url");

if (originURL != null && !originURL.isEmpty()) {

int lastSlash = originURL.lastIndexOf('/');

String repoName = null;

if (lastSlash >= 0) {

repoName = originURL.substring(lastSlash + 1);

} else {

repoName = originURL;

}

if (repoName.endsWith(".git")) {

repoName = repoName.substring(0, repoName.length() - 4);

}

return repoName;

}

} catch (ConfigInvalidException e) {

LOGGER.warn("Cannot read git config at " + config.getAbsolutePath(), e);

}

return null;

}

開發者ID:eclipse,項目名稱:n4js,代碼行數:46,

示例10: checkDockerBuild

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Check the build result when using Docker.

*

* @param fileName Log file containing the result of the build.

* @return True if the app successfully built; False otherwise.

*/

public boolean checkDockerBuild(String fileName){

try{

String text = Files.readFileIntoString(fileName);

Matcher m = Pattern.compile("((.*?) Application 'jhipster' is running!)").matcher(text);

while (m.find()) return true;

return false;

} catch (Exception e){

return false;

}

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:17,

示例11: extractTime

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return the time from log fils (compile.log, build.log)

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractTime(String fileName){

String timebuild = "";

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("Started JhipsterApp in (.*?) seconds").matcher(text);

Matcher m2 = Pattern.compile("Total time: (.*?) secs").matcher(text);

Matcher m3 = Pattern.compile("Total time: (.*?)s").matcher(text);

Matcher m4 = Pattern.compile("Total time: (.*?) mins (.*?) secs").matcher(text);

Matcher m5 = Pattern.compile("Total time: (.*?) hrs (.*?) mins (.*?) secs").matcher(text);

Matcher m6 = Pattern.compile("Total time: (.*?):(.*?) min").matcher(text);

//check if secs

while(m2.find()) timebuild = m2.group(1).toString()+";";

//check if s

while(m3.find()) timebuild = m3.group(1).toString()+";";

//check if mins

while(m4.find()) timebuild = Float.toString(((Float.valueOf(m4.group(1).toString())*60) + Float.valueOf(m4.group(2).toString())))+";";

//check if min

while(m6.find()) timebuild = Float.toString(((Float.valueOf(m6.group(1).toString())*60) + Float.valueOf(m6.group(2).toString())))+";";

//check if hrs

while(m5.find()) timebuild = Float.toString(((Float.valueOf(m5.group(1).toString()) *3600)+ (Float.valueOf(m5.group(2).toString())*60) + Float.valueOf(m5.group(3).toString())))+";";

//check if seconds -> build with Docker (not Package)

while(m1.find()) timebuild = timebuild +m1.group(1).toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

if (timebuild == "") {return DEFAULT_NOT_FOUND_VALUE;}

else {return timebuild;}

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:40,

示例12: extractMemoryBuild

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return the memory used

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractMemoryBuild(String fileName){

String memoryBuild = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?)Final Memory").matcher(text);

while(m1.find()) return memoryBuild = m1.toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return memoryBuild;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:19,

示例13: extractResultsTest

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return results from tests ./mvnw clean test | ./gradlew clean test

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractResultsTest(String fileName){

String resultsTests = "";

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.repository.CustomSocialUsersConnectionRepositoryIntTest").matcher(text);

Matcher m2 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.security.SecurityUtilsUnitTest").matcher(text);

Matcher m3 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.service.SocialServiceIntTest").matcher(text);

Matcher m4 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.service.UserServiceIntTest").matcher(text);

Matcher m5 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.web.rest.AccountResourceIntTest").matcher(text);

Matcher m6 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.web.rest.AuditResourceIntTest").matcher(text);

Matcher m7 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.web.rest.UserResourceIntTest").matcher(text);

while(m1.find()) resultsTests = resultsTests + m1.group().toString() +"\n";

while(m2.find()) resultsTests = resultsTests + m2.group().toString() +"\n";

while(m3.find()) resultsTests = resultsTests + m3.group().toString() +"\n";

while(m4.find()) resultsTests = resultsTests + m4.group().toString() +"\n";

while(m5.find()) resultsTests = resultsTests + m5.group().toString() +"\n";

while(m6.find()) resultsTests = resultsTests + m6.group().toString() +"\n";

while(m7.find()) resultsTests = resultsTests + m7.group().toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

if(resultsTests.equals("")) return DEFAULT_NOT_FOUND_VALUE;

else return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:34,

示例14: extractCucumber

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return results from tests ./mvnw clean test | ./gradlew clean test -> cucumber

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractCucumber(String fileName){

String resultsTests = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("Tests run: (.*?) - in io.variability.jhipster.cucumber.CucumberTest").matcher(text);

while(m1.find()) return resultsTests = m1.group().toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:19,

示例15: extractKarmaJS

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return results from : gulp test

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractKarmaJS(String fileName){

String resultsTests = "OK";

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?) FAILED").matcher(text);

while(m1.find())

{resultsTests = resultsTests + m1.group().toString() + "\n";}

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:20,

示例16: extractGatling

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return results from tests ./mvnw gatling:execute| ./gradlew gatlingRun -x cleanResources

*

* @param jDirectory Name of the folder

* @return String of time of building

*

* TODO Create sequence of tests for gatling.

*/

public String extractGatling(String fileName){

String resultsTests = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?)").matcher(text);

while(m1.find()) return resultsTests = m1.group(1).toString();

} catch (Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:21,

示例17: extractProtractor

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

/**

* Return results from tests gulp protractor

*

* @param jDirectory Name of the folder

* @return String of time of building

*

*/

public String extractProtractor(String fileName){

String resultsTests = DEFAULT_NOT_FOUND_VALUE;

try{

String text = Files.readFileIntoString(path+fileName);

Matcher m1 = Pattern.compile("(.*?) specs, (.*?) failures").matcher(text);

while(m1.find()) return resultsTests = m1.group().toString();

} catch(Exception e){

_log.error("Exception: "+e.getMessage());

}

return resultsTests;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:21,

示例18: fullTest

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

@Override

@SuppressWarnings("unused")

protected void fullTest(String projectId)

throws IOException, InterruptedException, InterruptedException {

String systemSeparator = System.getProperty("line.separator", "\n");

try {

for (String lsep : new String[] { "\n", "\r\n", "\r" }) {

System.setProperty("line.separator", lsep);

String expectationFileName = projectId + "/expected.adoc";

workspace = new FileBasedWorkspace(resourceSetProvider, classpathPackageManager);

URI uriProject = URI.createFileURI(new File(TESTRESOURCES + projectId).getAbsolutePath());

workspace.registerProject(uriProject);

N4JSModel model = new N4JSModel(workspace);

injector.injectMembers(model);

runtimeCore = new N4JSRuntimeCore(workspace, model);

IN4JSProject project = runtimeCore.findProject(uriProject).get();

assertNotNull("Project not found", project);

Collection specChangeSet = jSDoc2SpecProcessor.convert(

new File(TESTRESOURCES),

Collections.singleton(project),

(p) -> resourceSetProvider.get(),

SubMonitorMsg.nullProgressMonitor());

String adocRootName = TESTRESOURCES + projectId + "/expectedADoc";

List expectedFileNames = getExpectedFileNames(adocRootName, specChangeSet);

assertFalse(expectedFileNames.isEmpty());

File adocRoot = new File(adocRootName);

String completeActual = "";

String completeExpected = "";

for (SpecFile specFile : specChangeSet) {

String fileName = specFile.getFile().getName().toString();

if (!expectedFileNames.contains(fileName))

continue;

String fullExpectationFileName = adocRoot.toPath().resolve(fileName).toString();

String expectedADoc = Files.readFileIntoString(fullExpectationFileName);

String actualADoc = specFile.getNewContent();

if (UPDATE_EXPECTION && !actualADoc.equals(expectedADoc)) {

expectedADoc = actualADoc;

Files.writeStringIntoFile(fullExpectationFileName, expectedADoc);

System.out.println("Updated expectation " + fullExpectationFileName);

}

completeActual += "\n " + fileName + " \n";

completeActual += actualADoc;

completeExpected += "\n " + fileName + " \n";

completeExpected += expectedADoc;

}

assertEqualsIgnoreWS(completeExpected, completeActual);

}

} finally {

System.setProperty("line.separator", systemSeparator);

}

}

開發者ID:eclipse,項目名稱:n4js,代碼行數:62,

示例19: isEncrypted

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

private boolean isEncrypted(File keyFile) {

String s = Files.readFileIntoString(keyFile.getAbsolutePath());

return s.indexOf("ENCRYPTED") >= 0;

}

開發者ID:eclipse,項目名稱:n4js,代碼行數:5,

示例20: infrastructureBug

​點讚 2

import org.eclipse.xtext.util.Files; //導入方法依賴的package包/類

private static boolean infrastructureBug(String logFile,String path){

String text = Files.readFileIntoString(path+logFile);

Matcher m = Pattern.compile("((.*?)Communications link failure)").matcher(text);

while(m.find()) return true;

return false;

}

開發者ID:axel-halin,項目名稱:Thesis-JHipster,代碼行數:7,

注:本文中的org.eclipse.xtext.util.Files.readFileIntoString方法示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值