@Test public void createTableTest() throws UnsupportedException, ExecutionException { TableName tableName = new TableName(DB_NAME, TABLE_NAME); TableMetadata tableMetadata = mock(TableMetadata.class); when(tableMetadata.getName()).thenReturn(tableName); mongoMetadataEngine.createTable(tableMetadata, connection); verify(tableMetadata, times(1)).getName(); verify(tableMetadata, times(1)).getOptions(); }
@Override protected void createTable(TableMetadata tableMetadata, Connection<MongoClient> connection) throws ExecutionException { if (tableMetadata == null) { throw new MongoValidationException("the table metadata is required"); } if (tableMetadata.getName() == null) { throw new MongoValidationException("the table name is required"); } if (ShardUtils.isCollectionSharded(SelectorOptionsUtils.processOptions(tableMetadata.getOptions()))) { ShardUtils.shardCollection((MongoClient) connection.getNativeConnection(), tableMetadata); } }
MongoMetadataEngine extends CommonsMetadataEngine<MongoClient> { @Override protected void createTable(TableMetadata tableMetadata, Connection<MongoClient> connection) throws ExecutionException { if (tableMetadata == null) { throw new MongoValidationException("the table metadata is required"); } if (tableMetadata.getName() == null) { throw new MongoValidationException("the table name is required"); } if (ShardUtils.isCollectionSharded(SelectorOptionsUtils.processOptions(tableMetadata.getOptions()))) { ShardUtils.shardCollection((MongoClient) connection.getNativeConnection(), tableMetadata); } } }
MongoMetadataEngine extends CommonsMetadataEngine<MongoClient> { @Override protected void createTable(TableMetadata tableMetadata, Connection<MongoClient> connection) throws ExecutionException { if (tableMetadata == null) { throw new MongoValidationException("the table metadata is required"); } if (tableMetadata.getName() == null) { throw new MongoValidationException("the table name is required"); } if (ShardUtils.isCollectionSharded(SelectorOptionsUtils.processOptions(tableMetadata.getOptions()))) { ShardUtils.shardCollection((MongoClient) connection.getNativeConnection(), tableMetadata); } } private  MongoMetadataEngine(MongoConnectionHandler connectionHandler); }
MongoMetadataEngine extends CommonsMetadataEngine<MongoClient> { @Override protected void createTable(TableMetadata tableMetadata, Connection<MongoClient> connection) throws ExecutionException { if (tableMetadata == null) { throw new MongoValidationException("the table metadata is required"); } if (tableMetadata.getName() == null) { throw new MongoValidationException("the table name is required"); } if (ShardUtils.isCollectionSharded(SelectorOptionsUtils.processOptions(tableMetadata.getOptions()))) { ShardUtils.shardCollection((MongoClient) connection.getNativeConnection(), tableMetadata); } } private  MongoMetadataEngine(MongoConnectionHandler connectionHandler); static MongoMetadataEngine getInstance(MongoConnectionHandler connectionHandler); }
MongoMetadataEngine extends CommonsMetadataEngine<MongoClient> { @Override protected void createTable(TableMetadata tableMetadata, Connection<MongoClient> connection) throws ExecutionException { if (tableMetadata == null) { throw new MongoValidationException("the table metadata is required"); } if (tableMetadata.getName() == null) { throw new MongoValidationException("the table name is required"); } if (ShardUtils.isCollectionSharded(SelectorOptionsUtils.processOptions(tableMetadata.getOptions()))) { ShardUtils.shardCollection((MongoClient) connection.getNativeConnection(), tableMetadata); } } private  MongoMetadataEngine(MongoConnectionHandler connectionHandler); static MongoMetadataEngine getInstance(MongoConnectionHandler connectionHandler);  }