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" ) @TestForIssue( jiraKey = "HHH-12357" )
public abstract class AbstractCharsetNamingStrategyTest extends BaseUnitTestCase { public abstract class AbstractCharsetNamingStrategyTest extends BaseUnitTestCase {
private ServiceRegistry serviceRegistry; protected ServiceRegistry serviceRegistry;
@Before @Before
public void setUp() { public void setUp() {
Map properties = new HashMap( Environment.getProperties() ); Map<Object, Object> properties = new HashMap<>( Environment.getProperties() );
properties.put( AvailableSettings.HBM2DDL_CHARSET_NAME, charsetName() ); properties.put( AvailableSettings.HBM2DDL_CHARSET_NAME, charsetName() );
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( properties ); serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( properties );
} }

View File

@ -8,6 +8,9 @@
// $Id$ // $Id$
package org.hibernate.test.annotations.namingstrategy.charset; package org.hibernate.test.annotations.namingstrategy.charset;
import org.hibernate.dialect.AbstractHANADialect;
import org.hibernate.engine.jdbc.spi.JdbcServices;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea
*/ */
@ -20,16 +23,31 @@ public class Iso88591CharsetNamingStrategyTest extends AbstractCharsetNamingStra
@Override @Override
protected String expectedUniqueKeyName() { 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"; return "UKq2jxex2hrvg4139p85npyj71g";
} }
}
@Override @Override
protected String expectedForeignKeyName() { 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"; return "FKdeqq4y6cesc2yfgi97u2hp61g";
} }
}
@Override @Override
protected String expectedIndexName() { 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"; return "IDXq2jxex2hrvg4139p85npyj71g";
} }
} }
}

View File

@ -8,7 +8,8 @@
// $Id$ // $Id$
package org.hibernate.test.annotations.namingstrategy.charset; 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 * @author Vlad Mihalcea
@ -22,16 +23,31 @@ public class Utf8CharsetNamingStrategyTest extends AbstractCharsetNamingStrategy
@Override @Override
protected String expectedUniqueKeyName() { 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"; return "UKpm66tdjkgtsca5x2uwux487t5";
} }
}
@Override @Override
protected String expectedForeignKeyName() { 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"; return "FKgvrnki5fwp3qo0hfp1bu1jj0q";
} }
}
@Override @Override
protected String expectedIndexName() { 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"; return "IDXpm66tdjkgtsca5x2uwux487t5";
} }
} }
}