From aee52550868c56de7f7063e4ca153b031dedecb0 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 13 Jul 2018 15:49:38 +0200 Subject: some updates and bugfixes --- .../core/impl/idp/module/test/TestRequestImpl.java | 40 ++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'eaaf_core/src/test') 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 a3812816..b1f53db3 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 @@ -26,12 +26,14 @@ *******************************************************************************/ package at.gv.egiz.eaaf.core.impl.idp.module.test; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException; +import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; /** * @author tlenz @@ -83,7 +85,7 @@ public class TestRequestImpl implements IRequest { * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String) */ @Override - public Object getGenericData(String key) { + public Object getRawData(String key) { return storage.get(key); } @@ -91,7 +93,7 @@ public class TestRequestImpl implements IRequest { * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String, java.lang.Class) */ @Override - public T getGenericData(String key, Class clazz) { + public T getRawData(String key, Class clazz) { return (T)storage.get(key); } @@ -218,14 +220,9 @@ public class TestRequestImpl implements IRequest { } @Override - public void setGenericDataToSession(Map map) throws EAAFStorageException { + public void setRawDataToTransaction(Map map) throws EAAFStorageException { storage.putAll(map); - - } - - @Override - public Map genericFullDataStorage() { - return storage; + } @Override @@ -270,7 +267,7 @@ public class TestRequestImpl implements IRequest { } @Override - public void setGenericDataToSession(String key, Object object) throws EAAFStorageException { + public void setRawDataToTransaction(String key, Object object) throws EAAFStorageException { storage.put(key, object); } @@ -278,6 +275,29 @@ public class TestRequestImpl implements IRequest { public void setSpConfig(ISPConfiguration spConfig) { this.spConfig = spConfig; } + + @Override + public T getSessionData(Class wrapper) { + if (wrapper != null) { + if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) { + try { + return wrapper.getConstructor(Map.class).newInstance(this.storage); + + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + throw new RuntimeException("Can NOT instance wrapper: " + wrapper.getName(), e); + + } + + } + + throw new RuntimeException("Can NOT wrap generic data into session data. " + + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper"); + + } + + return null; + } -- cgit v1.2.3