Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.ApplicationStateManager


        "class", "t-autocomplete-menu");
        writer.end();

        Link link = resources.createEventLink(EVENT_NAME);

        JSONObject config = new JSONObject();
        config.put("paramName", PARAM_NAME);
        config.put("indicator", loaderId);

        if (resources.isBound("minChars"))
            config.put("minChars", minChars);

        if (resources.isBound("frequency"))
            config.put("frequency", frequency);

        if (resources.isBound("tokens"))
        {
            for (int i = 0; i < tokens.length(); i++)
            {
                config.accumulate("tokens", tokens.substring(i, i + 1));
            }
        }

        // Let subclasses do more.
        configure(config);
View Full Code Here


     * not formatted correct.
     */
    JSONObject onParse(@RequestParameter(INPUT_PARAMETER)
    String input)
    {
        JSONObject response = new JSONObject();

        try
        {
            Date date = format.parse(input);

            response.put(RESULT, date.getTime());
        }
        catch (ParseException ex)
        {
            response.put(ERROR, ex.getMessage());
        }

        return response;
    }
View Full Code Here

    @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


    @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

    @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

    }

    @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

    }

    @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

    @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


    @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

    }

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

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

TOP

Related Classes of org.apache.tapestry5.services.ApplicationStateManager

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.