Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.Credentials


  @After
  public void cleanup() throws Exception {
    H.tearDown();

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");

    if (testFolderUrl != null) {
      //remove the test user if it exists.
      String postUrl = testFolderUrl;
      List<NameValuePair> postParams = new ArrayList<NameValuePair>();
View Full Code Here


    testUserId = H.createTestUser();

    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
View Full Code Here

    testUserId = H.createTestUser();

    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
View Full Code Here

    //1. verify user can update thier own properties
    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
    //user can update their own properties
    assertEquals(true, jsonObj.getBoolean("canUpdateProperties"));
   
   
    //2. now try another user
    testUserId2 = H.createTestUser();

    //fetch the JSON for the test page to verify the settings.
    Credentials testUser2Creds = new UsernamePasswordCredentials(testUserId2, "testPwd");

    String json2 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json2);
    JSONObject jsonObj2 = new JSONObject(json2);
   
View Full Code Here

    //1. Verify non admin user can not update group properties
    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/group/" + testGroupId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
View Full Code Here

    //1. verify user can not remove themselves
    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
    //user can not remove themselves
    assertEquals(false, jsonObj.getBoolean("canRemove"));
   
   
    //2. now try another user
    testUserId2 = H.createTestUser();

    //fetch the JSON for the test page to verify the settings.
    Credentials testUser2Creds = new UsernamePasswordCredentials(testUserId2, "testPwd");

    String json2 = H.getAuthenticatedContent(testUser2Creds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json2);
    JSONObject jsonObj2 = new JSONObject(json2);
   
View Full Code Here

    //1. Verify non admin user can not remove group
    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/group/" + testGroupId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
View Full Code Here

    //1. Verify non admin user can not update group membership
    String getUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/group/" + testGroupId + ".privileges-info.json";

    //fetch the JSON for the test page to verify the settings.
    Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");

    String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
    assertNotNull(json);
    JSONObject jsonObj = new JSONObject(json);
   
View Full Code Here

 
  @Override
  public void tearDown() throws Exception {
    super.tearDown();

    Credentials creds = new UsernamePasswordCredentials("admin", "admin");

    if (testFolderUrl != null) {
      //remove the test user if it exists.
      String postUrl = testFolderUrl;
      List<NameValuePair> postParams = new ArrayList<NameValuePair>();
View Full Code Here

    List<NameValuePair> postParams = new ArrayList<NameValuePair>();
    postParams.add(new NameValuePair("principalId", testUserId));
    postParams.add(new NameValuePair("privilege@jcr:read", "granted"));
    postParams.add(new NameValuePair("privilege@jcr:write", "denied"));
   
    Credentials creds = new UsernamePasswordCredentials("admin", "admin");
    assertAuthenticatedPostStatus(creds, postUrl, HttpServletResponse.SC_OK, postParams, null);

    if (addGroupAce) {
      testGroupId = createTestGroup();
     
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.Credentials

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.