use of com.enonic.xp.impl.server.rest.model.SystemDumpUpgradeRequestJson in project xp by enonic.
the class SystemResourceTest method upgrade.
@Test
public void upgrade() throws Exception {
Mockito.when(taskService.submitTask(Mockito.isA(UpgradeRunnableTask.class), eq("upgrade"))).thenReturn(TaskId.from("task-id"));
final SystemDumpUpgradeRequestJson json = Mockito.mock(SystemDumpUpgradeRequestJson.class);
final TaskResultJson result = resource.upgrade(json);
assertEquals("task-id", result.getTaskId());
}
use of com.enonic.xp.impl.server.rest.model.SystemDumpUpgradeRequestJson in project xp by enonic.
the class UpgradeRunnableTaskTest method upgrade.
@Test
public void upgrade() {
final DumpUpgradeResult upgradeResult = DumpUpgradeResult.create().initialVersion(Version.emptyVersion).upgradedVersion(new Version(1)).stepResult(DumpUpgradeStepResult.create().stepName("Step1").initialVersion(Version.emptyVersion).upgradedVersion(new Version(1)).build()).build();
Mockito.when(this.dumpService.upgrade(Mockito.isA(SystemDumpUpgradeParams.class))).thenReturn(upgradeResult);
final UpgradeRunnableTask task = createAndRunTask(new SystemDumpUpgradeRequestJson("dump-name"));
task.createTaskResult();
Mockito.verify(progressReporter, Mockito.times(1)).info(contentQueryArgumentCaptor.capture());
Mockito.verify(taskService, Mockito.times(1)).submitTask(Mockito.isA(RunnableTask.class), Mockito.eq("upgrade"));
final String result = contentQueryArgumentCaptor.getAllValues().get(0);
jsonTestHelper.assertJsonEquals(jsonTestHelper.loadTestJson("upgrade_result.json"), jsonTestHelper.stringToJson(result));
}
Aggregations