本文整理汇总了Java中org.eclipse.xtext.util.Files.readFileIntoString方法的典型用法代码示例。如果您正苦于以下问题:Java Files.readFileIntoString方法的具体用法?Java Files.readFileIntoString怎么用?Java Files.readFileIntoString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.util.Files
的用法示例。
在下文中一共展示了Files.readFileIntoString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkGenerateApp
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;
}
}
示例2: checkCompileApp
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;
}
}
示例3: checkBuildApp
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;
}
}
示例4: extractCoverageIntstructions
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</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?) %"
+ "</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?) %</td>").matcher(text);
Matcher m2 = Pattern.compile("Total</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?)%"
+ "</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?)%</td>").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;
}
示例5: extractCoverageBranches
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</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?) %"
+ "</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?) %</td>").matcher(text);
Matcher m2 = Pattern.compile("Total</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?)%"
+ "</td><td class=\"bar\">(.*?)</td><td class=\"ctr2\">(.*?)%</td>").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;
}
示例6: extractJSCoverageStatements
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("(.*?)<div class='fl pad1y space-right2'>(\r*?)(\n*?)"
+ "(.*?)<span class=\"strong\">(.*?)</span>(\r*?)(\n*?)"
+ "(.*?)<span class=\"quiet\">Statements</span>(\r*?)(\n*?)"
+ "(.*?)<span class='fraction'>(.*?)</span>(\r*?)(\n*?)"
+ "(.*?)</div>").matcher(text);
while(m1.find()) return m1.group(5).toString();
} catch(Exception e){
_log.error("Exception: "+e.getMessage());
}
return result;
}
示例7: extractJSCoverageBranches
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("(.*?)<div class='fl pad1y space-right2'>(\r*?)(\n*?)"
+ "(.*?)<span class=\"strong\">(.*?)</span>(\r*?)(\n*?)"
+ "(.*?)<span class=\"quiet\">Branches</span>(\r*?)(\n*?)"
+ "(.*?)<span class='fraction'>(.*?)</span>(\r*?)(\n*?)"
+ "(.*?)</div>").matcher(text);
while(m1.find()) return m1.group(5).toString();
} catch(Exception e){
_log.error("Exception: "+e.getMessage());
}
return result;
}
示例8: extractStacktraces
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;
}
示例9: getRepoName
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;
}
示例10: checkDockerBuild
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;
}
}
示例11: extractTime
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;}
}
示例12: extractMemoryBuild
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;
}
示例13: extractResultsTest
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;
}
示例14: extractCucumber
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;
}
示例15: extractKarmaJS
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;
}