Commits
tsl@kvalitetsit.dk authored 809453b6577
27 27 | import java.util.Properties; |
28 28 | import java.util.Scanner; |
29 29 | |
30 30 | import static org.junit.Assert.assertEquals; |
31 31 | import static org.junit.Assert.assertFalse; |
32 32 | import static org.junit.Assert.assertNotNull; |
33 33 | import static org.junit.Assert.assertNull; |
34 34 | import static org.junit.Assert.assertTrue; |
35 35 | |
36 36 | public class CreateIdCardFromBstIT extends AbstractIT { |
37 - | private static final String NTS_SERVER_URL = System.getProperty("ntsUrl", "http://test1.ekstern-test.nspop.dk:8080"); |
38 - | // private static final String NTS_SERVER_URL = "localhost:9990"; |
37 + | private static final String NTS_SERVER_URL = System.getProperty("ntsUrl", "https://test1.ekstern-test.nspop.dk:8443"); |
39 38 | private static final String SOSIGW_SERVER_URL = System.getProperty("sosigwUrl", "http://localhost:8080"); |
40 39 | private static final String REQUEST_URL = SOSIGW_SERVER_URL + "/sosigw/service/sosigw"; |
41 40 | private static final String CREATE_IDCARD_FROM_BST_URL = REQUEST_URL + "/createIdCardFromBST"; |
42 41 | private static NTS nts; |
43 42 | private static Header medcomHeader; |
44 43 | |
45 44 | |
46 45 | public static void setupNTS() throws MalformedURLException { |
47 46 | StaticConfigImpl.initSettings(); |
48 47 | NTSClient ntsClient = new NTSClient(); |
216 215 | } |
217 216 | |
218 217 | private void validateResponse(Document responseDoc, String cacheKey) throws Exception { |
219 218 | OIOBSTSAMLAssertionToIDCardResponse response = parseResponse(responseDoc); |
220 219 | assertFalse(response.getFaultString(), response.isFault()); |
221 220 | assertEquals("Response should not be signed", 0, responseDoc.getDocumentElement().getElementsByTagName(DSTags.SIGNATURE_PREFIXED).getLength()); |
222 221 | assertNotNull(response.getIDCard()); |
223 222 | assertTrue(response.getIDCard() instanceof UserIDCard); |
224 223 | UserIDCard idCard = (UserIDCard) response.getIDCard(); |
225 224 | validateIdCard(idCard); |
226 - | // validateAgainstNTS(idCard, cacheKey); // TODO fails |
225 + | validateAgainstNTS(idCard, cacheKey); |
227 226 | } |
228 227 | |
229 228 | private OIOBSTSAMLAssertionToIDCardResponse parseResponse(Document response) { |
230 229 | return new OIOBSTSAMLAssertionToIDCardResponseModelBuilder().build(response); |
231 230 | } |
232 231 | |
233 232 | private void validateIdCard(UserIDCard idCard) { |
234 233 | assertEquals("0707764321", idCard.getUserInfo().getCPR()); |
235 234 | assertEquals("NSTSSenAtre", idCard.getUserInfo().getGivenName()); |
236 235 | assertEquals("Sørensen", idCard.getUserInfo().getSurName()); |