HHH-6744 : Skip MultiPathCircleCascadeTest.testMergeEntityWithNonNullableTransientEntity() when CHECK_NULLABILITY is false and sequence/increment generator is used

This commit is contained in:
Gail Badner 2011-10-18 17:05:54 -07:00
parent 35a8543818
commit 7e1752cfb3
3 changed files with 18 additions and 33 deletions

View File

@ -23,13 +23,8 @@
*/
package org.hibernate.test.cascade.circle;
import org.junit.Test;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.testing.SkipForDialect;
/**
* @author Gail Badner
@ -40,11 +35,4 @@ public class MultiPathCircleCascadeCheckNullibilityFalseTest extends MultiPathCi
super.configure( cfg );
cfg.setProperty( Environment.CHECK_NULLABILITY, "false" );
}
@Override
@SkipForDialect(value = { Oracle10gDialect.class, PostgreSQLDialect.class }, comment = "This test is known to fail for dialects using a sequence for the native generator. See HHH-6744")
@Test
public void testMergeEntityWithNonNullableTransientEntity() {
super.testMergeEntityWithNonNullableTransientEntity();
}
}

View File

@ -23,12 +23,6 @@
*/
package org.hibernate.test.cascade.circle;
import org.hibernate.JDBCException;
import org.hibernate.PropertyValueException;
import org.hibernate.TransientObjectException;
import static org.junit.Assert.assertTrue;
/**
* @author Gail Badner
*/
@ -39,19 +33,4 @@ public class MultiPathCircleCascadeDelayedInsertTest extends MultiPathCircleCasc
"cascade/circle/MultiPathCircleCascadeDelayedInsert.hbm.xml"
};
}
@Override
protected void checkExceptionFromNullValueForNonNullable(Exception ex, boolean checkNullability, boolean isNullValue ) {
if ( checkNullability ) {
if ( isNullValue ) {
assertTrue( ex instanceof PropertyValueException );
}
else {
assertTrue( ex instanceof TransientObjectException );
}
}
else {
assertTrue( ex instanceof JDBCException || ex instanceof TransientObjectException );
}
}
}

View File

@ -35,6 +35,10 @@ import org.hibernate.engine.spi.SessionImplementor;
import org.junit.Test;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.IncrementGenerator;
import org.hibernate.id.SequenceGenerator;
import org.hibernate.testing.SkipLog;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.junit.Assert.assertEquals;
@ -90,6 +94,20 @@ public class MultiPathCircleCascadeTest extends BaseCoreFunctionalTestCase {
@Test
public void testMergeEntityWithNonNullableTransientEntity() {
// Skip if CHECK_NULLABILITY is false and route ID is a sequence or incrment generator (see HHH-6744)
IdentifierGenerator routeIdentifierGenerator = sessionFactory().getEntityPersister( Route.class.getName() ).getIdentifierGenerator();
if ( ! sessionFactory().getSettings().isCheckNullability() &&
( SequenceGenerator.class.isInstance( routeIdentifierGenerator) ||
IncrementGenerator.class.isInstance( routeIdentifierGenerator ) )
) {
SkipLog.reportSkip(
"delayed-insert without checking nullability",
"delayed-insert without checking nullability is known to fail when dirty-checking; see HHH-6744"
);
return;
}
Route route = getUpdatedDetachedEntity();
Node node = (Node) route.getNodes().iterator().next();