@Test(
      priority = 1,
      groups = {"wso2.greg"},
      description = "Metadata search by available Property Name")
  public void searchResourceByPropertyName()
      throws SearchAdminServiceRegistryExceptionException, RemoteException, RegistryException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setPropertyName("x");
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminService.getAdvancedSearchResults(sessionCookie, searchQuery);
    Assert.assertNotNull(result.getResourceDataList(), "No Record Found");
    Assert.assertTrue(
        (result.getResourceDataList().length > 0), "No Record Found. set valid property name");

    for (ResourceData resource : result.getResourceDataList()) {
      boolean propertyFound = false;
      Iterator<String> properties =
          (Iterator<String>)
              registry.get(resource.getResourcePath()).getProperties().propertyNames();
      while (properties.hasNext()) {
        if (properties.next().contains("x")) {
          propertyFound = true;
        }
      }
      Assert.assertTrue(
          propertyFound, "Property name not found on Resource " + resource.getResourcePath());
    }
  }
  @Test(
      priority = 4,
      groups = {"wso2.greg"},
      description = "Metadata search by unavailable PropertyName")
  public void searchResourceByUnAvailablePropertyName()
      throws SearchAdminServiceRegistryExceptionException, RemoteException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setPropertyName("xyz1234");
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminService.getAdvancedSearchResults(sessionCookie, searchQuery);
    Assert.assertNull(result.getResourceDataList(), "Result Object found");
  }
  @Test(
      priority = 5,
      dataProvider = "invalidCharacter",
      groups = {"wso2.greg"},
      description = "Metadata search by PropertyName with invalid characters")
  public void searchResourceByPropertyNameWithInvalidCharacter(String invalidInput)
      throws SearchAdminServiceRegistryExceptionException, RemoteException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();

    paramBean.setPropertyName(invalidInput);
    ArrayOfString[] paramList = paramBean.getParameterList();
    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminService.getAdvancedSearchResults(sessionCookie, searchQuery);
    Assert.assertNull(result.getResourceDataList(), "Result Object found.");
  }