HHH-10904 - Fix tests failing when switching to MySQL
This commit is contained in:
parent
5ef1da74c2
commit
0e6230faf0
|
@ -78,7 +78,7 @@ public class QueryWithLiteralsInSelectExpressionTest extends BaseEntityManagerFu
|
||||||
final EntityManager entityManager = getOrCreateEntityManager();
|
final EntityManager entityManager = getOrCreateEntityManager();
|
||||||
try {
|
try {
|
||||||
final List<Object[]> elements = entityManager.createQuery(
|
final List<Object[]> elements = entityManager.createQuery(
|
||||||
"SELECT cast(null as boolean), false, e.name FROM MyEntity e",
|
"SELECT cast(null as char), false, e.name FROM MyEntity e",
|
||||||
Object[].class
|
Object[].class
|
||||||
).getResultList();
|
).getResultList();
|
||||||
Assert.assertEquals( 1, elements.size() );
|
Assert.assertEquals( 1, elements.size() );
|
||||||
|
|
|
@ -13,15 +13,17 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.dialect.MySQL5Dialect;
|
||||||
|
|
||||||
|
import org.hibernate.testing.SkipForDialect;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
|
||||||
import org.hibernate.Session;
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
* @author Piotr Krauzowicz <p.krauzowicz@visiona.pl>
|
* @author Piotr Krauzowicz <p.krauzowicz@visiona.pl>
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
|
@SkipForDialect(value = MySQL5Dialect.class, comment = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||||
public class ByteArrayIdTest extends BaseCoreFunctionalTestCase {
|
public class ByteArrayIdTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,6 +19,9 @@ import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.dialect.MySQL5Dialect;
|
||||||
|
|
||||||
|
import org.hibernate.testing.SkipForDialect;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
|
@ -29,6 +32,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
* @author Piotr Krauzowicz <p.krauzowicz@visiona.pl>
|
* @author Piotr Krauzowicz <p.krauzowicz@visiona.pl>
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
|
@SkipForDialect(value = MySQL5Dialect.class, comment = "BLOB/TEXT column 'id' used in key specification without a key length")
|
||||||
public class PrimitiveByteArrayIdTest extends BaseCoreFunctionalTestCase {
|
public class PrimitiveByteArrayIdTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.schemaupdate;
|
package org.hibernate.test.schemaupdate;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
|
@ -25,12 +25,13 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||||
import org.hibernate.tool.schema.TargetType;
|
import org.hibernate.tool.schema.TargetType;
|
||||||
|
|
||||||
|
import org.hibernate.testing.Skip;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
|
|
||||||
import static org.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
@ -38,7 +39,7 @@ import static org.junit.Assert.assertThat;
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class QuotedTableNameSchemaUpdateTest {
|
public class QuotedTableNameSchemaUpdateTest extends BaseUnitTestCase {
|
||||||
|
|
||||||
private File output;
|
private File output;
|
||||||
private StandardServiceRegistry ssr;
|
private StandardServiceRegistry ssr;
|
||||||
|
@ -59,6 +60,7 @@ public class QuotedTableNameSchemaUpdateTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestForIssue(jiraKey = "HHH-10820")
|
@TestForIssue(jiraKey = "HHH-10820")
|
||||||
|
@Skip(condition = Skip.OperatingSystem.Windows.class, message = "On Windows, MySQL is case insensitive!")
|
||||||
public void testSchemaUpdateWithQuotedTableName() throws Exception {
|
public void testSchemaUpdateWithQuotedTableName() throws Exception {
|
||||||
final MetadataSources metadataSources = new MetadataSources( ssr );
|
final MetadataSources metadataSources = new MetadataSources( ssr );
|
||||||
metadataSources.addAnnotatedClass( QuotedTable.class );
|
metadataSources.addAnnotatedClass( QuotedTable.class );
|
||||||
|
|
|
@ -18,9 +18,11 @@ import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||||
import org.hibernate.tool.schema.TargetType;
|
import org.hibernate.tool.schema.TargetType;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.core.Is.is;
|
import static org.hamcrest.core.Is.is;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
@ -29,7 +31,8 @@ import static org.junit.Assert.assertThat;
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-10373")
|
@TestForIssue(jiraKey = "HHH-10373")
|
||||||
public class IdBagSequenceTest {
|
@RequiresDialectFeature(DialectChecks.SupportsSequences.class)
|
||||||
|
public class IdBagSequenceTest extends BaseUnitTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIdBagSequenceGeneratorIsCreated() throws Exception {
|
public void testIdBagSequenceGeneratorIsCreated() throws Exception {
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
</set>
|
</set>
|
||||||
<map name="tokens" sort="natural" table="search_tokens">
|
<map name="tokens" sort="natural" table="search_tokens">
|
||||||
<key column="searchString"/>
|
<key column="searchString"/>
|
||||||
<map-key column="key" type="string"/>
|
<map-key column="`key`" type="string"/>
|
||||||
<element column="value" type="string"/>
|
<element column="`value`" type="string"/>
|
||||||
</map>
|
</map>
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,19 @@ public @interface Skip {
|
||||||
public boolean isMatch();
|
public boolean isMatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class AlwaysSkip implements Matcher {
|
class AlwaysSkip implements Matcher {
|
||||||
@Override
|
@Override
|
||||||
public boolean isMatch() {
|
public boolean isMatch() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface OperatingSystem {
|
||||||
|
class Windows implements Matcher {
|
||||||
|
@Override
|
||||||
|
public boolean isMatch() {
|
||||||
|
return System.getProperty("os.name").toLowerCase().contains( "windows" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue