本文整理汇总了Java中org.alfresco.service.cmr.replication.ReplicationDefinition.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ReplicationDefinition.getId方法的具体用法?Java ReplicationDefinition.getId怎么用?Java ReplicationDefinition.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.replication.ReplicationDefinition
的用法示例。
在下文中一共展示了ReplicationDefinition.getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreation
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入方法依赖的package包/类
public void testCreation() throws Exception
{
ReplicationDefinition replicationAction =
replicationService.createReplicationDefinition(ACTION_NAME, "Test Definition");
assertNotNull(replicationAction);
assertEquals("Test Definition", replicationAction.getDescription());
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
String id = replicationAction.getId();
assertNotNull(id);
assertTrue(id.length() > 0);
assertNotNull(replicationAction.getPayload());
assertEquals(0, replicationAction.getPayload().size());
assertNull(replicationAction.getLocalTransferReport());
assertNull(replicationAction.getRemoteTransferReport());
}
示例2: testCreation
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入方法依赖的package包/类
public void testCreation() throws Exception
{
ReplicationDefinition replicationAction =
replicationService.createReplicationDefinition(ACTION_NAME, "Test Definition");
assertNotNull(replicationAction);
assertEquals("Test Definition", replicationAction.getDescription());
assertEquals(ACTION_NAME, replicationAction.getReplicationName());
assertEquals(ACTION_QNAME, replicationAction.getReplicationQName());
String id = replicationAction.getId();
assertNotNull(id);
assertTrue(id.length() > 0);
assertNotNull(replicationAction.getPayload());
assertEquals(0, replicationAction.getPayload().size());
assertNull(replicationAction.getLocalTransferReport());
assertNull(replicationAction.getRemoteTransferReport());
}
示例3: testCreateSaveLoad
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入方法依赖的package包/类
public void testCreateSaveLoad() throws Exception
{
ReplicationDefinition replicationAction =
replicationService.createReplicationDefinition(ACTION_NAME, "Test Definition");
String initialId = replicationAction.getId();
replicationAction.getPayload().add(
new NodeRef("workspace://SpacesStore/Testing")
);
replicationAction.getPayload().add(
new NodeRef("workspace://SpacesStore/Testing2")
);
assertEquals(2, replicationAction.getPayload().size());
replicationService.saveReplicationDefinition(replicationAction);
// Load it again, should have the same details still
ReplicationDefinition retrieved =
replicationService.loadReplicationDefinition(ACTION_NAME);
assertNotNull(retrieved);
assertEquals(initialId, retrieved.getId());
assertEquals(ACTION_NAME, retrieved.getReplicationName());
assertEquals(ACTION_QNAME, retrieved.getReplicationQName());
assertEquals("Test Definition", retrieved.getDescription());
assertEquals(2, retrieved.getPayload().size());
// Load a 2nd copy, won't be any changes
ReplicationDefinition second =
replicationService.loadReplicationDefinition(ACTION_NAME);
assertNotNull(second);
assertEquals(initialId, second.getId());
assertEquals(ACTION_NAME, second.getReplicationName());
assertEquals(ACTION_QNAME, second.getReplicationQName());
assertEquals("Test Definition", second.getDescription());
assertEquals(2, second.getPayload().size());
}
示例4: testRunningActionCancel
import org.alfresco.service.cmr.replication.ReplicationDefinition; //导入方法依赖的package包/类
public void testRunningActionCancel() throws Exception
{
Response response;
// Not allowed if you're not an admin
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getGuestUserName());
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + "MadeUp"), Status.STATUS_UNAUTHORIZED);
assertEquals(Status.STATUS_UNAUTHORIZED, response.getStatus());
AuthenticationUtil.setFullyAuthenticatedUser(USER_NORMAL);
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + "MadeUp"), Status.STATUS_UNAUTHORIZED);
assertEquals(Status.STATUS_UNAUTHORIZED, response.getStatus());
// If not found, you get a 404
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + "MadeUp"), Status.STATUS_NOT_FOUND);
assertEquals(Status.STATUS_NOT_FOUND, response.getStatus());
// Create one
ReplicationDefinition rd = replicationService.createReplicationDefinition("Test1", "Testing");
replicationService.saveReplicationDefinition(rd);
actionTrackingService.recordActionExecuting(rd);
String id = rd.getId();
String instance = Integer.toString( ((ActionImpl)rd).getExecutionInstance() );
String key = "replicationActionExecutor=" + id + "=" + instance;
assertEquals(false, actionTrackingService.isCancellationRequested(rd));
// Request it to cancel
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + key), Status.STATUS_NO_CONTENT);
assertEquals(Status.STATUS_NO_CONTENT, response.getStatus());
// Check it was cancelled
assertEquals(true, actionTrackingService.isCancellationRequested(rd));
// Request again - no change
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + key), Status.STATUS_NO_CONTENT);
assertEquals(Status.STATUS_NO_CONTENT, response.getStatus());
assertEquals(true, actionTrackingService.isCancellationRequested(rd));
// You can ask a pending action to cancel
// At this time, it will remain in the queue though
rd = replicationService.createReplicationDefinition("Test2", "Testing");
replicationService.saveReplicationDefinition(rd);
actionTrackingService.recordActionPending(rd);
String id2 = rd.getId();
String instance2 = Integer.toString( ((ActionImpl)rd).getExecutionInstance() );
String key2 = "replicationActionExecutor=" + id2 + "=" + instance2;
// Should be in the cache, but not not running and not cancelled
assertEquals(false, actionTrackingService.isCancellationRequested(rd));
assertEquals(null, rd.getExecutionStartDate());
assertNotNull(executingActionsCache.get(key2));
assertFalse(executingActionsCache.get(key2).isCancelRequested());
// Ask for it to be cancelled via the webscript
response = sendRequest(new DeleteRequest(URL_RUNNING_ACTION + key2), Status.STATUS_NO_CONTENT);
assertEquals(Status.STATUS_NO_CONTENT, response.getStatus());
// Should still be in the cache, not running but cancelled
assertNotNull(executingActionsCache.get(key2));
assertTrue(executingActionsCache.get(key2).isCancelRequested());
assertEquals(true, actionTrackingService.isCancellationRequested(rd));
assertEquals(null, rd.getExecutionStartDate());
}