use of org.talend.components.google.drive.data.GoogleDriveInputProperties in project components by Talend.
the class GoogleDriveDatastoreRuntime method doHealthChecks.
@Override
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) {
GoogleDriveDataSource ds = new GoogleDriveDataSource();
GoogleDriveInputProperties properties = new GoogleDriveInputProperties("health");
GoogleDriveDatasetProperties dataset = new GoogleDriveDatasetProperties("data");
dataset.setDatastoreProperties(datastore);
properties.setDatasetProperties(dataset);
ds.initialize(container, properties);
return Arrays.asList(ds.validate(container));
}
use of org.talend.components.google.drive.data.GoogleDriveInputProperties in project components by Talend.
the class GoogleDriveDatasetTestIT method setUp.
@Before
public void setUp() throws Exception {
datastore = new GoogleDriveDatastoreProperties("test");
datastore.setupProperties();
datastore.setupLayout();
dataset = new GoogleDriveDatasetProperties("test");
dataset.setupProperties();
dataset.setupLayout();
dataset.datastore.setReference(datastore);
dataset.listMode.setValue(ListMode.Both);
dataset.folder.setValue("root");
dataset.includeSubDirectories.setValue(true);
dataset.includeTrashedFiles.setValue(false);
properties = new GoogleDriveInputProperties("test");
properties.setupProperties();
properties.setupLayout();
properties.setDatasetProperties(dataset);
//
createdFolders = new ArrayList<>();
GoogleDriveDatasetRuntime rt = new GoogleDriveDatasetRuntime();
rt.initialize(null, dataset);
GoogleDriveUtils utils = rt.createDataSource(properties).getDriveUtils();
for (int i = 0; i < LIMIT; i++) {
createdFolders.add(utils.createFolder("root", "folder" + i));
}
}
use of org.talend.components.google.drive.data.GoogleDriveInputProperties in project components by Talend.
the class GoogleDriveDatasetRuntime method getSample.
@Override
public void getSample(int limit, Consumer<IndexedRecord> consumer) {
GoogleDriveInputProperties properties = new GoogleDriveInputProperties("sample");
properties.setDatasetProperties(dataset);
GoogleDriveInputReader reader = (GoogleDriveInputReader) createDataSource(properties).createReader(container);
reader.setLimit(limit);
ReaderDataProvider<IndexedRecord> provider = new ReaderDataProvider<>(reader, limit, consumer);
provider.retrieveData();
}
use of org.talend.components.google.drive.data.GoogleDriveInputProperties in project components by Talend.
the class GoogleDriveDataBaseTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
datasetSchema = //
SchemaBuilder.builder().record(GoogleDriveListDefinition.COMPONENT_NAME).fields().name(GoogleDriveListDefinition.RETURN_ID).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().name(GoogleDriveListDefinition.RETURN_NAME).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().name(GoogleDriveListDefinition.RETURN_MIME_TYPE).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().name(GoogleDriveListDefinition.RETURN_MODIFIED_TIME).prop(SchemaConstants.TALEND_IS_LOCKED, "true").prop(SchemaConstants.TALEND_COLUMN_PATTERN, //
"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'").prop(SchemaConstants.JAVA_CLASS_FLAG, //
Date.class.getCanonicalName()).prop(SchemaConstants.TALEND_COLUMN_DB_LENGTH, //
"255").type(AvroUtils._logicalTimestamp()).noDefault().name(GoogleDriveListDefinition.RETURN_SIZE).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().longType().noDefault().name(GoogleDriveListDefinition.RETURN_KIND).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().name(GoogleDriveListDefinition.RETURN_TRASHED).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().booleanType().noDefault().name(GoogleDriveListDefinition.RETURN_PARENTS).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().name(GoogleDriveListDefinition.RETURN_WEB_VIEW_LINK).prop(SchemaConstants.TALEND_IS_LOCKED, "true").type().nullable().stringType().noDefault().endRecord();
datasetSchema.addProp(SchemaConstants.TALEND_IS_LOCKED, "true");
dataSource = new GoogleDriveDataSource();
datastore = new GoogleDriveDatastoreProperties("test");
datastore.setupProperties();
dataset = new GoogleDriveDatasetProperties("test");
dataset.setupProperties();
dataset.setDatastoreProperties(datastore);
inputProperties = new GoogleDriveInputProperties("test");
inputProperties.setupProperties();
inputProperties.setDatasetProperties(dataset);
}
use of org.talend.components.google.drive.data.GoogleDriveInputProperties in project components by Talend.
the class GoogleDriveDatasetRuntimeTest method testCreateDataSource.
@Test
public void testCreateDataSource() throws Exception {
final GoogleDriveInputProperties inputProperties = new GoogleDriveInputProperties("test");
inputProperties.setDatasetProperties(ds);
GoogleDriveDataSource dtas = rt.createDataSource(inputProperties);
assertNotNull(dtas);
}
Aggregations