Search in sources :

Example 1 with GoogleDriveDatasetProperties

use of org.talend.components.google.drive.data.GoogleDriveDatasetProperties 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));
}
Also used : GoogleDriveDatasetProperties(org.talend.components.google.drive.data.GoogleDriveDatasetProperties) GoogleDriveInputProperties(org.talend.components.google.drive.data.GoogleDriveInputProperties)

Example 2 with GoogleDriveDatasetProperties

use of org.talend.components.google.drive.data.GoogleDriveDatasetProperties 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));
    }
}
Also used : GoogleDriveDatasetProperties(org.talend.components.google.drive.data.GoogleDriveDatasetProperties) GoogleDriveInputProperties(org.talend.components.google.drive.data.GoogleDriveInputProperties) GoogleDriveUtils(org.talend.components.google.drive.runtime.GoogleDriveUtils) GoogleDriveDatasetRuntime(org.talend.components.google.drive.runtime.data.GoogleDriveDatasetRuntime) GoogleDriveDatastoreProperties(org.talend.components.google.drive.data.GoogleDriveDatastoreProperties) Before(org.junit.Before)

Example 3 with GoogleDriveDatasetProperties

use of org.talend.components.google.drive.data.GoogleDriveDatasetProperties 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);
}
Also used : GoogleDriveDatasetProperties(org.talend.components.google.drive.data.GoogleDriveDatasetProperties) GoogleDriveInputProperties(org.talend.components.google.drive.data.GoogleDriveInputProperties) GoogleDriveDatastoreProperties(org.talend.components.google.drive.data.GoogleDriveDatastoreProperties) Before(org.junit.Before)

Example 4 with GoogleDriveDatasetProperties

use of org.talend.components.google.drive.data.GoogleDriveDatasetProperties in project components by Talend.

the class GoogleDriveDatasetRuntimeTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    ds = new GoogleDriveDatasetProperties("test");
    ds.setupProperties();
    ds.setupLayout();
    dstore = new GoogleDriveDatastoreProperties("test");
    dstore.serviceAccountJSONFile.setValue("service_account.json");
    ds.setDatastoreProperties(dstore);
    ds.folder.setValue("folder");
    rt = new GoogleDriveDatasetRuntime();
}
Also used : GoogleDriveDatasetProperties(org.talend.components.google.drive.data.GoogleDriveDatasetProperties) GoogleDriveDatastoreProperties(org.talend.components.google.drive.data.GoogleDriveDatastoreProperties) Before(org.junit.Before)

Aggregations

GoogleDriveDatasetProperties (org.talend.components.google.drive.data.GoogleDriveDatasetProperties)4 Before (org.junit.Before)3 GoogleDriveDatastoreProperties (org.talend.components.google.drive.data.GoogleDriveDatastoreProperties)3 GoogleDriveInputProperties (org.talend.components.google.drive.data.GoogleDriveInputProperties)3 GoogleDriveUtils (org.talend.components.google.drive.runtime.GoogleDriveUtils)1 GoogleDriveDatasetRuntime (org.talend.components.google.drive.runtime.data.GoogleDriveDatasetRuntime)1