Search in sources :

Example 1 with JacksonUtil

use of org.alfresco.rest.api.tests.util.JacksonUtil in project alfresco-remote-api by Alfresco.

the class AbstractBaseApiTest method setup.

@Override
@Before
public void setup() throws Exception {
    jacksonUtil = new JacksonUtil(applicationContext.getBean("jsonHelper", JacksonHelper.class));
    if (networkOne == null) {
        // note: populateTestData/createTestData will be called (which currently creates 2 tenants, 9 users per tenant, 10 sites per tenant, ...)
        networkOne = getTestFixture().getRandomNetwork();
    }
    // userOneN1 = networkN1.createUser();
    // userTwoN1 = networkN1.createUser();
    String tenantDomain = networkOne.getId();
    if (!TenantService.DEFAULT_DOMAIN.equals(tenantDomain)) {
        networkAdmin = DEFAULT_ADMIN + "@" + tenantDomain;
    }
    // to enable admin access via test calls - eg. via PublicApiClient -> AbstractTestApi -> findUserByUserName
    getOrCreateUser(networkAdmin, "admin", networkOne);
    setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
    // note: createUser currently relies on repoService
    user1 = createUser("user1-" + RUNID, "user1Password", networkOne);
    user2 = createUser("user2-" + RUNID, "user2Password", networkOne);
    // used-by teardown to cleanup
    authenticationService = applicationContext.getBean("authenticationService", MutableAuthenticationService.class);
    personService = applicationContext.getBean("personService", PersonService.class);
    users.add(user1);
    users.add(user2);
    setRequestContext(networkOne.getId(), user1, null);
    tSiteId = createSite("TestSite A - " + RUNID, SiteVisibility.PRIVATE).getId();
    tDocLibNodeId = getSiteContainerNodeId(tSiteId, "documentLibrary");
    setRequestContext(null, null, null);
}
Also used : JacksonUtil(org.alfresco.rest.api.tests.util.JacksonUtil) PersonService(org.alfresco.service.cmr.security.PersonService) RestApiUtil.toJsonAsString(org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsString) MutableAuthenticationService(org.alfresco.service.cmr.security.MutableAuthenticationService) Before(org.junit.Before)

Aggregations

JacksonUtil (org.alfresco.rest.api.tests.util.JacksonUtil)1 RestApiUtil.toJsonAsString (org.alfresco.rest.api.tests.util.RestApiUtil.toJsonAsString)1 MutableAuthenticationService (org.alfresco.service.cmr.security.MutableAuthenticationService)1 PersonService (org.alfresco.service.cmr.security.PersonService)1 Before (org.junit.Before)1