From 438727ab21b5e80d1771279b988d6aed57ba3ab1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 13 Dec 2013 04:06:05 +0000 Subject: 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 --- .../stal/service/translator/STALTranslatorTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'STALService/src/test') 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 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) -- cgit v1.2.3