コード例 #1
0
 @Test
 public void testLoadRepresentationsAsyncWithIds() {
   List<String> dbIds = new ArrayList<String>();
   DbListener dbl;
   try {
     dbl = new DbListener();
     dbIds.add(mockRepresentationId);
     papi.loadRepresentationsAsync(dbIds, dbl);
     assertEquals(dbl.getResult(), 1);
   } catch (Exception e) {
     fail(e.getMessage());
   }
   try {
     // non-existent id
     dbl = new DbListener();
     dbIds.clear();
     dbIds.add(NonExistentClusterId);
     papi.loadRepresentationsAsync(dbIds, dbl);
     fail();
   } catch (IllegalArgumentException e) {
     assert (true);
   }
   try {
     // wrong input
     dbl = new DbListener();
     dbIds.add(AbcId);
     papi.loadRepresentationsAsync(dbIds, dbl);
     fail();
   } catch (IllegalArgumentException e) {
     assert (true);
   }
 }
コード例 #2
0
 @Test
 public void testLoadRepresentationsAsyncWithConfig() {
   DbFilterConfig conf = new DbFilterConfig();
   conf.addNotation(Constants.NOTATION_BPMN2_0.toString());
   DbListener dbl = new DbListener();
   try {
     papi.loadRepresentationsAsync(conf, dbl);
     assertEquals(dbl.getResult(), 3);
   } catch (Exception e) {
     fail(e.getMessage());
   }
   // no wrong input
 }