@Test(
      groups = {"wso2.am"},
      description =
          "Test the API with endpoint security enabled with simple password"
              + " that only has characters and numbers")
  public void testInvokeGETResourceWithSecuredEndPointPasswordOnlyNumbersAndLetters()
      throws Exception {
    String endpointUsername = "******";
    char[] endpointPassword = {'a', 'd', 'm', 'i', 'n', '1', '2', '3'};
    byte[] userNamePasswordByteArray =
        (endpointUsername + ":" + String.valueOf(endpointPassword)).getBytes();
    String encodedUserNamePassword = DatatypeConverter.printBase64Binary(userNamePasswordByteArray);

    APICreationRequestBean apiCreationRequestBean =
        new APICreationRequestBean(
            API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl));
    apiCreationRequestBean.setTags(API_TAGS);
    apiCreationRequestBean.setDescription(API_DESCRIPTION);
    apiCreationRequestBean.setEndpointType("secured");
    apiCreationRequestBean.setEpUsername(endpointUsername);
    apiCreationRequestBean.setEpPassword(String.valueOf(endpointPassword));
    apiCreationRequestBean.setTier(TIER_UNLIMITED);
    apiCreationRequestBean.setTiersCollection(TIER_UNLIMITED);
    APIIdentifier apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION_1_0_0);
    apiIdentifier.setTier(TIER_UNLIMITED);
    createPublishAndSubscribeToAPI(
        apiIdentifier,
        apiCreationRequestBean,
        apiPublisherClientUser1,
        apiStoreClientUser1,
        APPLICATION_NAME);
    waitForAPIDeploymentSync(
        user.getUserName(), API_NAME, API_VERSION_1_0_0, APIMIntegrationConstants.IS_API_EXISTS);

    String accessToken =
        generateApplicationKeys(apiStoreClientUser1, APPLICATION_NAME).getAccessToken();
    requestHeadersGet.put("Authorization", "Bearer " + accessToken);
    HttpResponse httpResponseGet =
        HttpRequestUtil.doGet(
            getAPIInvocationURLHttp(API_CONTEXT, API_VERSION_1_0_0) + "/sec", requestHeadersGet);
    assertEquals(
        httpResponseGet.getResponseCode(),
        HTTP_RESPONSE_CODE_OK,
        "Invocation fails for GET request for "
            + "endpoint type secured. username:"******" password:"******"Response Data not match for GET"
            + " request for endpoint type secured. Expected value :"
            + encodedUserNamePassword
            + " not contains in "
            + "response data:"
            + httpResponseGet.getData()
            + "username:"******" password:"
            + String.valueOf(endpointPassword));
  }
  @Test(
      groups = {"wso2.am"},
      dataProvider = "SymbolCharacters",
      description = "Test the API with endpoint security" + " enabled with complex password",
      dependsOnMethods = "testInvokeGETResourceWithSecuredEndPointPasswordOnlyNumbersAndLetters")
  public void testInvokeGETResourceWithSecuredEndPointComplexPassword(String symbolicCharacter)
      throws Exception {

    String endpointUsername = "******";
    char[] endpointPassword = {
      'a', 'b', 'c', 'd', symbolicCharacter.charAt(0), 'e', 'f', 'g', 'h', 'i', 'j', 'k'
    };
    byte[] userNamePasswordByteArray =
        (endpointUsername + ":" + String.valueOf(endpointPassword)).getBytes();
    String encodedUserNamePassword = DatatypeConverter.printBase64Binary(userNamePasswordByteArray);
    APICreationRequestBean apiCreationRequestBean =
        new APICreationRequestBean(
            API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl));
    apiCreationRequestBean.setTags(API_TAGS);
    apiCreationRequestBean.setDescription(API_DESCRIPTION);
    apiCreationRequestBean.setVisibility("public");
    apiCreationRequestBean.setEndpointType("secured");
    apiCreationRequestBean.setEpUsername(endpointUsername);
    apiCreationRequestBean.setEpPassword(
        URLEncoder.encode(String.valueOf(endpointPassword), "UTF-8"));
    // Update API with Edited information
    HttpResponse updateAPIHTTPResponse = apiPublisherClientUser1.updateAPI(apiCreationRequestBean);
    assertEquals(
        updateAPIHTTPResponse.getResponseCode(),
        HTTP_RESPONSE_CODE_OK,
        "Update APi with new Resource " + "information fail");
    assertEquals(
        updateAPIHTTPResponse.getData(),
        "{\"error\" : false}",
        "Update APi with new Resource information fail");
    // Send GET request

    waitForAPIDeploymentSync(
        user.getUserName(), API_NAME, API_VERSION_1_0_0, encodedUserNamePassword);

    HttpResponse httpResponseGet =
        HttpRequestUtil.doGet(
            getAPIInvocationURLHttp(API_CONTEXT, API_VERSION_1_0_0) + "/sec", requestHeadersGet);
    assertEquals(
        httpResponseGet.getResponseCode(),
        HTTP_RESPONSE_CODE_OK,
        "Invocation fails for GET request for "
            + "endpoint type secured. username:"******" password:"******"Response Data not match for GET"
            + " request for endpoint type secured. Expected value : "
            + encodedUserNamePassword
            + " not contains in "
            + "response data: "
            + httpResponseGet.getData()
            + " username:"******" password:"
            + String.valueOf(endpointPassword));
  }