Package org.springframework.integration.xquery.support

Examples of org.springframework.integration.xquery.support.XQueryParameter


   */
  @Test
  public void fewParametersProvided() {
    XQueryExecutor executor = getExecutor();
    executor.setXQuery(EXT_VARIABLE_XQUERY);
    executor.addXQueryParameter(new XQueryParameter("class",Integer.valueOf(3)));
    try {
      executor.afterPropertiesSet();
    } catch (MessagingException e) {
      Assert.assertEquals("Missing parameter(s) [$name]", e.getMessage());
    }
View Full Code Here


      executor.setXQuery("'Hello World'");
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Only one of XQuery resource file or XQuery may be specified", e.getMessage());
    }
    Assert.assertNull(TestUtils.getPropertyValue(executor, "xQuery"));
    executor.addXQueryParameter(new XQueryParameter("name", "headers['studentName']"));
    executor.addXQueryParameter(new XQueryParameter("class", Integer.valueOf(1)));
    executor.afterPropertiesSet();
    Assert.assertNotNull(TestUtils.getPropertyValue(executor, "xQuery",String.class));
  }
View Full Code Here

    Message<File> message = MessageBuilder.withPayload(file)
                  .setHeader("studentName", "Jughead")
                  .build();
    XQueryExecutor executor = getExecutor();
    executor.setXQuery(EXT_VARIABLE_XQUERY);
    executor.addXQueryParameter(new XQueryParameter("name", "headers['studentName']"));
    executor.addXQueryParameter(new XQueryParameter("class", Integer.valueOf(1)));
    executor.afterPropertiesSet();
    List<Object> subjects;
    if(extractNodeText) {
      subjects = new ArrayList<Object>(executor.executeForString(message));
    }
View Full Code Here

    Map<String, XQueryParameter> params =
      TestUtils.getPropertyValue(transformer, "executor.xQueryParameterMap",Map.class);
    Assert.assertEquals(2, params.size());
    Assert.assertTrue(params.containsKey("name"));
    Assert.assertTrue(params.containsKey("class"));
    XQueryParameter param = params.get("name");
    Assert.assertEquals("name", param.getParameterName());
    Assert.assertEquals("headers['name']",
        TestUtils.getPropertyValue(param, "messageProcessor.expression.expression",String.class));

    destroy();
  }
View Full Code Here

    Map<String, XQueryParameter> params =
      TestUtils.getPropertyValue(router, "executor.xQueryParameterMap",Map.class);
    Assert.assertEquals(2, params.size());
    Assert.assertTrue(params.containsKey("name"));
    Assert.assertTrue(params.containsKey("class"));
    XQueryParameter param = params.get("name");
    Assert.assertEquals("name", param.getParameterName());
    Assert.assertEquals("headers['name']",
        TestUtils.getPropertyValue(param, "messageProcessor.expression.expression",String.class));

    destroy();
  }
View Full Code Here

    @SuppressWarnings("unchecked")
    Map<String, XQueryParameter> params =
      TestUtils.getPropertyValue(router, "executor.xQueryParameterMap",Map.class);
    Assert.assertEquals(1, params.size());
    Assert.assertTrue(params.containsKey("name"));
    XQueryParameter param = params.get("name");
    Assert.assertEquals("name", param.getParameterName());
    Assert.assertEquals("name",
        TestUtils.getPropertyValue(param, "parameterValue",String.class));
    destroy();
  }
View Full Code Here

      //bind the parameter values
      if(xQueryParameters != null && xQueryParameters.size() > 0) {
        //bind them one by one
        for(String parameter:xQueryParameters) {
          XQueryParameter xQueryParam = xQueryParameterMap.get(parameter);
          //TODO: Check what possible values can be supported to be set here
          //Accordingly do we need to set the third parameter for XQItemType
          expression.bindObject(new QName(xQueryParam.getParameterName()),
                          xQueryParam.evaluate(message), null);
        }
      }

      XQResultSequence result = expression.executeQuery();
      return mapper.mapResults(result);
View Full Code Here

TOP

Related Classes of org.springframework.integration.xquery.support.XQueryParameter

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.