modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java
| 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 0d6dcd43a16699348430e81a241ae38da6d431af
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu May 23 17:14:50 2013 -0400
Fix test that started failing after the change to remove JOIN FETCH
from Criteria calls that include paging and optional data. It seems the
new approach changes slightly the way the data is returned.
loadDefinition() returns hibernate proxied data. It is not safe to pass
proxies into equals() impls because these typically access fields directly,
not through getters, and therefore bypass the proxied data.
Note that this change in behavior due to the JOIN FETCH fix would only
affect non-client code (like test code or intra-slsb calls) because return
values to client code would already be cleansed of the proxies. The test
is fixed in the same way, by using HibernateDetachUtility to scrub the
proxies before attempting the assertEquals().
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java
index 18c7093..4202d6a 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/drift/ManageDriftDefinitionsTest.java
@@ -57,6 +57,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
+import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
import org.rhq.enterprise.server.test.TransactionCallback;
import org.rhq.test.AssertUtils;
@@ -91,7 +92,7 @@ public class ManageDriftDefinitionsTest extends AbstractDriftServerTest
{
deleteEntity(ResourceType.class, DRIFT_NOT_SUPPORTED_TYPE);
}
- public void createDefinitionFromUnpinnedTemplate() {
+ public void createDefinitionFromUnpinnedTemplate() throws Exception {
// first create a template
final DriftDefinition templateDef = new DriftDefinition(new Configuration());
templateDef.setName(NAME_PREFIX + "createUnpinnedDefinition");
@@ -114,6 +115,7 @@ public class ManageDriftDefinitionsTest extends
AbstractDriftServerTest {
DriftDefinitionComparator comparator = new DriftDefinitionComparator(
BOTH_BASE_INFO_AND_DIRECTORY_SPECIFICATIONS);
+ HibernateDetachUtility.nullOutUninitializedFields(newDef,
SerializationType.SERIALIZATION);
assertEquals("The drift definition was not persisted correctly", 0,
comparator.compare(definition, newDef));
assertEquals("The template association was not set on the definition",
template, newDef.getTemplate());
}
Show replies by date