use of com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder in project kylo by Teradata.
the class IntegrationTestBase method importReusableFlowXmlTemplate.
protected ImportTemplate importReusableFlowXmlTemplate(String templatePath, ReusableTemplateConnectionInfo connectionInfo) {
LOG.info("Importing template {}", templatePath);
List<ImportComponentOption> importComponentOptions = new ArrayList<>();
importComponentOptions.add(new ImportComponentOptionBuilder(ImportComponent.TEMPLATE_DATA).alwaysImport().build());
importComponentOptions.add(new ImportComponentOptionBuilder(ImportComponent.NIFI_TEMPLATE).alwaysImport().build());
importComponentOptions.add(new ImportComponentOptionBuilder(ImportComponent.REUSABLE_TEMPLATE).alwaysImport().build());
if (connectionInfo != null) {
importComponentOptions.add(new ImportComponentOptionBuilder(ImportComponent.TEMPLATE_CONNECTION_INFORMATION).alwaysImport().connectionInfo(connectionInfo).build());
}
String importOptions = ObjectMapperSerializer.serialize(importComponentOptions);
String uploadKey = UUID.randomUUID().toString();
Response post = given(AdminControllerV2.BASE).contentType("multipart/form-data").multiPart(new File(templatePath)).multiPart("uploadKey", uploadKey).multiPart("importComponents", importOptions).when().post(AdminControllerV2.IMPORT_TEMPLATE);
post.then().statusCode(HTTP_OK);
return post.as(ImportTemplate.class);
}
Aggregations