summaryrefslogtreecommitdiff
path: root/BKUOnline/src/test/java/at/gv/egiz
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-05 13:39:32 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-09-05 13:39:32 +0000
commit146f204a81af9ea52de889c7f4c07d4a0ec22333 (patch)
treea51651a139c38c0a4b028bfd62610d17703c8a08 /BKUOnline/src/test/java/at/gv/egiz
parent3808a5b4ec9d13c8cbb1b7fd95afa62c133342fd (diff)
downloadmocca-146f204a81af9ea52de889c7f4c07d4a0ec22333.tar.gz
mocca-146f204a81af9ea52de889c7f4c07d4a0ec22333.tar.bz2
mocca-146f204a81af9ea52de889c7f4c07d4a0ec22333.zip
HashDataInput
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@22 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline/src/test/java/at/gv/egiz')
-rw-r--r--BKUOnline/src/test/java/at/gv/egiz/stal/service/STALRequestBrokerTest.java88
1 files changed, 68 insertions, 20 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 cd321c71..62d6f8a6 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
@@ -24,7 +24,7 @@ import at.gv.egiz.stal.service.impl.STALRequestBrokerImpl;
import at.gv.egiz.stal.service.impl.RequestBrokerSTALFactory;
import at.gv.egiz.stal.service.impl.STALRequestBroker;
import at.gv.egiz.stal.ErrorResponse;
-import at.gv.egiz.stal.HashDataInputCallback;
+import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.InfoboxReadRequest;
import at.gv.egiz.stal.InfoboxReadResponse;
import at.gv.egiz.stal.QuitRequest;
@@ -95,13 +95,24 @@ public class STALRequestBrokerTest {
SignRequest r1 = new SignRequest();
r1.setKeyIdentifier("keybox1");
r1.setSignedInfo("1234".getBytes());
- r1.setHashDataInput(new HashDataInputCallback() {
+ HashDataInput hdi = new HashDataInput() {
@Override
- public InputStream getHashDataInput(String referenceId) {
+ public String getReferenceId() {
+ return "refId1234";
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/plain";
+ }
+
+ @Override
+ public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
- });
+ };
+ r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
BindingProcessorSimulator bp = new BindingProcessorSimulator();
@@ -125,13 +136,24 @@ public class STALRequestBrokerTest {
SignRequest r1 = new SignRequest();
r1.setKeyIdentifier("keybox1");
r1.setSignedInfo("1234".getBytes());
- r1.setHashDataInput(new HashDataInputCallback() {
+ HashDataInput hdi = new HashDataInput() {
+
+ @Override
+ public String getReferenceId() {
+ return "refId1234";
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/plain";
+ }
@Override
- public InputStream getHashDataInput(String referenceId) {
+ public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
- });
+ };
+ r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
BindingProcessorSimulator bp = new BindingProcessorSimulator();
@@ -169,26 +191,48 @@ public class STALRequestBrokerTest {
SignRequest r1 = new SignRequest();
r1.setKeyIdentifier("keybox1");
r1.setSignedInfo("1234".getBytes());
- r1.setHashDataInput(new HashDataInputCallback() {
+ HashDataInput hdi = new HashDataInput() {
@Override
- public InputStream getHashDataInput(String referenceId) {
+ public String getReferenceId() {
+ return "refId1234";
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/plain";
+ }
+
+ @Override
+ public InputStream getHashDataInput() {
return new ByteArrayInputStream("hashdatainput1234".getBytes());
}
- });
+ };
+ r1.setHashDataInput(Collections.singletonList(hdi));
requests.add(r1);
List<STALRequest> requests2 = new ArrayList<STALRequest>();
SignRequest r2 = new SignRequest();
r2.setKeyIdentifier("keybox2");
r2.setSignedInfo("6789".getBytes());
- r2.setHashDataInput(new HashDataInputCallback() {
+ HashDataInput hdi2 = new HashDataInput() {
+
+ @Override
+ public String getReferenceId() {
+ return "refId6789";
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
@Override
- public InputStream getHashDataInput(String referenceId) {
- return new ByteArrayInputStream("hashdatainput6789".getBytes());
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("<xml>hashdatainput6789</xml>".getBytes());
}
- });
+ };
+ r2.setHashDataInput(Collections.singletonList(hdi2));
requests2.add(r2);
BindingProcessorSimulator bp = new BindingProcessorSimulator();
@@ -228,9 +272,11 @@ public class STALRequestBrokerTest {
} else if (request instanceof SignRequest) {
log.debug("calling stal.getCurrentHashDataInputCallback");
- HashDataInputCallback cb = stal.getHashDataInput();
- assertNotNull(cb);
- InputStream hd = cb.getHashDataInput("1234");
+ List<HashDataInput> hdis = stal.getHashDataInput();
+ assertNotNull(hdis);
+ assertEquals(hdis.size(), 1);
+ HashDataInput hdi = hdis.get(0);// cb.getHashDataInput("1234");
+ InputStream hd = hdi.getHashDataInput();
byte[] data = new byte[hd.available()];
hd.read(data);
log.debug("got HashDataInput " + new String(data));
@@ -280,9 +326,11 @@ public class STALRequestBrokerTest {
// if (request instanceof InfoboxReadRequest) {
if (request instanceof SignRequest) {
log.debug("calling stal.getCurrentHashDataInputCallback");
- HashDataInputCallback cb = stal.getHashDataInput();
- assertNotNull(cb);
- InputStream hd = cb.getHashDataInput("1234");
+ List<HashDataInput> hdis = stal.getHashDataInput();
+ assertNotNull(hdis);
+ assertEquals(hdis.size(), 1);
+ HashDataInput hdi = hdis.get(0);// cb.getHashDataInput("1234");
+ InputStream hd = hdi.getHashDataInput();
byte[] data = new byte[hd.available()];
hd.read(data);
log.debug("got HashDataInput " + new String(data));