aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test/java
diff options
context:
space:
mode:
authorlalber <lukas.alber@iaik.tugraz.at>2020-10-20 16:57:45 +0200
committerlalber <lukas.alber@iaik.tugraz.at>2020-10-20 16:57:45 +0200
commitd42ef2bccc0acd4e1ee830f42956a5cafb863299 (patch)
treeaca5e0f56116e7d6f823fc1c0ff13a783fb09d73 /eidas_modules/authmodule-eIDAS-v2/src/test/java
parent3332e8c363b624e7478f303c403ea709844e822f (diff)
downloadNational_eIDAS_Gateway-d42ef2bccc0acd4e1ee830f42956a5cafb863299.tar.gz
National_eIDAS_Gateway-d42ef2bccc0acd4e1ee830f42956a5cafb863299.tar.bz2
National_eIDAS_Gateway-d42ef2bccc0acd4e1ee830f42956a5cafb863299.zip
cyclic depend
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java
index f674b6b1..028210cb 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java
@@ -9,6 +9,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateAuthnReque
import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummySpecificCommunicationService;
import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
@@ -16,6 +17,7 @@ import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
+import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.FinalizeAuthenticationTask;
import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
@@ -63,9 +65,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
-import szrservices.PersonInfoType;
-import szrservices.SZR;
-import szrservices.SZRException_Exception;
+import szrservices.*;
import javax.xml.namespace.QName;
import java.io.IOException;
@@ -83,13 +83,15 @@ import static org.powermock.api.mockito.PowerMockito.*;
//@PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
@PrepareForTest(CreateIdentityLinkTask.class)
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
+@ContextConfiguration("/SpringTest-context_tasks_test_2.xml")
public class CreateIdentityLinkTaskEidNewTest {
@Autowired(required = true)
private CreateIdentityLinkTask task;
@Autowired(required = true)
+ private FinalizeAuthenticationTask authTask;
+ @Autowired(required = true)
private DummySpecificCommunicationService commService;
@Autowired(required = true)
private IConfiguration basicConfig;
@@ -142,8 +144,10 @@ public class CreateIdentityLinkTaskEidNewTest {
pendingReq.setSpConfig(oaParam);
pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
pendingReq.setAuthUrl("http://test.com/");
+ pendingReq.setTransactionId("avaasbav");
executionContext.put(MsEidasNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "XX");
+ executionContext.put(EaafConstants.PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT, true);
szrMock = soap.mock(SZR.class, "http://localhost:1234/demoszr");
}
@@ -179,7 +183,7 @@ public class CreateIdentityLinkTaskEidNewTest {
.subjectNameIdFormat("afaf").attributes(attributeMap).build();
}
- @Test(expected = RuntimeException.class)
+ @Test
public void firstTest() {
// keystore password f/+saJBc3a}*/T^s
try {
@@ -188,10 +192,17 @@ public class CreateIdentityLinkTaskEidNewTest {
// SZR szrMock2 = Mockito.mock(SZR.class, Mockito.CALLS_REAL_METHODS);
when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10));
+ val signContentResp = new SignContentResponseType();
+ SignContentEntry signContentEntry = new SignContentEntry();
+ signContentEntry.setValue(RandomStringUtils.randomAlphanumeric(10));
+ signContentResp.getOut().add(signContentEntry);
+ when(szrMock, "signContent", any(), any(), any()).thenReturn(signContentResp);
// when(szrMock2, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10));
// Wie kann ich das vom Bean rein gehängte SZR mit dem Mock überschreiben?
task.execute(pendingReq, executionContext);
+
+ authTask.execute(pendingReq, executionContext);
} catch (Exception e) {
e.printStackTrace();
Assert.fail();