use of org.alfresco.service.namespace.QNamePattern in project alfresco-repository by Alfresco.
the class VirtualNodeServiceExtensionTest method testGetChildAssocs_2.
@Test
public void testGetChildAssocs_2() throws Exception {
// semi-virtual folder with 2 virtual folder nodes
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(virtualFolder1NodeRef);
assertEquals(2, childAssocs.size());
setUpTestAssociations(virtualFolder1NodeRef);
NodeRef node2 = nodeService.getChildByName(virtualFolder1NodeRef, ContentModel.ASSOC_CONTAINS, "Node2");
NodeRef node2_1 = nodeService.getChildByName(node2, ContentModel.ASSOC_CONTAINS, "Node2_1");
childAssocs = nodeService.getChildAssocs(node2, ContentModel.ASSOC_ARCHIVED_LINK, ContentModel.ASSOC_ARCHIVED_LINK, 7, true);
assertTrue(childAssocs.isEmpty());
childAssocs = nodeService.getChildAssocs(node2, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, 7, true);
assertEquals(2, childAssocs.size());
assertAssocNames(childAssocs, copyOf(node2ChildrenQNames, 2));
childAssocs = nodeService.getChildAssocs(virtualFolder1NodeRef, RegexQNamePattern.MATCH_ALL, new QNamePattern() {
@Override
public boolean isMatch(QName qname) {
return qname.getLocalName().startsWith("test") && qname.getLocalName().endsWith("txt");
}
}, 15, true);
assertEquals(11, childAssocs.size());
// reference child
if (logger.isDebugEnabled()) {
logger.debug("Getting children of node2 " + node2);
}
childAssocs = nodeService.getChildAssocs(node2, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, 2, true);
if (logger.isDebugEnabled()) {
logger.debug("Got children of node2 " + childAssocs);
}
assertEquals(2, childAssocs.size());
// one virtual folder with a virtual node reference child
childAssocs = nodeService.getChildAssocs(node2_1, RegexQNamePattern.MATCH_ALL, RegexQNamePattern.MATCH_ALL, 10, true);
assertEquals(10, childAssocs.size());
assertAssocNames(childAssocs, copyOf(node2_1ChildrenQNames, 10));
}
use of org.alfresco.service.namespace.QNamePattern in project alfresco-repository by Alfresco.
the class ThumbnailServiceImplTest method checkRenditioned.
private void checkRenditioned(NodeRef contentNodeRef, List<ExpectedAssoc> expectedAssocs) {
assertTrue("Renditioned aspect should have been applied", this.secureNodeService.hasAspect(contentNodeRef, RenditionModel.ASPECT_RENDITIONED));
for (ExpectedAssoc expectedAssoc : expectedAssocs) {
QNamePattern qNamePattern = expectedAssoc.getAssocName() != null ? QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, expectedAssoc.getAssocName()) : null;
List<ChildAssociationRef> assocs = this.secureNodeService.getChildAssocs(contentNodeRef, expectedAssoc.getAssocTypeQName(), qNamePattern);
assertNotNull(assocs);
assertEquals(expectedAssoc + " association count mismatch", expectedAssoc.getCount(), assocs.size());
}
}
Aggregations