@Test public final void testExecuteValidUser() { final List<TabGroup> tabGroups = new ArrayList<TabGroup>(); tabGroups.add(page); context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue("tabName")); oneOf(actionContext).getPrincipal(); will(returnValue(principal)); oneOf(principal).getAccountId(); will(returnValue("userName")); oneOf(personMapper).findByAccountId("userName"); will(returnValue(person)); oneOf(person).addTab(with(any(Tab.class)), with(TabGroupType.START)); allowing(person).getId(); will(returnValue(1L)); one(personMapper).clear(); oneOf(personMapper).flush(); oneOf(person).getDisplayName(); will(returnValue("userName")); one(tabMapper).findById(with(any(long.class))); will(returnValue(tab)); allowing(deleteCacheKeysMapper).execute(with(any(Set.class))); } }); Tab actual = null; try { actual = (Tab) sut.execute(actionContext); } catch (Exception e) { fail("Caught an exception"); } assertSame(tab, actual); context.assertIsSatisfied(); }
public final Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String tabName = (String) inActionContext.getParams(); Tab tab = new Tab(tabName, Layout.THREECOLUMN); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.addTab(tab, TabGroupType.START); personMapper.flush(); personMapper.clear(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + person.getId())); if (log.isDebugEnabled()) { log.debug("Saved tab for " + person.getDisplayName()); } return tabMapper.findById(tab.getId()); }
AddTabExecution implements ExecutionStrategy<PrincipalActionContext> { public final Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String tabName = (String) inActionContext.getParams(); Tab tab = new Tab(tabName, Layout.THREECOLUMN); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.addTab(tab, TabGroupType.START); personMapper.flush(); personMapper.clear(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + person.getId())); if (log.isDebugEnabled()) { log.debug("Saved tab for " + person.getDisplayName()); } return tabMapper.findById(tab.getId()); } }
AddTabExecution implements ExecutionStrategy<PrincipalActionContext> { public final Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String tabName = (String) inActionContext.getParams(); Tab tab = new Tab(tabName, Layout.THREECOLUMN); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.addTab(tab, TabGroupType.START); personMapper.flush(); personMapper.clear(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + person.getId())); if (log.isDebugEnabled()) { log.debug("Saved tab for " + person.getDisplayName()); } return tabMapper.findById(tab.getId()); } AddTabExecution(final PersonMapper inPersonMapper, final TabMapper inTabMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); }
AddTabExecution implements ExecutionStrategy<PrincipalActionContext> { public final Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String tabName = (String) inActionContext.getParams(); Tab tab = new Tab(tabName, Layout.THREECOLUMN); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.addTab(tab, TabGroupType.START); personMapper.flush(); personMapper.clear(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + person.getId())); if (log.isDebugEnabled()) { log.debug("Saved tab for " + person.getDisplayName()); } return tabMapper.findById(tab.getId()); } AddTabExecution(final PersonMapper inPersonMapper, final TabMapper inTabMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); final Serializable execute(final PrincipalActionContext inActionContext); }
AddTabExecution implements ExecutionStrategy<PrincipalActionContext> { public final Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String tabName = (String) inActionContext.getParams(); Tab tab = new Tab(tabName, Layout.THREECOLUMN); Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.addTab(tab, TabGroupType.START); personMapper.flush(); personMapper.clear(); deleteKeysMapper.execute(Collections.singleton(CacheKeys.PERSON_PAGE_PROPERTIES_BY_ID + person.getId())); if (log.isDebugEnabled()) { log.debug("Saved tab for " + person.getDisplayName()); } return tabMapper.findById(tab.getId()); } AddTabExecution(final PersonMapper inPersonMapper, final TabMapper inTabMapper,
            final DomainMapper<Set<String>, Boolean> inDeleteKeysMapper); final Serializable execute(final PrincipalActionContext inActionContext);  }