Java 类org.hibernate.engine.jdbc.env.spi.IdentifierHelper 实例源码

项目:bootstrap    文件:ImplicitNamingStrategyNiceJpaImplTest.java   
private void mockContext(final ImplicitNameSource source) {
    final MetadataBuildingContext context = Mockito.mock(MetadataBuildingContext.class);
    final InFlightMetadataCollector collector = Mockito.mock(InFlightMetadataCollector.class);
    final Database database = Mockito.mock(Database.class);
    final JdbcEnvironment jdbcEnvironment = Mockito.mock(JdbcEnvironment.class);
    final IdentifierHelper identifierHelper = Mockito.mock(IdentifierHelper.class);
    Mockito.when(identifierHelper.toIdentifier(ArgumentMatchers.anyString())).then(new Answer<Identifier>() {

        @Override
        public Identifier answer(final InvocationOnMock invocation) {
            return DatabaseIdentifier.toIdentifier((String)invocation.getArguments()[0]) ;
        }
    });
    Mockito.when(jdbcEnvironment.getIdentifierHelper()).thenReturn(identifierHelper);
    Mockito.when(database.getJdbcEnvironment()).thenReturn(jdbcEnvironment);
    Mockito.when(collector.getDatabase()).thenReturn(database);
    Mockito.when(context.getMetadataCollector()).thenReturn(collector);
    Mockito.when(source.getBuildingContext()).thenReturn(context);
}
项目:bootstrap    文件:SequenceIdentifierGeneratorStrategyProviderTest.java   
private JdbcEnvironment newJdbcEnvironment() {

        JdbcEnvironment jdbcEnvironment = Mockito.mock(JdbcEnvironment.class);
        IdentifierHelper identifierHelper = Mockito.mock(IdentifierHelper.class);
        Mockito.when(identifierHelper.toIdentifier(ArgumentMatchers.anyString())).then(new Answer<Identifier>() {

            @Override
            public Identifier answer(InvocationOnMock invocation) {
                if (invocation.getArguments()[0] == null)
                    return null;
                return new Identifier((String) invocation.getArguments()[0], false);
            }
        });
        Mockito.when(jdbcEnvironment.getIdentifierHelper()).thenReturn(identifierHelper);
        return jdbcEnvironment;
    }
项目:spanner-hibernate    文件:CloudSpannerDialect.java   
@Override
public IdentifierHelper buildIdentifierHelper(IdentifierHelperBuilder builder, DatabaseMetaData dbMetaData)
        throws SQLException
{
    // only override this method in order to be able to access the database
    // metadata
    this.metadata = dbMetaData;
    return super.buildIdentifierHelper(builder, dbMetaData);
}
项目:org.fastnate    文件:AllowMissingIdentitySupportDialect.java   
@Override
public IdentifierHelper buildIdentifierHelper(final IdentifierHelperBuilder builder,
        final DatabaseMetaData dbMetaData) throws SQLException {
    return this.wrapped.buildIdentifierHelper(builder, dbMetaData);
}