Added existsRMSite method to RMSiteAPI

This commit is contained in:
Tuna Aksoy
2016-11-17 20:57:17 +00:00
parent 5a10944ae4
commit 119236a0d9
4 changed files with 35 additions and 19 deletions

View File

@@ -43,7 +43,6 @@ import static org.alfresco.rest.rm.community.model.site.RMSiteFields.DESCRIPTION
import static org.alfresco.rest.rm.community.model.site.RMSiteFields.TITLE;
import static org.jglue.fluentjson.JsonBuilderFactory.buildObject;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK;
import com.google.gson.JsonObject;
import com.jayway.restassured.RestAssured;
@@ -124,7 +123,7 @@ public class BaseRestTest extends RestTest
public void createRMSiteIfNotExists() throws Exception
{
// Check RM site doesn't exist
if (!siteRMExists())
if (!rmSiteAPI.existsRMSite())
{
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
@@ -143,16 +142,6 @@ public class BaseRestTest extends RestTest
}
}
/**
* Check if the RM site exists via the GET request
*/
public boolean siteRMExists() throws Exception
{
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
rmSiteAPI.getSite();
return restWrapper.getStatusCode().equals(OK.toString());
}
/**
* Helper method to create child category
*
@@ -191,7 +180,7 @@ public class BaseRestTest extends RestTest
{
return createComponent(parentId, folderName, UNFILED_RECORD_FOLDER_TYPE, FOLDER_TITLE);
}
/**
* Helper method to create generic child component
*

View File

@@ -94,7 +94,7 @@ public class FilePlanTests extends BaseRestTest
public void getFilePlanComponentWhenRMIsNotCreated(String filePlanAlias) throws Exception
{
// Check RM Site Exist
if (siteRMExists())
if (rmSiteAPI.existsRMSite())
{
// Delete RM Site
rmSiteAPI.deleteRMSite();

View File

@@ -94,7 +94,7 @@ public class RMSiteTests extends BaseRestTest
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Check if the RM site exists
if (siteRMExists())
if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
rmSiteAPI.deleteRMSite();
@@ -192,9 +192,8 @@ public class RMSiteTests extends BaseRestTest
// Authenticate with admin user
RestWrapper restWrapper = rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Get the RM site
RMSite rmSite = rmSiteAPI.getSite();
if (!siteRMExists())
// Check if RM site exists
if (!rmSiteAPI.existsRMSite())
{
// Verify the status code when RM site doesn't exist
restWrapper.assertStatusCodeIs(NOT_FOUND);
@@ -202,6 +201,9 @@ public class RMSiteTests extends BaseRestTest
}
else
{
// Get the RM site
RMSite rmSite = rmSiteAPI.getSite();
// Verify the status code
restWrapper.assertStatusCodeIs(OK);
assertEquals(rmSite.getId(), RM_ID);
@@ -227,7 +229,7 @@ public class RMSiteTests extends BaseRestTest
rmSiteAPI.usingRestWrapper().authenticateUser(dataUser.getAdminUser());
// Check if the RM site exists
if (siteRMExists())
if (rmSiteAPI.existsRMSite())
{
// Delete the RM site
rmSiteAPI.deleteRMSite();