use of com.day.cq.replication.ReplicationAction in project acs-aem-commons by Adobe-Consulting-Services.
the class DispatcherFlushRulesImplTest method testPreprocess_notAccepts_ReplicationActionPathEmpty.
@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);
}
use of com.day.cq.replication.ReplicationAction in project acs-aem-commons by Adobe-Consulting-Services.
the class DispatcherFlushRulesImplTest method testPreprocess_notAccepts_ReplicationActionPathNull.
@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);
}
use of com.day.cq.replication.ReplicationAction in project acs-aem-commons by Adobe-Consulting-Services.
the class DispatcherFlushRulesImplTest method testPreprocess_notAccepts_ReplicationActionTypeTest.
@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);
}
use of com.day.cq.replication.ReplicationAction in project acs-aem-commons by Adobe-Consulting-Services.
the class DispatcherFlushRulesImplTest method testPreprocess_success_hierarchical.
@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);
}
Aggregations