Search in sources :

Example 1 with PublicApiClient

use of org.alfresco.rest.api.tests.client.PublicApiClient in project alfresco-remote-api by Alfresco.

the class AbstractTestApi method setupTests.

@Before
public void setupTests() throws Exception {
    TestFixture testFixture = getTestFixture(false);
    this.applicationContext = testFixture.getApplicationContext();
    this.repoService = testFixture.getRepoService();
    this.transactionHelper = (RetryingTransactionHelper) applicationContext.getBean("retryingTransactionHelper");
    HttpClientProvider httpClientProvider = (HttpClientProvider) applicationContext.getBean("httpClientProvider");
    UserDataService userDataService = new UserDataService() {

        @Override
        public UserData findUserByUserName(String userName) {
            UserData userData = new UserData();
            TestPerson person = getRepoService().getPerson(userName.toLowerCase());
            userData.setUserName(person.getId());
            userData.setPassword(person.getPassword());
            userData.setId(person.getId());
            return userData;
        }
    };
    AuthenticationDetailsProvider authenticationDetailsProvider = new UserAuthenticationDetailsProviderImpl(userDataService, "admin", "admin");
    AuthenticatedHttp authenticatedHttp = new AuthenticatedHttp(httpClientProvider, authenticationDetailsProvider);
    this.httpClient = new PublicApiHttpClient(TestFixture.HOST, TestFixture.PORT, TestFixture.CONTEXT_PATH, TestFixture.PUBLIC_API_SERVLET_NAME, authenticatedHttp);
    this.publicApiClient = new PublicApiClient(httpClient, userDataService);
}
Also used : AuthenticationDetailsProvider(org.alfresco.rest.api.tests.client.AuthenticationDetailsProvider) HttpClientProvider(org.alfresco.rest.api.tests.client.HttpClientProvider) UserData(org.alfresco.rest.api.tests.client.UserData) AuthenticatedHttp(org.alfresco.rest.api.tests.client.AuthenticatedHttp) PublicApiHttpClient(org.alfresco.rest.api.tests.client.PublicApiHttpClient) PublicApiClient(org.alfresco.rest.api.tests.client.PublicApiClient) UserAuthenticationDetailsProviderImpl(org.alfresco.rest.api.tests.client.UserAuthenticationDetailsProviderImpl) TestPerson(org.alfresco.rest.api.tests.RepoService.TestPerson) UserDataService(org.alfresco.rest.api.tests.client.UserDataService) Before(org.junit.Before)

Aggregations

TestPerson (org.alfresco.rest.api.tests.RepoService.TestPerson)1 AuthenticatedHttp (org.alfresco.rest.api.tests.client.AuthenticatedHttp)1 AuthenticationDetailsProvider (org.alfresco.rest.api.tests.client.AuthenticationDetailsProvider)1 HttpClientProvider (org.alfresco.rest.api.tests.client.HttpClientProvider)1 PublicApiClient (org.alfresco.rest.api.tests.client.PublicApiClient)1 PublicApiHttpClient (org.alfresco.rest.api.tests.client.PublicApiHttpClient)1 UserAuthenticationDetailsProviderImpl (org.alfresco.rest.api.tests.client.UserAuthenticationDetailsProviderImpl)1 UserData (org.alfresco.rest.api.tests.client.UserData)1 UserDataService (org.alfresco.rest.api.tests.client.UserDataService)1 Before (org.junit.Before)1