Merge branch 'release/V3.0' of https://git.alfresco.com/records-management/records-management into feature-3-0/RM-6577_AutomatedRestApiTests

This commit is contained in:
Rodica Sutu
2019-07-02 10:34:50 +03:00
100 changed files with 308 additions and 257 deletions

View File

@@ -27,6 +27,8 @@
package org.alfresco.rest.core.v0;
import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
@@ -44,6 +46,10 @@ public class APIUtils
{
/** Logger for this class. */
private static final Logger LOGGER = LoggerFactory.getLogger(APIUtils.class);
/** The ISO instant formatter that formats or parses an instant in UTC, such as '2011-12-03T10:15:305Z'
* similar with {@link DateTimeFormatter#ISO_INSTANT}, but with only 3 nanoseconds*/
public static final DateTimeFormatter ISO_INSTANT_FORMATTER =
new DateTimeFormatterBuilder().appendInstant(3).toFormatter();
/** Private constructor for helper class. */
private APIUtils()

View File

@@ -27,6 +27,7 @@
package org.alfresco.rest.v0;
import static org.alfresco.dataprep.AlfrescoHttpClient.MIME_TYPE_JSON;
import static org.alfresco.rest.core.v0.APIUtils.ISO_INSTANT_FORMATTER;
import static org.apache.http.HttpStatus.SC_OK;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
@@ -37,7 +38,6 @@ import java.io.IOException;
import java.text.MessageFormat;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
@@ -346,7 +346,7 @@ public class RMRolesAndActionsAPI extends BaseAPI
requestParams.put("nodeRef", recNodeRef);
if (date != null)
{
String thisMoment = date.format(DateTimeFormatter.ISO_INSTANT);
String thisMoment = date.format(ISO_INSTANT_FORMATTER);
requestParams.put("params", new JSONObject()
.put("asOfDate", new JSONObject()
.put("iso8601", thisMoment)
@@ -373,7 +373,7 @@ public class RMRolesAndActionsAPI extends BaseAPI
requestParams.put("name", RM_ACTIONS.COMPLETE_EVENT.getAction());
requestParams.put("nodeRef", recNodeRef);
date = (date != null) ? date : Instant.now();
String formattedDate = DateTimeFormatter.ISO_INSTANT.format(date);
String formattedDate = ISO_INSTANT_FORMATTER.format(date);
requestParams.put("params", new JSONObject()
.put("eventName", event.getEventName())
.put("eventCompletedBy", user)

View File

@@ -1,3 +1,3 @@
alfresco.server=localhost
rest.rmPath=alfresco/api/-default-/public/gs/versions/1
alfresco.port=8080
alfresco.port=8080
rest.rmPath=alfresco/api/-default-/public/gs/versions/1