本文整理汇总了Java中org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome类的典型用法代码示例。如果您正苦于以下问题:Java ConditionAndOutcome类的具体用法?Java ConditionAndOutcome怎么用?Java ConditionAndOutcome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConditionAndOutcome类属于org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport包,在下文中一共展示了ConditionAndOutcome类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLogMessage
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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.ConditionAndOutcome; //导入依赖的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.ConditionAndOutcome; //导入依赖的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: addLogMessage
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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");
}
}
示例5: testDuplicateConditionAndOutcomes
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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));
}
示例6: duplicateOutcomes
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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();
}
示例7: add
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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
示例8: MessageAndCondition
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的package包/类
public MessageAndCondition(ConditionAndOutcome conditionAndOutcome) {
Condition condition = conditionAndOutcome.getCondition();
ConditionOutcome outcome = conditionAndOutcome.getOutcome();
this.condition = ClassUtils.getShortName(condition.getClass());
if (StringUtils.hasLength(outcome.getMessage())) {
this.message = outcome.getMessage();
}
else {
this.message = (outcome.isMatch() ? "matched" : "did not match");
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:AutoConfigurationReportEndpoint.java
示例9: recordConditionEvaluations
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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
示例10: getNumberOfOutcomes
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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
示例11: recordConditionEvaluations
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport.ConditionAndOutcome; //导入依赖的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));
}