Refactored code

This commit is contained in:
Tuna Aksoy
2016-11-01 19:42:39 +00:00
parent f0655e004a
commit 43e483d0bc
22 changed files with 417 additions and 285 deletions

2
README
View File

@@ -1,3 +1,3 @@
FIXME: DOCUMENT ME BETTER :) FIXME: Add more info to the README file
In order to change the value of a property in "config.properties" create a file called "local.properties" under src/test/resources and redefine the property with the new value. In order to change the value of a property in "config.properties" create a file called "local.properties" under src/test/resources and redefine the property with the new value.

View File

@@ -11,8 +11,8 @@
*/ */
package org.alfresco.rest.model.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.ALLOWABLE_OPERATIONS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import java.util.List; import java.util.List;
@@ -28,32 +28,22 @@ import com.fasterxml.jackson.annotation.JsonProperty;
//FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed //FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
public class FilePlanComponent public class FilePlanComponent
{ {
private String id; private String id;
private String parentId; private String parentId;
private String name; private String name;
private String nodeType; private String nodeType;
private boolean isCategory; private boolean isCategory;
private boolean isRecordFolder; private boolean isRecordFolder;
private boolean isFile; private boolean isFile;
private boolean hasRetentionSchedule; private boolean hasRetentionSchedule;
private List<String> aspectNames; private List<String> aspectNames;
private FilePlanComponentCreatedByUser createdByUser;
@JsonProperty(PROPERTIES) @JsonProperty(PROPERTIES)
private FilePlanComponentProperties properties; private FilePlanComponentProperties properties;
private FilePlanComponentCreatedByUser createdByUser;
@JsonProperty (ALLOWABLE_OPERATIONS) @JsonProperty (ALLOWABLE_OPERATIONS)
private List<String> allowableOperations; private List<String> allowableOperations;
/** /**
* @return the id * @return the id
*/ */

View File

@@ -9,7 +9,9 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
/** /**
* File plan component alias enumeration * File plan component alias enumeration
@@ -33,19 +35,26 @@ public enum FilePlanComponentAlias
public static final FilePlanComponentAlias getFilePlanComponentAlias(String alias) public static final FilePlanComponentAlias getFilePlanComponentAlias(String alias)
{ {
switch (alias) mandatoryString("alias", alias);
FilePlanComponentAlias result = null;
FilePlanComponentAlias[] values = values();
for (FilePlanComponentAlias filePlanComponentAlias : values)
{ {
case "-filePlan-": if (filePlanComponentAlias.toString().equals(alias))
return FILE_PLAN_ALIAS; {
case "-transfers-": result = filePlanComponentAlias;
return TRANSFERS_ALIAS; break;
case "-unfiled-": }
return UNFILED_RECORDS_CONTAINER_ALIAS;
case "-holds-":
return HOLDS_ALIAS;
} }
throw new IllegalArgumentException("Invalid file plan component alias enum value: '" + alias + "'."); if (result == null)
{
throw new IllegalArgumentException("Invalid file plan component alias enum value: '" + alias + "'.");
}
return result;
} }
/** /**

View File

@@ -13,6 +13,7 @@ package org.alfresco.rest.model.fileplancomponents;
/** /**
* POJO for file plan component created by object * POJO for file plan component created by object
*
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 1.0 * @since 1.0
*/ */
@@ -20,6 +21,7 @@ public class FilePlanComponentCreatedByUser
{ {
private String id; private String id;
private String displayName; private String displayName;
/** /**
* @return the id * @return the id
*/ */
@@ -27,6 +29,7 @@ public class FilePlanComponentCreatedByUser
{ {
return this.id; return this.id;
} }
/** /**
* @param id the id to set * @param id the id to set
*/ */
@@ -34,6 +37,7 @@ public class FilePlanComponentCreatedByUser
{ {
this.id = id; this.id = id;
} }
/** /**
* @return the displayName * @return the displayName
*/ */
@@ -41,6 +45,7 @@ public class FilePlanComponentCreatedByUser
{ {
return this.displayName; return this.displayName;
} }
/** /**
* @param displayName the displayName to set * @param displayName the displayName to set
*/ */

View File

@@ -11,10 +11,11 @@
*/ */
package org.alfresco.rest.model.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.ENTRY;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.rest.core.RestModels; import org.alfresco.rest.core.RestModels;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponent;
/** /**
* POJO for file plan component entry * POJO for file plan component entry
@@ -24,7 +25,7 @@ import org.alfresco.rest.model.fileplancomponents.FilePlanComponent;
*/ */
public class FilePlanComponentEntry extends RestModels<FilePlanComponent, FilePlanComponentEntry> public class FilePlanComponentEntry extends RestModels<FilePlanComponent, FilePlanComponentEntry>
{ {
@JsonProperty(value = "entry") @JsonProperty(ENTRY)
FilePlanComponent filePlanComponent; FilePlanComponent filePlanComponent;
public FilePlanComponent getFilePlanComponent() public FilePlanComponent getFilePlanComponent()

View File

@@ -9,7 +9,7 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
/** /**
* File plan component field names constants * File plan component field names constants
@@ -22,6 +22,7 @@ public class FilePlanComponentFields
public static final String NAME = "name"; public static final String NAME = "name";
public static final String NODE_TYPE = "nodeType"; public static final String NODE_TYPE = "nodeType";
public static final String NODE_PARENT_ID = "parentId"; public static final String NODE_PARENT_ID = "parentId";
public static final String ENTRY = "entry";
public static final String PROPERTIES = "properties"; public static final String PROPERTIES = "properties";
public static final String PROPERTIES_TITLE = "cm:title"; public static final String PROPERTIES_TITLE = "cm:title";
public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator"; public static final String PROPERTIES_VITAL_RECORD_INDICATOR = "rma:vitalRecordIndicator";

View File

@@ -11,10 +11,10 @@
*/ */
package org.alfresco.rest.model.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_HOLD_REASON;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_VITAL_RECORD_INDICATOR;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@@ -38,8 +38,9 @@ public class FilePlanComponentProperties
@JsonProperty(PROPERTIES_HOLD_REASON) @JsonProperty(PROPERTIES_HOLD_REASON)
private String holdReason; private String holdReason;
@JsonProperty (PROPERTIES_DESCRIPTION) @JsonProperty(PROPERTIES_DESCRIPTION)
private String description; private String description;
/** /**
* @return the vitalRecord * @return the vitalRecord
*/ */
@@ -103,5 +104,4 @@ public class FilePlanComponentProperties
{ {
return this.description; return this.description;
} }
} }

View File

@@ -9,7 +9,9 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.fileplancomponents; package org.alfresco.rest.model.fileplancomponents;
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
/** /**
* File plan component type enumeration * File plan component type enumeration
@@ -37,27 +39,26 @@ public enum FilePlanComponentType
public static final FilePlanComponentType getFilePlanComponentType(String type) public static final FilePlanComponentType getFilePlanComponentType(String type)
{ {
switch (type) mandatoryString("type", type);
FilePlanComponentType result = null;
FilePlanComponentType[] values = values();
for (FilePlanComponentType filePlanComponentType : values)
{ {
case "rma:filePlan": if (filePlanComponentType.toString().equals(filePlanComponentType))
return FILE_PLAN_TYPE; {
case "rma:recordCategory": result = filePlanComponentType;
return RECORD_CATEGORY_TYPE; break;
case "rma:recordFolder": }
return RECORD_FOLDER_TYPE;
case "rma:hold":
return HOLD_TYPE;
case "rma:unfiledRecordFolder":
return UNFILED_RECORD_FOLDER_TYPE;
case "rma:holdContainer":
return HOLD_CONTAINER_TYPE;
case "rma:transferContainer":
return TRANSFER_CONTAINER_TYPE;
case "rma:unfiledRecordContainer":
return UNFILED_CONTAINER_TYPE;
} }
throw new IllegalArgumentException("Invalid file plan component type enum value: '" + type + "'."); if (result == null)
{
throw new IllegalArgumentException("Invalid file plan component type enum value: '" + type + "'.");
}
return result;
} }
/** /**

View File

@@ -15,6 +15,7 @@ import org.alfresco.rest.core.RestModels;
/** /**
* Handle collection of FilePlanComponents * Handle collection of FilePlanComponents
*
* @author Kristijan Conkas * @author Kristijan Conkas
* @since 1.0 * @since 1.0
*/ */

View File

@@ -13,7 +13,6 @@ package org.alfresco.rest.model.site;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import org.alfresco.com.site.RMSiteCompliance;
import org.alfresco.rest.model.RestSiteModel; import org.alfresco.rest.model.RestSiteModel;
/** /**
@@ -29,6 +28,7 @@ public class RMSite extends RestSiteModel
/** /**
* Helper method to set RM site compliance * Helper method to set RM site compliance
*
* @param compliance {@link RMSiteCompliance} the compliance to set * @param compliance {@link RMSiteCompliance} the compliance to set
*/ */
public void setCompliance(RMSiteCompliance compliance) public void setCompliance(RMSiteCompliance compliance)
@@ -38,6 +38,7 @@ public class RMSite extends RestSiteModel
/** /**
* Helper method to get RM site compliance * Helper method to get RM site compliance
*
* @return compliance the RM Site compliance to get * @return compliance the RM Site compliance to get
*/ */
public RMSiteCompliance getCompliance() public RMSiteCompliance getCompliance()

View File

@@ -9,7 +9,7 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.site; package org.alfresco.rest.model.site;
/** /**
* RM Site compliance * RM Site compliance

View File

@@ -9,7 +9,7 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.site; package org.alfresco.rest.model.site;
/** /**
*RM Site properties from the RM Model Schema *RM Site properties from the RM Model Schema

View File

@@ -11,10 +11,10 @@
*/ */
package org.alfresco.rest.requests; package org.alfresco.rest.requests;
import static org.alfresco.com.util.ParameterCheck.mandatoryObject;
import static org.alfresco.com.util.ParameterCheck.mandatoryString;
import static org.alfresco.rest.core.RestRequest.requestWithBody; import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest; import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.util.ParameterCheck.mandatoryObject;
import static org.alfresco.rest.util.ParameterCheck.mandatoryString;
import static org.springframework.http.HttpMethod.DELETE; import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.GET; import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.HttpMethod.POST;
@@ -37,7 +37,7 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
@Scope(value = "prototype") @Scope(value = "prototype")
public class FilePlanComponentApi extends RestAPI<FilePlanComponentApi> public class FilePlanComponentAPI extends RestAPI<FilePlanComponentAPI>
{ {
/** /**
* Get a file plan component * Get a file plan component

View File

@@ -13,6 +13,7 @@ package org.alfresco.rest.requests;
import static org.alfresco.rest.core.RestRequest.requestWithBody; import static org.alfresco.rest.core.RestRequest.requestWithBody;
import static org.alfresco.rest.core.RestRequest.simpleRequest; import static org.alfresco.rest.core.RestRequest.simpleRequest;
import static org.alfresco.rest.util.ParameterCheck.mandatoryObject;
import static org.springframework.http.HttpMethod.DELETE; import static org.springframework.http.HttpMethod.DELETE;
import static org.springframework.http.HttpMethod.GET; import static org.springframework.http.HttpMethod.GET;
import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.HttpMethod.POST;
@@ -34,7 +35,7 @@ import org.springframework.stereotype.Component;
*/ */
@Component @Component
@Scope (value = "prototype") @Scope (value = "prototype")
public class RMSiteAPI extends RestAPI public class RMSiteAPI extends RestAPI<RMSiteAPI>
{ {
/** /**
* Get the RM site * Get the RM site
@@ -71,6 +72,8 @@ public class RMSiteAPI extends RestAPI
*/ */
public RMSite createRMSite(JsonObject rmSiteProperties) throws Exception public RMSite createRMSite(JsonObject rmSiteProperties) throws Exception
{ {
mandatoryObject("rmSiteProperties", rmSiteProperties);
return usingRestWrapper().processModel(RMSite.class, requestWithBody( return usingRestWrapper().processModel(RMSite.class, requestWithBody(
POST, POST,
rmSiteProperties.toString(), rmSiteProperties.toString(),
@@ -113,11 +116,12 @@ public class RMSiteAPI extends RestAPI
*/ */
public RMSite updateRMSite(JsonObject rmSiteProperties) throws Exception public RMSite updateRMSite(JsonObject rmSiteProperties) throws Exception
{ {
mandatoryObject("rmSiteProperties", rmSiteProperties);
return usingRestWrapper().processModel(RMSite.class, requestWithBody( return usingRestWrapper().processModel(RMSite.class, requestWithBody(
PUT, PUT,
rmSiteProperties.toString(), rmSiteProperties.toString(),
"sites/rm" "sites/rm"
)); ));
} }
} }

View File

@@ -9,7 +9,7 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.com.util; package org.alfresco.rest.util;
import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isBlank;
@@ -27,11 +27,11 @@ public class ParameterCheck
} }
/** /**
* FIXME: Document me :) * Checks if a given {@link String} is blank or not, i.e. not <code>null<code>, "" or " ".
* *
* @param paramName FIXME: Document me :) * @param paramName The name of the parameter to check
* @param paramValue FIXME: Document me :) * @param paramValue The value of the parameter to check
* @throws IllegalArgumentException FIXME: Document me :) * @throws IllegalArgumentException Throws an exception if the given value is blank
*/ */
public static void mandatoryString(final String paramName, final String paramValue) throws IllegalArgumentException public static void mandatoryString(final String paramName, final String paramValue) throws IllegalArgumentException
{ {
@@ -42,12 +42,13 @@ public class ParameterCheck
} }
/** /**
* FIXME: Document me :) * Checks if a given {@link Object} is null or not
* *
* @param paramName FIXME: Document me :) * @param paramName The name of the parameter to check
* @param object FIXME: Document me :) * @param object The value of the parameter to check
* @throws IllegalArgumentException Throws an exception if the given value is null
*/ */
public static void mandatoryObject(final String paramName, final Object object) public static void mandatoryObject(final String paramName, final Object object) throws IllegalArgumentException
{ {
if (object == null) if (object == null)
{ {

View File

@@ -0,0 +1,25 @@
/*
* #%L
* Alfresco Records Management Module
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
* #L%
*/
package org.alfresco.rest.base;
/**
* List of allowable operations
*
* @author Tuna Aksoy
* @since 1.0
*/
public class AllowableOperations
{
public static final String CREATE = "create";
public static final String UPDATE = "update";
public static final String DELETE = "delete";
}

View File

@@ -9,14 +9,14 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.rest; package org.alfresco.rest.base;
import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt;
import static org.alfresco.com.site.RMSiteCompliance.STANDARD; import static org.alfresco.rest.model.site.RMSiteCompliance.STANDARD;
import static org.alfresco.com.site.RMSiteFields.COMPLIANCE; import static org.alfresco.rest.model.site.RMSiteFields.COMPLIANCE;
import static org.alfresco.com.site.RMSiteFields.DESCRIPTION; import static org.alfresco.rest.model.site.RMSiteFields.DESCRIPTION;
import static org.alfresco.com.site.RMSiteFields.TITLE; import static org.alfresco.rest.model.site.RMSiteFields.TITLE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject; import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.HttpStatus.OK;
@@ -24,6 +24,7 @@ import static org.springframework.http.HttpStatus.OK;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.jayway.restassured.RestAssured; import com.jayway.restassured.RestAssured;
import org.alfresco.rest.RestTest;
import org.alfresco.rest.core.RestWrapper; import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.requests.RMSiteAPI; import org.alfresco.rest.requests.RMSiteAPI;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
@@ -58,10 +59,10 @@ public class BaseRestTest extends RestTest
private String restRmPath; private String restRmPath;
@Autowired @Autowired
public RMSiteAPI rmSiteAPI; private RMSiteAPI rmSiteAPI;
@Autowired @Autowired
public DataUser dataUser; private DataUser dataUser;
// Constants // Constants
public static final String RM_ID = "rm"; public static final String RM_ID = "rm";
@@ -79,17 +80,18 @@ public class BaseRestTest extends RestTest
RestAssured.port = parseInt(port); RestAssured.port = parseInt(port);
RestAssured.basePath = restRmPath; RestAssured.basePath = restRmPath;
//create RM Site if not exist // Create RM Site if not exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
} }
/** /**
* Helper method to create the RM Site via the POST request * Helper method to create the RM Site via the POST request
* if the site doesn't exist * if the site doesn't exist
*/ */
public void createRMSiteIfNotExists() throws Exception public void createRMSiteIfNotExists() throws Exception
{ {
//check RM site doesn't exist // Check RM site doesn't exist
if (!siteRMExist()) if (!siteRMExists())
{ {
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
@@ -109,9 +111,9 @@ public class BaseRestTest extends RestTest
} }
/** /**
* Check the RM site exist via the GET request * Check if the RM site exists via the GET request
*/ */
public boolean siteRMExist() throws Exception public boolean siteRMExists() throws Exception
{ {
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
rmSiteAPI.getSite(); rmSiteAPI.getSite();

View File

@@ -9,16 +9,16 @@
* agreement is prohibited. * agreement is prohibited.
* #L% * #L%
*/ */
package org.alfresco.rest; package org.alfresco.rest.base;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.HOLDS_ALIAS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.HOLDS_ALIAS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.TRANSFERS_ALIAS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.UNFILED_RECORDS_CONTAINER_ALIAS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.FILE_PLAN_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.HOLD_CONTAINER_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.TRANSFER_CONTAINER_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.UNFILED_CONTAINER_TYPE;
import org.testng.annotations.DataProvider; import org.testng.annotations.DataProvider;
@@ -26,6 +26,7 @@ import org.testng.annotations.DataProvider;
* Test data used in tests * Test data used in tests
* *
* @author Rodica Sutu * @author Rodica Sutu
* @since 1.0
*/ */
public interface TestData public interface TestData
{ {
@@ -39,6 +40,10 @@ public interface TestData
* The default password used when creating test users. * The default password used when creating test users.
*/ */
public static final String DEFAULT_PASSWORD = "password"; public static final String DEFAULT_PASSWORD = "password";
/**
* The default email address used when creating test users.
*/
public static final String DEFAULT_EMAIL = "default@alfresco.com"; public static final String DEFAULT_EMAIL = "default@alfresco.com";
/** /**

View File

@@ -11,14 +11,18 @@
*/ */
package org.alfresco.rest.fileplancomponents; package org.alfresco.rest.fileplancomponents;
import static java.util.UUID.randomUUID; import static java.util.Arrays.asList;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; import static org.alfresco.rest.base.AllowableOperations.CREATE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.NAME; import static org.alfresco.rest.base.AllowableOperations.DELETE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.NODE_TYPE; import static org.alfresco.rest.base.AllowableOperations.UPDATE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.NAME;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_DESCRIPTION;
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject; import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.FORBIDDEN; import static org.springframework.http.HttpStatus.FORBIDDEN;
import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.NOT_FOUND;
@@ -27,16 +31,15 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.Arrays;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.alfresco.com.fileplancomponents.FilePlanComponentAlias; import org.alfresco.rest.base.BaseRestTest;
import org.alfresco.com.fileplancomponents.FilePlanComponentType; import org.alfresco.rest.base.TestData;
import org.alfresco.rest.BaseRestTest;
import org.alfresco.rest.TestData;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.requests.FilePlanComponentApi; import org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponentType;
import org.alfresco.rest.requests.FilePlanComponentAPI;
import org.alfresco.rest.requests.RMSiteAPI;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug; import org.alfresco.utility.report.Bug;
@@ -53,14 +56,17 @@ import org.testng.annotations.Test;
public class FilePlanTests extends BaseRestTest public class FilePlanTests extends BaseRestTest
{ {
@Autowired @Autowired
private FilePlanComponentApi filePlanComponentApi; private FilePlanComponentAPI filePlanComponentAPI;
@Autowired
private RMSiteAPI rmSiteAPI;
@Autowired @Autowired
private DataUser dataUser; private DataUser dataUser;
/** /**
* Given that the RM site doesn't exist * Given that the RM site doesn't exist
* When I use the API to get the File Plan/holds/unfiled/transfers * When I use the API to get the File Plan/Holds/Unfiled Records Container/Transfers
* Then I get the 404 response code * Then I get the 404 response code
*/ */
@Test @Test
@@ -71,17 +77,21 @@ public class FilePlanTests extends BaseRestTest
) )
public void getFilePlanComponentWhenRMIsNotCreated(String filePlanAlias) throws Exception public void getFilePlanComponentWhenRMIsNotCreated(String filePlanAlias) throws Exception
{ {
//check RM Site Exist // Check RM Site Exist
if (siteRMExist()) if (siteRMExists())
{ {
//delete RM Site // Delete RM Site
rmSiteAPI.deleteRMSite(); rmSiteAPI.deleteRMSite();
} }
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//get the file plan component // Authenticate with admin user
filePlanComponentApi.getFilePlanComponent(filePlanAlias.toString()); filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Get the file plan component
filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString());
//check the response code is NOT_FOUND //check the response code is NOT_FOUND
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(NOT_FOUND); filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(NOT_FOUND);
} }
/** /**
@@ -97,15 +107,19 @@ public class FilePlanTests extends BaseRestTest
) )
public void getFilePlanComponentWhenRMIsCreated(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception public void getFilePlanComponentWhenRMIsCreated(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception
{ {
//create RM Site if doesn't exist // Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
//authenticate with admin user
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Authenticate with admin user
//get the file plan special container filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
FilePlanComponent filePlanComponent=filePlanComponentApi.getFilePlanComponent(filePlanAlias.toString());
//check the response code // Get the file plan special container
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(OK); FilePlanComponent filePlanComponent = filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString());
//check the response contains the right node type
// Check the response code
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
// Check the response contains the right node type
assertEquals(filePlanComponent.getNodeType(), rmType.toString()); assertEquals(filePlanComponent.getNodeType(), rmType.toString());
} }
@@ -122,17 +136,22 @@ public class FilePlanTests extends BaseRestTest
) )
public void includeAllowableOperations(String specialContainerAlias) throws Exception public void includeAllowableOperations(String specialContainerAlias) throws Exception
{ {
//create RM Site if doesn't exist // Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//GET the file plan special containers with the optional parameter allowableOperations // Authenticate with admin user
FilePlanComponent filePlanComponent = filePlanComponentApi.withParams("include=allowableOperations").getFilePlanComponent(specialContainerAlias); filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//Check the list of allowableOperations returned
assertTrue(filePlanComponent.getAllowableOperations().containsAll(Arrays.asList("update", "create")), // Get the file plan special containers with the optional parameter allowableOperations
FilePlanComponent filePlanComponent = filePlanComponentAPI.withParams("include=allowableOperations").getFilePlanComponent(specialContainerAlias);
// Check the list of allowableOperations returned
assertTrue(filePlanComponent.getAllowableOperations().containsAll(asList(UPDATE, CREATE)),
"Wrong list of the allowable operations is return" + filePlanComponent.getAllowableOperations().toString()); "Wrong list of the allowable operations is return" + filePlanComponent.getAllowableOperations().toString());
//check the list of allowableOperations doesn't contains DELETE operation
assertFalse(filePlanComponent.getAllowableOperations().contains("delete"), // Check the list of allowableOperations doesn't contains DELETE operation
"The list of allowable operations contains delete option"+ filePlanComponent.getAllowableOperations().toString()); assertFalse(filePlanComponent.getAllowableOperations().contains(DELETE),
"The list of allowable operations contains delete option" + filePlanComponent.getAllowableOperations().toString());
} }
/** /**
@@ -145,12 +164,16 @@ public class FilePlanTests extends BaseRestTest
@Bug (id = "RM-4295") @Bug (id = "RM-4295")
public void updateFilePlan() throws Exception public void updateFilePlan() throws Exception
{ {
String FILE_PLAN_DESCRIPTION="Description updated " +randomUUID().toString().substring(0, 4); String FILE_PLAN_DESCRIPTION = "Description updated " + getRandomAlphanumeric();
String FILE_PLAN_TITLE = "Title updated " + randomUUID().toString().substring(0, 4); String FILE_PLAN_TITLE = "Title updated " + getRandomAlphanumeric();
//create RM Site if doesn't exist
// Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//Build the file plan root properties // Authenticate with admin user
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Build the file plan root properties
JsonObject filePlanProperties = buildObject() JsonObject filePlanProperties = buildObject()
.addObject(PROPERTIES) .addObject(PROPERTIES)
.add(PROPERTIES_TITLE, FILE_PLAN_TITLE) .add(PROPERTIES_TITLE, FILE_PLAN_TITLE)
@@ -158,15 +181,15 @@ public class FilePlanTests extends BaseRestTest
.end() .end()
.getJson(); .getJson();
// Update the record category // Update the record category
FilePlanComponent renamedFilePlanComponent = filePlanComponentApi.updateFilePlanComponent(filePlanProperties,FILE_PLAN_ALIAS.toString()); FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(filePlanProperties,FILE_PLAN_ALIAS.toString());
// Verify the response status code // Verify the response status code
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(OK); filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(OK);
// Verify the returned description field for the file plan component // Verify the returned description field for the file plan component
assertEquals(renamedFilePlanComponent.getProperties().getDescription(), FILE_PLAN_DESCRIPTION); assertEquals(renamedFilePlanComponent.getProperties().getDescription(), FILE_PLAN_DESCRIPTION);
// Verify the returned title field for the file plan component // Verify the returned title field for the file plan component
assertEquals(renamedFilePlanComponent.getProperties().getTitle(), FILE_PLAN_TITLE); assertEquals(renamedFilePlanComponent.getProperties().getTitle(), FILE_PLAN_TITLE);
} }
@@ -184,12 +207,17 @@ public class FilePlanTests extends BaseRestTest
) )
public void deleteFilePlanSpecialComponents(String filePlanAlias) throws Exception public void deleteFilePlanSpecialComponents(String filePlanAlias) throws Exception
{ {
// Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//get the file plan component // Authenticate with admin user
filePlanComponentApi.deleteFilePlanComponent(filePlanAlias.toString()); filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
//check the DELETE response status code
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); // Delete the file plan component
filePlanComponentAPI.deleteFilePlanComponent(filePlanAlias.toString());
// Check the DELETE response status code
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
} }
/** /**
@@ -206,28 +234,33 @@ public class FilePlanTests extends BaseRestTest
@Bug(id="RM-4296") @Bug(id="RM-4296")
public void createFilePlanSpecialContainerWhenExists(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception public void createFilePlanSpecialContainerWhenExists(FilePlanComponentAlias filePlanAlias, FilePlanComponentType rmType) throws Exception
{ {
String rmSiteId=rmSiteAPI.getSite().getGuid(); String rmSiteId = rmSiteAPI.getSite().getGuid();
//create RM Site if doesn't exist // Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
String COMPONENT_TITLE = filePlanAlias + randomUUID().toString().substring(0, 4); // Authenticate with admin user
filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
String name = filePlanAlias + getRandomAlphanumeric();
//Build the file plan root properties //Build the file plan root properties
JsonObject componentProperties = buildObject() JsonObject componentProperties = buildObject()
.add(NAME, COMPONENT_TITLE) .add(NAME, name)
.add(NODE_TYPE, rmType.toString()) .add(NODE_TYPE, rmType.toString())
.getJson(); .getJson();
//create the special containers into RM site - parent folder
filePlanComponentApi.createFilePlanComponent(componentProperties, rmSiteId);
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
//create the special containers into RM site - parent folder // Create the special containers into RM site - parent folder
filePlanComponentApi.createFilePlanComponent(componentProperties, FILE_PLAN_ALIAS.toString()); filePlanComponentAPI.createFilePlanComponent(componentProperties, rmSiteId);
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
//create the special containers into the root of special containers containers // Create the special containers into RM site - parent folder
filePlanComponentApi.createFilePlanComponent(componentProperties, filePlanAlias.toString()); filePlanComponentAPI.createFilePlanComponent(componentProperties, FILE_PLAN_ALIAS.toString());
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
// Create the special containers into the root of special containers containers
filePlanComponentAPI.createFilePlanComponent(componentProperties, filePlanAlias.toString());
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
} }
/** /**
@@ -243,17 +276,25 @@ public class FilePlanTests extends BaseRestTest
) )
public void getSpecialFilePlanComponentsWithNonRMuser(String filePlanAlias) throws Exception public void getSpecialFilePlanComponentsWithNonRMuser(String filePlanAlias) throws Exception
{ {
//create RM Site if doesn't exist // Create RM Site if doesn't exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Disconnect user from REST API session
rmSiteAPI.usingRestWrapper().disconnect(); rmSiteAPI.usingRestWrapper().disconnect();
// Authenticate admin user to Alfresco REST API
restClient.authenticateUser(dataUser.getAdminUser()); restClient.authenticateUser(dataUser.getAdminUser());
//create a random user
// Create a random user
UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
//authenticate using the random user
filePlanComponentApi.usingRestWrapper().authenticateUser(nonRMuser); // Authenticate using the random user
//get the special file plan components filePlanComponentAPI.usingRestWrapper().authenticateUser(nonRMuser);
filePlanComponentApi.getFilePlanComponent(filePlanAlias.toString());
//check the response status code -FORBIDDEN // Get the special file plan components
filePlanComponentApi.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); filePlanComponentAPI.getFilePlanComponent(filePlanAlias.toString());
// Check the response status code is FORBIDDEN
filePlanComponentAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
} }
} }

View File

@@ -11,15 +11,14 @@
*/ */
package org.alfresco.rest.fileplancomponents; package org.alfresco.rest.fileplancomponents;
import static java.util.UUID.randomUUID; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.NAME;
import static org.alfresco.com.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.NODE_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.NAME; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.NODE_TYPE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentFields.PROPERTIES_TITLE; import static org.alfresco.rest.model.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.RECORD_CATEGORY_TYPE; import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
import static org.alfresco.com.fileplancomponents.FilePlanComponentType.RECORD_FOLDER_TYPE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject; import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.NOT_FOUND;
@@ -36,20 +35,19 @@ import java.util.NoSuchElementException;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.alfresco.com.fileplancomponents.FilePlanComponentType; import org.alfresco.rest.base.BaseRestTest;
import org.alfresco.rest.BaseRestTest;
import org.alfresco.rest.core.RestWrapper; import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponent; import org.alfresco.rest.model.fileplancomponents.FilePlanComponent;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponentProperties; import org.alfresco.rest.model.fileplancomponents.FilePlanComponentProperties;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponentType;
import org.alfresco.rest.model.fileplancomponents.FilePlanComponentsCollection; import org.alfresco.rest.model.fileplancomponents.FilePlanComponentsCollection;
import org.alfresco.rest.requests.FilePlanComponentApi; import org.alfresco.rest.requests.FilePlanComponentAPI;
import org.alfresco.utility.data.DataUser; import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* FIXME: Document me :) * Record category related API tests
* *
* @author Kristijan Conkas * @author Kristijan Conkas
* @author Tuna Aksoy * @author Tuna Aksoy
@@ -58,12 +56,12 @@ import org.testng.annotations.Test;
public class RecordCategoryTest extends BaseRestTest public class RecordCategoryTest extends BaseRestTest
{ {
@Autowired @Autowired
private FilePlanComponentApi filePlanComponentApi; private FilePlanComponentAPI filePlanComponentAPI;
@Autowired @Autowired
private DataUser dataUser; private DataUser dataUser;
// for children creation test // Number of children (for children creation test)
private static final int NUMBER_OF_CHILDREN = 10; private static final int NUMBER_OF_CHILDREN = 10;
/** /**
@@ -78,10 +76,11 @@ public class RecordCategoryTest extends BaseRestTest
) )
public void createCategoryTest() throws Exception public void createCategoryTest() throws Exception
{ {
RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Authenticate with admin user
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
String categoryName = "Category name " + randomUUID().toString().substring(0, 8); String categoryName = "Category name " + getRandomAlphanumeric();
String categoryTitle = "Category title " + randomUUID().toString().substring(0, 8); String categoryTitle = "Category title " + getRandomAlphanumeric();
// Build the record category properties // Build the record category properties
JsonObject recordCategoryProperties = buildObject(). JsonObject recordCategoryProperties = buildObject().
@@ -93,7 +92,7 @@ public class RecordCategoryTest extends BaseRestTest
getJson(); getJson();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = filePlanComponentApi.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString()); FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString());
// Verify the status code // Verify the status code
restWrapper.assertStatusCodeIs(CREATED); restWrapper.assertStatusCodeIs(CREATED);
@@ -102,18 +101,18 @@ public class RecordCategoryTest extends BaseRestTest
assertTrue(filePlanComponent.isIsCategory()); assertTrue(filePlanComponent.isIsCategory());
assertFalse(filePlanComponent.isIsFile()); assertFalse(filePlanComponent.isIsFile());
assertFalse(filePlanComponent.isIsRecordFolder()); assertFalse(filePlanComponent.isIsRecordFolder());
assertEquals(filePlanComponent.getName(), categoryName); assertEquals(filePlanComponent.getName(), categoryName);
assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE.toString()); assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE.toString());
assertFalse(filePlanComponent.isHasRetentionSchedule()); assertFalse(filePlanComponent.isHasRetentionSchedule());
assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
// Verify the returned file plan component properties // Verify the returned file plan component properties
FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties(); FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
assertEquals(filePlanComponentProperties.getTitle(), categoryTitle); assertEquals(filePlanComponentProperties.getTitle(), categoryTitle);
logger.info("aspects: " + filePlanComponent.getAspectNames()); logger.info("Aspects: " + filePlanComponent.getAspectNames());
} }
/** /**
@@ -128,11 +127,12 @@ public class RecordCategoryTest extends BaseRestTest
) )
public void renameCategory() throws Exception public void renameCategory() throws Exception
{ {
RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Authenticate with admin user
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Create record category first // Create record category first
String categoryName = "Category name " + randomUUID().toString().substring(0, 8); String categoryName = "Category name " + getRandomAlphanumeric();
String categoryTitle = "Category title " + randomUUID().toString().substring(0, 8); String categoryTitle = "Category title " + getRandomAlphanumeric();
// Build the record category properties // Build the record category properties
JsonObject recordCategoryProperties = buildObject(). JsonObject recordCategoryProperties = buildObject().
@@ -144,7 +144,7 @@ public class RecordCategoryTest extends BaseRestTest
getJson(); getJson();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = filePlanComponentApi.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString()); FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString());
String newCategoryName = "Rename " + categoryName; String newCategoryName = "Rename " + categoryName;
@@ -154,16 +154,17 @@ public class RecordCategoryTest extends BaseRestTest
getJson(); getJson();
// Update the record category // Update the record category
FilePlanComponent renamedFilePlanComponent = filePlanComponentApi.updateFilePlanComponent(updateRecordCategoryProperties, filePlanComponent.getId()); FilePlanComponent renamedFilePlanComponent = filePlanComponentAPI.updateFilePlanComponent(updateRecordCategoryProperties, filePlanComponent.getId());
// Verify the status code // Verify the status code
restWrapper.assertStatusCodeIs(OK); restWrapper.assertStatusCodeIs(OK);
// Verify the returned file plan component // Verify the returned file plan component
assertEquals(renamedFilePlanComponent.getName(), newCategoryName); assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
// get actual FILE_PLAN_ALIAS id // Get actual FILE_PLAN_ALIAS id
FilePlanComponent parentComponent = filePlanComponentApi.getFilePlanComponent(FILE_PLAN_ALIAS.toString()); FilePlanComponent parentComponent = filePlanComponentAPI.getFilePlanComponent(FILE_PLAN_ALIAS.toString());
// verify renamed component still has this parent // verify renamed component still has this parent
assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId()); assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
} }
@@ -180,11 +181,12 @@ public class RecordCategoryTest extends BaseRestTest
) )
public void deleteCategory() throws Exception public void deleteCategory() throws Exception
{ {
RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Authenticate with admin user
RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Create record category first // Create record category first
String categoryName = "Category name " + randomUUID().toString().substring(0, 8); String categoryName = "Category name " + getRandomAlphanumeric();
String categoryTitle = "Category title " + randomUUID().toString().substring(0, 8); String categoryTitle = "Category title " + getRandomAlphanumeric();
// Build the record category properties // Build the record category properties
JsonObject recordCategoryProperties = buildObject(). JsonObject recordCategoryProperties = buildObject().
@@ -196,16 +198,16 @@ public class RecordCategoryTest extends BaseRestTest
getJson(); getJson();
// Create the record category // Create the record category
FilePlanComponent filePlanComponent = filePlanComponentApi.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString()); FilePlanComponent filePlanComponent = filePlanComponentAPI.createFilePlanComponent(recordCategoryProperties, FILE_PLAN_ALIAS.toString());
// Delete the record category // Delete the record category
filePlanComponentApi.deleteFilePlanComponent(filePlanComponent.getId()); filePlanComponentAPI.deleteFilePlanComponent(filePlanComponent.getId());
// Verify the status code // Verify the status code
restWrapper.assertStatusCodeIs(NO_CONTENT); restWrapper.assertStatusCodeIs(NO_CONTENT);
// deleted component should no longer be retrievable // Deleted component should no longer be retrievable
filePlanComponentApi.getFilePlanComponent(filePlanComponent.getId()); filePlanComponentAPI.getFilePlanComponent(filePlanComponent.getId());
restWrapper.assertStatusCodeIs(NOT_FOUND); restWrapper.assertStatusCodeIs(NOT_FOUND);
} }
@@ -221,17 +223,17 @@ public class RecordCategoryTest extends BaseRestTest
) )
public void createSubcategory() throws Exception public void createSubcategory() throws Exception
{ {
// create root level category // Create root level category
FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), RandomData.getRandomAlphanumeric()); FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), getRandomAlphanumeric());
assertNotNull(rootCategory.getId()); assertNotNull(rootCategory.getId());
// create subcategory as a child of rootCategory // Create subcategory as a child of rootCategory
FilePlanComponent childCategory = createCategory(rootCategory.getId(), RandomData.getRandomAlphanumeric()); FilePlanComponent childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric());
// child category created? // Child category created?
assertNotNull(childCategory.getId()); assertNotNull(childCategory.getId());
// verify child category // Verify child category
assertEquals(childCategory.getParentId(), rootCategory.getId()); assertEquals(childCategory.getParentId(), rootCategory.getId());
assertTrue(childCategory.isIsCategory()); assertTrue(childCategory.isIsCategory());
assertFalse(childCategory.isIsFile()); assertFalse(childCategory.isIsFile());
@@ -253,57 +255,61 @@ public class RecordCategoryTest extends BaseRestTest
) )
public void listChildren() throws Exception public void listChildren() throws Exception
{ {
// create root level category // Create root level category
FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), RandomData.getRandomAlphanumeric()); FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS.toString(), getRandomAlphanumeric());
assertNotNull(rootCategory.getId()); assertNotNull(rootCategory.getId());
// add child categories/folders // Add child categories/folders
ArrayList<FilePlanComponent> children = new ArrayList<FilePlanComponent>(); ArrayList<FilePlanComponent> children = new ArrayList<FilePlanComponent>();
for (int i=0; i < NUMBER_OF_CHILDREN; i++) for (int i=0; i < NUMBER_OF_CHILDREN; i++)
{ {
// create a child // Create a child
FilePlanComponent child = createComponent(rootCategory.getId(), FilePlanComponent child = createComponent(rootCategory.getId(),
RandomData.getRandomAlphanumeric(), getRandomAlphanumeric(),
// half of the children should be subcategories, the other subfolders // half of the children should be subcategories, the other subfolders
(i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE); (i <= NUMBER_OF_CHILDREN / 2) ? RECORD_CATEGORY_TYPE : RECORD_FOLDER_TYPE);
assertNotNull(child.getId()); assertNotNull(child.getId());
children.add(child); children.add(child);
} }
// list children from API // Authenticate with admin user
RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
FilePlanComponentsCollection apiChildren = filePlanComponentApi.listChildComponents(rootCategory.getId());
// List children from API
FilePlanComponentsCollection apiChildren = filePlanComponentAPI.listChildComponents(rootCategory.getId());
// Check status code
restWrapper.assertStatusCodeIs(OK); restWrapper.assertStatusCodeIs(OK);
logger.info("parent: " + rootCategory.getId()); logger.info("parent: " + rootCategory.getId());
// check listed children against created list // Check listed children against created list
apiChildren.getEntries().forEach(c -> apiChildren.getEntries().forEach(c ->
{ {
FilePlanComponent filePlanComponent = c.getFilePlanComponent(); FilePlanComponent filePlanComponent = c.getFilePlanComponent();
assertNotNull(filePlanComponent.getId()); assertNotNull(filePlanComponent.getId());
logger.info("checking child " + filePlanComponent.getId()); logger.info("Checking child " + filePlanComponent.getId());
try try
{ {
// find this child in created children list // Find this child in created children list
FilePlanComponent createdComponent = children.stream() FilePlanComponent createdComponent = children.stream()
.filter(child -> child.getId().equals(filePlanComponent.getId())) .filter(child -> child.getId().equals(filePlanComponent.getId()))
.findFirst() .findFirst()
.get(); .get();
// created by // Created by
assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername()); assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
// is parent Id set correctly? // Is parent Id set correctly?
assertEquals(filePlanComponent.getParentId(), rootCategory.getId()); assertEquals(filePlanComponent.getParentId(), rootCategory.getId());
// only categories or folders have been created // Only categories or folders have been created
assertFalse(filePlanComponent.isIsFile()); assertFalse(filePlanComponent.isIsFile());
// boolean properties related to node type // Boolean properties related to node type
// only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created // Only RECORD_CATEGORY_TYPE and RECORD_FOLDER_TYPE have been created
if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE.toString())) if (filePlanComponent.getNodeType().equals(RECORD_CATEGORY_TYPE.toString()))
{ {
assertTrue(filePlanComponent.isIsCategory()); assertTrue(filePlanComponent.isIsCategory());
assertFalse(filePlanComponent.isIsRecordFolder()); assertFalse(filePlanComponent.isIsRecordFolder());
} }
@@ -313,12 +319,13 @@ public class RecordCategoryTest extends BaseRestTest
assertFalse(filePlanComponent.isIsCategory()); assertFalse(filePlanComponent.isIsCategory());
} }
// does returned object have the same contents as the created one? // Does returned object have the same contents as the created one?
assertEquals(createdComponent.getName(), filePlanComponent.getName()); assertEquals(createdComponent.getName(), filePlanComponent.getName());
assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType()); assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType());
// verify properties // Verify properties
} // FIXME: Verify properties
}
catch (NoSuchElementException e) catch (NoSuchElementException e)
{ {
fail("No child element for " + filePlanComponent.getId()); fail("No child element for " + filePlanComponent.getId());
@@ -328,8 +335,10 @@ public class RecordCategoryTest extends BaseRestTest
/** /**
* Helper method to create child category * Helper method to create child category
* @param parentCategoryId *
* @param categoryName * @param parentCategoryId The id of the parent category
* @param categoryName The name of the category
* @return The created category
* @throws Exception on unsuccessful component creation * @throws Exception on unsuccessful component creation
*/ */
private FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception private FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
@@ -339,15 +348,16 @@ public class RecordCategoryTest extends BaseRestTest
/** /**
* Helper method to create generic child component * Helper method to create generic child component
* @param parentComponentId *
* @param componentName * @param parentComponentId The id of the parent file plan component
* @param componentType * @param componentName The name of the file plan component
* @return * @param componentType The name of the file plan component
* @return The created file plan component
* @throws Exception * @throws Exception
*/ */
private FilePlanComponent createComponent(String parentComponentId, String componentName, FilePlanComponentType componentType) throws Exception private FilePlanComponent createComponent(String parentComponentId, String componentName, FilePlanComponentType componentType) throws Exception
{ {
RestWrapper restWrapper = filePlanComponentApi.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = filePlanComponentAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
JsonObject componentProperties = buildObject(). JsonObject componentProperties = buildObject().
add(NAME, componentName). add(NAME, componentName).
@@ -357,7 +367,7 @@ public class RecordCategoryTest extends BaseRestTest
end(). end().
getJson(); getJson();
FilePlanComponent fpc = filePlanComponentApi.createFilePlanComponent(componentProperties, parentComponentId); FilePlanComponent fpc = filePlanComponentAPI.createFilePlanComponent(componentProperties, parentComponentId);
restWrapper.assertStatusCodeIs(CREATED); restWrapper.assertStatusCodeIs(CREATED);
return fpc; return fpc;
} }

View File

@@ -11,14 +11,14 @@
*/ */
package org.alfresco.rest.site; package org.alfresco.rest.site;
import static org.alfresco.com.site.RMSiteCompliance.DOD5015; import static org.alfresco.rest.base.TestData.ANOTHER_ADMIN;
import static org.alfresco.com.site.RMSiteCompliance.STANDARD; import static org.alfresco.rest.base.TestData.DEFAULT_EMAIL;
import static org.alfresco.com.site.RMSiteFields.COMPLIANCE; import static org.alfresco.rest.base.TestData.DEFAULT_PASSWORD;
import static org.alfresco.com.site.RMSiteFields.DESCRIPTION; import static org.alfresco.rest.model.site.RMSiteCompliance.DOD5015;
import static org.alfresco.com.site.RMSiteFields.TITLE; import static org.alfresco.rest.model.site.RMSiteCompliance.STANDARD;
import static org.alfresco.rest.TestData.ANOTHER_ADMIN; import static org.alfresco.rest.model.site.RMSiteFields.COMPLIANCE;
import static org.alfresco.rest.TestData.DEFAULT_EMAIL; import static org.alfresco.rest.model.site.RMSiteFields.DESCRIPTION;
import static org.alfresco.rest.TestData.DEFAULT_PASSWORD; import static org.alfresco.rest.model.site.RMSiteFields.TITLE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject; import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CONFLICT; import static org.springframework.http.HttpStatus.CONFLICT;
@@ -34,10 +34,12 @@ import static org.testng.Assert.assertNotNull;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import org.alfresco.dataprep.UserService; import org.alfresco.dataprep.UserService;
import org.alfresco.rest.BaseRestTest; import org.alfresco.rest.base.BaseRestTest;
import org.alfresco.rest.core.RestWrapper; import org.alfresco.rest.core.RestWrapper;
import org.alfresco.rest.model.site.RMSite; import org.alfresco.rest.model.site.RMSite;
import org.alfresco.rest.requests.RMSiteAPI;
import org.alfresco.utility.constants.UserRole; import org.alfresco.utility.constants.UserRole;
import org.alfresco.utility.data.DataUser;
import org.alfresco.utility.data.RandomData; import org.alfresco.utility.data.RandomData;
import org.alfresco.utility.model.UserModel; import org.alfresco.utility.model.UserModel;
import org.alfresco.utility.report.Bug; import org.alfresco.utility.report.Bug;
@@ -56,12 +58,16 @@ public class RMSiteTests extends BaseRestTest
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired
private RMSiteAPI rmSiteAPI;
@Autowired
private DataUser dataUser;
/** /**
* Given that RM module is installed * Given that RM module is installed
* When I want to create the rm site with specific title, description and compliance * When I want to create the RM site with specific title, description and compliance
* Then the RM site is created * Then the RM site is created
*
*/ */
@Test @Test
( (
@@ -69,12 +75,16 @@ public class RMSiteTests extends BaseRestTest
) )
public void createRMSiteAsAdminUser() throws Exception public void createRMSiteAsAdminUser() throws Exception
{ {
// Authenticate with admin user
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
if (siteRMExist())
// Check if the RM site exists
if (siteRMExists())
{ {
// Delete the RM site // Delete the RM site
rmSiteAPI.deleteRMSite(); rmSiteAPI.deleteRMSite();
} }
// Build the RM site properties // Build the RM site properties
JsonObject rmSiteProperties = buildObject() JsonObject rmSiteProperties = buildObject()
.add(TITLE, RM_TITLE) .add(TITLE, RM_TITLE)
@@ -108,8 +118,10 @@ public class RMSiteTests extends BaseRestTest
) )
public void createRMSiteWhenSiteExists() throws Exception public void createRMSiteWhenSiteExists() throws Exception
{ {
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); // Create the RM site if it does not exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
// Authenticate with admin user
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Construct new properties // Construct new properties
@@ -141,6 +153,7 @@ public class RMSiteTests extends BaseRestTest
) )
public void deleteRMSite() throws Exception public void deleteRMSite() throws Exception
{ {
// Authenticate with admin user
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Delete the RM site // Delete the RM site
@@ -161,13 +174,14 @@ public class RMSiteTests extends BaseRestTest
) )
public void getRMSite() throws Exception public void getRMSite() throws Exception
{ {
// Authenticate with admin user
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Get the RM site // Get the RM site
RMSite rmSite = rmSiteAPI.getSite(); RMSite rmSite = rmSiteAPI.getSite();
if (!siteRMExist()) if (!siteRMExists())
{ {
// Verify the status code when rm site doesn't exist // Verify the status code when RM site doesn't exist
restWrapper.assertStatusCodeIs(NOT_FOUND); restWrapper.assertStatusCodeIs(NOT_FOUND);
createRMSiteIfNotExists(); createRMSiteIfNotExists();
} }
@@ -194,13 +208,20 @@ public class RMSiteTests extends BaseRestTest
@Bug (id="RM-4289") @Bug (id="RM-4289")
public void createRMSiteAsAnotherAdminUser() throws Exception public void createRMSiteAsAnotherAdminUser() throws Exception
{ {
// Authenticate with admin user
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
if (siteRMExist())
// Check if the RM site exists
if (siteRMExists())
{ {
//Delete the RM site // Delete the RM site
rmSiteAPI.deleteRMSite(); rmSiteAPI.deleteRMSite();
} }
// Disconnect the current user from the API session
rmSiteAPI.usingRestWrapper().disconnect(); rmSiteAPI.usingRestWrapper().disconnect();
// Create user
userService.create(dataUser.getAdminUser().getUsername(), userService.create(dataUser.getAdminUser().getUsername(),
dataUser.getAdminUser().getPassword(), dataUser.getAdminUser().getPassword(),
ANOTHER_ADMIN, ANOTHER_ADMIN,
@@ -208,8 +229,13 @@ public class RMSiteTests extends BaseRestTest
DEFAULT_EMAIL, DEFAULT_EMAIL,
ANOTHER_ADMIN, ANOTHER_ADMIN,
ANOTHER_ADMIN); ANOTHER_ADMIN);
UserModel userModel=new UserModel(ANOTHER_ADMIN,DEFAULT_PASSWORD);
// Build the user model
UserModel userModel = new UserModel(ANOTHER_ADMIN,DEFAULT_PASSWORD);
// Authenticate as that new user
rmSiteAPI.usingRestWrapper().authenticateUser(userModel); rmSiteAPI.usingRestWrapper().authenticateUser(userModel);
// Build the RM site properties // Build the RM site properties
JsonObject rmSiteProperties = buildObject() JsonObject rmSiteProperties = buildObject()
.add(TITLE, RM_TITLE) .add(TITLE, RM_TITLE)
@@ -251,14 +277,19 @@ public class RMSiteTests extends BaseRestTest
.add(DESCRIPTION, NEW_DESCRIPTION) .add(DESCRIPTION, NEW_DESCRIPTION)
.getJson(); .getJson();
// Authenticate with admin user
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
if (!siteRMExist())
{
createRMSiteIfNotExists();
}
// Create the site if it does not exist
createRMSiteIfNotExists();
// Disconnect the user from the API session
rmSiteAPI.usingRestWrapper().disconnect(); rmSiteAPI.usingRestWrapper().disconnect();
// Create a random user
UserModel nonRMuser = dataUser.createRandomTestUser("testUser"); UserModel nonRMuser = dataUser.createRandomTestUser("testUser");
// Authenticate as that random user
rmSiteAPI.usingRestWrapper().authenticateUser(nonRMuser); rmSiteAPI.usingRestWrapper().authenticateUser(nonRMuser);
// Create the RM site // Create the RM site
@@ -267,7 +298,10 @@ public class RMSiteTests extends BaseRestTest
// Verify the status code // Verify the status code
rmSiteAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN); rmSiteAPI.usingRestWrapper().assertStatusCodeIs(FORBIDDEN);
// Disconnect the user from the API session
rmSiteAPI.usingRestWrapper().disconnect(); rmSiteAPI.usingRestWrapper().disconnect();
// Authenticate with admin user
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Update the RM Site // Update the RM Site
@@ -284,7 +318,6 @@ public class RMSiteTests extends BaseRestTest
assertEquals(rmSite.getVisibility(), PUBLIC); assertEquals(rmSite.getVisibility(), PUBLIC);
} }
/** /**
* Given that RM site exist * Given that RM site exist
* When the admin user wants to update the RM site compliance * When the admin user wants to update the RM site compliance
@@ -293,19 +326,21 @@ public class RMSiteTests extends BaseRestTest
@Test @Test
public void updateRMSiteComplianceAsAdmin() throws Exception public void updateRMSiteComplianceAsAdmin() throws Exception
{ {
// Authenticate with admin user
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser()); rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
if (!siteRMExist())
{ // Create the RM site if it does not exist
createRMSiteIfNotExists(); createRMSiteIfNotExists();
}
// Build the RM site properties // Build the RM site properties
JsonObject rmSiteToUpdate = buildObject() JsonObject rmSiteToUpdate = buildObject()
.add(COMPLIANCE, DOD5015.toString()) .add(COMPLIANCE, DOD5015.toString())
.getJson(); .getJson();
// Update the RM site // Update the RM site
RMSite rmSite = rmSiteAPI.updateRMSite(rmSiteToUpdate); rmSiteAPI.updateRMSite(rmSiteToUpdate);
// Verify the response status code // Verify the response status code
rmSiteAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST); rmSiteAPI.usingRestWrapper().assertStatusCodeIs(BAD_REQUEST);
} }
} }

View File

@@ -2,16 +2,16 @@
# Original property values from default.properties # # Original property values from default.properties #
######################################################################### #########################################################################
# dataprep related # Dataprep related
alfresco.scheme=http alfresco.scheme=http
alfresco.server=localhost alfresco.server=localhost
alfresco.port=8080 alfresco.port=8080
# credentials # Credentials
admin.user=admin admin.user=admin
admin.password=admin admin.password=admin
# rest related # Rest related
rest.basePath=alfresco/api/-default-/public/alfresco/versions/1 rest.basePath=alfresco/api/-default-/public/alfresco/versions/1
rest.workflowPath=alfresco/api/-default-/public/workflow/versions/1 rest.workflowPath=alfresco/api/-default-/public/workflow/versions/1