當前位置: 首頁>>代碼示例>>Java>>正文


Java ConditionAndOutcomes類代碼示例

本文整理匯總了Java中org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes的典型用法代碼示例。如果您正苦於以下問題:Java ConditionAndOutcomes類的具體用法?Java ConditionAndOutcomes怎麽用?Java ConditionAndOutcomes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConditionAndOutcomes類屬於org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport包,在下文中一共展示了ConditionAndOutcomes類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addLogMessage

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
private void addLogMessage(StringBuilder message, String source,
		ConditionAndOutcomes conditionAndOutcomes) {
	message.append(String.format("%n   %s", source));
	message.append(conditionAndOutcomes.isFullMatch() ? " matched" : " did not match")
			.append(String.format("%n"));
	for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) {
		message.append("      - ");
		if (StringUtils.hasLength(conditionAndOutcome.getOutcome().getMessage())) {
			message.append(conditionAndOutcome.getOutcome().getMessage());
		}
		else {
			message.append(conditionAndOutcome.getOutcome().isMatch() ? "matched"
					: "did not match");
		}
		message.append(" (");
		message.append(ClassUtils
				.getShortName(conditionAndOutcome.getCondition().getClass()));
		message.append(String.format(")%n"));
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:21,代碼來源:ConditionEvaluationReportMessage.java

示例2: testDuplicateConditionAndOutcomes

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void testDuplicateConditionAndOutcomes() {
	ConditionAndOutcome outcome1 = new ConditionAndOutcome(this.condition1,
			new ConditionOutcome(true, "Message 1"));
	ConditionAndOutcome outcome2 = new ConditionAndOutcome(this.condition2,
			new ConditionOutcome(true, "Message 2"));
	ConditionAndOutcome outcome3 = new ConditionAndOutcome(this.condition3,
			new ConditionOutcome(true, "Message 2"));

	assertThat(outcome1).isEqualTo(outcome1);
	assertThat(outcome1).isNotEqualTo(outcome2);
	assertThat(outcome2).isEqualTo(outcome3);

	ConditionAndOutcomes outcomes = new ConditionAndOutcomes();
	outcomes.add(this.condition1, new ConditionOutcome(true, "Message 1"));
	outcomes.add(this.condition2, new ConditionOutcome(true, "Message 2"));
	outcomes.add(this.condition3, new ConditionOutcome(true, "Message 2"));

	assertThat(getNumberOfOutcomes(outcomes)).isEqualTo(2);
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:21,代碼來源:ConditionEvaluationReportTests.java

示例3: duplicateOutcomes

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void duplicateOutcomes() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
			DuplicateConfig.class);
	ConditionEvaluationReport report = ConditionEvaluationReport
			.get(context.getBeanFactory());
	String autoconfigKey = MultipartAutoConfiguration.class.getName();

	ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource()
			.get(autoconfigKey);
	assertThat(outcomes).isNotEqualTo(nullValue());
	assertThat(getNumberOfOutcomes(outcomes)).isEqualTo(2);

	List<String> messages = new ArrayList<String>();
	for (ConditionAndOutcome outcome : outcomes) {
		messages.add(outcome.getOutcome().getMessage());
	}
	assertThat(messages).areAtLeastOne(Matched.by(
			containsString("@ConditionalOnClass classes found: javax.servlet.Servlet,"
					+ "org.springframework.web.multipart.support.StandardServletMultipartResolver")));
	context.close();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:23,代碼來源:ConditionEvaluationReportTests.java

示例4: negativeOuterPositiveInnerBean

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void negativeOuterPositiveInnerBean() throws Exception {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "test.present=true");
	context.register(NegativeOuterConfig.class);
	context.refresh();
	ConditionEvaluationReport report = ConditionEvaluationReport
			.get(context.getBeanFactory());
	Map<String, ConditionAndOutcomes> sourceOutcomes = report
			.getConditionAndOutcomesBySource();
	assertThat(context.containsBean("negativeOuterPositiveInnerBean")).isFalse();
	String negativeConfig = NegativeOuterConfig.class.getName();
	assertThat(sourceOutcomes.get(negativeConfig).isFullMatch()).isFalse();
	String positiveConfig = NegativeOuterConfig.PositiveInnerConfig.class.getName();
	assertThat(sourceOutcomes.get(positiveConfig).isFullMatch()).isFalse();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:17,代碼來源:ConditionEvaluationReportTests.java

示例5: addLogMessage

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
private void addLogMessage(StringBuilder message, String source,
		ConditionAndOutcomes conditionAndOutcomes) {
	message.append("\n   " + source);
	message.append(
			conditionAndOutcomes.isFullMatch() ? " matched\n" : " did not match\n");
	for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) {
		message.append("      - ");
		if (StringUtils.hasLength(conditionAndOutcome.getOutcome().getMessage())) {
			message.append(conditionAndOutcome.getOutcome().getMessage());
		}
		else {
			message.append(conditionAndOutcome.getOutcome().isMatch() ? "matched"
					: "did not match");
		}
		message.append(" (");
		message.append(ClassUtils
				.getShortName(conditionAndOutcome.getCondition().getClass()));
		message.append(")\n");
	}

}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:22,代碼來源:AutoConfigurationReportLoggingInitializer.java

