mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
renamings
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
package org.alfresco.rest;
|
||||
|
||||
import org.alfresco.rest.v1.RestSites;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SampleATest extends BaseRestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSites onSites;
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleATestMethod1()
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
Assert.assertFalse(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||
}
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleATestMethod2()
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "a");
|
||||
Assert.assertTrue(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||
|
||||
Assert.assertEquals(onSites.usingRestWrapper().getLastStatus().getName(), HttpStatus.ACCEPTED.name(), "Status Code Name");
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package org.alfresco.rest;
|
||||
|
||||
import org.alfresco.rest.v1.RestSites;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SampleBTest extends BaseRestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSites onSites;
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleBTestMethod1()
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
Assert.assertFalse(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||
}
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleBTestMethod2()
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "a");
|
||||
Assert.assertTrue(onSites.withAuthUser(admin).getSites().getEntries().isEmpty(), "We have sites");
|
||||
|
||||
Assert.assertEquals(onSites.usingRestWrapper().getLastStatus().getName().toLowerCase(), HttpStatus.UNAUTHORIZED.name().toLowerCase(), "Status Code Name");
|
||||
}
|
||||
|
||||
|
||||
@Test(groups = {"rest-api-v1"})
|
||||
public void getSite()
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
|
||||
Assert.assertEquals(onSites.withAuthUser(admin).getSite("0-C2291-1470305685222").getId(), "asd");
|
||||
}
|
||||
|
||||
}
|
||||
+9
-4
@@ -1,5 +1,7 @@
|
||||
package org.alfresco.rest;
|
||||
package org.alfresco.rest.v1;
|
||||
|
||||
import org.alfresco.rest.core.RestProperties;
|
||||
import org.alfresco.rest.core.RestWrapper;
|
||||
import org.alfresco.tester.ServerHealth;
|
||||
import org.alfresco.tester.TasProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -10,7 +12,7 @@ import org.testng.annotations.BeforeClass;
|
||||
import com.jayway.restassured.RestAssured;
|
||||
|
||||
@ContextConfiguration("classpath:alfresco-restapi-context.xml")
|
||||
public class BaseRestTest extends AbstractTestNGSpringContextTests
|
||||
public abstract class RestTest extends AbstractTestNGSpringContextTests
|
||||
{
|
||||
@Autowired
|
||||
protected RestProperties restProperties;
|
||||
@@ -21,8 +23,11 @@ public class BaseRestTest extends AbstractTestNGSpringContextTests
|
||||
@Autowired
|
||||
protected ServerHealth serverHealth;
|
||||
|
||||
@BeforeClass
|
||||
public void setup() throws Exception
|
||||
@Autowired
|
||||
protected RestWrapper restClient;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void setupRestTest() throws Exception
|
||||
{
|
||||
serverHealth.assertIfServerOnline();
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.alfresco.rest.v1;
|
||||
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.v1.RestSitesApi;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SampleATest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSitesApi siteAPI;
|
||||
|
||||
@BeforeClass
|
||||
public void initTest()
|
||||
{
|
||||
siteAPI.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleATestMethod1() throws JsonToModelConversionException
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
restClient.authenticateUser(admin);
|
||||
|
||||
Assert.assertFalse(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
||||
}
|
||||
|
||||
@Test(groups = {"rest-api-v1", "sanity"})
|
||||
public void sampleATestMethod2() throws JsonToModelConversionException
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "a");
|
||||
restClient.authenticateUser(admin);
|
||||
Assert.assertTrue(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
||||
Assert.assertEquals(siteAPI.usingRestWrapper().getLastStatus().getName().toLowerCase(), HttpStatus.UNAUTHORIZED.name().toLowerCase(), "Status Code Name");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.alfresco.rest.v1;
|
||||
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.v1.RestSitesApi;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SampleBTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSitesApi siteAPI;
|
||||
|
||||
@BeforeClass
|
||||
public void initTest()
|
||||
{
|
||||
siteAPI.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Test(groups = { "rest-api-v1", "sanity" })
|
||||
public void sampleBTestMethod1() throws JsonToModelConversionException
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
restClient.authenticateUser(admin);
|
||||
Assert.assertFalse(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
||||
}
|
||||
|
||||
@Test(groups = { "rest-api-v1", "sanity" })
|
||||
public void sampleBTestMethod2() throws JsonToModelConversionException
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "a");
|
||||
restClient.authenticateUser(admin);
|
||||
Assert.assertTrue(siteAPI.getSites().getEntries().isEmpty(), "We have sites");
|
||||
|
||||
Assert.assertEquals(siteAPI.usingRestWrapper().getLastStatus().getName().toLowerCase(), HttpStatus.UNAUTHORIZED.name().toLowerCase(),
|
||||
"Status Code Name");
|
||||
}
|
||||
|
||||
@Test(groups = { "rest-api-v1" })
|
||||
public void getSite() throws JsonToModelConversionException
|
||||
{
|
||||
UserModel admin = new UserModel("admin", "admin");
|
||||
restClient.authenticateUser(admin);
|
||||
Assert.assertEquals(siteAPI.getSite("0-C2291-1470305685222").getId(), "no-id");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.alfresco.rest.v1;
|
||||
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.v1.RestPeopleApi;
|
||||
import org.alfresco.tester.data.DataUser;
|
||||
import org.alfresco.tester.exception.DataPreparationException;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SamplePeopleTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestPeopleApi peopleAPI;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
private UserModel userModel;
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
|
||||
restClient.authenticateUser(userModel);
|
||||
peopleAPI.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPerson() throws JsonToModelConversionException
|
||||
{
|
||||
Assert.assertNotNull(peopleAPI.getPerson(userModel.getUsername()), "Get person response should not be null");
|
||||
Assert.assertEquals(peopleAPI.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get person response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonResponseNotNull() throws JsonToModelConversionException
|
||||
{
|
||||
Assert.assertNotNull(peopleAPI.getPerson(userModel.getUsername()), "Get person response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonCheckStatusCode() throws JsonToModelConversionException
|
||||
{
|
||||
peopleAPI.getPerson(userModel.getUsername());
|
||||
Assert.assertEquals(peopleAPI.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get person response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonResponseNotNull1() throws JsonToModelConversionException
|
||||
{
|
||||
Assert.assertNotNull(peopleAPI.getPerson(userModel.getUsername()), "Get person response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonCheckStatusCode1() throws JsonToModelConversionException
|
||||
{
|
||||
peopleAPI.getPerson(userModel.getUsername());
|
||||
Assert.assertEquals(peopleAPI.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get person response status code is not correct");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.alfresco.rest.v1;
|
||||
|
||||
import org.alfresco.rest.exception.JsonToModelConversionException;
|
||||
import org.alfresco.rest.v1.RestSitesApi;
|
||||
import org.alfresco.tester.data.DataSite;
|
||||
import org.alfresco.tester.data.DataUser;
|
||||
import org.alfresco.tester.exception.DataPreparationException;
|
||||
import org.alfresco.tester.model.SiteModel;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SampleSitesTest extends RestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSitesApi siteAPI;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
DataSite dataSite;
|
||||
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass
|
||||
public void initTest() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
restClient.authenticateUser(userModel);
|
||||
siteModel = dataSite.createPublicRandomSite();
|
||||
siteAPI.useRestClient(restClient);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSitesResponseNotNull() throws JsonToModelConversionException
|
||||
{
|
||||
Assert.assertNotNull(siteAPI.getSites().getEntries(), "Get sites response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSitesCheckStatusCode()
|
||||
{
|
||||
Assert.assertEquals(siteAPI.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get sites response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSiteResponseNotNull() throws JsonToModelConversionException
|
||||
{
|
||||
Assert.assertNotNull(siteAPI.getSite(siteModel.getId()), "Get site response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSiteCheckStatusCode() throws JsonToModelConversionException
|
||||
{
|
||||
siteAPI.getSite(siteModel.getId());
|
||||
Assert.assertEquals(siteAPI.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get site response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionHasPagination() throws JsonToModelConversionException
|
||||
{
|
||||
siteAPI.getSites().assertPagination();
|
||||
Assert.assertEquals(siteAPI.getSites().getPagination().getCount(), 100);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package people;
|
||||
|
||||
import org.alfresco.rest.BaseRestTest;
|
||||
import org.alfresco.rest.v1.RestPeople;
|
||||
import org.alfresco.tester.data.DataUser;
|
||||
import org.alfresco.tester.exception.DataPreparationException;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class PeopleTest extends BaseRestTest
|
||||
{
|
||||
@Autowired
|
||||
RestPeople onPeople;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
private UserModel userModel;
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonResponseNotNull()
|
||||
{
|
||||
Assert.assertNotNull(onPeople.withAuthUser(userModel).getPerson(userModel.getUsername()), "Get person response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPersonCheckStatusCode()
|
||||
{
|
||||
onPeople.withAuthUser(userModel).getPerson(userModel.getUsername());
|
||||
Assert.assertEquals(onPeople.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get person response status code is not correct");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package sites;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.BaseRestTest;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.rest.v1.RestSites;
|
||||
import org.alfresco.tester.data.DataSite;
|
||||
import org.alfresco.tester.data.DataUser;
|
||||
import org.alfresco.tester.exception.DataPreparationException;
|
||||
import org.alfresco.tester.model.SiteModel;
|
||||
import org.alfresco.tester.model.UserModel;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.social.alfresco.api.entities.Role;
|
||||
import org.springframework.social.alfresco.api.entities.Site.Visibility;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class SitesTest extends BaseRestTest
|
||||
{
|
||||
@Autowired
|
||||
RestSites onSites;
|
||||
|
||||
@Autowired
|
||||
DataUser dataUser;
|
||||
|
||||
@Autowired
|
||||
DataSite dataSite;
|
||||
|
||||
private UserModel userModel;
|
||||
private SiteModel siteModel;
|
||||
|
||||
@BeforeClass
|
||||
public void setUp() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createUser(RandomStringUtils.randomAlphanumeric(20));
|
||||
siteModel = new SiteModel(Role.SiteManager.toString(), Visibility.PUBLIC, "", RandomStringUtils.randomAlphanumeric(20),
|
||||
RandomStringUtils.randomAlphanumeric(20), RandomStringUtils.randomAlphanumeric(20));
|
||||
|
||||
siteModel = dataSite.createSite(siteModel);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSitesResponseNotNull()
|
||||
{
|
||||
Assert.assertNotNull(onSites.withAuthUser(userModel).getSites().getEntries(), "Get sites response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSitesCheckStatusCode()
|
||||
{
|
||||
onSites.withAuthUser(userModel).getSites();
|
||||
Assert.assertEquals(onSites.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get sites response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSiteResponseNotNull()
|
||||
{
|
||||
Assert.assertNotNull(onSites.withAuthUser(userModel).getSite(siteModel.getId()), "Get site response should not be null");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSiteCheckStatusCode()
|
||||
{
|
||||
onSites.withAuthUser(userModel).getSite(siteModel.getId());
|
||||
Assert.assertEquals(onSites.usingRestWrapper().getStatusCode(), HttpStatus.OK.toString(), "Get site response status code is not correct");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSitePresent()
|
||||
{
|
||||
onSites.withAuthUser(userModel).getSites().hasSite(siteModel.getId());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user