@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()); } }
@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()); } } }