当前位置: 首页>>代码示例>>Java>>正文


Java KoanSuiteCompilationListener类代码示例

本文整理汇总了Java中com.sandwich.util.io.KoanSuiteCompilationListener的典型用法代码示例。如果您正苦于以下问题:Java KoanSuiteCompilationListener类的具体用法?Java KoanSuiteCompilationListener怎么用?Java KoanSuiteCompilationListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KoanSuiteCompilationListener类属于com.sandwich.util.io包,在下文中一共展示了KoanSuiteCompilationListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: safelyConstructSuite

import com.sandwich.util.io.KoanSuiteCompilationListener; //导入依赖的package包/类
private Object safelyConstructSuite(DynamicClassLoader loader,
		KoanSuiteCompilationListener compilationListener,
		Entry<String, Map<String, KoanElementAttributes>> e) {
	// this is written strangely so stack trace will always be the same when constructSuite fails
	// this permits the app to only show the compilation failure once, despite the fact this
	// is getting hit every second.
	Object suite = null;
	while(suite == null || compilationListener.isLastCompilationAttemptFailure()) {
		suite = constructSuite(loader, e.getKey(), compilationListener);
		if(compilationListener.isLastCompilationAttemptFailure()){
		    if(!ApplicationSettings.isInteractive()){
		        AppLauncher.exit(255);
		    }
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e1) {}
		}
	}
	return suite;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:21,代码来源:RunKoans.java

示例2: stubAllKoans

import com.sandwich.util.io.KoanSuiteCompilationListener; //导入依赖的package包/类
protected Path stubAllKoans(String packageName, List<String> path){
	Path oldKoans = PathToEnlightenment.getPathToEnlightenment();
	Map<String, Map<String, KoanElementAttributes>> tempSuitesAndMethods = 
		new LinkedHashMap<String, Map<String, KoanElementAttributes>>();
	DynamicClassLoader loader = KoanClassLoader.getInstance();
	for(String suite : path){
		Map<String, KoanElementAttributes> methodsByName = new LinkedHashMap<String, KoanElementAttributes>();
		KoanSuiteCompilationListener listener = new KoanSuiteCompilationListener();
		for(Method m : loader.loadClass(suite, listener).getMethods()){
			if(m.getAnnotation(Koan.class) != null){
				methodsByName.put(m.getName(), new KoanElementAttributes(m.getName(), "", m.getDeclaringClass().getName()));
			}
		}
		tempSuitesAndMethods.put(suite, methodsByName);
	}
	Map<String, Map<String, Map<String, KoanElementAttributes>>> stubbedPath = 
		new LinkedHashMap<String, Map<String, Map<String, KoanElementAttributes>>>();
	stubbedPath.put(packageName, tempSuitesAndMethods);
	PathToEnlightenment.theWay = new Path(null,stubbedPath);
	return oldKoans;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:22,代码来源:CommandLineTestCase.java

示例3: safelyConstructSuite

import com.sandwich.util.io.KoanSuiteCompilationListener; //导入依赖的package包/类
private Object safelyConstructSuite(DynamicClassLoader loader,
		KoanSuiteCompilationListener compilationListener,
		Entry<String, Map<String, KoanElementAttributes>> e) {
	// this is written strangely so stack trace will always be the same when constructSuite fails
	// this permits the app to only show the compilation failure once, despite the fact this
	// is getting hit every second.
	Object suite = null;
	while(suite == null || compilationListener.isLastCompilationAttemptFailure()) {
		suite = constructSuite(loader, e.getKey(), compilationListener);
		if(compilationListener.isLastCompilationAttemptFailure()){
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e1) {}
		}
	}
	return suite;
}
 
开发者ID:MarinaMurashev,项目名称:JavaKoans,代码行数:18,代码来源:RunKoans.java

示例4: runKoans

import com.sandwich.util.io.KoanSuiteCompilationListener; //导入依赖的package包/类
KoanSuiteResult runKoans() {
	List<String> passingSuites = new ArrayList<String>();
	List<String> failingSuites = new ArrayList<String>();
	String level = null;
	KoanMethodResult failure = null;
	DynamicClassLoader loader = KoanClassLoader.getInstance();
	Path pathToEnlightenment = getPathToEnlightenment();
	KoanSuiteCompilationListener compilationListener = new KoanSuiteCompilationListener();
	int successfull = 0;
	for (Entry<String, Map<String, Map<String, KoanElementAttributes>>> packages : pathToEnlightenment) {
		for (Entry<String, Map<String, KoanElementAttributes>> e : packages.getValue().entrySet()) {
			String name = e.getKey().substring(e.getKey().lastIndexOf('.')+1);
			if(failure == null){
				Object suite = safelyConstructSuite(loader, compilationListener, e);
				final List<KoanElementAttributes> attributes = new ArrayList<KoanElementAttributes>(e.getValue().values());
				final List<KoanMethod> methods = mergeJavaFilesMethodsAndThoseInXml(suite, attributes, pathToEnlightenment.getOnlyMethodNameToRun());
				Collections.sort(methods, new KoanComparator());
				for (final KoanMethod koan : methods) {
					KoanMethodResult result = KoanMethodRunner.run(suite, koan);
					if(KoanMethodResult.PASSED != result){
						// Test failed!
						failure = result;
						failingSuites.add(name);
						break;
					}else{
						successfull++;
					}
				}
				if (failure == null) {
					passingSuites.add(name);
				}
				level = packages.getKey();
			}else{
				failingSuites.add(name);
			}
		}
	}
	return new KoanResultBuilder()
			.level(level)
			.numberPassing(successfull)
			.totalNumberOfKoanMethods(pathToEnlightenment.getTotalNumberOfKoans())
			.methodResult(failure).passingCases(passingSuites)
			.remainingCases(failingSuites).build();
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:45,代码来源:RunKoans.java


注:本文中的com.sandwich.util.io.KoanSuiteCompilationListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。