Search in sources :

Example 1 with AtlasExportRequest

use of org.apache.atlas.model.impexp.AtlasExportRequest in project incubator-atlas by apache.

the class ExportServiceTest method getRequestForDept.

private AtlasExportRequest getRequestForDept(boolean addFetchType, String fetchTypeValue, boolean addMatchType, String matchTypeValue) {
    AtlasExportRequest request = new AtlasExportRequest();
    List<AtlasObjectId> itemsToExport = new ArrayList<>();
    itemsToExport.add(new AtlasObjectId("Department", "name", "hr"));
    request.setItemsToExport(itemsToExport);
    setOptionsMap(request, addFetchType, fetchTypeValue, addMatchType, matchTypeValue);
    return request;
}
Also used : AtlasExportRequest(org.apache.atlas.model.impexp.AtlasExportRequest) ArrayList(java.util.ArrayList) AtlasObjectId(org.apache.atlas.model.instance.AtlasObjectId)

Example 2 with AtlasExportRequest

use of org.apache.atlas.model.impexp.AtlasExportRequest in project incubator-atlas by apache.

the class ExportServiceTest method exportType_Succeeds.

@Test
public void exportType_Succeeds() throws AtlasBaseException, FileNotFoundException {
    String requestingIP = "1.0.0.0";
    String hostName = "root";
    AtlasExportRequest request = getRequestForFullFetch();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ZipSink zipSink = new ZipSink(baos);
    AtlasExportResult result = exportService.run(zipSink, request, "admin", hostName, requestingIP);
    assertNotNull(exportService);
    assertEquals(result.getHostName(), hostName);
    assertEquals(result.getClientIpAddress(), requestingIP);
    assertEquals(request, result.getRequest());
}
Also used : AtlasExportResult(org.apache.atlas.model.impexp.AtlasExportResult) AtlasExportRequest(org.apache.atlas.model.impexp.AtlasExportRequest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.testng.annotations.Test)

Example 3 with AtlasExportRequest

use of org.apache.atlas.model.impexp.AtlasExportRequest in project incubator-atlas by apache.

the class ExportServiceTest method getRequestForFullFetch.

private AtlasExportRequest getRequestForFullFetch() {
    AtlasExportRequest request = new AtlasExportRequest();
    List<AtlasObjectId> itemsToExport = new ArrayList<>();
    itemsToExport.add(new AtlasObjectId("hive_db", "qualifiedName", "default@cl1"));
    request.setItemsToExport(itemsToExport);
    return request;
}
Also used : AtlasExportRequest(org.apache.atlas.model.impexp.AtlasExportRequest) ArrayList(java.util.ArrayList) AtlasObjectId(org.apache.atlas.model.instance.AtlasObjectId)

Example 4 with AtlasExportRequest

use of org.apache.atlas.model.impexp.AtlasExportRequest in project incubator-atlas by apache.

the class ExportServiceTest method requestingExportOfNonExistentEntity_ReturnsFailure.

@Test
public void requestingExportOfNonExistentEntity_ReturnsFailure() throws Exception {
    AtlasExportRequest request = getRequestForEmployee();
    tamperEmployeeRequest(request);
    ZipSource zipSource = runExportWithParameters(request);
    assertNotNull(zipSource.getCreationOrder());
    assertEquals(zipSource.getCreationOrder().size(), 0);
    assertEquals(AtlasExportResult.OperationStatus.FAIL, zipSource.getExportResult().getOperationStatus());
}
Also used : AtlasExportRequest(org.apache.atlas.model.impexp.AtlasExportRequest) Test(org.testng.annotations.Test)

Example 5 with AtlasExportRequest

use of org.apache.atlas.model.impexp.AtlasExportRequest in project incubator-atlas by apache.

the class ExportServiceTest method getRequestForEmployee.

private AtlasExportRequest getRequestForEmployee() {
    AtlasExportRequest request = new AtlasExportRequest();
    List<AtlasObjectId> itemsToExport = new ArrayList<>();
    itemsToExport.add(new AtlasObjectId("Employee", "name", "Max"));
    request.setItemsToExport(itemsToExport);
    setOptionsMap(request, true, "CONNECTED", false, "");
    return request;
}
Also used : AtlasExportRequest(org.apache.atlas.model.impexp.AtlasExportRequest) ArrayList(java.util.ArrayList) AtlasObjectId(org.apache.atlas.model.instance.AtlasObjectId)

Aggregations

AtlasExportRequest (org.apache.atlas.model.impexp.AtlasExportRequest)6 ArrayList (java.util.ArrayList)4 AtlasObjectId (org.apache.atlas.model.instance.AtlasObjectId)4 AtlasExportResult (org.apache.atlas.model.impexp.AtlasExportResult)2 Test (org.testng.annotations.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1