aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java104
1 files changed, 0 insertions, 104 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java
deleted file mode 100644
index d89f7751..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.tasks;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-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 at.asitplus.eidas.specific.connector.MSeIDASNodeConstants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask;
-import at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.dummy.DummySpecificCommunicationService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-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;
-import at.gv.egiz.eaaf.core.exceptions.EaafException;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-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;
-import eu.eidas.auth.commons.light.ILightRequest;
-import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
-public class GenerateAuthnRequestTaskFirstTest {
-
- @Autowired(required=true) private GenerateAuthnRequestTask task;
- @Autowired(required=true) private DummySpecificCommunicationService commService;
- @Autowired(required=true) private IConfiguration basicConfig;
-
- final ExecutionContext executionContext = new ExecutionContextImpl();
- private MockHttpServletRequest httpReq;
- private MockHttpServletResponse httpResp;
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_1.properties");
-
- }
-
- @Before
- public void setUp() {
-
- httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
- httpResp = new MockHttpServletResponse();
- RequestContextHolder.resetRequestAttributes();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
- }
-
- @Test
- @DirtiesContext
- public void withCustomStaticProviderNameForPublicSPs() throws TaskExecutionException, SpecificCommunicationException {
- executionContext.put(MSeIDASNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "CC");
-
- try {
- task.execute(pendingReq, executionContext);
-
- } catch (TaskExecutionException e) {
- //forward URL is not set in example config
- org.springframework.util.Assert.isInstanceOf(EaafConfigurationException.class, e.getOriginalException(), "Wrong exception");
- Assert.assertEquals("wrong errorCode", "config.08", ((EaafException) e.getOriginalException()).getErrorId());
- Assert.assertEquals("wrong parameter size", 1, ((EaafException) e.getOriginalException()).getParams().length);
- Assert.assertEquals("wrong errorMsg", Constants.CONIG_PROPS_EIDAS_NODE_FORWARD_URL, ((EaafException) e.getOriginalException()).getParams()[0]);
-
- }
-
- ILightRequest eIDASReq = commService.getAndRemoveRequest(null, null);
-
- Assert.assertEquals("ProviderName is not Static", "myNode", eIDASReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", eIDASReq.getSpType());
- Assert.assertEquals("wrong LoA", "http://eidas.europa.eu/LoA/high", eIDASReq.getLevelOfAssurance());
- }
-
-}