diff options
author | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-12-13 04:06:05 +0000 |
---|---|---|
committer | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2013-12-13 04:06:05 +0000 |
commit | 438727ab21b5e80d1771279b988d6aed57ba3ab1 (patch) | |
tree | 1de5dc68467b378d7ece4a1119ac539dca6462c9 /STALService/src/test | |
parent | da6c49cbea9c80ad057a5fc3b698ce14ad9a7415 (diff) | |
download | mocca-438727ab21b5e80d1771279b988d6aed57ba3ab1.tar.gz mocca-438727ab21b5e80d1771279b988d6aed57ba3ab1.tar.bz2 mocca-438727ab21b5e80d1771279b988d6aed57ba3ab1.zip |
Add ExcludedByteRange to STAL SignatureRequest, honour it for digest calculation
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1264 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'STALService/src/test')
-rw-r--r-- | STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java index a82006fc..83adfe30 100644 --- a/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java +++ b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java @@ -25,6 +25,8 @@ package at.gv.egiz.stal.service.translator; +import java.math.BigInteger; + import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; @@ -107,6 +109,12 @@ public class STALTranslatorTest { assertEquals(request.getSignedInfo().isIsCMSSignedAttributes(), resultT.getSignedInfo().isIsCMSSignedAttributes()); assertEquals(request.getSignatureMethod(), resultT.getSignatureMethod()); assertEquals(request.getDigestMethod(), resultT.getDigestMethod()); + if (request.getExcludedByteRange() == null) + assertNull(resultT.getExcludedByteRange()); + else { + assertEquals(request.getExcludedByteRange().getFrom(), resultT.getExcludedByteRange().getFrom()); + assertEquals(request.getExcludedByteRange().getTo(), resultT.getExcludedByteRange().getTo()); + } } /** @@ -122,6 +130,10 @@ public class STALTranslatorTest { req.setSignedInfo(signedInfo); req.setSignatureMethod("signatureMethod"); req.setDigestMethod("digestMethod"); + SignRequestType.ExcludedByteRange excludedByteRange = of.createSignRequestTypeExcludedByteRange(); + excludedByteRange.setFrom(BigInteger.ZERO); + excludedByteRange.setTo(BigInteger.ONE); + req.setExcludedByteRange(excludedByteRange); JAXBElement<? extends RequestType> request = of.createGetNextRequestResponseTypeSignRequest(req); STALTranslator instance = new STALTranslator(); STALRequest result = instance.translateWSRequest(request); @@ -131,6 +143,12 @@ public class STALTranslatorTest { assertEquals(req.getSignedInfo().isIsCMSSignedAttributes(), ((SignRequest) result).getSignedInfo().isIsCMSSignedAttributes()); assertEquals(req.getSignatureMethod(), ((SignRequest) result).getSignatureMethod()); assertEquals(req.getDigestMethod(), ((SignRequest) result).getDigestMethod()); + if (req.getExcludedByteRange() == null) + assertNull(((SignRequest) result).getExcludedByteRange()); + else { + assertEquals(req.getExcludedByteRange().getFrom(), ((SignRequest) result).getExcludedByteRange().getFrom()); + assertEquals(req.getExcludedByteRange().getTo(), ((SignRequest) result).getExcludedByteRange().getTo()); + } } @Test(expected=RuntimeException.class) |