Java 类org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration 实例源码

项目:spring-cloud-sleuth    文件:ZipkinAutoConfigurationTests.java   
@Test
public void overrideRabbitMQQueue() throws Exception {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "spring.zipkin.rabbitmq.queue:zipkin2");
    context.register(
            PropertyPlaceholderAutoConfiguration.class,
            TraceMetricsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            ZipkinAutoConfiguration.class);
    context.refresh();

    SpanReporter spanReporter = context.getBean(SpanReporter.class);
    assertThat(spanReporter).extracting("reporter.sender.queue")
            .contains("zipkin2");

    context.close();
}
项目:spring-cloud-sleuth    文件:ZipkinAutoConfigurationTests.java   
@Test
public void canOverrideBySender() throws Exception {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "spring.zipkin.sender.type:web");
    context.register(
            PropertyPlaceholderAutoConfiguration.class,
            TraceMetricsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class,
            ZipkinAutoConfiguration.class);
    context.refresh();

    SpanReporter spanReporter = context.getBean(SpanReporter.class);
    assertThat(spanReporter).extracting("reporter.sender").allSatisfy(
            s -> assertThat(s.getClass().getSimpleName()).isEqualTo("RestTemplateSender")
    );

    context.close();
}
项目:spring-cloud-sleuth    文件:ZipkinAutoConfigurationTests.java   
@Test
public void rabbitWinsWhenKafkaPresent() throws Exception {
    context = new AnnotationConfigApplicationContext();
    context.register(
            PropertyPlaceholderAutoConfiguration.class,
            TraceMetricsAutoConfiguration.class,
            RabbitAutoConfiguration.class,
            KafkaAutoConfiguration.class,
            ZipkinAutoConfiguration.class);
    context.refresh();

    SpanReporter spanReporter = context.getBean(SpanReporter.class);
    assertThat(spanReporter).extracting("reporter.sender")
            .allSatisfy(s -> assertThat(s).isInstanceOf(RabbitMQSender.class));

    context.close();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void rabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(RabbitHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notRabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.rabbit.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ApplicationHealthIndicator.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RabbitHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, RabbitAutoConfiguration.class,
            EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(RabbitAdmin.class).length)
            .isEqualTo(1);
    RabbitHealthIndicator healthIndicator = this.context
            .getBean(RabbitHealthIndicator.class);
    assertThat(healthIndicator).isNotNull();
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void rabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(RabbitHealthIndicator.class);
}
项目:spring-boot-concourse    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notRabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.rabbit.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertThat(beans).hasSize(1);
    assertThat(beans.values().iterator().next().getClass())
            .isEqualTo(ApplicationHealthIndicator.class);
}
项目:spring-boot-concourse    文件:RabbitHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, RabbitAutoConfiguration.class,
            EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class);
    assertThat(this.context.getBeanNamesForType(RabbitAdmin.class).length)
            .isEqualTo(1);
    RabbitHealthIndicator healthIndicator = this.context
            .getBean(RabbitHealthIndicator.class);
    assertThat(healthIndicator).isNotNull();
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void notRabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.rabbit.enabled:false",
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(1, beans.size());
    assertEquals(ApplicationHealthIndicator.class,
            beans.values().iterator().next().getClass());
}
项目:contestparser    文件:RabbitHealthIndicatorTests.java   
@Test
public void indicatorExists() {
    this.context = new AnnotationConfigApplicationContext(
            PropertyPlaceholderAutoConfiguration.class, RabbitAutoConfiguration.class,
            EndpointAutoConfiguration.class, HealthIndicatorAutoConfiguration.class);
    assertEquals(1, this.context.getBeanNamesForType(RabbitAdmin.class).length);
    RabbitHealthIndicator healthIndicator = this.context
            .getBean(RabbitHealthIndicator.class);
    assertNotNull(healthIndicator);
}
项目:contestparser    文件:HealthIndicatorAutoConfigurationTests.java   
@Test
public void rabbitHealthIndicator() {
    this.context.register(RabbitAutoConfiguration.class,
            ManagementServerProperties.class, HealthIndicatorAutoConfiguration.class);
    EnvironmentTestUtils.addEnvironment(this.context,
            "management.health.diskspace.enabled:false");
    this.context.refresh();
    Map<String, HealthIndicator> beans = this.context
            .getBeansOfType(HealthIndicator.class);
    assertEquals(1, beans.size());
    assertEquals(RabbitHealthIndicator.class,
            beans.values().iterator().next().getClass());
}