mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4488 (Refactor REST API Automation test code according to the latest changes)
This commit is contained in:
@@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Extends {@link RestProperties} to be able to change/add properties
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
|
@@ -33,7 +33,7 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Extends {@link RestWrapper} in order to call IG APIs with our own properties
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
|
@@ -56,7 +56,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class FilePlanComponentModel extends TestModel
|
public class FilePlanComponent extends TestModel
|
||||||
{
|
{
|
||||||
@JsonProperty (required = true)
|
@JsonProperty (required = true)
|
||||||
private String id;
|
private String id;
|
@@ -49,8 +49,8 @@ import lombok.NoArgsConstructor;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class FilePlanComponentEntry extends RestModels<FilePlanComponentModel, FilePlanComponentEntry>
|
public class FilePlanComponentEntry extends RestModels<FilePlanComponent, FilePlanComponentEntry>
|
||||||
{
|
{
|
||||||
@JsonProperty(ENTRY)
|
@JsonProperty(ENTRY)
|
||||||
FilePlanComponentModel filePlanComponentModel;
|
FilePlanComponent filePlanComponentModel;
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,7 @@ public class FilePlanComponentProperties
|
|||||||
|
|
||||||
@JsonProperty(PROPERTIES_REVIEW_PERIOD)
|
@JsonProperty(PROPERTIES_REVIEW_PERIOD)
|
||||||
@JsonSerialize (using = ReviewPeriodSerializer.class)
|
@JsonSerialize (using = ReviewPeriodSerializer.class)
|
||||||
private ReviewPeriod reviewPeriod;
|
private FilePlanComponentReviewPeriod reviewPeriod;
|
||||||
|
|
||||||
@JsonProperty(PROPERTIES_LOCATION)
|
@JsonProperty(PROPERTIES_LOCATION)
|
||||||
private String location;
|
private String location;
|
||||||
|
@@ -32,7 +32,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POJO for the review period
|
* POJO for the file plan component review period
|
||||||
*
|
*
|
||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
@@ -41,7 +41,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ReviewPeriod
|
public class FilePlanComponentReviewPeriod
|
||||||
{
|
{
|
||||||
private String periodType;
|
private String periodType;
|
||||||
private String expression;
|
private String expression;
|
@@ -49,7 +49,7 @@ import lombok.NoArgsConstructor;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class RMSiteModel extends RestSiteModel
|
public class RMSite extends RestSiteModel
|
||||||
{
|
{
|
||||||
@JsonProperty (value = COMPLIANCE, required = true)
|
@JsonProperty (value = COMPLIANCE, required = true)
|
||||||
private RMSiteCompliance compliance;
|
private RMSiteCompliance compliance;
|
@@ -30,7 +30,7 @@ import org.alfresco.rest.core.RMRestWrapper;
|
|||||||
import org.alfresco.rest.requests.ModelRequest;
|
import org.alfresco.rest.requests.ModelRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Extends {@link ModelRequest} to set {@link RMRestWrapper}
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.community.requests;
|
package org.alfresco.rest.rm.community.requests.igCoreAPI;
|
||||||
|
|
||||||
import static com.jayway.restassured.RestAssured.basic;
|
import static com.jayway.restassured.RestAssured.basic;
|
||||||
import static com.jayway.restassured.RestAssured.given;
|
import static com.jayway.restassured.RestAssured.given;
|
||||||
@@ -53,22 +53,25 @@ import com.jayway.restassured.http.ContentType;
|
|||||||
import com.jayway.restassured.response.Response;
|
import com.jayway.restassured.response.Response;
|
||||||
|
|
||||||
import org.alfresco.rest.core.RMRestWrapper;
|
import org.alfresco.rest.core.RMRestWrapper;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
||||||
|
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* File plan component REST API Wrapper
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class FilePlanComponents extends RMModelRequest
|
public class FilePlanComponentAPI extends RMModelRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
* @param restWrapper
|
* @param restWrapper
|
||||||
*/
|
*/
|
||||||
public FilePlanComponents(RMRestWrapper rmRestWrapper)
|
public FilePlanComponentAPI(RMRestWrapper rmRestWrapper)
|
||||||
{
|
{
|
||||||
super(rmRestWrapper);
|
super(rmRestWrapper);
|
||||||
}
|
}
|
||||||
@@ -77,7 +80,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* Get a file plan component
|
* Get a file plan component
|
||||||
*
|
*
|
||||||
* @param filePlanComponentId The id of the file plan component to get
|
* @param filePlanComponentId The id of the file plan component to get
|
||||||
* @return The {@link FilePlanComponentModel} for the given file plan component id
|
* @return The {@link FilePlanComponent} for the given file plan component id
|
||||||
* @throws Exception for the following cases:
|
* @throws Exception for the following cases:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@code fileplanComponentId} is not a valid format</li>
|
* <li>{@code fileplanComponentId} is not a valid format</li>
|
||||||
@@ -85,7 +88,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* <li>{@code fileplanComponentId} does not exist</li>
|
* <li>{@code fileplanComponentId} does not exist</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId) throws Exception
|
public FilePlanComponent getFilePlanComponent(String filePlanComponentId) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||||
|
|
||||||
@@ -93,18 +96,23 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Get a file plan component
|
||||||
*
|
*
|
||||||
* @param filePlanComponentId FIXME!!!
|
* @param filePlanComponentId The id of the file plan component to get
|
||||||
* @param parameters FIXME!!!
|
* @param parameters The URL parameters to add
|
||||||
* @return FIXME!!!
|
* @return The {@link FilePlanComponent} for the given file plan component id
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception for the following cases:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@code fileplanComponentId} is not a valid format</li>
|
||||||
|
* <li>authentication fails</li>
|
||||||
|
* <li>{@code fileplanComponentId} does not exist</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel getFilePlanComponent(String filePlanComponentId, String parameters) throws Exception
|
public FilePlanComponent getFilePlanComponent(String filePlanComponentId, String parameters) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||||
|
|
||||||
return getRMRestWrapper().processModel(FilePlanComponentModel.class, simpleRequest(
|
return getRMRestWrapper().processModel(FilePlanComponent.class, simpleRequest(
|
||||||
GET,
|
GET,
|
||||||
"fileplan-components/{fileplanComponentId}?{parameters}",
|
"fileplan-components/{fileplanComponentId}?{parameters}",
|
||||||
filePlanComponentId,
|
filePlanComponentId,
|
||||||
@@ -140,7 +148,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
*
|
*
|
||||||
* @param filePlanComponentModel The properties of the file plan component to be created
|
* @param filePlanComponentModel The properties of the file plan component to be created
|
||||||
* @param parentId The id of the parent where the new file plan component should be created
|
* @param parentId The id of the parent where the new file plan component should be created
|
||||||
* @return The {@link FilePlanComponentModel} with the given properties
|
* @return The {@link FilePlanComponent} with the given properties
|
||||||
* @throws Exception for the following cases:
|
* @throws Exception for the following cases:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@code fileplanComponentId} is not a valid format</li>
|
* <li>{@code fileplanComponentId} is not a valid format</li>
|
||||||
@@ -151,7 +159,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* <li>model integrity exception, including node name with invalid characters</li>
|
* <li>model integrity exception, including node name with invalid characters</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId) throws Exception
|
public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
||||||
mandatoryString("parentId", parentId);
|
mandatoryString("parentId", parentId);
|
||||||
@@ -160,26 +168,34 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a file plan component with the given properties under the parent node with the given id
|
||||||
*
|
*
|
||||||
* @param filePlanComponentModel FIXME!!!
|
* @param filePlanComponentModel The properties of the file plan component to be created
|
||||||
* @param parentId FIXME!!!
|
* @param parameters The URL parameters to add
|
||||||
* @param parameters FIXME!!!
|
* @param parentId The id of the parent where the new file plan component should be created
|
||||||
* @return FIXME!!!
|
* @return The {@link FilePlanComponent} with the given properties
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception for the following cases:
|
||||||
|
* <ul>
|
||||||
|
* <li>{@code fileplanComponentId} is not a valid format</li>
|
||||||
|
* <li>authentication fails</li>
|
||||||
|
* <li>current user does not have permission to add children to {@code fileplanComponentId}</li>
|
||||||
|
* <li>{@code fileplanComponentId} does not exist</li>
|
||||||
|
* <li>new name clashes with an existing node in the current parent container</li>
|
||||||
|
* <li>model integrity exception, including node name with invalid characters</li>
|
||||||
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String parentId, String parameters) throws Exception
|
public FilePlanComponent createFilePlanComponent(FilePlanComponent filePlanComponentModel, String parentId, String parameters) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
||||||
mandatoryString("parentId", parentId);
|
mandatoryString("parentId", parentId);
|
||||||
|
|
||||||
return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody(
|
return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
|
||||||
POST,
|
POST,
|
||||||
toJson(filePlanComponentModel),
|
toJson(filePlanComponentModel),
|
||||||
"fileplan-components/{fileplanComponentId}/children?{parameters}",
|
"fileplan-components/{fileplanComponentId}/children?{parameters}",
|
||||||
parentId,
|
parentId,
|
||||||
parameters
|
parameters
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,7 +206,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* @return newly created {@link FilePlanComponent}
|
* @return newly created {@link FilePlanComponent}
|
||||||
* @throws Exception if operation failed
|
* @throws Exception if operation failed
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, String fileName, String parentId) throws Exception
|
public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, String fileName, String parentId) throws Exception
|
||||||
{
|
{
|
||||||
return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId);
|
return createElectronicRecord(electronicRecordModel, new File(Resources.getResource(fileName).getFile()), parentId);
|
||||||
}
|
}
|
||||||
@@ -203,7 +219,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* @return newly created {@link FilePlanComponent}
|
* @return newly created {@link FilePlanComponent}
|
||||||
* @throws Exception if operation failed
|
* @throws Exception if operation failed
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createElectronicRecord(FilePlanComponentModel electronicRecordModel, File recordContent, String parentId) throws Exception
|
public FilePlanComponent createElectronicRecord(FilePlanComponent electronicRecordModel, File recordContent, String parentId) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("electronicRecordModel", electronicRecordModel);
|
mandatoryObject("electronicRecordModel", electronicRecordModel);
|
||||||
mandatoryString("parentId", parentId);
|
mandatoryString("parentId", parentId);
|
||||||
@@ -245,7 +261,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
|
getRMRestWrapper().setStatusCode(Integer.toString(response.getStatusCode()));
|
||||||
|
|
||||||
/* return a FilePlanComponent object representing Response */
|
/* return a FilePlanComponent object representing Response */
|
||||||
return response.jsonPath().getObject("entry", FilePlanComponentModel.class);
|
return response.jsonPath().getObject("entry", FilePlanComponent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,7 +280,7 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
* <li>model integrity exception, including node name with invalid characters</li>
|
* <li>model integrity exception, including node name with invalid characters</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponentModel, String filePlanComponentId) throws Exception
|
public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponentModel, String filePlanComponentId) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
mandatoryObject("filePlanComponentProperties", filePlanComponentModel);
|
||||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||||
@@ -272,18 +288,35 @@ public class FilePlanComponents extends RMModelRequest
|
|||||||
return updateFilePlanComponent(filePlanComponentModel, filePlanComponentId, EMPTY);
|
return updateFilePlanComponent(filePlanComponentModel, filePlanComponentId, EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FilePlanComponentModel updateFilePlanComponent(FilePlanComponentModel filePlanComponent, String filePlanComponentId, String parameters) throws Exception
|
/**
|
||||||
|
* Updates a file plan component
|
||||||
|
*
|
||||||
|
* @param filePlanComponentModel The properties to be updated
|
||||||
|
* @param parameters The URL parameters to add
|
||||||
|
* @param filePlanComponentId The id of the file plan component which will be updated
|
||||||
|
* @param returns The updated {@link FilePlanComponent}
|
||||||
|
* @throws Exception for the following cases:
|
||||||
|
* <ul>
|
||||||
|
* <li>the update request is invalid or {@code fileplanComponentId} is not a valid format or {@code filePlanComponentProperties} is invalid</li>
|
||||||
|
* <li>authentication fails</li>
|
||||||
|
* <li>current user does not have permission to update {@code fileplanComponentId}</li>
|
||||||
|
* <li>{@code fileplanComponentId} does not exist</li>
|
||||||
|
* <li>the updated name clashes with an existing node in the current parent folder</li>
|
||||||
|
* <li>model integrity exception, including node name with invalid characters</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public FilePlanComponent updateFilePlanComponent(FilePlanComponent filePlanComponent, String filePlanComponentId, String parameters) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("filePlanComponentProperties", filePlanComponent);
|
mandatoryObject("filePlanComponentProperties", filePlanComponent);
|
||||||
mandatoryString("filePlanComponentId", filePlanComponentId);
|
mandatoryString("filePlanComponentId", filePlanComponentId);
|
||||||
|
|
||||||
return getRMRestWrapper().processModel(FilePlanComponentModel.class, requestWithBody(
|
return getRMRestWrapper().processModel(FilePlanComponent.class, requestWithBody(
|
||||||
PUT,
|
PUT,
|
||||||
toJson(filePlanComponent),
|
toJson(filePlanComponent),
|
||||||
"fileplan-components/{fileplanComponentId}?{parameters}",
|
"fileplan-components/{fileplanComponentId}?{parameters}",
|
||||||
filePlanComponentId,
|
filePlanComponentId,
|
||||||
parameters
|
parameters
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@@ -24,7 +24,7 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.community.requests;
|
package org.alfresco.rest.rm.community.requests.igCoreAPI;
|
||||||
|
|
||||||
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;
|
||||||
@@ -37,20 +37,23 @@ import static org.springframework.http.HttpMethod.PUT;
|
|||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
import org.alfresco.rest.core.RMRestWrapper;
|
import org.alfresco.rest.core.RMRestWrapper;
|
||||||
import org.alfresco.rest.rm.community.model.site.RMSiteModel;
|
import org.alfresco.rest.rm.community.model.site.RMSite;
|
||||||
|
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* RM Site REST API Wrapper
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class RMSite extends RMModelRequest
|
public class RMSiteAPI extends RMModelRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param restWrapper
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param rmRestWrapper RM REST Wrapper
|
||||||
*/
|
*/
|
||||||
public RMSite(RMRestWrapper rmRestWrapper)
|
public RMSiteAPI(RMRestWrapper rmRestWrapper)
|
||||||
{
|
{
|
||||||
super(rmRestWrapper);
|
super(rmRestWrapper);
|
||||||
}
|
}
|
||||||
@@ -58,7 +61,7 @@ public class RMSite extends RMModelRequest
|
|||||||
/**
|
/**
|
||||||
* Get the RM site
|
* Get the RM site
|
||||||
*
|
*
|
||||||
* @return The {@link RMSiteModel} for the given file plan component id
|
* @return The {@link RMSite} for the given file plan component id
|
||||||
* @throws Exception for the following cases:
|
* @throws Exception for the following cases:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Api Response code 400 Invalid parameter: GET request is supported only for the RM site</li>
|
* <li>Api Response code 400 Invalid parameter: GET request is supported only for the RM site</li>
|
||||||
@@ -67,9 +70,9 @@ public class RMSite extends RMModelRequest
|
|||||||
* <li>Api Response code default Unexpected error</li>
|
* <li>Api Response code default Unexpected error</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public RMSiteModel getSite() throws Exception
|
public RMSite getSite() throws Exception
|
||||||
{
|
{
|
||||||
return getRMRestWrapper().processModel(RMSiteModel.class, simpleRequest(
|
return getRMRestWrapper().processModel(RMSite.class, simpleRequest(
|
||||||
GET,
|
GET,
|
||||||
"ig-sites/rm"
|
"ig-sites/rm"
|
||||||
));
|
));
|
||||||
@@ -79,7 +82,7 @@ public class RMSite extends RMModelRequest
|
|||||||
* Create the RM site
|
* Create the RM site
|
||||||
*
|
*
|
||||||
* @param rmSite The properties of the rm site to be created
|
* @param rmSite The properties of the rm site to be created
|
||||||
* @return The {@link RMSiteModel} with the given properties
|
* @return The {@link RMSite} with the given properties
|
||||||
* @throws Exception for the following cases:
|
* @throws Exception for the following cases:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid</li>
|
* <li>Api Response code 400 Invalid parameter: title, or description exceed the maximum length; or siteBodyCreate invalid</li>
|
||||||
@@ -88,11 +91,11 @@ public class RMSite extends RMModelRequest
|
|||||||
* <li>Api Response code default Unexpected error</li>
|
* <li>Api Response code default Unexpected error</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public RMSiteModel createRMSite(RMSiteModel rmSiteModel) throws Exception
|
public RMSite createRMSite(RMSite rmSiteModel) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("rmSiteModel", rmSiteModel);
|
mandatoryObject("rmSiteModel", rmSiteModel);
|
||||||
|
|
||||||
return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody(
|
return getRMRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||||
POST,
|
POST,
|
||||||
toJson(rmSiteModel),
|
toJson(rmSiteModel),
|
||||||
"ig-sites"
|
"ig-sites"
|
||||||
@@ -122,7 +125,7 @@ public class RMSite extends RMModelRequest
|
|||||||
* Update RM site
|
* Update RM site
|
||||||
*
|
*
|
||||||
* @param rmSiteProperties The properties to be updated
|
* @param rmSiteProperties The properties to be updated
|
||||||
* @return The updated {@link RMSiteModel}
|
* @return The updated {@link RMSite}
|
||||||
* @throws Exception for the following cases:
|
* @throws Exception for the following cases:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid</li>
|
* <li>Api Response code 400 the update request is invalid {@code rmSiteModel} is invalid</li>
|
||||||
@@ -132,11 +135,11 @@ public class RMSite extends RMModelRequest
|
|||||||
* <li>Api Response code default Unexpected error,model integrity exception</li>
|
* <li>Api Response code default Unexpected error,model integrity exception</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public RMSiteModel updateRMSite(RMSiteModel rmSiteModel) throws Exception
|
public RMSite updateRMSite(RMSite rmSiteModel) throws Exception
|
||||||
{
|
{
|
||||||
mandatoryObject("rmSiteProperties", rmSiteModel);
|
mandatoryObject("rmSiteProperties", rmSiteModel);
|
||||||
|
|
||||||
return getRMRestWrapper().processModel(RMSiteModel.class, requestWithBody(
|
return getRMRestWrapper().processModel(RMSite.class, requestWithBody(
|
||||||
PUT,
|
PUT,
|
||||||
toJson(rmSiteModel),
|
toJson(rmSiteModel),
|
||||||
"ig-sites/rm"
|
"ig-sites/rm"
|
@@ -24,7 +24,7 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.community.requests;
|
package org.alfresco.rest.rm.community.requests.igCoreAPI;
|
||||||
|
|
||||||
import static com.jayway.restassured.RestAssured.given;
|
import static com.jayway.restassured.RestAssured.given;
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ import org.alfresco.dataprep.AlfrescoHttpClient;
|
|||||||
import org.alfresco.dataprep.AlfrescoHttpClientFactory;
|
import org.alfresco.dataprep.AlfrescoHttpClientFactory;
|
||||||
import org.alfresco.dataprep.UserService;
|
import org.alfresco.dataprep.UserService;
|
||||||
import org.alfresco.rest.core.RestAPI;
|
import org.alfresco.rest.core.RestAPI;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
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.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -100,7 +100,7 @@ public class RMUserAPI extends RestAPI<RMUserAPI>
|
|||||||
* @param user {@link UserModel} for a user to be granted permission
|
* @param user {@link UserModel} for a user to be granted permission
|
||||||
* @param permission {@link UserPermissions} to be granted
|
* @param permission {@link UserPermissions} to be granted
|
||||||
*/
|
*/
|
||||||
public void addUserPermission(FilePlanComponentModel component, UserModel user, String permission)
|
public void addUserPermission(FilePlanComponent component, UserModel user, String permission)
|
||||||
{
|
{
|
||||||
// get an "old-style" REST API client
|
// get an "old-style" REST API client
|
||||||
AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
|
AlfrescoHttpClient client = alfrescoHttpClientFactory.getObject();
|
||||||
@@ -135,10 +135,10 @@ public class RMUserAPI extends RestAPI<RMUserAPI>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a user with the given name using the old APIs
|
||||||
*
|
*
|
||||||
* @param userName FIXME!!!
|
* @param userName The user name
|
||||||
* @return FIXME!!!
|
* @return <code>true</code> if the user was created successfully, <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean createUser(String userName)
|
public boolean createUser(String userName)
|
||||||
{
|
{
|
@@ -33,9 +33,7 @@ import com.jayway.restassured.RestAssured;
|
|||||||
|
|
||||||
import org.alfresco.rest.core.RMRestProperties;
|
import org.alfresco.rest.core.RMRestProperties;
|
||||||
import org.alfresco.rest.core.RMRestWrapper;
|
import org.alfresco.rest.core.RMRestWrapper;
|
||||||
import org.alfresco.rest.rm.community.requests.FilePlanComponents;
|
|
||||||
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
import org.alfresco.rest.rm.community.requests.RMModelRequest;
|
||||||
import org.alfresco.rest.rm.community.requests.RMSite;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the entire IG Core API
|
* Defines the entire IG Core API
|
||||||
@@ -50,10 +48,10 @@ public class RestIGCoreAPI extends RMModelRequest
|
|||||||
private RMRestProperties rmRestProperties;
|
private RMRestProperties rmRestProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param rmRestWrapper FIXME!!!
|
* @param rmRestWrapper RM REST Wrapper
|
||||||
* @param rmRestProperties FIXME!!!
|
* @param rmRestProperties RM REST Properties
|
||||||
*/
|
*/
|
||||||
public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties)
|
public RestIGCoreAPI(RMRestWrapper rmRestWrapper, RMRestProperties rmRestProperties)
|
||||||
{
|
{
|
||||||
@@ -67,20 +65,20 @@ public class RestIGCoreAPI extends RMModelRequest
|
|||||||
/**
|
/**
|
||||||
* Provides DSL on all REST calls under <code>ig-sites/rm/...</code> API path
|
* Provides DSL on all REST calls under <code>ig-sites/rm/...</code> API path
|
||||||
*
|
*
|
||||||
* @return {@link RMSite}
|
* @return {@link RMSiteAPI}
|
||||||
*/
|
*/
|
||||||
public RMSite usingRMSite()
|
public RMSiteAPI usingRMSite()
|
||||||
{
|
{
|
||||||
return new RMSite(getRMRestWrapper());
|
return new RMSiteAPI(getRMRestWrapper());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Provides DSL on all REST calls under <code>fileplan-components/...</code> API path
|
||||||
*
|
*
|
||||||
* @return FIXME!!!
|
* @return {@link FilePlanComponentAPI}
|
||||||
*/
|
*/
|
||||||
public FilePlanComponents usingFilePlanComponents()
|
public FilePlanComponentAPI usingFilePlanComponents()
|
||||||
{
|
{
|
||||||
return new FilePlanComponents(getRMRestWrapper());
|
return new FilePlanComponentAPI(getRMRestWrapper());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for serializing the Review Period type
|
* Utility class for serializing the Review Period type
|
||||||
@@ -41,7 +41,7 @@ import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod;
|
|||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class ReviewPeriodSerializer extends JsonSerializer<ReviewPeriod>
|
public class ReviewPeriodSerializer extends JsonSerializer<FilePlanComponentReviewPeriod>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param value The Review Period value that is being serialized.
|
* @param value The Review Period value that is being serialized.
|
||||||
@@ -51,7 +51,7 @@ public class ReviewPeriodSerializer extends JsonSerializer<ReviewPeriod>
|
|||||||
* @throws JsonProcessingException
|
* @throws JsonProcessingException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException
|
public void serialize(FilePlanComponentReviewPeriod value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException
|
||||||
{
|
{
|
||||||
//create the custom string value for the Review Period type
|
//create the custom string value for the Review Period type
|
||||||
gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString());
|
gen.writeString(new StringBuilder().append(value.getPeriodType()).append("|").append(value.getExpression()).toString());
|
||||||
|
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.rest.rm.community.base;
|
||||||
|
|
||||||
|
import org.alfresco.rest.RestTest;
|
||||||
|
import org.alfresco.rest.core.RMRestWrapper;
|
||||||
|
import org.alfresco.rest.rm.community.requests.igCoreAPI.FilePlanComponentAPI;
|
||||||
|
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMSiteAPI;
|
||||||
|
import org.alfresco.utility.data.DataUser;
|
||||||
|
import org.alfresco.utility.model.UserModel;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class to hold the REST APIs
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.6
|
||||||
|
*/
|
||||||
|
public abstract class BaseRESTAPI extends RestTest
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private RMRestWrapper rmRestWrapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataUser dataUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The RM REST Wrapper
|
||||||
|
*
|
||||||
|
* @return the rmRestWrapper
|
||||||
|
*/
|
||||||
|
protected RMRestWrapper getRmRestWrapper()
|
||||||
|
{
|
||||||
|
return this.rmRestWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The data user service
|
||||||
|
*
|
||||||
|
* @return the dataUser
|
||||||
|
*/
|
||||||
|
protected DataUser getDataUser()
|
||||||
|
{
|
||||||
|
return this.dataUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the given {@link HttpStatus} code with the response status code
|
||||||
|
*
|
||||||
|
* @param httpStatus The {@link HttpStatus} to assert
|
||||||
|
*/
|
||||||
|
protected void assertStatusCode(HttpStatus httpStatus)
|
||||||
|
{
|
||||||
|
getRmRestWrapper().assertStatusCodeIs(httpStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the admin user
|
||||||
|
*
|
||||||
|
* @return The admin user
|
||||||
|
*/
|
||||||
|
protected UserModel getAdminUser()
|
||||||
|
{
|
||||||
|
return getDataUser().getAdminUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link RMSiteAPI} as the admin user
|
||||||
|
*
|
||||||
|
* @return {@link RMSiteAPI} with the admin credentials
|
||||||
|
*/
|
||||||
|
protected RMSiteAPI getRMSiteAPI()
|
||||||
|
{
|
||||||
|
return getRMSiteAPI(getAdminUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link RMSiteAPI} as the given user
|
||||||
|
*
|
||||||
|
* @param userModel The user model whose credentials will be used to get the API
|
||||||
|
* @return {@link RMSiteAPI} with user credentials
|
||||||
|
*/
|
||||||
|
protected RMSiteAPI getRMSiteAPI(UserModel userModel)
|
||||||
|
{
|
||||||
|
getRmRestWrapper().authenticateUser(userModel);
|
||||||
|
return getRmRestWrapper().withIGCoreAPI().usingRMSite();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@link FilePlanComponentAPI} as the admin user
|
||||||
|
*
|
||||||
|
* @return {@link FilePlanComponentAPI} with the admin credentials
|
||||||
|
*/
|
||||||
|
protected FilePlanComponentAPI getFilePlanComponentsAPI()
|
||||||
|
{
|
||||||
|
return getFilePlanComponentsAPI(getAdminUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the {@link FilePlanComponentAPI} as the given user
|
||||||
|
*
|
||||||
|
* @param userModel The user model whose credentials will be used to get the API
|
||||||
|
* @return {@link FilePlanComponentAPI} with the user credentials
|
||||||
|
*/
|
||||||
|
protected FilePlanComponentAPI getFilePlanComponentsAPI(UserModel userModel)
|
||||||
|
{
|
||||||
|
getRmRestWrapper().authenticateUser(userModel);
|
||||||
|
return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents();
|
||||||
|
}
|
||||||
|
}
|
@@ -39,16 +39,9 @@ import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
|||||||
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;
|
||||||
|
|
||||||
import org.alfresco.rest.RestTest;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.core.RMRestWrapper;
|
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.rest.rm.community.requests.FilePlanComponents;
|
|
||||||
import org.alfresco.rest.rm.community.requests.RMSite;
|
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
|
|
||||||
@@ -59,44 +52,8 @@ import org.testng.annotations.DataProvider;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class BaseRestTest extends RestTest
|
public class BaseRESTTest extends BaseRESTAPI
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
private RMRestWrapper rmRestWrapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DataUser dataUser;
|
|
||||||
|
|
||||||
protected RMSite getRMSiteAPI()
|
|
||||||
{
|
|
||||||
return getRMSiteAPI(dataUser.getAdminUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RMSite getRMSiteAPI(UserModel userModel)
|
|
||||||
{
|
|
||||||
getRmRestWrapper().authenticateUser(userModel);
|
|
||||||
return getRmRestWrapper().withIGCoreAPI().usingRMSite();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected FilePlanComponents getFilePlanComponentsAPI()
|
|
||||||
{
|
|
||||||
return getFilePlanComponentsAPI(dataUser.getAdminUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected FilePlanComponents getFilePlanComponentsAPI(UserModel userModel)
|
|
||||||
{
|
|
||||||
getRmRestWrapper().authenticateUser(userModel);
|
|
||||||
return getRmRestWrapper().withIGCoreAPI().usingFilePlanComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the rmRestWrapper
|
|
||||||
*/
|
|
||||||
protected RMRestWrapper getRmRestWrapper()
|
|
||||||
{
|
|
||||||
return this.rmRestWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Valid root containers where electronic and non-electronic records can be created */
|
/** Valid root containers where electronic and non-electronic records can be created */
|
||||||
@DataProvider(name = "validRootContainers")
|
@DataProvider(name = "validRootContainers")
|
||||||
public Object[][] getValidRootContainers() throws Exception
|
public Object[][] getValidRootContainers() throws Exception
|
||||||
@@ -123,16 +80,6 @@ public class BaseRestTest extends RestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME!!!
|
|
||||||
*
|
|
||||||
* @param httpStatus FIXME!!!
|
|
||||||
*/
|
|
||||||
protected void assertStatusCode(HttpStatus httpStatus)
|
|
||||||
{
|
|
||||||
getRmRestWrapper().assertStatusCodeIs(httpStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@@ -153,82 +100,82 @@ public class BaseRestTest extends RestTest
|
|||||||
/**
|
/**
|
||||||
* Helper method to create child category
|
* Helper method to create child category
|
||||||
*
|
*
|
||||||
* @param user user under whose privileges this structure is going to be created
|
* @param user The user under whose privileges this structure is going to be created
|
||||||
* @param parentCategoryId The id of the parent category
|
* @param parentCategoryId The id of the parent category
|
||||||
* @param categoryName The name of the category
|
* @param categoryName The name of the category
|
||||||
* @return The created category
|
* @return The created category
|
||||||
* @throws Exception on unsuccessful component creation
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createCategory(UserModel user, String parentCategoryId, String categoryName) throws Exception
|
public FilePlanComponent createCategory(UserModel user, String parentCategoryId, String categoryName) throws Exception
|
||||||
{
|
{
|
||||||
return createComponent(user, parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE);
|
return createComponent(user, parentCategoryId, categoryName, RECORD_CATEGORY_TYPE, CATEGORY_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Helper method to create child category as the admin user
|
||||||
*
|
*
|
||||||
* @param parentCategoryId FIXME!!!
|
* @param parentCategoryId The id of the parent category
|
||||||
* @param categoryName FIXME!!!
|
* @param categoryName The name of the category
|
||||||
* @return FIXME!!!
|
* @return The created category
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception
|
public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
|
||||||
{
|
{
|
||||||
return createCategory(dataUser.getAdminUser(), parentCategoryId, categoryName);
|
return createCategory(getAdminUser(), parentCategoryId, categoryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to create child folder
|
* Helper method to create child folder
|
||||||
*
|
*
|
||||||
* @param user user under whose privileges this structure is going to be created
|
* @param user The user under whose privileges this structure is going to be created
|
||||||
* @param parentCategoryId The id of the parent category
|
* @param parentCategoryId The id of the parent category
|
||||||
* @param folderName The name of the category
|
* @param folderName The name of the category
|
||||||
* @return The created category
|
* @return The created category
|
||||||
* @throws Exception on unsuccessful component creation
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createFolder(UserModel user, String parentCategoryId, String folderName) throws Exception
|
public FilePlanComponent createFolder(UserModel user, String parentCategoryId, String folderName) throws Exception
|
||||||
{
|
{
|
||||||
return createComponent(user, parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
|
return createComponent(user, parentCategoryId, folderName, RECORD_FOLDER_TYPE, FOLDER_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Helper method to create child folder as the admin user
|
||||||
*
|
*
|
||||||
* @param parentCategoryId FIXME!!!
|
* @param parentCategoryId The id of the parent category
|
||||||
* @param folderName FIXME!!!
|
* @param folderName The name of the category
|
||||||
* @return FIXME!!!
|
* @return The created category
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createFolder(String parentCategoryId, String folderName) throws Exception
|
public FilePlanComponent createFolder(String parentCategoryId, String folderName) throws Exception
|
||||||
{
|
{
|
||||||
return createFolder(dataUser.getAdminUser(), parentCategoryId, folderName);
|
return createFolder(getAdminUser(), parentCategoryId, folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to create child unfiled record folder
|
* Helper method to create child unfiled record folder
|
||||||
*
|
*
|
||||||
* @param user user under whose privileges this structure is going to be created
|
* @param user The user under whose privileges this structure is going to be created
|
||||||
* @param parentId The id of the parent folder
|
* @param parentId The id of the parent folder
|
||||||
* @param folderName The name of the folder
|
* @param folderName The name of the folder
|
||||||
* @return The created folder
|
* @return The created folder
|
||||||
* @throws Exception on unsuccessful component creation
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createUnfiledRecordsFolder(UserModel user, String parentId, String folderName) throws Exception
|
public FilePlanComponent createUnfiledRecordsFolder(UserModel user, String parentId, String folderName) throws Exception
|
||||||
{
|
{
|
||||||
return createComponent(user, parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
|
return createComponent(user, parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Helper method to create child unfiled record folder as the admin user
|
||||||
*
|
*
|
||||||
* @param parentId FIXME!!!
|
* @param parentId The id of the parent folder
|
||||||
* @param folderName FIXME!!!
|
* @param folderName The name of the folder
|
||||||
* @return FIXME!!!
|
* @return The created folder
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createUnfiledRecordsFolder(String parentId, String folderName) throws Exception
|
public FilePlanComponent createUnfiledRecordsFolder(String parentId, String folderName) throws Exception
|
||||||
{
|
{
|
||||||
return createUnfiledRecordsFolder(dataUser.getAdminUser(), parentId, folderName);
|
return createUnfiledRecordsFolder(getAdminUser(), parentId, folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -236,16 +183,16 @@ public class BaseRestTest extends RestTest
|
|||||||
*
|
*
|
||||||
* @param user user under whose privileges this structure is going to be created
|
* @param user user under whose privileges this structure is going to be created
|
||||||
* @param parentComponentId The id of the parent file plan component
|
* @param parentComponentId The id of the parent file plan component
|
||||||
* @param componentName The name of the file plan component
|
* @param componentName The name of the file plan component
|
||||||
* @param componentType The type of the file plan component
|
* @param componentType The type of the file plan component
|
||||||
* @param componentTitle The title of the file plan component
|
* @param componentTitle The title of the file plan component
|
||||||
* @return The created file plan component
|
* @return The created file plan component
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private FilePlanComponentModel createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception
|
private FilePlanComponent createComponent(UserModel user, String parentComponentId, String componentName, String componentType, String componentTitle) throws Exception
|
||||||
{
|
{
|
||||||
FilePlanComponentModel filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle);
|
FilePlanComponent filePlanComponentModel = createFilePlanComponentModel(componentName, componentType, componentTitle);
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI(user).createFilePlanComponent(filePlanComponentModel, parentComponentId);
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
return filePlanComponent;
|
return filePlanComponent;
|
||||||
@@ -253,19 +200,20 @@ public class BaseRestTest extends RestTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to close folder
|
* Helper method to close folder
|
||||||
* @param folderId
|
*
|
||||||
* @return
|
* @param folderId The id of the folder
|
||||||
|
* @return The closed folder
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel closeFolder(String folderId) throws Exception
|
protected FilePlanComponent closeFolder(String folderId) throws Exception
|
||||||
{
|
{
|
||||||
// build file plan component + properties for update request
|
// build file plan component + properties for update request
|
||||||
FilePlanComponentProperties properties = new FilePlanComponentProperties();
|
FilePlanComponentProperties properties = new FilePlanComponentProperties();
|
||||||
properties.setIsClosed(true);
|
properties.setIsClosed(true);
|
||||||
FilePlanComponentModel filePlanComponent = new FilePlanComponentModel();
|
FilePlanComponent filePlanComponent = new FilePlanComponent();
|
||||||
filePlanComponent.setProperties(properties);
|
filePlanComponent.setProperties(properties);
|
||||||
|
|
||||||
FilePlanComponentModel updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId);
|
FilePlanComponent updatedComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, folderId);
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
return updatedComponent;
|
return updatedComponent;
|
||||||
}
|
}
|
||||||
@@ -273,53 +221,54 @@ public class BaseRestTest extends RestTest
|
|||||||
/**
|
/**
|
||||||
* Helper method to create a randomly-named <category>/<folder> structure in file plan
|
* Helper method to create a randomly-named <category>/<folder> structure in file plan
|
||||||
*
|
*
|
||||||
* @param user user under whose privileges this structure is going to be created
|
* @param user The user under whose privileges this structure is going to be created
|
||||||
* @param parentId parent container id
|
* @param parentId parent container id
|
||||||
* @return record folder
|
* @return record folder
|
||||||
* @throws Exception on failed creation
|
* @throws Exception on failed creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createCategoryFolderInFilePlan(UserModel user) throws Exception
|
public FilePlanComponent createCategoryFolderInFilePlan(UserModel user) throws Exception
|
||||||
{
|
{
|
||||||
// create root category
|
// create root category
|
||||||
FilePlanComponentModel recordCategory = createCategory(user, FILE_PLAN_ALIAS, "Category " + getRandomAlphanumeric());
|
FilePlanComponent recordCategory = createCategory(user, FILE_PLAN_ALIAS, "Category " + getRandomAlphanumeric());
|
||||||
|
|
||||||
// and return a folder underneath
|
// and return a folder underneath
|
||||||
return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric());
|
return createFolder(user, recordCategory.getId(), "Folder " + getRandomAlphanumeric());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Helper method to create a randomly-named <category>/<folder> structure in file plan as the admin user
|
||||||
*
|
*
|
||||||
* @param parentId FIXME!!!
|
* @param parentId parent container id
|
||||||
* @return FIXME!!!
|
* @return record folder
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception on failed creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createCategoryFolderInFilePlan() throws Exception
|
public FilePlanComponent createCategoryFolderInFilePlan() throws Exception
|
||||||
{
|
{
|
||||||
return createCategoryFolderInFilePlan(dataUser.getAdminUser());
|
return createCategoryFolderInFilePlan(getAdminUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to retrieve a file plan component with user's privilege
|
* Helper method to retrieve a file plan component with user's privilege
|
||||||
|
*
|
||||||
* @param user user under whose privileges a component is to be read
|
* @param user user under whose privileges a component is to be read
|
||||||
* @param componentId id of the component to read
|
* @param componentId id of the component to read
|
||||||
* @return {@link FilePlanComponent} for given componentId
|
* @return {@link FilePlanComponent} for given componentId
|
||||||
* @throws Exception if user doesn't have sufficient privileges
|
* @throws Exception if user doesn't have sufficient privileges
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception
|
public FilePlanComponent getFilePlanComponentAsUser(UserModel user, String componentId) throws Exception
|
||||||
{
|
{
|
||||||
return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId);
|
return getFilePlanComponentsAPI(user).getFilePlanComponent(componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Helper method to retrieve a file plan component with user's privilege as the admin user
|
||||||
*
|
*
|
||||||
* @param componentId FIXME!!!
|
* @param componentId id of the component to read
|
||||||
* @return FIXME!!!
|
* @return {@link FilePlanComponent} for given componentId
|
||||||
* @throws Exception FIXME!!!
|
* @throws Exception if user doesn't have sufficient privileges
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel getFilePlanComponent(String componentId) throws Exception
|
public FilePlanComponent getFilePlanComponent(String componentId) throws Exception
|
||||||
{
|
{
|
||||||
return getFilePlanComponentAsUser(dataUser.getAdminUser(), componentId);
|
return getFilePlanComponentAsUser(getAdminUser(), componentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -36,11 +36,11 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
|
|||||||
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.user.UserPermissions;
|
import org.alfresco.rest.rm.community.model.user.UserPermissions;
|
||||||
import org.alfresco.rest.rm.community.model.user.UserRoles;
|
import org.alfresco.rest.rm.community.model.user.UserRoles;
|
||||||
import org.alfresco.rest.rm.community.requests.RMUserAPI;
|
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
|
||||||
import org.alfresco.test.AlfrescoTest;
|
import org.alfresco.test.AlfrescoTest;
|
||||||
import org.alfresco.utility.constants.UserRole;
|
import org.alfresco.utility.constants.UserRole;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
@@ -58,7 +58,7 @@ import org.testng.annotations.Test;
|
|||||||
* @author Kristijan Conkas
|
* @author Kristijan Conkas
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class DeleteRecordTests extends BaseRestTest
|
public class DeleteRecordTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private RMUserAPI rmUserAPI;
|
private RMUserAPI rmUserAPI;
|
||||||
@@ -84,9 +84,9 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
description = "Admin user can delete an electronic record"
|
description = "Admin user can delete an electronic record"
|
||||||
)
|
)
|
||||||
@AlfrescoTest(jira="RM-4363")
|
@AlfrescoTest(jira="RM-4363")
|
||||||
public void adminCanDeleteElectronicRecord(FilePlanComponentModel container) throws Exception
|
public void adminCanDeleteElectronicRecord(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
|
FilePlanComponent newRecord = getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
|
||||||
|
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
@@ -111,10 +111,10 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
description = "Admin user can delete a non-electronic record"
|
description = "Admin user can delete a non-electronic record"
|
||||||
)
|
)
|
||||||
@AlfrescoTest(jira="RM-4363")
|
@AlfrescoTest(jira="RM-4363")
|
||||||
public void adminCanDeleteNonElectronicRecord(FilePlanComponentModel container) throws Exception
|
public void adminCanDeleteNonElectronicRecord(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
// create a non-electronic record
|
// create a non-electronic record
|
||||||
FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
|
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), container.getId());
|
||||||
|
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
public void userWithoutWritePermissionsCantDeleteRecord() throws Exception
|
public void userWithoutWritePermissionsCantDeleteRecord() throws Exception
|
||||||
{
|
{
|
||||||
// create a non-electronic record in unfiled records
|
// create a non-electronic record in unfiled records
|
||||||
FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
|
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), UNFILED_RECORDS_CONTAINER_ALIAS);
|
||||||
|
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
|
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
|
||||||
|
|
||||||
// create random folder
|
// create random folder
|
||||||
FilePlanComponentModel randomFolder = createCategoryFolderInFilePlan();
|
FilePlanComponent randomFolder = createCategoryFolderInFilePlan();
|
||||||
logger.info("random folder:" + randomFolder.getName());
|
logger.info("random folder:" + randomFolder.getName());
|
||||||
|
|
||||||
// grant deleteUser Filing privileges on randomFolder category, this will be
|
// grant deleteUser Filing privileges on randomFolder category, this will be
|
||||||
@@ -200,7 +200,7 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
|
rmUserAPI.usingRestWrapper().assertStatusCodeIs(OK);
|
||||||
|
|
||||||
// create a non-electronic record in randomFolder
|
// create a non-electronic record in randomFolder
|
||||||
FilePlanComponentModel newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
|
FilePlanComponent newRecord = getFilePlanComponentsAPI().createFilePlanComponent(createNonElectronicRecordModel(), randomFolder.getId());
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
// verify the user can see the newRecord
|
// verify the user can see the newRecord
|
||||||
@@ -217,7 +217,7 @@ public class DeleteRecordTests extends BaseRestTest
|
|||||||
* @param record
|
* @param record
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void deleteAndVerify(FilePlanComponentModel record) throws Exception
|
private void deleteAndVerify(FilePlanComponent record) throws Exception
|
||||||
{
|
{
|
||||||
// delete it and verify status
|
// delete it and verify status
|
||||||
getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
|
getFilePlanComponentsAPI().deleteFilePlanComponent(record.getId());
|
||||||
|
@@ -40,8 +40,8 @@ import static org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY;
|
|||||||
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 org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ import org.testng.annotations.Test;
|
|||||||
* @author Kristijan Conkas
|
* @author Kristijan Conkas
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class ElectronicRecordTests extends BaseRestTest
|
public class ElectronicRecordTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
/** Valid root containers where electronic records can be created */
|
/** Valid root containers where electronic records can be created */
|
||||||
@DataProvider(name = "invalidParentContainers")
|
@DataProvider(name = "invalidParentContainers")
|
||||||
@@ -88,7 +88,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "invalidParentContainers",
|
dataProvider = "invalidParentContainers",
|
||||||
description = "Electronic records can't be created in invalid parent containers"
|
description = "Electronic records can't be created in invalid parent containers"
|
||||||
)
|
)
|
||||||
public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponentModel container) throws Exception
|
public void cantCreateElectronicRecordsInInvalidContainers(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
// Build object the filePlan
|
// Build object the filePlan
|
||||||
getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
|
getFilePlanComponentsAPI().createElectronicRecord(createElectronicRecordModel(), IMAGE_FILE, container.getId());
|
||||||
@@ -110,7 +110,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
@Test(description = "Electronic record can't be created in closed record folder")
|
@Test(description = "Electronic record can't be created in closed record folder")
|
||||||
public void cantCreateElectronicRecordInClosedFolder() throws Exception
|
public void cantCreateElectronicRecordInClosedFolder() throws Exception
|
||||||
{
|
{
|
||||||
FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan();
|
FilePlanComponent recordFolder = createCategoryFolderInFilePlan();
|
||||||
|
|
||||||
// the folder should be open
|
// the folder should be open
|
||||||
assertFalse(recordFolder.getProperties().getIsClosed());
|
assertFalse(recordFolder.getProperties().getIsClosed());
|
||||||
@@ -150,7 +150,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Electronic record can only be created if all mandatory properties are given"
|
description = "Electronic record can only be created if all mandatory properties are given"
|
||||||
)
|
)
|
||||||
public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponentModel container) throws Exception
|
public void canCreateElectronicRecordOnlyWithMandatoryProperties(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
logger.info("Root container:\n" + toJson(container));
|
logger.info("Root container:\n" + toJson(container));
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// component without name
|
// component without name
|
||||||
FilePlanComponentModel record = FilePlanComponentModel.builder()
|
FilePlanComponent record = FilePlanComponent.builder()
|
||||||
.nodeType(CONTENT_TYPE)
|
.nodeType(CONTENT_TYPE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -194,16 +194,16 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Electronic records can be created in unfiled record folder or unfiled record root"
|
description = "Electronic records can be created in unfiled record folder or unfiled record root"
|
||||||
)
|
)
|
||||||
public void canCreateElectronicRecordsInValidContainers(FilePlanComponentModel container) throws Exception
|
public void canCreateElectronicRecordsInValidContainers(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
FilePlanComponentModel record = createElectronicRecordModel();
|
FilePlanComponent record = createElectronicRecordModel();
|
||||||
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
|
String newRecordId = getFilePlanComponentsAPI().createElectronicRecord(record, IMAGE_FILE, container.getId()).getId();
|
||||||
|
|
||||||
// verify the create request status code
|
// verify the create request status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
// get newly created electronic record and verify its properties
|
// get newly created electronic record and verify its properties
|
||||||
FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
|
FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
|
||||||
// created record will have record identifier inserted in its name but will be prefixed with
|
// created record will have record identifier inserted in its name but will be prefixed with
|
||||||
// the name it was created as
|
// the name it was created as
|
||||||
assertTrue(electronicRecord.getName().startsWith(record.getName()));
|
assertTrue(electronicRecord.getName().startsWith(record.getName()));
|
||||||
@@ -220,10 +220,10 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Electronic records can be created in unfiled record folder or unfiled record root"
|
description = "Electronic records can be created in unfiled record folder or unfiled record root"
|
||||||
)
|
)
|
||||||
public void recordNameDerivedFromFileName(FilePlanComponentModel container) throws Exception
|
public void recordNameDerivedFromFileName(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
// record object without name set
|
// record object without name set
|
||||||
FilePlanComponentModel record = FilePlanComponentModel.builder()
|
FilePlanComponent record = FilePlanComponent.builder()
|
||||||
.nodeType(CONTENT_TYPE)
|
.nodeType(CONTENT_TYPE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class ElectronicRecordTests extends BaseRestTest
|
|||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
// get newly created electonic record and verify its properties
|
// get newly created electonic record and verify its properties
|
||||||
FilePlanComponentModel electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
|
FilePlanComponent electronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(newRecordId);
|
||||||
// record will have record identifier inserted in its name but will for sure start with file name
|
// record will have record identifier inserted in its name but will for sure start with file name
|
||||||
// and end with its extension
|
// and end with its extension
|
||||||
assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));
|
assertTrue(electronicRecord.getName().startsWith(IMAGE_FILE.substring(0, IMAGE_FILE.indexOf("."))));
|
||||||
|
@@ -43,9 +43,9 @@ 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 org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.base.TestData;
|
import org.alfresco.rest.rm.community.base.TestData;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
@@ -60,7 +60,7 @@ import org.testng.annotations.Test;
|
|||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class FilePlanTests extends BaseRestTest
|
public class FilePlanTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataUser dataUser;
|
private DataUser dataUser;
|
||||||
@@ -109,7 +109,7 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
|
|
||||||
// Get the file plan special container
|
// Get the file plan special container
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponentAlias);
|
||||||
|
|
||||||
// Check the response code
|
// Check the response code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -135,7 +135,7 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
|
|
||||||
// Get the file plan special containers with the optional parameter allowableOperations
|
// Get the file plan special containers with the optional parameter allowableOperations
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().getFilePlanComponent(specialContainerAlias, "include=" + ALLOWABLE_OPERATIONS);
|
||||||
|
|
||||||
// Check the list of allowableOperations returned
|
// Check the list of allowableOperations returned
|
||||||
if(specialContainerAlias.equals(TRANSFERS_ALIAS))
|
if(specialContainerAlias.equals(TRANSFERS_ALIAS))
|
||||||
@@ -171,7 +171,7 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
|
|
||||||
// Build object for updating the filePlan
|
// Build object for updating the filePlan
|
||||||
FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
|
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
.title(FILE_PLAN_TITLE)
|
.title(FILE_PLAN_TITLE)
|
||||||
.description(FILE_PLAN_DESCRIPTION)
|
.description(FILE_PLAN_DESCRIPTION)
|
||||||
@@ -179,7 +179,7 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Update the record category
|
// Update the record category
|
||||||
FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
|
FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(filePlanComponent, FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
// Verify the response status code
|
// Verify the response status code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -262,7 +262,7 @@ public class FilePlanTests extends BaseRestTest
|
|||||||
String name = filePlanComponentAlias + getRandomAlphanumeric();
|
String name = filePlanComponentAlias + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Build the file plan root properties
|
// Build the file plan root properties
|
||||||
FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
|
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||||
.name(name)
|
.name(name)
|
||||||
.nodeType(filePlanComponentType)
|
.nodeType(filePlanComponentType)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
|
@@ -47,8 +47,8 @@ import static org.testng.Assert.assertFalse;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.utility.constants.UserRole;
|
import org.alfresco.utility.constants.UserRole;
|
||||||
import org.alfresco.utility.data.DataUser;
|
import org.alfresco.utility.data.DataUser;
|
||||||
@@ -63,7 +63,7 @@ import org.testng.annotations.Test;
|
|||||||
* @author Kristijan Conkas
|
* @author Kristijan Conkas
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class NonElectronicRecordTests extends BaseRestTest
|
public class NonElectronicRecordTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataUser dataUser;
|
private DataUser dataUser;
|
||||||
@@ -81,12 +81,12 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
public void cantCreateForInvalidParentIds() throws Exception
|
public void cantCreateForInvalidParentIds() throws Exception
|
||||||
{
|
{
|
||||||
// create record category, non-electronic records can't be its children
|
// create record category, non-electronic records can't be its children
|
||||||
FilePlanComponentModel recordCategoryModel = FilePlanComponentModel.builder()
|
FilePlanComponent recordCategoryModel = FilePlanComponent.builder()
|
||||||
.name("Category " + getRandomAlphanumeric())
|
.name("Category " + getRandomAlphanumeric())
|
||||||
.nodeType(RECORD_CATEGORY_TYPE)
|
.nodeType(RECORD_CATEGORY_TYPE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
FilePlanComponentModel recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
|
FilePlanComponent recordCategory = getFilePlanComponentsAPI().createFilePlanComponent(recordCategoryModel, FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
// iterate through all invalid parent containers and try to create/file an electronic record
|
// iterate through all invalid parent containers and try to create/file an electronic record
|
||||||
asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
|
asList(FILE_PLAN_ALIAS, TRANSFERS_ALIAS, HOLDS_ALIAS, recordCategory.getId())
|
||||||
@@ -128,7 +128,7 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Non-electronic records can be created in valid containers"
|
description = "Non-electronic records can be created in valid containers"
|
||||||
)
|
)
|
||||||
public void canCreateInValidContainers(FilePlanComponentModel container) throws Exception
|
public void canCreateInValidContainers(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
logger.info("Root container:\n" + toJson(container));
|
logger.info("Root container:\n" + toJson(container));
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
Integer size = random.nextInt(Integer.MAX_VALUE);
|
Integer size = random.nextInt(Integer.MAX_VALUE);
|
||||||
|
|
||||||
// set values of all available properties for the non electronic records
|
// set values of all available properties for the non electronic records
|
||||||
FilePlanComponentModel filePlanComponent = FilePlanComponentModel.builder()
|
FilePlanComponent filePlanComponent = FilePlanComponent.builder()
|
||||||
.name("Record " + getRandomAlphanumeric())
|
.name("Record " + getRandomAlphanumeric())
|
||||||
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -175,7 +175,7 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
// get newly created non-electonic record and verify its properties
|
// get newly created non-electonic record and verify its properties
|
||||||
FilePlanComponentModel nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
|
FilePlanComponent nonElectronicRecord = getFilePlanComponentsAPI().getFilePlanComponent(nonElectronicId);
|
||||||
|
|
||||||
assertEquals(title, nonElectronicRecord.getProperties().getTitle());
|
assertEquals(title, nonElectronicRecord.getProperties().getTitle());
|
||||||
assertEquals(description, nonElectronicRecord.getProperties().getDescription());
|
assertEquals(description, nonElectronicRecord.getProperties().getDescription());
|
||||||
@@ -200,7 +200,7 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
@Test(description = "Non-electronic record can't be created in closed record folder")
|
@Test(description = "Non-electronic record can't be created in closed record folder")
|
||||||
public void cantCreateInClosedFolder() throws Exception
|
public void cantCreateInClosedFolder() throws Exception
|
||||||
{
|
{
|
||||||
FilePlanComponentModel recordFolder = createCategoryFolderInFilePlan();
|
FilePlanComponent recordFolder = createCategoryFolderInFilePlan();
|
||||||
|
|
||||||
// the folder should be open
|
// the folder should be open
|
||||||
assertFalse(recordFolder.getProperties().getIsClosed());
|
assertFalse(recordFolder.getProperties().getIsClosed());
|
||||||
@@ -239,7 +239,7 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Non-electronic record can only be created if all mandatory properties are given"
|
description = "Non-electronic record can only be created if all mandatory properties are given"
|
||||||
)
|
)
|
||||||
public void allMandatoryPropertiesRequired(FilePlanComponentModel container) throws Exception
|
public void allMandatoryPropertiesRequired(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
logger.info("Root container:\n" + toJson(container));
|
logger.info("Root container:\n" + toJson(container));
|
||||||
if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
|
if (container.getNodeType().equals(RECORD_FOLDER_TYPE))
|
||||||
@@ -249,10 +249,10 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// component without name and title
|
// component without name and title
|
||||||
FilePlanComponentModel noNameOrTitle = getDummyNonElectronicRecord();
|
FilePlanComponent noNameOrTitle = getDummyNonElectronicRecord();
|
||||||
|
|
||||||
// component with title only
|
// component with title only
|
||||||
FilePlanComponentModel titleOnly = getDummyNonElectronicRecord();
|
FilePlanComponent titleOnly = getDummyNonElectronicRecord();
|
||||||
FilePlanComponentProperties properties = FilePlanComponentProperties.builder()
|
FilePlanComponentProperties properties = FilePlanComponentProperties.builder()
|
||||||
.title("Title " + getRandomAlphanumeric())
|
.title("Title " + getRandomAlphanumeric())
|
||||||
.build();
|
.build();
|
||||||
@@ -297,12 +297,12 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
dataProvider = "validRootContainers",
|
dataProvider = "validRootContainers",
|
||||||
description = "Non-electronic record can't be created if user doesn't have RM privileges"
|
description = "Non-electronic record can't be created if user doesn't have RM privileges"
|
||||||
)
|
)
|
||||||
public void cantCreateIfNoRmPrivileges(FilePlanComponentModel container) throws Exception
|
public void cantCreateIfNoRmPrivileges(FilePlanComponent container) throws Exception
|
||||||
{
|
{
|
||||||
UserModel user = createUserWithRole("zzzuser", SiteManager);
|
UserModel user = createUserWithRole("zzzuser", SiteManager);
|
||||||
|
|
||||||
// try to create a fileplan component
|
// try to create a fileplan component
|
||||||
FilePlanComponentModel record = FilePlanComponentModel.builder()
|
FilePlanComponent record = FilePlanComponent.builder()
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
.description("Description")
|
.description("Description")
|
||||||
.title("Title")
|
.title("Title")
|
||||||
@@ -329,9 +329,9 @@ public class NonElectronicRecordTests extends BaseRestTest
|
|||||||
* Helper function to return an empty FilePlanComponent for non-electronic record
|
* Helper function to return an empty FilePlanComponent for non-electronic record
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private FilePlanComponentModel getDummyNonElectronicRecord()
|
private FilePlanComponent getDummyNonElectronicRecord()
|
||||||
{
|
{
|
||||||
FilePlanComponentModel component = FilePlanComponentModel.builder()
|
FilePlanComponent component = FilePlanComponent.builder()
|
||||||
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
.nodeType(NON_ELECTRONIC_RECORD_TYPE)
|
||||||
.build();
|
.build();
|
||||||
return component;
|
return component;
|
||||||
|
@@ -44,14 +44,12 @@ import static org.testng.Assert.fail;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.base.TestData;
|
import org.alfresco.rest.rm.community.base.TestData;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.report.Bug;
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,11 +59,8 @@ import org.testng.annotations.Test;
|
|||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class RecordCategoryTest extends BaseRestTest
|
public class RecordCategoryTest extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
private DataUser dataUser;
|
|
||||||
|
|
||||||
// Number of children (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;
|
||||||
|
|
||||||
@@ -85,7 +80,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Build the record category properties
|
// Build the record category properties
|
||||||
FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
|
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||||
.name(categoryName)
|
.name(categoryName)
|
||||||
.nodeType(RECORD_CATEGORY_TYPE)
|
.nodeType(RECORD_CATEGORY_TYPE)
|
||||||
.properties(
|
.properties(
|
||||||
@@ -95,7 +90,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record category
|
// Create the record category
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
@@ -108,7 +103,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
assertEquals(filePlanComponent.getName(), categoryName);
|
assertEquals(filePlanComponent.getName(), categoryName);
|
||||||
assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE);
|
assertEquals(filePlanComponent.getNodeType(), RECORD_CATEGORY_TYPE);
|
||||||
|
|
||||||
assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Verify the returned file plan component properties
|
// Verify the returned file plan component properties
|
||||||
FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
|
FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
|
||||||
@@ -134,7 +129,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Build the record category properties
|
// Build the record category properties
|
||||||
FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
|
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||||
.name(categoryName)
|
.name(categoryName)
|
||||||
.nodeType(RECORD_CATEGORY_TYPE)
|
.nodeType(RECORD_CATEGORY_TYPE)
|
||||||
.properties(
|
.properties(
|
||||||
@@ -144,15 +139,15 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record category
|
// Create the record category
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
String newCategoryName = "Rename " + categoryName;
|
String newCategoryName = "Rename " + categoryName;
|
||||||
|
|
||||||
// Build the properties which will be updated
|
// Build the properties which will be updated
|
||||||
FilePlanComponentModel recordCategoryUpdated = FilePlanComponentModel.builder().name(newCategoryName).build();
|
FilePlanComponent recordCategoryUpdated = FilePlanComponent.builder().name(newCategoryName).build();
|
||||||
|
|
||||||
// Update the record category
|
// Update the record category
|
||||||
FilePlanComponentModel renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
|
FilePlanComponent renamedFilePlanComponent = getFilePlanComponentsAPI().updateFilePlanComponent(recordCategoryUpdated, filePlanComponent.getId());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -161,7 +156,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
|
assertEquals(renamedFilePlanComponent.getName(), newCategoryName);
|
||||||
|
|
||||||
// Get actual FILE_PLAN_ALIAS id
|
// Get actual FILE_PLAN_ALIAS id
|
||||||
FilePlanComponentModel parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
|
FilePlanComponent parentComponent = getFilePlanComponentsAPI().getFilePlanComponent(FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
// verify renamed component still has this parent
|
// verify renamed component still has this parent
|
||||||
assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
|
assertEquals(renamedFilePlanComponent.getParentId(), parentComponent.getId());
|
||||||
@@ -184,7 +179,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
String categoryTitle = "Category title " + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Build the record category properties
|
// Build the record category properties
|
||||||
FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
|
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||||
.name(categoryName)
|
.name(categoryName)
|
||||||
.nodeType(RECORD_CATEGORY_TYPE)
|
.nodeType(RECORD_CATEGORY_TYPE)
|
||||||
.properties(
|
.properties(
|
||||||
@@ -194,7 +189,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record category
|
// Create the record category
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(recordCategory, FILE_PLAN_ALIAS);
|
||||||
|
|
||||||
// Delete the record category
|
// Delete the record category
|
||||||
getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
|
getFilePlanComponentsAPI().deleteFilePlanComponent(filePlanComponent.getId());
|
||||||
@@ -220,11 +215,11 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
public void createSubcategory() throws Exception
|
public void createSubcategory() throws Exception
|
||||||
{
|
{
|
||||||
// Create root level category
|
// Create root level category
|
||||||
FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
|
FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
|
||||||
assertNotNull(rootCategory.getId());
|
assertNotNull(rootCategory.getId());
|
||||||
|
|
||||||
// Create subcategory as a child of rootCategory
|
// Create subcategory as a child of rootCategory
|
||||||
FilePlanComponentModel childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric());
|
FilePlanComponent childCategory = createCategory(rootCategory.getId(), getRandomAlphanumeric());
|
||||||
|
|
||||||
// Child category created?
|
// Child category created?
|
||||||
assertNotNull(childCategory.getId());
|
assertNotNull(childCategory.getId());
|
||||||
@@ -252,15 +247,15 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
public void listChildren() throws Exception
|
public void listChildren() throws Exception
|
||||||
{
|
{
|
||||||
// Create root level category
|
// Create root level category
|
||||||
FilePlanComponentModel rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
|
FilePlanComponent rootCategory = createCategory(FILE_PLAN_ALIAS, getRandomAlphanumeric());
|
||||||
assertNotNull(rootCategory.getId());
|
assertNotNull(rootCategory.getId());
|
||||||
|
|
||||||
// Add child categories/folders
|
// Add child categories/folders
|
||||||
ArrayList<FilePlanComponentModel> children = new ArrayList<FilePlanComponentModel>();
|
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
|
||||||
FilePlanComponentModel child = createComponent(rootCategory.getId(),
|
FilePlanComponent child = createComponent(rootCategory.getId(),
|
||||||
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);
|
||||||
@@ -278,20 +273,20 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
// Check listed children against created list
|
// Check listed children against created list
|
||||||
apiChildren.getEntries().forEach(c ->
|
apiChildren.getEntries().forEach(c ->
|
||||||
{
|
{
|
||||||
FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel();
|
FilePlanComponent filePlanComponent = c.getFilePlanComponentModel();
|
||||||
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
|
||||||
FilePlanComponentModel 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(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Is parent Id set correctly?
|
// Is parent Id set correctly?
|
||||||
assertEquals(filePlanComponent.getParentId(), rootCategory.getId());
|
assertEquals(filePlanComponent.getParentId(), rootCategory.getId());
|
||||||
@@ -344,10 +339,10 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
String COMPONENT_NAME = "Component"+getRandomAlphanumeric();
|
String COMPONENT_NAME = "Component"+getRandomAlphanumeric();
|
||||||
|
|
||||||
//Create the category
|
//Create the category
|
||||||
FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME);
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, COMPONENT_NAME);
|
||||||
|
|
||||||
//Build node properties
|
//Build node properties
|
||||||
FilePlanComponentModel recordCategory = FilePlanComponentModel.builder()
|
FilePlanComponent recordCategory = FilePlanComponent.builder()
|
||||||
.name(COMPONENT_NAME)
|
.name(COMPONENT_NAME)
|
||||||
.nodeType(nodeType)
|
.nodeType(nodeType)
|
||||||
.properties(
|
.properties(
|
||||||
@@ -370,7 +365,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
* @return The created category
|
* @return The created category
|
||||||
* @throws Exception on unsuccessful component creation
|
* @throws Exception on unsuccessful component creation
|
||||||
*/
|
*/
|
||||||
public FilePlanComponentModel createCategory(String parentCategoryId, String categoryName) throws Exception
|
public FilePlanComponent createCategory(String parentCategoryId, String categoryName) throws Exception
|
||||||
{
|
{
|
||||||
return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE);
|
return createComponent(parentCategoryId, categoryName, RECORD_CATEGORY_TYPE);
|
||||||
}
|
}
|
||||||
@@ -384,10 +379,10 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
* @return The created file plan component
|
* @return The created file plan component
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private FilePlanComponentModel createComponent(String parentComponentId, String componentName, String componentType) throws Exception
|
private FilePlanComponent createComponent(String parentComponentId, String componentName, String componentType) throws Exception
|
||||||
{
|
{
|
||||||
// Build node properties
|
// Build node properties
|
||||||
FilePlanComponentModel component = FilePlanComponentModel.builder()
|
FilePlanComponent component = FilePlanComponent.builder()
|
||||||
.name(componentName)
|
.name(componentName)
|
||||||
.nodeType(componentType)
|
.nodeType(componentType)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -395,7 +390,7 @@ public class RecordCategoryTest extends BaseRestTest
|
|||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(component, parentComponentId);
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
return filePlanComponent;
|
return filePlanComponent;
|
||||||
|
@@ -49,15 +49,13 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.base.TestData;
|
import org.alfresco.rest.rm.community.base.TestData;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentReviewPeriod;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.ReviewPeriod;
|
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.alfresco.utility.report.Bug;
|
import org.alfresco.utility.report.Bug;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.testng.annotations.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -68,11 +66,8 @@ import org.testng.annotations.Test;
|
|||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class RecordFolderTests extends BaseRestTest
|
public class RecordFolderTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
public DataUser dataUser;
|
|
||||||
|
|
||||||
private static final int NUMBER_OF_FOLDERS = 5;
|
private static final int NUMBER_OF_FOLDERS = 5;
|
||||||
/**
|
/**
|
||||||
* Given that a record category exists
|
* Given that a record category exists
|
||||||
@@ -88,9 +83,9 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Authenticate with admin user
|
// Authenticate with admin user
|
||||||
FilePlanComponentModel filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
FilePlanComponent filePlanComponent = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
||||||
|
|
||||||
FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
|
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||||
.name(FOLDER_NAME)
|
.name(FOLDER_NAME)
|
||||||
.nodeType(RECORD_FOLDER_TYPE)
|
.nodeType(RECORD_FOLDER_TYPE)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -99,7 +94,7 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record folder
|
// Create the record folder
|
||||||
FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
|
FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, filePlanComponent.getId());
|
||||||
|
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
@@ -112,7 +107,7 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
|
|
||||||
assertEquals(folder.getName(), FOLDER_NAME);
|
assertEquals(folder.getName(), FOLDER_NAME);
|
||||||
assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE);
|
assertEquals(folder.getNodeType(), RECORD_FOLDER_TYPE);
|
||||||
assertEquals(folder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
assertEquals(folder.getCreatedByUser().getId(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Verify the returned file plan component properties
|
// Verify the returned file plan component properties
|
||||||
FilePlanComponentProperties folderProperties = folder.getProperties();
|
FilePlanComponentProperties folderProperties = folder.getProperties();
|
||||||
@@ -136,7 +131,7 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
|
String componentID = getFilePlanComponentsAPI().getFilePlanComponent(filePlanComponent).getId();
|
||||||
|
|
||||||
// Build the record category properties
|
// Build the record category properties
|
||||||
FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
|
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||||
.name(FOLDER_NAME)
|
.name(FOLDER_NAME)
|
||||||
.nodeType(RECORD_FOLDER_TYPE)
|
.nodeType(RECORD_FOLDER_TYPE)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -164,10 +159,10 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
{
|
{
|
||||||
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
||||||
FilePlanComponentModel folder = createFolder(category.getId(),FOLDER_NAME);
|
FilePlanComponent folder = createFolder(category.getId(),FOLDER_NAME);
|
||||||
|
|
||||||
FilePlanComponentModel folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
|
FilePlanComponent folderDetails = getFilePlanComponentsAPI().getFilePlanComponent(folder.getId(), "include=" + IS_CLOSED);
|
||||||
|
|
||||||
// Verify the returned properties for the file plan component - record folder
|
// Verify the returned properties for the file plan component - record folder
|
||||||
assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType());
|
assertEquals(RECORD_FOLDER_TYPE, folderDetails.getNodeType());
|
||||||
@@ -177,8 +172,8 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
assertFalse(folderDetails.getIsClosed());
|
assertFalse(folderDetails.getIsClosed());
|
||||||
|
|
||||||
assertEquals(FOLDER_NAME,folderDetails.getName());
|
assertEquals(FOLDER_NAME,folderDetails.getName());
|
||||||
assertEquals(dataUser.getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId());
|
assertEquals(getAdminUser().getUsername(),folderDetails.getCreatedByUser().getId());
|
||||||
assertEquals(dataUser.getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId());
|
assertEquals(getAdminUser().getUsername(), folderDetails.getModifiedByUser().getId());
|
||||||
assertEquals(FOLDER_TITLE,folderDetails.getProperties().getTitle());
|
assertEquals(FOLDER_TITLE,folderDetails.getProperties().getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,10 +194,10 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
//Create a record category
|
//Create a record category
|
||||||
FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
||||||
|
|
||||||
//Create a record folder
|
//Create a record folder
|
||||||
FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME);
|
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
|
||||||
|
|
||||||
// Create record category first
|
// Create record category first
|
||||||
String folderDescription = "The folder description is updated" + getRandomAlphanumeric();
|
String folderDescription = "The folder description is updated" + getRandomAlphanumeric();
|
||||||
@@ -211,19 +206,19 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String location = "Location"+getRandomAlphanumeric();
|
String location = "Location"+getRandomAlphanumeric();
|
||||||
|
|
||||||
//Create the file plan component properties to update
|
//Create the file plan component properties to update
|
||||||
FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
|
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||||
.name(folderName)
|
.name(folderName)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
.title(folderTitle)
|
.title(folderTitle)
|
||||||
.description(folderDescription)
|
.description(folderDescription)
|
||||||
.vitalRecord(true)
|
.vitalRecord(true)
|
||||||
.reviewPeriod(new ReviewPeriod("month","1"))
|
.reviewPeriod(new FilePlanComponentReviewPeriod("month","1"))
|
||||||
.location(location)
|
.location(location)
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Update the record category
|
// Update the record category
|
||||||
FilePlanComponentModel folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
|
FilePlanComponent folderUpdated = getFilePlanComponentsAPI().updateFilePlanComponent(recordFolder, folder.getId());
|
||||||
|
|
||||||
// Check the Response Status Code
|
// Check the Response Status Code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -253,10 +248,10 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Create the record category
|
// Create the record category
|
||||||
FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
||||||
|
|
||||||
// Create the record folder
|
// Create the record folder
|
||||||
FilePlanComponentModel folder = createFolder(category.getId(), FOLDER_NAME);
|
FilePlanComponent folder = createFolder(category.getId(), FOLDER_NAME);
|
||||||
|
|
||||||
// Delete the Record folder
|
// Delete the Record folder
|
||||||
getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
|
getFilePlanComponentsAPI().deleteFilePlanComponent(folder.getId());
|
||||||
@@ -286,14 +281,14 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
String CATEGORY = CATEGORY_NAME + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Authenticate with admin user
|
// Authenticate with admin user
|
||||||
FilePlanComponentModel category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
FilePlanComponent category = createCategory(FILE_PLAN_ALIAS, CATEGORY);
|
||||||
|
|
||||||
// Add child olders
|
// Add child olders
|
||||||
ArrayList<FilePlanComponentModel> children = new ArrayList<FilePlanComponentModel>();
|
ArrayList<FilePlanComponent> children = new ArrayList<FilePlanComponent>();
|
||||||
for (int i = 0; i < NUMBER_OF_FOLDERS; i++)
|
for (int i = 0; i < NUMBER_OF_FOLDERS; i++)
|
||||||
{
|
{
|
||||||
// Create a child
|
// Create a child
|
||||||
FilePlanComponentModel child = createFolder(category.getId(),
|
FilePlanComponent child = createFolder(category.getId(),
|
||||||
getRandomAlphanumeric());
|
getRandomAlphanumeric());
|
||||||
assertNotNull(child.getId());
|
assertNotNull(child.getId());
|
||||||
children.add(child);
|
children.add(child);
|
||||||
@@ -308,20 +303,20 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
// Check listed children against created list
|
// Check listed children against created list
|
||||||
apiChildren.getEntries().forEach(c ->
|
apiChildren.getEntries().forEach(c ->
|
||||||
{
|
{
|
||||||
FilePlanComponentModel filePlanComponent = c.getFilePlanComponentModel();
|
FilePlanComponent filePlanComponent = c.getFilePlanComponentModel();
|
||||||
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
|
||||||
FilePlanComponentModel 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(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Is parent Id set correctly
|
// Is parent Id set correctly
|
||||||
assertEquals(filePlanComponent.getParentId(), category.getId());
|
assertEquals(filePlanComponent.getParentId(), category.getId());
|
||||||
@@ -362,14 +357,14 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
String relativePath = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + LocalDateTime.now().getDayOfMonth();
|
String relativePath = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + LocalDateTime.now().getDayOfMonth();
|
||||||
|
|
||||||
//The record folder to be created
|
//The record folder to be created
|
||||||
FilePlanComponentModel recordFolder = FilePlanComponentModel.builder()
|
FilePlanComponent recordFolder = FilePlanComponent.builder()
|
||||||
.name(FOLDER_NAME)
|
.name(FOLDER_NAME)
|
||||||
.nodeType(RECORD_FOLDER_TYPE)
|
.nodeType(RECORD_FOLDER_TYPE)
|
||||||
.relativePath(relativePath)
|
.relativePath(relativePath)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record folder
|
// Create the record folder
|
||||||
FilePlanComponentModel folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
|
FilePlanComponent folder = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder, FILE_PLAN_ALIAS, "include=" + PATH);
|
||||||
//Check the API response code
|
//Check the API response code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
@@ -398,14 +393,14 @@ public class RecordFolderTests extends BaseRestTest
|
|||||||
//New Relative Path only a part of containers need to be created before the record folder
|
//New Relative Path only a part of containers need to be created before the record folder
|
||||||
String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + (LocalDateTime.now().getDayOfMonth() + 1);
|
String NEW_RELATIVE_PATH = LocalDateTime.now().getYear() + "/" + LocalDateTime.now().getMonth() + "/" + (LocalDateTime.now().getDayOfMonth() + 1);
|
||||||
//The record folder to be created
|
//The record folder to be created
|
||||||
FilePlanComponentModel recordFolder2 = FilePlanComponentModel.builder()
|
FilePlanComponent recordFolder2 = FilePlanComponent.builder()
|
||||||
.name(FOLDER_NAME)
|
.name(FOLDER_NAME)
|
||||||
.nodeType(RECORD_FOLDER_TYPE)
|
.nodeType(RECORD_FOLDER_TYPE)
|
||||||
.relativePath(NEW_RELATIVE_PATH)
|
.relativePath(NEW_RELATIVE_PATH)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create the record folder
|
// Create the record folder
|
||||||
FilePlanComponentModel folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
|
FilePlanComponent folder2 = getFilePlanComponentsAPI().createFilePlanComponent(recordFolder2, FILE_PLAN_ALIAS, "include=" + PATH);
|
||||||
//Check the API response code
|
//Check the API response code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
|
@@ -48,12 +48,10 @@ import static org.testng.Assert.assertTrue;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentsCollection;
|
||||||
import org.alfresco.utility.data.DataUser;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@@ -63,24 +61,23 @@ import org.testng.annotations.Test;
|
|||||||
* @author Kristijan Conkas
|
* @author Kristijan Conkas
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class UnfiledRecordsFolderTests extends BaseRestTest
|
public class UnfiledRecordsFolderTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
|
||||||
private DataUser dataUser;
|
|
||||||
|
|
||||||
/** invalid root level types, at unfiled records root level these shouldn't be possible to create */
|
/** invalid root level types, at unfiled records root level these shouldn't be possible to create */
|
||||||
|
|
||||||
@DataProvider(name = "invalidRootTypes")
|
@DataProvider(name = "invalidRootTypes")
|
||||||
public Object[][] createData1() {
|
public Object[][] createData1()
|
||||||
return new Object[][] {
|
{
|
||||||
{ FILE_PLAN_TYPE },
|
return new Object[][]
|
||||||
{ RECORD_CATEGORY_TYPE },
|
{
|
||||||
{ RECORD_FOLDER_TYPE },
|
{ FILE_PLAN_TYPE },
|
||||||
{ HOLD_TYPE },
|
{ RECORD_CATEGORY_TYPE },
|
||||||
{ HOLD_CONTAINER_TYPE },
|
{ RECORD_FOLDER_TYPE },
|
||||||
{ TRANSFER_CONTAINER_TYPE },
|
{ HOLD_TYPE },
|
||||||
{ UNFILED_CONTAINER_TYPE }
|
{ HOLD_CONTAINER_TYPE },
|
||||||
};
|
{ TRANSFER_CONTAINER_TYPE },
|
||||||
|
{ UNFILED_CONTAINER_TYPE }
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,7 +95,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String folderDescription = folderName + " Description";
|
String folderDescription = folderName + " Description";
|
||||||
|
|
||||||
// Build unfiled records folder properties
|
// Build unfiled records folder properties
|
||||||
FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
|
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||||
.name(folderName)
|
.name(folderName)
|
||||||
.nodeType(UNFILED_RECORD_FOLDER_TYPE)
|
.nodeType(UNFILED_RECORD_FOLDER_TYPE)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -107,7 +104,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
FilePlanComponentModel filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
|
FilePlanComponent filePlanComponent = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, UNFILED_RECORDS_CONTAINER_ALIAS);
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
@@ -120,7 +117,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
assertEquals(filePlanComponent.getName(), folderName);
|
assertEquals(filePlanComponent.getName(), folderName);
|
||||||
assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
|
assertEquals(filePlanComponent.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
|
||||||
|
|
||||||
assertEquals(filePlanComponent.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
assertEquals(filePlanComponent.getCreatedByUser().getId(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Verify the returned file plan component properties
|
// Verify the returned file plan component properties
|
||||||
FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
|
FilePlanComponentProperties filePlanComponentProperties = filePlanComponent.getProperties();
|
||||||
@@ -145,7 +142,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
logger.info("creating " + filePlanComponentType);
|
logger.info("creating " + filePlanComponentType);
|
||||||
|
|
||||||
// Build unfiled records folder properties
|
// Build unfiled records folder properties
|
||||||
FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
|
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||||
.name(folderName)
|
.name(folderName)
|
||||||
.nodeType(filePlanComponentType)
|
.nodeType(filePlanComponentType)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -182,11 +179,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String childFolderDescription = childFolderName + " Description";
|
String childFolderDescription = childFolderName + " Description";
|
||||||
|
|
||||||
// No need for fine control, create it using utility function
|
// No need for fine control, create it using utility function
|
||||||
FilePlanComponentModel parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, parentFolderName);
|
FilePlanComponent parentFolder = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, parentFolderName);
|
||||||
assertEquals(parentFolderName, parentFolder.getName());
|
assertEquals(parentFolderName, parentFolder.getName());
|
||||||
|
|
||||||
// Build the unfiled records folder properties
|
// Build the unfiled records folder properties
|
||||||
FilePlanComponentModel unfiledFolder = FilePlanComponentModel.builder()
|
FilePlanComponent unfiledFolder = FilePlanComponent.builder()
|
||||||
.name(childFolderName)
|
.name(childFolderName)
|
||||||
.nodeType(UNFILED_RECORD_FOLDER_TYPE)
|
.nodeType(UNFILED_RECORD_FOLDER_TYPE)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
@@ -196,7 +193,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Create it as a child of parentFolder
|
// Create it as a child of parentFolder
|
||||||
FilePlanComponentModel childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
|
FilePlanComponent childFolder = getFilePlanComponentsAPI().createFilePlanComponent(unfiledFolder, parentFolder.getId());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
@@ -208,7 +205,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
|
|
||||||
assertEquals(childFolder.getName(), childFolderName);
|
assertEquals(childFolder.getName(), childFolderName);
|
||||||
assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
|
assertEquals(childFolder.getNodeType(), UNFILED_RECORD_FOLDER_TYPE);
|
||||||
assertEquals(childFolder.getCreatedByUser().getId(), dataUser.getAdminUser().getUsername());
|
assertEquals(childFolder.getCreatedByUser().getId(), getAdminUser().getUsername());
|
||||||
|
|
||||||
// Verify the returned file plan component properties
|
// Verify the returned file plan component properties
|
||||||
FilePlanComponentProperties childProperties = childFolder.getProperties();
|
FilePlanComponentProperties childProperties = childFolder.getProperties();
|
||||||
@@ -248,11 +245,11 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String folderName = "Folder To Modify" + getRandomAlphanumeric();
|
String folderName = "Folder To Modify" + getRandomAlphanumeric();
|
||||||
|
|
||||||
// No need for fine control, create it using utility function
|
// No need for fine control, create it using utility function
|
||||||
FilePlanComponentModel folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
|
FilePlanComponent folderToModify = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
|
||||||
assertEquals(folderName, folderToModify.getName());
|
assertEquals(folderName, folderToModify.getName());
|
||||||
|
|
||||||
// Build the properties which will be updated
|
// Build the properties which will be updated
|
||||||
FilePlanComponentModel folderToUpdate = FilePlanComponentModel.builder()
|
FilePlanComponent folderToUpdate = FilePlanComponent.builder()
|
||||||
.name(modified + folderToModify.getName())
|
.name(modified + folderToModify.getName())
|
||||||
.properties(FilePlanComponentProperties.builder().
|
.properties(FilePlanComponentProperties.builder().
|
||||||
title(modified + folderToModify.getProperties().getTitle()).
|
title(modified + folderToModify.getProperties().getTitle()).
|
||||||
@@ -266,7 +263,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
|
|
||||||
// This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
|
// This is to ensure the change was actually applied, rather than simply trusting the object returned by PUT
|
||||||
FilePlanComponentModel renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
|
FilePlanComponent renamedFolder = getFilePlanComponentsAPI().getFilePlanComponent(folderToModify.getId());
|
||||||
|
|
||||||
// Verify the returned file plan component
|
// Verify the returned file plan component
|
||||||
assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
|
assertEquals(modified + folderToModify.getName(), renamedFolder.getName());
|
||||||
@@ -287,7 +284,7 @@ public class UnfiledRecordsFolderTests extends BaseRestTest
|
|||||||
String folderName = "Folder To Delete" + getRandomAlphanumeric();
|
String folderName = "Folder To Delete" + getRandomAlphanumeric();
|
||||||
|
|
||||||
// Create folderToDelete
|
// Create folderToDelete
|
||||||
FilePlanComponentModel folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
|
FilePlanComponent folderToDelete = createUnfiledRecordsFolder(UNFILED_RECORDS_CONTAINER_ALIAS, folderName);
|
||||||
assertEquals(folderName, folderToDelete.getName());
|
assertEquals(folderName, folderToDelete.getName());
|
||||||
|
|
||||||
// Delete folderToDelete
|
// Delete folderToDelete
|
||||||
|
@@ -48,9 +48,9 @@ import static org.springframework.social.alfresco.api.entities.Site.Visibility.P
|
|||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.base.BaseRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRESTTest;
|
||||||
import org.alfresco.rest.rm.community.model.site.RMSiteModel;
|
import org.alfresco.rest.rm.community.model.site.RMSite;
|
||||||
import org.alfresco.rest.rm.community.requests.RMUserAPI;
|
import org.alfresco.rest.rm.community.requests.igCoreAPI.RMUserAPI;
|
||||||
import org.alfresco.utility.data.DataUser;
|
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;
|
||||||
@@ -65,7 +65,7 @@ import org.testng.annotations.Test;
|
|||||||
* @author Rodica Sutu
|
* @author Rodica Sutu
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public class RMSiteTests extends BaseRestTest
|
public class RMSiteTests extends BaseRESTTest
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataUser dataUser;
|
private DataUser dataUser;
|
||||||
@@ -92,7 +92,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the RM site
|
// Create the RM site
|
||||||
RMSiteModel rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel());
|
RMSite rmSiteResponse = getRMSiteAPI().createRMSite(createStandardRMSiteModel());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
@@ -125,7 +125,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
|
String newDescription = RM_DESCRIPTION + "createRMSiteWhenSiteExists";
|
||||||
|
|
||||||
// Create the RM site
|
// Create the RM site
|
||||||
RMSiteModel rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
|
RMSite rmSiteModel = createRMSiteModel(STANDARD, newTitle, newDescription);
|
||||||
getRMSiteAPI().createRMSite(rmSiteModel);
|
getRMSiteAPI().createRMSite(rmSiteModel);
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
@@ -174,7 +174,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Get the RM site
|
// Get the RM site
|
||||||
RMSiteModel rmSiteModel = getRMSiteAPI().getSite();
|
RMSite rmSiteModel = getRMSiteAPI().getSite();
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -208,7 +208,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
rmUserAPI.createUser(ANOTHER_ADMIN);
|
rmUserAPI.createUser(ANOTHER_ADMIN);
|
||||||
|
|
||||||
// Create the RM site
|
// Create the RM site
|
||||||
RMSiteModel rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
|
RMSite rmSiteModel = getRMSiteAPI(new UserModel(ANOTHER_ADMIN, DEFAULT_PASSWORD)).createRMSite(createDOD5015RMSiteModel());
|
||||||
|
|
||||||
// Verify the status code
|
// Verify the status code
|
||||||
assertStatusCode(CREATED);
|
assertStatusCode(CREATED);
|
||||||
@@ -239,7 +239,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
|
|
||||||
// Create RM site model
|
// Create RM site model
|
||||||
RMSiteModel rmSiteToUpdate = RMSiteModel.builder().build();
|
RMSite rmSiteToUpdate = RMSite.builder().build();
|
||||||
rmSiteToUpdate.setTitle(NEW_TITLE);
|
rmSiteToUpdate.setTitle(NEW_TITLE);
|
||||||
rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
|
rmSiteToUpdate.setDescription(NEW_DESCRIPTION);
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
assertStatusCode(FORBIDDEN);
|
assertStatusCode(FORBIDDEN);
|
||||||
|
|
||||||
// Update the RM Site
|
// Update the RM Site
|
||||||
RMSiteModel rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate);
|
RMSite rmSiteModel = getRMSiteAPI().updateRMSite(rmSiteToUpdate);
|
||||||
|
|
||||||
// Verify the response status code
|
// Verify the response status code
|
||||||
assertStatusCode(OK);
|
assertStatusCode(OK);
|
||||||
@@ -275,7 +275,7 @@ public class RMSiteTests extends BaseRestTest
|
|||||||
createRMSiteIfNotExists();
|
createRMSiteIfNotExists();
|
||||||
|
|
||||||
// Build the RM site properties
|
// Build the RM site properties
|
||||||
RMSiteModel rmSiteToUpdate = RMSiteModel.builder().compliance(DOD5015).build();
|
RMSite rmSiteToUpdate = RMSite.builder().compliance(DOD5015).build();
|
||||||
|
|
||||||
// Update the RM site
|
// Update the RM site
|
||||||
getRMSiteAPI().updateRMSite(rmSiteToUpdate);
|
getRMSiteAPI().updateRMSite(rmSiteToUpdate);
|
||||||
|
@@ -30,11 +30,11 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentType.NON_ELECTRONIC_RECORD_TYPE;
|
||||||
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
import static org.alfresco.utility.data.RandomData.getRandomAlphanumeric;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentModel;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponent;
|
||||||
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
import org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Utility class for file plan component models
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
@@ -50,50 +50,50 @@ public class FilePlanComponentsUtil
|
|||||||
public static final String IMAGE_FILE = "money.JPG";
|
public static final String IMAGE_FILE = "money.JPG";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a record model with the given type and a random name (with "Record " prefix)
|
||||||
*
|
*
|
||||||
* @param nodeType FIXME!!!
|
* @param nodeType The node type
|
||||||
* @return FIXME!!!
|
* @return The {@link FilePlanComponent} with for the given node type
|
||||||
*/
|
*/
|
||||||
private static FilePlanComponentModel createRecordModel(String nodeType)
|
private static FilePlanComponent createRecordModel(String nodeType)
|
||||||
{
|
{
|
||||||
return FilePlanComponentModel.builder()
|
return FilePlanComponent.builder()
|
||||||
.name("Record " + getRandomAlphanumeric())
|
.name("Record " + getRandomAlphanumeric())
|
||||||
.nodeType(nodeType)
|
.nodeType(nodeType)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates an electronic record model with a random name (with "Record " prefix)
|
||||||
*
|
*
|
||||||
* @return FIXME!!!
|
* @return The electronic record as {@link FilePlanComponent}
|
||||||
*/
|
*/
|
||||||
public static FilePlanComponentModel createElectronicRecordModel()
|
public static FilePlanComponent createElectronicRecordModel()
|
||||||
{
|
{
|
||||||
return createRecordModel(CONTENT_TYPE);
|
return createRecordModel(CONTENT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a non-electronic record model with a random name (with "Record " prefix)
|
||||||
*
|
*
|
||||||
* @return FIXME!!!
|
* @return The non-electronic record as {@link FilePlanComponent}
|
||||||
*/
|
*/
|
||||||
public static FilePlanComponentModel createNonElectronicRecordModel()
|
public static FilePlanComponent createNonElectronicRecordModel()
|
||||||
{
|
{
|
||||||
return createRecordModel(NON_ELECTRONIC_RECORD_TYPE);
|
return createRecordModel(NON_ELECTRONIC_RECORD_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a file plan component with the given name, type and title
|
||||||
*
|
*
|
||||||
* @param name FIXME!!!
|
* @param name The name of the file plan component
|
||||||
* @param type FIXME!!!
|
* @param type The type of the file plan component
|
||||||
* @param title FIXME!!!
|
* @param title The title of the file plan component
|
||||||
* @return
|
* @return The {@link FilePlanComponent} with the given details
|
||||||
*/
|
*/
|
||||||
public static FilePlanComponentModel createFilePlanComponentModel(String name, String type, String title)
|
public static FilePlanComponent createFilePlanComponentModel(String name, String type, String title)
|
||||||
{
|
{
|
||||||
return FilePlanComponentModel.builder()
|
return FilePlanComponent.builder()
|
||||||
.name(name)
|
.name(name)
|
||||||
.nodeType(type)
|
.nodeType(type)
|
||||||
.properties(FilePlanComponentProperties.builder()
|
.properties(FilePlanComponentProperties.builder()
|
||||||
|
@@ -30,10 +30,10 @@ import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.DOD5015
|
|||||||
import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
|
import static org.alfresco.rest.rm.community.model.site.RMSiteCompliance.STANDARD;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.site.RMSiteCompliance;
|
import org.alfresco.rest.rm.community.model.site.RMSiteCompliance;
|
||||||
import org.alfresco.rest.rm.community.model.site.RMSiteModel;
|
import org.alfresco.rest.rm.community.model.site.RMSite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Utility class for the RM Site
|
||||||
*
|
*
|
||||||
* @author Tuna Aksoy
|
* @author Tuna Aksoy
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
@@ -51,48 +51,48 @@ public class RMSiteUtil
|
|||||||
public static final String RM_DESCRIPTION = "Records Management Site";
|
public static final String RM_DESCRIPTION = "Records Management Site";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates an RM Site model for the given compliance, title and description
|
||||||
*
|
*
|
||||||
* @param compliance FIXME!!!
|
* @param compliance The RM site compliance
|
||||||
* @param title FIXME!!!
|
* @param title The site title
|
||||||
* @param description FIXME!!!
|
* @param description The site description
|
||||||
* @return FIXME!!!
|
* @return The {@link RMSite} with the given details
|
||||||
*/
|
*/
|
||||||
public static RMSiteModel createRMSiteModel(RMSiteCompliance compliance, String title, String description)
|
public static RMSite createRMSiteModel(RMSiteCompliance compliance, String title, String description)
|
||||||
{
|
{
|
||||||
RMSiteModel rmSiteModel = RMSiteModel.builder().compliance(compliance).build();
|
RMSite rmSiteModel = RMSite.builder().compliance(compliance).build();
|
||||||
rmSiteModel.setTitle(title);
|
rmSiteModel.setTitle(title);
|
||||||
rmSiteModel.setDescription(description);
|
rmSiteModel.setDescription(description);
|
||||||
return rmSiteModel;
|
return rmSiteModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates an RM Site for the given compliance and default title and description
|
||||||
*
|
*
|
||||||
* @param compliance FIXME!!!
|
* @param The RM site compliance
|
||||||
* @return FIXME!!!
|
* @return The {@link RMSite} with the given details
|
||||||
*/
|
*/
|
||||||
private static RMSiteModel createRMSiteModel(RMSiteCompliance compliance)
|
private static RMSite createRMSiteModel(RMSiteCompliance compliance)
|
||||||
{
|
{
|
||||||
return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION);
|
return createRMSiteModel(compliance, RM_TITLE, RM_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a standard RM site with the default title and description
|
||||||
*
|
*
|
||||||
* @return FIXME!!!
|
* @return The standard RM site
|
||||||
*/
|
*/
|
||||||
public static RMSiteModel createStandardRMSiteModel()
|
public static RMSite createStandardRMSiteModel()
|
||||||
{
|
{
|
||||||
return createRMSiteModel(STANDARD);
|
return createRMSiteModel(STANDARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME!!!
|
* Creates a DOD5015 compliance RM site with the default title and description
|
||||||
*
|
*
|
||||||
* @return FIXME!!!
|
* @return The DOD5015 compliance RM site
|
||||||
*/
|
*/
|
||||||
public static RMSiteModel createDOD5015RMSiteModel()
|
public static RMSite createDOD5015RMSiteModel()
|
||||||
{
|
{
|
||||||
return createRMSiteModel(DOD5015);
|
return createRMSiteModel(DOD5015);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user