use of org.talend.dataprep.upgrade.model.UpgradeTaskId in project data-prep by Talend.
the class UpgradeService method upgradeVersion.
/**
* Apply all upgrade tasks that need to be applied once per version.
*/
public void upgradeVersion() {
LOG.info("Global upgrade process starting");
int numberOfTasksApplied = 0;
for (UpgradeTask task : tasks) {
final UpgradeTaskId taskId = task.getId();
// skip non version upgrade task
if (task.getTarget() != VERSION) {
LOG.debug("{} does not target version", taskId);
continue;
}
final String targetId = VERSION.name() + '-' + taskId.getVersion();
if (repository.isAlreadyApplied(targetId, taskId)) {
LOG.debug("{} already applied, let's skip it", taskId);
} else {
LOG.debug("apply upgrade {}", taskId);
try {
task.run();
} catch (Exception exception) {
LOG.error("Failed to apply upgrade {}", taskId);
break;
}
repository.applied(targetId, taskId);
numberOfTasksApplied++;
}
}
LOG.info("Global upgrade process finished, {} upgrade(s) performed", numberOfTasksApplied);
}
use of org.talend.dataprep.upgrade.model.UpgradeTaskId in project data-prep by Talend.
the class BasePEUpgradeTest method shouldCheckId.
@Test
public void shouldCheckId() throws Exception {
// when
UpgradeTaskId id = getTaskId();
// then
assertEquals(getExpectedVersion(), id.getVersion());
assertEquals(getExpectedTaskOrder(), id.getOrder());
}
Aggregations