OW2 Consortium jonas

Compare Revisions

Ignore whitespace Rev 22467 → Rev 22468

/jonas/trunk/jonas/itests/applications/jaxws-add/modules/webapp/src/main/java/org/ow2/jonas/tests/applications/wsadd/ws/AuditEventServiceServlet.java
1,3 → 1,27
/**
* JOnAS: Java(TM) Open Application Server
* Copyright (C) 2012 Bull S.A.S.
* Contact: jonas-team@ow2.org
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* --------------------------------------------------------------------------
* $Id: WebServicesAuditTestCase.java 22467 2012-05-31 14:22:14Z benebrice $
* --------------------------------------------------------------------------
*/
 
package org.ow2.jonas.tests.applications.wsadd.ws;
 
import java.io.IOException;
35,8 → 59,8
boolean ok = false;
GenericAuditReport report;
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.req=req;
this.resp=resp;
this.req = req;
this.resp = resp;
try {
InitialContext ic = new InitialContext();
47,30 → 71,32
sendEvent();
} catch (Exception e) {
throw new IllegalStateException("Error on audit tests", e);
} finally {
unregister();
}
}
public void register(){
if(eventService.getDispatcher("JAXWS")==null) {
EventDispatcher d= new EventDispatcher();
d.setNbWorkers(2);
d.start();
eventService.registerDispatcher("JAXWS", d);
}
// if(eventService.getDispatcher("JAXWS") == null) {
// EventDispatcher d= new EventDispatcher();
// d.setNbWorkers(2);
// d.start();
// eventService.registerDispatcher("JAXWS", d);
// }
eventService.registerListener(this, "JAXWS");
}
public void sendEvent(){
//Call the webservice
try{
String serviceURL = "http://localhost:" + req.getParameter("port") + "/wsadd-sample/WSAddService";
 
try {
String serviceURL = req.getScheme() + "://" + req.getLocalAddr() + ":" + req.getServerPort() + "/wsadd-sample/WSAddService";
// Trigger the report generation
DefaultHttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(serviceURL);
InputStreamEntity entity = new InputStreamEntity(getClass().getResourceAsStream("/WEB-INF/soap-request-add.xml"), -1);
InputStreamEntity entity = new InputStreamEntity(getClass().getResourceAsStream("/soap-request-add.xml"), -1);
entity.setContentType("application/soap+xml");
post.setEntity(entity);
client.execute(post);
81,7 → 107,7
int i = 0;
int times = 20;
int sleepTime = 500;
while((report == null) && (i < times)) {
while ((report == null) && (i < times)) {
Thread.sleep(sleepTime);
i++;
}
90,30 → 116,29
if (!ok) {
resp.getWriter().println("Report was not generated after " + ((i * sleepTime) / 1000) + " seconds");
}
} catch (Exception e) {
throw new IllegalStateException("Error send JAXWS event on test", e);
}
catch(Exception e){
throw new IllegalStateException("Error send JAXWS event on test",e);
}
}
public void unregister(){
public void unregister() {
eventService.unregisterListener(this);
}
 
public boolean accept(IEvent event){
public boolean accept(IEvent event) {
return true;
}
 
public EventPriority getPriority(){
public EventPriority getPriority() {
return EventPriority.ASYNC_HIGH;
}
 
public void handle(IEvent event){
report=(GenericAuditReport) ((Event) event).getReport();
ok=true;
public void handle(IEvent event) {
report = (GenericAuditReport) ((Event) event).getReport();
ok = true;
}
 
}
/jonas/trunk/jonas/itests/applications/jaxws-add/modules/webapp/src/main/resources/soap-request-add.xml
New file
0,0 → 1,35
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- JOnAS: Java(TM) Open Application Server
- Copyright (C) 2012 Bull S.A.S.
- Contact: jonas-team@ow2.org
-
- 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 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: jonas-web.xml 21050 2011-03-24 14:43:27Z benoitf $
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsad="http://wsadd.applis.tests.jonas.ow2.org/">
<soapenv:Header/>
<soapenv:Body>
<wsad:addRequest>
<op1>1</op1>
<op2>1</op2>
</wsad:addRequest>
</soapenv:Body>
</soapenv:Envelope>
Property changes:
Added: svn:mime-type
+ text/plain
/jonas/trunk/jonas/itests/applications/jaxws-add/modules/webapp/src/main/webapp/WEB-INF/soap-request-add.xml
File deleted
/jonas/trunk/jonas/itests/cargo/jrmp/src/test/java/org/ow2/jonas/itests/cargo/jrmp/WebServicesAuditTestCase.java
1,6 → 1,6
/**
* JOnAS: Java(TM) Open Application Server
* Copyright (C) 2011 Bull S.A.S.
* Copyright (C) 2011-2012 Bull S.A.S.
* Contact: jonas-team@ow2.org
*
* This library is free software; you can redistribute it and/or
100,7 → 100,7
 
@Test
public void testEventReportIsSend() throws Exception {
String serviceURL = "http://localhost:" + this.webcontainerPort + "/wsadd-sample/AuditEventServiceChecker?port="+this.webcontainerPort;
String serviceURL = "http://localhost:" + this.webcontainerPort + "/wsadd-sample/AuditEventServiceChecker";
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpGet get = new HttpGet(serviceURL);
HttpResponse response = httpclient.execute(get);