use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class SortAndOrderHelperTest method createPreparation.
private Preparation createPreparation(String name, String author, long creation, long modification, long size, String dsId) {
Preparation firstPrep = new Preparation();
firstPrep.setDataSetId(dsId);
firstPrep.setName(name);
firstPrep.setAuthor(new Owner("1234", author, "").getDisplayName());
firstPrep.setCreationDate(creation);
firstPrep.setLastModificationDate(modification);
List<Step> steps = new ArrayList<>();
for (int i = 0; i < size; i++) {
steps.add(null);
}
firstPrep.setSteps(steps);
return firstPrep;
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class NoOpLockedResourceRepositoryTest method tryLock.
@Test
public void tryLock() throws Exception {
// given
String preparationId = "preparation id";
Preparation preparationMock = mock(Preparation.class);
when(preparationRepository.get(preparationId, Preparation.class)).thenReturn(preparationMock);
// when
Preparation preparation = noOpLockedResourceRepository.tryLock(preparationId, "Toto", "toto de Charleville-Mézières");
// then
assertEquals(preparationMock, preparation);
verify(preparationRepository).get(preparationId, Preparation.class);
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method stepsWithAppend.
@Test
public void stepsWithAppend() {
final String version = versionService.version().getVersionId();
final List<Action> actions = getSimpleAction("uppercase", "column_name", "lastname");
final PreparationActions newContent1 = PreparationActions.ROOT_ACTIONS.append(actions);
repository.add(newContent1);
final PreparationActions newContent2 = newContent1.append(actions);
repository.add(newContent2);
// Steps
final Step s1 = new Step(Step.ROOT_STEP.id(), newContent1.id(), version);
repository.add(s1);
final Step s2 = new Step(s1.id(), newContent2.id(), version);
repository.add(s2);
// Preparation
final Preparation preparation = new Preparation("#54258728", "1234", s2.id(), version);
preparation.setCreationDate(0L);
repository.add(preparation);
assertThat(preparation.id(), Is.is("#54258728"));
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class PreparationTest method initialStep.
@Test
public void initialStep() {
final String version = versionService.version().getVersionId();
final List<Action> actions = getSimpleAction("uppercase", "column_name", "lastname");
final PreparationActions newContent = new PreparationActions(actions, version);
repository.add(newContent);
final Step s = new Step(Step.ROOT_STEP.id(), newContent.id(), version);
repository.add(s);
Preparation preparation = new Preparation("#48368", "1234", s.id(), version);
preparation.setCreationDate(0L);
repository.add(preparation);
assertThat(preparation.id(), Is.is("#48368"));
}
use of org.talend.dataprep.api.preparation.Preparation in project data-prep by Talend.
the class InMemoryPreparationRepositoryTest method getPreparation.
/**
* Helper method that only generates a preparation but simplify code.
*
* @param datasetId the preparation dataset id.
* @param rootName root name for all the preparation attributes.
* @return a new Preparation.
*/
private Preparation getPreparation(String datasetId, String rootName) {
Preparation preparation = new Preparation(UUID.randomUUID().toString(), datasetId, getStep(rootName).id(), "1.0");
preparation.setName(rootName + "_name");
preparation.setAuthor(rootName + "_name");
return preparation;
}
Aggregations