diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 17:01:09 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-20 17:01:09 +0000 |
commit | a7d404cd6db2724d36523e59c87c3007fa86a258 (patch) | |
tree | e938b10cccf606c062fdb4cf569b8245a83b8a37 /BKUOnline/src/test/java | |
parent | c97c49eb4399829603816e4b3e47c74b67d0f27b (diff) | |
parent | ce598ba5142ff7673085dd90865f9323d69574be (diff) | |
download | mocca-1.0.2.tar.gz mocca-1.0.2.tar.bz2 mocca-1.0.2.zip |
[maven-release-plugin] copy for tag mocca-1.0.2mocca-1.0.2
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/tags/mocca-1.0.2@276 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"); |