mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-13194: Fix failing unit test + restore ability for web scripts to work on a read-only repository
- Authentication work must settle for read only transaction if system is read only - No need for RemoteAlfrescoTicketServiceTest to start its own read-only transaction! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@43407 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,8 +24,6 @@ import org.alfresco.repo.remoteconnector.LocalWebScriptConnectorServiceImpl;
|
||||
import org.alfresco.repo.remotecredentials.PasswordCredentialsInfoImpl;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo;
|
||||
import org.alfresco.service.cmr.remotecredentials.RemoteCredentialsService;
|
||||
@@ -53,7 +51,6 @@ public class RemoteAlfrescoTicketServiceTest extends BaseWebScriptTest
|
||||
private static final String INVALID_REMOTE_SYSTEM_ID = "testingInvalidRemoteSystem";
|
||||
|
||||
private MutableAuthenticationService authenticationService;
|
||||
private RetryingTransactionHelper retryingTransactionHelper;
|
||||
private PersonService personService;
|
||||
|
||||
private RemoteAlfrescoTicketService remoteAlfrescoTicketService;
|
||||
@@ -72,7 +69,6 @@ public class RemoteAlfrescoTicketServiceTest extends BaseWebScriptTest
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
this.retryingTransactionHelper = (RetryingTransactionHelper)getServer().getApplicationContext().getBean("retryingTransactionHelper");
|
||||
this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
||||
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
||||
|
||||
@@ -386,19 +382,13 @@ public class RemoteAlfrescoTicketServiceTest extends BaseWebScriptTest
|
||||
creds.setRemotePassword("INVALID");
|
||||
remoteCredentialsService.updateCredentials(creds);
|
||||
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Void>() {
|
||||
public Void execute()
|
||||
{
|
||||
try
|
||||
{
|
||||
remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
||||
fail("Shouldn't be able to refetch with wrong details");
|
||||
}
|
||||
catch(AuthenticationException e) {}
|
||||
return null;
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
try
|
||||
{
|
||||
remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
||||
fail("Shouldn't be able to refetch with wrong details");
|
||||
}
|
||||
catch(AuthenticationException e) {}
|
||||
|
||||
// Check it was still marked as invalid, despite a read only transaction
|
||||
creds = (PasswordCredentialsInfoImpl)remoteCredentialsService.getPersonCredentials(TEST_REMOTE_SYSTEM_ID);
|
||||
assertEquals(false, creds.getLastAuthenticationSucceeded());
|
||||
|
Reference in New Issue
Block a user