Package org.jboss.arquillian.spring.integration.context

Examples of org.jboss.arquillian.spring.integration.context.ClientTestScopeApplicationContext


    public void customContextShouldBeChosenWhenBothDefaultAndCustomResourcesExist() {
        // given
        TestClass testClass = new TestClass(ClientXmlAnnotatedClassWithBothCustomAndDefaultLocations.class);

        // when
        ClientTestScopeApplicationContext applicationContext = instance.createApplicationContext(testClass);

        // then
        assertThat(applicationContext.getApplicationContext().getBeanDefinitionNames()).isEmpty();
        assertThat(applicationContext.getApplicationContext().getBeanDefinitionCount()).isEqualTo(0);
    }
View Full Code Here


    public void createdApplicationContextCreatedFromDefaultResourceShouldContainSingleBean() {
        // given
        TestClass testClass = new TestClass(ClientXmlAnnotatedClass.class);

        // when
        ClientTestScopeApplicationContext applicationContext = instance.createApplicationContext(testClass);

        // then
        assertThat(applicationContext.getApplicationContext().getBeanDefinitionNames()).isNotEmpty();
        assertThat(applicationContext.getApplicationContext().getBeanDefinitionCount()).isEqualTo(1);
        assertThat(applicationContext.getApplicationContext().getBeanDefinitionNames()[0]).contains(PlainClass.class.getName());
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public ClientTestScopeApplicationContext createApplicationContext(TestClass testClass) {

        return new ClientTestScopeApplicationContext(getApplicationContext(testClass), true);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public ClientTestScopeApplicationContext createApplicationContext(TestClass testClass) {

        return new ClientTestScopeApplicationContext(getApplicationContext(testClass), testClass, true);
    }
View Full Code Here

        instance = new ClientApplicationContextLifecycleHandler();

        supportedApplicationContextProducer = mock(ClientApplicationContextProducer.class);
        when(supportedApplicationContextProducer.supports(any(TestClass.class))).thenReturn(true);
        when(supportedApplicationContextProducer.createApplicationContext(any(TestClass.class)))
                .thenReturn(new ClientTestScopeApplicationContext(new GenericApplicationContext(), testClass, true));

        notSupportedApplicationContextProducer = mock(ClientApplicationContextProducer.class);
        when(notSupportedApplicationContextProducer.supports(any(TestClass.class))).thenReturn(false);

        applicationContextDestroyer = mock(ApplicationContextDestroyer.class);
View Full Code Here

        Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
        when(mockServiceLoader.get()).thenReturn(serviceLoader);
        TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);

        ApplicationContext applicationContext = mock(ApplicationContext.class);
        ClientTestScopeApplicationContext ClientTestScopeApplicationContext =
                new ClientTestScopeApplicationContext(applicationContext, new TestClass(Object.class), true);

        InstanceProducer<ClientTestScopeApplicationContext> mockApplicationContext = mock(InstanceProducer.class);
        when(mockApplicationContext.get()).thenReturn(ClientTestScopeApplicationContext);
        TestReflectionHelper.setFieldValue(instance, "applicationContextInstance", mockApplicationContext);
View Full Code Here

        Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
        when(mockServiceLoader.get()).thenReturn(serviceLoader);
        TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);

        ApplicationContext applicationContext = mock(ApplicationContext.class);
        ClientTestScopeApplicationContext ClientTestScopeApplicationContext =
                new ClientTestScopeApplicationContext(applicationContext, new TestClass(Object.class), true);

        InstanceProducer<ClientTestScopeApplicationContext> mockApplicationContext = mock(InstanceProducer.class);
        when(mockApplicationContext.get()).thenReturn(ClientTestScopeApplicationContext);
        TestReflectionHelper.setFieldValue(instance, "applicationContextInstance", mockApplicationContext);
View Full Code Here

        Instance<ServiceLoader> mockServiceLoader = mock(Instance.class);
        when(mockServiceLoader.get()).thenReturn(serviceLoader);
        TestReflectionHelper.setFieldValue(instance, "serviceLoaderInstance", mockServiceLoader);

        ApplicationContext applicationContext = mock(ApplicationContext.class);
        ClientTestScopeApplicationContext ClientTestScopeApplicationContext =
                new ClientTestScopeApplicationContext(applicationContext, new TestClass(Object.class), true);

        InstanceProducer<ClientTestScopeApplicationContext> mockApplicationContext = mock(InstanceProducer.class);
        when(mockApplicationContext.get()).thenReturn(ClientTestScopeApplicationContext);
        TestReflectionHelper.setFieldValue(instance, "applicationContextInstance", mockApplicationContext);
View Full Code Here

    public void shouldCreateApplicationContextUsingDefaultJavaConfig() {
        // given
        TestClass testClass = new TestClass(ClientClassesAnnotatedClassWithDefaultConfigurationClassSpecified.class);

        // when
        ClientTestScopeApplicationContext applicationContext = instance.createApplicationContext(testClass);

        // then
        assertThat(applicationContext).isNotNull();
        assertThat(applicationContext.getApplicationContext().getBeanNamesForType(PlainClass.class)).isNotNull();
        assertThat(applicationContext.getApplicationContext().getBeanNamesForType(ClassFromTestPackage.class)).isEmpty();
    }
View Full Code Here

    public void shouldInjectClassesFromPackagesIncludedInDefaultConfiguration() {
        // given
        TestClass testClass = new TestClass(ClientClassesAnnotatedClassWithStaticDefaultConfigurationInnerClassAndPackages.class);

        // when
        ClientTestScopeApplicationContext applicationContext = instance.createApplicationContext(testClass);

        // then
        assertThat(applicationContext.getApplicationContext().getBeanNamesForType(PlainClass.class)).isNotNull();
        assertThat(applicationContext.getApplicationContext().getBeanNamesForType(ClassFromTestPackage.class)).isNotEmpty();

    }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.spring.integration.context.ClientTestScopeApplicationContext

Copyright © 2018 www.massapicom. 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.