@Test @Ignore public void testFindByUsername() { mongoOperations.dropCollection(User.class); userService.save(new UserInfo("found", "securepw", Collections.<RoleInfo>emptySet(), new AddressInfo("", "", "", "", "", "", "", "", 0, 0))); UserInfo userInfo = userService.findByUsername("found"); assertNotNull(userInfo); UserInfo notFound = userService.findByUsername("not-found"); assertNull(notFound); }
@Override public UserInfo findByUsername(String username) { User user = userRepository.findByUsername(username); return (user != null) ? getDozerMapper().map(user, UserInfo.class) : null; }
UserServiceImpl extends AbstractServiceImpl<UserInfo, User> implements UserService { @Override public UserInfo findByUsername(String username) { User user = userRepository.findByUsername(username); return (user != null) ? getDozerMapper().map(user, UserInfo.class) : null; } }
UserServiceImpl extends AbstractServiceImpl<UserInfo, User> implements UserService { @Override public UserInfo findByUsername(String username) { User user = userRepository.findByUsername(username); return (user != null) ? getDozerMapper().map(user, UserInfo.class) : null; } @Autowired  UserServiceImpl(@Qualifier("userRepository") UserRepository repository,
                           @Qualifier("dozerMapper") Mapper dozerMapper,
                           @Qualifier("userPasswordEncoder") ShaPasswordEncoder passwordEncoder); }
UserServiceImpl extends AbstractServiceImpl<UserInfo, User> implements UserService { @Override public UserInfo findByUsername(String username) { User user = userRepository.findByUsername(username); return (user != null) ? getDozerMapper().map(user, UserInfo.class) : null; } @Autowired  UserServiceImpl(@Qualifier("userRepository") UserRepository repository,
                           @Qualifier("dozerMapper") Mapper dozerMapper,
                           @Qualifier("userPasswordEncoder") ShaPasswordEncoder passwordEncoder); @Override UserInfo findById(ObjectId userId); @Override UserInfo findByUsername(String username); @Override boolean existsUserWithEmail(String email); @Override List<UserInfo> findAll(); @Override void save(UserInfo userInfo); }
UserServiceImpl extends AbstractServiceImpl<UserInfo, User> implements UserService { @Override public UserInfo findByUsername(String username) { User user = userRepository.findByUsername(username); return (user != null) ? getDozerMapper().map(user, UserInfo.class) : null; } @Autowired  UserServiceImpl(@Qualifier("userRepository") UserRepository repository,
                           @Qualifier("dozerMapper") Mapper dozerMapper,
                           @Qualifier("userPasswordEncoder") ShaPasswordEncoder passwordEncoder); @Override UserInfo findById(ObjectId userId); @Override UserInfo findByUsername(String username); @Override boolean existsUserWithEmail(String email); @Override List<UserInfo> findAll(); @Override void save(UserInfo userInfo);  }