use of org.talend.daikon.NamedThing in project components by Talend.
the class SnowflakeTableListProperties method afterFormFinishMain.
public ValidationResult afterFormFinishMain(Repository<Properties> repo) throws Exception {
ValidationResult vr = SnowflakeSourceOrSink.validateConnection(this);
if (vr.getStatus() != ValidationResult.Result.OK) {
return vr;
}
String connRepLocation = repo.storeProperties(connection, connection.name.getValue(), repositoryLocation, null);
for (NamedThing nl : selectedTableNames.getValue()) {
String tableId = nl.getName();
SnowflakeTableProperties tableProps = new SnowflakeTableProperties(tableId);
tableProps.connection = connection;
tableProps.init();
Schema schema = SnowflakeSourceOrSink.getSchema(null, this, tableId);
tableProps.tableName.setValue(tableId);
tableProps.main.schema.setValue(schema);
repo.storeProperties(tableProps, nl.getName(), connRepLocation, "main.schema");
}
return ValidationResult.OK;
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class NetSuiteClientServiceIT method testGetSearchableTypes.
@Test
public void testGetSearchableTypes() throws Exception {
NetSuiteClientService<?> connection = webServiceTestFixture.getClientService();
connection.login();
Collection<NamedThing> searches = connection.getMetaDataSource().getSearchableTypes();
for (NamedThing search : searches) {
assertNotNull(search);
assertNotNull(search.getName());
assertNotNull(search.getDisplayName());
SearchRecordTypeDesc searchRecordInfo = connection.getMetaDataSource().getSearchRecordType(search.getName());
assertNotNull("Search record def found: " + search.getName(), searchRecordInfo);
}
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class PubSubDatasetProperties method beforeSubscription.
public ValidationResult beforeSubscription() {
PubSubDatasetDefinition definition = new PubSubDatasetDefinition();
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(this);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, getClass().getClassLoader())) {
IPubSubDatasetRuntime runtime = (IPubSubDatasetRuntime) sandboxedInstance.getInstance();
runtime.initialize(null, this);
List<NamedThing> topics = new ArrayList<>();
for (String topicName : runtime.listSubscriptions()) {
topics.add(new SimpleNamedThing(topicName, topicName));
}
subscription.setPossibleValues(topics);
return ValidationResult.OK;
} catch (Exception e) {
return new ValidationResult(new ComponentException(e));
}
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class MarketoSourceOrSink method getSchemaNames.
@Override
public List<NamedThing> getSchemaNames(RuntimeContainer container) throws IOException {
List<NamedThing> customObjects = new ArrayList<>();
MarketoClientServiceExtended client = (MarketoClientServiceExtended) getClientService(null);
TMarketoInputProperties ip = new TMarketoInputProperties("COSchemas");
ip.init();
ip.connection = properties.getConnectionProperties();
ip.inputOperation.setValue(InputOperation.CustomObject);
ip.customObjectAction.setValue(CustomObjectAction.list);
ip.customObjectNames.setValue("");
ip.schemaInput.schema.setValue(MarketoConstants.getCustomObjectDescribeSchema());
MarketoRecordResult r = client.listCustomObjects(ip);
for (IndexedRecord co : r.getRecords()) {
// name cannot be null
String name = co.get(0).toString();
Object displayName = co.get(1);
if (displayName == null) {
displayName = name;
}
customObjects.add(new SimpleNamedThing(name, displayName.toString()));
}
//
return customObjects;
}
use of org.talend.daikon.NamedThing in project components by Talend.
the class MarketoCustomObjectsSchemasPropertiesTest method testAfterFormFinishCustomObjects.
@Test
public void testAfterFormFinishCustomObjects() throws Exception {
try (SandboxedInstanceTestFixture sandboxedInstanceTestFixture = new SandboxedInstanceTestFixture()) {
sandboxedInstanceTestFixture.setUp();
properties.beforeFormPresentCustomObjects();
List<NamedThing> o = new ArrayList<>();
o.add(new SimpleNamedThing("car_c", "car_c"));
properties.selectedCustomObjectsNames.setValue(o);
assertEquals(Result.OK, properties.afterFormFinishCustomObjects(repo).getStatus());
//
o.add(new SimpleNamedThing("car_except", "car_except"));
properties.selectedCustomObjectsNames.setValue(o);
assertEquals(Result.ERROR, properties.afterFormFinishCustomObjects(repo).getStatus());
}
}
Aggregations