@Override
 public void importIdentifiers(
     @NotNull IdentifiersMapping idMapping, Datasource sourceDatasource, @Nullable String select)
     throws IOException {
   try {
     for (ValueTable vt : sourceDatasource.getValueTables()) {
       if (idMapping.isForTable(vt)) {
         importIdentifiers(idMapping, vt, select);
       }
     }
   } finally {
     if (MagmaEngine.get().hasTransientDatasource(sourceDatasource.getName()))
       MagmaEngine.get().removeTransientDatasource(sourceDatasource.getName());
   }
 }
示例#2
0
  private Datasource createMockDatasource(String dsName, String... tables) {
    Datasource mockDatasource = createMock(Datasource.class);
    mockDatasource.initialise();
    EasyMock.expectLastCall().once();
    mockDatasource.dispose();
    EasyMock.expectLastCall().once();

    expect(mockDatasource.getName()).andReturn(dsName).anyTimes();
    for (String table : tables) {
      ValueTable mockTable = createMock(ValueTable.class);
      expect(mockTable.getName()).andReturn(table).anyTimes();
      expect(mockDatasource.getValueTable(table)).andReturn(mockTable).anyTimes();
      replay(mockTable);
    }
    replay(mockDatasource);
    return mockDatasource;
  }