Examples of AnnotationConfigApplicationContext


Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

  }

  @Test
  public void testDefaultContext() throws Exception {
    System.setProperty("HADOOP_TOKEN_FILE_LOCATION", "xx/xx/xx/00002");
    context = new AnnotationConfigApplicationContext();
    context.register(TestConfigWithClass.class, YarnContainerAutoConfiguration.class);
    context.refresh();
    assertNotNull(context.getBean(YarnContainer.class));
    assertNotNull(context.getBean(ContainerLauncherRunner.class));
  }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

  }

  @Test
  public void testDefaultContext() throws Exception {
    System.setProperty("HADOOP_TOKEN_FILE_LOCATION", "xx/xx/xx/00001/container_tokens");
    context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils
        .addEnvironment(
            this.context,
            "spring.yarn.appmaster.appmasterClass:org.springframework.yarn.boot.YarnAppmasterAutoConfigurationTests$TestManagedContainerClusterAppmaster",
            "spring.yarn.appmaster.containercluster.enabled:true");
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

  }

  @Test
  public void testOverrideDefaultGridProjectionFactory() throws Exception {
    System.setProperty("HADOOP_TOKEN_FILE_LOCATION", "xx/xx/xx/00001/container_tokens");
    context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils
        .addEnvironment(
            this.context,
            "spring.yarn.appmaster.appmasterClass:org.springframework.yarn.boot.YarnAppmasterAutoConfigurationTests$TestManagedContainerClusterAppmaster",
            "spring.yarn.appmaster.containercluster.enabled:true");
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

  }

  @Test
  public void testAddCustomGridProjectionFactory() throws Exception {
    System.setProperty("HADOOP_TOKEN_FILE_LOCATION", "xx/xx/xx/00001/container_tokens");
    context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils
        .addEnvironment(
            this.context,
            "spring.yarn.appmaster.appmasterClass:org.springframework.yarn.boot.YarnAppmasterAutoConfigurationTests$TestManagedContainerClusterAppmaster",
            "spring.yarn.appmaster.containercluster.enabled:true");
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

            // first try to create annotation config application context
            Class<?>[] annotatedClasses = new Class<?>[resources.length];
            for (int i = 0; i < resources.length; i++) {
                annotatedClasses[i] = this.classLoader.loadClass(resources[i]);
            }
            AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(annotatedClasses);
            context.setParent(parent);
            context.setClassLoader(classLoader);
            return context;
        } catch (ClassNotFoundException e) {
            // create generic application context
            GenericApplicationContext context = new GenericApplicationContext(parent);
            context.setClassLoader(classLoader);
            ResourceLoader resourceLoader = new DefaultResourceLoader(classLoader);
            context.setResourceLoader(resourceLoader);
            BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
            for (String resource : resources) {
                reader.loadBeanDefinitions(resourceLoader.getResource(resource));
            }
            context.refresh();
            return context;
        }

    }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

public class ServerTracerTest {

    @Test
    public void testServerTracer() {
        final AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext(TraceFiltersMockConfig.class, SpanCollectorMockConfig.class,
                ServerTracerConfig.class);
        try {
            final ServerTracer bean1 = ctx.getBean(ServerTracer.class);
            assertNotNull(bean1);
            final ServerTracer bean2 = ctx.getBean(ServerTracer.class);
            assertSame("Expect singleton.", bean1, bean2);

        } finally {
            ctx.close();
        }
    }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

public class ClientTracerConfigTest {

    @Test
    public void testClientTracer() {
        final AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext(TraceFiltersMockConfig.class, SpanCollectorMockConfig.class,
                ClientTracerConfig.class);
        try {
            final ClientTracer bean1 = ctx.getBean(ClientTracer.class);
            assertNotNull(bean1);
            final ClientTracer bean2 = ctx.getBean(ClientTracer.class);
            assertSame("Expect singleton.", bean1, bean2);

        } finally {
            ctx.close();
        }
    }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

public class AnnotationSubmitterConfigTest {

    @Test
    public void testAnnotationSubmitter() {
        final AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext(AnnotationSubmitterConfig.class);
        try {
            final AnnotationSubmitter bean1 = ctx.getBean(AnnotationSubmitter.class);
            assertNotNull(bean1);
            final AnnotationSubmitter bean2 = ctx.getBean(AnnotationSubmitter.class);
            assertSame("Expect singleton.", bean1, bean2);

        } finally {
            ctx.close();
        }
    }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

public class ServerSpanThreadBinderConfigTest {

    @Test
    public void testThreadBinder() {
        final AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext(ServerSpanThreadBinderConfig.class);
        try {
            final ServerSpanThreadBinderConfig bean1 = ctx.getBean(ServerSpanThreadBinderConfig.class);
            assertNotNull(bean1);
            final ServerSpanThreadBinderConfig bean2 = ctx.getBean(ServerSpanThreadBinderConfig.class);
            assertSame("Expect singleton.", bean1, bean2);

        } finally {
            ctx.close();
        }
    }
View Full Code Here

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext

public class EndPointSubmitterConfigTest {

    @Test
    public void test() {
        final AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(EndPointSubmitterConfig.class);
        try {
            final EndPointSubmitter bean1 = ctx.getBean(EndPointSubmitter.class);
            assertNotNull(bean1);
            final EndPointSubmitter bean2 = ctx.getBean(EndPointSubmitter.class);
            assertSame("Expect singleton.", bean1, bean2);

        } finally {
            ctx.close();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.