diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 14:09:21 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 14:09:21 +0000 |
commit | 23f82c4d63290cb41dc0fc6ebb86d6cae9a560fe (patch) | |
tree | 79b317ee10777ece72bb916d95ccc70616f0015a /BKUOnline/src/test/java | |
parent | 7c14149f55c8f48ca24786f97f7abed4e55804b1 (diff) | |
download | mocca-23f82c4d63290cb41dc0fc6ebb86d6cae9a560fe.tar.gz mocca-23f82c4d63290cb41dc0fc6ebb86d6cae9a560fe.tar.bz2 mocca-23f82c4d63290cb41dc0fc6ebb86d6cae9a560fe.zip |
prepare for stal service extension
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@262 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline/src/test/java')
-rw-r--r-- | BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java | 51 |
1 files changed, 32 insertions, 19 deletions
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<RequestType> requests = stal.nextRequest(Collections.singletonList(oldResp)); + InfoboxReadResponseType oldResp = of.createInfoboxReadResponseType(); + ArrayList<JAXBElement<? extends ResponseType>> oldResponses = new ArrayList<JAXBElement<? extends ResponseType>>(); + oldResponses.add(of.createGetNextRequestTypeInfoboxReadResponse(oldResp)); + + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(oldResponses); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<ResponseType> responses = new ArrayList<ResponseType>(); - for (RequestType request : requests) { + List<JAXBElement<? extends ResponseType>> responses = new ArrayList<JAXBElement<? extends ResponseType>>(); + for (JAXBElement<? extends RequestType> 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<? extends RequestType> 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<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - List<ResponseType> responses = new ArrayList<ResponseType>(); - for (RequestType request : requests) { + List<JAXBElement<? extends ResponseType>> responses = new ArrayList<JAXBElement<? extends ResponseType>>(); + for (JAXBElement<? extends RequestType> 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<? extends RequestType> 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<RequestType> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); + List<JAXBElement<? extends RequestType>> requests = stal.nextRequest(null); //new ArrayList<ResponseType>()); log.debug("got " + requests.size() + " requests. processing..."); Thread.sleep(1); - for (RequestType request : requests) { + for (JAXBElement<? extends RequestType> requestElt : requests) { + RequestType request = requestElt.getValue(); // if (request instanceof InfoboxReadRequest) { if (request instanceof SignRequestType) { log.debug("calling stal.getCurrentHashDataInputCallback"); |