From 198a88294281a055db65aafa256ab539c1a3046e Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Thu, 19 Jan 2006 16:02:11 +0000 Subject: [PATCH] Broke up tests that were testing failure modes and then trying to test success modes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2151 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/node/BaseNodeServiceTest.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java b/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java index d3ab0d1a24..97b8ee1c4a 100644 --- a/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java +++ b/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java @@ -159,7 +159,14 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest @Override protected void onTearDownInTransaction() throws Exception { - authenticationComponent.clearCurrentSecurityContext(); + try + { + authenticationComponent.clearCurrentSecurityContext(); + } + catch (Throwable e) + { + // do nothing + } super.onTearDownInTransaction(); } @@ -707,7 +714,7 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest return count; } - public void testAddChild() throws Exception + public void testAddBogusChild() throws Exception { // create a bogus reference NodeRef bogusChildRef = new NodeRef(rootNodeRef.getStoreRef(), "BOGUS"); @@ -720,6 +727,10 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest { // expected } + } + + public void testAddChild() throws Exception + { NodeRef childNodeRef = nodeService.createNode( rootNodeRef, ASSOC_TYPE_QNAME_TEST_CHILDREN, @@ -1115,7 +1126,7 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest return assocRef; } - public void testCreateAndRemoveAssociation() throws Exception + public void testAssociationToIncorrectNodeType() throws Exception { AssociationRef assocRef = createAssociation(); NodeRef sourceRef = assocRef.getSourceRef(); @@ -1131,6 +1142,14 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest { // expected } + } + + public void testDuplicateAssociationDetection() throws Exception + { + AssociationRef assocRef = createAssociation(); + NodeRef sourceRef = assocRef.getSourceRef(); + NodeRef targetRef = assocRef.getTargetRef(); + QName qname = assocRef.getTypeQName(); try { // attempt repeat @@ -1141,6 +1160,12 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest { // expected } + } + + public void testCreateAndRemoveAssociation() throws Exception + { + AssociationRef assocRef = createAssociation(); + NodeRef sourceRef = assocRef.getSourceRef(); // create another Map properties = new HashMap(5);