@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());
    }
  }
Exemple #2
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());
    }
  }
Exemple #3
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());
      }
    }
  }
  @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");
  }
Exemple #5
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");
  }
  @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.");
  }
Exemple #7
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");
    }
  }
Exemple #8
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());
    }
  }