Search in sources :

Example 1 with UpgradeTaskId

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);
}
Also used : UpgradeTaskId(org.talend.dataprep.upgrade.model.UpgradeTaskId) UpgradeTask(org.talend.dataprep.upgrade.model.UpgradeTask)

Example 2 with UpgradeTaskId

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());
}
Also used : UpgradeTaskId(org.talend.dataprep.upgrade.model.UpgradeTaskId) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

UpgradeTaskId (org.talend.dataprep.upgrade.model.UpgradeTaskId)2 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 UpgradeTask (org.talend.dataprep.upgrade.model.UpgradeTask)1