Package org.springframework.extensions.webscripts

Examples of org.springframework.extensions.webscripts.Runtime


    verify(handler).handleWebScriptResponse(any(WebScriptResponse.class));
  }

  @Test
  public void testHandleWebScriptSession() {
    final Runtime runtime = mock(Runtime.class);
    when(runtime.getSession()).thenReturn(mock(WebScriptSession.class));
    handleGet("/handleWebScriptSession", new MockWebScriptRequest().runtime(runtime));
    verify(handler).handleWebScriptSession(any(WebScriptSession.class));
  }
View Full Code Here


  /* Main operations */

  @Test
  public void testHandleResponseTemplate() {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplate", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(handler).handleResponseTemplate();
    final String templateName = templateNameForHandlerMethod("handleResponseTemplate");
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate(templateName);
View Full Code Here

    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate(templateName);
  }

  @Test
  public void testHandleResponseTemplateWithAnnotation() {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplateWithAnnotation", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(handler).handleResponseTemplateWithAnnotation();
    final String templateName = templateNameForHandlerMethod("handleResponseTemplateWithAnnotation");
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate(templateName);
View Full Code Here

    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate(templateName);
  }

  @Test
  public void testHandleResponseTemplateWithCustomName() throws SecurityException, NoSuchMethodException {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplateWithCustomName", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-template.html");
  }
View Full Code Here

    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-template.html");
  }

  @Test
  public void testCustomReturnedTemplate() throws SecurityException, NoSuchMethodException {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplateWithReturnValue", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-returned-template.html");
  }
View Full Code Here

    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-returned-template.html");
  }

  @Test
  public void testCustomReturnedTemplateOverride() throws SecurityException, NoSuchMethodException {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplateWithReturnValueOverride", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-returned-template.html");
  }
View Full Code Here

    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("custom-returned-template.html");
  }

  @Test
  public void testCustomReturnedTemplateDefault() throws SecurityException, NoSuchMethodException {
    final Runtime runtime = createRuntime();
    handleGet("/handleResponseTemplateWithReturnValueDefault", new MockWebScriptRequest().format("html").runtime(runtime),
        new MockWebScriptResponse().writer(new StringWriter()));
    verify(getTemplateProcessor(runtime), atLeastOnce()).hasTemplate("default-template.html");
  }
View Full Code Here

    when(ftlTemplateProcessor.hasTemplate(anyString())).thenReturn(true);
    final TemplateProcessorRegistry templateProcessorRegistry = new TemplateProcessorRegistry();
    templateProcessorRegistry.registerTemplateProcessor(ftlTemplateProcessor, "ftl", "Freemarker");
    final Container container = mock(Container.class);
    when(container.getTemplateProcessorRegistry()).thenReturn(templateProcessorRegistry);
    final Runtime runtime = mock(Runtime.class);
    when(runtime.getContainer()).thenReturn(container);
    return runtime;
  }
View Full Code Here

TOP

Related Classes of org.springframework.extensions.webscripts.Runtime

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.