use of com.enonic.xp.dump.SystemDumpListener in project xp by enonic.
the class DumpServiceImplTest method dumpAndLoadListener.
@Test
public void dumpAndLoadListener() {
createNode(NodePath.ROOT, "myNode");
final SystemDumpListener systemDumpListener = mock(SystemDumpListener.class);
NodeHelper.runAsAdmin(() -> this.dumpService.dump(SystemDumpParams.create().dumpName("myTestDump").includeVersions(true).includeBinaries(true).listener(systemDumpListener).build()));
Mockito.verify(systemDumpListener).dumpingBranch(TEST_REPO_ID, WS_DEFAULT, 2);
Mockito.verify(systemDumpListener).dumpingBranch(TEST_REPO_ID, WS_OTHER, 1);
Mockito.verify(systemDumpListener).dumpingBranch(AUDIT_LOG_REPO_ID, AUDIT_LOG_BRANCH, 1);
Mockito.verify(systemDumpListener).dumpingBranch(SCHEDULER_REPO_ID, SCHEDULER_BRANCH, 1);
Mockito.verify(systemDumpListener).dumpingBranch(SystemConstants.SYSTEM_REPO_ID, SystemConstants.BRANCH_SYSTEM, 6);
Mockito.verify(systemDumpListener, Mockito.times(11)).nodeDumped();
final SystemLoadListener systemLoadListener = mock(SystemLoadListener.class);
NodeHelper.runAsAdmin(() -> this.dumpService.load(SystemLoadParams.create().dumpName("myTestDump").includeVersions(true).listener(systemLoadListener).build()));
Mockito.verify(systemLoadListener).loadingBranch(TEST_REPO_ID, ctxDefault().getBranch(), 2L);
Mockito.verify(systemLoadListener).loadingVersions(TEST_REPO_ID);
Mockito.verify(systemLoadListener).loadingBranch(TEST_REPO_ID, WS_OTHER, 1L);
Mockito.verify(systemLoadListener).loadingVersions(TEST_REPO_ID);
Mockito.verify(systemLoadListener).loadingBranch(AUDIT_LOG_REPO_ID, AUDIT_LOG_BRANCH, 1L);
Mockito.verify(systemLoadListener).loadingBranch(SCHEDULER_REPO_ID, SCHEDULER_BRANCH, 1L);
Mockito.verify(systemLoadListener).loadingVersions(AUDIT_LOG_REPO_ID);
Mockito.verify(systemLoadListener).loadingVersions(SCHEDULER_REPO_ID);
Mockito.verify(systemLoadListener).loadingBranch(SystemConstants.SYSTEM_REPO_ID, SystemConstants.BRANCH_SYSTEM, 6L);
Mockito.verify(systemLoadListener).loadingVersions(SystemConstants.SYSTEM_REPO_ID);
Mockito.verify(systemLoadListener, Mockito.times(21)).entryLoaded();
}
Aggregations