Examples of ApplicationStateManager


Examples of org.apache.tapestry.services.ApplicationStateManager

        strategy.set(asoClass, aso);

        replay();

        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source);

        manager.set(asoClass, aso);

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry.services.ApplicationStateManager

        replay();

        Map<Class, ApplicationStateContribution> configuration = Collections.emptyMap();

        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source);

        Object actual = manager.get(asoClass);

        assertSame(actual, holder.get());

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry.services.ApplicationStateManager

    }

    @Test
    public void no_fields_with_annotation()
    {
        ApplicationStateManager manager = newApplicationStateManager();
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        train_findFieldsWithAnnotation(ct, ApplicationState.class);
View Full Code Here

Examples of org.apache.tapestry.services.ApplicationStateManager

    @SuppressWarnings("unchecked")
    @Test
    public void field_read_and_write() throws Exception
    {
        ApplicationStateManager manager = newApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();

        String componentClassName = StateHolder.class.getName();
        Class asoClass = ReadOnlyBean.class;

        ClassPool pool = new ClassPool();
        ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
        pool.appendClassPath(new LoaderClassPath(contextLoader));

        Loader loader = new Loader(contextLoader, pool);

        loader.delegateLoadingOf("org.apache.tapestry.");

        CtClass ctClass = pool.get(componentClassName);
        InternalClassTransformation transformation = new InternalClassTransformationImpl(ctClass,
                                                                                         _contextClassLoader, logger,
                                                                                         null);

        replay();

        new ApplicationStateWorker(manager).transform(transformation, model);

        verify();

        transformation.finish();

        Class transformedClass = pool.toClass(ctClass, loader);

        Instantiator instantiator = transformation.createInstantiator(transformedClass);

        Object component = instantiator.newInstance(resources);

        // Test the companion flag field

        expect(manager.exists(asoClass)).andReturn(true);

        replay();

        assertEquals(_access.get(component, "beanExists"), true);

        verify();

        // Test read property (get from ASM)

        Object aso = new ReadOnlyBean();

        train_get(manager, asoClass, aso);

        replay();

        assertSame(_access.get(component, "bean"), aso);

        verify();

        // Test write property (set ASM)

        Object aso2 = new ReadOnlyBean();

        manager.set(asoClass, aso2);

        replay();

        _access.set(component, "bean", aso2);
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager

    @SuppressWarnings("unchecked")
    @Test
    public void field_read_and_write() throws Exception
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentClassCache cache = mockComponentClassCache();

        train_getLogger(model, logger);

        Class asoClass = SimpleASO.class;

        CtClass ctClass = findCtClass(StateHolder.class);

        train_forName(cache, asoClass);

        replay();

        InternalClassTransformation transformation = new InternalClassTransformationImpl(classFactory, ctClass, null,
                                                                                         model, null);
        new ApplicationStateWorker(manager, cache).transform(transformation, model);

        verify();

        transformation.finish();

        Instantiator instantiator = transformation.createInstantiator();

        Object component = instantiator.newInstance(resources);

        // Test the companion flag field

        expect(manager.exists(asoClass)).andReturn(true);

        replay();

        assertEquals(access.get(component, "beanExists"), true);

        verify();

        // Test read property (get from ASM)

        Object aso = new SimpleASO();

        train_get(manager, asoClass, aso);

        replay();

        assertSame(access.get(component, "bean"), aso);

        verify();

        // Test write property (set ASM)

        Object aso2 = new SimpleASO();

        manager.set(asoClass, aso2);

        replay();

        access.set(component, "bean", aso2);
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager


    @Test
    public void read_field_with_create_disabled() throws Exception
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentClassCache cache = mockComponentClassCache();
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager

    @SuppressWarnings("unchecked")
    @Test
    public void field_read_and_write() throws Exception
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentClassCache cache = mockComponentClassCache();

        train_getLogger(model, logger);

        Class asoClass = SimpleASO.class;

        CtClass ctClass = findCtClass(StateHolder.class);

        train_forName(cache, asoClass);

        replay();

        InternalClassTransformation transformation = new InternalClassTransformationImpl(classFactory, ctClass, null,
                model, null, false);
        new ApplicationStateWorker(manager, cache).transform(transformation, model);

        verify();

        transformation.finish();

        Instantiator instantiator = transformation.createInstantiator();

        Object component = instantiator.newInstance(resources);

        // Test the companion flag field

        expect(manager.exists(asoClass)).andReturn(true);

        replay();

        assertEquals(access.get(component, "beanExists"), true);

        verify();

        // Test read property (get from ASM)

        Object aso = new SimpleASO();

        train_get(manager, asoClass, aso);

        replay();

        assertSame(access.get(component, "bean"), aso);

        verify();

        // Test write property (set ASM)

        Object aso2 = new SimpleASO();

        manager.set(asoClass, aso2);

        replay();

        access.set(component, "bean", aso2);
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager

    }

    @Test
    public void read_field_with_create_disabled() throws Exception
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentClassCache cache = mockComponentClassCache();
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager

    }

    @Test
    public void no_fields_with_annotation()
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        train_findFieldsWithAnnotation(ct, ApplicationState.class);
        train_findFieldsWithAnnotation(ct, SessionState.class);
View Full Code Here

Examples of org.apache.tapestry5.services.ApplicationStateManager

    @SuppressWarnings("unchecked")
    @Test
    public void field_read_and_write() throws Exception
    {
        ApplicationStateManager manager = mockApplicationStateManager();
        Logger logger = mockLogger();
        MutableComponentModel model = mockMutableComponentModel();
        InternalComponentResources resources = mockInternalComponentResources();
        ComponentClassCache cache = mockComponentClassCache();

        train_getLogger(model, logger);

        Class asoClass = SimpleASO.class;

        CtClass ctClass = findCtClass(StateHolder.class);

        train_forName(cache, asoClass);

        replay();

        InternalClassTransformation transformation = new InternalClassTransformationImpl(classFactory, ctClass, null,
                                                                                         model, null);
        new ApplicationStateWorker(manager, cache).transform(transformation, model);

        verify();

        transformation.finish();

        Instantiator instantiator = transformation.createInstantiator();

        Object component = instantiator.newInstance(resources);

        // Test the companion flag field

        expect(manager.exists(asoClass)).andReturn(true);

        replay();

        assertEquals(access.get(component, "beanExists"), true);

        verify();

        // Test read property (get from ASM)

        Object aso = new SimpleASO();

        train_get(manager, asoClass, aso);

        replay();

        assertSame(access.get(component, "bean"), aso);

        verify();

        // Test write property (set ASM)

        Object aso2 = new SimpleASO();

        manager.set(asoClass, aso2);

        replay();

        access.set(component, "bean", aso2);
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.