use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageBaseBlobTestIT method doContainerDelete.
/**
* doContainerDelete.
*
* @param container {@link String} container
* @return <code>Boolean</code> {@link Boolean} boolean
* @throws Exception the exception
*/
@SuppressWarnings("rawtypes")
public Boolean doContainerDelete(String container) throws Exception {
TAzureStorageContainerDeleteProperties properties = new TAzureStorageContainerDeleteProperties("tests");
setupConnectionProperties(properties);
properties.container.setValue(container);
BoundedReader reader = createBoundedReader(properties);
return reader.start();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageBaseBlobTestIT method doContainerExist.
/**
* doContainerExist - Checks if container exists
*
* @param container {@link String} container
* @return {@link Boolean} true if exists.
* @throws Exception the exception
*/
@SuppressWarnings("rawtypes")
public Boolean doContainerExist(String container) throws Exception {
TAzureStorageContainerExistProperties properties = new TAzureStorageContainerExistProperties("tests");
setupConnectionProperties(properties);
properties.container.setValue(container);
BoundedReader reader = createBoundedReader(properties);
return reader.start();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageDeleteReaderTestIT method testBlobDelete.
@SuppressWarnings("rawtypes")
@Test
public void testBlobDelete() throws Exception {
TAzureStorageDeleteProperties props = new TAzureStorageDeleteProperties("tests");
props.container.setValue(CONTAINER);
setupConnectionProperties(props);
RemoteBlobsTable rmt = new RemoteBlobsTable("tests");
List<String> pfx = new ArrayList<>();
List<Boolean> inc = new ArrayList<>();
pfx.add("");
inc.add(false);
rmt.prefix.setValue(pfx);
rmt.include.setValue(inc);
props.remoteBlobs = rmt;
BoundedReader reader = createBoundedReader(props);
assertTrue(reader.start());
List<String> blobs = listAllBlobs(CONTAINER);
// blob1.txt, blob2.txt & blob3.txt should be deleted
for (String b : TEST_ROOT_BLOBS) assertFalse(isInBlobList(b, blobs));
// the others should exist
for (String b : TEST_SUB_BLOBS) assertTrue(isInBlobList(b, blobs));
//
// delete sub1 and sub3
//
pfx.clear();
pfx.add("sub1/");
pfx.add("sub3/");
inc.clear();
inc.add(true);
inc.add(true);
rmt.prefix.setValue(pfx);
rmt.include.setValue(inc);
props.remoteBlobs = rmt;
reader = createBoundedReader(props);
assertTrue(reader.start());
blobs = listAllBlobs(CONTAINER);
for (String b : TEST_ROOT_BLOBS) assertFalse(isInBlobList(b, blobs));
for (String b : TEST_SUB1_BLOBS) assertFalse(isInBlobList(b, blobs));
for (String b : TEST_SUB3_BLOBS) assertFalse(isInBlobList(b, blobs));
// the others should exist
for (String b : TEST_SUB2_BLOBS) assertTrue(isInBlobList(b, blobs));
//
// finally delete everything
//
pfx.clear();
pfx.add("");
inc.clear();
inc.add(true);
rmt.prefix.setValue(pfx);
rmt.include.setValue(inc);
props.remoteBlobs = rmt;
reader = createBoundedReader(props);
assertTrue(reader.start());
blobs = listAllBlobs(CONTAINER);
assertTrue(blobs.size() == 0);
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class GoogleDriveCopyReaderTest method testStartCopyFileAndRename.
@Test
public void testStartCopyFileAndRename() throws Exception {
properties.rename.setValue(true);
source.initialize(container, properties);
BoundedReader reader = source.createReader(container);
assertTrue(reader.start());
IndexedRecord record = (IndexedRecord) reader.getCurrent();
assertNotNull(record);
assertEquals(2, record.getSchema().getFields().size());
assertEquals(SOURCE_ID, record.get(0));
assertEquals(DESTINATION_ID, record.get(1));
reader.close();
Map<String, Object> returnValues = reader.getReturnValues();
assertNotNull(returnValues);
assertEquals(SOURCE_ID, returnValues.get(GoogleDriveCopyDefinition.RETURN_SOURCE_ID));
assertEquals(DESTINATION_ID, returnValues.get(GoogleDriveCopyDefinition.RETURN_DESTINATION_ID));
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class GoogleDriveCopyReaderTest method testStartCopyFileAndRemove.
@Test
public void testStartCopyFileAndRemove() throws Exception {
properties.deleteSourceFile.setValue(true);
source.initialize(container, properties);
BoundedReader reader = source.createReader(container);
assertTrue(reader.start());
IndexedRecord record = (IndexedRecord) reader.getCurrent();
assertNotNull(record);
assertEquals(2, record.getSchema().getFields().size());
assertEquals(SOURCE_ID, record.get(0));
assertEquals(DESTINATION_ID, record.get(1));
reader.close();
Map<String, Object> returnValues = reader.getReturnValues();
assertNotNull(returnValues);
assertEquals(SOURCE_ID, returnValues.get(GoogleDriveCopyDefinition.RETURN_SOURCE_ID));
assertEquals(DESTINATION_ID, returnValues.get(GoogleDriveCopyDefinition.RETURN_DESTINATION_ID));
}
Aggregations