use of org.alfresco.rest.api.tests.client.AuthenticationDetailsProvider in project alfresco-remote-api by Alfresco.
the class EnterpriseWorkflowTestApi method before.
@Before
public void before() throws Exception {
this.applicationContext = getTestFixture().getApplicationContext();
this.repoService = getTestFixture().getRepoService();
this.transactionHelper = (RetryingTransactionHelper) applicationContext.getBean("retryingTransactionHelper");
this.personService = (PersonService) applicationContext.getBean("PersonService");
this.nodeService = (NodeService) applicationContext.getBean("NodeService");
this.serviceRegistry = (ServiceRegistry) applicationContext.getBean("ServiceRegistry");
HttpClientProvider httpClientProvider = (HttpClientProvider) applicationContext.getBean("httpClientProvider");
UserDataService userDataService = new UserDataService() {
@Override
public UserData findUserByUserName(String userName) {
UserData userData = new UserData();
if (userName.startsWith("admin")) {
userData.setUserName(userName);
userData.setPassword("admin");
userData.setId(userName);
} else {
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 WorkflowApiHttpClient("localhost", TestFixture.PORT, TestFixture.CONTEXT_PATH, TestFixture.PUBLIC_API_SERVLET_NAME, authenticatedHttp);
this.publicApiClient = new WorkflowApiClient(httpClient, userDataService);
activitiProcessEngine = (ProcessEngine) applicationContext.getBean("activitiProcessEngine");
}
use of org.alfresco.rest.api.tests.client.AuthenticationDetailsProvider 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