Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.Environment.peek()


    @Test
    public void peek_when_empty_returns_null()
    {
        Environment e = new EnvironmentImpl();

        assertNull(e.peek(Runnable.class));
        assertNull(e.peek(Map.class));
    }

    @Test
    public void push_and_pop()
View Full Code Here


    public void peek_when_empty_returns_null()
    {
        Environment e = new EnvironmentImpl();

        assertNull(e.peek(Runnable.class));
        assertNull(e.peek(Map.class));
    }

    @Test
    public void push_and_pop()
    {
View Full Code Here

        replay();

        assertNull(e.push(Runnable.class, r1));

        assertSame(r1, e.peek(Runnable.class));

        assertSame(r1, e.push(Runnable.class, r2));

        assertSame(r2, e.peek(Runnable.class));
View Full Code Here

        assertSame(r1, e.peek(Runnable.class));

        assertSame(r1, e.push(Runnable.class, r2));

        assertSame(r2, e.peek(Runnable.class));

        assertSame(r2, e.pop(Runnable.class));
        assertSame(r1, e.pop(Runnable.class));

        verify();
View Full Code Here

        train_getOverrideMessages(overrides, messages);

        expect(model.newInstance()).andReturn(data);
       
        expect(env.peek(eq(BeanValidationContext.class))).andReturn(null);
       
        expect(model.getBeanType()).andReturn(RegistrationData.class);

        BeanEditContext ctxt = new BeanEditContext()
        {
View Full Code Here

        train_getOverrideMessages(overrides, messages);

        expect(model.newInstance()).andReturn(data);
       
        expect(env.peek(eq(BeanValidationContext.class))).andReturn(beanValidationContext);
       
        expect(env.pop(eq(BeanValidationContext.class))).andReturn(beanValidationContext);
       
        expect(env.push(eq(BeanValidationContext.class), isA(BeanValidationContext.class))).andReturn(beanValidationContext);
       
View Full Code Here

    public void add_zones()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("element", "client1"));
        js.addInitializerCall("zone", new JSONObject("element", "client2"));

        replay();
View Full Code Here

    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();
        FormSupport fs = mockFormSupport();

        expect(environment.peek(FormSupport.class)).andReturn(fs).atLeastOnce();

        expect(fs.getClientId()).andReturn("myform");
        expect(fs.getFormComponentId()).andReturn("MyPage.myform");

        JSONObject expected = new JSONObject(String.format(
View Full Code Here

    public void zones_with_functions()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("{'element':'client1', 'show':'showme' }"));
        js.addInitializerCall("zone", new JSONObject("{'element':'client2', 'update':'updateme' }"));

        replay();
View Full Code Here

    public void zone_function_names_are_converted_to_lower_case()
    {
        JavaScriptSupport js = mockJavaScriptSupport();
        Environment environment = mockEnvironment();

        expect(environment.peek(FormSupport.class)).andReturn(null).atLeastOnce();

        js.addInitializerCall("zone", new JSONObject("{'element':'client1', 'show':'showme' }"));
        js.addInitializerCall("zone", new JSONObject("{'element':'client2', 'update':'updateme' }"));

        replay();
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.