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


Java KoanElementAttributes类代码示例

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


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

示例1: defaultKoanDescriptions

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
@Test
public void defaultKoanDescriptions() throws Exception {
	StringBuilder exceptionStringBuilder = new StringBuilder(KoanConstants.EOL);
	for (Entry<String, Map<String, KoanElementAttributes>> suiteAndKoans : 
		PathToEnlightenment.getPathToEnlightenment().getKoanMethodsBySuiteByPackage().next().getValue().entrySet()) {
		for(Entry<String, KoanElementAttributes> koanEntry : suiteAndKoans.getValue().entrySet()){
			KoanMethod koan = KoanMethod.getInstance(koanEntry.getValue());
			Koan annotation = koan.getMethod().getAnnotation(Koan.class);
			if (annotation != null && KoanConstants.DEFAULT_KOAN_DESC.equals(koan.getLesson())) {
				exceptionStringBuilder.append(suiteAndKoans.getKey().getClass().getName()).append('.')
						.append(koan.getMethod().getName()).append(KoanConstants.EOL);
			}
		}
	}
	String exceptionString = exceptionStringBuilder.toString();
	if(exceptionString.trim().length() != 0){
		throw new RuntimeException(new StringBuilder(KoanConstants.EOL).append(
			"Following still have default Koan description:").append(exceptionString).toString());
	}
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:21,代码来源:DefaultKoanDescriptionTest.java

示例2: stubAllKoans

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的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 = new DynamicClassLoader();
	for(String suite : path){
		Map<String, KoanElementAttributes> methodsByName = new LinkedHashMap<String, KoanElementAttributes>();
		for(Method m : loader.loadClass(suite).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,代码行数:21,代码来源:CommandLineTestCase.java

示例3: safelyConstructSuite

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的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

示例4: stubAllKoans

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的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

示例5: safelyConstructSuite

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的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

示例6: testGetKoans

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
@Test
public void testGetKoans() throws Exception {
	stubAllKoans(Arrays.asList(new OnePassingKoan()));
	Map<String, Map<String, KoanElementAttributes>> koans = PathToEnlightenment.getPathToEnlightenment().iterator().next().getValue();
	assertEquals(1, koans.size());
	Entry<String, Map<String, KoanElementAttributes>> entry = koans.entrySet().iterator().next();
	assertEquals(OnePassingKoan.class.getName(), entry.getKey());
	assertEquals(	OnePassingKoan.class.getDeclaredMethod("koan").toString(), 
					KoanMethod.getInstance(entry.getValue().get("koan")).getMethod().toString());
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:11,代码来源:AppReadinessForDeploymentTest.java

示例7: getInstance

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
public static KoanMethod getInstance(KoanElementAttributes koanAttributes){
	try {
		return new KoanMethod(koanAttributes);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:8,代码来源:KoanMethod.java

示例8: getTotalNumberOfKoans

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
public int getTotalNumberOfKoans() {
	if(methodName != null){
		return 1;
	}
	int total = 0;
	Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> koanMethodsBySuiteByPackageIter = 
		getKoanMethodsBySuiteByPackage();
	while(koanMethodsBySuiteByPackageIter.hasNext()){
		Entry<String, Map<String, Map<String, KoanElementAttributes>>> e = koanMethodsBySuiteByPackageIter.next();
		for(Entry<String, Map<String, KoanElementAttributes>> e1 : e.getValue().entrySet()){
			total += countKoanAnnotationsInJavaFileGivenClassName(e1.getKey());
		}
	}
	return total;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:16,代码来源:PathToEnlightenment.java

示例9: stubKoanMethodsBySuiteByClass

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
protected Path stubKoanMethodsBySuiteByClass(Map<String, Map<String, Map<String, KoanElementAttributes>>> koanMethodsBySuiteByPackage){
	// unlike other collections in this app, this actually needs to remain mutable after the reference is
	// stored and utilized internally. this is so the DynamicClassLoader can swap out references to 
	// any dynamic classes
	this.koanMethodsBySuiteByPackage = koanMethodsBySuiteByPackage;
	return this;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:8,代码来源:PathToEnlightenment.java

示例10: KoanMethod

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
private KoanMethod(KoanElementAttributes koanAttributes) throws SecurityException, NoSuchMethodException{
	this(null, koanAttributes);
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:4,代码来源:KoanMethod.java

示例11: runKoans

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的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

示例12: Path

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
public Path(String methodName, Map<String, Map<String, Map<String, KoanElementAttributes>>> koans) {
	stubKoanMethodsBySuiteByClass(koans);
	this.methodName = methodName;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:5,代码来源:PathToEnlightenment.java

示例13: iterator

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
public Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> iterator() {
	return getKoanMethodsBySuiteByPackage();
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:4,代码来源:PathToEnlightenment.java

示例14: getKoanMethodsBySuiteByPackage

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
protected Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> getKoanMethodsBySuiteByPackage() {
	return koanMethodsBySuiteByPackage.entrySet().iterator();
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:4,代码来源:PathToEnlightenment.java

示例15: equals

import com.sandwich.koan.path.xmltransformation.KoanElementAttributes; //导入依赖的package包/类
@Override public boolean equals(Object o){
	if(o == this){
		return true;
	}
	if(o instanceof Path){
		if(getKoanMethodsBySuiteByPackage() == ((Path)o).getKoanMethodsBySuiteByPackage()){
			return true;
		}
		if(getKoanMethodsBySuiteByPackage() == null || ((Path)o).getKoanMethodsBySuiteByPackage() == null
				|| getKoanMethodsBySuiteByPackage().getClass() != ((Path)o).getKoanMethodsBySuiteByPackage().getClass()){
			return false;
		}
		Iterator<Entry<String,Map<String, Map<String, KoanElementAttributes>>>> i1 = 
			getKoanMethodsBySuiteByPackage();
		Iterator<Entry<String, Map<String, Map<String, KoanElementAttributes>>>> i2 = 
			((Path)o).getKoanMethodsBySuiteByPackage();
		while(i1.hasNext()){
			Map<String, Map<String, KoanElementAttributes>> m1 = i1.next().getValue();
			Map<String, Map<String, KoanElementAttributes>> m2 = i2.next().getValue();
			if(m1 == m2){
				continue;
			}
			if(			m1 == null 
					||  m2 == null
					||  m1.size() != m2.size()
					||  m1.getClass() != m2.getClass()){
				return false;
			}
			Iterator<Entry<String, Map<String, KoanElementAttributes>>> ii1 = m1.entrySet().iterator();
			Iterator<Entry<String, Map<String, KoanElementAttributes>>> ii2 = m2.entrySet().iterator();
			while(ii1.hasNext()){
				Entry<String, Map<String, KoanElementAttributes>> e1 = ii1.next();
				Entry<String, Map<String, KoanElementAttributes>> e2 = ii2.next();
				if(!e1.getKey().getClass().equals(e2.getKey().getClass())){
					return false;
				}
				if(!e1.getValue().equals(e2.getValue())){
					return false;
				}
			}
		}
	}
	return true;
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:45,代码来源:PathToEnlightenment.java


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