RM-6746 cherry picking merge request from RM-6790

This commit is contained in:
Claudia Agache
2019-04-03 09:44:57 +01:00
committed by Ross Gale
parent 8aeb41d83d
commit f70e3f92f1
7 changed files with 88 additions and 38 deletions

View File

@@ -13,9 +13,9 @@
<properties>
<maven.build.sourceVersion>1.8</maven.build.sourceVersion>
<alfresco.rm.share>alfresco-rm-community-share</alfresco.rm.share>
<alfresco.rm.repo>alfresco-rm-community-repo</alfresco.rm.repo>
<tas.restapi.version>5.2.0-10</tas.restapi.version>
<ags.share>alfresco-governance-services-community-share</ags.share>
<ags.repo>alfresco-governance-services-community-repo</ags.repo>
<tas.restapi.version>6.0.0.3</tas.restapi.version>
<fluent.json.version>2.0.0</fluent.json.version>
</properties>
@@ -59,7 +59,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
<version>1.18.6</version>
<scope>provided</scope>
</dependency>
<!-- FIXME: Remove this dependency once RMUserAPI.java has been refactored -->
@@ -73,5 +73,10 @@
<artifactId>alfresco-testng</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
</dependencies>
</project>

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;
@@ -341,7 +341,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)
@@ -368,7 +368,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,2 +1,3 @@
alfresco.server=localhost
alfresco.port=8080
rest.rmPath=alfresco/api/-default-/public/gs/versions/1