Search in sources :

Example 36 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class ConfigData method setActiveConfig.

private FixedQuerySender setActiveConfig(String activeConfig, FixedQuerySender qs) {
    Parameter param = new Parameter();
    param.setName(ACTIVE_CONFIG);
    if ("on".equals(activeConfig)) {
        param.setValue(qs.getDbmsSupport().getBooleanValue(true));
    } else {
        param.setValue(qs.getDbmsSupport().getBooleanValue(false));
    }
    qs.addParameter(param);
    return qs;
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter)

Example 37 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class ConfigData method activeConfigQuery.

private String activeConfigQuery(IPipeLineSession session, String name, String formJmsRealm, String result) throws PipeRunException {
    FixedQuerySender qs = (FixedQuerySender) ibisContext.createBeanAutowireByName(FixedQuerySender.class);
    try {
        qs.setName("QuerySender");
        qs.setJmsRealm(formJmsRealm);
        qs.setQueryType("update");
        qs.setQuery("UPDATE IBISCONFIG SET ACTIVECONFIG = '" + qs.getDbmsSupport().getBooleanValue(false) + "' WHERE NAME=?");
        Parameter param = new Parameter();
        param.setName("name");
        param.setValue(name);
        qs.addParameter(param);
        qs.setScalar(true);
        qs.configure();
        qs.open();
        ParameterResolutionContext prc = new ParameterResolutionContext(DUMMY, session);
        result = qs.sendMessage(DUMMY, DUMMY, prc);
    } catch (Exception t) {
        throw new PipeRunException(this, getLogPrefix(session) + "Error occured on executing jdbc query", t);
    } finally {
        qs.close();
    }
    return result;
}
Also used : PipeRunException(nl.nn.adapterframework.core.PipeRunException) Parameter(nl.nn.adapterframework.parameters.Parameter) ParameterResolutionContext(nl.nn.adapterframework.parameters.ParameterResolutionContext) FixedQuerySender(nl.nn.adapterframework.jdbc.FixedQuerySender) PipeRunException(nl.nn.adapterframework.core.PipeRunException) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 38 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class LdapSenderTest method updateAttribute.

@Test
public void updateAttribute() throws SAXException, IOException, ConfigurationException, SenderException, LDAPException {
    String result;
    LDAPConnection connection = inMemoryDirectoryServer.getConnection();
    LdapSender ldapSender = null;
    try {
        ldapSender = new LdapSender();
        ldapSender.setLdapProviderURL("ldap://" + connection.getConnectedAddress() + ":" + connection.getConnectedPort());
        ldapSender.setOperation("update");
        Parameter parameter = new Parameter();
        parameter.setName("entryName");
        parameter.setValue("cn=LEA Administrator,ou=groups,ou=development," + baseDNs);
        ldapSender.addParameter(parameter);
        ldapSender.configure();
        ldapSender.open();
        result = ldapSender.sendMessage("dummy", "<attributes><attribute name=\"mail\"><value>info@ibissource.org</value></attribute></attributes>");
    } finally {
        if (ldapSender != null) {
            ldapSender.close();
        }
        if (connection != null) {
            connection.close();
        }
    }
    assertEquals("<LdapResult>Success</LdapResult>", result);
    compareXML("Ldap/expected/updateAttribute.xml", getTree());
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) Test(org.junit.Test)

Example 39 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class LdapSenderTest method updateNewEntry.

@Test
public void updateNewEntry() throws SAXException, IOException, ConfigurationException, SenderException, LDAPException {
    String result;
    LDAPConnection connection = inMemoryDirectoryServer.getConnection();
    LdapSender ldapSender = null;
    try {
        ldapSender = new LdapSender();
        ldapSender.setLdapProviderURL("ldap://" + connection.getConnectedAddress() + ":" + connection.getConnectedPort());
        ldapSender.setOperation("update");
        Parameter parameter = new Parameter();
        parameter.setName("entryName");
        parameter.setValue("cn=LEA Administrator,ou=groups,ou=development," + baseDNs);
        ldapSender.addParameter(parameter);
        Parameter parameter2 = new Parameter();
        parameter2.setName("newEntryName");
        parameter2.setValue("cn=LEA Administrator,ou=people,ou=development," + baseDNs);
        ldapSender.addParameter(parameter2);
        ldapSender.configure();
        ldapSender.open();
        result = ldapSender.sendMessage("dummy", "<dummy/>");
    } finally {
        if (ldapSender != null) {
            ldapSender.close();
        }
        if (connection != null) {
            connection.close();
        }
    }
    assertEquals("<LdapResult>Success</LdapResult>", result);
    compareXML("Ldap/expected/updateNewEntry.xml", getTree());
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection) Test(org.junit.Test)

Example 40 with Parameter

use of nl.nn.adapterframework.parameters.Parameter in project iaf by ibissource.

the class LdapSenderTest method getTree.

private String getTree() throws LDAPException, ConfigurationException, SenderException {
    LDAPConnection connection = inMemoryDirectoryServer.getConnection();
    LdapSender ldapSender = null;
    try {
        ldapSender = new LdapSender();
        ldapSender.setLdapProviderURL("ldap://" + connection.getConnectedAddress() + ":" + connection.getConnectedPort());
        ldapSender.setOperation("getTree");
        Parameter parameter = new Parameter();
        parameter.setName("entryName");
        parameter.setValue(baseDNs);
        ldapSender.addParameter(parameter);
        ldapSender.configure();
        ldapSender.open();
        return ldapSender.sendMessage("dummy", "dummy");
    } finally {
        if (ldapSender != null) {
            ldapSender.close();
        }
        if (connection != null) {
            connection.close();
        }
    }
}
Also used : Parameter(nl.nn.adapterframework.parameters.Parameter) LDAPConnection(com.unboundid.ldap.sdk.LDAPConnection)

Aggregations

Parameter (nl.nn.adapterframework.parameters.Parameter)41 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)19 ParameterResolutionContext (nl.nn.adapterframework.parameters.ParameterResolutionContext)15 ParameterList (nl.nn.adapterframework.parameters.ParameterList)13 PipeRunException (nl.nn.adapterframework.core.PipeRunException)12 IOException (java.io.IOException)7 FixedQuerySender (nl.nn.adapterframework.jdbc.FixedQuerySender)7 ParameterException (nl.nn.adapterframework.core.ParameterException)6 PipeRunResult (nl.nn.adapterframework.core.PipeRunResult)6 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)5 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)4 Map (java.util.Map)4 Test (org.junit.Test)3 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedList (java.util.LinkedList)2