HiveMetaStoreBridge { void importHiveMetadata(boolean failOnError) throws Exception { LOG.info("Importing hive metadata"); importDatabases(failOnError); } HiveMetaStoreBridge(String clusterName, Hive hiveClient, AtlasClient atlasClient);  HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf);  HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf, AtlasClient atlasClient); String getClusterName(); Referenceable createDBInstance(Database hiveDB); static String getDBQualifiedName(String clusterName, String dbName); @VisibleForTesting int importTable(Referenceable databaseReferenceable, String databaseName, String tableName, final boolean failOnError); static String getTableQualifiedName(String clusterName, String dbName, String tableName, boolean isTemporaryTable); static String getTableQualifiedName(String clusterName, Table table); static String getTableProcessQualifiedName(String clusterName, Table table); static String getTableQualifiedName(String clusterName, String dbName, String tableName); Referenceable createTableInstance(Referenceable dbReference, Table hiveTable); static Date getTableCreatedTime(Table table); static String getStorageDescQFName(String entityQualifiedName); Referenceable fillStorageDesc(StorageDescriptor storageDesc, String tableQualifiedName,
        String sdQualifiedName, Id tableId); Referenceable fillHDFSDataSet(String pathUri); static String getColumnQualifiedName(final String tableQualifiedName, final String colName); List<Referenceable> getColumns(List<FieldSchema> schemaList, Referenceable tableReference); static void main(String[] args); static final String HIVE_CLUSTER_NAME; static final String DEFAULT_CLUSTER_NAME; static final String DESCRIPTION_ATTR; static final String TEMP_TABLE_PREFIX; static final long MILLIS_CONVERT_FACTOR; static final String ATLAS_ENDPOINT; static final String COMMENT; static final String PARAMETERS; static final String COLUMNS; static final String POSITION; static final String PART_COLS; static final String TABLE_ALIAS_LIST; static final String STORAGE_NUM_BUCKETS; static final String STORAGE_IS_STORED_AS_SUB_DIRS; static final String TABLE; static final String DB; static final String STORAGE_DESC; static final String STORAGE_DESC_INPUT_FMT; static final String STORAGE_DESC_OUTPUT_FMT; static final String LOCATION; static final String TABLE_TYPE_ATTR; static final String CREATE_TIME; static final String LAST_ACCESS_TIME; static final String HDFS_PATH; final Hive hiveClient; }
@Test public void testImportThatUpdatesRegisteredDatabase() throws Exception { when(hiveClient.getAllDatabases()).thenReturn(Arrays.asList(new String[]{TEST_DB_NAME})); String description = "This is a default database"; when(hiveClient.getDatabase(TEST_DB_NAME)).thenReturn( new Database(TEST_DB_NAME, description, "/user/hive/default", null)); when(hiveClient.getAllTables(TEST_DB_NAME)).thenReturn(Arrays.asList(new String[]{})); returnExistingDatabase(TEST_DB_NAME, atlasClient, CLUSTER_NAME); HiveMetaStoreBridge bridge = new HiveMetaStoreBridge(CLUSTER_NAME, hiveClient, atlasClient); bridge.importHiveMetadata(true); verify(atlasClient).updateEntity(eq("72e06b34-9151-4023-aa9d-b82103a50e76"), (Referenceable) argThat( new MatchesReferenceableProperty(HiveMetaStoreBridge.DESCRIPTION_ATTR, description))); }