mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1868: added 400 and 401 status tests.
Also fixed jackson deserialisation that I had unwittingly broken in the last commit by taking out the "id" field in ActionDefinition.
This commit is contained in:
@@ -94,6 +94,7 @@ public class ActionsImpl implements Actions
|
|||||||
map(this::toModel).
|
map(this::toModel).
|
||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
return new ActionDefinition(
|
return new ActionDefinition(
|
||||||
|
actionDefinition.getName(), // ID is a synonym for name.
|
||||||
actionDefinition.getName(),
|
actionDefinition.getName(),
|
||||||
actionDefinition.getTitle(),
|
actionDefinition.getTitle(),
|
||||||
actionDefinition.getDescription(),
|
actionDefinition.getDescription(),
|
||||||
|
@@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ActionDefinition
|
public class ActionDefinition
|
||||||
{
|
{
|
||||||
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
private String title;
|
private String title;
|
||||||
private String description;
|
private String description;
|
||||||
@@ -44,7 +45,8 @@ public class ActionDefinition
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionDefinition(String name,
|
public ActionDefinition(String id,
|
||||||
|
String name,
|
||||||
String title,
|
String title,
|
||||||
String description,
|
String description,
|
||||||
List<String> applicableTypes,
|
List<String> applicableTypes,
|
||||||
@@ -52,6 +54,7 @@ public class ActionDefinition
|
|||||||
boolean trackStatus,
|
boolean trackStatus,
|
||||||
List<ParameterDefinition> parameterDefinitions)
|
List<ParameterDefinition> parameterDefinitions)
|
||||||
{
|
{
|
||||||
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -62,11 +65,11 @@ public class ActionDefinition
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synonym for name.
|
* Will be used as a synonym for name.
|
||||||
*/
|
*/
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return getName();
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
|
@@ -399,6 +399,12 @@ public class TestActions extends AbstractBaseApiTest
|
|||||||
assertEquals(expectedActions, retrievedActions);
|
assertEquals(expectedActions, retrievedActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Badly formed request -> 400
|
||||||
|
{
|
||||||
|
PublicApiClient.Paging paging = getPaging(0, -1); // -1 is not acceptable
|
||||||
|
actions.getActionDefinitionsForNode(validNode.getId(), createParams(paging, null), 400);
|
||||||
|
}
|
||||||
|
|
||||||
// Non-existent node ID
|
// Non-existent node ID
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = new NodeRef(
|
NodeRef nodeRef = new NodeRef(
|
||||||
@@ -408,5 +414,11 @@ public class TestActions extends AbstractBaseApiTest
|
|||||||
|
|
||||||
actions.getActionDefinitionsForNode(nodeRef.getId(), emptyParams, 404);
|
actions.getActionDefinitionsForNode(nodeRef.getId(), emptyParams, 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unauthorized -> 401
|
||||||
|
{
|
||||||
|
publicApiClient.setRequestContext(new RequestContext(account1.getId(), person1, "invalid-password"));
|
||||||
|
actions.getActionDefinitionsForNode(validNode.getId(), emptyParams, 401);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user