Package org.soybeanMilk.web

Examples of org.soybeanMilk.web.WebObjectSource


  }

  @Test
  public void execute_forwardTarget() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    webExecutor.execute("exe0", os);
   
    Assert.assertEquals("url.jsp", ((MockHttpServletResponse)os.getResponse()).getForwardedUrl());
  }
View Full Code Here


  }
 
  @Test
  public void execute_redirectTarget() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    webExecutor.execute("exe1", os);
   
    Assert.assertEquals("url.jsp", ((MockHttpServletResponse)os.getResponse()).getRedirectedUrl());
  }
View Full Code Here

  }

  @Test
  public void execute_customizedTarget() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    webExecutor.execute("exe2", os);
   
    Assert.assertEquals(JsonTargetHandler.jsonHeader, ((MockHttpServletResponse)os.getResponse()).getContentType());
    Assert.assertNull(((MockHttpServletResponse)os.getResponse()).getRedirectedUrl());
    Assert.assertNull(((MockHttpServletResponse)os.getResponse()).getForwardedUrl());
  }
View Full Code Here

  }
 
  @Test
  public void execute_targetTypeIgnoreCase() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    webExecutor.execute("exe3", os);
   
    Assert.assertEquals("url.jsp", ((MockHttpServletResponse)os.getResponse()).getRedirectedUrl());
  }
View Full Code Here

  }
 
  @Test
  public void execute_restful() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    webExecutor.execute("test/aaa/1/bbb", os);
   
    Assert.assertEquals("aaa", os.getRequest().getAttribute("v0"));
    Assert.assertEquals("bbb", os.getRequest().getAttribute("v1"));
    Assert.assertEquals("test/aaa/1/bbb.jsp", ((MockHttpServletResponse)os.getResponse()).getForwardedUrl());
  }
View Full Code Here

  }
 
  @Test
  public void execute_resolverClass_typeVariable() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    MockHttpServletRequest request=(MockHttpServletRequest)os.getRequest();
   
    String id="my id";
    String name="my name";
   
    request.setParameter("typeVariable.id", id);
    request.setParameter("typeVariable.name", name);
   
    webExecutor.execute("typeVariableTest", os);
   
    TestBeanSub result=os.get("request.testResult");
   
    Assert.assertEquals(result.getId(), id);
    Assert.assertEquals(result.getName(), name);
  }
View Full Code Here

  }
 
  @Test
  public void execute_resolverClass_genericArray() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    MockHttpServletRequest request=(MockHttpServletRequest)os.getRequest();
   
    String[] id={"id-0", "id-1","id-2"};
    String[] name={"name-0", "name-1", "name-2"};
   
    request.setParameter("genericArray.id", id);
    request.setParameter("genericArray.name", name);
   
    webExecutor.execute("genericArrayTest", os);
   
    TestBeanSub[] result=os.get("request.testResult");
   
    Assert.assertEquals(id.length, result.length);
   
    for(int i=0; i<result.length; i++)
    {
View Full Code Here

  }
 
  @Test
  public void execute_resolverClass_parameterizedType() throws Exception
  {
    WebObjectSource os=createWebObjectSource();
    MockHttpServletRequest request=(MockHttpServletRequest)os.getRequest();
   
    String[] id={"id-0", "id-1","id-2"};
    String[] name={"name-0", "name-1", "name-2"};
   
    request.setParameter("parameterizedType.id", id);
    request.setParameter("parameterizedType.name", name);
   
    webExecutor.execute("parameterizedTypeTest", os);
   
    List<TestBeanSub> result=os.get("request.testResult");
   
    Assert.assertEquals(id.length, result.size());
   
    for(int i=0; i<result.size(); i++)
    {
View Full Code Here

  {
    MockHttpServletRequest request=new MockHttpServletRequest();
    MockHttpServletResponse response=new MockHttpServletResponse();
    MockServletContext application=new MockServletContext();
   
    WebObjectSource os=new DefaultWebObjectSource(request, response, application);
   
    return os;
  }
View Full Code Here

    String exeName=getRequestExecutableName(request, response);
   
    if(log.isDebugEnabled())
      log.debug("processing request "+SbmUtils.toString(exeName));
   
    WebObjectSource webObjSource=getWebObjectSourceFactory().create(request, response, getServletContext());
   
    try
    {
      getWebExecutor().execute(exeName, webObjSource);
    }
View Full Code Here

TOP

Related Classes of org.soybeanMilk.web.WebObjectSource

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.