• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ReplicationAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.day.cq.replication.ReplicationAction的典型用法代码示例。如果您正苦于以下问题:Java ReplicationAction类的具体用法?Java ReplicationAction怎么用?Java ReplicationAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReplicationAction类属于com.day.cq.replication包,在下文中一共展示了ReplicationAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: replicate

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Override
public void replicate(final Entry entry, String userId) throws RepositoryException {
	if (actionSubmitter == null) {
		LOG.warn(String.format("History entry '%s' replication cannot be performed on author instance",
				entry.getPath()));
		return;
	}
	SlingHelper.operateTraced(resolverFactory, userId, new OperateCallback() {
		@Override
		public void operate(ResourceResolver resolver) throws Exception {
			Resource resource = resolver.getResource(entry.getPath());
			if (resource != null) {
				try {
					LOG.warn("Sending action {} to action submitter", REPLICATE_ACTION);
					Map<String, Object> properties = new HashMap<>(resource.getValueMap());
					properties.put(ReplicationAction.PROPERTY_USER_ID, resolver.getUserID());
					actionSubmitter.sendAction(REPLICATE_ACTION, properties);
					LOG.warn("Action {} was sent to action submitter", REPLICATE_ACTION);
				} catch (ActionSendException e) {
					LOG.info("Cannot send action", e);
				}
			}
		}
	});
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:26,代码来源:HistoryImpl.java


示例2: handleAction

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Override
public void handleAction(final ValueMap valueMap) {
	Preconditions
			.checkState(instanceTypeProvider.isOnAuthor(), "Action Receiver has to be called in author");
	String userId = valueMap.get(ReplicationAction.PROPERTY_USER_ID, String.class);
	SlingHelper.operateTraced(resolverFactory, userId, new OperateCallback() {
		@Override
		public void operate(ResourceResolver resolver) throws Exception {
			//FIXME would be lovely to cast ValueMap -> ModifiableEntryBuilder
			String scriptLocation = valueMap.get(ModifiableEntryBuilder.FILE_PATH_PROPERTY, String.class);
			Resource scriptResource = resolver.getResource(scriptLocation);
			Script script = scriptResource.adaptTo(ScriptImpl.class);
			InstanceDetails instanceDetails = getInstanceDetails(valueMap);
			Progress progress = getProgress(valueMap, resolver.getUserID());
			Calendar executionTime = getCalendar(valueMap);
			Mode mode = getMode(valueMap);
			history.logRemote(script, mode, progress, instanceDetails, executionTime);
		}
	});
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:21,代码来源:RemoteScriptExecutionActionReceiver.java


示例3: handleEvent

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Override
public void handleEvent(Event event) {

    if (!isAuthor) {
        return;
    }

    ReplicationAction action = ReplicationAction.fromEvent(event);
    String path = action.getPath();
    switch (action.getType()) {
        case ACTIVATE:
            if (LOG.isDebugEnabled()) {
                LOG.debug("Activation invoked for {}", path);
            }
            indexService.add(path, action.getRevision());
            break;

        case DEACTIVATE:
        case DELETE:
            if (LOG.isDebugEnabled()) {
                LOG.debug("Removal received for {}", path);
            }
            indexService.remove(path);
            break;
    }
}
 
开发者ID:mwmd,项目名称:ease,代码行数:27,代码来源:ReplicationListener.java


示例4: testHandleEvent

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testHandleEvent() throws LoginException {
    final Map<String, Object> eventParams  = new HashMap<>();
    eventParams.put("paths", new String[]{PACKAGE_PATH});
    eventParams.put("userId", "replication-user");

    final Event event = new Event(ReplicationAction.EVENT_TOPIC, eventParams);

    final ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);

    eventHandler.bindRepository(null, null, true);
    eventHandler.handleEvent(event);

    verify(jobManager, times(1)).addJob(eq("acs-commons/replication/package"), captor.capture());
    final Map<String, Object> actual = captor.getValue();
    assertEquals("replication-user", (String) actual.get("replicatedBy"));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:18,代码来源:JcrPackageReplicationStatusEventHandlerTest.java


示例5: create

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Override
public ReplicationContent create(Session session, ReplicationAction action, ReplicationContentFactory factory, Map<String, Object> map) throws ReplicationException {
  String path = action.getPath();
  ReplicationLog log = action.getLog();

  if (StringUtils.isNotBlank(path)) {
    try {
      HashMap<String, Object> sessionMap = new HashMap<>();
      sessionMap.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session);
      ResourceResolver resolver = resolverFactory.getResourceResolver(sessionMap);

      Resource resource = resolver.getResource(path);
      if (resource != null) {
        String primaryType = resource.getValueMap().get(JcrConstants.JCR_PRIMARYTYPE, String.class);
        ElasticSearchContentBuilder builder = getContentBuilder(primaryType, log);
        if (builder != null) {
          return createReplicationContent(factory, builder.create(path, resolver));
        }
      }
    }
    catch (LoginException e) {
      log.error("Could not retrieve Page Manager", e);
    }

  }
  log.info(getClass().getSimpleName() + ": Path is blank");
  return ReplicationContent.VOID;
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:29,代码来源:ElasticSearchIndexContentBuilder.java


示例6: getInfoFromEvent

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
/**
 * Extracts relevant event information from a Granite Replication Event OR a Day CQ Replication event.
 * @param event the Osgi Event
 * @return a Map containing the relevant data points.
 */
protected final Map<String, Object> getInfoFromEvent(Event event) {
    final Map<String, Object> eventConfig = new HashMap<>();

    final ReplicationEvent replicationEvent = ReplicationEvent.fromEvent(event);
    if (replicationEvent != null) {
        // Granite event
        final ReplicationAction replicationAction = replicationEvent.getReplicationAction();
        eventConfig.put(PROPERTY_PATHS, replicationAction.getPaths());
        eventConfig.put(PROPERTY_REPLICATED_BY, replicationAction.getUserId());
    } else {
        // CQ event
        String[] paths = (String[]) event.getProperty(ReplicationAction.PROPERTY_PATHS);
        if (paths == null) {
            paths = ArrayUtils.EMPTY_STRING_ARRAY;
        }

        String userId = (String) event.getProperty(ReplicationAction.PROPERTY_USER_ID);
        if (StringUtils.isBlank(userId)) {
            userId = StringUtils.defaultIfEmpty(this.replicatedByOverride, FALLBACK_REPLICATION_USER_ID);
        }

        eventConfig.put(PROPERTY_PATHS, paths);
        eventConfig.put(PROPERTY_REPLICATED_BY,userId);
    }

    return eventConfig;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:33,代码来源:JcrPackageReplicationStatusEventHandler.java


示例7: accepts

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
/**
 * Checks if this service should react to or ignore this replication action.
 *
 * @param replicationAction The replication action that is initiating this flush request
 * @param replicationOptions The replication options that is initiating this flush request
 * @return true is this service should attempt to flush associated resources for this replication request
 */
private boolean accepts(final ReplicationAction replicationAction, final ReplicationOptions replicationOptions) {
    if (replicationAction == null || replicationOptions == null)  {
        log.debug("Replication Action or Options are null. Skipping this replication.");
        return false;
    }

    final String path = replicationAction.getPath();

    if (replicationOptions.getFilter() instanceof DispatcherFlushRulesFilter) {
        log.debug("Ignore applying dispatcher flush rules for [ {} ], as it originated from this "
                + "Service.", path);
        return false;
    } else if ((this.hierarchicalFlushRules == null || this.hierarchicalFlushRules.size() < 1)
            && (this.resourceOnlyFlushRules == null || this.resourceOnlyFlushRules.size() < 1)) {
        log.warn("Ignored due no configured flush rules.");
        return false;
    } else if (StringUtils.isBlank(path)) {
        // Do nothing on blank paths
        log.debug("Replication Action path is blank. Skipping this replication.");
        return false;
    } else if (!ReplicationActionType.ACTIVATE.equals(replicationAction.getType())
            && !ReplicationActionType.DEACTIVATE.equals(replicationAction.getType())
            && !ReplicationActionType.DELETE.equals(replicationAction.getType())) {
        // Ignoring non-modifying ReplicationActionTypes
        return false;
    }

    return true;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:37,代码来源:DispatcherFlushRulesImpl.java


示例8: testGetInfoFromEvent_CQEvent

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testGetInfoFromEvent_CQEvent() {
    final String[] expectedPaths = new String[]{PACKAGE_PATH};
    final String expectedUserId = "replication-user";

    final Map<String, Object> properties  = new HashMap<>();
    properties.put("paths", expectedPaths);
    properties.put("userId", expectedUserId);

    final Event event = new Event(ReplicationAction.EVENT_TOPIC, properties);

    final Map<String, Object> actual = eventHandler.getInfoFromEvent(event);
    assertEquals(expectedPaths, actual.get("paths"));
    assertEquals(expectedUserId, actual.get("replicatedBy"));
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:16,代码来源:JcrPackageReplicationStatusEventHandlerTest.java


示例9: testPreprocess_notAccepts_ReplicationOptionsIsNull

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationOptionsIsNull() throws Exception {
    when(hierarchicalFlushRules.size()).thenReturn(9);

    dispatcherFlushRules.preprocess(new ReplicationAction(ReplicationActionType.ACTIVATE, "/content/foo"), null);

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:9,代码来源:DispatcherFlushRulesImplTest.java


示例10: testPreprocess_notAccepts_ReplicationActionNoFlushRules

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionNoFlushRules() throws Exception {
    when(this.hierarchicalFlushRules.size()).thenReturn(0);
    when(this.resourceOnlyFlushRules.size()).thenReturn(0);

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");

    dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:13,代码来源:DispatcherFlushRulesImplTest.java


示例11: testPreprocess_notAccepts_ReplicationActionPathEmpty

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionPathEmpty() throws Exception {
    when(this.hierarchicalFlushRules.size()).thenReturn(9);
    when(this.resourceOnlyFlushRules.size()).thenReturn(9);

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("");

    dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:13,代码来源:DispatcherFlushRulesImplTest.java


示例12: testPreprocess_notAccepts_ReplicationActionPathNull

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionPathNull() throws Exception {
    when(this.hierarchicalFlushRules.size()).thenReturn(9);
    when(this.resourceOnlyFlushRules.size()).thenReturn(9);

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn(null);

    dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:13,代码来源:DispatcherFlushRulesImplTest.java


示例13: testPreprocess_notAccepts_ReplicationActionTypeInternalPoll

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionTypeInternalPoll() throws Exception {
    when(this.hierarchicalFlushRules.size()).thenReturn(9);
    when(this.resourceOnlyFlushRules.size()).thenReturn(9);

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.INTERNAL_POLL);

    dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:14,代码来源:DispatcherFlushRulesImplTest.java


示例14: testPreprocess_notAccepts_ReplicationActionTypeTest

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_ReplicationActionTypeTest() throws Exception {
    when(this.hierarchicalFlushRules.size()).thenReturn(9);
    when(this.resourceOnlyFlushRules.size()).thenReturn(9);

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.TEST);

    dispatcherFlushRules.preprocess(replicationAction, new ReplicationOptions());

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:14,代码来源:DispatcherFlushRulesImplTest.java


示例15: testPreprocess_notAccepts_NonMatchingPath

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_notAccepts_NonMatchingPath() throws Exception {
    this.hierarchicalFlushRules.put(Pattern.compile("/content/foo.*"), new String[] { "/content/target" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verifyZeroInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:16,代码来源:DispatcherFlushRulesImplTest.java


示例16: testPreprocess_success_hierarchical

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_success_hierarchical() throws Exception {
    hierarchicalFlushRules.put(Pattern.compile("/content/acs-aem-commons/.*"), new String[] { "/content/target", "/content/target2" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons/page");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);

    final ArgumentCaptor<DispatcherFlushFilter> agentFilterCaptor = ArgumentCaptor.forClass(DispatcherFlushFilter
            .class);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/target"));

    assertEquals(DispatcherFlushFilter.FlushType.Hierarchical, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/target2"));

    assertEquals(DispatcherFlushFilter.FlushType.Hierarchical, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verifyNoMoreInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:37,代码来源:DispatcherFlushRulesImplTest.java


示例17: testPreprocess_success_resourceOnly

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_success_resourceOnly() throws Exception {
    resourceOnlyFlushRules.put(Pattern.compile("/content/acs-aem-commons/.*"), new String[] { "/content/target" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons/page");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);

    final ArgumentCaptor<DispatcherFlushFilter> agentFilterCaptor = ArgumentCaptor.forClass(DispatcherFlushFilter
            .class);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/target"));

    assertEquals(DispatcherFlushFilter.FlushType.ResourceOnly, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verifyNoMoreInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:28,代码来源:DispatcherFlushRulesImplTest.java


示例18: testPreprocess_success_hierarchicalAndResourceOnly

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_success_hierarchicalAndResourceOnly() throws Exception {
    hierarchicalFlushRules.put(Pattern.compile("/content/.*"), new String[] { "/content/hierarchical" });
    resourceOnlyFlushRules.put(Pattern.compile("/content/.*"), new String[] { "/content/resource-only" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons/page");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);
    replicationOptions.setFilter(new DispatcherFlushFilter());

    final ArgumentCaptor<DispatcherFlushFilter> agentFilterCaptor = ArgumentCaptor.forClass(DispatcherFlushFilter
            .class);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/hierarchical"));

    assertEquals(DispatcherFlushFilter.FlushType.Hierarchical, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/resource-only"));

    assertEquals(DispatcherFlushFilter.FlushType.ResourceOnly, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verifyNoMoreInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:39,代码来源:DispatcherFlushRulesImplTest.java


示例19: testPreprocess_success_translation1

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_success_translation1() throws Exception {
    hierarchicalFlushRules.put(Pattern.compile("/content/acs-aem-commons/(.*)"), new String[] { "/content/target/$1" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons/page");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);

    final ArgumentCaptor<DispatcherFlushFilter> agentFilterCaptor = ArgumentCaptor.forClass(DispatcherFlushFilter
            .class);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/target/page"));

    assertEquals(DispatcherFlushFilter.FlushType.Hierarchical, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verifyNoMoreInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:28,代码来源:DispatcherFlushRulesImplTest.java


示例20: testPreprocess_success_translation2

import com.day.cq.replication.ReplicationAction; //导入依赖的package包/类
@Test
public void testPreprocess_success_translation2() throws Exception {
    hierarchicalFlushRules.put(Pattern.compile("/content/acs-aem-commons/(.*)/(.*)"), new String[] { "/content/target/$1/acs-aem-commons/$2" });

    final ReplicationAction replicationAction = mock(ReplicationAction.class);
    when(replicationAction.getPath()).thenReturn("/content/acs-aem-commons/en/page");
    when(replicationAction.getType()).thenReturn(ReplicationActionType.ACTIVATE);

    final ReplicationOptions replicationOptions = new ReplicationOptions();
    replicationOptions.setSynchronous(false);

    final ArgumentCaptor<DispatcherFlushFilter> agentFilterCaptor = ArgumentCaptor.forClass(DispatcherFlushFilter
            .class);

    dispatcherFlushRules.preprocess(replicationAction, replicationOptions);

    verify(dispatcherFlusher, times(1)).flush(any(ResourceResolver.class), eq(ReplicationActionType.ACTIVATE),
            eq(false),
            agentFilterCaptor.capture(),
            eq("/content/target/en/acs-aem-commons/page"));

    assertEquals(DispatcherFlushFilter.FlushType.Hierarchical, agentFilterCaptor.getValue().getFlushType());
    // Private impl class; no access to test for instanceof
    assertEquals("DispatcherFlushRulesFilter", agentFilterCaptor.getValue().getClass().getSimpleName());

    verifyNoMoreInteractions(dispatcherFlusher);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:28,代码来源:DispatcherFlushRulesImplTest.java



注:本文中的com.day.cq.replication.ReplicationAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ObjectUsageCount类代码示例发布时间:2022-05-22
下一篇:
Java IoAcceptor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap