mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
60596: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (Cloud/4.3) 60363: Merged DEV to V4.2-BUG-FIX (4.2.2) 58124: Added missing transaction(s) in SOLRTrackingComponentTest (MNT-9806) 58128: Added missing transaction(s) in MultiTDemoTest (MNT-9806) 58247: Added missing transaction(s) in TransferServiceToBeRefactoredTest. Fixed dozens of warnings as well. (MNT-9806) 58248: Added missing transaction(s) in WikiServiceImplTest. Fixed code warnings. (MNT-9806) 58249: Added missing transaction(s) in CalendarServiceImplTest. (MNT-9806) 58251: Added missing transaction(s) in NodeServiceTest. (MNT-9806) 58252: Added missing transaction(s) in LockDAOTest. (MNT-9806) 58253: Added missing transaction(s) in NodeDAOTest. (MNT-9806) 58257: Added missing transaction(s) in SOLRDAOTest. (MNT-9806) 58259: Added missing transaction(s) in ReplicationRestApiTest (MNT-9806) 58260: Added missing transaction(s) in RunningActionRestApiTest (MNT-9806) 58304: Added missing transaction(s) in UnlockMethodTest (MNT-9806) 58368: Added missing transaction(s) in UnlockMethodTest (MNT-9806) 58892: Added missing transaction(s) in NodeServiceTest (MNT-9806) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -74,6 +74,7 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
private SimpleCache<String, ExecutionDetails> executingActionsCache;
|
||||
|
||||
private Repository repositoryHelper;
|
||||
@SuppressWarnings("unused")
|
||||
private NodeRef dataDictionary;
|
||||
|
||||
/**
|
||||
@@ -499,7 +500,9 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
replicationService.saveReplicationDefinition(rd);
|
||||
actionTrackingService.recordActionExecuting(rd);
|
||||
String id2 = rd.getId();
|
||||
@SuppressWarnings("unused")
|
||||
String instance2 = Integer.toString( ((ActionImpl)rd).getExecutionInstance() );
|
||||
@SuppressWarnings("unused")
|
||||
String startedAt2 = ISO8601DateFormat.format(rd.getExecutionStartDate());
|
||||
|
||||
rd = replicationService.createReplicationDefinition("AnotherTest", "3rd Testing");
|
||||
@@ -603,7 +606,9 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
ActionImpl alt2 = new ActionImpl(null, "54321", "MadeUp2");
|
||||
actionTrackingService.recordActionExecuting(alt1);
|
||||
actionTrackingService.recordActionExecuting(alt2);
|
||||
@SuppressWarnings("unused")
|
||||
String startAtAlt2 = ISO8601DateFormat.format( alt2.getExecutionStartDate() );
|
||||
@SuppressWarnings("unused")
|
||||
String instanceAlt2 = Integer.toString( alt2.getExecutionInstance() );
|
||||
|
||||
// 2 replication actions
|
||||
@@ -878,21 +883,28 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
// Should be pending
|
||||
// Wait for it to fail (we didn't
|
||||
// specify enough options for a valid transfer)
|
||||
for(int i=0; i<50; i++) {
|
||||
for(int i=0; i<50; i++)
|
||||
{
|
||||
txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
rd = replicationService.loadReplicationDefinition("Test1");
|
||||
txn.commit();
|
||||
|
||||
if(rd.getExecutionStatus() == ActionStatus.New) {
|
||||
if(rd.getExecutionStatus() == ActionStatus.New)
|
||||
{
|
||||
// Still pending, or maybe running
|
||||
try {
|
||||
try
|
||||
{
|
||||
Thread.sleep(100);
|
||||
} catch(InterruptedException e) {}
|
||||
} else if (rd.getExecutionStatus() == ActionStatus.Failed) {
|
||||
}
|
||||
else if (rd.getExecutionStatus() == ActionStatus.Failed)
|
||||
{
|
||||
// We're done
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Unexpected status in repo of " + rd.getExecutionStatus());
|
||||
}
|
||||
}
|
||||
@@ -960,21 +972,26 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
// Should be pending
|
||||
// Wait for it to fail (we didn't
|
||||
// specify enough options for a valid transfer)
|
||||
for(int i=0; i<50; i++) {
|
||||
for(int i=0; i<50; i++)
|
||||
{
|
||||
txn = transactionService.getUserTransaction();
|
||||
txn.begin();
|
||||
rd = replicationService.loadReplicationDefinition("Test1");
|
||||
txn.commit();
|
||||
|
||||
if(rd.getExecutionStatus() == ActionStatus.New) {
|
||||
if(rd.getExecutionStatus() == ActionStatus.New)
|
||||
{
|
||||
// Still pending, or maybe running
|
||||
try {
|
||||
try
|
||||
{
|
||||
Thread.sleep(100);
|
||||
} catch(InterruptedException e) {}
|
||||
} else if (rd.getExecutionStatus() == ActionStatus.Failed) {
|
||||
} else if (rd.getExecutionStatus() == ActionStatus.Failed)
|
||||
{
|
||||
// We're done
|
||||
break;
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
fail("Unexpected status in repo of " + rd.getExecutionStatus());
|
||||
}
|
||||
}
|
||||
@@ -990,13 +1007,14 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
ApplicationContext appContext = getServer().getApplicationContext();
|
||||
|
||||
nodeService = (NodeService)appContext.getBean("nodeService");
|
||||
nodeService = (NodeService)appContext.getBean("NodeService");
|
||||
replicationService = (ReplicationService)appContext.getBean("ReplicationService");
|
||||
actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
|
||||
repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
|
||||
@@ -1015,7 +1033,8 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
// Ensure we start with no replication definitions
|
||||
// (eg another test left them behind)
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
|
||||
for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
|
||||
for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions())
|
||||
{
|
||||
replicationService.deleteReplicationDefinition(rd);
|
||||
}
|
||||
txn.commit();
|
||||
@@ -1030,9 +1049,6 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see junit.framework.TestCase#tearDown()
|
||||
*/
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
@@ -1051,7 +1067,8 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
|
||||
// Clear out the running actions
|
||||
for(ExecutionSummary es : actionTrackingService.getAllExecutingActions()) {
|
||||
for(ExecutionSummary es : actionTrackingService.getAllExecutingActions())
|
||||
{
|
||||
executingActionsCache.remove(
|
||||
AbstractActionWebscript.getRunningId(es)
|
||||
);
|
||||
|
@@ -1546,7 +1546,7 @@ public class ReplicationRestApiTest extends BaseWebScriptTest
|
||||
super.setUp();
|
||||
ApplicationContext appContext = getServer().getApplicationContext();
|
||||
|
||||
nodeService = (NodeService)appContext.getBean("nodeService");
|
||||
nodeService = (NodeService)appContext.getBean("NodeService");
|
||||
replicationService = (ReplicationService)appContext.getBean("ReplicationService");
|
||||
actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
|
||||
repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
|
||||
|
@@ -10,6 +10,7 @@ import java.util.Collections;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
@@ -320,10 +321,30 @@ public class UnlockMethodTest
|
||||
WebDAVHelper davHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
|
||||
unlockMethod.setDetails(request, new MockHttpServletResponse(), davHelper, folderNodeRef);
|
||||
unlockMethod.parseRequestHeaders();
|
||||
unlockMethod.executeImpl();
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
unlockMethod.executeImpl();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
fail("Exception should have been thrown, but wasn't.");
|
||||
}
|
||||
catch (AlfrescoRuntimeException e)
|
||||
{
|
||||
if (e.getCause() instanceof WebDAVServerException)
|
||||
{
|
||||
WebDAVServerException ee = (WebDAVServerException) e.getCause();
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, ee.getHttpStatusCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
fail("Incorrect exception thrown.");
|
||||
}
|
||||
}
|
||||
catch (WebDAVServerException e)
|
||||
{
|
||||
assertEquals(HttpServletResponse.SC_PRECONDITION_FAILED, e.getHttpStatusCode());
|
||||
|
Reference in New Issue
Block a user