コード例 #1
0
 @Test(
     groups = "wso2.das",
     description = "Range operations",
     dependsOnMethods = "paginationSearch")
 public void range() throws Exception {
   RecordBean[] byRange =
       webServiceClient.getByRange(
           TABLE1.replace('.', '_'), new String[] {"uuid"}, 0, System.currentTimeMillis(), 0, 200);
   Assert.assertNotNull(byRange, "Returns null array");
   Assert.assertEquals(byRange.length, 100, "Not contains 100 records");
   List<String> recordIds = new ArrayList<>(100);
   for (RecordBean recordBean : byRange) {
     recordIds.add(recordBean.getId());
   }
   RecordBean[] byId =
       webServiceClient.getById(
           TABLE1.replace('.', '_'), new String[] {"uuid"}, recordIds.toArray(new String[100]));
   Assert.assertNotNull(byId, "Returns null array");
   Assert.assertEquals(byId.length, 100, "Not contains 100 records");
   webServiceClient.deleteByIds(TABLE1.replace('.', '_'), recordIds.toArray(new String[100]));
   Thread.sleep(40000);
   byRange =
       webServiceClient.getByRange(
           TABLE1.replace('.', '_'), new String[] {"uuid"}, 0, System.currentTimeMillis(), 0, 200);
   Assert.assertNull(byRange, "Returns not null array");
 }
コード例 #2
0
 @Test(groups = "wso2.das", description = "Pagination search", dependsOnMethods = "getRecordCount")
 public void paginationSearch() throws Exception {
   if (webServiceClient.isPaginationSupported(TABLE1.replace('.', '_'))) {
     Set<String> ids = new HashSet<>(100);
     long time = System.currentTimeMillis();
     for (int i = 0; i < 4; i++) {
       RecordBean[] byRange =
           webServiceClient.getByRange(
               TABLE1.replace('.', '_'), new String[] {"uuid"}, 0, time, i * 25, 25);
       Assert.assertEquals(byRange.length, 25, "Pagination result count is wrong");
       for (RecordBean recordBean : byRange) {
         ids.add(recordBean.getId());
       }
     }
     Assert.assertEquals(ids.size(), 100, "Doesn't contain all the records doing the pagination");
   }
 }