Search in sources :

Example 1 with MockComponentDefinition

use of org.talend.components.service.rest.mock.MockComponentDefinition in project components by Talend.

the class ConnectorDtoTest method createConnectorList_source.

@Test
public void createConnectorList_source() throws Exception {
    // Partial mock to override the connectors available for the definition.
    MockComponentDefinition def = new MockComponentDefinition("components", ConnectorTopology.OUTGOING);
    def.setPropertyClass(MockComponentSourceProperties.class);
    // The default components don't have connectors specified.
    List<ConnectorDto> actual = ConnectorDto.createConnectorList(def);
    assertThat(actual, hasSize(1));
    assertThat(actual.get(0).getConnectorType(), is(ConnectorTypology.SOURCE));
    assertThat(actual.get(0).getFlowType(), is("MAIN"));
}
Also used : MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) Test(org.junit.Test)

Example 2 with MockComponentDefinition

use of org.talend.components.service.rest.mock.MockComponentDefinition in project components by Talend.

the class ConnectorDtoTest method createConnectorList_empty.

@Test
public void createConnectorList_empty() throws Exception {
    // The default components don't have connectors specified.
    List<ConnectorDto> actual = ConnectorDto.createConnectorList(new MockComponentDefinition("components"));
    assertThat(actual, empty());
}
Also used : MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) Test(org.junit.Test)

Example 3 with MockComponentDefinition

use of org.talend.components.service.rest.mock.MockComponentDefinition in project components by Talend.

the class ConnectorDtoTest method createConnectorList_sink.

@Test
public void createConnectorList_sink() throws Exception {
    // Partial mock to override the connectors available for the definition.
    MockComponentDefinition def = new MockComponentDefinition("components", ConnectorTopology.OUTGOING);
    def.setPropertyClass(MockComponentSinkProperties.class);
    // The default components don't have connectors specified.
    List<ConnectorDto> actual = ConnectorDto.createConnectorList(def);
    assertThat(actual, hasSize(1));
    assertThat(actual.get(0).getConnectorType(), is(ConnectorTypology.SINK));
    assertThat(actual.get(0).getFlowType(), is("REJECT"));
}
Also used : MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) Test(org.junit.Test)

Example 4 with MockComponentDefinition

use of org.talend.components.service.rest.mock.MockComponentDefinition in project components by Talend.

the class ConnectorDtoTest method createConnectorList_transformer.

@Test
public void createConnectorList_transformer() throws Exception {
    // Partial mock to override the connectors available for the definition.
    MockComponentDefinition def = new MockComponentDefinition("components", ConnectorTopology.OUTGOING);
    def.setPropertyClass(MockComponentTransformerProperties.class);
    // The default components don't have connectors specified.
    List<ConnectorDto> actual = ConnectorDto.createConnectorList(def);
    assertThat(actual, hasSize(2));
    assertThat(actual.get(0).getConnectorType(), is(ConnectorTypology.SINK));
    assertThat(actual.get(0).getFlowType(), is("REJECT"));
    assertThat(actual.get(1).getConnectorType(), is(ConnectorTypology.SOURCE));
    assertThat(actual.get(1).getFlowType(), is("MAIN"));
}
Also used : MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) Test(org.junit.Test)

Example 5 with MockComponentDefinition

use of org.talend.components.service.rest.mock.MockComponentDefinition in project components by Talend.

the class DefinitionsControllerTest method getComponentsDefinitions.

private Map<String, ComponentDefinition> getComponentsDefinitions() {
    Map<String, ComponentDefinition> definitions = new HashMap<>();
    definitions.put("source_1", new MockComponentDefinition("source_1", "icon_key_source_1", INCOMING));
    definitions.put("source_2", new MockComponentDefinition("source_2", INCOMING));
    definitions.put("source_3", new MockComponentDefinition("source_2", ExecutionEngine.BEAM, INCOMING));
    definitions.put("sink_1", new MockComponentDefinition("sink_1", "icon_key_sink_1", OUTGOING));
    definitions.put("sink_2", new MockComponentDefinition("sink_2", ExecutionEngine.DI_SPARK_BATCH, OUTGOING));
    definitions.put("sink_3", new MockComponentDefinition("sink_3", ExecutionEngine.DI_SPARK_BATCH, OUTGOING));
    definitions.put("transformer_1", new MockComponentDefinition("transformer_1", "icon_key_transformer_1", ExecutionEngine.DI_SPARK_STREAMING, INCOMING_AND_OUTGOING));
    definitions.put("transformer_2", new MockComponentDefinition("transformer_2", ExecutionEngine.DI_SPARK_STREAMING, INCOMING_AND_OUTGOING));
    definitions.put("transformer_3", new MockComponentDefinition("transformer_3", ExecutionEngine.DI_SPARK_STREAMING, INCOMING_AND_OUTGOING));
    definitions.put("config_1", new MockComponentDefinition("config_1", "icon_key_config_1", NONE));
    definitions.put("config_2", new MockComponentDefinition("config_2", NONE));
    definitions.put("config_3", new MockComponentDefinition("config_3", NONE));
    definitions.put("s&s_1", new MockComponentDefinition("ss_1", "icon_key_ss_1", INCOMING, OUTGOING));
    definitions.put("s&s_2", new MockComponentDefinition("ss_2", INCOMING, OUTGOING));
    return definitions;
}
Also used : MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) HashMap(java.util.HashMap) MockComponentDefinition(org.talend.components.service.rest.mock.MockComponentDefinition) ComponentDefinition(org.talend.components.api.component.ComponentDefinition)

Aggregations

MockComponentDefinition (org.talend.components.service.rest.mock.MockComponentDefinition)5 Test (org.junit.Test)4 HashMap (java.util.HashMap)1 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)1