Added AttributeService to ServiceRegistry.

Test for correctness of Attribute deletetion.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5521 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-04-20 19:04:50 +00:00
parent 5401499003
commit 37e81b9ea4
3 changed files with 67 additions and 0 deletions

View File

@@ -227,4 +227,53 @@ public class AttributeServiceTest extends TestCase
fail(); fail();
} }
} }
public void testDelete()
{
try
{
// Put some attributes in place.
MapAttribute map = new MapAttributeValue();
map.put("a", new StringAttributeValue("a"));
map.put("b", new StringAttributeValue("b"));
map.put("c", new StringAttributeValue("c"));
map.put("d", new StringAttributeValue("d"));
map.put("e", new StringAttributeValue("e"));
map.put("f", new StringAttributeValue("f"));
map.put("g", new StringAttributeValue("g"));
map.put("h", new StringAttributeValue("h"));
map.put("i", new StringAttributeValue("i"));
map.put("j", new StringAttributeValue("j"));
map.put("k", new StringAttributeValue("k"));
map.put("l", new StringAttributeValue("l"));
map.put("m", new StringAttributeValue("m"));
map.put("n", new StringAttributeValue("n"));
map.put("o", new StringAttributeValue("o"));
map.put("p", new StringAttributeValue("p"));
map.put("q", new StringAttributeValue("q"));
map.put("r", new StringAttributeValue("r"));
map.put("s", new StringAttributeValue("s"));
map.put("t", new StringAttributeValue("t"));
map.put("u", new StringAttributeValue("u"));
map.put("v", new StringAttributeValue("v"));
map.put("w", new StringAttributeValue("w"));
map.put("x", new StringAttributeValue("x"));
map.put("y", new StringAttributeValue("y"));
map.put("z", new StringAttributeValue("z"));
fService.setAttribute("", "map", map);
fService.setAttribute("map", "submap", map);
fService.setAttribute("map/submap", "subsubmap", map);
assertEquals(27, fService.getKeys("map").size());
assertEquals(27, fService.getKeys("map/submap").size());
fService.removeAttribute("map/submap/subsubmap", "b");
assertEquals(25, fService.getKeys("map/submap/subsubmap").size());
fService.removeAttribute("map/submap", "subsubmap");
assertEquals(26, fService.getKeys("map/submap").size());
}
catch (Exception e)
{
e.printStackTrace();
}
}
} }

View File

@@ -28,6 +28,7 @@ import java.util.Collection;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.attributes.AttributeService;
import org.alfresco.service.cmr.audit.AuditService; import org.alfresco.service.cmr.audit.AuditService;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.avmsync.AVMSyncService;
@@ -352,4 +353,12 @@ public class ServiceDescriptorRegistry
{ {
return (CrossRepositoryCopyService)getService(CROSS_REPO_COPY_SERVICE); return (CrossRepositoryCopyService)getService(CROSS_REPO_COPY_SERVICE);
} }
/* (non-Javadoc)
* @see org.alfresco.service.ServiceRegistry#getAttributeService()
*/
public AttributeService getAttributeService()
{
return (AttributeService)getService(ATTRIBUTE_SERVICE);
}
} }

View File

@@ -27,6 +27,7 @@ package org.alfresco.service;
import java.util.Collection; import java.util.Collection;
import org.alfresco.service.cmr.action.ActionService; import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.attributes.AttributeService;
import org.alfresco.service.cmr.audit.AuditService; import org.alfresco.service.cmr.audit.AuditService;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.cmr.avmsync.AVMSyncService;
@@ -104,6 +105,7 @@ public interface ServiceRegistry
static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService"); static final QName AVM_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMService");
static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService"); static final QName AVM_SYNC_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AVMSyncService");
static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService"); static final QName CROSS_REPO_COPY_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "CrossRepositoryCopyService");
static final QName ATTRIBUTE_SERVICE = QName.createQName(NamespaceService.ALFRESCO_URI, "AttributeService");
/** /**
* Get the list of services provided by the Repository * Get the list of services provided by the Repository
@@ -315,4 +317,11 @@ public interface ServiceRegistry
*/ */
@NotAuditable @NotAuditable
CrossRepositoryCopyService getCrossRepositoryCopyService(); CrossRepositoryCopyService getCrossRepositoryCopyService();
/**
* Get the attribute service (or null if one is not provided)
* @return
*/
@NotAuditable
AttributeService getAttributeService();
} }