Update of /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/soap
In directory sc8-pr-cvs1:/tmp/cvs-serv16358/src/java/org/neuclear/xml/soap
Modified Files:
MockXMLInputStreamServlet.java SOAPServlet.java SOAPTools.java
Added Files:
EchoSOAPServlet.java
Log Message:
More Cactus unit testing going on.
--- NEW FILE: EchoSOAPServlet.java ---
package org.neuclear.xml.soap;
import org.dom4j.Element;
/*
NeuClear Distributed Transaction Clearing Platform
(C) 2003 Pelle Braendgaard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id: EchoSOAPServlet.java,v 1.1 2003/11/24 23:33:15 pelle Exp $
$Log: EchoSOAPServlet.java,v $
Revision 1.1 2003/11/24 23:33:15 pelle
More Cactus unit testing going on.
*/
/**
* User: pelleb
* Date: Nov 24, 2003
* Time: 4:35:18 PM
*/
public class EchoSOAPServlet extends SOAPServlet {
protected Element handleSOAPRequest(Element request, String soapAction) throws SOAPException {
return request;
}
}
Index: MockXMLInputStreamServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/soap/MockXMLInputStreamServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MockXMLInputStreamServlet.java 24 Nov 2003 16:49:25 -0000 1.1
--- MockXMLInputStreamServlet.java 24 Nov 2003 23:33:15 -0000 1.2
***************
*** 3,9 ****
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
- import java.io.InputStream;
- import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
--- 3,9 ----
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
+ import java.io.IOException;
+ import java.io.InputStream;
import java.io.InputStreamReader;
***************
*** 28,31 ****
--- 28,34 ----
$Id$
$Log$
+ Revision 1.2 2003/11/24 23:33:15 pelle
+ More Cactus unit testing going on.
+
Revision 1.1 2003/11/24 16:49:25 pelle
Added Cactus testing structure.
***************
*** 34,41 ****
*/
! public class MockXMLInputStreamServlet extends XMLInputStreamServlet{
protected void handleInputStream(final InputStream is, final HttpServletRequest request, final HttpServletResponse response) throws IOException {
! final BufferedReader reader=new BufferedReader(new InputStreamReader(is));
! lastInput=reader.readLine();
}
--- 37,48 ----
*/
! public class MockXMLInputStreamServlet extends XMLInputStreamServlet {
protected void handleInputStream(final InputStream is, final HttpServletRequest request, final HttpServletResponse response) throws IOException {
! if (is == null) {
! lastInput = null;
! return;
! }
! final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
! lastInput = reader.readLine();
}
***************
*** 45,49 ****
}
! private String lastInput=null;
}
--- 52,56 ----
}
! private String lastInput = null;
}
Index: SOAPServlet.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/soap/SOAPServlet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SOAPServlet.java 21 Nov 2003 04:44:30 -0000 1.2
--- SOAPServlet.java 24 Nov 2003 23:33:15 -0000 1.3
***************
*** 1,4 ****
--- 1,7 ----
/* $Id$
* $Log$
+ * Revision 1.3 2003/11/24 23:33:15 pelle
+ * More Cactus unit testing going on.
+ *
* Revision 1.2 2003/11/21 04:44:30 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 93,104 ****
final SAXReader reader = new SAXReader();
final Document doc = reader.read(is);
! System.out.println("RECEIVED:" + doc.asXML());
! System.out.println("NEUDIST: SOAP Post Request to " + this.getClass().getName());
! final Element bodyElement = doc.getRootElement().element(DocumentHelper.createQName("Body", DocumentHelper.createNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/")));
//TODO: Check for null
final Element requestElement = (Element) bodyElement.elements().get(0);
if (requestElement == null) {
! System.out.println("NEUDIST: SOAP Request was invalid");
! System.out.println(doc.asXML());
response.sendError(500, "NEUDIST: SOAP Request was invalid");
}
--- 96,107 ----
final SAXReader reader = new SAXReader();
final Document doc = reader.read(is);
! // System.out.println("RECEIVED:" + doc.asXML());
! // System.out.println("NEUDIST: SOAP Post Request to " + this.getClass().getName());
! final Element bodyElement = doc.getRootElement().element(SOAPTools.createEnvelopeQName());
//TODO: Check for null
final Element requestElement = (Element) bodyElement.elements().get(0);
if (requestElement == null) {
! // System.out.println("NEUDIST: SOAP Request was invalid");
! // System.out.println(doc.asXML());
response.sendError(500, "NEUDIST: SOAP Request was invalid");
}
***************
*** 122,129 ****
out.close();
} catch (DocumentException e) {
! System.out.println("NeuDist: Exception in SOAP Request");
e.printStackTrace(System.out);
response.sendError(500, e.getMessage());
}
}
}
--- 125,133 ----
out.close();
} catch (DocumentException e) {
! // System.out.println("NeuDist: Exception in SOAP Request");
e.printStackTrace(System.out);
response.sendError(500, e.getMessage());
}
}
+
}
Index: SOAPTools.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-xmlsig/src/java/org/neuclear/xml/soap/SOAPTools.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** SOAPTools.java 21 Nov 2003 04:44:30 -0000 1.3
--- SOAPTools.java 24 Nov 2003 23:33:15 -0000 1.4
***************
*** 1,4 ****
--- 1,7 ----
/* $Id$
* $Log$
+ * Revision 1.4 2003/11/24 23:33:15 pelle
+ * More Cactus unit testing going on.
+ *
* Revision 1.3 2003/11/21 04:44:30 pelle
* EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
***************
*** 105,111 ****
*/
! import org.dom4j.Document;
! import org.dom4j.DocumentException;
! import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.neuclear.commons.NeuClearException;
--- 108,112 ----
*/
! import org.dom4j.*;
import org.dom4j.io.SAXReader;
import org.neuclear.commons.NeuClearException;
***************
*** 201,205 ****
}
! private static final byte SOAP_START[] = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>\n".getBytes();
! private static final byte SOAP_END[] = "</SOAP-ENV:Body></SOAP-ENV:Envelope>".getBytes();
}
--- 202,210 ----
}
! static QName createEnvelopeQName() {
! return DocumentHelper.createQName("Body", DocumentHelper.createNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"));
! }
!
! static final byte SOAP_START[] = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>\n".getBytes();
! static final byte SOAP_END[] = "</SOAP-ENV:Body></SOAP-ENV:Envelope>".getBytes();
}
|