use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.
the class ComponentServiceTest method testGetSchema.
@Test
public void testGetSchema() {
TestComponentProperties componentProperties = (TestComponentProperties) getComponentService().getComponentProperties(TestComponentDefinition.COMPONENT_NAME);
Schema aSchema = SchemaBuilder.builder().booleanType();
componentProperties.mainOutput.setValue(aSchema);
Schema schema = getComponentService().getSchema(componentProperties, componentProperties.getAllConnectors().iterator().next(), true);
assertEquals(aSchema, schema);
schema = getComponentService().getSchema(componentProperties, new Connector() {
@Override
public String getDisplayName() {
return null;
}
@Override
public String getTitle() {
return null;
}
@Override
public void setI18nMessageFormatter(I18nMessages i18nMessages) {
}
@Override
public String getI18nMessage(String key, Object... arguments) {
return null;
}
@Override
public String getName() {
return "foo";
}
}, true);
assertNull(schema);
}
use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.
the class ComponentServiceTest method testAvailalbleConnectors.
@Test
public void testAvailalbleConnectors() {
TestComponentProperties componentProperties = (TestComponentProperties) getComponentService().getComponentProperties(TestComponentDefinition.COMPONENT_NAME);
Set<? extends Connector> availableConnectors = getComponentService().getAvailableConnectors(componentProperties, Collections.EMPTY_SET, true);
assertThat(availableConnectors, not(is(empty())));
Connector mainConnector = componentProperties.getAllConnectors().iterator().next();
assertEquals(availableConnectors.iterator().next(), mainConnector);
availableConnectors = getComponentService().getAvailableConnectors(componentProperties, Collections.singleton(mainConnector), true);
assertThat(availableConnectors, is(empty()));
}
use of org.talend.components.api.service.common.testcomponent.TestComponentProperties in project components by Talend.
the class ComponentServiceTest method testGetWizardWithProps.
@Test
public void testGetWizardWithProps() {
TestComponentWizard wizard = (TestComponentWizard) getComponentService().getComponentWizard(TestComponentWizardDefinition.COMPONENT_WIZARD_NAME, "userdata");
wizard.props = new TestComponentProperties("props").init();
ComponentProperties props = (ComponentProperties) wizard.props;
List<ComponentWizard> wizards = getComponentService().getComponentWizardsForProperties(props, "userdata");
assertTrue(props == ((TestComponentWizard) wizards.get(0)).props);
}
Aggregations