Search in sources :

Example 1 with TJiraInputProperties

use of org.talend.components.jira.tjirainput.TJiraInputProperties in project components by Talend.

the class JiraSourceTest method setUp.

/**
 * Prepares required instances for tests
 */
@Before
public void setUp() {
    AvroRegistry registry = new AvroRegistry();
    Schema stringSchema = registry.getConverter(String.class).getSchema();
    Schema.Field jsonField = new Schema.Field("json", stringSchema, null, null, Order.ASCENDING);
    schema = Schema.createRecord("jira", null, null, false, Collections.singletonList(jsonField));
    schema.addProp(TALEND_IS_LOCKED, "true");
    inputProperties = new TJiraInputProperties("root");
    inputProperties.connection.hostUrl.setValue("hostValue");
    inputProperties.connection.basicAuthentication.userId.setValue("userIdValue");
    inputProperties.connection.basicAuthentication.password.setValue("passwordValue");
    inputProperties.resource.setValue(Resource.ISSUE);
    inputProperties.schema.schema.setValue(schema);
    inputProperties.jql.setValue("jqlValue");
    inputProperties.batchSize.setValue(50);
    inputProperties.projectId.setValue("projectIdValue");
}
Also used : AvroRegistry(org.talend.daikon.avro.AvroRegistry) Schema(org.apache.avro.Schema) TJiraInputProperties(org.talend.components.jira.tjirainput.TJiraInputProperties) Before(org.junit.Before)

Example 2 with TJiraInputProperties

use of org.talend.components.jira.tjirainput.TJiraInputProperties in project components by Talend.

the class JiraSource method initialize.

/**
 * Saves component properties in this object
 *
 * @param container {@link RuntimeContainer} instance
 * @param properties component properties
 */
@Override
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) {
    ValidationResult validate = super.initialize(container, properties);
    if (validate.getStatus() == Result.ERROR) {
        return validate;
    }
    TJiraInputProperties inputProperties = (TJiraInputProperties) properties;
    this.jql = inputProperties.jql.getStringValue();
    this.batchSize = inputProperties.batchSize.getValue();
    this.projectId = inputProperties.projectId.getStringValue();
    this.resourceType = inputProperties.resource.getValue();
    return ValidationResult.OK;
}
Also used : TJiraInputProperties(org.talend.components.jira.tjirainput.TJiraInputProperties) ValidationResult(org.talend.daikon.properties.ValidationResult)

Aggregations

TJiraInputProperties (org.talend.components.jira.tjirainput.TJiraInputProperties)2 Schema (org.apache.avro.Schema)1 Before (org.junit.Before)1 AvroRegistry (org.talend.daikon.avro.AvroRegistry)1 ValidationResult (org.talend.daikon.properties.ValidationResult)1