use of org.talend.daikon.properties.property.StringProperty in project tdi-studio-se by Talend.
the class TestComponentDefinition method getReturnProperties.
@Override
public Property[] getReturnProperties() {
StringProperty return1 = newProperty("return1");
setupI18N(new Property<?>[] { return1 });
return new Property[] { return1, RETURN_ERROR_MESSAGE_PROP, RETURN_TOTAL_RECORD_COUNT_PROP, RETURN_SUCCESS_RECORD_COUNT_PROP, RETURN_REJECT_RECORD_COUNT_PROP };
}
use of org.talend.daikon.properties.property.StringProperty in project components by Talend.
the class TestComponentDefinition method getReturnProperties.
@Override
public Property[] getReturnProperties() {
StringProperty return1 = newProperty("return1");
return1.setI18nMessageFormatter(getI18nMessageFormatter());
return new Property[] { return1, RETURN_ERROR_MESSAGE_PROP, RETURN_TOTAL_RECORD_COUNT_PROP, RETURN_SUCCESS_RECORD_COUNT_PROP, RETURN_REJECT_RECORD_COUNT_PROP };
}
use of org.talend.daikon.properties.property.StringProperty in project components by Talend.
the class AzureStorageRuntimeTest method testInitializeValidReferencedConnection.
@Test
public void testInitializeValidReferencedConnection() {
// Init the referenced connection
TAzureStorageConnectionProperties referenced = new TAzureStorageConnectionProperties("sharedConnection");
referenced.setupProperties();
referenced.accountName.setValue("fakeAccountName");
referenced.accountKey.setValue("fakeAccountKey=ANBHFYRJJFHRIKKJFU");
// Add referenced connection to the runtime container
runtimeContainer.setComponentData("shared-connection", AzureStorageRuntime.KEY_CONNECTION_PROPERTIES, referenced);
// reference connection by id
properties.referencedComponent.componentInstanceId = new StringProperty("connection").setValue("shared-connection");
// init and test
ValidationResult validationResult = this.azureStorageRuntime.initialize(runtimeContainer, properties);
assertEquals(ValidationResult.OK.getStatus(), validationResult.getStatus());
assertNotNull(azureStorageRuntime.getConnectionProperties());
}
use of org.talend.daikon.properties.property.StringProperty in project components by Talend.
the class CommonUtilsTest method testUpdatePossibleValues.
@Test
public void testUpdatePossibleValues() {
StringProperty property = new StringProperty("names");
property.setPossibleValues(Arrays.asList("a", "b", "c"));
property.setStoredValue("a");
List<String> newPossibleValues = Arrays.asList("a1", "b1", "c1");
CommonUtils.updatePossibleValues(property, newPossibleValues);
Assert.assertEquals("a1", property.getValue());
Assert.assertEquals(newPossibleValues, property.getPossibleValues());
newPossibleValues = Arrays.asList("b1", "a1", "c1", "d1", "e1", "f1");
CommonUtils.updatePossibleValues(property, newPossibleValues);
Assert.assertEquals("a1", property.getValue());
Assert.assertEquals(newPossibleValues, property.getPossibleValues());
}
use of org.talend.daikon.properties.property.StringProperty in project tdi-studio-se by Talend.
the class ComponentsUtilsTest method testGetFormalPossibleValues.
@Test
public void testGetFormalPossibleValues() {
ComponentService componentService = ComponentsUtils.getComponentService();
//$NON-NLS-1$
ComponentProperties props = (ComponentProperties) new TestProperties("test").init();
Form form = props.getForm(Form.MAIN);
Element element = new FakeElement(form.getName());
Widget testWidget = null;
Property testProperty = null;
Collection<Widget> widgets = form.getWidgets();
Iterator<Widget> widgetsIterator = widgets.iterator();
while (widgetsIterator.hasNext()) {
Widget widget = widgetsIterator.next();
NamedThing content = widget.getContent();
if (content instanceof Property) {
testWidget = widget;
testProperty = (Property) content;
break;
}
}
assertNotNull(testWidget);
assertNotNull(testProperty);
// Test NamedThing type
List<NamedThing> namedThings = new ArrayList<>();
namedThings.add(new SimpleNamedThing("p1", "Test P1"));
namedThings.add(new SimpleNamedThing("p2", "Test P2"));
namedThings.add(new SimpleNamedThing("p3", "Test P3"));
testProperty.setPossibleValues(namedThings);
GenericElementParameter param = new GenericElementParameter(element, props, form, testWidget, componentService);
param.setPossibleValues(testProperty.getPossibleValues());
List<NamedThing> possibleValues = ComponentsUtils.getFormalPossibleValues(param);
assertEquals(3, possibleValues.size());
namedThings.retainAll(possibleValues);
assertEquals(3, namedThings.size());
// Test Integer type which is not support yet
List<Integer> ints = new ArrayList<>();
ints.add(1);
ints.add(2);
ints.add(3);
testProperty.setPossibleValues(ints);
param = new GenericElementParameter(element, props, form, testWidget, componentService);
param.setPossibleValues(testProperty.getPossibleValues());
possibleValues = ComponentsUtils.getFormalPossibleValues(param);
assertEquals(0, possibleValues.size());
// Test StringProperty
testWidget = null;
StringProperty testStringProperty = null;
widgetsIterator = widgets.iterator();
while (widgetsIterator.hasNext()) {
Widget widget = widgetsIterator.next();
NamedThing content = widget.getContent();
if (content instanceof StringProperty) {
testWidget = widget;
testStringProperty = (StringProperty) content;
break;
}
}
assertNotNull(testWidget);
assertNotNull(testStringProperty);
testStringProperty.setPossibleNamedThingValues(namedThings);
param = new GenericElementParameter(element, props, form, testWidget, componentService);
param.setPossibleValues(testStringProperty.getPossibleValues());
possibleValues = ComponentsUtils.getFormalPossibleValues(param);
assertEquals(3, possibleValues.size());
List<String> pvNames = new ArrayList<>();
for (NamedThing pv : possibleValues) {
pvNames.add(pv.getName());
}
for (NamedThing nt : namedThings) {
assertTrue(pvNames.contains(nt.getName()));
}
}
Aggregations