From d311d0f7b7ef9ed5bc383d6744b7d61239aafbc1 Mon Sep 17 00:00:00 2001 From: tkellner Date: Fri, 13 Dec 2013 01:26:39 +0000 Subject: Extend STAL to support CMS SignedAttributes git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1262 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../stal/service/translator/STALTranslatorTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'STALService/src/test/java/at/gv/egiz/stal/service') 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 8331c993..98d301a7 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 @@ -28,6 +28,7 @@ package at.gv.egiz.stal.service.translator; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.SignRequest.SignedInfo; import at.gv.egiz.stal.service.translator.STALTranslator.TranslationHandler; import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.RequestType; @@ -94,13 +95,17 @@ public class STALTranslatorTest { System.out.println("translate"); SignRequest request = new SignRequest(); request.setKeyIdentifier("kid"); - request.setSignedInfo("signedinfo".getBytes()); + SignedInfo signedInfo = new SignedInfo(); + signedInfo.setValue("signedinfo".getBytes()); + request.setSignedInfo(signedInfo); STALTranslator instance = new STALTranslator(); JAXBElement result = instance.translate(request); assertEquals(SignRequestType.class, result.getValue().getClass()); SignRequestType resultT = (SignRequestType) result.getValue(); assertEquals(request.getKeyIdentifier(), resultT.getKeyIdentifier()); - assertEquals(request.getSignedInfo(), resultT.getSignedInfo()); + assertEquals(request.getSignedInfo().getValue(), resultT.getSignedInfo().getValue()); + assertEquals(request.getSignedInfo().isIsCMSSignedAttributes(), resultT.getSignedInfo().isIsCMSSignedAttributes()); + assertEquals(request.getSignatureMethod(), resultT.getSignatureMethod()); } /** @@ -111,13 +116,18 @@ public class STALTranslatorTest { System.out.println("translate"); SignRequestType req = of.createSignRequestType(); req.setKeyIdentifier("kid"); - req.setSignedInfo("signedinfo".getBytes()); + SignRequestType.SignedInfo signedInfo = of.createSignRequestTypeSignedInfo(); + signedInfo.setValue("signedinfo".getBytes()); + req.setSignedInfo(signedInfo); + req.setSignatureMethod("signatureMethod"); JAXBElement request = of.createGetNextRequestResponseTypeSignRequest(req); STALTranslator instance = new STALTranslator(); STALRequest result = instance.translateWSRequest(request); assertEquals(SignRequest.class, result.getClass()); assertEquals(req.getKeyIdentifier(), ((SignRequest) result).getKeyIdentifier()); - assertEquals(req.getSignedInfo(), ((SignRequest) result).getSignedInfo()); + assertEquals(req.getSignedInfo().getValue(), ((SignRequest) result).getSignedInfo().getValue()); + assertEquals(req.getSignedInfo().isIsCMSSignedAttributes(), ((SignRequest) result).getSignedInfo().isIsCMSSignedAttributes()); + assertEquals(req.getSignatureMethod(), ((SignRequest) result).getSignatureMethod()); } @Test(expected=RuntimeException.class) -- cgit v1.2.3