Package org.alfresco.utility.data
Class DataContent
- java.lang.Object
-
- org.alfresco.utility.data.TestData<DataContent>
-
- org.alfresco.utility.data.DataContent
-
- All Implemented Interfaces:
DSL<DataContent>
@Service @Scope("prototype") public class DataContent extends TestData<DataContent>Utility for creating files and folders, asserting they exist in repository
-
-
Field Summary
-
Fields inherited from class org.alfresco.utility.data.TestData
currentUser, EMAIL, PASSWORD, tasProperties
-
-
Constructor Summary
Constructors Constructor Description DataContent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAspect(java.util.List<XMLAspectData> aspects)Adding aspects to ContentModelsjava.lang.StringaddEmailAlias(java.lang.String alias)Add Email Alias aspect (emailserver:aliasable)dataContent.usingSite(testSite).usingResource(testFolder).addEmailAlias("aliasTas");voidaddFileToFavorites(FileModel file)Add file to favoritesvoidaddFolderToFavorites(FolderModel folder)Add folder to favoritesvoidaddTagToContent(TagModel model)Creates a tag for a content file You must use this in correlation withTestData.usingResource(ContentModel)voidassertContentDoesNotExist()voidassertContentExist()voidassertContentHasTag(java.lang.String cmisObjectPath, TagModel model)Verify content has tagvoidassertContentSizeIs(long sizeInBytes)Asserting the size of the contentvoidassertContentVersionIs(java.lang.String version)Asserting the version of the contentvoidcancelCheckOut()Check out documentbooleancheckContent(java.lang.String fullPath, UserModel userModel)voidcheckIn(java.lang.String newContent, boolean majorVersion, java.lang.String checkInComment)Check in document.voidcheckOutDocument()Check out documentvoidcloseContentStream(org.apache.chemistry.opencmis.commons.data.ContentStream contentStream)FileModelcreateContent(org.alfresco.dataprep.CMISUtil.DocumentType documentType)Creates a random document based onCMISUtil.DocumentTypepassed Return theDocumentobject on success creationdataContent.usingUser(userModel).usingResource(myFolder).createContent(DocumentType.TEXT_PLAIN);FileModelcreateContent(FileModel fileModel)Creates a random document based onCMISUtil.DocumentTypepassed Return theDocumentobject on success creationdataContent.usingSite(site).createContent(sourceFile);ContentModelcreateCustomContent(ContentModel contentModel, java.lang.String objectTypeID, CustomObjectTypeProperties objectTypeProperty)FolderModelcreateFolder()It will create a random folder in current resourcedataContent.usingUser(testUser).usingSite(testSite).createFolder();FolderModelcreateFolder(FolderModel folderModel)It will create a new folder in current resourceFolderModel newRandomFolder = FolderModel.getRandomFolderModel(); dataContent.usingUser(testUser).usingSite(testSite).createFolder(newRandomFolder);voiddeleteContent()Use this to delete the last resource, either file or folderdataContent.usingUser(adminUser).usingSite(siteModel).usingResource(repoFile).deleteContent();voiddeleteSite(SiteModel site)Delete a sitevoiddeleteTree(FolderModel from)Delete parent folder along with all children in itvoiddeployContentModel(java.lang.String localModelXMLFilePath)voidemptyUserTrashcan(UserModel user)org.apache.chemistry.opencmis.client.api.DocumentgetCMISDocument(java.lang.String filePath)Get the corresponding CMIS Document Object of a file using only the file pathorg.apache.chemistry.opencmis.client.api.FoldergetCMISFolder(java.lang.String folderPath)Get the corresponding CMIS Folder Object of a file using only the file pathorg.alfresco.dataprep.ContentActionsgetContentActions()org.apache.chemistry.opencmis.commons.data.ContentStreamgetContentStream(java.lang.String fileName, java.lang.String content)FileModelgetCustomModel()Returns customModel file is one exists or is deployed using deployContentModel otherwise nulljava.lang.StringgetNodeRef()voidrenameContent(ContentModel newContent)Use this to rename a file or a folderdataContent.usingUser(adminUser).usingSite(siteModel).usingResource(repoFolder).renameContent(newRepoFolder);voidsetCustomModel(java.lang.String localModelXMLFilePath)Deploy a custom content model to repository http://docs.alfresco.com/5.1/tasks/deploy-dynamic.htmlvoidsetInheritPermissions(boolean inheritPermissions)voidupdateContent(java.lang.String newContent)Update document contentDataContentusingAdmin()Defines the current user to be AdminDataContentusingUser(UserModel user)Call this method if you want to use another user rather than admin defined inTasPropertiesproperties filevoidwaitUntilContentIsCreated(java.lang.String fullPath)Wait and retry for 15 seconds checking if a resource is createdvoidwaitUntilContentIsCreatedInLinux(java.lang.String fullPath)Wait and retry for 15 seconds checking if a resource is created for Linux OSvoidwaitUntilContentIsDeleted(java.lang.String fullPath)-
Methods inherited from class org.alfresco.utility.data.TestData
assertExtensionAmpExists, assertLogLineIs, getAdminUser, getAlfrescoHome, getCurrentSite, getCurrentSpace, getCurrentUser, getDataDictionaryPath, getLastResource, getRootPath, getSitesPath, getUserHomesPath, isAFile, setCurrentSite, setCurrentSpace, setCurrentUser, setLastResource, usingLastServerLogLines, usingResource, usingRoot, usingSite, usingSite, usingUserHome, usingUserHome, withJMX
-
-
-
-
Method Detail
-
getContentActions
public org.alfresco.dataprep.ContentActions getContentActions()
-
usingUser
public DataContent usingUser(UserModel user)
Description copied from class:TestDataCall this method if you want to use another user rather than admin defined inTasPropertiesproperties file- Specified by:
usingUserin interfaceDSL<DataContent>- Overrides:
usingUserin classTestData<DataContent>
-
usingAdmin
public DataContent usingAdmin()
Description copied from interface:DSLDefines the current user to be Admin- Specified by:
usingAdminin interfaceDSL<DataContent>- Overrides:
usingAdminin classTestData<DataContent>- Returns:
-
createFolder
public FolderModel createFolder(FolderModel folderModel)
It will create a new folder in current resourceFolderModel newRandomFolder = FolderModel.getRandomFolderModel(); dataContent.usingUser(testUser).usingSite(testSite).createFolder(newRandomFolder);
-
createFolder
public FolderModel createFolder()
It will create a random folder in current resourcedataContent.usingUser(testUser).usingSite(testSite).createFolder();
-
deleteContent
public void deleteContent()
Use this to delete the last resource, either file or folderdataContent.usingUser(adminUser).usingSite(siteModel).usingResource(repoFile).deleteContent();
-
renameContent
public void renameContent(ContentModel newContent)
Use this to rename a file or a folderdataContent.usingUser(adminUser).usingSite(siteModel).usingResource(repoFolder).renameContent(newRepoFolder);- Parameters:
newContent-
-
addEmailAlias
public java.lang.String addEmailAlias(java.lang.String alias) throws java.lang.ExceptionAdd Email Alias aspect (emailserver:aliasable)dataContent.usingSite(testSite).usingResource(testFolder).addEmailAlias("aliasTas");- Parameters:
alias-- Returns:
- Throws:
java.lang.Exception
-
createContent
public FileModel createContent(org.alfresco.dataprep.CMISUtil.DocumentType documentType) throws DataPreparationException
Creates a random document based onCMISUtil.DocumentTypepassed Return theDocumentobject on success creationdataContent.usingUser(userModel).usingResource(myFolder).createContent(DocumentType.TEXT_PLAIN);- Parameters:
documentType-- Returns:
- Throws:
DataPreparationException
-
createContent
public FileModel createContent(FileModel fileModel) throws DataPreparationException
Creates a random document based onCMISUtil.DocumentTypepassed Return theDocumentobject on success creationdataContent.usingSite(site).createContent(sourceFile);- Parameters:
documentType-- Returns:
- Throws:
DataPreparationException
-
assertContentExist
public void assertContentExist() throws TestConfigurationException- Parameters:
fullPath- - the full path to CMIS objectuserModel-- Throws:
TestConfigurationException
-
assertContentDoesNotExist
public void assertContentDoesNotExist() throws TestConfigurationException- Throws:
TestConfigurationException
-
checkContent
public boolean checkContent(java.lang.String fullPath, UserModel userModel) throws TestConfigurationException- Throws:
TestConfigurationException
-
waitUntilContentIsDeleted
public void waitUntilContentIsDeleted(java.lang.String fullPath)
-
waitUntilContentIsCreated
public void waitUntilContentIsCreated(java.lang.String fullPath)
Wait and retry for 15 seconds checking if a resource is created- Parameters:
fullPath-
-
waitUntilContentIsCreatedInLinux
public void waitUntilContentIsCreatedInLinux(java.lang.String fullPath)
Wait and retry for 15 seconds checking if a resource is created for Linux OS- Parameters:
fullPath-
-
deleteSite
public void deleteSite(SiteModel site)
Delete a site- Parameters:
site-
-
deleteTree
public void deleteTree(FolderModel from)
Delete parent folder along with all children in it- Parameters:
from-
-
setCustomModel
public void setCustomModel(java.lang.String localModelXMLFilePath)
Deploy a custom content model to repository http://docs.alfresco.com/5.1/tasks/deploy-dynamic.html- Parameters:
localModelXMLFilePath-- Throws:
TestConfigurationException
-
deployContentModel
public void deployContentModel(java.lang.String localModelXMLFilePath) throws TestConfigurationException- Throws:
TestConfigurationException
-
getCustomModel
public FileModel getCustomModel()
Returns customModel file is one exists or is deployed using deployContentModel otherwise null
-
getContentStream
public org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(java.lang.String fileName, java.lang.String content) throws java.lang.Exception- Throws:
java.lang.Exception
-
closeContentStream
public void closeContentStream(org.apache.chemistry.opencmis.commons.data.ContentStream contentStream) throws java.io.IOException- Throws:
java.io.IOException
-
createCustomContent
public ContentModel createCustomContent(ContentModel contentModel, java.lang.String objectTypeID, CustomObjectTypeProperties objectTypeProperty) throws java.lang.Exception
- Parameters:
contentModel-objectTypeID- Example: objectTypeID = "D:cmis:document"- Throws:
java.lang.Exception
-
addTagToContent
public void addTagToContent(TagModel model) throws TestConfigurationException
Creates a tag for a content file You must use this in correlation withTestData.usingResource(ContentModel)- Parameters:
fileModel-model- tag model- Throws:
TestConfigurationException
-
assertContentHasTag
public void assertContentHasTag(java.lang.String cmisObjectPath, TagModel model)Verify content has tag- Parameters:
cmisObjectPath-model-
-
getNodeRef
public java.lang.String getNodeRef()
- Returns:
- nodeRef of the current resource used
You can use this in correlation with
TestData.usingResource(ContentModel)and/orTestData.usingSite(SiteModel), etc.
-
getCMISDocument
public org.apache.chemistry.opencmis.client.api.Document getCMISDocument(java.lang.String filePath)
Get the corresponding CMIS Document Object of a file using only the file path- Parameters:
filePath-- Returns:
Document
-
getCMISFolder
public org.apache.chemistry.opencmis.client.api.Folder getCMISFolder(java.lang.String folderPath)
Get the corresponding CMIS Folder Object of a file using only the file path- Parameters:
filePath-- Returns:
Folder
-
addAspect
public void addAspect(java.util.List<XMLAspectData> aspects)
Adding aspects to ContentModels- Parameters:
object-
-
addFileToFavorites
public void addFileToFavorites(FileModel file) throws DataPreparationException
Add file to favorites- Throws:
DataPreparationException
-
addFolderToFavorites
public void addFolderToFavorites(FolderModel folder) throws DataPreparationException
Add folder to favorites- Throws:
DataPreparationException
-
assertContentVersionIs
public void assertContentVersionIs(java.lang.String version)
Asserting the version of the content- Parameters:
version-
-
assertContentSizeIs
public void assertContentSizeIs(long sizeInBytes)
Asserting the size of the content- Parameters:
sizeInBytes- size in bytes
-
checkOutDocument
public void checkOutDocument()
Check out document
-
cancelCheckOut
public void cancelCheckOut()
Check out document
-
updateContent
public void updateContent(java.lang.String newContent)
Update document content- Parameters:
newContent-
-
checkIn
public void checkIn(java.lang.String newContent, boolean majorVersion, java.lang.String checkInComment)Check in document.- Parameters:
newContent-majorVersion- true to set major version(e.g. 2.0)checkInComment-
-
setInheritPermissions
public void setInheritPermissions(boolean inheritPermissions)
-
emptyUserTrashcan
public void emptyUserTrashcan(UserModel user)
-
-