@Test(expected = PrincipalPopulationException.class) public void testExecuteFailNullResult() { context.checking(new Expectations() { { allowing(personMapper).fetchUniqueResult(openSocialId); will(returnValue(null)); oneOf(getPersonModelViewByAccountIdMapper).execute(openSocialId); will(returnValue(null)); } }); Principal result = sut.execute(openSocialId); context.assertIsSatisfied(); }
@Override public Principal execute(final String inOpenSocialId) { PersonModelView user = null; try { user = personMapper.fetchUniqueResult(inOpenSocialId); } catch (Exception e) { logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId); throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId, e); } if (user == null) { logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid"); try { user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId); } catch (Exception e) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } if (user == null) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } } return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId()); }
OpenSocialPrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inOpenSocialId) { PersonModelView user = null; try { user = personMapper.fetchUniqueResult(inOpenSocialId); } catch (Exception e) { logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId); throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId, e); } if (user == null) { logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid"); try { user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId); } catch (Exception e) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } if (user == null) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } } return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId()); } }
OpenSocialPrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inOpenSocialId) { PersonModelView user = null; try { user = personMapper.fetchUniqueResult(inOpenSocialId); } catch (Exception e) { logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId); throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId, e); } if (user == null) { logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid"); try { user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId); } catch (Exception e) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } if (user == null) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } } return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId()); } OpenSocialPrincipalDao(final GetPeopleByOpenSocialIds inPersonMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper); }
OpenSocialPrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inOpenSocialId) { PersonModelView user = null; try { user = personMapper.fetchUniqueResult(inOpenSocialId); } catch (Exception e) { logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId); throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId, e); } if (user == null) { logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid"); try { user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId); } catch (Exception e) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } if (user == null) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } } return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId()); } OpenSocialPrincipalDao(final GetPeopleByOpenSocialIds inPersonMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper); @Override Principal execute(final String inOpenSocialId); }
OpenSocialPrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inOpenSocialId) { PersonModelView user = null; try { user = personMapper.fetchUniqueResult(inOpenSocialId); } catch (Exception e) { logger.error("Unable to populate principal for OpenSocialId: " + inOpenSocialId); throw new PrincipalPopulationException("Unable to populate principal for OpenSocialId: " + inOpenSocialId, e); } if (user == null) { logger.error("Unable to find principal for OpenSocialId: " + inOpenSocialId + " attempting ntid"); try { user = getPersonModelViewByAccountIdMapper.execute(inOpenSocialId); } catch (Exception e) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } if (user == null) { throw new PrincipalPopulationException("Unable to find principal for OpenSocialId: " + inOpenSocialId); } } return new DefaultPrincipal(user.getAccountId(), user.getOpenSocialId(), user.getEntityId()); } OpenSocialPrincipalDao(final GetPeopleByOpenSocialIds inPersonMapper,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper); @Override Principal execute(final String inOpenSocialId);  }