Search in sources :

Example 1 with TAzureStorageOutputTableProperties

use of org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties in project components by Talend.

the class AzureStorageTableComponentsTest method getAllSchemaPropertiesConnectors.

@Test
public void getAllSchemaPropertiesConnectors() {
    TAzureStorageOutputTableProperties p = new TAzureStorageOutputTableProperties("test");
    assertTrue(p.getAllSchemaPropertiesConnectors(true).isEmpty());
    HashSet<PropertyPathConnector> connectors = new HashSet<>();
    connectors.add(p.MAIN_CONNECTOR);
    assertEquals(connectors, p.getAllSchemaPropertiesConnectors(false));
}
Also used : PropertyPathConnector(org.talend.components.api.component.PropertyPathConnector) TAzureStorageOutputTableProperties(org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with TAzureStorageOutputTableProperties

use of org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties in project components by Talend.

the class AzureStorageTableWriterTest method setUp.

@Before
public void setUp() throws Exception {
    container = new RuntimeContainerMock();
    sink = new AzureStorageTableSink();
    properties = new TAzureStorageOutputTableProperties(PROP_ + "InputTable");
    properties.setupProperties();
    // valid fake connection
    properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
    properties.connection.protocol.setValue(Protocol.HTTP);
    properties.connection.accountName.setValue("fakeAccountName");
    properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
    properties.dieOnError.setValue(false);
    properties.tableName.setValue(TableHelper.generateRandomTableName());
    properties.actionOnTable.setValue(ActionOnTable.Create_table_if_does_not_exist);
    properties.actionOnData.setValue(ActionOnData.Insert);
    properties.schema.schema.setValue(TableHelper.getWriteSchema());
    properties.schemaReject.schema.setValue(TableHelper.getRejectSchema());
    properties.partitionKey.setStoredValue("PartitionKey");
    properties.rowKey.setStoredValue("RowKey");
}
Also used : TAzureStorageOutputTableProperties(org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties) RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)

Example 3 with TAzureStorageOutputTableProperties

use of org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties in project components by Talend.

the class TAzureStorageInputTableTestIT method createSampleDataset.

public void createSampleDataset(String table) throws Throwable {
    tableClient.getTableReference(table).createIfNotExists();
    TAzureStorageOutputTableProperties props = new TAzureStorageOutputTableProperties("tests");
    props = (TAzureStorageOutputTableProperties) setupConnectionProperties(props);
    props.setupProperties();
    props.schema.schema.setValue(getDynamicSchema());
    props.actionOnTable.setValue(ActionOnTable.Default);
    props.actionOnData.setValue(ActionOnData.Insert);
    props.schemaListener.afterSchema();
    props.tableName.setValue(table);
    Writer<?> writer = createWriter(props);
    writer.open("test-uid");
    for (String p : partitions) {
        for (String r : rows) {
            IndexedRecord entity = new GenericData.Record(getWriteSchema());
            entity.put(0, p);
            entity.put(1, r);
            entity.put(2, RandomStringUtils.random(50));
            entity.put(3, RandomStringUtils.randomNumeric(10));
            writer.write(entity);
        }
    }
    writer.close();
}
Also used : TAzureStorageOutputTableProperties(org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) IndexedRecord(org.apache.avro.generic.IndexedRecord)

Example 4 with TAzureStorageOutputTableProperties

use of org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties in project components by Talend.

the class AzureStorageTableSinkTest method setUp.

@Before
public void setUp() throws Exception {
    sink = new AzureStorageTableSink();
    p = new TAzureStorageOutputTableProperties("test");
    p.connection.setupProperties();
    p.setupProperties();
    sink.initialize(null, p);
}
Also used : TAzureStorageOutputTableProperties(org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties) Before(org.junit.Before)

Example 5 with TAzureStorageOutputTableProperties

use of org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties in project components by Talend.

the class AzureStorageTableWriteOperationTest method setUp.

@Before
public void setUp() throws Exception {
    container = new RuntimeContainerMock();
    sink = new AzureStorageTableSink();
    properties = new TAzureStorageOutputTableProperties(PROP_ + "InputTable");
    properties.setupProperties();
    // valid fake connection
    properties.connection = new TAzureStorageConnectionProperties(PROP_ + "Connection");
    properties.connection.protocol.setValue(Protocol.HTTP);
    properties.connection.accountName.setValue("fakeAccountName");
    properties.connection.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
    properties.dieOnError.setValue(false);
    properties.tableName.setValue("testtable");
    properties.actionOnTable.setValue(ActionOnTable.Create_table_if_does_not_exist);
    properties.actionOnData.setValue(ActionOnData.Insert);
    properties.schema.schema.setValue(TableHelper.getWriteSchema());
    properties.schemaReject.schema.setValue(TableHelper.getRejectSchema());
    properties.partitionKey.setStoredValue("PartitionKey");
    properties.rowKey.setStoredValue("RowKey");
}
Also used : TAzureStorageOutputTableProperties(org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties) RuntimeContainerMock(org.talend.components.azurestorage.RuntimeContainerMock) TAzureStorageConnectionProperties(org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties) Before(org.junit.Before)

Aggregations

TAzureStorageOutputTableProperties (org.talend.components.azurestorage.table.tazurestorageoutputtable.TAzureStorageOutputTableProperties)5 Before (org.junit.Before)2 RuntimeContainerMock (org.talend.components.azurestorage.RuntimeContainerMock)2 TAzureStorageConnectionProperties (org.talend.components.azurestorage.tazurestorageconnection.TAzureStorageConnectionProperties)2 HashSet (java.util.HashSet)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 Test (org.junit.Test)1 PropertyPathConnector (org.talend.components.api.component.PropertyPathConnector)1