use of org.apache.atlas.model.impexp.AtlasImportRequest in project incubator-atlas by apache.
the class AtlasImportRequestTest method serializeAtlasImportRequstFromJsonWithEmptyTransforms.
@Test
public void serializeAtlasImportRequstFromJsonWithEmptyTransforms() {
String jsonData = "{ \"options\": { \"transforms\": \"{ }\" } }";
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
assertNotNull(request);
assertNotNull(request.getOptions());
assertNotNull(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
ImportTransforms tr = ImportTransforms.fromJson(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
assertNotNull(tr);
assertNotNull(tr.getTransforms());
assertEquals(tr.getTransforms().size(), 0);
}
use of org.apache.atlas.model.impexp.AtlasImportRequest in project incubator-atlas by apache.
the class AtlasImportRequestTest method serializeAtlasImportRequstFromJson.
@Test
public void serializeAtlasImportRequstFromJson() {
String jsonData = "{ \"options\": { \"transforms\": \"{ \\\"hive_db\\\": { \\\"qualifiedName\\\": [ \\\"replace:@cl1:@cl2\\\" ] }, \\\"hive_table\\\": { \\\"qualifiedName\\\": [ \\\"lowercase\\\", \\\"replace:@cl1:@cl2\\\" ] } }\" } } }";
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
assertNotNull(request);
assertNotNull(request.getOptions());
assertNotNull(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
ImportTransforms tr = ImportTransforms.fromJson(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
assertNotNull(tr);
assertNotNull(tr.getTransforms());
assertEquals(tr.getTransforms().size(), 2);
assertTrue(tr.getTransforms().containsKey("hive_db"));
assertEquals(tr.getTransforms("hive_db").entrySet().size(), 1);
assertTrue(tr.getTransforms("hive_db").containsKey("qualifiedName"));
assertEquals(tr.getTransforms("hive_db").get("qualifiedName").size(), 1);
assertTrue(tr.getTransforms().containsKey("hive_table"));
assertEquals(tr.getTransforms("hive_table").entrySet().size(), 1);
assertTrue(tr.getTransforms("hive_table").containsKey("qualifiedName"));
assertEquals(tr.getTransforms("hive_table").get("qualifiedName").size(), 2);
}
use of org.apache.atlas.model.impexp.AtlasImportRequest in project incubator-atlas by apache.
the class ZipFileResourceTestUtils method runAndVerifyQuickStart_v1_Import.
public static void runAndVerifyQuickStart_v1_Import(ImportService importService, ZipSource zipSource) throws AtlasBaseException, IOException {
AtlasExportResult exportResult = zipSource.getExportResult();
List<String> creationOrder = zipSource.getCreationOrder();
AtlasImportRequest request = getDefaultImportRequest();
AtlasImportResult result = runImportWithParameters(importService, request, zipSource);
Assert.assertNotNull(result);
verifyImportedMetrics(exportResult, result);
verifyImportedEntities(creationOrder, result.getProcessedEntities());
}
use of org.apache.atlas.model.impexp.AtlasImportRequest in project incubator-atlas by apache.
the class AtlasImportRequestTest method serializeAtlasImportRequstFromJsonWith1Transform.
@Test
public void serializeAtlasImportRequstFromJsonWith1Transform() {
String jsonData = "{ \"options\": { \"transforms\": \"{ \\\"hive_db\\\": { \\\"qualifiedName\\\": [ \\\"replace:@cl1:@cl2\\\" ] } }\" } }";
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
assertNotNull(request);
assertNotNull(request.getOptions());
assertNotNull(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
ImportTransforms tr = ImportTransforms.fromJson(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
assertNotNull(tr);
assertNotNull(tr.getTransforms());
assertEquals(tr.getTransforms().size(), 1);
assertTrue(tr.getTransforms().containsKey("hive_db"));
assertEquals(tr.getTransforms("hive_db").entrySet().size(), 1);
assertTrue(tr.getTransforms("hive_db").containsKey("qualifiedName"));
assertEquals(tr.getTransforms("hive_db").get("qualifiedName").size(), 1);
}
use of org.apache.atlas.model.impexp.AtlasImportRequest in project incubator-atlas by apache.
the class AtlasImportRequestTest method serializeAtlasImportRequstFromJsonWithEmptyOptions.
@Test
public void serializeAtlasImportRequstFromJsonWithEmptyOptions() {
String jsonData = "{ \"options\": {} }";
AtlasImportRequest request = AtlasType.fromJson(jsonData, AtlasImportRequest.class);
assertNotNull(request);
assertNotNull(request.getOptions());
assertNull(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
ImportTransforms tr = ImportTransforms.fromJson(request.getOptions().get(AtlasImportRequest.TRANSFORMS_KEY));
assertNull(tr);
}
Aggregations