From b5018668a538b7931feabb109ac176db53b02976 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 28 Jun 2019 13:11:42 +0200 Subject: add some mockups for testing --- .../eaaf/core/impl/idp/auth/DummyAuthManager.java | 26 ++++++++++++ .../idp/module/test/DummyProtocolAuthService.java | 42 +++++++++++++++++++ .../core/impl/idp/module/test/TestRequestImpl.java | 25 +++++++++--- .../resources/SpringTest-context_authManager.xml | 47 ++++++++++++++++++++++ 4 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyAuthManager.java create mode 100644 eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java create mode 100644 eaaf_core/src/test/resources/SpringTest-context_authManager.xml diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyAuthManager.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyAuthManager.java new file mode 100644 index 00000000..368a1915 --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyAuthManager.java @@ -0,0 +1,26 @@ +package at.gv.egiz.eaaf.core.impl.idp.auth; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.slo.ISLOInformationContainer; +import at.gv.egiz.eaaf.core.exceptions.EAAFException; +import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl; + +public class DummyAuthManager extends AbstractAuthenticationManager { + + @Override + public ISLOInformationContainer performSingleLogOut(HttpServletRequest httpReq, HttpServletResponse httpResp, + IRequest pendingReq, String internalSSOId) throws EAAFException { + return null; + } + + @Override + protected void populateExecutionContext(ExecutionContext executionContext, RequestImpl pendingReq, + HttpServletRequest httpReq) throws EAAFException { + + } + +} diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java new file mode 100644 index 00000000..a50e92cb --- /dev/null +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java @@ -0,0 +1,42 @@ +package at.gv.egiz.eaaf.core.impl.idp.module.test; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService; +import at.gv.egiz.eaaf.core.exceptions.EAAFException; + +public class DummyProtocolAuthService implements IProtocolAuthenticationService { + + @Override + public void performAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) + throws IOException, EAAFException { + // TODO Auto-generated method stub + + } + + @Override + public void finalizeAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq) + throws EAAFException, IOException { + // TODO Auto-generated method stub + + } + + @Override + public void buildProtocolSpecificErrorResponse(Throwable throwable, HttpServletRequest req, + HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException { + // TODO Auto-generated method stub + + } + + @Override + public void handleErrorNoRedirect(Throwable throwable, HttpServletRequest req, HttpServletResponse resp, + boolean writeExceptionToStatisticLog) throws IOException, EAAFException { + // TODO Auto-generated method stub + + } + +} diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java index 25e2d6a1..b6679f2e 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java @@ -45,6 +45,8 @@ public class TestRequestImpl implements IRequest { private ISPConfiguration spConfig = null; private final Map storage = new HashMap(); private String transactionId = null; + private String pendingReqId = null; + private String authURL = null; /* (non-Javadoc) * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule() @@ -130,8 +132,7 @@ public class TestRequestImpl implements IRequest { */ @Override public String getAuthURL() { - // TODO Auto-generated method stub - return null; + return this.authURL; } /* (non-Javadoc) @@ -139,8 +140,10 @@ public class TestRequestImpl implements IRequest { */ @Override public String getAuthURLWithOutSlash() { - // TODO Auto-generated method stub - return null; + if (this.authURL != null && this.authURL.endsWith("/")) + return this.authURL.substring(0, this.authURL.length()-1); + else + return this.authURL; } /* (non-Javadoc) @@ -227,8 +230,7 @@ public class TestRequestImpl implements IRequest { @Override public String getPendingRequestId() { - // TODO Auto-generated method stub - return null; + return this.pendingReqId; } @Override @@ -302,6 +304,17 @@ public class TestRequestImpl implements IRequest { public void setTransactionId(String transactionId) { this.transactionId = transactionId; } + + public void setPendingReqId(String pendingReqId) { + this.pendingReqId = pendingReqId; + } + + public void setAuthURL(String authURL) { + this.authURL = authURL; + } + + + diff --git a/eaaf_core/src/test/resources/SpringTest-context_authManager.xml b/eaaf_core/src/test/resources/SpringTest-context_authManager.xml new file mode 100644 index 00000000..b8eef11f --- /dev/null +++ b/eaaf_core/src/test/resources/SpringTest-context_authManager.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3