Search in sources :

Example 1 with Mode

use of org.talend.components.jira.Mode in project components by Talend.

the class TJiraOutputPropertiesTest method testSetupProperties.

/**
 * Checks {@link TJiraOutputProperties#setupProperties()} sets correct initial property values
 */
@Test
public void testSetupProperties() {
    AvroRegistry registry = new AvroRegistry();
    Schema stringSchema = registry.getConverter(String.class).getSchema();
    Schema.Field jsonField = new Schema.Field("json", stringSchema, null, null, Order.ASCENDING);
    Schema expectedSchema = Schema.createRecord("jira", null, null, false, Collections.singletonList(jsonField));
    expectedSchema.addProp(TALEND_IS_LOCKED, "true");
    TJiraOutputProperties properties = new TJiraOutputProperties("root");
    properties.setupProperties();
    Action actionValue = properties.action.getValue();
    Resource resourceValue = properties.resource.getValue();
    boolean deleteSubtasksValue = properties.deleteSubtasks.getValue();
    Mode modeValue = properties.mode.getValue();
    Schema schema = properties.schema.schema.getValue();
    assertThat(actionValue, equalTo(Action.INSERT));
    assertThat(resourceValue, equalTo(Resource.ISSUE));
    assertThat(deleteSubtasksValue, equalTo(true));
    assertThat(modeValue, equalTo(Mode.ADVANCED));
    assertThat(schema, equalTo(expectedSchema));
}
Also used : Action(org.talend.components.jira.Action) AvroRegistry(org.talend.daikon.avro.AvroRegistry) Schema(org.apache.avro.Schema) Mode(org.talend.components.jira.Mode) Resource(org.talend.components.jira.Resource) Test(org.junit.Test)

Aggregations

Schema (org.apache.avro.Schema)1 Test (org.junit.Test)1 Action (org.talend.components.jira.Action)1 Mode (org.talend.components.jira.Mode)1 Resource (org.talend.components.jira.Resource)1 AvroRegistry (org.talend.daikon.avro.AvroRegistry)1