HHH-12357 - NamingHelper uses system default encoding

Fix failing tests on SAP HANA
This commit is contained in:
Jonathan Bregler 2018-03-26 13:44:34 +02:00 committed by Vlad Mihalcea
parent c863d12fd2
commit 1915ba780f
3 changed files with 43 additions and 9 deletions

View File

@ -40,11 +40,11 @@ import static org.junit.Assert.assertEquals;
@TestForIssue( jiraKey = "HHH-12357" )
public abstract class AbstractCharsetNamingStrategyTest extends BaseUnitTestCase {
private ServiceRegistry serviceRegistry;
protected ServiceRegistry serviceRegistry;
@Before
public void setUp() {
Map properties = new HashMap( Environment.getProperties() );
Map<Object, Object> properties = new HashMap<>( Environment.getProperties() );
properties.put( AvailableSettings.HBM2DDL_CHARSET_NAME, charsetName() );
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( properties );
}

View File

@ -8,6 +8,9 @@
// $Id$
package org.hibernate.test.annotations.namingstrategy.charset;
import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
/**
* @author Vlad Mihalcea
*/
@ -20,16 +23,31 @@ public class Iso88591CharsetNamingStrategyTest extends AbstractCharsetNamingStra
@Override
protected String expectedUniqueKeyName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "UK38xspy14r49kkcmmyltias1j4"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "UKq2jxex2hrvg4139p85npyj71g";
}
}
@Override
protected String expectedForeignKeyName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "FKdvmx00nr88d03v6xhrjyujrq2"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "FKdeqq4y6cesc2yfgi97u2hp61g";
}
}
@Override
protected String expectedIndexName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "IDX38xspy14r49kkcmmyltias1j4"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "IDXq2jxex2hrvg4139p85npyj71g";
}
}
}

View File

@ -8,7 +8,8 @@
// $Id$
package org.hibernate.test.annotations.namingstrategy.charset;
import org.hibernate.testing.TestForIssue;
import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
/**
* @author Vlad Mihalcea
@ -22,16 +23,31 @@ public class Utf8CharsetNamingStrategyTest extends AbstractCharsetNamingStrategy
@Override
protected String expectedUniqueKeyName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "UKinnacp0woeltj5l0k4vgabf8k"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "UKpm66tdjkgtsca5x2uwux487t5";
}
}
@Override
protected String expectedForeignKeyName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "FKe1lr9dd16cmmon53r7m736yev"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "FKgvrnki5fwp3qo0hfp1bu1jj0q";
}
}
@Override
protected String expectedIndexName() {
if ( this.serviceRegistry.getService( JdbcServices.class ).getDialect() instanceof AbstractHANADialect ) {
return "IDXinnacp0woeltj5l0k4vgabf8k"; // Non-ASCII, non-alphanumeric identifiers are quoted on HANA
}
else {
return "IDXpm66tdjkgtsca5x2uwux487t5";
}
}
}