org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration#org.assertj.core.api.IterableAssert源码实例Demo

下面列出了org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration#org.assertj.core.api.IterableAssert 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

void assertAccountBalances(BalanceFile... balanceFiles) {
    IterableAssert<AccountBalanceSet> iterableAssert = assertThat(accountBalanceSetRepository.findAll())
            .hasSize(balanceFiles.length)
            .allMatch(abs -> abs.isComplete())
            .allMatch(abs -> abs.getProcessingEndTimestamp() != null)
            .allMatch(abs -> abs.getProcessingStartTimestamp() != null);

    for (BalanceFile balanceFile : balanceFiles) {
        iterableAssert.anyMatch(abs -> balanceFile.getConsensusTimestamp() == abs.getConsensusTimestamp() &&
                accountBalanceRepository.findByIdConsensusTimestamp(abs.getConsensusTimestamp()).size() ==
                        balanceFile.getCount());
    }
}
 
@Test
public void eventRegistryWithRabbit() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(RabbitAutoConfiguration.class))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors())
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
@Test
public void eventRegistryWithKafka() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.class))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
源代码4 项目: termsuite-core   文件: TerminologyAssert.java
public IterableAssert<Relation> asTermVariationsHavingRule(String ruleName) {
	Set<Relation> variations = Sets.newHashSet();
	for(Relation v:actual.getRelations()) {
		if(getVariationRules(v).contains(ruleName))
			variations.add(v);
		
	}
	return assertThat(variations);
}
 
源代码5 项目: termsuite-core   文件: TerminologyAssert.java
public IterableAssert<Relation> asTermVariations(RelationType ralType, RelationType... ralTypes) {
	EnumSet<RelationType> accepted = EnumSet.of(ralType, ralTypes);
	Set<Relation> relations = actual.getRelations().stream()
			.filter(r-> accepted.contains(r.getType()))
			.collect(toSet());
	return assertThat(
			relations);
}
 
源代码6 项目: termsuite-core   文件: TerminologyAssert.java
public IterableAssert<Term> asCompoundList() {
	Set<Term> comouponds = actual.getTerms().values().stream()
		.filter(t-> t.getWords().size() == 1 && t.getWords().get(0).getWord().isCompound())
		.collect(toSet());
	IterableAssert<Term> assertThat = assertThat(comouponds);
	return assertThat;
}
 
源代码7 项目: termsuite-core   文件: TerminologyAssert.java
public IterableAssert<String> asMatchingRules() {
	Set<String> matchingRuleNames = Sets.newHashSet();
	for(Relation tv:actual.getRelations().stream().filter(r->r.getType() == RelationType.VARIATION).collect(toSet())) 
		matchingRuleNames.addAll(getVariationRules(tv));
	IterableAssert<String> assertThat = assertThat(matchingRuleNames);
	return assertThat;
}
 
源代码8 项目: doov   文件: ValidationRuleAssert.java
public ValidationRuleAssert isUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.contains(fieldIds);
    return this;
}
 
源代码9 项目: doov   文件: ValidationRuleAssert.java
public ValidationRuleAssert isNotUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.doesNotContain(fieldIds);
    return this;
}
 
源代码10 项目: doov   文件: MappingRuleAssert.java
public MappingRuleAssert isUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.contains(fieldIds);
    return this;
}
 
源代码11 项目: doov   文件: MappingRuleAssert.java
public MappingRuleAssert isNotUsing(FieldId... fieldIds) {
    final List<FieldId> fields = collect(actual.metadata());
    final IterableAssert<FieldId> iterableAssert = new IterableAssert<>(fields);
    iterableAssert.doesNotContain(fieldIds);
    return this;
}
 
源代码12 项目: smart-testing   文件: TestListResolverAssert.java
public IterableAssert<ResolvedTest> includedPatterns() {
    isNotNull();

    return Assertions.assertThat(actual.getIncludedPatterns());
}
 
源代码13 项目: smart-testing   文件: TestListResolverAssert.java
public IterableAssert<ResolvedTest> excludedPatterns() {
    isNotNull();

    return Assertions.assertThat(actual.getExcludedPatterns());
}
 
@Test
public void standaloneEventRegistryWithBasicDataSource() {
    contextRunner.run(context -> {
        assertThat(context)
            .doesNotHaveBean(AppEngine.class)
            .doesNotHaveBean(ProcessEngine.class)
            .doesNotHaveBean(ChannelModelProcessor.class)
            .doesNotHaveBean("eventProcessEngineConfigurationConfigurer")
            .doesNotHaveBean("eventAppEngineConfigurationConfigurer");
        EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
        assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
        assertAllServicesPresent(context, eventRegistryEngine);

        IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
            eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

        channelModelProcessorAssert
            .hasSize(4);

        channelModelProcessorAssert
            .element(0)
            .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(1)
            .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(2)
            .isInstanceOf(InboundChannelModelProcessor.class);

        channelModelProcessorAssert
            .element(3)
            .isInstanceOf(OutboundChannelModelProcessor.class);

        assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
            .getBean(CustomUserEngineConfigurerConfiguration.class)
            .satisfies(configuration -> {
                assertThat(configuration.getInvokedConfigurations())
                    .containsExactly(
                        SpringEventRegistryEngineConfiguration.class
                    );
            });

    });
}
 
@Test
public void eventRegistryWithJms() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class
        ))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();

            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(5);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(OutboundChannelModelProcessor.class);

        });
}
 
@Test
public void eventRegistryWithJmsRabbitAndKafka() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class
        ))
        .run(context -> {
            assertThat(context)
                .hasSingleBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor")
                .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor")
                .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());
            channelModelProcessorAssert
                .hasSize(7)
                .contains(
                    context.getBean("jmsChannelDefinitionProcessor", JmsChannelModelProcessor.class),
                    context.getBean("rabbitChannelDefinitionProcessor", RabbitChannelDefinitionProcessor.class),
                    context.getBean("kafkaChannelDefinitionProcessor", KafkaChannelDefinitionProcessor.class)
                );

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(5)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(6)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
@Test
public void eventRegistryWithCustomDefinitionProcessors() {
    contextRunner
        .withConfiguration(AutoConfigurations.of(
            ActiveMQAutoConfiguration.class,
            JmsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class
        ))
        .withUserConfiguration(CustomChannelDefinitionProcessorsConfiguration.class)
        .run(context -> {
            assertThat(context)
                .doesNotHaveBean(JmsChannelModelProcessor.class)
                .hasBean("jmsChannelDefinitionProcessor")
                .doesNotHaveBean(RabbitChannelDefinitionProcessor.class)
                .hasBean("rabbitChannelDefinitionProcessor")
                .doesNotHaveBean(KafkaChannelDefinitionProcessor.class)
                .hasBean("kafkaChannelDefinitionProcessor")
                .hasBean("customChannelDefinitionProcessor");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
            IterableAssert<ChannelModelProcessor> channelModelProcessorAssert = assertThat(
                eventRegistryEngineConfiguration.getChannelModelProcessors());
            channelModelProcessorAssert
                .hasSize(8);

            channelModelProcessorAssert
                .element(0)
                .isEqualTo(context.getBean("customChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(1)
                .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(2)
                .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

        channelModelProcessorAssert
                .element(3)
                .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

            channelModelProcessorAssert
                .element(4)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(5)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(6)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(7)
                .isInstanceOf(OutboundChannelModelProcessor.class);
        });
}
 
源代码18 项目: termsuite-core   文件: TerminologyAssert.java
public IterableAssert<Relation> getVariations(Term base) {
	return assertThat(UnitTests.outRels(actual, base));
}