use of org.alfresco.rest.api.tests.client.PublicApiHttpClient 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);
}
Aggregations