diff options
Diffstat (limited to 'eaaf_core/src/test')
-rw-r--r-- | eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java | 40 |
1 files changed, 30 insertions, 10 deletions
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> T getGenericData(String key, Class<T> clazz) { + public <T> T getRawData(String key, Class<T> clazz) { return (T)storage.get(key); } @@ -218,14 +220,9 @@ public class TestRequestImpl implements IRequest { } @Override - public void setGenericDataToSession(Map<String, Object> map) throws EAAFStorageException { + public void setRawDataToTransaction(Map<String, Object> map) throws EAAFStorageException { storage.putAll(map); - - } - - @Override - public Map<String, Object> 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> T getSessionData(Class<T> 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; + } |