Source:
<code>public void createTable() throws Exception { String defaultDbName = "default"; String tblName = "createtable"; String tblName2 = "createtable2"; String tblOwner = "me"; String serdeLocation = "file:/tmp"; FieldSchema col1 = new FieldSchema("col1", "int", "no comment"); List<FieldSchema> cols = new ArrayList<FieldSchema>(); cols.add(col1); SerDeInfo serde = new SerDeInfo("serde", "seriallib", null); StorageDescriptor sd = new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, TableType.MANAGED_TABLE.toString()); msClient.createTable(table); NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 0, null); assertEquals(1, rsp.getEventsSize()); NotificationEvent event = rsp.getEvents().get(0); assertEquals(firstEventId + 1, event.getEventId()); assertTrue(event.getEventTime() >= startTime); assertEquals(EventType.CREATE_TABLE.toString(), event.getEventType()); assertEquals(defaultDbName, event.getDbName()); assertEquals(tblName, event.getTableName()); CreateTableMessage createTblMsg = md.getCreateTableMessage(event.getMessage()); assertEquals(defaultDbName, createTblMsg.getDB()); assertEquals(tblName, createTblMsg.getTable()); assertEquals(table, createTblMsg.getTableObj()); assertEquals(TableType.MANAGED_TABLE.toString(), createTblMsg.getTableType()); MockMetaStoreEventListener.popAndVerifyLastEventId(EventType.CREATE_TABLE, firstEventId + 1); table = new Table(tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, <START> emptyParameters, null, null, TableType.MANAGED_TABLE.toString()); <END> DummyRawStoreFailEvent.setEventSucceed(false); try { msClient.createTable(table); fail("Error: create table should've failed"); } catch (Exception ex) { } rsp = msClient.getNextNotification(firstEventId, 0, null); assertEquals(1, rsp.getEventsSize()); }</code><technical_language>need ? default managed table</technical_language>

Target:
public void createTable() throws Exception { String defaultDbName = "default"; String tblName = "createtable"; String tblName2 = "createtable2"; String tblOwner = "me"; String serdeLocation = "file:/tmp"; FieldSchema col1 = new FieldSchema("col1", "int", "no comment"); List<FieldSchema> cols = new ArrayList<FieldSchema>(); cols.add(col1); SerDeInfo serde = new SerDeInfo("serde", "seriallib", null); StorageDescriptor sd = new StorageDescriptor(cols, serdeLocation, "input", "output", false, 0, serde, null, null, emptyParameters); Table table = new Table(tblName, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, TableType.MANAGED_TABLE.toString()); msClient.createTable(table); NotificationEventResponse rsp = msClient.getNextNotification(firstEventId, 0, null); assertEquals(1, rsp.getEventsSize()); NotificationEvent event = rsp.getEvents().get(0); assertEquals(firstEventId + 1, event.getEventId()); assertTrue(event.getEventTime() >= startTime); assertEquals(EventType.CREATE_TABLE.toString(), event.getEventType()); assertEquals(defaultDbName, event.getDbName()); assertEquals(tblName, event.getTableName()); CreateTableMessage createTblMsg = md.getCreateTableMessage(event.getMessage()); assertEquals(defaultDbName, createTblMsg.getDB()); assertEquals(tblName, createTblMsg.getTable()); assertEquals(table, createTblMsg.getTableObj()); assertEquals(TableType.MANAGED_TABLE.toString(), createTblMsg.getTableType()); MockMetaStoreEventListener.popAndVerifyLastEventId(EventType.CREATE_TABLE, firstEventId + 1); table = new Table(tblName2, defaultDbName, tblOwner, startTime, startTime, 0, sd, null, emptyParameters, null, null, null); DummyRawStoreFailEvent.setEventSucceed(false); try { msClient.createTable(table); fail("Error: create table should've failed"); } catch (Exception ex) { } rsp = msClient.getNextNotification(firstEventId, 0, null); assertEquals(1, rsp.getEventsSize()); }