Advertisement
Guest User

Switchyard testing

a guest
Jan 21st, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.38 KB | None | 0 0
  1. public interface CommonDao<T> {
  2.  
  3.     public abstract T getEntityById(String entityId);
  4.  
  5.     public abstract void save(T object);
  6.  
  7.     public abstract void deleteEntityById(String entityId);
  8.  
  9. }
  10.  
  11. public interface LogService<T> extends CommonDao<T>{
  12.  
  13.     public void save(T item);
  14.  
  15.     public T getEntityById(String id);
  16.  
  17.     public List<T> getRecentActivity(String user);
  18.  
  19.     public void deleteEntityById(String entityId);
  20.  
  21.     public List<T> getActivityList(ActivityLogQueryParams params);
  22.  
  23. }
  24.  
  25. @RunWith(SwitchYardRunner.class)
  26. @SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
  27. public class LogServiceTest {
  28.  
  29.     @ServiceOperation("LogService")
  30.     private Invoker logService;
  31.  
  32.     @Test
  33.     public void testSaveRuleActivity() throws Exception {
  34.         RuleActivity expectedRuleActivity = new RuleActivity(new Date(), "user123", Application.RH, Category.Rules,
  35.                 "strategy123", "rule123", RuleAction.Created);
  36.         logService.operation("save").sendInOnly(expectedRuleActivity);
  37.  
  38.         RuleActivity actualRuleActivity = logService.operation("getEntityById").sendInOut(expectedRuleActivity.getId())
  39.                 .getContent(RuleActivity.class);
  40.         Assert.assertEquals(expectedRuleActivity, actualRuleActivity);
  41.  
  42.         logService.operation("deleteEntityById").sendInOnly(expectedRuleActivity.getId());
  43.         Assert.assertNull(logService.operation("getEntityById").sendInOut(expectedRuleActivity.getId()).getContent());
  44.     }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement