Search in sources :

Example 1 with ImportComponentOptionBuilder

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);
}
Also used : Response(com.jayway.restassured.response.Response) ImportComponentOptionBuilder(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder) ArrayList(java.util.ArrayList) ImportComponentOption(com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption) File(java.io.File)

Aggregations

Response (com.jayway.restassured.response.Response)1 ImportComponentOption (com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOption)1 ImportComponentOptionBuilder (com.thinkbiganalytics.feedmgr.rest.model.ImportComponentOptionBuilder)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1