Examples of XmlRpcString


Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

    String result = "Luke";
    this.xmlRpcServiceExporter.invoke(xmlRpcRequest);
    this.xmlRpcServiceExporterControl.setReturnValue(result);

    // expectation: create a XML-RPC element from the result.
    XmlRpcString parameter = new XmlRpcString(result);
    this.xmlRpcElementFactory.createXmlRpcElement(result);
    this.xmlRpcElementFactoryControl.setReturnValue(parameter);

    // expectation: serialize the XML-RPC response.
    byte[] serializedXmlRpcResponse = { 5, 7, 3 };
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   * <code>{@link XmlRpcResponseWriter#writeResponse(XmlRpcResponse)}</code>
   * creates the XML-RPC response correctly if the response contains array
   * parameters.
   */
  public final void testWriteResponseWithArrayParameters() {
    XmlRpcString firstValue = new XmlRpcString("Darth Vader");
    XmlRpcString secondValue = new XmlRpcString("Darth Sidius");

    XmlRpcArray xmlRpcArray = new XmlRpcArray();
    xmlRpcArray.add(firstValue);
    xmlRpcArray.add(secondValue);

    XmlRpcElement[] parameters = { xmlRpcArray };
    XmlRpcResponse response = new XmlRpcResponse(parameters);

    StringBuffer builder = new StringBuffer(256);
    builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    builder
        .append("<methodResponse><params><param><value><array><data><value><string>");
    builder.append(firstValue.getValue());
    builder.append("</string></value><value><string>");
    builder.append(secondValue.getValue());
    builder
        .append("</string></value></data></array></value></param></params></methodResponse>");

    String expected = builder.toString();

View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   * parameters.
   */
  public final void testWriteResponseWithStringParameters() {
    String value = "X-Wing";

    XmlRpcString xmlRpcString = new XmlRpcString(value);
    XmlRpcElement[] parameters = { xmlRpcString };

    XmlRpcResponse response = new XmlRpcResponse(parameters);

    StringBuffer builder = new StringBuffer(256);
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   * parameters.
   */
  public final void testWriteResponseWithStructParameters() {
    XmlRpcMember integerMember = new XmlRpcMember("id", new XmlRpcInteger(
        new Integer(56)));
    XmlRpcMember stringMember = new XmlRpcMember("fullName", new XmlRpcString(
        "Luke Skywalker"));

    XmlRpcStruct xmlRpcStruct = new XmlRpcStruct();
    xmlRpcStruct.add(integerMember);
    xmlRpcStruct.add(stringMember);
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   */
  public void testFindMatchingMethodWithMatchingMethodWithArguments() {
    Long customerId = new Long(542);

    String methodName = "getCustomerName";
    XmlRpcElement[] parameters = { new XmlRpcString(customerId.toString()) };

    XmlRpcRequest request = new XmlRpcRequest();
    request.setMethodName(methodName);
    request.setParameters(parameters);

View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   */
  public void testFindMatchingMethodWithNotMatchingParameterCount() {
    XmlRpcRequest request = new XmlRpcRequest();
    request.setMethodName("getCustomerName");

    XmlRpcElement[] parameters = { new XmlRpcString("Luke"),
        new XmlRpcString("Anakin") };
    request.setParameters(parameters);

    try {
      this.serviceExporter.findMatchingMethod(request);
      fail("A 'XmlRpcMethodNotFoundException' should have been thrown");
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   */
  public void testFindMatchingMethodWithNotMatchingParameterType() {
    XmlRpcRequest request = new XmlRpcRequest();
    request.setMethodName("getCustomerName");

    XmlRpcElement[] parameters = { new XmlRpcString("Luke") };
    request.setParameters(parameters);

    try {
      this.serviceExporter.findMatchingMethod(request);
      fail("A 'XmlRpcMethodNotFoundException' should have been thrown");
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

  public void testInvokeXmlRpcRequest() throws Exception {
    Long argument = new Long(54);
    String customerName = "Luke";

    String methodName = "getCustomerName";
    XmlRpcElement[] parameters = { new XmlRpcString(argument.toString()) };

    XmlRpcRequest request = new XmlRpcRequest();
    request.setMethodName(methodName);
    request.setParameters(parameters);
   
View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   * <code>{@link XmlRpcRequestParser#parseRequest(InputStream)}</code> parses
   * correctly a XML-RPC request containing array parameters.
   */
  public final void testParseRequestWithArrayParameters() {
    XmlRpcArray xmlRpcArray = new XmlRpcArray();
    xmlRpcArray.add(new XmlRpcString("Luke"));
    xmlRpcArray.add(new XmlRpcString("Leia"));

    XmlRpcElement[] parameters = { xmlRpcArray };

    XmlRpcRequest expected = new XmlRpcRequest(this.serviceName,
        this.methodName, parameters);

    StringBuffer builder = new StringBuffer();
    builder.append("<?xml version=\"1.0\"?>");
    builder.append("<methodCall><methodName>");
    builder.append(this.serviceAndMethodNames);
    builder.append("</methodName><params><param><value><array><data>");

    XmlRpcElement[] elements = xmlRpcArray.getElements();
    int memberCount = elements.length;
    for (int i = 0; i < memberCount; i++) {
      XmlRpcString element = (XmlRpcString) elements[i];

      builder.append("<value>");
      builder.append(element.getValue());
      builder.append("</value>");
    }

    builder.append("</data></array></value></param></params></methodCall>");

View Full Code Here

Examples of org.springmodules.remoting.xmlrpc.support.XmlRpcString

   * Verifies that the method
   * <code>{@link XmlRpcRequestParser#parseRequest(InputStream)}</code> parses
   * correctly a XML-RPC request containing string parameters.
   */
  public final void testParseRequestWithStringParameters() {
    XmlRpcString[] parameters = { new XmlRpcString("Hoth"),
        new XmlRpcString("Endor") };

    XmlRpcRequest expected = new XmlRpcRequest(this.serviceName,
        this.methodName, parameters);

    StringBuffer builder = new StringBuffer();
    builder.append("<?xml version=\"1.0\"?>");
    builder.append("<methodCall><methodName>");
    builder.append(this.serviceAndMethodNames);
    builder.append("</methodName><params>");

    int parameterCount = parameters.length;
    for (int i = 0; i < parameterCount; i++) {
      XmlRpcString xmlRpcString = parameters[i];
      String value = (String) xmlRpcString.getValue();

      // even parameters will have an extra "string" element.
      boolean addStringElement = (i % 2 == 0);

      builder.append("<param><value>");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.