@Test public void testNullPmv() { context.checking(new Expectations() { { oneOf(getPersonMVByAccountId).execute("accountId"); will(returnValue(null)); oneOf(serviceActionController).execute(with(any(ServiceActionContext.class)), with(any(TaskHandlerServiceAction.class))); will(returnValue(personMock)); oneOf(personMock).getAccountId(); will(returnValue("accountId")); oneOf(personMock).getOpenSocialId(); will(returnValue("osid")); oneOf(personMock).getId(); will(returnValue(5L)); } }); assertNotNull(sut.execute("accountId")); context.assertIsSatisfied(); }
@Override public Principal execute(final String inAccountId) { DefaultPrincipal result = null; try { PersonModelView pmv = getPersonMVByAccountId.execute(inAccountId); if (pmv != null) { result = new DefaultPrincipal(pmv.getAccountId(), pmv.getOpenSocialId(), pmv.getId()); } else { logger.info("Unable to populate principal from cache/db, looking up user in LDAP for: " + inAccountId); Person person = (Person) serviceActionController.execute(new ServiceActionContext(inAccountId, null), createUserfromLdapAction); result = new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()); } } catch (Exception ex) { logger.info("Unable to populate principal from DataStore for: " + inAccountId, ex); } return result; }
DataStorePrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inAccountId) { DefaultPrincipal result = null; try { PersonModelView pmv = getPersonMVByAccountId.execute(inAccountId); if (pmv != null) { result = new DefaultPrincipal(pmv.getAccountId(), pmv.getOpenSocialId(), pmv.getId()); } else { logger.info("Unable to populate principal from cache/db, looking up user in LDAP for: " + inAccountId); Person person = (Person) serviceActionController.execute(new ServiceActionContext(inAccountId, null), createUserfromLdapAction); result = new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()); } } catch (Exception ex) { logger.info("Unable to populate principal from DataStore for: " + inAccountId, ex); } return result; } }
DataStorePrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inAccountId) { DefaultPrincipal result = null; try { PersonModelView pmv = getPersonMVByAccountId.execute(inAccountId); if (pmv != null) { result = new DefaultPrincipal(pmv.getAccountId(), pmv.getOpenSocialId(), pmv.getId()); } else { logger.info("Unable to populate principal from cache/db, looking up user in LDAP for: " + inAccountId); Person person = (Person) serviceActionController.execute(new ServiceActionContext(inAccountId, null), createUserfromLdapAction); result = new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()); } } catch (Exception ex) { logger.info("Unable to populate principal from DataStore for: " + inAccountId, ex); } return result; } DataStorePrincipalDao(final DomainMapper<String, PersonModelView> inGetPersonMVByAccountId,
            final ActionController inServiceActionController, final TaskHandlerServiceAction inCreateUserfromLdapAction); }
DataStorePrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inAccountId) { DefaultPrincipal result = null; try { PersonModelView pmv = getPersonMVByAccountId.execute(inAccountId); if (pmv != null) { result = new DefaultPrincipal(pmv.getAccountId(), pmv.getOpenSocialId(), pmv.getId()); } else { logger.info("Unable to populate principal from cache/db, looking up user in LDAP for: " + inAccountId); Person person = (Person) serviceActionController.execute(new ServiceActionContext(inAccountId, null), createUserfromLdapAction); result = new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()); } } catch (Exception ex) { logger.info("Unable to populate principal from DataStore for: " + inAccountId, ex); } return result; } DataStorePrincipalDao(final DomainMapper<String, PersonModelView> inGetPersonMVByAccountId,
            final ActionController inServiceActionController, final TaskHandlerServiceAction inCreateUserfromLdapAction); @Override Principal execute(final String inAccountId); }
DataStorePrincipalDao implements DomainMapper<String, Principal> { @Override public Principal execute(final String inAccountId) { DefaultPrincipal result = null; try { PersonModelView pmv = getPersonMVByAccountId.execute(inAccountId); if (pmv != null) { result = new DefaultPrincipal(pmv.getAccountId(), pmv.getOpenSocialId(), pmv.getId()); } else { logger.info("Unable to populate principal from cache/db, looking up user in LDAP for: " + inAccountId); Person person = (Person) serviceActionController.execute(new ServiceActionContext(inAccountId, null), createUserfromLdapAction); result = new DefaultPrincipal(person.getAccountId(), person.getOpenSocialId(), person.getId()); } } catch (Exception ex) { logger.info("Unable to populate principal from DataStore for: " + inAccountId, ex); } return result; } DataStorePrincipalDao(final DomainMapper<String, PersonModelView> inGetPersonMVByAccountId,
            final ActionController inServiceActionController, final TaskHandlerServiceAction inCreateUserfromLdapAction); @Override Principal execute(final String inAccountId);  }