Package speculoos.jndi.mappers

Examples of speculoos.jndi.mappers.SearchMapperImpl


        Attributes attributes) throws SAXException {
      /* defined output map ? */
      Object input = maps.get(attributes.getValue("input"));
      Object output = maps.get(attributes.getValue("output"));
      if (input != null && output != null) {
        SearchMapperImpl smi = ((SearchMapperImpl) current);
        try {
          smi.setFilter((Class) input, (Map) output);
        } catch (ClassCastException e) {
          throw new SAXException(
              "Incorrect types for input/output attributes in search '"
                  + attributes.getValue("name")
                  + "'. Output should be a map and input a bean.");
View Full Code Here


  class SearchHandler implements TagHandler {

    public void startElement(String uri, String localName, String qName,
        Attributes attributes) throws SAXException {
      SearchMapperImpl smi = new SearchMapperImpl(attributes
          .getValue("name"));
      smi.setTypeHelper(typeHelper);
      /* defined input/output map ? */
      Object output = maps.get(attributes.getValue("output"));
      Object input = maps.get(attributes.getValue("input"));
      if (output != null && input != null) {
        try {
          smi.setOutput((Class) input, (Map) output);
        } catch (ClassCastException e) {
          throw new SAXException(
              "Incorrect types for input/output attributes in search '"
                  + attributes.getValue("name")
                  + "'. Output should be a map and input a bean.");
View Full Code Here

    }

    public void endElement(String uri, String localName, String qName)
        throws SAXException {
      // add mapper to source
      SearchMapperImpl smi = (SearchMapperImpl) pop();
      add(smi.getName(), smi);
      ((JNDISource) current).add(smi.getName(), smi);
      link(smi.getName(), ((JNDISource) current).getName());
    }
View Full Code Here

    /* create source */
    JNDISource src = new JNDISource();
    /* configure source */
    src.addParameters(env);
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl("search1");
    VariableString root = new VariableString("cn=${nom}");
    smi.setRoot(root);
    smi.setTypeHelper(new TypeHelper());
    src.add("search1", smi);
    /* start source */
    src.start(env);
    /* create mapper */
    SearchMapper sm = (SearchMapper) src.create("search1", new HashMap());
View Full Code Here

    /* create source */
    JNDISource src = new JNDISource();
    /* configure source */
    src.addParameters(env);
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl();
    VariableString root = new VariableString("cn=${nom}");
    smi.setRoot(root);
    smi.setTypeHelper(new TypeHelper());
    src.add("search1", smi);
    /* create mapper */
    try {
      SearchMapper sm = (SearchMapper) src.create("search1",
          new HashMap());
View Full Code Here

    /* create source */
    JNDISource src = new JNDISource();
    /* configure source */
    src.addParameters(env);
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl();
    VariableString root = new VariableString("cn=${nom}");
    smi.setRoot(root);
    smi.setTypeHelper(new TypeHelper());
    src.add("search1", smi);
    src.start(env);
    /* create mapper */
    try {
      SearchMapper sm = (SearchMapper) src
View Full Code Here

    /* create source */
    JNDISource src = new JNDISource();
    /* configure source */
    src.addParameters(env);
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl();
    VariableString root = new VariableString("cn=${nom}");
    smi.setRoot(root);
    smi.setTypeHelper(new TypeHelper());
    src.add("search1", smi);
    src.start(env);
    /* create mapper */
    try {
      SearchMapper sm = (SearchMapper) src.create("search1",
View Full Code Here

    /* start */
    Map genv = new HashMap();
    genv.put("toto", "toto");
    genv.put("titi", "titi");
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl();
    VariableString root = new VariableString("cn=${nom}");
    smi.setRoot(root);
    smi.setTypeHelper(new TypeHelper());
    src.add("search1", smi);
    src.start(genv);
    /* check environnement is passed to mapper */
    SearchMapperImpl sm = (SearchMapperImpl) src.create("search1", genv);
    assertEquals("Environment badly configured", "tututiti", sm
        .getEnvironment().get("var2"));
    assertEquals("Environment badly configured", "toto", sm
        .getEnvironment().get("toto"));
  }
View Full Code Here

    /* start */
    Map genv = new HashMap();
    genv.put("toto", "toto");
    genv.put("titi", "titi");
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl("search1");
    VariableString root = new VariableString("ou=Personnes");
    smi.setRoot(root);
    VariableString filter = new VariableString(
        "(fullName=${self.name} ${self.surname})");
    smi.getInputChain().addMapper(new StringVariable("filter", filter));
    smi.setTypeHelper(new TypeHelper());
      src.add("search1", smi);
    src.start(genv);
    /* check environnement is passed to mapper */
    SearchMapperImpl sm = (SearchMapperImpl) src.create("search1", genv);
    Map h = new HashMap();
    h.put("name","name");
    h.put("surname","surname");
    /* populate input */
    Personne input = new Personne();
    input.setName("NAQUIN");
    input.setSurname("thiery");
    sm.setOutput(Personne.class,h);
    sm.map(input, null);
    src.release(sm);
    try {
      src.release(sm);
    } catch (Exception e) {
      fail("Multiple releases should not throw exceptions");
View Full Code Here

    /* start */
    Map genv = new HashMap();
    genv.put("toto", "toto");
    genv.put("titi", "titi");
    /* add mapper */
    SearchMapperImpl smi = new SearchMapperImpl("search1");
    VariableString root = new VariableString("ou=Personnes");
    smi.setRoot(root);
    VariableString filter = new VariableString(
        "(fullName=${self.name} ${self.surname})");
    smi.getInputChain().addMapper(new StringVariable("filter", filter));
    smi.setTypeHelper(new TypeHelper());
      src.add("search1", smi);
    src.start(genv);
    /* check environnement is passed to mapper */
    SearchMapperImpl sm = (SearchMapperImpl) src.create("search1", genv);
    /* populate input */
    Map h = new HashMap();
    h.put("name","name");
    h.put("surname","surname");
    Personne input = new Personne();
    input.setName("NAQUIN");
    input.setSurname("thiery");
    sm.setOutput(Personne.class,h);
    sm.map(input, null);
    src.release(sm);
    try {
      input.setSurname("thiery");
        sm.map(input, null);
      fail("Map should fail after  releases");
    } catch (Exception e) {
    }

  }
View Full Code Here

TOP

Related Classes of speculoos.jndi.mappers.SearchMapperImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.