REPO-2251 : REST API: Reliable TAS REST API & CMIS build plans (5.2.N & 5.1.N)

Refactor all Network tests:
   Group network tests into related class (removed from previous class designed for each endpoint)
   Add abstract class NetworkDataPrep on which are created tenants and other resources shared for these tests (high cost)
   NOTE: Some test still need fixing.
This commit is contained in:
Alexandru-Eusebiu Epure
2017-10-16 17:29:01 +03:00
parent 99731d7364
commit 5b19cc559e
68 changed files with 1977 additions and 2261 deletions
@@ -0,0 +1,66 @@
package org.alfresco.rest;
import org.alfresco.dataprep.CMISUtil.DocumentType;
import org.alfresco.rest.model.RestNetworkModel;
import org.alfresco.utility.model.FileModel;
import org.alfresco.utility.model.SiteModel;
import org.alfresco.utility.model.UserModel;
public abstract class NetworkDataPrep extends RestTest
{
protected static UserModel adminUserModel;
protected static UserModel adminTenantUser, secondAdminTenantUser;
protected static UserModel tenantUser, secondTenantUser, differentNetworkTenantUser;
protected static UserModel tenantUserWithBad;
protected static UserModel userModel;
protected static RestNetworkModel restNetworkModel;
protected static String tenantDomain;
protected static SiteModel siteModel;
protected static FileModel document, document2;
private static boolean isInitialized = false;
public void init()
{
if(isInitialized)
{
}
else
{
isInitialized = true;
try
{
initialization();
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void initialization() throws Exception
{
adminUserModel = dataUser.getAdminUser();
//create first tenant Admin User.
adminTenantUser = UserModel.getAdminTenantUser();
restClient.authenticateUser(adminUserModel);
restClient.usingTenant().createTenant(adminTenantUser);
tenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("uTenant");
secondTenantUser = dataUser.usingUser(adminTenantUser).createUserWithTenant("sTenant");
//create second tenant Admin User.
secondAdminTenantUser = UserModel.getAdminTenantUser();
restClient.usingTenant().createTenant(secondAdminTenantUser);
tenantDomain = tenantUser.getDomain();
differentNetworkTenantUser = dataUser.usingUser(secondAdminTenantUser).createUserWithTenant("dTenant");
userModel = dataUser.createRandomTestUser();
siteModel = dataSite.usingUser(adminUserModel).createPublicRandomSite();
document = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
document2 = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
}
}