use of io.mantisrx.connector.iceberg.sink.committer.metrics.CommitterMetrics in project mantis by Netflix.
the class IcebergCommitterStage method newTransformer.
/**
* Use this to instantiate a new transformer from a given {@link Context}.
*/
public static Transformer newTransformer(Context context) {
CommitterConfig config = new CommitterConfig(context.getParameters());
CommitterMetrics metrics = new CommitterMetrics();
Catalog catalog = context.getServiceLocator().service(Catalog.class);
TableIdentifier id = TableIdentifier.of(config.getCatalog(), config.getDatabase(), config.getTable());
Table table = catalog.loadTable(id);
IcebergCommitter committer = new IcebergCommitter(table);
return new Transformer(config, metrics, committer, Schedulers.computation());
}
use of io.mantisrx.connector.iceberg.sink.committer.metrics.CommitterMetrics in project mantis by Netflix.
the class IcebergCommitterStageTest method setUp.
@BeforeEach
void setUp() {
this.scheduler = new TestScheduler();
this.subscriber = new TestSubscriber<>();
Parameters parameters = StageOverrideParameters.newParameters();
CommitterConfig config = new CommitterConfig(parameters);
CommitterMetrics metrics = new CommitterMetrics();
this.committer = mock(IcebergCommitter.class);
transformer = new IcebergCommitterStage.Transformer(config, metrics, committer, scheduler);
ServiceLocator serviceLocator = mock(ServiceLocator.class);
when(serviceLocator.service(Configuration.class)).thenReturn(mock(Configuration.class));
this.catalog = mock(Catalog.class);
Table table = mock(Table.class);
when(table.spec()).thenReturn(PartitionSpec.unpartitioned());
when(this.catalog.loadTable(any())).thenReturn(table);
when(serviceLocator.service(Catalog.class)).thenReturn(this.catalog);
this.context = mock(Context.class);
when(this.context.getParameters()).thenReturn(parameters);
when(this.context.getServiceLocator()).thenReturn(serviceLocator);
}
Aggregations