From 23f82c4d63290cb41dc0fc6ebb86d6cae9a560fe Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 14:09:21 +0000 Subject: prepare for stal service extension git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@262 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/stal/service/STALRequestBrokerTest.java | 51 ++++++++++++++-------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'BKUOnline/src/test/java/at/gv/egiz') diff --git a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java index 8830a81c..9d77e53e 100644 --- a/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java +++ b/BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java @@ -34,6 +34,7 @@ import at.gv.egiz.stal.SignResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.service.types.InfoboxReadRequestType; import at.gv.egiz.stal.service.types.InfoboxReadResponseType; +import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; @@ -45,6 +46,7 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.xml.bind.JAXBElement; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.BeforeClass; @@ -283,19 +285,25 @@ public class STALRequestBrokerTest { @Override public void run() { try { + ObjectFactory of= new ObjectFactory(); + log.debug("calling stal.nextRequest(oldResponse)"); - ResponseType oldResp = new InfoboxReadResponseType(); - List requests = stal.nextRequest(Collections.singletonList(oldResp)); + InfoboxReadResponseType oldResp = of.createInfoboxReadResponseType(); + ArrayList> oldResponses = new ArrayList>(); + oldResponses.add(of.createGetNextRequestTypeInfoboxReadResponse(oldResp)); + + List> requests = stal.nextRequest(oldResponses); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List responses = new ArrayList(); - for (RequestType request : requests) { + List> responses = new ArrayList>(); + for (JAXBElement requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof InfoboxReadRequestType) { log.debug("received UNEXPECTED READINFOBOX request"); - InfoboxReadResponseType r = new InfoboxReadResponseType(); + InfoboxReadResponseType r = of.createInfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeInfoboxReadResponse(r)); } else if (request instanceof SignRequestType) { log.debug("received UNEXPECTED SIGN request"); @@ -311,9 +319,9 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponseType r = new SignResponseType(); + SignResponseType r = of.createSignResponseType(); r.setSignatureValue("dummySignature".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeSignResponse(r)); } else if (request instanceof QuitRequestType) { log.debug("received EXPECTED QUIT request"); return; @@ -326,7 +334,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (RequestType request : requests) { + for (JAXBElement requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { @@ -347,17 +356,19 @@ public class STALRequestBrokerTest { @Override public void run() { try { + ObjectFactory of = new ObjectFactory(); // first call w/ empty response list log.debug("calling stal.nextRequest"); - List requests = stal.nextRequest(null); //new ArrayList()); + List> requests = stal.nextRequest(null); //new ArrayList()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List responses = new ArrayList(); - for (RequestType request : requests) { + List> responses = new ArrayList>(); + for (JAXBElement requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof InfoboxReadRequestType) { - InfoboxReadResponseType r = new InfoboxReadResponseType(); + InfoboxReadResponseType r = of.createInfoboxReadResponseType(); r.setInfoboxValue("dummyInfobox".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeInfoboxReadResponse(r)); } else if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); @@ -371,9 +382,9 @@ public class STALRequestBrokerTest { log.debug("got HashDataInput " + new String(data)); - SignResponseType r = new SignResponseType(); + SignResponseType r = of.createSignResponseType(); r.setSignatureValue("dummySignature".getBytes()); - responses.add(r); + responses.add(of.createGetNextRequestTypeSignResponse(r)); } else if (request instanceof QuitRequestType) { log.debug("received UNEXPECTED QUIT request"); return; @@ -386,7 +397,8 @@ public class STALRequestBrokerTest { // } log.debug("calling stal.nextRequest with " + responses.size() + " responses"); requests = stal.nextRequest(responses); - for (RequestType request : requests) { + for (JAXBElement requestElt : requests) { + RequestType request = requestElt.getValue(); if (request instanceof QuitRequestType) { log.debug("got QUIT request"); } else { @@ -408,10 +420,11 @@ public class STALRequestBrokerTest { try { // first call w/ empty response list log.debug("calling stal.nextRequest"); - List requests = stal.nextRequest(null); //new ArrayList()); + List> requests = stal.nextRequest(null); //new ArrayList()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - for (RequestType request : requests) { + for (JAXBElement requestElt : requests) { + RequestType request = requestElt.getValue(); // if (request instanceof InfoboxReadRequest) { if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); -- cgit v1.2.3