Example #1
0
  @Test(
      groups = {"wso2.greg"},
      description = "Metadata search by Updater Name pattern matching",
      dependsOnMethods = "searchResourceByUpdaterNot")
  public void searchResourceByUpdaterNamePattern()
      throws SearchAdminServiceRegistryExceptionException, RemoteException, RegistryException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setUpdater("adm%");
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminServiceClient.getAdvancedSearchResults(searchQuery);
    Assert.assertNotNull(result.getResourceDataList(), "No Record Found");
    Assert.assertTrue(
        (result.getResourceDataList().length > 0),
        "No Record Found. set valid Updater name pattern");
    for (ResourceData resourceData : result.getResourceDataList()) {
      Resource resource = registry.get(resourceData.getResourcePath());
      Assert.assertTrue(
          (resource.getLastUpdaterUserName().startsWith("adm")),
          "search word pattern not contain on Updater Name :" + resourceData.getResourcePath());
    }
  }
Example #2
0
  @Test(
      groups = {"wso2.greg"},
      description = "Metadata search by available Updater Name not",
      dependsOnMethods = "searchResourceByUpdater")
  public void searchResourceByUpdaterNot()
      throws SearchAdminServiceRegistryExceptionException, RemoteException, RegistryException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setUpdater(userName);
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);

    // to set updatedRangeNegate
    ArrayOfString updaterNameNegate = new ArrayOfString();
    updaterNameNegate.setArray(new String[] {"updaterNameNegate", "on"});

    searchQuery.addParameterValues(updaterNameNegate);

    AdvancedSearchResultsBean result =
        searchAdminServiceClient.getAdvancedSearchResults(searchQuery);
    Assert.assertNotNull(result.getResourceDataList(), "No Record Found");
    Assert.assertTrue(
        (result.getResourceDataList().length > 0), "No Record Found. set valid Updater name");
    for (ResourceData resource : result.getResourceDataList()) {
      Resource regResource = registry.get(resource.getResourcePath());
      if (regResource.getProperty("registry.link") == null) {
        Assert.assertFalse(
            regResource.getLastUpdaterUserName().contains(userName),
            "searched updater name not contain on actual Updater Name :"
                + resource.getResourcePath());
      }
    }
  }
Example #3
0
  @Test(
      groups = {"wso2.greg"},
      description = "Metadata search by unavailable Updater Name",
      dependsOnMethods = "searchResourceByUpdaterNamePattern")
  public void searchResourceByUnAvailableUpdaterName()
      throws SearchAdminServiceRegistryExceptionException, RemoteException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setUpdater("xyz1234");
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminServiceClient.getAdvancedSearchResults(searchQuery);
    Assert.assertNull(result.getResourceDataList(), "Result Object found");
  }
Example #4
0
  @Test(
      dataProvider = "invalidCharacter",
      groups = {"wso2.greg"},
      dataProviderClass = Parameters.class,
      description = "Metadata search by Updater Name with invalid characters",
      dependsOnMethods = "searchResourceByUnAvailableUpdaterName")
  public void searchResourceByUpdaterNameWithInvalidCharacter(String invalidInput)
      throws SearchAdminServiceRegistryExceptionException, RemoteException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();

    paramBean.setUpdater(invalidInput);
    ArrayOfString[] paramList = paramBean.getParameterList();
    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result = null;
    try {
      result = searchAdminServiceClient.getAdvancedSearchResults(searchQuery);
    } finally {
      Assert.assertTrue(result.getErrorMessage().contains("illegal characters"), "Wrong exception");
    }
  }
Example #5
0
  @Test(
      groups = {"wso2.greg"},
      description = "Metadata search by available Updater Name")
  public void searchResourceByUpdater()
      throws SearchAdminServiceRegistryExceptionException, RemoteException, RegistryException {
    CustomSearchParameterBean searchQuery = new CustomSearchParameterBean();
    SearchParameterBean paramBean = new SearchParameterBean();
    paramBean.setUpdater(userName);
    ArrayOfString[] paramList = paramBean.getParameterList();

    searchQuery.setParameterValues(paramList);
    AdvancedSearchResultsBean result =
        searchAdminServiceClient.getAdvancedSearchResults(searchQuery);
    Assert.assertNotNull(result.getResourceDataList(), "No Record Found");
    Assert.assertTrue(
        (result.getResourceDataList().length > 0), "No Record Found. set valid updater name");
    for (ResourceData resource : result.getResourceDataList()) {
      Assert.assertTrue(
          registry.get(resource.getResourcePath()).getLastUpdaterUserName().contains(userName),
          "search word not contain on Updater Name :" + resource.getResourcePath());
    }
  }