@Test public void shouldCreateToken() throws CoreTokenException, ErrorResultException { Token token = new Token("badger", TokenType.SESSION); adapter.create(token); verify(mockLDAPAdapter).create(any(Connection.class), eq(token)); }
public void create(Token token) throws CoreTokenException { Connection connection = null; try { connection = connectionFactory.getConnection(); ldapAdapter.create(connection, token); if (debug.messageEnabled()) { debug.message(MessageFormat.format( CoreTokenConstants.DEBUG_HEADER + "Create: Created {0} Token {1}\n" + "{2}", token.getType(), token.getTokenId(), token)); } } catch (ErrorResultException e) { throw new CreateFailedException(token, e); } finally { IOUtils.closeIfNotNull(connection); } }
CoreTokenAdapter { public void create(Token token) throws CoreTokenException { Connection connection = null; try { connection = connectionFactory.getConnection(); ldapAdapter.create(connection, token); if (debug.messageEnabled()) { debug.message(MessageFormat.format( CoreTokenConstants.DEBUG_HEADER + "Create: Created {0} Token {1}\n" + "{2}", token.getType(), token.getTokenId(), token)); } } catch (ErrorResultException e) { throw new CreateFailedException(token, e); } finally { IOUtils.closeIfNotNull(connection); } } }
CoreTokenAdapter { public void create(Token token) throws CoreTokenException { Connection connection = null; try { connection = connectionFactory.getConnection(); ldapAdapter.create(connection, token); if (debug.messageEnabled()) { debug.message(MessageFormat.format( CoreTokenConstants.DEBUG_HEADER + "Create: Created {0} Token {1}\n" + "{2}", token.getType(), token.getTokenId(), token)); } } catch (ErrorResultException e) { throw new CreateFailedException(token, e); } finally { IOUtils.closeIfNotNull(connection); } } @Inject  CoreTokenAdapter(ConnectionFactory connectionFactory, QueryFactory queryFactory,
                            LDAPAdapter ldapAdapter, ConfigurationObserver observer,
                            CoreTokenConfigListener listener, @Named(CoreTokenConstants.CTS_DEBUG) Debug debug); }
CoreTokenAdapter { public void create(Token token) throws CoreTokenException { Connection connection = null; try { connection = connectionFactory.getConnection(); ldapAdapter.create(connection, token); if (debug.messageEnabled()) { debug.message(MessageFormat.format( CoreTokenConstants.DEBUG_HEADER + "Create: Created {0} Token {1}\n" + "{2}", token.getType(), token.getTokenId(), token)); } } catch (ErrorResultException e) { throw new CreateFailedException(token, e); } finally { IOUtils.closeIfNotNull(connection); } } @Inject  CoreTokenAdapter(ConnectionFactory connectionFactory, QueryFactory queryFactory,
                            LDAPAdapter ldapAdapter, ConfigurationObserver observer,
                            CoreTokenConfigListener listener, @Named(CoreTokenConstants.CTS_DEBUG) Debug debug); void create(Token token); Token read(String tokenId); QueryBuilder query(); QueryFilter buildFilter(); void updateOrCreate(Token token); void delete(String tokenId); }
CoreTokenAdapter { public void create(Token token) throws CoreTokenException { Connection connection = null; try { connection = connectionFactory.getConnection(); ldapAdapter.create(connection, token); if (debug.messageEnabled()) { debug.message(MessageFormat.format( CoreTokenConstants.DEBUG_HEADER + "Create: Created {0} Token {1}\n" + "{2}", token.getType(), token.getTokenId(), token)); } } catch (ErrorResultException e) { throw new CreateFailedException(token, e); } finally { IOUtils.closeIfNotNull(connection); } } @Inject  CoreTokenAdapter(ConnectionFactory connectionFactory, QueryFactory queryFactory,
                            LDAPAdapter ldapAdapter, ConfigurationObserver observer,
                            CoreTokenConfigListener listener, @Named(CoreTokenConstants.CTS_DEBUG) Debug debug); void create(Token token); Token read(String tokenId); QueryBuilder query(); QueryFilter buildFilter(); void updateOrCreate(Token token); void delete(String tokenId);  }