@Test public void testExecute() { context.checking(new Expectations() { { allowing(actionContext).getParams(); will(returnValue(request)); allowing(actionContext).getPrincipal(); will(returnValue(principal)); allowing(principal).getId(); will(returnValue(1L)); allowing(request).getTabId(); will(returnValue(tabId)); allowing(tabMapper).findById(tabId); will(returnValue(tab)); allowing(request).getTabName(); will(returnValue(tabName)); allowing(tab).setTabName(tabName); allowing(deleteCacheKeysMapper).execute(with(any(Set.class))); allowing(tabMapper).flush(); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Boolean execute(final PrincipalActionContext inActionContext) { RenameTabRequest requestParams = (RenameTabRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(requestParams.getTabId()); tab.setTabName(requestParams.getTabName()); tabMapper.flush(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return Boolean.TRUE; }
RenameTabExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { RenameTabRequest requestParams = (RenameTabRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(requestParams.getTabId()); tab.setTabName(requestParams.getTabName()); tabMapper.flush(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return Boolean.TRUE; } }
RenameTabExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { RenameTabRequest requestParams = (RenameTabRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(requestParams.getTabId()); tab.setTabName(requestParams.getTabName()); tabMapper.flush(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return Boolean.TRUE; } RenameTabExecution(final TabMapper mapper, final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); }
RenameTabExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { RenameTabRequest requestParams = (RenameTabRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(requestParams.getTabId()); tab.setTabName(requestParams.getTabName()); tabMapper.flush(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return Boolean.TRUE; } RenameTabExecution(final TabMapper mapper, final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Boolean execute(final PrincipalActionContext inActionContext); }
RenameTabExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Boolean execute(final PrincipalActionContext inActionContext) { RenameTabRequest requestParams = (RenameTabRequest) inActionContext.getParams(); Tab tab = tabMapper.findById(requestParams.getTabId()); tab.setTabName(requestParams.getTabName()); tabMapper.flush(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + inActionContext.getPrincipal().getId())); return Boolean.TRUE; } RenameTabExecution(final TabMapper mapper, final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); @Override Boolean execute(final PrincipalActionContext inActionContext);  }