Merged BRANCHES/DEV/V4.0-BUG-FIX to HEAD

37628: Build Fix


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37696 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2012-06-12 18:49:03 +00:00
parent d7432dcc64
commit 6b19ff80b0

View File

@@ -819,6 +819,10 @@ public class SOLRTrackingComponentTest extends TestCase
{ {
expectedNumMetaDataNodes++; expectedNumMetaDataNodes++;
} }
if(nodeStatus == NodeStatus.DELETED)
{
expectedNumMetaDataNodes++;
}
if(doChecks) if(doChecks)
{ {
@@ -885,113 +889,117 @@ public class SOLRTrackingComponentTest extends TestCase
Long nodeId = nodeMetaData.getNodeId(); Long nodeId = nodeMetaData.getNodeId();
NodeRef nodeRef = nodeMetaData.getNodeRef(); NodeRef nodeRef = nodeMetaData.getNodeRef();
Set<QName> aspects = nodeMetaData.getAspects(); if(nodeService.exists(nodeRef))
Set<QName> actualAspects = nodeService.getAspects(nodeRef);
assertEquals("Aspects are incorrect", actualAspects, aspects);
Map<QName, Serializable> properties = nodeMetaData.getProperties();
// NodeService converts properties so use nodeDAO to get unadulterated property value
Map<QName, Serializable> actualProperties = filterResudualProperties(nodeDAO.getNodeProperties(nodeId));
//assertTrue("Properties are incorrect", compareProperties(actualProperties, properties));
assertEquals("Properties are incorrect", actualProperties, properties);
NodeAssertions assertions = getNodeAssertions(nodeRef);
// NodeAssertions assertions = nodes.get(nodeRef);
Set<QName> expectedAspects = assertions.getAspects();
if(expectedAspects != null)
{ {
for(QName aspect : expectedAspects)
Set<QName> aspects = nodeMetaData.getAspects();
Set<QName> actualAspects = nodeService.getAspects(nodeRef);
assertEquals("Aspects are incorrect", actualAspects, aspects);
Map<QName, Serializable> properties = nodeMetaData.getProperties();
// NodeService converts properties so use nodeDAO to get unadulterated property value
Map<QName, Serializable> actualProperties = filterResudualProperties(nodeDAO.getNodeProperties(nodeId));
//assertTrue("Properties are incorrect", compareProperties(actualProperties, properties));
assertEquals("Properties are incorrect", actualProperties, properties);
NodeAssertions assertions = getNodeAssertions(nodeRef);
// NodeAssertions assertions = nodes.get(nodeRef);
Set<QName> expectedAspects = assertions.getAspects();
if(expectedAspects != null)
{ {
assertTrue("Expected aspect" + aspect, aspects.contains(aspect)); for(QName aspect : expectedAspects)
{
assertTrue("Expected aspect" + aspect, aspects.contains(aspect));
}
} }
}
Map<QName, Serializable> expectedProperties = assertions.getProperties(); Map<QName, Serializable> expectedProperties = assertions.getProperties();
if(expectedProperties != null) if(expectedProperties != null)
{
for(QName propName : expectedProperties.keySet())
{ {
Serializable expectedPropValue = expectedProperties.get(propName); for(QName propName : expectedProperties.keySet())
Serializable actualPropValue = properties.get(propName); {
assertNotNull("Missing property " + propName, actualPropValue); Serializable expectedPropValue = expectedProperties.get(propName);
assertEquals("Incorrect property value", expectedPropValue, actualPropValue); Serializable actualPropValue = properties.get(propName);
assertNotNull("Missing property " + propName, actualPropValue);
assertEquals("Incorrect property value", expectedPropValue, actualPropValue);
}
} }
}
// TODO complete path tests // TODO complete path tests
// List<Path> actualPaths = nodeMetaData.getPaths(); // List<Path> actualPaths = nodeMetaData.getPaths();
// List<Path> expectedPaths = nodeService.getPaths(nodeRef, false); // List<Path> expectedPaths = nodeService.getPaths(nodeRef, false);
// assertEquals("Paths are incorrect", expectedPaths, actualPaths); // assertEquals("Paths are incorrect", expectedPaths, actualPaths);
boolean expectAspects = assertions.isExpectAspects(); boolean expectAspects = assertions.isExpectAspects();
if(expectAspects && nodeMetaData.getAspects() == null) if(expectAspects && nodeMetaData.getAspects() == null)
{ {
fail("Expecting aspects but got no aspects"); fail("Expecting aspects but got no aspects");
} }
else if(!expectAspects && nodeMetaData.getAspects() != null) else if(!expectAspects && nodeMetaData.getAspects() != null)
{ {
fail("Not expecting aspects but got aspects"); fail("Not expecting aspects but got aspects");
} }
boolean expectProperties = assertions.isExpectProperties(); boolean expectProperties = assertions.isExpectProperties();
if(expectProperties && nodeMetaData.getProperties() == null) if(expectProperties && nodeMetaData.getProperties() == null)
{ {
fail("Expecting properties but got no properties"); fail("Expecting properties but got no properties");
} }
else if(!expectProperties && nodeMetaData.getProperties() != null) else if(!expectProperties && nodeMetaData.getProperties() != null)
{ {
fail("Not expecting properties but got properties"); fail("Not expecting properties but got properties");
} }
boolean expectType = assertions.isExpectType(); boolean expectType = assertions.isExpectType();
if(expectType && nodeMetaData.getNodeType() == null) if(expectType && nodeMetaData.getNodeType() == null)
{ {
fail("Expecting type but got no type"); fail("Expecting type but got no type");
} }
else if(!expectType && nodeMetaData.getNodeType() != null) else if(!expectType && nodeMetaData.getNodeType() != null)
{ {
fail("Not expecting type but got type"); fail("Not expecting type but got type");
} }
boolean expectAclId = assertions.isExpectAclId(); boolean expectAclId = assertions.isExpectAclId();
if(expectAclId && nodeMetaData.getAclId() == null) if(expectAclId && nodeMetaData.getAclId() == null)
{ {
fail("Expecting acl id but got no acl id"); fail("Expecting acl id but got no acl id");
} }
else if(!expectAclId && nodeMetaData.getAclId() != null) else if(!expectAclId && nodeMetaData.getAclId() != null)
{ {
fail("Not expecting acl id but got acl id"); fail("Not expecting acl id but got acl id");
} }
boolean expectPaths = assertions.isExpectPaths(); boolean expectPaths = assertions.isExpectPaths();
if(expectPaths && nodeMetaData.getPaths() == null) if(expectPaths && nodeMetaData.getPaths() == null)
{ {
fail("Expecting paths but got no paths"); fail("Expecting paths but got no paths");
} }
else if(!expectPaths && nodeMetaData.getPaths() != null) else if(!expectPaths && nodeMetaData.getPaths() != null)
{ {
fail("Not expecting paths but got paths"); fail("Not expecting paths but got paths");
} }
boolean expectAssociations = assertions.isExpectAssociations(); boolean expectAssociations = assertions.isExpectAssociations();
if(expectAssociations && nodeMetaData.getChildAssocs() == null) if(expectAssociations && nodeMetaData.getChildAssocs() == null)
{ {
fail("Expecting associations but got no associations"); fail("Expecting associations but got no associations");
} }
else if(!expectAssociations && nodeMetaData.getChildAssocs() != null) else if(!expectAssociations && nodeMetaData.getChildAssocs() != null)
{ {
fail("Not expecting associations but got associations"); fail("Not expecting associations but got associations");
} }
boolean expectOwner = assertions.isExpectOwner(); boolean expectOwner = assertions.isExpectOwner();
if(expectOwner && nodeMetaData.getOwner() == null) if(expectOwner && nodeMetaData.getOwner() == null)
{ {
fail("Expecting owner but got no owner"); fail("Expecting owner but got no owner");
} }
else if(!expectOwner && nodeMetaData.getOwner() != null) else if(!expectOwner && nodeMetaData.getOwner() != null)
{ {
fail("Not expecting owner but got owner"); fail("Not expecting owner but got owner");
}
} }
} }