use of org.apache.cayenne.dbsync.merge.factory.MergerTokenFactoryProvider in project cayenne by apache.
the class MigrateAction method performAction.
public void performAction(ActionEvent e) {
DataSourceWizard connectWizard = getDataSourceWizard("Migrate DB Schema: Connect to Database");
if (connectWizard == null) {
return;
}
DataMap map = getProjectController().getCurrentDataMap();
if (map == null) {
throw new IllegalStateException("No current DataMap selected.");
}
dialogShown = false;
DbActionOptionsDialog optionsDialog = loaderOptionDialog(connectWizard);
if (dialogShown && optionsDialog == null) {
return;
}
String selectedCatalog = optionsDialog == null ? null : optionsDialog.getSelectedCatalog();
String selectedSchema = optionsDialog == null ? null : optionsDialog.getSelectedSchema();
MergerTokenFactoryProvider mergerTokenFactoryProvider = getApplication().getInjector().getInstance(MergerTokenFactoryProvider.class);
// ... show dialog...
new MergerOptions(getProjectController(), "Migrate DB Schema: Options", connectWizard.getConnectionInfo(), map, selectedCatalog, selectedSchema, mergerTokenFactoryProvider).startupAction();
}
use of org.apache.cayenne.dbsync.merge.factory.MergerTokenFactoryProvider in project cayenne by apache.
the class DefaultDbImportActionTest method buildDbImportAction.
private DefaultDbImportAction buildDbImportAction(FileProjectSaver projectSaver, DataMapLoader mapLoader, final DbLoader dbLoader) throws Exception {
Logger log = mock(Logger.class);
when(log.isDebugEnabled()).thenReturn(true);
when(log.isInfoEnabled()).thenReturn(true);
DbAdapter dbAdapter = mock(DbAdapter.class);
DbAdapterFactory adapterFactory = mock(DbAdapterFactory.class);
when(adapterFactory.createAdapter((DataNodeDescriptor) any(), (DataSource) any())).thenReturn(dbAdapter);
DataSourceFactory dataSourceFactory = mock(DataSourceFactory.class);
DataSource mock = mock(DataSource.class);
when(dataSourceFactory.getDataSource((DataNodeDescriptor) any())).thenReturn(mock);
DataChannelMetaData metaData = mock(DataChannelMetaData.class);
MergerTokenFactoryProvider mergerTokenFactoryProvider = mock(MergerTokenFactoryProvider.class);
when(mergerTokenFactoryProvider.get((DbAdapter) any())).thenReturn(new DefaultMergerTokenFactory());
DataChannelDescriptorLoader dataChannelDescriptorLoader = mock(DataChannelDescriptorLoader.class);
return new DefaultDbImportAction(log, projectSaver, dataSourceFactory, adapterFactory, mapLoader, mergerTokenFactoryProvider, dataChannelDescriptorLoader, metaData) {
protected DbLoader createDbLoader(DbAdapter adapter, Connection connection, DbImportConfiguration config) {
return dbLoader;
}
};
}
Aggregations