use of org.teiid.resource.adapter.google.gdata.SpreadsheetMetadataExtractor in project teiid by teiid.
the class MetadataLoadingTest method testMetadata.
@Test
public void testMetadata() {
SpreadsheetMetadataExtractor extractor = new SpreadsheetMetadataExtractor();
extractor.setGdataAPI(gdata);
extractor.setVisualizationAPI(visualizationAPI);
SpreadsheetInfo metadata = extractor.extractMetadata("integration_tests", false);
Assert.assertEquals(0, metadata.getWorksheetByName("Sheet1").getColumnCount());
Assert.assertEquals(2, metadata.getWorksheetByName("Sheet2").getColumnCount());
metadata = extractor.extractMetadata("people", false);
Assert.assertEquals(5, metadata.getWorksheetByName("list").getColumnCount());
Assert.assertEquals(4, metadata.getWorksheetByName("phones").getColumnCount());
}
use of org.teiid.resource.adapter.google.gdata.SpreadsheetMetadataExtractor in project teiid by teiid.
the class SpreadsheetConnectionImpl method getSpreadsheetInfo.
@Override
public SpreadsheetInfo getSpreadsheetInfo() {
SpreadsheetInfo info = spreadsheetInfo.get();
if (info == null) {
synchronized (spreadsheetInfo) {
info = spreadsheetInfo.get();
if (info == null) {
SpreadsheetMetadataExtractor metadataExtractor = new SpreadsheetMetadataExtractor();
metadataExtractor.setGdataAPI(gdata);
metadataExtractor.setVisualizationAPI(dataProtocol);
if (config.getSpreadsheetId() == null) {
info = metadataExtractor.extractMetadata(config.getSpreadsheetName(), false);
} else {
info = metadataExtractor.extractMetadata(config.getSpreadsheetId(), true);
}
spreadsheetInfo.set(info);
}
}
}
return info;
}
Aggregations