示例6: testDuplicateConditionAndOutcomes

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void testDuplicateConditionAndOutcomes() {
	ConditionAndOutcome outcome1 = new ConditionAndOutcome(this.condition1,
			new ConditionOutcome(true, "Message 1"));
	ConditionAndOutcome outcome2 = new ConditionAndOutcome(this.condition2,
			new ConditionOutcome(true, "Message 2"));
	ConditionAndOutcome outcome3 = new ConditionAndOutcome(this.condition3,
			new ConditionOutcome(true, "Message 2"));

	assertThat(outcome1, equalTo(outcome1));
	assertThat(outcome1, not(equalTo(outcome2)));
	assertThat(outcome2, equalTo(outcome3));

	ConditionAndOutcomes outcomes = new ConditionAndOutcomes();
	outcomes.add(this.condition1, new ConditionOutcome(true, "Message 1"));
	outcomes.add(this.condition2, new ConditionOutcome(true, "Message 2"));
	outcomes.add(this.condition3, new ConditionOutcome(true, "Message 2"));

	assertThat(getNumberOfOutcomes(outcomes), equalTo(2));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:21,代碼來源:ConditionEvaluationReportTests.java

示例7: duplicateOutcomes

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void duplicateOutcomes() {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
			DuplicateConfig.class);
	ConditionEvaluationReport report = ConditionEvaluationReport
			.get(context.getBeanFactory());
	String autoconfigKey = MultipartAutoConfiguration.class.getName();

	ConditionAndOutcomes outcomes = report.getConditionAndOutcomesBySource()
			.get(autoconfigKey);
	assertThat(outcomes, not(nullValue()));
	assertThat(getNumberOfOutcomes(outcomes), equalTo(2));

	List<String> messages = new ArrayList<String>();
	for (ConditionAndOutcome outcome : outcomes) {
		messages.add(outcome.getOutcome().getMessage());
	}

	Matcher<String> onClassMessage = containsString("@ConditionalOnClass "
			+ "classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver");
	assertThat(messages, hasItem(onClassMessage));
	context.close();
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:24,代碼來源:ConditionEvaluationReportTests.java

示例8: negativeOuterPositiveInnerBean

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void negativeOuterPositiveInnerBean() throws Exception {
	AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
	EnvironmentTestUtils.addEnvironment(context, "test.present=true");
	context.register(NegativeOuterConfig.class);
	context.refresh();
	ConditionEvaluationReport report = ConditionEvaluationReport
			.get(context.getBeanFactory());
	Map<String, ConditionAndOutcomes> sourceOutcomes = report
			.getConditionAndOutcomesBySource();
	assertThat(context.containsBean("negativeOuterPositiveInnerBean"),
			equalTo(false));
	String negativeConfig = NegativeOuterConfig.class.getName();
	assertThat(sourceOutcomes.get(negativeConfig).isFullMatch(), equalTo(false));
	String positiveConfig = NegativeOuterConfig.PositiveInnerConfig.class.getName();
	assertThat(sourceOutcomes.get(positiveConfig).isFullMatch(), equalTo(false));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:18,代碼來源:ConditionEvaluationReportTests.java

示例9: Report

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
public Report(ConditionEvaluationReport report) {
	this.positiveMatches = new LinkedMultiValueMap<String, MessageAndCondition>();
	this.negativeMatches = new LinkedMultiValueMap<String, MessageAndCondition>();
	this.exclusions = report.getExclusions();
	for (Map.Entry<String, ConditionAndOutcomes> entry : report
			.getConditionAndOutcomesBySource().entrySet()) {
		add(entry.getValue().isFullMatch() ? this.positiveMatches
				: this.negativeMatches, entry.getKey(), entry.getValue());

	}
	if (report.getParent() != null) {
		this.parent = new Report(report.getParent());
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:15,代碼來源:AutoConfigurationReportEndpoint.java

示例10: add

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
private void add(MultiValueMap<String, MessageAndCondition> map, String source,
		ConditionAndOutcomes conditionAndOutcomes) {
	String name = ClassUtils.getShortName(source);
	for (ConditionAndOutcome conditionAndOutcome : conditionAndOutcomes) {
		map.add(name, new MessageAndCondition(conditionAndOutcome));
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:8,代碼來源:AutoConfigurationReportEndpoint.java

示例11: recordConditionEvaluations

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void recordConditionEvaluations() throws Exception {
	this.outcome1 = new ConditionOutcome(false, "m1");
	this.outcome2 = new ConditionOutcome(false, "m2");
	this.outcome3 = new ConditionOutcome(false, "m3");
	this.report.recordConditionEvaluation("a", this.condition1, this.outcome1);
	this.report.recordConditionEvaluation("a", this.condition2, this.outcome2);
	this.report.recordConditionEvaluation("b", this.condition3, this.outcome3);
	Map<String, ConditionAndOutcomes> map = this.report
			.getConditionAndOutcomesBySource();
	assertThat(map.size()).isEqualTo(2);
	Iterator<ConditionAndOutcome> iterator = map.get("a").iterator();

	ConditionAndOutcome conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition()).isEqualTo(this.condition1);
	assertThat(conditionAndOutcome.getOutcome()).isEqualTo(this.outcome1);

	conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition()).isEqualTo(this.condition2);
	assertThat(conditionAndOutcome.getOutcome()).isEqualTo(this.outcome2);
	assertThat(iterator.hasNext()).isFalse();

	iterator = map.get("b").iterator();
	conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition()).isEqualTo(this.condition3);
	assertThat(conditionAndOutcome.getOutcome()).isEqualTo(this.outcome3);
	assertThat(iterator.hasNext()).isFalse();
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:29,代碼來源:ConditionEvaluationReportTests.java

示例12: getNumberOfOutcomes

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
private int getNumberOfOutcomes(ConditionAndOutcomes outcomes) {
	Iterator<ConditionAndOutcome> iterator = outcomes.iterator();
	int numberOfOutcomesAdded = 0;
	while (iterator.hasNext()) {
		numberOfOutcomesAdded++;
		iterator.next();
	}
	return numberOfOutcomesAdded;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:10,代碼來源:ConditionEvaluationReportTests.java

示例13: recordConditionEvaluations

import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes; //導入依賴的package包/類
@Test
public void recordConditionEvaluations() throws Exception {
	this.outcome1 = new ConditionOutcome(false, "m1");
	this.outcome2 = new ConditionOutcome(false, "m2");
	this.outcome3 = new ConditionOutcome(false, "m3");
	this.report.recordConditionEvaluation("a", this.condition1, this.outcome1);
	this.report.recordConditionEvaluation("a", this.condition2, this.outcome2);
	this.report.recordConditionEvaluation("b", this.condition3, this.outcome3);
	Map<String, ConditionAndOutcomes> map = this.report
			.getConditionAndOutcomesBySource();
	assertThat(map.size(), equalTo(2));
	Iterator<ConditionAndOutcome> iterator = map.get("a").iterator();

	ConditionAndOutcome conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition(), equalTo(this.condition1));
	assertThat(conditionAndOutcome.getOutcome(), equalTo(this.outcome1));

	conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition(), equalTo(this.condition2));
	assertThat(conditionAndOutcome.getOutcome(), equalTo(this.outcome2));
	assertThat(iterator.hasNext(), equalTo(false));

	iterator = map.get("b").iterator();
	conditionAndOutcome = iterator.next();
	assertThat(conditionAndOutcome.getCondition(), equalTo(this.condition3));
	assertThat(conditionAndOutcome.getOutcome(), equalTo(this.outcome3));
	assertThat(iterator.hasNext(), equalTo(false));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:29,代碼來源:ConditionEvaluationReportTests.java


注:本文中的org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcomes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。