Examples of TestHttpServletRequest


Examples of com.squareup.rack.servlet.TestHttpServletRequest

  @Before public void setUp() {
    IRubyObject callable = Ruby.getGlobalRuntime()
        .evalScriptlet("proc { |env| [200, {'Content-Type' => 'text/plain'}, env.keys] }");

    RackEnvironmentBuilder envBuilder = new RackEnvironmentBuilder();
    TestHttpServletRequest request = TestHttpServletRequest.newBuilder().build();
    app = new JRubyRackApplication(callable);
    env = envBuilder.build(request);
  }
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

   public void testValidWebAuthorization() throws Exception
   {
      //Create a ContextMap
      Map<String,Object> contextMap = new HashMap<String,Object>()
     
      HttpServletRequest request = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
     
      RoleGroup roleGroup = SecurityTestUtil.getRoleGroup(new String[]{"roleA", "roleC"});
     
      //Add good roles to the context
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

   public void testInvalidWebAuthorization() throws Exception
   {
    //Create a ContextMap
      Map<String,Object> contextMap = new HashMap<String,Object>()
     
      HttpServletRequest request = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
     
      RoleGroup roleGroup = SecurityTestUtil.getRoleGroup(new String[]{"Villain"});
     
      //Add good roles to the context
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

   {
      Map<String,Object> moduleOptions = SecurityTestUtil.getWebDelegateOptions();
      ApplicationPolicy ap = SecurityTestUtil.getApplicationPolicy("test", moduleOptions);
      SecurityTestUtil.setUpRegularConfiguration(ap);
     
      HttpServletRequest hsr = new TestHttpServletRequest(new SimplePrincipal("someprincipal"),
            "/someuri", "GET");
      //Create a ContextMap
      Map<String,Object> cmap = new HashMap<String,Object>()
      webResource = new WebResource(cmap);
      webResource.setServletRequest(hsr);
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      WebResource er = getResource(policyRegistration);
      er.setPolicyContextID(this.contextID);
     
      er.setServletRequest(new TestHttpServletRequest(p, uri, "GET"));
      assertEquals(AuthorizationContext.PERMIT,
            pc.authorize(er, getSubject(), getRoleGroup()));
     
      Principal principal = new SimplePrincipal("Notjduke");
      HttpServletRequest hsr = new TestHttpServletRequest(principal, uri, "GET");
      //Now change the ejb principal
      er.setServletRequest(hsr);
      assertEquals(AuthorizationContext.DENY,
            pc.authorize(er, getSubject(), getRoleGroup()));
   }
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

      registerPolicy(policyRegistration);
      WebResource er = getResource(policyRegistration);
      er.setPolicyContextID(this.contextID);
     
      Principal principal = new SimplePrincipal("Notjduke");
      HttpServletRequest hsr = new TestHttpServletRequest(principal, uri, "GET");
      //Now change the ejb principal
      er.setServletRequest(hsr);
      assertEquals(AuthorizationContext.DENY,
            pc.authorize(er, getSubject(), getRoleGroup()));
   }
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

   }

   @SuppressWarnings("unchecked")
   public HttpServletRequest getHttpServletRequest(String username, String pass)
   {
      HttpServletRequest hsr = new TestHttpServletRequest(new SimplePrincipal(username), pass, "GET");
      hsr.getParameterMap().put("j_username", username);
      hsr.getParameterMap().put("j_password", pass);
      return hsr;
   }
View Full Code Here

Examples of org.jboss.test.util.TestHttpServletRequest

  
   public void testAuthorization() throws Exception
   {
      HashMap<String,Object> cmap = new HashMap<String,Object>();
      WebResource wr = new WebResource(cmap);
      wr.setServletRequest(new TestHttpServletRequest(p,"test", "get"));
      AuthorizationManager am = new JBossAuthorizationManager("other");
      am.authorize(wr);//This should just pass as the default module PERMITS all
   }
View Full Code Here

Examples of org.jbpm.designer.helper.TestHttpServletRequest

        DictionaryServlet dictionaryServlet = new DictionaryServlet();
        dictionaryServlet.setProfile(profile);

        dictionaryServlet.init(new TestServletConfig(new TestServletContext(repository)));
        TestHttpServletResponse response = new  TestHttpServletResponse();
        dictionaryServlet.doPost(new TestHttpServletRequest(params), response);

        String responseText = new String(response.getContent());
        assertNotNull(responseText);
        assertEquals("saved", responseText);
View Full Code Here

Examples of org.jbpm.designer.helper.TestHttpServletRequest

        DictionaryServlet dictionaryServlet = new DictionaryServlet();
        dictionaryServlet.setProfile(profile);

        dictionaryServlet.init(new TestServletConfig(new TestServletContext(repository)));
        TestHttpServletResponse response = new  TestHttpServletResponse();
        dictionaryServlet.doPost(new TestHttpServletRequest(params), response);

        String dictionaryContent = new String(response.getContent());
        assertNotNull(dictionaryContent);
        assertEquals("test dictionary content", dictionaryContent);
    }
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.