Package nexj.core.rpc

Examples of nexj.core.rpc.MockServer


      tobj2.setOID(OID.fromBinary(Binary.parse("1000000000000010008000BEEF0000000A")));
      tobj.setValue("doctor", tobj2);
      response.addResult(Arrays.asList(new Object[]{tobj}));
      XMLReadRequest request = (XMLReadRequest)unmarshaller.deserialize(reader);

      m_marshaller.serialize(request.invoke(new MockServer(response)), writer);
      XMLUtil.parse(new StringReader(writer.toString()), m_xsdMap); // validate to XSD

      Node root = XMLUtil.parse(new StringReader(writer.toString())).getFirstChild();

      assertEquals(XML.BASE_PREFIX + "Read-Response", root.getNodeName());
      assertEquals(1, root.getChildNodes().getLength());
      assertEquals("item", root.getChildNodes().item(0).getNodeName());
      assertEquals(1, root.getChildNodes().item(0).getAttributes().getLength());
      assertEquals("Patient",
                   root
                      .getChildNodes()
                         .item(0)
                            .getAttributes()
                               .getNamedItem(XML.XSI_NS + ":type")
                                  .getNodeValue());
      assertEquals(3, root.getChildNodes().item(0).getChildNodes().getLength());

      assertNotNull(XMLUtil.findChildElement(root.getChildNodes().item(0),
                                             XML.BASE_PREFIX + "oid"));
      assertNotNull(XMLUtil.findChildElement(root.getChildNodes().item(0),
                                             XML.BASE_PREFIX + "version"));
      assertNull(XMLUtil
                    .findChildElement(root.getChildNodes().item(0), "doctor")
                       .getAttributes()
                          .getNamedItem(XML.XSI_NS + ":type"));

      writer.getBuffer().setLength(0);
      reader = new StringReader("<Read-Request xmlns=\"" + XML.NS_URI_TNS + "\"><class>Patient</class>"
         + "<attributes>(fullName name)</attributes><where></where><orderBy></orderBy><count>8</count>"
         + "<offset>0</offset></Read-Request>");
      response = new Response();
      tobj = new TransferObject("User");
      tobj2 = new TransferObject("Doctor");

      tobj2.setOID(OID.fromBinary(Binary.parse("1000000000000010008000BEEF0000000A")));
      tobj.setValue("contact", tobj2);
      response.addResult(Arrays.asList(new Object[]{tobj}));
      request = (XMLReadRequest)unmarshaller.deserialize(reader);

      m_marshaller.serialize(request.invoke(new MockServer(response)), writer);
      XMLUtil.parse(new StringReader(writer.toString()), m_xsdMap); // validate to XSD

      root = XMLUtil.parse(new StringReader(writer.toString())).getFirstChild();

      assertEquals(XML.BASE_PREFIX + "Read-Response", root.getNodeName());
View Full Code Here

TOP

Related Classes of nexj.core.rpc.MockServer

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.