use of org.talend.dataprep.qa.dto.FolderContent in project data-prep by Talend.
the class PreparationStep method registerExistingPreparation.
@When("^I load the existing preparation called \"(.*)\"$")
public void registerExistingPreparation(String preparationFullname) throws IOException {
String preparationName = util.extractNameFromFullName(preparationFullname);
String prepPath = util.extractPathFromFullName(preparationFullname);
Folder prepFolder = folderUtil.searchFolder(prepPath);
FolderContent folderContent = folderUtil.listPreparation(prepPath);
if (folderContent != null) {
List<PreparationDetails> preparations = //
folderContent.preparations.stream().filter(p -> p.name.equals(preparationName)).collect(Collectors.toList());
assertEquals("More than one preparation with \"" + preparationFullname + "\" name founded.", 1, preparations.size());
PreparationDetails preparation = preparations.get(0);
context.storeExistingPreparationRef(preparation.id, preparation.name, prepFolder.getPath());
}
}
use of org.talend.dataprep.qa.dto.FolderContent in project data-prep by Talend.
the class PreparationStep method doesPrepExistsInFolder.
/**
* Check if a preparation of a given name exist in a specified folder.
*
* @param prepFullName the seeked preparation.
* @return <code>true</code> if the preparation is founded, <code>false</code> else.
* @throws IOException if the folder preparation listing fails.
*/
private boolean doesPrepExistsInFolder(String prepFullName) throws IOException {
boolean isPrepPresent = false;
String suffixedPrepName = getSuffixedPrepName(prepFullName);
String prepPath = util.extractPathFromFullName(prepFullName);
String prepId = context.getPreparationId(suffixedPrepName, prepPath);
FolderContent folderContent = folderUtil.listPreparation(prepPath);
if (folderContent != null) {
isPrepPresent = folderContent.preparations.stream().filter(p -> //
p.id.equals(prepId) && //
p.name.equals(suffixedPrepName)).count() == 1;
}
return isPrepPresent;
}
Aggregations