use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.
the class NewGenericWizardMigrationTask method initGenericConnection.
protected GenericConnection initGenericConnection(Connection oldConnection) {
if (oldConnection == null) {
return null;
}
GenericConnection genericConnection = GenericMetadataFactory.eINSTANCE.createGenericConnection();
genericConnection.setName(oldConnection.getName());
genericConnection.setLabel(oldConnection.getLabel() != null ? oldConnection.getLabel() : oldConnection.getName());
genericConnection.setContextId(oldConnection.getContextId());
genericConnection.setContextMode(oldConnection.isContextMode());
return genericConnection;
}
use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.
the class DynamicComposite method resetComponentProperties.
private void resetComponentProperties() {
if (connectionItem != null) {
Connection connection = connectionItem.getConnection();
if (connection instanceof GenericConnection) {
GenericConnection genericConnection = (GenericConnection) connection;
genericConnection.setCompProperties(form.getProperties().toSerialized());
}
}
}
use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.
the class GenericRepositoryContentHandler method addNode.
@Override
public void addNode(ERepositoryObjectType type, RepositoryNode recBinNode, IRepositoryViewObject repositoryObject, RepositoryNode node) {
if (isRepObjType(type)) {
Item item = repositoryObject.getProperty().getItem();
if (item instanceof GenericConnectionItem) {
GenericConnectionItem connItem = (GenericConnectionItem) item;
GenericConnection connection = (GenericConnection) connItem.getConnection();
createSubNodes(node, repositoryObject, connection);
}
}
}
use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.
the class RepositoryUpdateTest method testRepositoryChange.
@Test
public void testRepositoryChange() throws PersistenceException {
//$NON-NLS-1$
String id = "testId";
try {
//$NON-NLS-1$ //$NON-NLS-2$
IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
Node node = new Node(component, new Process(new FakePropertyImpl()));
GenericConnection connection = (GenericConnection) createBasicConnection(id).getConnection();
setupPropertiesWithoutProxy(id);
updateNode(id, node, connection);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.useProxy", Boolean.FALSE);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.host", "\"\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.port", null);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.password", "\"\"");
setupPropertiesWithProxy(id);
updateNode(id, node, connection);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.useProxy", Boolean.TRUE);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.host", "\"host\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.port", 1234);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"proxyUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.password", "\"proxyPassword\"");
} finally {
IRepositoryViewObject object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
if (object != null) {
ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
}
}
}
use of org.talend.repository.generic.model.genericMetadata.GenericConnection in project tdi-studio-se by Talend.
the class RepositoryUpdateTest method createBasicConnection.
/**
* DOC nrousseau Comment method "createBasicConnection".
*
* @param id
* @return
* @throws PersistenceException
*/
private GenericConnectionItem createBasicConnection(String id) throws PersistenceException {
GenericConnection connection = GenericMetadataFactory.eINSTANCE.createGenericConnection();
Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
// ses the id to be used for persistence lookup
connectionProperty.setId(id);
connectionProperty.setAuthor(((RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
//$NON-NLS-1$
connectionProperty.setStatusCode("");
connectionProperty.setLabel("test");
GenericConnectionItem connectionItem = GenericMetadataFactory.eINSTANCE.createGenericConnectionItem();
connectionItem.setProperty(connectionProperty);
connectionItem.setConnection(connection);
connectionItem.setTypeName("salesforce");
ProxyRepositoryFactory.getInstance().create(connectionItem, new Path(""));
return connectionItem;
}
Aggregations