Search in sources :

Example 1 with HBaseBasedAuditRepository

use of org.apache.atlas.repository.audit.HBaseBasedAuditRepository in project incubator-atlas by apache.

the class DefaultMetadataServiceTest method setUp.

@BeforeTest
public void setUp() throws Exception {
    typeDefChangeListener = (DefaultMetadataService) metadataService;
    metadataService = TestUtils.addSessionCleanupWrapper(metadataService);
    if (auditRepository instanceof HBaseBasedAuditRepository) {
        HBaseTestUtils.startCluster();
        ((HBaseBasedAuditRepository) auditRepository).start();
    }
    TestUtils.resetRequestContext();
    RequestContext.get().setUser("testuser");
    TypesDef typesDef = TestUtils.defineHiveTypes();
    try {
        metadataService.getTypeDefinition(TestUtils.TABLE_TYPE);
    } catch (TypeNotFoundException e) {
        metadataService.createType(TypesSerialization.toJson(typesDef));
    }
    String dbGUid = TestUtils.createInstance(metadataService, db);
    table = createTableEntity(dbGUid);
    String tableGuid = TestUtils.createInstance(metadataService, table);
    String tableDefinitionJson = metadataService.getEntityDefinition(TestUtils.TABLE_TYPE, NAME, (String) table.get(NAME));
    table = InstanceSerialization.fromJsonReferenceable(tableDefinitionJson, true);
    tableId = new Id(tableGuid, 0, TestUtils.TABLE_TYPE);
}
Also used : HBaseBasedAuditRepository(org.apache.atlas.repository.audit.HBaseBasedAuditRepository) TypesDef(org.apache.atlas.typesystem.TypesDef) TypeNotFoundException(org.apache.atlas.typesystem.exception.TypeNotFoundException) Id(org.apache.atlas.typesystem.persistence.Id) BeforeTest(org.testng.annotations.BeforeTest)

Aggregations

HBaseBasedAuditRepository (org.apache.atlas.repository.audit.HBaseBasedAuditRepository)1 TypesDef (org.apache.atlas.typesystem.TypesDef)1 TypeNotFoundException (org.apache.atlas.typesystem.exception.TypeNotFoundException)1 Id (org.apache.atlas.typesystem.persistence.Id)1 BeforeTest (org.testng.annotations.BeforeTest)1