use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method testTimestamp.
@Test
public void testTimestamp() throws Exception {
Preparation preparation = new Preparation("#584284", "1234", Step.ROOT_STEP.id(), versionService.version().getVersionId());
final long time0 = preparation.getLastModificationDate();
TimeUnit.MILLISECONDS.sleep(50);
preparation.updateLastModificationDate();
final long time1 = preparation.getLastModificationDate();
assertThat(time0, lessThan(time1));
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method should_merge_from_other.
@Test
public void should_merge_from_other() {
Preparation source = new Preparation("#4837", versionService.version().getVersionId());
Preparation theOtherOne = new Preparation("#4837", versionService.version().getVersionId());
theOtherOne.setAuthor("Joss Stone");
theOtherOne.setCreationDate(source.getCreationDate() - 1000);
theOtherOne.setDataSetId("ds#123456");
theOtherOne.setLastModificationDate(theOtherOne.getCreationDate() + 12345682);
theOtherOne.setName("my preparation name");
theOtherOne.setHeadId(Step.ROOT_STEP.id());
Preparation actual = source.merge(theOtherOne);
assertEquals(actual, theOtherOne);
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method testDefaultPreparation.
@Test
public void testDefaultPreparation() throws Exception {
final Preparation preparation = new Preparation("#123", "12345", Step.ROOT_STEP.id(), versionService.version().getVersionId());
preparation.setCreationDate(0L);
assertThat(preparation.id(), is("#123"));
assertThat(preparation.getHeadId(), is(Step.ROOT_STEP.id()));
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method testId_withName.
@Test
public void testId_withName() throws Exception {
// Preparation id with name
Preparation preparation = new Preparation("#87374", "1234", Step.ROOT_STEP.id(), versionService.version().getVersionId());
preparation.setName("My Preparation");
preparation.setCreationDate(0L);
final String id0 = preparation.getId();
assertThat(id0, is("#87374"));
// Same preparation (but with empty name): id must remain same
preparation.setName("");
final String id1 = preparation.getId();
assertThat(id1, is("#87374"));
// Same preparation (but with null name, null and empty names should be treated all the same): id must remain same
preparation.setName(null);
final String id2 = preparation.getId();
assertThat(id2, is("#87374"));
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method should_merge_from_source.
@Test
public void should_merge_from_source() {
Preparation theOtherOne = new Preparation("#23874", versionService.version().getVersionId());
Preparation source = new Preparation("#158387", versionService.version().getVersionId());
source.setAuthor("Bloc Party");
source.setCreationDate(theOtherOne.getCreationDate() - 1000);
source.setDataSetId("ds#65478");
source.setLastModificationDate(source.getCreationDate() + 2658483);
source.setName("banquet");
source.setHeadId(Step.ROOT_STEP.id());
Preparation actual = source.merge(theOtherOne);
assertEquals(actual, source);
}
Aggregations