use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class RuleServiceTest method testGetRuleset.
public void testGetRuleset() throws Exception {
JSONObject parentRule = createRule(testWorkNodeRef);
String[] parentRuleIds = new String[] { parentRule.getJSONObject("data").getString("id") };
JSONObject jsonRule = createRule(testNodeRef);
String[] ruleIds = new String[] { jsonRule.getJSONObject("data").getString("id") };
Action linkRulesAction = actionService.createAction(LinkRules.NAME);
linkRulesAction.setParameterValue(LinkRules.PARAM_LINK_FROM_NODE, testNodeRef);
actionService.executeAction(linkRulesAction, testNodeRef2);
Response linkedFromResponse = sendRequest(new GetRequest(formatRulesetUrl(testNodeRef)), 200);
JSONObject linkedFromResult = new JSONObject(linkedFromResponse.getContentAsString());
checkRuleset(linkedFromResult, 1, ruleIds, 1, parentRuleIds, true, false);
Response linkedToResponse = sendRequest(new GetRequest(formatRulesetUrl(testNodeRef2)), 200);
JSONObject linkedToResult = new JSONObject(linkedToResponse.getContentAsString());
checkRuleset(linkedToResult, 1, ruleIds, 1, parentRuleIds, false, true);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class RuleServiceTest method testGetActionDefinitions.
public void testGetActionDefinitions() throws Exception {
Response response = sendRequest(new GetRequest(URL_ACTIONDEFINITIONS), 200);
JSONObject result = new JSONObject(response.getContentAsString());
assertNotNull(result);
assertTrue(result.has("data"));
JSONArray data = result.getJSONArray("data");
for (int i = 0; i < data.length(); i++) {
JSONObject actionDefinition = data.getJSONObject(i);
assertTrue(actionDefinition.has("name"));
assertTrue(actionDefinition.has("displayLabel"));
assertTrue(actionDefinition.has("description"));
assertTrue(actionDefinition.has("adHocPropertiesAllowed"));
assertTrue(actionDefinition.has("parameterDefinitions"));
assertTrue(actionDefinition.has("applicableTypes"));
}
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class RuleServiceTest method testGetActionConditionDefinitions.
public void testGetActionConditionDefinitions() throws Exception {
Response response = sendRequest(new GetRequest(URL_ACTIONCONDITIONDEFINITIONS), 200);
JSONObject result = new JSONObject(response.getContentAsString());
assertNotNull(result);
assertTrue(result.has("data"));
JSONArray data = result.getJSONArray("data");
for (int i = 0; i < data.length(); i++) {
JSONObject actionConditionDefinition = data.getJSONObject(i);
assertTrue(actionConditionDefinition.has("name"));
assertTrue(actionConditionDefinition.has("displayLabel"));
assertTrue(actionConditionDefinition.has("description"));
assertTrue(actionConditionDefinition.has("adHocPropertiesAllowed"));
assertTrue(actionConditionDefinition.has("parameterDefinitions"));
}
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class RuleServiceTest method testGetRuleDetails.
public void testGetRuleDetails() throws Exception {
JSONObject jsonRule = createRule(testNodeRef);
String ruleId = jsonRule.getJSONObject("data").getString("id");
Response response = sendRequest(new GetRequest(formateRuleUrl(testNodeRef, ruleId)), 200);
JSONObject result = new JSONObject(response.getContentAsString());
checkRuleComplete(result);
}
use of org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest in project alfresco-remote-api by Alfresco.
the class RuleServiceTest method testGetRuleTypes.
public void testGetRuleTypes() throws Exception {
Response response = sendRequest(new GetRequest(URL_RULETYPES), 200);
JSONObject result = new JSONObject(response.getContentAsString());
assertNotNull(result);
assertTrue(result.has("data"));
JSONArray data = result.getJSONArray("data");
for (int i = 0; i < data.length(); i++) {
JSONObject ruleType = data.getJSONObject(i);
assertTrue(ruleType.has("name"));
assertTrue(ruleType.has("displayLabel"));
assertTrue(ruleType.has("url"));
}
}
Aggregations