Java Code Examples for org.hibernate.engine.jdbc.env.spi.QualifiedObjectNameFormatter

The following examples show how to use org.hibernate.engine.jdbc.env.spi.QualifiedObjectNameFormatter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private static Metadata setupMetadataMock() {
  Metadata metadata = mock(Metadata.class);
  Database database = mock(Database.class);
  JdbcEnvironment jdbcEnvironment = mock(JdbcEnvironment.class);
  QualifiedObjectNameFormatter qualifiedObjectNameFormatter =
      mock(QualifiedObjectNameFormatter.class);

  when(metadata.getDatabase()).thenReturn(database);
  when(database.getJdbcEnvironment()).thenReturn(jdbcEnvironment);
  when(jdbcEnvironment.getQualifiedObjectNameFormatter())
      .thenReturn(qualifiedObjectNameFormatter);
  when(qualifiedObjectNameFormatter.format(any(QualifiedTableName.class), any()))
      .thenAnswer(invocation ->
          ((QualifiedTableName) invocation.getArguments()[0]).getTableName().getCanonicalName());

  return metadata;
}
 
Example 2
@Override @SuppressWarnings("unchecked")
public <R extends Service> R getService(Class<R> serviceRole) {
    if ( serviceRole == VertxInstance.class ) {
        return (R) vertxService;
    }
    else if ( serviceRole == JdbcEnvironment.class ) {
        return (R) new JdbcEnvironment() {
            @Override
            public Dialect getDialect() {
                return new MySQL8Dialect();
            }

            @Override
            public ExtractedDatabaseMetaData getExtractedDatabaseMetaData() {
                return null;
            }

            @Override
            public Identifier getCurrentCatalog() {
                return null;
            }

            @Override
            public Identifier getCurrentSchema() {
                return null;
            }

            @Override
            public QualifiedObjectNameFormatter getQualifiedObjectNameFormatter() {
                return null;
            }

            @Override
            public IdentifierHelper getIdentifierHelper() {
                return null;
            }

            @Override
            public NameQualifierSupport getNameQualifierSupport() {
                return null;
            }

            @Override
            public SqlExceptionHelper getSqlExceptionHelper() {
                return null;
            }

            @Override
            public LobCreatorBuilder getLobCreatorBuilder() {
                return null;
            }

            @Override
            public TypeInfo getTypeInfoForJdbcCode(int jdbcTypeCode) {
                return null;
            }
        };
    }
    else {
        throw new IllegalArgumentException( "This is a mock service - need to explicitly handle any service we might need during testing" );
    }
}
 
Example 3
Source Project: lams   Source File: JdbcEnvironmentImpl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public QualifiedObjectNameFormatter getQualifiedObjectNameFormatter() {
	return qualifiedObjectNameFormatter;
}