mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-3345 e2e REST API TAS tests delete rule (#1256)
* ACS-3345: REST API TAS tests for delete rule. * ACS-3345: REST API TAS tests for delete rule. * ACS-3345: REST API TAS tests for delete rule. * ACS-3345: Fixing the naming. * ACS-3345: REST API TAS tests for delete rule.
This commit is contained in:
@@ -41,6 +41,7 @@ import org.alfresco.rest.api.model.rules.Rule;
|
||||
import org.alfresco.rest.api.model.rules.RuleSet;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.ListPage;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
@@ -183,7 +184,13 @@ public class RulesImpl implements Rules
|
||||
{
|
||||
if (RuleSet.isDefaultId(ruleSetId))
|
||||
{
|
||||
return ruleService.getRuleSetNode(associatedFolderNodeRef);
|
||||
final NodeRef ruleSetNodeRef = ruleService.getRuleSetNode(associatedFolderNodeRef);
|
||||
if (ruleSetNodeRef == null)
|
||||
{
|
||||
//folder doesn't have a -default- rule set
|
||||
throw new RelationshipResourceNotFoundException(associatedFolderNodeRef.getId(), ruleSetId);
|
||||
}
|
||||
return ruleSetNodeRef;
|
||||
}
|
||||
|
||||
final NodeRef ruleSetNodeRef = validateNode(ruleSetId, ContentModel.TYPE_SYSTEM_FOLDER, RULE_SET_EXPECTED_TYPE_NAME);
|
||||
|
@@ -53,6 +53,7 @@ import org.alfresco.rest.api.model.rules.Rule;
|
||||
import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.rest.framework.core.exceptions.RelationshipResourceNotFoundException;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Paging;
|
||||
import org.alfresco.service.Experimental;
|
||||
@@ -196,6 +197,20 @@ public class RulesImplTest extends TestCase
|
||||
then(ruleServiceMock).shouldHaveNoInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRulesForNotExistingDefaultRuleSetNode()
|
||||
{
|
||||
given(nodesMock.nodeMatches(eq(folderNodeRef), any(), any())).willReturn(true);
|
||||
given(ruleServiceMock.getRuleSetNode(folderNodeRef)).willReturn(null);
|
||||
|
||||
// when
|
||||
assertThatExceptionOfType(RelationshipResourceNotFoundException.class).isThrownBy(
|
||||
() -> rules.getRules(FOLDER_NODE_ID, DEFAULT_ID, paging));
|
||||
|
||||
then(ruleServiceMock).should().getRuleSetNode(folderNodeRef);
|
||||
then(ruleServiceMock).shouldHaveNoMoreInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRulesForNotAssociatedRuleSetToFolder()
|
||||
{
|
||||
|
Reference in New Issue
Block a user