summaryrefslogtreecommitdiff
path: root/eaaf_core/src/test
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-04 19:43:32 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2019-12-04 19:43:32 +0100
commit759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f (patch)
tree2132024fc058b1ef5338bf50df575a3244cc3f9f /eaaf_core/src/test
parent4f15bdc45b08724d20c66c9fd74ea6a43a03c32f (diff)
downloadEAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.tar.gz
EAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.tar.bz2
EAAF-Components-759ac5f42c6aff901dbeede4fbf1a1d2e08cad0f.zip
common EGIZ code-style refactoring
Diffstat (limited to 'eaaf_core/src/test')
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/AuthenticationDataBuilderTest.java291
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyAuthManager.java23
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyHttpClientFactory.java20
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/TestAuthenticationDataBuilder.java90
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/AbstractAttributeBuilderTest.java209
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/BirthdayAttrBuilderTest.java40
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/FamilyNameAttrBuilderTest.java110
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java110
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java147
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java138
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java21
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java23
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java679
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/DummyTransactionStorage.java335
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/ExpressionContextAdapter.java100
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SimplePojo.java85
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionAwareProcessEngineTest.java283
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionEvaluatorTest.java96
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSAML1AssertionTask.java87
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSaml1AssertionTask.java82
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/GetIdentityLinkTask.java85
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBKUTask.java63
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBkuTask.java55
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java88
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateIdentityLinkTask.java69
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateSignedAuthBlockTask.java74
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/BooleanStringExpressionEvaluator.java60
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HalloWeltTask.java58
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HelloWorldTask.java58
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessDefinitionParserTest.java280
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessEngineTest.java416
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/StopProcessFlagTask.java62
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ThrowExceptionTask.java62
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtilsTest.java851
-rw-r--r--eaaf_core/src/test/resources/SpringTest-context_authManager.xml89
-rw-r--r--eaaf_core/src/test/resources/SpringTest-context_eaaf_core.xml32
-rw-r--r--eaaf_core/src/test/resources/log4j.xml26
-rw-r--r--eaaf_core/src/test/resources/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml8
38 files changed, 2785 insertions, 2620 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/AuthenticationDataBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/AuthenticationDataBuilderTest.java
index c4acbaad..586d464e 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/AuthenticationDataBuilderTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/AuthenticationDataBuilderTest.java
@@ -3,7 +3,12 @@ package at.gv.egiz.eaaf.core.impl.idp.auth;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Map;
-
+import at.gv.egiz.eaaf.core.api.idp.IAuthData;
+import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
+import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummyConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -11,97 +16,203 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.Base64Utils;
-import at.gv.egiz.eaaf.core.api.idp.IAuthData;
-import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
-import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummyConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/SpringTest-context_eaaf_core.xml")
public class AuthenticationDataBuilderTest {
- @Autowired private TestAuthenticationDataBuilder authBuilder;
- @Autowired private DummyConfiguration authConfig;
-
- private static final String DUMMY_IDL_2 = "PHNhbWw6QXNzZXJ0aW9uIEFzc2VydGlvbklEPSJlbGdhdGVzdC5lZ2l6Lmd2LmF0LUFzc2VydGlvbklEWFhYxZB6Z8O8cl9YWFhUw7x6ZWvDp2kiIElzc3VlSW5zdGFudD0iMjAxOS0wMy0wNFQxNTo1MzowNCswMTowMCIgSXNzdWVyPSJodHRwOi8vcG9ydGFsLmJtaS5ndi5hdC9yZWYvc3pyL2lzc3VlciIgTWFqb3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GFuY2VzdG9yLW9yLXNlbGY6OmRzaWc6U2lnbmF0dXJlKTwvZHNpZzpYUGF0aD48L2RzaWc6VHJhbnNmb3JtPjwvZHNpZzpUcmFuc2Zvcm1zPjxkc2lnOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzaWc6RGlnZXN0VmFsdWU+QXN4VHprWmRBWUM0U0s1cTh5c0pLVDd5ZHVRPTwvZHNpZzpEaWdlc3RWYWx1ZT48L2RzaWc6UmVmZXJlbmNlPjwvZHNpZzpNYW5pZmVzdD48L2RzaWc6T2JqZWN0PjwvZHNpZzpTaWduYXR1cmU+PC9zYW1sOkFzc2VydGlvbj4=";
-
- @Test
- public void dummyTest() throws Exception {
-
-
- }
-
-
-
- @Test
- public void buildAuthDataWithIDLOnly_2_without_flag() throws Exception {
- buildAuthDataWithIDLOnly_2(null, "XXXŐz'gür", "XXXTüzekçi");
- System.out.println("IDPParser and AuthDataBuilder without escape config --> Successfull");
-
- }
-
-
- @Test
- public void buildAuthDataWithIDLOnly_2_with_flag_true() throws Exception {
- buildAuthDataWithIDLOnly_2(true, "XXXŐz&#39;gür", "XXXTüzekçi");
- System.out.println("IDPParser and AuthDataBuilder with escape config 'true' --> Successfull");
-
- }
-
- @Test
- public void buildAuthDataWithIDLOnly_2_with_flag_false() throws Exception {
- buildAuthDataWithIDLOnly_2(false, "XXXŐz'gür", "XXXTüzekçi");
- System.out.println("IDPParser and AuthDataBuilder with escape config 'false' --> Successfull");
-
- }
-
- private void buildAuthDataWithIDLOnly_2(Boolean idlEscaptionFlag, String givenName, String familyName) throws Exception {
- IAuthData authData = null;
-
- try {
- authConfig.setIsIDLEscapingEnabled(idlEscaptionFlag);
-
- TestRequestImpl pendingReq = new TestRequestImpl();
- Map<String, String> spConfigMap = new HashMap<String, String>();
- spConfigMap.put("target", "urn:publicid:gv.at:cdid+ZP-MH");
-
- DummySPConfiguration spConfig = new DummySPConfiguration(spConfigMap , authConfig);
- pendingReq.setSpConfig(spConfig);
-
- HashMap<String, Object> sessionStore = new HashMap<String, Object>();
- AuthProcessDataWrapper wrapper = new AuthProcessDataWrapper(sessionStore);
- wrapper.setIdentityLink(new SimpleIdentityLinkAssertionParser(new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_2.getBytes()))).parseIdentityLink());
- pendingReq.setRawDataToTransaction(sessionStore);
-
- authData = authBuilder.buildAuthenticationData(pendingReq);
-
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
-
- }
-
- if (authData == null)
- throw new Exception("AuthenticationData is 'null'");
-
- if (!authData.getFamilyName().equals(familyName))
- throw new Exception("Familyname wrong");
-
- if (!authData.getGivenName().equals(givenName))
- throw new Exception("GivenName wrong");
-
- if (!authData.getFormatedDateOfBirth().equals("1973-06-04"))
- throw new Exception("DateOfBirth wrong");
-
-
- if (!authData.getIdentificationValue().equals("RUxHQVRlc3RQQjBYWFjFkHpnw7xyX1hYWFTDvHpla8OnaQ=="))
- throw new Exception("baseId wrong");
-
- if (!authData.getIdentificationType().equals("urn:publicid:gv.at:baseid"))
- throw new Exception("baseIdType wrong");
-
- }
-
+ @Autowired
+ private TestAuthenticationDataBuilder authBuilder;
+ @Autowired
+ private DummyConfiguration authConfig;
+
+ private static final String DUMMY_IDL_2 =
+ "PHNhbWw6QXNzZXJ0aW9uIEFzc2VydGlvbklEPSJlbGdhdGVzdC5lZ2l6Lmd2LmF0LUFzc2VydGlvbklEWFhYxZB6Z8O8"
+ + "cl9YWFhUw7x6ZWvDp2kiIElzc3VlSW5zdGFudD0iMjAxOS0wMy0wNFQxNTo1MzowNCswMTowMCIgSXNzdWVyPSJodH"
+ + "RwOi8vcG9ydGFsLmJtaS5ndi5hdC9yZWYvc3pyL2lzc3VlciIgTWFqb3JWZXJzaW9uPSIxIiBNaW5vclZlcnNpb249"
+ + "IjAiIHhtbG5zOmRzaWc9Imh0dHA6Ly93d3cudzMub3JnLzIwMD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HJDa2hvdEhmcHFZaHJKaUFtSitPZnROdgo2b3hNUGZOaFpnMDFlT290bTFKK1dWMm1KYmdjUFROU0MxT05jU0ZkUT"
+ + "V2WlpMTDI0SjJIY3c9PTwvZHNpZzpYNTA5Q2VydGlmaWNhdGU+PC9kc2lnOlg1MDlEYXRhPjwvZHNpZzpLZXlJbmZv"
+ + "Pjxkc2lnOk9iamVjdD48ZHNpZzpNYW5pZmVzdCBJZD0ibWFuaWZlc3QiPjxkc2lnOlJlZmVyZW5jZSBVUkk9IiI+PG"
+ + "RzaWc6VHJhbnNmb3Jtcz48ZHNpZzpUcmFuc2Zvcm0gQWxnb3JpdGhtPSJodHRwOi8vd3d3LnczLm9yZy9UUi8xOTk5"
+ + "L1JFQy14cGF0aC0xOTk5MTExNiI+PGRzaWc6WFBhdGggeG1sbnM6ZHNpZz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC"
+ + "8wOS94bWxkc2lnIyI+bm90KGFuY2VzdG9yLW9yLXNlbGY6OmRzaWc6U2lnbmF0dXJlKTwvZHNpZzpYUGF0aD48L2Rz"
+ + "aWc6VHJhbnNmb3JtPjwvZHNpZzpUcmFuc2Zvcm1zPjxkc2lnOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly"
+ + "93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNzaGExIi8+PGRzaWc6RGlnZXN0VmFsdWU+QXN4VHprWmRBWUM0U0s1"
+ + "cTh5c0pLVDd5ZHVRPTwvZHNpZzpEaWdlc3RWYWx1ZT48L2RzaWc6UmVmZXJlbmNlPjwvZHNpZzpNYW5pZmVzdD48L2"
+ + "RzaWc6T2JqZWN0PjwvZHNpZzpTaWduYXR1cmU+PC9zYW1sOkFzc2VydGlvbj4=";
+
+ @Test
+ public void dummyTest() throws Exception {
+
+
+ }
+
+
+
+ @Test
+ public void buildAuthDataWithIdlOnly_2_without_flag() throws Exception {
+ buildAuthDataWithIdlOnly_2(null, "XXXŐz'gür", "XXXTüzekçi");
+ System.out.println("IDPParser and AuthDataBuilder without escape config --> Successfull");
+
+ }
+
+
+ @Test
+ public void buildAuthDataWithIdlOnly_2_with_flag_true() throws Exception {
+ buildAuthDataWithIdlOnly_2(true, "XXXŐz&#39;gür", "XXXTüzekçi");
+ System.out.println("IDPParser and AuthDataBuilder with escape config 'true' --> Successfull");
+
+ }
+
+ @Test
+ public void buildAuthDataWithIdlOnly_2_with_flag_false() throws Exception {
+ buildAuthDataWithIdlOnly_2(false, "XXXŐz'gür", "XXXTüzekçi");
+ System.out.println("IDPParser and AuthDataBuilder with escape config 'false' --> Successfull");
+
+ }
+
+ private void buildAuthDataWithIdlOnly_2(final Boolean idlEscaptionFlag, final String givenName,
+ final String familyName) throws Exception {
+ IAuthData authData = null;
+
+ try {
+ authConfig.setIsIdlEscapingEnabled(idlEscaptionFlag);
+
+ final TestRequestImpl pendingReq = new TestRequestImpl();
+ final Map<String, String> spConfigMap = new HashMap<>();
+ spConfigMap.put("target", "urn:publicid:gv.at:cdid+ZP-MH");
+
+ final DummySpConfiguration spConfig = new DummySpConfiguration(spConfigMap, authConfig);
+ pendingReq.setSpConfig(spConfig);
+
+ final HashMap<String, Object> sessionStore = new HashMap<>();
+ final AuthProcessDataWrapper wrapper = new AuthProcessDataWrapper(sessionStore);
+ wrapper.setIdentityLink(new SimpleIdentityLinkAssertionParser(
+ new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_2.getBytes())))
+ .parseIdentityLink());
+ pendingReq.setRawDataToTransaction(sessionStore);
+
+ authData = authBuilder.buildAuthenticationData(pendingReq);
+
+ } catch (final Exception e) {
+ e.printStackTrace();
+ throw e;
+
+ }
+
+ if (authData == null) {
+ throw new Exception("AuthenticationData is 'null'");
+ }
+
+ if (!authData.getFamilyName().equals(familyName)) {
+ throw new Exception("Familyname wrong");
+ }
+
+ if (!authData.getGivenName().equals(givenName)) {
+ throw new Exception("GivenName wrong");
+ }
+
+ if (!authData.getFormatedDateOfBirth().equals("1973-06-04")) {
+ throw new Exception("DateOfBirth wrong");
+ }
+
+
+ if (!authData.getIdentificationValue()
+ .equals("RUxHQVRlc3RQQjBYWFjFkHpnw7xyX1hYWFTDvHpla8OnaQ==")) {
+ throw new Exception("baseId wrong");
+ }
+
+ if (!authData.getIdentificationType().equals("urn:publicid:gv.at:baseid")) {
+ throw new Exception("baseIdType wrong");
+ }
+
+ }
+
}
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
index 368a1915..6d2ca67e 100644
--- 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
@@ -5,22 +5,23 @@ 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.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
+ public ISloInformationContainer performSingleLogOut(final HttpServletRequest httpReq,
+ final HttpServletResponse httpResp, final IRequest pendingReq, final String internalSsoId)
+ throws EaafException {
+ return null;
+ }
- @Override
- protected void populateExecutionContext(ExecutionContext executionContext, RequestImpl pendingReq,
- HttpServletRequest httpReq) throws EAAFException {
+ @Override
+ protected void populateExecutionContext(final ExecutionContext executionContext,
+ final RequestImpl pendingReq, final HttpServletRequest httpReq) throws EaafException {
- }
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyHttpClientFactory.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyHttpClientFactory.java
index 752932ce..9a924f83 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyHttpClientFactory.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/DummyHttpClientFactory.java
@@ -6,16 +6,16 @@ import at.gv.egiz.eaaf.core.impl.utils.IHttpClientFactory;
public class DummyHttpClientFactory implements IHttpClientFactory {
- @Override
- public CloseableHttpClient getHttpClient() {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public CloseableHttpClient getHttpClient() {
+ // TODO Auto-generated method stub
+ return null;
+ }
- @Override
- public CloseableHttpClient getHttpClient(boolean followRedirects) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public CloseableHttpClient getHttpClient(final boolean followRedirects) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/TestAuthenticationDataBuilder.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/TestAuthenticationDataBuilder.java
index c5610bc9..3e21c211 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/TestAuthenticationDataBuilder.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/TestAuthenticationDataBuilder.java
@@ -2,11 +2,11 @@ package at.gv.egiz.eaaf.core.impl.idp.auth;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
-import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.IspConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.data.IAuthProcessDataContainer;
-import at.gv.egiz.eaaf.core.exceptions.EAAFAuthenticationException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException;
+import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.impl.data.Pair;
import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData;
import at.gv.egiz.eaaf.core.impl.idp.auth.builder.AbstractAuthenticationDataBuilder;
@@ -14,46 +14,48 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
public class TestAuthenticationDataBuilder extends AbstractAuthenticationDataBuilder {
- @Override
- protected IAuthData getAuthDataInstance(IRequest pendingReq) throws EAAFException {
- throw new EAAFException("Not supported yet");
- }
-
- @Override
- protected void buildServiceSpecificAuthenticationData(IAuthData authData, IRequest pendingReq)
- throws EAAFException {
- throw new EAAFException("Not supported yet");
-
- }
-
- @Override
- @Deprecated
- protected IAuthData buildDeprecatedAuthData(IRequest pendingReq) throws EAAFException {
- final AuthenticationData authData = new AuthenticationData();
- try {
- generateDeprecatedBasicAuthData(authData, pendingReq, pendingReq.getSessionData(AuthProcessDataWrapper.class));
-
- } catch (final Exception e) {
- e.printStackTrace();
- throw new EAAFAuthenticationException("AuthDataGeneration FAILED", null, e);
-
- }
- return authData;
- }
-
- @Override
- protected Pair<String, String> getEncryptedbPKFromPVPAttribute(IAuthProcessDataContainer authProcessDataContainer,
- AuthenticationData authData, ISPConfiguration spConfig) throws EAAFBuilderException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- protected Pair<String, String> getbaseIDFromSZR(AuthenticationData authData, String notValidbPK,
- String notValidbPKType) {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ protected IAuthData getAuthDataInstance(final IRequest pendingReq) throws EaafException {
+ throw new EaafException("Not supported yet");
+ }
+
+ @Override
+ protected void buildServiceSpecificAuthenticationData(final IAuthData authData,
+ final IRequest pendingReq) throws EaafException {
+ throw new EaafException("Not supported yet");
+
+ }
+
+ @Override
+ @Deprecated
+ protected IAuthData buildDeprecatedAuthData(final IRequest pendingReq) throws EaafException {
+ final AuthenticationData authData = new AuthenticationData();
+ try {
+ generateDeprecatedBasicAuthData(authData, pendingReq,
+ pendingReq.getSessionData(AuthProcessDataWrapper.class));
+
+ } catch (final Exception e) {
+ e.printStackTrace();
+ throw new EaafAuthenticationException("AuthDataGeneration FAILED", null, e);
+
+ }
+ return authData;
+ }
+
+ @Override
+ protected Pair<String, String> getEncryptedBpkFromPvpAttribute(
+ final IAuthProcessDataContainer authProcessDataContainer, final AuthenticationData authData,
+ final IspConfiguration spConfig) throws EaafBuilderException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Pair<String, String> getbaseIdFromSzr(final AuthenticationData authData,
+ final String notValidBpk, final String notValidBpkType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/AbstractAttributeBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/AbstractAttributeBuilderTest.java
index 68cc16ed..8619b58f 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/AbstractAttributeBuilderTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/AbstractAttributeBuilderTest.java
@@ -3,67 +3,174 @@ package at.gv.egiz.eaaf.core.impl.idp.auth.attributes;
import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Map;
-
-import org.junit.BeforeClass;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.Base64Utils;
-
import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
-import at.gv.egiz.eaaf.core.exceptions.EAAFParserException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
+import at.gv.egiz.eaaf.core.exceptions.EaafParserException;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.impl.idp.auth.TestAuthenticationDataBuilder;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
import at.gv.egiz.eaaf.core.impl.idp.builder.SimpleStringAttributeGenerator;
import at.gv.egiz.eaaf.core.impl.idp.module.test.DummyConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySPConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import org.junit.BeforeClass;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.Base64Utils;
public abstract class AbstractAttributeBuilderTest {
- @Autowired private TestAuthenticationDataBuilder authBuilder;
- private static final String DUMMY_IDL_2 = "PHNhbWw6QXNzZXJ0aW9uIEFzc2VydGlvbklEPSJlbGdhdGVzdC5lZ2l6Lmd2LmF0LUFzc2VydGlvbklEWFhYxZB6Z8O8cl9YWFhUw7x6ZWvDp2kiIElzc3VlSW5zdGFudD0iMjAxOS0wMy0wNFQxNTo1MzowNCswMTowMCIgSXNzdWVyPSJodHRwOi8vcG9ydGFsLmJtaS5ndi5hdC9yZWYvc3pyL2lzc3VlciIgTWFqb3JWZXJzaW9uPSIxIiBNaW5vclZlcnNpb249IjAiIHhtbG5zOmRzaWc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyMiIHhtbG5zOmVjZHNhPSJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSMiIHhtbG5zOnByPSJodHRwOi8vcmVmZXJlbmNlLmUtZ292ZXJubWVudC5ndi5hdC9uYW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VHprWmRBWUM0U0s1cTh5c0pLVDd5ZHVRPTwvZHNpZzpEaWdlc3RWYWx1ZT48L2RzaWc6UmVmZXJlbmNlPjwvZHNpZzpNYW5pZmVzdD48L2RzaWc6T2JqZWN0PjwvZHNpZzpTaWduYXR1cmU+PC9zYW1sOkFzc2VydGlvbj4=";
-
- protected IAttributeGenerator<String> g = new SimpleStringAttributeGenerator();
- protected static DummySPConfiguration spConfig = null;
-
- private final static Map<String, String> spConfigMap = new HashMap<String, String>();
- private final static TestRequestImpl pendingReq = new TestRequestImpl();
-
-
-
- @BeforeClass
- public static void intialize() throws EAAFParserException, EAAFStorageException {
- spConfigMap.put("target", "urn:publicid:gv.at:cdid+ZP-MH");
-
- spConfig = new DummySPConfiguration(spConfigMap, new DummyConfiguration());
- pendingReq.setSpConfig(spConfig);
-
- final HashMap<String, Object> sessionStore = new HashMap<String, Object>();
- final AuthProcessDataWrapper wrapper = new AuthProcessDataWrapper(sessionStore);
- wrapper.setIdentityLink(new SimpleIdentityLinkAssertionParser(new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_2.getBytes()))).parseIdentityLink());
- pendingReq.setRawDataToTransaction(sessionStore);
-
-
- }
-
- protected void putIntoSPConfigMap(String key, String value) {
- spConfigMap.put(key, value);
-
- }
-
- protected IAuthData buildAuthData() throws Exception {
- try {
- return authBuilder.buildAuthenticationData(pendingReq);
-
- } catch (final Exception e) {
- e.printStackTrace();
- throw e;
-
- }
-
- }
-
+ @Autowired
+ private TestAuthenticationDataBuilder authBuilder;
+ private static final String DUMMY_IDL_2 =
+ "PHNhbWw6QXNzZXJ0aW9uIEFzc2VydGlvbklEPSJlbGdhdGVzdC5lZ2l6Lmd2LmF0LUFzc2VydGlvbklEWFhYxZB6Z8O8"
+ + "cl9YWFhUw7x6ZWvDp2kiIElzc3VlSW5zdGFudD0iMjAxOS0wMy0wNFQxNTo1MzowNCswMTowMCIgSXNzdWVyPSJodH"
+ + "RwOi8vcG9ydGFsLmJtaS5ndi5h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+ protected IAttributeGenerator<String> gen = new SimpleStringAttributeGenerator();
+ protected static DummySpConfiguration spConfig = null;
+
+ private static final Map<String, String> spConfigMap = new HashMap<>();
+ private static final TestRequestImpl pendingReq = new TestRequestImpl();
+
+
+
+ /**
+ * jUnit class initializer.
+ *
+ * @throws EaafParserException In case of an error
+ * @throws EaafStorageException In case of an error
+ */
+ @BeforeClass
+ public static void intialize() throws EaafParserException, EaafStorageException {
+ spConfigMap.put("target", "urn:publicid:gv.at:cdid+ZP-MH");
+
+ spConfig = new DummySpConfiguration(spConfigMap, new DummyConfiguration());
+ pendingReq.setSpConfig(spConfig);
+
+ final HashMap<String, Object> sessionStore = new HashMap<>();
+ final AuthProcessDataWrapper wrapper = new AuthProcessDataWrapper(sessionStore);
+ wrapper.setIdentityLink(new SimpleIdentityLinkAssertionParser(
+ new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_2.getBytes()))).parseIdentityLink());
+ pendingReq.setRawDataToTransaction(sessionStore);
+
+
+ }
+
+ protected void putIntoSpConfigMap(final String key, final String value) {
+ spConfigMap.put(key, value);
+
+ }
+
+ protected IAuthData buildAuthData() throws Exception {
+ try {
+ return authBuilder.buildAuthenticationData(pendingReq);
+
+ } catch (final Exception e) {
+ e.printStackTrace();
+ throw e;
+
+ }
+
+ }
+
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/BirthdayAttrBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/BirthdayAttrBuilderTest.java
index 5f1913a3..7be691d2 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/BirthdayAttrBuilderTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/BirthdayAttrBuilderTest.java
@@ -16,24 +16,26 @@ import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.BirthdateAttributeBuilde
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/SpringTest-context_eaaf_core.xml")
-public class BirthdayAttrBuilderTest extends AbstractAttributeBuilderTest{
-
- private final IAttributeBuilder attrBuilde = new BirthdateAttributeBuilder();
-
- @Test
- public void performTest_ok() {
- try {
- final IAuthData authData = buildAuthData();
- final String value = attrBuilde.build(spConfig, authData, g);
-
- final DateFormat format = new SimpleDateFormat(PVPAttributeDefinitions.BIRTHDATE_FORMAT_PATTERN);
- Assert.assertEquals("Birthday does NOT match", authData.getDateOfBirth(), format.parse(value));
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder has an exception", e == null);
-
- }
-
- }
+public class BirthdayAttrBuilderTest extends AbstractAttributeBuilderTest {
+
+ private final IAttributeBuilder attrBuilde = new BirthdateAttributeBuilder();
+
+ @Test
+ public void performTest_ok() {
+ try {
+ final IAuthData authData = buildAuthData();
+ final String value = attrBuilde.build(spConfig, authData, gen);
+
+ final DateFormat format =
+ new SimpleDateFormat(PVPAttributeDefinitions.BIRTHDATE_FORMAT_PATTERN);
+ Assert.assertEquals("Birthday does NOT match", authData.getDateOfBirth(),
+ format.parse(value));
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder has an exception", e == null);
+
+ }
+
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/FamilyNameAttrBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/FamilyNameAttrBuilderTest.java
index 51a6a2c2..ea3c12dd 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/FamilyNameAttrBuilderTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/FamilyNameAttrBuilderTest.java
@@ -16,57 +16,61 @@ import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PrincipalNameAttributeBu
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/SpringTest-context_eaaf_core.xml")
-public class FamilyNameAttrBuilderTest extends AbstractAttributeBuilderTest{
-
- private final IAttributeBuilder attrBuilde = new PrincipalNameAttributeBuilder();
-
- @Test
- public void performTest_ok() {
- try {
- final IAuthData authData = buildAuthData();
- final String value = attrBuilde.build(spConfig, authData, g);
- Assert.assertEquals("FamilyName does NOT match", authData.getFamilyName(), value);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder has an exception", e == null);
-
- }
-
- }
-
- @Test
- public void performTest_null() {
- try {
- final AuthenticationData authData = (AuthenticationData) buildAuthData();
- authData.setFamilyName(null);
-
- attrBuilde.build(spConfig, authData, g);
- Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException);
- Assert.assertEquals("Attr. name in exception does NOT match",
- PVPAttributeDefinitions.PRINCIPAL_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName());
-
- }
-
- }
-
- @Test
- public void performTest_emtpty() {
- try {
- final AuthenticationData authData = (AuthenticationData) buildAuthData();
- authData.setFamilyName(StringUtils.EMPTY);
-
- attrBuilde.build(spConfig, authData, g);
- Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException);
- Assert.assertEquals("Attr. name in exception does NOT match",
- PVPAttributeDefinitions.PRINCIPAL_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName());
-
- }
-
- }
+public class FamilyNameAttrBuilderTest extends AbstractAttributeBuilderTest {
+
+ private final IAttributeBuilder attrBuilde = new PrincipalNameAttributeBuilder();
+
+ @Test
+ public void performTest_ok() {
+ try {
+ final IAuthData authData = buildAuthData();
+ final String value = attrBuilde.build(spConfig, authData, gen);
+ Assert.assertEquals("FamilyName does NOT match", authData.getFamilyName(), value);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder has an exception", e == null);
+
+ }
+
+ }
+
+ @Test
+ public void performTest_null() {
+ try {
+ final AuthenticationData authData = (AuthenticationData) buildAuthData();
+ authData.setFamilyName(null);
+
+ attrBuilde.build(spConfig, authData, gen);
+ Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder provide wrong exception",
+ e instanceof UnavailableAttributeException);
+ Assert.assertEquals("Attr. name in exception does NOT match",
+ PVPAttributeDefinitions.PRINCIPAL_NAME_NAME,
+ ((UnavailableAttributeException) e).getAttributeName());
+
+ }
+
+ }
+
+ @Test
+ public void performTest_emtpty() {
+ try {
+ final AuthenticationData authData = (AuthenticationData) buildAuthData();
+ authData.setFamilyName(StringUtils.EMPTY);
+
+ attrBuilde.build(spConfig, authData, gen);
+ Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder provide wrong exception",
+ e instanceof UnavailableAttributeException);
+ Assert.assertEquals("Attr. name in exception does NOT match",
+ PVPAttributeDefinitions.PRINCIPAL_NAME_NAME,
+ ((UnavailableAttributeException) e).getAttributeName());
+
+ }
+
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java
index dd1dfa5e..62324491 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/GivenNameAttrBuilderTest.java
@@ -16,57 +16,61 @@ import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.GivenNameAttributeBuilde
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/SpringTest-context_eaaf_core.xml")
-public class GivenNameAttrBuilderTest extends AbstractAttributeBuilderTest{
-
- private final IAttributeBuilder attrBuilde = new GivenNameAttributeBuilder();
-
- @Test
- public void performTest_ok() {
- try {
- final IAuthData authData = buildAuthData();
- final String value = attrBuilde.build(spConfig, authData, g);
- Assert.assertEquals("GivenName does NOT match", authData.getGivenName(), value);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder has an exception", e == null);
-
- }
-
- }
-
- @Test
- public void performTest_null() {
- try {
- final AuthenticationData authData = (AuthenticationData) buildAuthData();
- authData.setGivenName(null);
-
- attrBuilde.build(spConfig, authData, g);
- Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException);
- Assert.assertEquals("Attr. name in exception does NOT match",
- PVPAttributeDefinitions.GIVEN_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName());
-
- }
-
- }
-
- @Test
- public void performTest_emtpty() {
- try {
- final AuthenticationData authData = (AuthenticationData) buildAuthData();
- authData.setGivenName(StringUtils.EMPTY);
-
- attrBuilde.build(spConfig, authData, g);
- Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
-
- } catch (final Exception e) {
- Assert.assertTrue("Attr. builder provide wrong exception", e instanceof UnavailableAttributeException);
- Assert.assertEquals("Attr. name in exception does NOT match",
- PVPAttributeDefinitions.GIVEN_NAME_NAME, ((UnavailableAttributeException) e).getAttributeName());
-
- }
-
- }
+public class GivenNameAttrBuilderTest extends AbstractAttributeBuilderTest {
+
+ private final IAttributeBuilder attrBuilde = new GivenNameAttributeBuilder();
+
+ @Test
+ public void performTest_ok() {
+ try {
+ final IAuthData authData = buildAuthData();
+ final String value = attrBuilde.build(spConfig, authData, gen);
+ Assert.assertEquals("GivenName does NOT match", authData.getGivenName(), value);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder has an exception", e == null);
+
+ }
+
+ }
+
+ @Test
+ public void performTest_null() {
+ try {
+ final AuthenticationData authData = (AuthenticationData) buildAuthData();
+ authData.setGivenName(null);
+
+ attrBuilde.build(spConfig, authData, gen);
+ Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder provide wrong exception",
+ e instanceof UnavailableAttributeException);
+ Assert.assertEquals("Attr. name in exception does NOT match",
+ PVPAttributeDefinitions.GIVEN_NAME_NAME,
+ ((UnavailableAttributeException) e).getAttributeName());
+
+ }
+
+ }
+
+ @Test
+ public void performTest_emtpty() {
+ try {
+ final AuthenticationData authData = (AuthenticationData) buildAuthData();
+ authData.setGivenName(StringUtils.EMPTY);
+
+ attrBuilde.build(spConfig, authData, gen);
+ Assert.assertTrue("Attr. Builder provide no 'UnavailableAttributeException'", false);
+
+ } catch (final Exception e) {
+ Assert.assertTrue("Attr. builder provide wrong exception",
+ e instanceof UnavailableAttributeException);
+ Assert.assertEquals("Attr. name in exception does NOT match",
+ PVPAttributeDefinitions.GIVEN_NAME_NAME,
+ ((UnavailableAttributeException) e).getAttributeName());
+
+ }
+
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java
index 816f6871..185e1d27 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyConfiguration.java
@@ -3,82 +3,83 @@ package at.gv.egiz.eaaf.core.impl.idp.module.test;
import java.net.URI;
import java.net.URL;
import java.util.Map;
-
import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
-import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration;
-import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.api.idp.IspConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.impl.idp.auth.builder.AbstractAuthenticationDataBuilder;
public class DummyConfiguration implements IConfigurationWithSP {
- private Boolean isIDLEscapingEnabled = null;
-
- @Override
- public String getBasicConfiguration(String key) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getBasicConfiguration(String key, String defaultValue) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Map<String, String> getBasicConfigurationWithPrefix(String prefix) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ISPConfiguration getServiceProviderConfiguration(String uniqueID) throws EAAFConfigurationException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <T> T getServiceProviderConfiguration(String spIdentifier, Class<T> decorator)
- throws EAAFConfigurationException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public URI getConfigurationRootDirectory() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String validateIDPURL(URL authReqUrl) throws EAAFException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setIsIDLEscapingEnabled(Boolean isIDLEscapingEnabled) {
- this.isIDLEscapingEnabled = isIDLEscapingEnabled;
- }
-
- @Override
- public Boolean getBasicConfigurationBoolean(String key) {
- return null;
-
- }
-
- @Override
- public boolean getBasicConfigurationBoolean(String key, boolean defaultValue) {
- if (AbstractAuthenticationDataBuilder.CONFIG_PROP_ENABLE_IDL_ATTRIBUTE_ESCAPEING.equals(key)) {
- if (isIDLEscapingEnabled == null)
- return defaultValue;
- else
- return isIDLEscapingEnabled;
-
- }
-
-
- return false;
-
- }
+ private Boolean isIdlEscapingEnabled = null;
+
+ @Override
+ public String getBasicConfiguration(final String key) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key, final String defaultValue) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public IspConfiguration getServiceProviderConfiguration(final String uniqueID)
+ throws EaafConfigurationException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <T> T getServiceProviderConfiguration(final String spIdentifier, final Class<T> decorator)
+ throws EaafConfigurationException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public URI getConfigurationRootDirectory() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String validateIdpUrl(final URL authReqUrl) throws EaafException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setIsIdlEscapingEnabled(final Boolean isIdlEscapingEnabled) {
+ this.isIdlEscapingEnabled = isIdlEscapingEnabled;
+ }
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key) {
+ return false;
+
+ }
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) {
+ if (AbstractAuthenticationDataBuilder.CONFIG_PROP_ENABLE_IDL_ATTRIBUTE_ESCAPEING.equals(key)) {
+ if (isIdlEscapingEnabled == null) {
+ return defaultValue;
+ } else {
+ return isIdlEscapingEnabled;
+ }
+
+ }
+
+
+ return false;
+
+ }
}
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
index 94209dd6..87f2bcb6 100644
--- 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
@@ -7,75 +7,77 @@ 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;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
public class DummyProtocolAuthService implements IProtocolAuthenticationService {
-
- private IRequest pendingReq;
- private HttpServletRequest httpReq;
- private HttpServletResponse httpResp;
- private Throwable exception;
- private boolean writeToStatisticLog;
-
-
- @Override
- public void performAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq)
- throws IOException, EAAFException {
- this.pendingReq = pendingReq;
- this.httpReq = req;
- this.httpResp = resp;
-
- }
-
- @Override
- public void finalizeAuthentication(HttpServletRequest req, HttpServletResponse resp, IRequest pendingReq)
- throws EAAFException, IOException {
- this.pendingReq = pendingReq;
- this.httpReq = req;
- this.httpResp = resp;
-
- }
-
- @Override
- public void buildProtocolSpecificErrorResponse(Throwable throwable, HttpServletRequest req,
- HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException {
- this.pendingReq = pendingReq;
- this.httpReq = req;
- this.httpResp = resp;
- this.exception = throwable;
-
- }
-
- @Override
- public void handleErrorNoRedirect(Throwable throwable, HttpServletRequest req, HttpServletResponse resp,
- boolean writeExceptionToStatisticLog) throws IOException, EAAFException {
- this.httpReq = req;
- this.httpResp = resp;
- this.exception = throwable;
- this.writeToStatisticLog = writeExceptionToStatisticLog;
-
- }
-
- public IRequest getPendingReq() {
- return pendingReq;
- }
-
- public HttpServletRequest getHttpReq() {
- return httpReq;
- }
-
- public HttpServletResponse getHttpResp() {
- return httpResp;
- }
-
- public Throwable getException() {
- return exception;
- }
-
- public boolean isWriteToStatisticLog() {
- return writeToStatisticLog;
- }
-
-
+
+ private IRequest pendingReq;
+ private HttpServletRequest httpReq;
+ private HttpServletResponse httpResp;
+ private Throwable exception;
+ private boolean writeToStatisticLog;
+
+
+ @Override
+ public void performAuthentication(final HttpServletRequest req, final HttpServletResponse resp,
+ final IRequest pendingReq) throws IOException, EaafException {
+ this.pendingReq = pendingReq;
+ this.httpReq = req;
+ this.httpResp = resp;
+
+ }
+
+ @Override
+ public void finalizeAuthentication(final HttpServletRequest req, final HttpServletResponse resp,
+ final IRequest pendingReq) throws EaafException, IOException {
+ this.pendingReq = pendingReq;
+ this.httpReq = req;
+ this.httpResp = resp;
+
+ }
+
+ @Override
+ public void buildProtocolSpecificErrorResponse(final Throwable throwable,
+ final HttpServletRequest req, final HttpServletResponse resp, final IRequest pendingReq)
+ throws IOException, EaafException {
+ this.pendingReq = pendingReq;
+ this.httpReq = req;
+ this.httpResp = resp;
+ this.exception = throwable;
+
+ }
+
+ @Override
+ public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req,
+ final HttpServletResponse resp, final boolean writeExceptionToStatisticLog)
+ throws IOException, EaafException {
+ this.httpReq = req;
+ this.httpResp = resp;
+ this.exception = throwable;
+ this.writeToStatisticLog = writeExceptionToStatisticLog;
+
+ }
+
+ public IRequest getPendingReq() {
+ return pendingReq;
+ }
+
+ public HttpServletRequest getHttpReq() {
+ return httpReq;
+ }
+
+ public HttpServletResponse getHttpResp() {
+ return httpResp;
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+ public boolean isWriteToStatisticLog() {
+ return writeToStatisticLog;
+ }
+
+
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java
deleted file mode 100644
index f51c95ab..00000000
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySPConfiguration.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package at.gv.egiz.eaaf.core.impl.idp.module.test;
-
-import java.util.Map;
-
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.conf.SPConfigurationImpl;
-
-public class DummySPConfiguration extends SPConfigurationImpl {
-
- public DummySPConfiguration(Map<String, String> spConfig, IConfiguration authConfig) {
- super(spConfig, authConfig);
-
- }
-
- @Override
- public String getAreaSpecificTargetIdentifier() {
- return getConfigurationValue("target");
-
- }
-
-}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java
new file mode 100644
index 00000000..87e91609
--- /dev/null
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummySpConfiguration.java
@@ -0,0 +1,23 @@
+package at.gv.egiz.eaaf.core.impl.idp.module.test;
+
+import java.util.Map;
+
+import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
+import at.gv.egiz.eaaf.core.impl.idp.conf.SpConfigurationImpl;
+
+public class DummySpConfiguration extends SpConfigurationImpl {
+
+ private static final long serialVersionUID = 3837138426712775909L;
+
+ public DummySpConfiguration(final Map<String, String> spConfig, final IConfiguration authConfig) {
+ super(spConfig, authConfig);
+
+ }
+
+ @Override
+ public String getAreaSpecificTargetIdentifier() {
+ return getConfigurationValue("target");
+
+ }
+
+}
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 80451399..ad80d3ad 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
@@ -1,343 +1,376 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.module.test;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-
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.api.idp.IspConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
+import org.apache.commons.lang3.StringUtils;
/**
+ * Test pending-request for jUnit tests.
+ *
* @author tlenz
*
*/
public class TestRequestImpl implements IRequest {
- private String processInstanceID = null;
- private ISPConfiguration spConfig = null;
- private final Map<String, Object> storage = new HashMap<String, Object>();
- private String transactionId = null;
- private String pendingReqId = null;
- private String authURL = null;
- private boolean authenticated;
- private boolean needAuthentication = false;
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule()
- */
- @Override
- public String requestedModule() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedAction()
- */
- @Override
- public String requestedAction() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#isPassiv()
- */
- @Override
- public boolean isPassiv() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#forceAuth()
- */
- @Override
- public boolean forceAuth() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String)
- */
- @Override
- public Object getRawData(String key) {
- return storage.get(key);
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String, java.lang.Class)
- */
- @Override
- public <T> T getRawData(String key, Class<T> clazz) {
- return (T)storage.get(key);
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueTransactionIdentifier()
- */
- @Override
- public String getUniqueTransactionIdentifier() {
- return this.transactionId;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueSessionIdentifier()
- */
- @Override
- public String getUniqueSessionIdentifier() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getProcessInstanceId()
- */
- @Override
- public String getProcessInstanceId() {
- return processInstanceID;
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURL()
- */
- @Override
- public String getAuthURL() {
- return this.authURL;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURLWithOutSlash()
- */
- @Override
- public String getAuthURLWithOutSlash() {
- if (this.authURL != null && this.authURL.endsWith("/"))
- return this.authURL.substring(0, this.authURL.length()-1);
- else
- return this.authURL;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#isNeedAuthentication()
- */
- @Override
- public boolean isNeedAuthentication() {
- return this.needAuthentication;
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#needSingleSignOnFunctionality()
- */
- @Override
- public boolean needSingleSignOnFunctionality() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#setNeedSingleSignOnFunctionality(boolean)
- */
- @Override
- public void setNeedSingleSignOnFunctionality(boolean needSSO) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#isAuthenticated()
- */
- @Override
- public boolean isAuthenticated() {
- return this.authenticated;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#setAuthenticated(boolean)
- */
- @Override
- public void setAuthenticated(boolean isAuthenticated) {
- this.authenticated = isAuthenticated;
-
- }
-
- /**
- * @param processInstanceID the processInstanceID to set
- */
- public void setProcessInstanceID(String processInstanceID) {
- this.processInstanceID = processInstanceID;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#isAbortedByUser()
- */
- @Override
- public boolean isAbortedByUser() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.moduls.IRequest#setAbortedByUser(boolean)
- */
- @Override
- public void setAbortedByUser(boolean isAborted) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public String getSPEntityId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setRawDataToTransaction(Map<String, Object> map) throws EAAFStorageException {
- storage.putAll(map);
-
- }
-
- @Override
- public String getPendingRequestId() {
- return this.pendingReqId;
- }
-
- @Override
- public String getInternalSSOSessionIdentifier() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setInternalSSOSessionIdentifier(String internalSSOSessionId) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public boolean isNeedUserConsent() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void setNeedUserConsent(boolean needConsent) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public ISPConfiguration getServiceProviderConfiguration() {
- return spConfig;
-
- }
-
- @Override
- public <T> T getServiceProviderConfiguration(Class<T> decorator) {
- return (T)spConfig;
- }
-
- @Override
- public void setRawDataToTransaction(String key, Object object) throws EAAFStorageException {
- if (StringUtils.isEmpty(key)) {
- throw new EAAFStorageException("Generic request-data can not be stored with a 'null' key", null);
-
- }
-
- if (object != null) {
- if (!Serializable.class.isInstance(object)) {
- throw new EAAFStorageException("Generic request-data can only store objects which implements the 'Seralizable' interface", null);
-
- }
- }
-
- storage.put(key, object);
-
- }
-
- 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;
- }
-
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-
- public void setPendingReqId(String pendingReqId) {
- this.pendingReqId = pendingReqId;
- }
-
- public void setAuthURL(String authURL) {
- this.authURL = authURL;
- }
-
- public void setNeedAuthentication(boolean needAuthentication) {
- this.needAuthentication = needAuthentication;
- }
-
-
-
-
-
-
-
+ private String processInstanceID = null;
+ private IspConfiguration spConfig = null;
+ private final Map<String, Object> storage = new HashMap<>();
+ private String transactionId = null;
+ private String pendingReqId = null;
+ private String authUrl = null;
+ private boolean authenticated;
+ private boolean needAuthentication = false;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedModule()
+ */
+ @Override
+ public String requestedModule() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#requestedAction()
+ */
+ @Override
+ public String requestedAction() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#isPassiv()
+ */
+ @Override
+ public boolean isPassiv() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#forceAuth()
+ */
+ @Override
+ public boolean forceAuth() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String)
+ */
+ @Override
+ public Object getRawData(final String key) {
+ return storage.get(key);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getGenericData(java.lang.String, java.lang.Class)
+ */
+ @Override
+ public <T> T getRawData(final String key, final Class<T> clazz) {
+ return (T) storage.get(key);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueTransactionIdentifier()
+ */
+ @Override
+ public String getUniqueTransactionIdentifier() {
+ return this.transactionId;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getUniqueSessionIdentifier()
+ */
+ @Override
+ public String getUniqueSessionIdentifier() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getProcessInstanceId()
+ */
+ @Override
+ public String getProcessInstanceId() {
+ return processInstanceID;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURL()
+ */
+ @Override
+ public String getAuthUrl() {
+ return this.authUrl;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#getAuthURLWithOutSlash()
+ */
+ @Override
+ public String getAuthUrlWithOutSlash() {
+ if (this.authUrl != null && this.authUrl.endsWith("/")) {
+ return this.authUrl.substring(0, this.authUrl.length() - 1);
+ } else {
+ return this.authUrl;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#isNeedAuthentication()
+ */
+ @Override
+ public boolean isNeedAuthentication() {
+ return this.needAuthentication;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#needSingleSignOnFunctionality()
+ */
+ @Override
+ public boolean needSingleSignOnFunctionality() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#setNeedSingleSignOnFunctionality(boolean)
+ */
+ @Override
+ public void setNeedSingleSignOnFunctionality(final boolean needSso) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#isAuthenticated()
+ */
+ @Override
+ public boolean isAuthenticated() {
+ return this.authenticated;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#setAuthenticated(boolean)
+ */
+ @Override
+ public void setAuthenticated(final boolean isAuthenticated) {
+ this.authenticated = isAuthenticated;
+
+ }
+
+ /**
+ * Set process-instance id.
+ *
+ * @param processInstanceID the processInstanceID to set
+ */
+ public void setProcessInstanceID(final String processInstanceID) {
+ this.processInstanceID = processInstanceID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#isAbortedByUser()
+ */
+ @Override
+ public boolean isAbortedByUser() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.moduls.IRequest#setAbortedByUser(boolean)
+ */
+ @Override
+ public void setAbortedByUser(final boolean isAborted) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String getSpEntityId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setRawDataToTransaction(final String key, final Object object)
+ throws EaafStorageException {
+ if (StringUtils.isEmpty(key)) {
+ throw new EaafStorageException("Generic request-data can not be stored with a 'null' key",
+ null);
+
+ }
+
+ if (object != null) {
+ if (!Serializable.class.isInstance(object)) {
+ throw new EaafStorageException(
+ "Generic request-data can only store objects which implements the 'Seralizable' interface",
+ null);
+
+ }
+ }
+
+ storage.put(key, object);
+
+ }
+
+ @Override
+ public void setRawDataToTransaction(final Map<String, Object> map) throws EaafStorageException {
+ storage.putAll(map);
+
+ }
+
+ @Override
+ public String getPendingRequestId() {
+ return this.pendingReqId;
+ }
+
+ @Override
+ public String getInternalSsoSessionIdentifier() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setInternalSsoSessionIdentifier(final String internalSsoSessionId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean isNeedUserConsent() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setNeedUserConsent(final boolean needConsent) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public IspConfiguration getServiceProviderConfiguration() {
+ return spConfig;
+
+ }
+
+ @Override
+ public <T> T getServiceProviderConfiguration(final Class<T> decorator) {
+ return (T) spConfig;
+ }
+
+
+
+ public void setSpConfig(final IspConfiguration spConfig) {
+ this.spConfig = spConfig;
+ }
+
+ @Override
+ public <T> T getSessionData(final 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;
+ }
+
+ public void setTransactionId(final String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public void setPendingReqId(final String pendingReqId) {
+ this.pendingReqId = pendingReqId;
+ }
+
+ public void setAuthUrl(final String authUrl) {
+ this.authUrl = authUrl;
+ }
+
+ public void setNeedAuthentication(final boolean needAuthentication) {
+ this.needAuthentication = needAuthentication;
+ }
+
+
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/DummyTransactionStorage.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/DummyTransactionStorage.java
index 4795fdf4..cc1d57cd 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/DummyTransactionStorage.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/DummyTransactionStorage.java
@@ -1,189 +1,186 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
-
import javax.sql.DataSource;
-
+import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-
/**
- * Dummy DataSource implementation for convenience in test cases where a
- * database connection will never actually be acquired.
+ * Dummy DataSource implementation for convenience in test cases where a database connection will
+ * never actually be acquired.
*
* @see DataSource
* @author Chris Beams
*/
public class DummyTransactionStorage implements ITransactionStorage {
- private static final Logger log = LoggerFactory.getLogger(DummyTransactionStorage.class);
-
-
- public class DummyDBEntry{
- public DummyDBEntry(String key, Object value){
- this.obj =value;
- this.key = key;
- }
- public String getKey() {
- return key;
- }
- public void setKey(String key) {
- this.key = key;
- }
- public Object getObj() {
- return obj;
- }
- public void setObj(Object obj) {
- this.obj = obj;
- }
- private String key;
- private Object obj;
- }
-
- private ArrayList<DummyDBEntry> ds = new ArrayList<DummyDBEntry>();
-
-
-
- @Override
- public boolean containsKey(String key) {
- // TODO Auto-generated method stub
- Iterator<DummyDBEntry> it = ds.iterator();
- while(it.hasNext()){
- DummyDBEntry t = it.next();
- if(t.getKey().equals(key))
- return true;
- }
- return false;
- }
-
- @Override
- public void put(String key, Object value, int timeout)
- throws EAAFException {
- // TODO Auto-generated method stub
- this.remove(key);
- this.ds.add(new DummyDBEntry(key, value));
-
- }
-
- @Override
- public Object get(String key) throws EAAFException {
- // TODO Auto-generated method stub
- Iterator<DummyDBEntry> it = ds.iterator();
- while(it.hasNext()){
- DummyDBEntry t = it.next();
- if(t.getKey().equals(key))
- return t;
- }
- return null;
- }
-
- @Override
- public <T> T get(String key, Class<T> clazz) throws EAAFException {
-
- DummyDBEntry o = (DummyDBEntry) get(key);
- if(o == null)
- return null;
- try {
- @SuppressWarnings("unchecked")
- T test = (T) (clazz.cast(o.getObj()));
- return test;
-
- } catch (Exception e) {
- log.warn("Sessioninformation Cast-Exception by using Artifact=" + key);
- throw new EAAFException("Sessioninformation Cast-Exception");
-
- }
- }
-
- @Override
- public <T> T get(String key, Class<T> clazz, long dataTimeOut)
- throws EAAFException {
- // TODO Auto-generated method stub
- return get(key,clazz);
- }
-
- @Override
- public void changeKey(String oldKey, String newKey, Object value)
- throws EAAFException {
- this.remove(oldKey);
- this.put(newKey, value, -1);
-
- }
-
- @Override
- public void remove(String key) {
- Iterator<DummyDBEntry> it = ds.iterator();
- while(it.hasNext()){
- DummyDBEntry t = it.next();
- if(t.getKey().equals(key)){
- this.ds.remove(t);
- return;
- }
- }
-
- }
-
- @Override
- public List<String> clean(Date now, long dataTimeOut) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Object getRaw(String key) throws EAAFException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void putRaw(String key, Object element) throws EAAFException {
- // TODO Auto-generated method stub
-
- }
-
-// @Override
-// public Object getAssertionStore(String key) throwsEAAFException {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// @Override
-// public void putAssertionStore(Object element) throws EAAFException {
-// // TODO Auto-generated method stub
-//
-// }
-
-
-} \ No newline at end of file
+ private static final Logger log = LoggerFactory.getLogger(DummyTransactionStorage.class);
+
+
+ public class DummyDbEntry {
+ public DummyDbEntry(final String key, final Object value) {
+ this.obj = value;
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(final String key) {
+ this.key = key;
+ }
+
+ public Object getObj() {
+ return obj;
+ }
+
+ public void setObj(final Object obj) {
+ this.obj = obj;
+ }
+
+ private String key;
+ private Object obj;
+ }
+
+ private final ArrayList<DummyDbEntry> ds = new ArrayList<>();
+
+
+
+ @Override
+ public boolean containsKey(final String key) {
+ // TODO Auto-generated method stub
+ final Iterator<DummyDbEntry> it = ds.iterator();
+ while (it.hasNext()) {
+ final DummyDbEntry t = it.next();
+ if (t.getKey().equals(key)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void put(final String key, final Object value, final int timeout) throws EaafException {
+ // TODO Auto-generated method stub
+ this.remove(key);
+ this.ds.add(new DummyDbEntry(key, value));
+
+ }
+
+ @Override
+ public Object get(final String key) throws EaafException {
+ // TODO Auto-generated method stub
+ final Iterator<DummyDbEntry> it = ds.iterator();
+ while (it.hasNext()) {
+ final DummyDbEntry t = it.next();
+ if (t.getKey().equals(key)) {
+ return t;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public <T> T get(final String key, final Class<T> clazz) throws EaafException {
+
+ final DummyDbEntry o = (DummyDbEntry) get(key);
+ if (o == null) {
+ return null;
+ }
+ try {
+ @SuppressWarnings("unchecked")
+ final T test = (clazz.cast(o.getObj()));
+ return test;
+
+ } catch (final Exception e) {
+ log.warn("Sessioninformation Cast-Exception by using Artifact=" + key);
+ throw new EaafException("Sessioninformation Cast-Exception");
+
+ }
+ }
+
+ @Override
+ public <T> T get(final String key, final Class<T> clazz, final long dataTimeOut)
+ throws EaafException {
+ // TODO Auto-generated method stub
+ return get(key, clazz);
+ }
+
+ @Override
+ public void changeKey(final String oldKey, final String newKey, final Object value)
+ throws EaafException {
+ this.remove(oldKey);
+ this.put(newKey, value, -1);
+
+ }
+
+ @Override
+ public void remove(final String key) {
+ final Iterator<DummyDbEntry> it = ds.iterator();
+ while (it.hasNext()) {
+ final DummyDbEntry t = it.next();
+ if (t.getKey().equals(key)) {
+ this.ds.remove(t);
+ return;
+ }
+ }
+
+ }
+
+ @Override
+ public List<String> clean(final Date now, final long dataTimeOut) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getRaw(final String key) throws EaafException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void putRaw(final String key, final Object element) throws EaafException {
+ // TODO Auto-generated method stub
+
+ }
+
+ // @Override
+ // public Object getAssertionStore(String key) throwsEAAFException {
+ // // TODO Auto-generated method stub
+ // return null;
+ // }
+ //
+ // @Override
+ // public void putAssertionStore(Object element) throws EAAFException {
+ // // TODO Auto-generated method stub
+ //
+ // }
+
+
+}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/ExpressionContextAdapter.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/ExpressionContextAdapter.java
index 9a05f905..c00cc628 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/ExpressionContextAdapter.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/ExpressionContextAdapter.java
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test;
@@ -31,48 +24,45 @@ import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext;
/**
* Adapter class for {@link ExpressionEvaluationContext}. Intended to be used for testing purposes.
- *
+ *
* @author tknall
- *
+ *
*/
public class ExpressionContextAdapter implements ExpressionEvaluationContext {
-
- private static final long serialVersionUID = 1L;
- private Map<String, Serializable> ctxData = Collections.synchronizedMap(new HashMap<String, Serializable>());
+ private static final long serialVersionUID = 1L;
+
+ private final Map<String, Serializable> ctxData =
+ Collections.synchronizedMap(new HashMap<String, Serializable>());
- /**
- * Returns a certain {@link Serializable} object associated with a certain {@code key}.
- *
- * @param key
- * The key.
- * @return The object or {@code null} if no object was found stored with that key or if a {@code null} value was
- * stored.
- */
- Serializable get(String key) {
- return ctxData.get(key);
- }
+ /**
+ * Returns a certain {@link Serializable} object associated with a certain {@code key}.
+ *
+ * @param key The key.
+ * @return The object or {@code null} if no object was found stored with that key or if a
+ * {@code null} value was stored.
+ */
+ Serializable get(final String key) {
+ return ctxData.get(key);
+ }
- /**
- * Stores a {@link Serializable} with a certain {@code key}.
- *
- * @param key
- * The key.
- * @param object
- * The object.
- */
- void put(String key, Serializable object) {
- ctxData.put(key, object);
- }
+ /**
+ * Stores a {@link Serializable} with a certain {@code key}.
+ *
+ * @param key The key.
+ * @param object The object.
+ */
+ void put(final String key, final Serializable object) {
+ ctxData.put(key, object);
+ }
- @Override
- public Map<String, Serializable> getCtx() {
- return Collections.unmodifiableMap(ctxData);
- }
+ @Override
+ public Map<String, Serializable> getCtx() {
+ return Collections.unmodifiableMap(ctxData);
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SimplePojo.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SimplePojo.java
index fa6a9f10..28dc57b4 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SimplePojo.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SimplePojo.java
@@ -1,67 +1,60 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test;
import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator;
/**
* A dummy pojo used to test {@link ExpressionEvaluator} with Spring EL referencing Spring beans.
- *
+ *
* @author tknall
- *
+ *
*/
public class SimplePojo {
- private Boolean booleanValue;
- private String stringValue;
- private Integer integerValue;
+ private Boolean booleanValue;
+ private String stringValue;
+ private Integer integerValue;
- public Boolean getBooleanValue() {
- return booleanValue;
- }
+ public Boolean getBooleanValue() {
+ return booleanValue;
+ }
- public void setBooleanValue(Boolean booleanValue) {
- this.booleanValue = booleanValue;
- }
+ public void setBooleanValue(final Boolean booleanValue) {
+ this.booleanValue = booleanValue;
+ }
- public String getStringValue() {
- return stringValue;
- }
+ public String getStringValue() {
+ return stringValue;
+ }
- public void setStringValue(String stringValue) {
- this.stringValue = stringValue;
- }
+ public void setStringValue(final String stringValue) {
+ this.stringValue = stringValue;
+ }
- public Integer getIntegerValue() {
- return integerValue;
- }
+ public Integer getIntegerValue() {
+ return integerValue;
+ }
- public void setIntegerValue(Integer integerValue) {
- this.integerValue = integerValue;
- }
+ public void setIntegerValue(final Integer integerValue) {
+ this.integerValue = integerValue;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionAwareProcessEngineTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionAwareProcessEngineTest.java
index 67675ff9..1d139b5e 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionAwareProcessEngineTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionAwareProcessEngineTest.java
@@ -1,47 +1,30 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test;
import static at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState.NOT_STARTED;
import static at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState.SUSPENDED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-
import java.io.IOException;
import java.io.InputStream;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;
import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
@@ -50,128 +33,132 @@ import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
import at.gv.egiz.eaaf.core.impl.idp.process.ProcessEngineImpl;
import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance;
import at.gv.egiz.eaaf.core.impl.idp.process.spring.SpringExpressionEvaluator;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
- * Tests the process engine using processes based on Spring EL referencing the process context and further Spring beans.
- *
+ * Tests the process engine using processes based on Spring EL referencing the process context and
+ * further Spring beans.
+ *
* @author tknall
- *
+ *
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml")
public class SpringExpressionAwareProcessEngineTest {
- @Autowired private static ProcessEngine pe;
- @Autowired private ApplicationContext applicationContext;
-
- private boolean isInitialized = false;
-
- @Before
- public void init() throws IOException, ProcessDefinitionParserException {
-
- if (!isInitialized) {
-
- if (pe == null) {
- pe = applicationContext.getBean("processEngine", ProcessEngine.class);
-
- }
-
- ((ProcessEngineImpl) pe).setTransitionConditionExpressionEvaluator(new SpringExpressionEvaluator());
- try (InputStream in = SpringExpressionAwareProcessEngineTest.class.getResourceAsStream("/process/spring/test/SampleProcessDefinitionWithExpression1.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(in);
- }
- try (InputStream in = SpringExpressionAwareProcessEngineTest.class.getResourceAsStream("/process/spring/test/SampleProcessDefinitionForSAML1Authentication.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(in);
- }
-
- //initHibernateForTesting();
- }
- }
-
- private static void initHibernateForTesting() throws IOException{
-
-// InputStream in = SpringExpressionAwareProcessEngineTest.class.getResourceAsStream("/at/gv/egovernment/moa/id/process/hibernate.configuration.test.properties");
-// Properties props = new Properties();
-// props.load(in);
-//
-// try {
-// //ConfigurationDBUtils.initHibernate(props);
-// Configuration config = new Configuration();
-// config.addProperties(props);
-// //config.addAnnotatedClass(ProcessInstanceStore.class);
-// config.addAnnotatedClass(AssertionStore.class);
-// //MOASessionDBUtils.initHibernate(config, props);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
- }
-
-
- @Test
- public void testSampleProcessDefinitionWithExpression1() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- TestRequestImpl req = new TestRequestImpl();
-
- String piId = pe.createProcessInstance("SampleProcessWithExpression1");
- ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
-
- // start process
- req.setProcessInstanceID(piId);
- pe.start(req);
-
- //processInstance should be removed when it ends
- try {
- pi = pe.getProcessInstance(piId);
- throw new ProcessExecutionException("ProcessInstance should be removed already, but it was found.");
- //assertEquals(ENDED, pi.getState());
-
- } catch (IllegalArgumentException e) {
- // do nothing because processInstance should be already removed
-
- }
- }
-
- @Test
- public void testSampleProcessDefinitionForSAML1Authentication() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- TestRequestImpl req = new TestRequestImpl();
-
- String piId = pe.createProcessInstance("SampleProcessDefinitionForSAML1Authentication");
- ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
- // start process
- req.setProcessInstanceID(piId);
- pe.start(req);
- pi = pe.getProcessInstance(piId);
- assertEquals(SUSPENDED, pi.getState());
-
- ExecutionContext ec = pi.getExecutionContext();
- assertNotNull(ec);
- System.out.println(ec.keySet());
-
- assertNotNull(ec.get("bkuURL"));
- assertNotNull(ec.get("IdentityLink"));
- assertNotNull(ec.get("isIdentityLinkValidated"));
- assertNotNull(ec.get("SignedAuthBlock"));
- assertNotNull(ec.get("isSignedAuthBlockValidated"));
- assertNotNull(ec.get("SAML1Assertion"));
-
- pe.signal(req);
- try {
- pi = pe.getProcessInstance(piId);
- throw new ProcessExecutionException("ProcessInstance should be removed already, but it was found.");
- //assertEquals(ENDED, pi.getState());
-
- } catch (IllegalArgumentException e) {
- // do nothing because processInstance should be already removed
-
- }
-
-
-
- }
+ @Autowired
+ private static ProcessEngine pe;
+ @Autowired
+ private ApplicationContext applicationContext;
+
+ private final boolean isInitialized = false;
+
+ /**
+ * jUnit test set-up.
+ *
+ * @throws IOException in case of an error
+ * @throws ProcessDefinitionParserException in case of an error
+ */
+ @Before
+ public void init() throws IOException, ProcessDefinitionParserException {
+
+ if (!isInitialized) {
+
+ if (pe == null) {
+ pe = applicationContext.getBean("processEngine", ProcessEngine.class);
+
+ }
+
+ ((ProcessEngineImpl) pe)
+ .setTransitionConditionExpressionEvaluator(new SpringExpressionEvaluator());
+ try (InputStream in = SpringExpressionAwareProcessEngineTest.class
+ .getResourceAsStream("/process/spring/test/SampleProcessDefinitionWithExpression1.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(in);
+ }
+ try (InputStream in = SpringExpressionAwareProcessEngineTest.class.getResourceAsStream(
+ "/process/spring/test/SampleProcessDefinitionForSAML1Authentication.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(in);
+ }
+
+ // initHibernateForTesting();
+ }
+ }
+
+ @Test
+ public void testSampleProcessDefinitionWithExpression1()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl req = new TestRequestImpl();
+
+ final String piId = pe.createProcessInstance("SampleProcessWithExpression1");
+ ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+
+ // start process
+ req.setProcessInstanceID(piId);
+ pe.start(req);
+
+ // processInstance should be removed when it ends
+ try {
+ pi = pe.getProcessInstance(piId);
+ throw new ProcessExecutionException(
+ "ProcessInstance should be removed already, but it was found.");
+ // assertEquals(ENDED, pi.getState());
+
+ } catch (final IllegalArgumentException e) {
+ // do nothing because processInstance should be already removed
+
+ }
+ }
+
+ @Test
+ public void testSampleProcessDefinitionForSaml1Authentication()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl req = new TestRequestImpl();
+
+ final String piId = pe.createProcessInstance("SampleProcessDefinitionForSAML1Authentication");
+ ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+ // start process
+ req.setProcessInstanceID(piId);
+ pe.start(req);
+ pi = pe.getProcessInstance(piId);
+ assertEquals(SUSPENDED, pi.getState());
+
+ final ExecutionContext ec = pi.getExecutionContext();
+ assertNotNull(ec);
+ System.out.println(ec.keySet());
+
+ assertNotNull(ec.get("bkuURL"));
+ assertNotNull(ec.get("IdentityLink"));
+ assertNotNull(ec.get("isIdentityLinkValidated"));
+ assertNotNull(ec.get("SignedAuthBlock"));
+ assertNotNull(ec.get("isSignedAuthBlockValidated"));
+ assertNotNull(ec.get("SAML1Assertion"));
+
+ pe.signal(req);
+ try {
+ pi = pe.getProcessInstance(piId);
+ throw new ProcessExecutionException(
+ "ProcessInstance should be removed already, but it was found.");
+ // assertEquals(ENDED, pi.getState());
+
+ } catch (final IllegalArgumentException e) {
+ // do nothing because processInstance should be already removed
+
+ }
+
+
+
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionEvaluatorTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionEvaluatorTest.java
index bde24824..5697365e 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionEvaluatorTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/SpringExpressionEvaluatorTest.java
@@ -1,34 +1,27 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
+import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -36,45 +29,44 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator;
-
/**
- * Tests the {@link ExpressionEvaluator} using a Spring EL based implementation capable of dereferencing Spring beans.
- *
+ * Tests the {@link ExpressionEvaluator} using a Spring EL based implementation capable of
+ * dereferencing Spring beans.
+ *
* @author tknall
- *
+ *
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/process/spring/test/SpringExpressionEvaluatorTest-context.xml")
public class SpringExpressionEvaluatorTest {
- private ExpressionContextAdapter ctx;
+ private ExpressionContextAdapter ctx;
- @Autowired
- private ExpressionEvaluator expressionEvaluator;
+ @Autowired
+ private ExpressionEvaluator expressionEvaluator;
- @Before
- public void prepareTest() {
- ctx = new ExpressionContextAdapter();
- }
+ @Before
+ public void prepareTest() {
+ ctx = new ExpressionContextAdapter();
+ }
- @Test
- public void testEvaluateSimpleExpression() {
- assertTrue(expressionEvaluator.evaluate(ctx, "'true'"));
- }
+ @Test
+ public void testEvaluateSimpleExpression() {
+ assertTrue(expressionEvaluator.evaluate(ctx, "'true'"));
+ }
- @Test
- public void testEvaluateExpressionWithCtx() {
- ctx.put("myProperty", false);
- assertFalse(expressionEvaluator.evaluate(ctx, "ctx['myProperty']"));
- }
+ @Test
+ public void testEvaluateExpressionWithCtx() {
+ ctx.put("myProperty", false);
+ assertFalse(expressionEvaluator.evaluate(ctx, "ctx['myProperty']"));
+ }
-// @Test
- public void testEvaluateExpressionWithBeanReference() {
- assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.booleanValue"));
- assertTrue(expressionEvaluator.evaluate(ctx, "'HelloWorld'.equals(@simplePojo.stringValue)"));
- assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.integerValue == 42"));
- assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.stringValue.length() == 10"));
- }
+ @Test
+ public void testEvaluateExpressionWithBeanReference() {
+ assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.booleanValue"));
+ assertTrue(expressionEvaluator.evaluate(ctx, "'HelloWorld'.equals(@simplePojo.stringValue)"));
+ assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.integerValue == 42"));
+ assertTrue(expressionEvaluator.evaluate(ctx, "@simplePojo.stringValue.length() == 10"));
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSAML1AssertionTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSAML1AssertionTask.java
deleted file mode 100644
index 9caba080..00000000
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSAML1AssertionTask.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Objects;
-
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-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.process.Task;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-
-/**
- * A dummy task simulating the creation of a SAML1 assertion.
- * <p>
- * Requires context data:
- * <ul>
- * <li>{@code IdentityLink}</li>
- * <li>{@code isIdentityLinkValidated}</li>
- * <li>{@code SignedAuthBlock}</li>
- * <li>{@code isSignedAuthBlockValidated}</li>
- * </ul>
- * </p>
- * <p>
- * Enriches context data with:
- * <ul>
- * <li>{@code SAML1Assertion}</li>
- * </ul>
- * </p>
- *
- * @author tknall
- *
- */
-@Service("CreateSAML1AssertionTask")
-public class CreateSAML1AssertionTask implements Task {
-
- private Logger log = LoggerFactory.getLogger(getClass());
-
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
- Objects.requireNonNull(executionContext.get("IdentityLink"));
- assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
- Objects.requireNonNull(executionContext.get("SignedAuthBlock"));
- assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isSignedAuthBlockValidated"))));
-
- log.debug("Using IdentityLink and signed auth block in order to create SAML1 assertion.");
-
- try (InputStream in = getClass().getResourceAsStream("/process/spring/test/task/SAML1Assertion.xml")) {
- executionContext.put("SAML1Assertion", IOUtils.toString(in, "UTF-8"));
- } catch (IOException e) {
- throw new TaskExecutionException(null, "", e);
- }
-
- return null;
- }
-
-}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSaml1AssertionTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSaml1AssertionTask.java
new file mode 100644
index 00000000..c699f093
--- /dev/null
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/CreateSaml1AssertionTask.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
+package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
+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.process.Task;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * A dummy task simulating the creation of a SAML1 assertion.
+ * <p>
+ * Requires context data:
+ * <ul>
+ * <li>{@code IdentityLink}</li>
+ * <li>{@code isIdentityLinkValidated}</li>
+ * <li>{@code SignedAuthBlock}</li>
+ * <li>{@code isSignedAuthBlockValidated}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Enriches context data with:
+ * <ul>
+ * <li>{@code SAML1Assertion}</li>
+ * </ul>
+ * </p>
+ *
+ * @author tknall
+ *
+ */
+@Service("CreateSAML1AssertionTask")
+public class CreateSaml1AssertionTask implements Task {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext)
+ throws TaskExecutionException {
+ Objects.requireNonNull(executionContext.get("IdentityLink"));
+ assert (Boolean.TRUE
+ .equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
+ Objects.requireNonNull(executionContext.get("SignedAuthBlock"));
+ assert (Boolean.TRUE
+ .equals(Objects.requireNonNull(executionContext.get("isSignedAuthBlockValidated"))));
+
+ log.debug("Using IdentityLink and signed auth block in order to create SAML1 assertion.");
+
+ try (InputStream in =
+ getClass().getResourceAsStream("/process/spring/test/task/SAML1Assertion.xml")) {
+ executionContext.put("SAML1Assertion", IOUtils.toString(in, "UTF-8"));
+ } catch (final IOException e) {
+ throw new TaskExecutionException(null, "", e);
+ }
+
+ return null;
+ }
+
+}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/GetIdentityLinkTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/GetIdentityLinkTask.java
index e6f12d1e..93fcf6db 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/GetIdentityLinkTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/GetIdentityLinkTask.java
@@ -1,44 +1,35 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
-
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
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.process.Task;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
/**
* A dummy task simulating the retrieval of an IdentityLink.
@@ -56,29 +47,31 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
* <li>{@code IdentityLink}</li>
* </ul>
* </p>
- *
+ *
* @author tknall
- *
+ *
*/
@Service("GetIdentityLinkTask")
-public class GetIdentityLinkTask implements Task {
+public class GetIdentityLinkTask implements Task {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext)
+ throws TaskExecutionException {
+ Objects.requireNonNull(executionContext.get("bkuURL"));
- private Logger log = LoggerFactory.getLogger(getClass());
+ log.debug("Using bkuURL in order to retrieve IdentityLink.");
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
- Objects.requireNonNull(executionContext.get("bkuURL"));
+ try (InputStream in = getClass()
+ .getResourceAsStream("/process/spring/test/task/IdentityLink_Max_Mustermann.xml")) {
+ executionContext.put("IdentityLink", IOUtils.toString(in, "UTF-8"));
- log.debug("Using bkuURL in order to retrieve IdentityLink.");
+ } catch (final IOException e) {
+ throw new TaskExecutionException(null, "", e);
+ }
- try (InputStream in = getClass().getResourceAsStream("/process/spring/test/task/IdentityLink_Max_Mustermann.xml")) {
- executionContext.put("IdentityLink", IOUtils.toString(in, "UTF-8"));
-
- } catch (IOException e) {
- throw new TaskExecutionException(null, "", e);
- }
-
- return null;
- }
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBKUTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBKUTask.java
deleted file mode 100644
index 4cff97c6..00000000
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBKUTask.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-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.process.Task;
-
-/**
- * A dummy task simulating a bku selection.
- * <p/>
- * Asynchonous
- * <p>
- * Enriches context data with:
- * <ul>
- * <li>{@code bkuURL}</li>
- * </ul>
- * </p>
- *
- * @author tknall
- *
- */
-@Service("SelectBKUTask")
-public class SelectBKUTask implements Task {
-
- private Logger log = LoggerFactory.getLogger(getClass());
-
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) {
- log.debug("Providing BKU selection.");
- executionContext.put("bkuURL", "https://127.0.0.1:3496/https-security-layer-request");
- return null;
- }
-
-}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBkuTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBkuTask.java
new file mode 100644
index 00000000..a6e2ac2c
--- /dev/null
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SelectBkuTask.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
+package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
+
+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.process.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * A dummy task simulating a bku selection.
+ * <p/>
+ * Asynchonous
+ * <p>
+ * Enriches context data with:
+ * <ul>
+ * <li>{@code bkuURL}</li>
+ * </ul>
+ * </p>
+ *
+ * @author tknall
+ *
+ */
+@Service("SelectBKUTask")
+public class SelectBkuTask implements Task {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext) {
+ log.debug("Providing BKU selection.");
+ executionContext.put("bkuURL", "https://127.0.0.1:3496/https-security-layer-request");
+ return null;
+ }
+
+}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
index a2203676..41beefc8 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
@@ -1,44 +1,35 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
-
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
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.process.Task;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
/**
* A dummy task simulating the signature of an auth block.
@@ -58,29 +49,32 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
* <li>{@code SignedAuthBlock}</li>
* </ul>
* </p>
- *
+ *
* @author tknall
- *
+ *
*/
@Service("SignAuthBlockTask")
-public class SignAuthBlockTask implements Task {
+public class SignAuthBlockTask implements Task {
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
- private Logger log = LoggerFactory.getLogger(getClass());
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext)
+ throws TaskExecutionException {
+ Objects.requireNonNull(executionContext.get("IdentityLink"));
+ assert (Boolean.TRUE
+ .equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
+ Objects.requireNonNull(executionContext.get("bkuURL"));
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
- Objects.requireNonNull(executionContext.get("IdentityLink"));
- assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
- Objects.requireNonNull(executionContext.get("bkuURL"));
+ log.debug("Using validated IdentityLink and bkuURL in order to sign auth block.");
+ try (InputStream in =
+ getClass().getResourceAsStream("/process/spring/test/task/SignedAuthBlock.xml")) {
+ executionContext.put("SignedAuthBlock", IOUtils.toString(in, "UTF-8"));
+ } catch (final IOException e) {
+ throw new TaskExecutionException(null, "", e);
- log.debug("Using validated IdentityLink and bkuURL in order to sign auth block.");
- try (InputStream in = getClass().getResourceAsStream("/process/spring/test/task/SignedAuthBlock.xml")) {
- executionContext.put("SignedAuthBlock", IOUtils.toString(in, "UTF-8"));
- } catch (IOException e) {
- throw new TaskExecutionException(null, "", e);
-
- }
- return null;
- }
+ }
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateIdentityLinkTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateIdentityLinkTask.java
index 7a1ba734..1a2cf5ee 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateIdentityLinkTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateIdentityLinkTask.java
@@ -1,40 +1,31 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
import java.util.Objects;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
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.process.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
/**
* Dummy task simulating the validation of an IdentityLink.
@@ -50,23 +41,23 @@ import at.gv.egiz.eaaf.core.api.idp.process.Task;
* <li>{@code isIdentityLinkValidated}</li>
* </ul>
* </p>
- *
- * @author tknall
- *
+ *
+ * @author tknall
+ *
*/
@Service("ValidateIdentityLinkTask")
public class ValidateIdentityLinkTask implements Task {
- private Logger log = LoggerFactory.getLogger(getClass());
+ private final Logger log = LoggerFactory.getLogger(getClass());
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) {
- Objects.requireNonNull(executionContext.get("IdentityLink"));
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext) {
+ Objects.requireNonNull(executionContext.get("IdentityLink"));
- log.debug("Validating IdentityLink.");
+ log.debug("Validating IdentityLink.");
- executionContext.put("isIdentityLinkValidated", true);
- return null;
- }
+ executionContext.put("isIdentityLinkValidated", true);
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateSignedAuthBlockTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateSignedAuthBlockTask.java
index 1509033f..f07920cd 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateSignedAuthBlockTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/ValidateSignedAuthBlockTask.java
@@ -1,41 +1,32 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
import java.util.Objects;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
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.process.Task;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
/**
* A dummy task simulating the validation of an auth block.
@@ -53,25 +44,28 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
* <li>{@code isSignedAuthBlockValidated}</li>
* </ul>
* </p>
- *
+ *
* @author tknall
- *
+ *
*/
@Service("ValidateSignedAuthBlockTask")
public class ValidateSignedAuthBlockTask implements Task {
- private Logger log = LoggerFactory.getLogger(getClass());
+ private final Logger log = LoggerFactory.getLogger(getClass());
- @Override
- public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
- Objects.requireNonNull(executionContext.get("IdentityLink"));
- assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
- Objects.requireNonNull(executionContext.get("SignedAuthBlock"));
+ @Override
+ public IRequest execute(final IRequest penReq, final ExecutionContext executionContext)
+ throws TaskExecutionException {
+ Objects.requireNonNull(executionContext.get("IdentityLink"));
+ assert (Boolean.TRUE
+ .equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
+ Objects.requireNonNull(executionContext.get("SignedAuthBlock"));
- log.debug("Using validated IdentityLink and signed auth block in order to validate signed auth block.");
+ log.debug(
+ "Using validated IdentityLink and signed auth block in order to validate signed auth block.");
- executionContext.put("isSignedAuthBlockValidated", true);
- return null;
- }
+ executionContext.put("isSignedAuthBlockValidated", true);
+ return null;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/BooleanStringExpressionEvaluator.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/BooleanStringExpressionEvaluator.java
index 517e7ce7..aa079f86 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/BooleanStringExpressionEvaluator.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/BooleanStringExpressionEvaluator.java
@@ -1,50 +1,42 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.test;
import java.util.Objects;
-
-import org.apache.commons.lang3.BooleanUtils;
-
import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext;
import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator;
+import org.apache.commons.lang3.BooleanUtils;
/**
- * Expression evaluator that guesses the boolean value from a String. Refer to {@link BooleanUtils#toBoolean(String)}
- * for further information.
- *
+ * Expression evaluator that guesses the boolean value from a String. Refer to
+ * {@link BooleanUtils#toBoolean(String)} for further information.
+ *
* @author tknall
- *
+ *
*/
public class BooleanStringExpressionEvaluator implements ExpressionEvaluator {
- @Override
- public boolean evaluate(ExpressionEvaluationContext expressionContext, String expression) {
- return BooleanUtils.toBoolean(Objects.requireNonNull(expression, "Expression must not be null."));
- }
+ @Override
+ public boolean evaluate(final ExpressionEvaluationContext expressionContext, final String expression) {
+ return BooleanUtils
+ .toBoolean(Objects.requireNonNull(expression, "Expression must not be null."));
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HalloWeltTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HalloWeltTask.java
index 743a61da..40892476 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HalloWeltTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HalloWeltTask.java
@@ -1,50 +1,42 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.test;
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
-import org.springframework.stereotype.Service;
+package at.gv.egiz.eaaf.core.impl.idp.process.test;
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.process.Task;
+import org.springframework.stereotype.Service;
/**
* Simple task that just outputs a "Hallo World" text to the console.
- *
+ *
* @author tknall
- *
+ *
*/
@Service("HalloWeltTask")
public class HalloWeltTask implements Task {
-
- @Override
- public IRequest execute(IRequest pendingReq, ExecutionContext executionContext) {
- System.out.println("Hallo Welt");
- return pendingReq;
- }
+
+ @Override
+ public IRequest execute(final IRequest pendingReq, final ExecutionContext executionContext) {
+ System.out.println("Hallo Welt");
+ return pendingReq;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HelloWorldTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HelloWorldTask.java
index c6da16b4..ce49e33d 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HelloWorldTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/HelloWorldTask.java
@@ -1,50 +1,42 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.test;
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
-import org.springframework.stereotype.Service;
+package at.gv.egiz.eaaf.core.impl.idp.process.test;
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.process.Task;
+import org.springframework.stereotype.Service;
/**
* Simple task that just outputs a "Hello World" text to the console.
- *
+ *
* @author tknall
- *
+ *
*/
@Service("HelloWorldTask")
public class HelloWorldTask implements Task {
-
- @Override
- public IRequest execute(IRequest pendingReq, ExecutionContext executionContext) {
- System.out.println("Hello World");
- return pendingReq;
- }
+
+ @Override
+ public IRequest execute(final IRequest pendingReq, final ExecutionContext executionContext) {
+ System.out.println("Hello World");
+ return pendingReq;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessDefinitionParserTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessDefinitionParserTest.java
index 90c8ce6f..2238ad09 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessDefinitionParserTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessDefinitionParserTest.java
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.test;
import static org.junit.Assert.assertEquals;
@@ -31,12 +24,8 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.io.InputStream;
-
-import org.junit.Test;
-
import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;
import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
import at.gv.egiz.eaaf.core.impl.idp.process.model.EndEvent;
@@ -45,119 +34,132 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode;
import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent;
import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo;
import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition;
+import org.junit.Test;
public class ProcessDefinitionParserTest {
-
- @Test(expected = ProcessDefinitionParserException.class)
- public void testParseInvalidProcessDefinition_MultipleStartEvents() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("InvalidProcessDefinition_MultipleStartEvents.xml")) {
- new ProcessDefinitionParser().parse(in);
- }
- }
-
- @Test(expected = ProcessDefinitionParserException.class)
- public void testParseInvalidProcessDefinition_TransitionLoop() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("InvalidProcessDefinition_TransitionLoop.xml")) {
- new ProcessDefinitionParser().parse(in);
- }
- }
-
- @Test(expected = ProcessDefinitionParserException.class)
- public void testParseInvalidProcessDefinition_TransitionStartsFromEndEvent() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("InvalidProcessDefinition_TransitionStartsFromEndEvent.xml")) {
- new ProcessDefinitionParser().parse(in);
- }
- }
-
- @Test(expected = ProcessDefinitionParserException.class)
- public void testParseInvalidProcessDefinition_TransitionRefsTransition() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("InvalidProcessDefinition_TransitionRefsTransition.xml")) {
- new ProcessDefinitionParser().parse(in);
- }
- }
-
- @Test(expected = ProcessDefinitionParserException.class)
- public void testParseInvalidProcessDefinition_NoStartEvents() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("InvalidProcessDefinition_NoStartEvents.xml")) {
- new ProcessDefinitionParser().parse(in);
- }
- }
-
- @Test
- public void testParseSampleProcessDefinition() throws IOException, ProcessDefinitionParserException {
- try (InputStream in = getClass().getResourceAsStream("/process/test/SampleProcessDefinition1.xml")) {
-
- ProcessDefinitionParser parser = new ProcessDefinitionParser();
- ProcessDefinition pd = parser.parse(in);
-
- assertNotNull(pd);
- assertEquals("SampleProcess1", pd.getId());
-
- // first assert tasks then transitions
- // start event
- StartEvent startEvent = pd.getStartEvent();
- assertNotNull(startEvent);
- assertEquals("start", startEvent.getId());
- assertEquals(startEvent, pd.getProcessNode("start"));
- // task1
- ProcessNode processNode = pd.getProcessNode("task1");
- assertNotNull(processNode);
- assertTrue(processNode instanceof TaskInfo);
- TaskInfo task1 = (TaskInfo) processNode;
- assertEquals("task1", task1.getId());
- assertFalse(task1.isAsync());
- // task2
- processNode = pd.getProcessNode("task2");
- assertNotNull(processNode);
- assertTrue(processNode instanceof TaskInfo);
- TaskInfo task2 = (TaskInfo) processNode;
- assertEquals("task2", task2.getId());
- assertTrue(task2.isAsync());
- // end event
- processNode = pd.getProcessNode("end");
- assertNotNull(processNode);
- assertTrue(processNode instanceof EndEvent);
- EndEvent endEvent = (EndEvent) processNode;
- assertEquals("end", endEvent.getId());
-
- // assert transitions
- // start event
- assertNotNull(startEvent.getIncomingTransitions());
- assertTrue(startEvent.getIncomingTransitions().isEmpty());
- assertNotNull(startEvent.getOutgoingTransitions());
- assertEquals(1, startEvent.getOutgoingTransitions().size());
- // transition from start to task1
- Transition startToTask1 = startEvent.getOutgoingTransitions().get(0);
- assertEquals("fromStart", startToTask1.getId());
- assertEquals(startEvent, startToTask1.getFrom());
- assertEquals(task1, startToTask1.getTo());
- assertEquals("true", startToTask1.getConditionExpression());
- // task1
- assertNotNull(task1.getIncomingTransitions());
- assertEquals(1, task1.getIncomingTransitions().size());
- assertEquals(startToTask1, task1.getIncomingTransitions().get(0));
- assertNotNull(task1.getOutgoingTransitions());
- assertEquals(1, task1.getOutgoingTransitions().size());
- // transition from task1 to task2
- Transition task1ToTask2 = task1.getOutgoingTransitions().get(0);
- assertNull(task1ToTask2.getId());
- assertEquals(task1, task1ToTask2.getFrom());
- assertEquals(task2, task1ToTask2.getTo());
- assertNull(task1ToTask2.getConditionExpression());
- // task2
- assertNotNull(task2.getIncomingTransitions());
- assertEquals(1, task2.getIncomingTransitions().size());
- assertEquals(task1ToTask2, task2.getIncomingTransitions().get(0));
- assertNotNull(task2.getOutgoingTransitions());
- assertEquals(1, task2.getOutgoingTransitions().size());
- // transition from task2 to end
- Transition task2ToEnd = task2.getOutgoingTransitions().get(0);
- assertNull(task2ToEnd.getId());
- assertEquals(task2, task2ToEnd.getFrom());
- assertEquals(endEvent, task2ToEnd.getTo());
- assertNull(task2ToEnd.getConditionExpression());
-
- }
- }
+
+ @Test(expected = ProcessDefinitionParserException.class)
+ public void testParseInvalidProcessDefinition_MultipleStartEvents()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in =
+ getClass().getResourceAsStream("InvalidProcessDefinition_MultipleStartEvents.xml")) {
+ new ProcessDefinitionParser().parse(in);
+ }
+ }
+
+ @Test(expected = ProcessDefinitionParserException.class)
+ public void testParseInvalidProcessDefinition_TransitionLoop()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in =
+ getClass().getResourceAsStream("InvalidProcessDefinition_TransitionLoop.xml")) {
+ new ProcessDefinitionParser().parse(in);
+ }
+ }
+
+ @Test(expected = ProcessDefinitionParserException.class)
+ public void testParseInvalidProcessDefinition_TransitionStartsFromEndEvent()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in = getClass()
+ .getResourceAsStream("InvalidProcessDefinition_TransitionStartsFromEndEvent.xml")) {
+ new ProcessDefinitionParser().parse(in);
+ }
+ }
+
+ @Test(expected = ProcessDefinitionParserException.class)
+ public void testParseInvalidProcessDefinition_TransitionRefsTransition()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in =
+ getClass().getResourceAsStream("InvalidProcessDefinition_TransitionRefsTransition.xml")) {
+ new ProcessDefinitionParser().parse(in);
+ }
+ }
+
+ @Test(expected = ProcessDefinitionParserException.class)
+ public void testParseInvalidProcessDefinition_NoStartEvents()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in =
+ getClass().getResourceAsStream("InvalidProcessDefinition_NoStartEvents.xml")) {
+ new ProcessDefinitionParser().parse(in);
+ }
+ }
+
+ @Test
+ public void testParseSampleProcessDefinition()
+ throws IOException, ProcessDefinitionParserException {
+ try (InputStream in =
+ getClass().getResourceAsStream("/process/test/SampleProcessDefinition1.xml")) {
+
+ final ProcessDefinitionParser parser = new ProcessDefinitionParser();
+ final ProcessDefinition pd = parser.parse(in);
+
+ assertNotNull(pd);
+ assertEquals("SampleProcess1", pd.getId());
+
+ // first assert tasks then transitions
+ // start event
+ final StartEvent startEvent = pd.getStartEvent();
+ assertNotNull(startEvent);
+ assertEquals("start", startEvent.getId());
+ assertEquals(startEvent, pd.getProcessNode("start"));
+ // task1
+ ProcessNode processNode = pd.getProcessNode("task1");
+ assertNotNull(processNode);
+ assertTrue(processNode instanceof TaskInfo);
+ final TaskInfo task1 = (TaskInfo) processNode;
+ assertEquals("task1", task1.getId());
+ assertFalse(task1.isAsync());
+ // task2
+ processNode = pd.getProcessNode("task2");
+ assertNotNull(processNode);
+ assertTrue(processNode instanceof TaskInfo);
+ final TaskInfo task2 = (TaskInfo) processNode;
+ assertEquals("task2", task2.getId());
+ assertTrue(task2.isAsync());
+ // end event
+ processNode = pd.getProcessNode("end");
+ assertNotNull(processNode);
+ assertTrue(processNode instanceof EndEvent);
+ final EndEvent endEvent = (EndEvent) processNode;
+ assertEquals("end", endEvent.getId());
+
+ // assert transitions
+ // start event
+ assertNotNull(startEvent.getIncomingTransitions());
+ assertTrue(startEvent.getIncomingTransitions().isEmpty());
+ assertNotNull(startEvent.getOutgoingTransitions());
+ assertEquals(1, startEvent.getOutgoingTransitions().size());
+ // transition from start to task1
+ final Transition startToTask1 = startEvent.getOutgoingTransitions().get(0);
+ assertEquals("fromStart", startToTask1.getId());
+ assertEquals(startEvent, startToTask1.getFrom());
+ assertEquals(task1, startToTask1.getTo());
+ assertEquals("true", startToTask1.getConditionExpression());
+ // task1
+ assertNotNull(task1.getIncomingTransitions());
+ assertEquals(1, task1.getIncomingTransitions().size());
+ assertEquals(startToTask1, task1.getIncomingTransitions().get(0));
+ assertNotNull(task1.getOutgoingTransitions());
+ assertEquals(1, task1.getOutgoingTransitions().size());
+ // transition from task1 to task2
+ final Transition task1ToTask2 = task1.getOutgoingTransitions().get(0);
+ assertNull(task1ToTask2.getId());
+ assertEquals(task1, task1ToTask2.getFrom());
+ assertEquals(task2, task1ToTask2.getTo());
+ assertNull(task1ToTask2.getConditionExpression());
+ // task2
+ assertNotNull(task2.getIncomingTransitions());
+ assertEquals(1, task2.getIncomingTransitions().size());
+ assertEquals(task1ToTask2, task2.getIncomingTransitions().get(0));
+ assertNotNull(task2.getOutgoingTransitions());
+ assertEquals(1, task2.getOutgoingTransitions().size());
+ // transition from task2 to end
+ final Transition task2ToEnd = task2.getOutgoingTransitions().get(0);
+ assertNull(task2ToEnd.getId());
+ assertEquals(task2, task2ToEnd.getFrom());
+ assertEquals(endEvent, task2ToEnd.getTo());
+ assertNull(task2ToEnd.getConditionExpression());
+
+ }
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessEngineTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessEngineTest.java
index dc45534e..9e8ce781 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessEngineTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ProcessEngineTest.java
@@ -1,38 +1,37 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.process.test;
import static at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState.NOT_STARTED;
import static at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState.SUSPENDED;
import static org.junit.Assert.assertEquals;
-
import java.io.IOException;
import java.io.InputStream;
-
+import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;
+import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessEngineImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -43,184 +42,199 @@ import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;
-import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessEngineImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance;
-
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml")
public class ProcessEngineTest {
-
- @Autowired private static ProcessEngine pe;
-
- @Autowired private ApplicationContext applicationContext;
-
- private boolean isInitialized = false;
-
- @Before
- public void init() throws IOException, ProcessDefinitionParserException {
-
- if (!isInitialized) {
- final ProcessDefinitionParser pdp = new ProcessDefinitionParser();
-
- if (pe == null) {
- pe = applicationContext.getBean("processEngine", ProcessEngine.class);
-
- }
-
- ((ProcessEngineImpl) pe).setTransitionConditionExpressionEvaluator(new BooleanStringExpressionEvaluator());
- try (InputStream in = ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition1.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
- }
- try (InputStream in = ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition2.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
- }
-
- try (InputStream in = ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition4.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
- }
-
- try (InputStream in = ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition5.xml")) {
- ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
- }
-
- //initHibernateForTesting();
- isInitialized = true;
- }
- }
-
- @Test
- public void wrongProcessDefinition() throws IOException {
- try (InputStream in = ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition3.xml")) {
- try {
- ((ProcessEngineImpl) pe).registerProcessDefinition(in);
- Assert.fail();
-
- } catch (final ProcessDefinitionParserException e) {
- Assert.assertTrue(e.getMessage().contains("Post-validation find an error in process definition"));
- }
- }
-
- }
-
- @Test
- public void testSampleProcess1() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- final TestRequestImpl testReq = new TestRequestImpl();
-
- final String piId = pe.createProcessInstance("SampleProcess1");
- ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
- // start process
- testReq.setProcessInstanceID(piId);
- pe.start(testReq);
- pi = pe.getProcessInstance(piId);
- assertEquals(SUSPENDED, pi.getState());
-
- System.out.println("Do something asynchronously");
- testReq.setProcessInstanceID(piId);
- pe.signal(testReq);
- try {
- pi = pe.getProcessInstance(piId);
- throw new ProcessExecutionException("ProcessInstance should be removed already, but it was found.");
- //assertEquals(ENDED, pi.getState());
-
- } catch (final IllegalArgumentException e) {
- // do nothing because processInstance should be already removed
-
- }
- }
-
- @Test
- public void testSampleProcess2() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- final TestRequestImpl testReq = new TestRequestImpl();
-
- final String piId = pe.createProcessInstance("SampleProcess2");
- ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
- // start process
- testReq.setProcessInstanceID(piId);
- pe.start(testReq);
- pi = pe.getProcessInstance(piId);
- assertEquals(SUSPENDED, pi.getState());
-
- System.out.println("Do something asynchronously");
- testReq.setProcessInstanceID(piId);
- pe.signal(testReq);
- try {
- pi = pe.getProcessInstance(piId);
- throw new ProcessExecutionException("ProcessInstance should be removed already, but it was found.");
- //assertEquals(ENDED, pi.getState());
-
- } catch (final IllegalArgumentException e) {
- // do nothing because processInstance should be already removed
-
- }
-
- }
-
- @Test
- public void testSampleProcess4() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- final TestRequestImpl testReq = new TestRequestImpl();
- testReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(5));
-
- final String piId = pe.createProcessInstance("SampleProcess4");
- final ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
- // start process
- testReq.setProcessInstanceID(piId);
- try {
- pe.start(testReq);
- Assert.fail("Task exception not handled");
-
- } catch (final ProcessExecutionException e1) {
- org.springframework.util.Assert.isInstanceOf(TaskExecutionException.class, e1.getCause(), "No TaskExecutionException");
- Assert.assertEquals("Wrong error-msg", "jUnit Test", e1.getCause().getMessage());
- Assert.assertEquals("Wrong pendingReqId", testReq.getPendingRequestId(), ((TaskExecutionException) e1.getCause()).getPendingRequestID());
- org.springframework.util.Assert.isInstanceOf(RuntimeException.class, e1.getCause().getCause(), "Wrong Exception in TaskExecutionException");
- }
-
-
- }
-
- @Test
- public void testSampleProcess5() throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
-
- final TestRequestImpl testReq = new TestRequestImpl();
-
- final String piId = pe.createProcessInstance("SampleProcess5");
- ProcessInstance pi = pe.getProcessInstance(piId);
- assertEquals(NOT_STARTED, pi.getState());
-
- // start process
- testReq.setProcessInstanceID(piId);
- pe.start(testReq);
-
- try {
- pi = pe.getProcessInstance(piId);
-
- } catch (final IllegalArgumentException e) {
- Assert.assertTrue("wrong error-msg", e.getMessage().contains("does not/no longer exist."));
- Assert.assertTrue("wrong process-instance-id", e.getMessage().contains(piId));
-
- }
-
-
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testProcessInstanceDoesNotExist() {
- pe.getProcessInstance("does not exist");
- }
+
+ @Autowired
+ private static ProcessEngine pe;
+
+ @Autowired
+ private ApplicationContext applicationContext;
+
+ private boolean isInitialized = false;
+
+ /**
+ * jUnit test set-up.
+ *
+ * @throws IOException in case of an error
+ * @throws ProcessDefinitionParserException in case of an error
+ */
+ @Before
+ public void init() throws IOException, ProcessDefinitionParserException {
+
+ if (!isInitialized) {
+ final ProcessDefinitionParser pdp = new ProcessDefinitionParser();
+
+ if (pe == null) {
+ pe = applicationContext.getBean("processEngine", ProcessEngine.class);
+
+ }
+
+ ((ProcessEngineImpl) pe)
+ .setTransitionConditionExpressionEvaluator(new BooleanStringExpressionEvaluator());
+ try (InputStream in = ProcessEngineTest.class
+ .getResourceAsStream("/process/test/SampleProcessDefinition1.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
+ }
+ try (InputStream in = ProcessEngineTest.class
+ .getResourceAsStream("/process/test/SampleProcessDefinition2.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
+ }
+
+ try (InputStream in = ProcessEngineTest.class
+ .getResourceAsStream("/process/test/SampleProcessDefinition4.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
+ }
+
+ try (InputStream in = ProcessEngineTest.class
+ .getResourceAsStream("/process/test/SampleProcessDefinition5.xml")) {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(pdp.parse(in));
+ }
+
+ // initHibernateForTesting();
+ isInitialized = true;
+ }
+ }
+
+ @Test
+ public void wrongProcessDefinition() throws IOException {
+ try (InputStream in =
+ ProcessEngineTest.class.getResourceAsStream("/process/test/SampleProcessDefinition3.xml")) {
+ try {
+ ((ProcessEngineImpl) pe).registerProcessDefinition(in);
+ Assert.fail();
+
+ } catch (final ProcessDefinitionParserException e) {
+ Assert.assertTrue(
+ e.getMessage().contains("Post-validation find an error in process definition"));
+ }
+ }
+
+ }
+
+ @Test
+ public void testSampleProcess1()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl testReq = new TestRequestImpl();
+
+ final String piId = pe.createProcessInstance("SampleProcess1");
+ ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+ // start process
+ testReq.setProcessInstanceID(piId);
+ pe.start(testReq);
+ pi = pe.getProcessInstance(piId);
+ assertEquals(SUSPENDED, pi.getState());
+
+ System.out.println("Do something asynchronously");
+ testReq.setProcessInstanceID(piId);
+ pe.signal(testReq);
+ try {
+ pi = pe.getProcessInstance(piId);
+ throw new ProcessExecutionException(
+ "ProcessInstance should be removed already, but it was found.");
+ // assertEquals(ENDED, pi.getState());
+
+ } catch (final IllegalArgumentException e) {
+ // do nothing because processInstance should be already removed
+
+ }
+ }
+
+ @Test
+ public void testSampleProcess2()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl testReq = new TestRequestImpl();
+
+ final String piId = pe.createProcessInstance("SampleProcess2");
+ ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+ // start process
+ testReq.setProcessInstanceID(piId);
+ pe.start(testReq);
+ pi = pe.getProcessInstance(piId);
+ assertEquals(SUSPENDED, pi.getState());
+
+ System.out.println("Do something asynchronously");
+ testReq.setProcessInstanceID(piId);
+ pe.signal(testReq);
+ try {
+ pi = pe.getProcessInstance(piId);
+ throw new ProcessExecutionException(
+ "ProcessInstance should be removed already, but it was found.");
+ // assertEquals(ENDED, pi.getState());
+
+ } catch (final IllegalArgumentException e) {
+ // do nothing because processInstance should be already removed
+
+ }
+
+ }
+
+ @Test
+ public void testSampleProcess4()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl testReq = new TestRequestImpl();
+ testReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(5));
+
+ final String piId = pe.createProcessInstance("SampleProcess4");
+ final ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+ // start process
+ testReq.setProcessInstanceID(piId);
+ try {
+ pe.start(testReq);
+ Assert.fail("Task exception not handled");
+
+ } catch (final ProcessExecutionException e1) {
+ org.springframework.util.Assert.isInstanceOf(TaskExecutionException.class, e1.getCause(),
+ "No TaskExecutionException");
+ Assert.assertEquals("Wrong error-msg", "jUnit Test", e1.getCause().getMessage());
+ Assert.assertEquals("Wrong pendingReqId", testReq.getPendingRequestId(),
+ ((TaskExecutionException) e1.getCause()).getPendingRequestID());
+ org.springframework.util.Assert.isInstanceOf(RuntimeException.class, e1.getCause().getCause(),
+ "Wrong Exception in TaskExecutionException");
+ }
+
+
+ }
+
+ @Test
+ public void testSampleProcess5()
+ throws IOException, ProcessDefinitionParserException, ProcessExecutionException {
+
+ final TestRequestImpl testReq = new TestRequestImpl();
+
+ final String piId = pe.createProcessInstance("SampleProcess5");
+ ProcessInstance pi = pe.getProcessInstance(piId);
+ assertEquals(NOT_STARTED, pi.getState());
+
+ // start process
+ testReq.setProcessInstanceID(piId);
+ pe.start(testReq);
+
+ try {
+ pi = pe.getProcessInstance(piId);
+
+ } catch (final IllegalArgumentException e) {
+ Assert.assertTrue("wrong error-msg", e.getMessage().contains("does not/no longer exist."));
+ Assert.assertTrue("wrong process-instance-id", e.getMessage().contains(piId));
+
+ }
+
+
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testProcessInstanceDoesNotExist() {
+ pe.getProcessInstance("does not exist");
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/StopProcessFlagTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/StopProcessFlagTask.java
index 8cd76eaa..2ef58729 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/StopProcessFlagTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/StopProcessFlagTask.java
@@ -1,52 +1,44 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.test;
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
-import org.springframework.stereotype.Service;
+package at.gv.egiz.eaaf.core.impl.idp.process.test;
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.process.Task;
+import org.springframework.stereotype.Service;
/**
* Simple task that just outputs a "Hello World" text to the console.
- *
+ *
* @author tknall
- *
+ *
*/
@Service("HelloWorldTask")
public class StopProcessFlagTask implements Task {
-
- @Override
- public IRequest execute(IRequest pendingReq, ExecutionContext executionContext) {
- System.out.println("Stop process-flow dynamically from task");
- executionContext.setCanceleProcessFlag();
-
- return pendingReq;
- }
+
+ @Override
+ public IRequest execute(final IRequest pendingReq, final ExecutionContext executionContext) {
+ System.out.println("Stop process-flow dynamically from task");
+ executionContext.setCanceleProcessFlag();
+
+ return pendingReq;
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ThrowExceptionTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ThrowExceptionTask.java
index ecd139c8..639121d6 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ThrowExceptionTask.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/test/ThrowExceptionTask.java
@@ -1,52 +1,46 @@
-/*******************************************************************************
- * Copyright 2017 Graz University of Technology
- * EAAF-Core Components has been developed in a cooperation between EGIZ,
- * A-SIT Plus, A-SIT, and Graz University of Technology.
+/*
+ * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a
+ * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.
*
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European
+ * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
+ * compliance with the Licence. You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.process.test;
+ * Unless required by applicable law or agreed to in writing, software distributed under the Licence
+ * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text file for details on the
+ * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
+ * works that you distribute must include a readable copy of the "NOTICE" text file.
+*/
-import org.springframework.stereotype.Service;
+package at.gv.egiz.eaaf.core.impl.idp.process.test;
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.process.Task;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import org.springframework.stereotype.Service;
/**
* Simple task that just outputs a "Hello World" text to the console.
- *
+ *
* @author tknall
- *
+ *
*/
@Service("HelloWorldTask")
public class ThrowExceptionTask implements Task {
-
- @Override
- public IRequest execute(IRequest pendingReq, ExecutionContext executionContext) throws TaskExecutionException {
- System.out.println("Stop process-flow dynamically from task");
- throw new TaskExecutionException(pendingReq, "jUnit Test", new RuntimeException("jUnit test exception handling"));
-
- }
+
+ @Override
+ public IRequest execute(final IRequest pendingReq, final ExecutionContext executionContext)
+ throws TaskExecutionException {
+ System.out.println("Stop process-flow dynamically from task");
+ throw new TaskExecutionException(pendingReq, "jUnit Test",
+ new RuntimeException("jUnit test exception handling"));
+
+ }
}
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtilsTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtilsTest.java
index 9df11ed6..d5ce24c5 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtilsTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/utils/KeyValueUtilsTest.java
@@ -8,7 +8,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Assert;
import org.junit.Test;
@@ -18,430 +17,430 @@ import org.junit.runners.BlockJUnit4ClassRunner;
@RunWith(BlockJUnit4ClassRunner.class)
public class KeyValueUtilsTest {
- @Test
- public void getFirstChildTest_1() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(4);
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, prefix);
- Assert.assertEquals("First child not match", child, resut);
-
- }
-
- @Test
- public void getFirstChildTest_2() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, prefix);
- Assert.assertEquals("First child not match", child, resut);
-
- }
-
- @Test
- public void getFirstChildTest_3() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, key);
- Assert.assertNull("First child not null", resut);
-
- }
-
- @Test
- public void getFirstChildTest_4() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(
- RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER + key,
- key);
- Assert.assertNull("First child not null", resut);
-
- }
-
- @Test
- public void getFirstChildTest_5() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = child + KeyValueUtils.KEY_DELIMITER + prefix;
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, null);
- Assert.assertEquals("First child not match", child, resut);
-
- }
-
- @Test
- public void getFirstChildTest_6() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
- final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, key);
- Assert.assertNull("First child not null", resut);
-
- }
-
- @Test
- public void getPrefixFromKey_1() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
- final String resut = KeyValueUtils.getPrefixFromKey(key, child);
- Assert.assertEquals("Prefix not match", prefix, resut);
-
- }
-
- @Test
- public void getPrefixFromKey_2() {
- final String child = RandomStringUtils.randomAlphabetic(2);
- final String resut = KeyValueUtils.getPrefixFromKey(null, child);
- Assert.assertNull("Prefix not null", resut);
-
- }
-
- @Test
- public void getPrefixFromKey_3() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String key = prefix + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(4);
- final String resut = KeyValueUtils.getPrefixFromKey(key, RandomStringUtils.randomAlphabetic(5));
- Assert.assertNull("Prefix not null", resut);
-
- }
-
- @Test
- public void getPrefixFromKey_4() {
- final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String child = KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(2);
- final String key = prefix + child;
- final String resut = KeyValueUtils.getPrefixFromKey(key, child);
- Assert.assertEquals("Prefix not match", prefix, resut);
-
- }
-
- @Test
- public void getPrefixFromKey_5() {
- final String key = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String resut = KeyValueUtils.getPrefixFromKey(key, null);
- Assert.assertNull("Prefix not null", resut);
-
- }
-
- @Test
- public void getRemovePrefixesFromKeys_1() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final Map<String, String> testMap = generateTestMap(testPrefix , 5, 5);
-
- final Map<String, String> result = KeyValueUtils.removePrefixFromKeys(testMap, testPrefix);
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- Assert.assertEquals("Result size not match", 5, result.size());
- final Iterator<Entry<String, String>> it = result.entrySet().iterator();
- while(it.hasNext()) {
- final Entry<String, String> next = it.next();
- Assert.assertNotNull("Key is null", next.getKey());
- Assert.assertNotNull("Value is null", next.getValue());
- Assert.assertTrue("Key is null", testMap.containsKey(testPrefix + "." + next.getKey()));
- Assert.assertEquals("Value not match", testMap.get(testPrefix + "." + next.getKey()), next.getValue());
-
- }
-
- }
-
- @Test
- public void getSubSetWithPrefixTest_1() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final Map<String, String> testMap = generateTestMap(testPrefix , 5, 5);
-
- final Map<String, String> result = KeyValueUtils.getSubSetWithPrefix(testMap, testPrefix);
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- Assert.assertEquals("Result size not match", 5, result.size());
- final Iterator<Entry<String, String>> it = result.entrySet().iterator();
- while(it.hasNext()) {
- final Entry<String, String> next = it.next();
- Assert.assertNotNull("Key is null", next.getKey());
- Assert.assertNotNull("Value is null", next.getValue());
- Assert.assertTrue("Key is null", testMap.containsKey(testPrefix + "." + next.getKey()));
- Assert.assertEquals("Value not match", testMap.get(testPrefix + "." + next.getKey()), next.getValue());
-
- }
-
- }
-
- @Test
- public void makeKeysAbsolutTest_1() {
- final String absTestPrefixtestPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String prefix = absTestPrefixtestPrefix + "." + RandomStringUtils.randomAlphabetic(4);
- final Map<String, String> testMap = generateTestMap(prefix, 5, 5);
- final Map<String, String> result = KeyValueUtils.makeKeysAbsolut(
- testMap,
- absTestPrefixtestPrefix,
- prefix);
-
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- Assert.assertEquals("Result size not match", 10, result.size());
- final Iterator<Entry<String, String>> it = result.entrySet().iterator();
- while(it.hasNext()) {
- final Entry<String, String> next = it.next();
- Assert.assertNotNull("Key is null", next.getKey());
- Assert.assertNotNull("Value is null", next.getValue());
- if (testMap.containsKey(next.getKey()))
- Assert.assertEquals("Value not match", testMap.get(next.getKey()), next.getValue());
- else {
- Assert.assertTrue("Key not found", testMap.containsKey(
- next.getKey().substring(
- absTestPrefixtestPrefix.length() + 1))
- );
- Assert.assertEquals("Value not match", testMap.get(
- next.getKey().substring(
- absTestPrefixtestPrefix.length() + 1)),
- next.getValue());
- }
- }
- }
-
- @Test
- public void getParentKeyTest_1() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final String result = KeyValueUtils.getParentKey(testPrefix + "." + RandomStringUtils.randomAlphabetic(5));
- Assert.assertNotNull("Result is null", result);
- Assert.assertEquals("Parent not match", testPrefix, result);
-
- }
-
- @Test
- public void getParentKeyTest_2() {
- final String result = KeyValueUtils.getParentKey(RandomStringUtils.randomAlphabetic(5));
- Assert.assertNotNull("Result is null", result);
- Assert.assertTrue("Result not empty", result.isEmpty());
-
- }
-
- @Test
- public void findNextFreeListCoutnerTest_1() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final Set<String> propList = new HashSet<String>();
- propList.add(testPrefix + ".1");
- propList.add(testPrefix + ".2");
- propList.add(testPrefix + ".0");
- propList.add(testPrefix + ".4");
- propList.add(testPrefix + ".3");
-
- final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
- Assert.assertEquals("Next free element not fount", 5, result);
-
- }
-
- @Test
- public void findNextFreeListCoutnerTest_2() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final Set<String> propList = new HashSet<String>();
- propList.add(testPrefix + ".1");
- propList.add(testPrefix + ".5");
- propList.add(testPrefix + ".0");
- propList.add(testPrefix + ".4");
- propList.add(testPrefix + ".3");
-
- final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
- Assert.assertEquals("Next free element not fount", 6, result);
-
- }
-
- @Test
- public void findNextFreeListCoutnerTest_3() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final Set<String> propList = new HashSet<String>();;
-
- final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
- Assert.assertEquals("Next free element not fount", 0, result);
-
- }
-
- @Test
- public void findNextFreeListCoutnerTest_4() {
- final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- final java.util.List<String> propList = new ArrayList<String>();
-
- final int result = KeyValueUtils.findNextFreeListCounter(propList.stream().toArray(String[]::new), testPrefix);
- Assert.assertEquals("Next free element not fount", 0, result);
-
- }
-
- @Test
- public void normalizeCSVValueStringTest_1() {
- final String csv1 = RandomStringUtils.randomAlphanumeric(5);
- final String csv2 = RandomStringUtils.randomAlphanumeric(5);
- final String csv3 = RandomStringUtils.randomAlphanumeric(5);
- final String csv4 = RandomStringUtils.randomAlphanumeric(5);
- final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
-
- final String result = KeyValueUtils.normalizeCSVValueString(testValue);
-
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- final String[] check = result.split(",");
- Assert.assertEquals("Result size wrong", 4, check.length);
- Assert.assertEquals("Result 1 wrong", csv1, check[0]);
- Assert.assertEquals("Result 2 wrong", csv2, check[1]);
- Assert.assertEquals("Result 3 wrong", csv3, check[2]);
- Assert.assertEquals("Result 4 wrong", csv4, check[3]);
-
- }
-
- @Test
- public void isCSVValueStringTest_1() {
- final String csv1 = RandomStringUtils.randomAlphanumeric(5);
- final String csv2 = RandomStringUtils.randomAlphanumeric(5);
- final String csv3 = RandomStringUtils.randomAlphanumeric(5);
- final String csv4 = RandomStringUtils.randomAlphanumeric(5);
- final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
- final boolean result = KeyValueUtils.isCSVValueString(testValue);
- Assert.assertTrue("CSV value not detected", result);
-
- }
-
- @Test
- public void isCSVValueStringTest_2() {
- final String csv1 = RandomStringUtils.randomAlphanumeric(5);
- final String testValue = " " + csv1 + " ,";
- final boolean result = KeyValueUtils.isCSVValueString(testValue);
- Assert.assertFalse("CSV value not detected", result);
-
- }
-
- @Test
- public void isCSVValueStringTest_3() {
- final String csv1 = RandomStringUtils.randomAlphanumeric(5);
- final String testValue = " " + csv1;
- final boolean result = KeyValueUtils.isCSVValueString(testValue);
- Assert.assertFalse("CSV value not detected", result);
-
- }
-
- @Test
- public void getListOfCSVValuesTest_1() {
- final String csv1 = RandomStringUtils.randomAlphanumeric(5);
- final String csv2 = RandomStringUtils.randomAlphanumeric(5);
- final String csv3 = RandomStringUtils.randomAlphanumeric(5);
- final String csv4 = RandomStringUtils.randomAlphanumeric(5);
- final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
-
- final List<String> result = KeyValueUtils.getListOfCSVValues(testValue);
-
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- Assert.assertEquals("Result size wrong", 4, result.size());
- Assert.assertEquals("Result 1 wrong", csv1, result.get(0));
- Assert.assertEquals("Result 2 wrong", csv2, result.get(1));
- Assert.assertEquals("Result 3 wrong", csv3, result.get(2));
- Assert.assertEquals("Result 4 wrong", csv4, result.get(3));
-
- }
-
- @Test
- public void convertListToMapTest_1() {
- final java.util.List<String> propList = new ArrayList<String>();
- final String prefix = RandomStringUtils.randomAlphabetic(4) + ".";
- final String key1 = RandomStringUtils.randomAlphabetic(5);
- final String value1 = RandomStringUtils.randomAlphanumeric(10);
- final String key2 = RandomStringUtils.randomAlphabetic(5);
- final String value2 = RandomStringUtils.randomAlphanumeric(10);
- final String key3 = RandomStringUtils.randomAlphabetic(5);
- final String value3 = RandomStringUtils.randomAlphanumeric(10);
- final String key4 = RandomStringUtils.randomAlphabetic(5);
- final String value4 = RandomStringUtils.randomAlphanumeric(10);
- final String key5 = RandomStringUtils.randomAlphabetic(5);
- final String value5 = RandomStringUtils.randomAlphanumeric(10);
- final String key6 = RandomStringUtils.randomAlphabetic(5);
- final String value6 = "="+RandomStringUtils.randomAlphanumeric(10);
-
- propList.add(prefix + key1 + "=" + value1);
- propList.add(prefix + key2 + "=" + value2);
- propList.add(prefix + key3 + "=" + value3);
- propList.add(prefix + key4 + "=" + value4);
- propList.add(prefix + key5 + "+" + value5);
- propList.add(prefix + key6 + "=" + value6);
-
- final Map<String, String> result = KeyValueUtils.convertListToMap(propList);
- Assert.assertNotNull("Result is null", result);
- Assert.assertFalse("Result is empty", result.isEmpty());
- Assert.assertEquals("Result size not match", 5, result.size());
-
- Assert.assertTrue("Key1 not found", result.containsKey(prefix+key1));
- Assert.assertEquals("Value1 not found", value1, result.get(prefix+key1));
- Assert.assertTrue("Key2 not found", result.containsKey(prefix+key2));
- Assert.assertEquals("Value2 not found", value2, result.get(prefix+key2));
- Assert.assertTrue("Key3 not found", result.containsKey(prefix+key3));
- Assert.assertEquals("Value3 not found", value3, result.get(prefix+key3));
- Assert.assertTrue("Key4 not found", result.containsKey(prefix+key4));
- Assert.assertEquals("Value4 not found", value4, result.get(prefix+key4));
-
- }
-
- @Test
- public void convertListToMapTest_2() {
- final java.util.List<String> propList = new ArrayList<String>();
-
- final Map<String, String> result = KeyValueUtils.convertListToMap(propList);
- Assert.assertNotNull("Result is null", result);
- Assert.assertTrue("Result is not empty", result.isEmpty());
-
- }
-
- private Map<String, String> generateTestMap(String testPrefix, int entriesWithPrefix, int entriesWithoutPrefix) {
- final Map<String, String> result = new HashMap<String, String>();
- for (int i=0; i<entriesWithPrefix; i++)
- result.put(
- testPrefix + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(5),
- RandomStringUtils.randomAlphabetic(5));
-
- final String key = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
- + RandomStringUtils.randomAlphabetic(5);
- for (int i=0; i<entriesWithoutPrefix; i++)
- result.put(
- key + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(5),
- RandomStringUtils.randomAlphabetic(5));
-
- return result;
-
- }
-
+ @Test
+ public void getFirstChildTest_1() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(4);
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, prefix);
+ Assert.assertEquals("First child not match", child, resut);
+
+ }
+
+ @Test
+ public void getFirstChildTest_2() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, prefix);
+ Assert.assertEquals("First child not match", child, resut);
+
+ }
+
+ @Test
+ public void getFirstChildTest_3() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, key);
+ Assert.assertNull("First child not null", resut);
+
+ }
+
+ @Test
+ public void getFirstChildTest_4() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(
+ RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER + key, key);
+ Assert.assertNull("First child not null", resut);
+
+ }
+
+ @Test
+ public void getFirstChildTest_5() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = child + KeyValueUtils.KEY_DELIMITER + prefix;
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, null);
+ Assert.assertEquals("First child not match", child, resut);
+
+ }
+
+ @Test
+ public void getFirstChildTest_6() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
+ final String resut = KeyValueUtils.getFirstChildAfterPrefix(key, key);
+ Assert.assertNull("First child not null", resut);
+
+ }
+
+ @Test
+ public void getPrefixFromKey_1() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + child;
+ final String resut = KeyValueUtils.getPrefixFromKey(key, child);
+ Assert.assertEquals("Prefix not match", prefix, resut);
+
+ }
+
+ @Test
+ public void getPrefixFromKey_2() {
+ final String child = RandomStringUtils.randomAlphabetic(2);
+ final String resut = KeyValueUtils.getPrefixFromKey(null, child);
+ Assert.assertNull("Prefix not null", resut);
+
+ }
+
+ @Test
+ public void getPrefixFromKey_3() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String key = prefix + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(4);
+ final String resut = KeyValueUtils.getPrefixFromKey(key, RandomStringUtils.randomAlphabetic(5));
+ Assert.assertNull("Prefix not null", resut);
+
+ }
+
+ @Test
+ public void getPrefixFromKey_4() {
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String child = KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(2);
+ final String key = prefix + child;
+ final String resut = KeyValueUtils.getPrefixFromKey(key, child);
+ Assert.assertEquals("Prefix not match", prefix, resut);
+
+ }
+
+ @Test
+ public void getPrefixFromKey_5() {
+ final String key = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String resut = KeyValueUtils.getPrefixFromKey(key, null);
+ Assert.assertNull("Prefix not null", resut);
+
+ }
+
+ @Test
+ public void getRemovePrefixesFromKeys_1() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final Map<String, String> testMap = generateTestMap(testPrefix, 5, 5);
+
+ final Map<String, String> result = KeyValueUtils.removePrefixFromKeys(testMap, testPrefix);
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ Assert.assertEquals("Result size not match", 5, result.size());
+ final Iterator<Entry<String, String>> it = result.entrySet().iterator();
+ while (it.hasNext()) {
+ final Entry<String, String> next = it.next();
+ Assert.assertNotNull("Key is null", next.getKey());
+ Assert.assertNotNull("Value is null", next.getValue());
+ Assert.assertTrue("Key is null", testMap.containsKey(testPrefix + "." + next.getKey()));
+ Assert.assertEquals("Value not match", testMap.get(testPrefix + "." + next.getKey()),
+ next.getValue());
+
+ }
+
+ }
+
+ @Test
+ public void getSubSetWithPrefixTest_1() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final Map<String, String> testMap = generateTestMap(testPrefix, 5, 5);
+
+ final Map<String, String> result = KeyValueUtils.getSubSetWithPrefix(testMap, testPrefix);
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ Assert.assertEquals("Result size not match", 5, result.size());
+ final Iterator<Entry<String, String>> it = result.entrySet().iterator();
+ while (it.hasNext()) {
+ final Entry<String, String> next = it.next();
+ Assert.assertNotNull("Key is null", next.getKey());
+ Assert.assertNotNull("Value is null", next.getValue());
+ Assert.assertTrue("Key is null", testMap.containsKey(testPrefix + "." + next.getKey()));
+ Assert.assertEquals("Value not match", testMap.get(testPrefix + "." + next.getKey()),
+ next.getValue());
+
+ }
+
+ }
+
+ @Test
+ public void makeKeysAbsolutTest_1() {
+ final String absTestPrefixtestPrefix = RandomStringUtils.randomAlphabetic(4)
+ + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(6)
+ + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(5);
+ final String prefix = absTestPrefixtestPrefix + "." + RandomStringUtils.randomAlphabetic(4);
+ final Map<String, String> testMap = generateTestMap(prefix, 5, 5);
+ final Map<String, String> result =
+ KeyValueUtils.makeKeysAbsolut(testMap, absTestPrefixtestPrefix, prefix);
+
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ Assert.assertEquals("Result size not match", 10, result.size());
+ final Iterator<Entry<String, String>> it = result.entrySet().iterator();
+ while (it.hasNext()) {
+ final Entry<String, String> next = it.next();
+ Assert.assertNotNull("Key is null", next.getKey());
+ Assert.assertNotNull("Value is null", next.getValue());
+ if (testMap.containsKey(next.getKey())) {
+ Assert.assertEquals("Value not match", testMap.get(next.getKey()), next.getValue());
+ } else {
+ Assert.assertTrue("Key not found",
+ testMap.containsKey(next.getKey().substring(absTestPrefixtestPrefix.length() + 1)));
+ Assert.assertEquals("Value not match",
+ testMap.get(next.getKey().substring(absTestPrefixtestPrefix.length() + 1)),
+ next.getValue());
+ }
+ }
+ }
+
+ @Test
+ public void getParentKeyTest_1() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final String result =
+ KeyValueUtils.getParentKey(testPrefix + "." + RandomStringUtils.randomAlphabetic(5));
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertEquals("Parent not match", testPrefix, result);
+
+ }
+
+ @Test
+ public void getParentKeyTest_2() {
+ final String result = KeyValueUtils.getParentKey(RandomStringUtils.randomAlphabetic(5));
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertTrue("Result not empty", result.isEmpty());
+
+ }
+
+ @Test
+ public void findNextFreeListCoutnerTest_1() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final Set<String> propList = new HashSet<>();
+ propList.add(testPrefix + ".1");
+ propList.add(testPrefix + ".2");
+ propList.add(testPrefix + ".0");
+ propList.add(testPrefix + ".4");
+ propList.add(testPrefix + ".3");
+
+ final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
+ Assert.assertEquals("Next free element not fount", 5, result);
+
+ }
+
+ @Test
+ public void findNextFreeListCoutnerTest_2() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final Set<String> propList = new HashSet<>();
+ propList.add(testPrefix + ".1");
+ propList.add(testPrefix + ".5");
+ propList.add(testPrefix + ".0");
+ propList.add(testPrefix + ".4");
+ propList.add(testPrefix + ".3");
+
+ final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
+ Assert.assertEquals("Next free element not fount", 6, result);
+
+ }
+
+ @Test
+ public void findNextFreeListCoutnerTest_3() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final Set<String> propList = new HashSet<>();
+
+ final int result = KeyValueUtils.findNextFreeListCounter(propList, testPrefix);
+ Assert.assertEquals("Next free element not fount", 0, result);
+
+ }
+
+ @Test
+ public void findNextFreeListCoutnerTest_4() {
+ final String testPrefix = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ final java.util.List<String> propList = new ArrayList<>();
+
+ final int result =
+ KeyValueUtils.findNextFreeListCounter(propList.stream().toArray(String[]::new), testPrefix);
+ Assert.assertEquals("Next free element not fount", 0, result);
+
+ }
+
+ @Test
+ public void normalizeCsvValueStringTest_1() {
+ final String csv1 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv2 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv3 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv4 = RandomStringUtils.randomAlphanumeric(5);
+ final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
+
+ final String result = KeyValueUtils.normalizeCsvValueString(testValue);
+
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ final String[] check = result.split(",");
+ Assert.assertEquals("Result size wrong", 4, check.length);
+ Assert.assertEquals("Result 1 wrong", csv1, check[0]);
+ Assert.assertEquals("Result 2 wrong", csv2, check[1]);
+ Assert.assertEquals("Result 3 wrong", csv3, check[2]);
+ Assert.assertEquals("Result 4 wrong", csv4, check[3]);
+
+ }
+
+ @Test
+ public void isCsvValueStringTest_1() {
+ final String csv1 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv2 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv3 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv4 = RandomStringUtils.randomAlphanumeric(5);
+ final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
+ final boolean result = KeyValueUtils.isCsvValueString(testValue);
+ Assert.assertTrue("CSV value not detected", result);
+
+ }
+
+ @Test
+ public void isCsvValueStringTest_2() {
+ final String csv1 = RandomStringUtils.randomAlphanumeric(5);
+ final String testValue = " " + csv1 + " ,";
+ final boolean result = KeyValueUtils.isCsvValueString(testValue);
+ Assert.assertFalse("CSV value not detected", result);
+
+ }
+
+ @Test
+ public void isCsvValueStringTest_3() {
+ final String csv1 = RandomStringUtils.randomAlphanumeric(5);
+ final String testValue = " " + csv1;
+ final boolean result = KeyValueUtils.isCsvValueString(testValue);
+ Assert.assertFalse("CSV value not detected", result);
+
+ }
+
+ @Test
+ public void getListOfCsvValuesTest_1() {
+ final String csv1 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv2 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv3 = RandomStringUtils.randomAlphanumeric(5);
+ final String csv4 = RandomStringUtils.randomAlphanumeric(5);
+ final String testValue = " " + csv1 + " ," + csv2 + "," + csv3 + "\n," + csv4 + " ";
+
+ final List<String> result = KeyValueUtils.getListOfCsvValues(testValue);
+
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ Assert.assertEquals("Result size wrong", 4, result.size());
+ Assert.assertEquals("Result 1 wrong", csv1, result.get(0));
+ Assert.assertEquals("Result 2 wrong", csv2, result.get(1));
+ Assert.assertEquals("Result 3 wrong", csv3, result.get(2));
+ Assert.assertEquals("Result 4 wrong", csv4, result.get(3));
+
+ }
+
+ @Test
+ public void convertListToMapTest_1() {
+ final java.util.List<String> propList = new ArrayList<>();
+ final String prefix = RandomStringUtils.randomAlphabetic(4) + ".";
+ final String key1 = RandomStringUtils.randomAlphabetic(5);
+ final String value1 = RandomStringUtils.randomAlphanumeric(10);
+ final String key2 = RandomStringUtils.randomAlphabetic(5);
+ final String value2 = RandomStringUtils.randomAlphanumeric(10);
+ final String key3 = RandomStringUtils.randomAlphabetic(5);
+ final String value3 = RandomStringUtils.randomAlphanumeric(10);
+ final String key4 = RandomStringUtils.randomAlphabetic(5);
+ final String value4 = RandomStringUtils.randomAlphanumeric(10);
+ final String key5 = RandomStringUtils.randomAlphabetic(5);
+ final String value5 = RandomStringUtils.randomAlphanumeric(10);
+ final String key6 = RandomStringUtils.randomAlphabetic(5);
+ final String value6 = "=" + RandomStringUtils.randomAlphanumeric(10);
+
+ propList.add(prefix + key1 + "=" + value1);
+ propList.add(prefix + key2 + "=" + value2);
+ propList.add(prefix + key3 + "=" + value3);
+ propList.add(prefix + key4 + "=" + value4);
+ propList.add(prefix + key5 + "+" + value5);
+ propList.add(prefix + key6 + "=" + value6);
+
+ final Map<String, String> result = KeyValueUtils.convertListToMap(propList);
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertFalse("Result is empty", result.isEmpty());
+ Assert.assertEquals("Result size not match", 5, result.size());
+
+ Assert.assertTrue("Key1 not found", result.containsKey(prefix + key1));
+ Assert.assertEquals("Value1 not found", value1, result.get(prefix + key1));
+ Assert.assertTrue("Key2 not found", result.containsKey(prefix + key2));
+ Assert.assertEquals("Value2 not found", value2, result.get(prefix + key2));
+ Assert.assertTrue("Key3 not found", result.containsKey(prefix + key3));
+ Assert.assertEquals("Value3 not found", value3, result.get(prefix + key3));
+ Assert.assertTrue("Key4 not found", result.containsKey(prefix + key4));
+ Assert.assertEquals("Value4 not found", value4, result.get(prefix + key4));
+
+ }
+
+ @Test
+ public void convertListToMapTest_2() {
+ final java.util.List<String> propList = new ArrayList<>();
+
+ final Map<String, String> result = KeyValueUtils.convertListToMap(propList);
+ Assert.assertNotNull("Result is null", result);
+ Assert.assertTrue("Result is not empty", result.isEmpty());
+
+ }
+
+ private Map<String, String> generateTestMap(final String testPrefix, final int entriesWithPrefix,
+ final int entriesWithoutPrefix) {
+ final Map<String, String> result = new HashMap<>();
+ for (int i = 0; i < entriesWithPrefix; i++) {
+ result.put(testPrefix + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(5),
+ RandomStringUtils.randomAlphabetic(5));
+ }
+
+ final String key = RandomStringUtils.randomAlphabetic(4) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(6) + KeyValueUtils.KEY_DELIMITER
+ + RandomStringUtils.randomAlphabetic(5);
+ for (int i = 0; i < entriesWithoutPrefix; i++) {
+ result.put(key + KeyValueUtils.KEY_DELIMITER + RandomStringUtils.randomAlphabetic(5),
+ RandomStringUtils.randomAlphabetic(5));
+ }
+
+ return result;
+
+ }
+
}
diff --git a/eaaf_core/src/test/resources/SpringTest-context_authManager.xml b/eaaf_core/src/test/resources/SpringTest-context_authManager.xml
index b8eef11f..9c94d4a7 100644
--- a/eaaf_core/src/test/resources/SpringTest-context_authManager.xml
+++ b/eaaf_core/src/test/resources/SpringTest-context_authManager.xml
@@ -1,47 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
-
- <bean id="TestAuthenticationDataBuilder"
- class="at.gv.egiz.eaaf.core.impl.idp.auth.TestAuthenticationDataBuilder"/>
-
- <bean id="dummyAuthManager"
- class="at.gv.egiz.eaaf.core.impl.idp.auth.DummyAuthManager" />
-
- <bean id="dummyRevisionLogger"
- class="at.gv.egiz.eaaf.core.impl.logging.DummyRevisionsLogger" />
-
- <bean id="DummyProtocolAuthService"
- class="at.gv.egiz.eaaf.core.impl.idp.module.test.DummyProtocolAuthService" />
-
- <bean id="DummyTransactionStorage"
- class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.DummyTransactionStorage" />
-
- <bean id="DummyStatusMessager"
- class="at.gv.egiz.eaaf.core.impl.logging.DummyStatusMessager" />
-
- <bean id="springElAwareExpressionEvaluator"
- class="at.gv.egiz.eaaf.core.impl.idp.process.spring.SpringExpressionEvaluator" />
-
- <bean id="processEngine"
- class="at.gv.egiz.eaaf.core.impl.idp.process.ProcessEngineImpl">
- <property name="transitionConditionExpressionEvaluator" ref="springElAwareExpressionEvaluator" />
- </bean>
-
- <bean id="ProcessInstanceStoreage"
- class="at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStoreDAOImpl"/>
-
- <bean id="RequestStorage"
- class="at.gv.egiz.eaaf.core.impl.idp.auth.RequestStorage"/>
-
- <bean id="simplePendingRequestIdGenerationStrategy"
- class="at.gv.egiz.eaaf.core.impl.utils.SimplePendingRequestIdGenerationStrategy" />
-
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+ <bean id="TestAuthenticationDataBuilder"
+ class="at.gv.egiz.eaaf.core.impl.idp.auth.TestAuthenticationDataBuilder" />
+
+ <bean id="dummyAuthManager"
+ class="at.gv.egiz.eaaf.core.impl.idp.auth.DummyAuthManager" />
+
+ <bean id="dummyRevisionLogger"
+ class="at.gv.egiz.eaaf.core.impl.logging.DummyRevisionsLogger" />
+
+ <bean id="DummyProtocolAuthService"
+ class="at.gv.egiz.eaaf.core.impl.idp.module.test.DummyProtocolAuthService" />
+
+ <bean id="DummyTransactionStorage"
+ class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.DummyTransactionStorage" />
+
+ <bean id="DummyStatusMessager"
+ class="at.gv.egiz.eaaf.core.impl.logging.DummyStatusMessager" />
+
+ <bean id="springElAwareExpressionEvaluator"
+ class="at.gv.egiz.eaaf.core.impl.idp.process.spring.SpringExpressionEvaluator" />
+
+ <bean id="processEngine"
+ class="at.gv.egiz.eaaf.core.impl.idp.process.ProcessEngineImpl">
+ <property name="transitionConditionExpressionEvaluator"
+ ref="springElAwareExpressionEvaluator" />
+ </bean>
+
+ <bean id="ProcessInstanceStoreage"
+ class="at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStoreDaoImpl" />
+
+ <bean id="RequestStorage"
+ class="at.gv.egiz.eaaf.core.impl.idp.auth.RequestStorage" />
+
+ <bean id="simplePendingRequestIdGenerationStrategy"
+ class="at.gv.egiz.eaaf.core.impl.utils.SimplePendingRequestIdGenerationStrategy" />
+
</beans>
diff --git a/eaaf_core/src/test/resources/SpringTest-context_eaaf_core.xml b/eaaf_core/src/test/resources/SpringTest-context_eaaf_core.xml
index 523e9fc7..77d70740 100644
--- a/eaaf_core/src/test/resources/SpringTest-context_eaaf_core.xml
+++ b/eaaf_core/src/test/resources/SpringTest-context_eaaf_core.xml
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:tx="http://www.springframework.org/schema/tx"
+ xmlns:aop="http://www.springframework.org/schema/aop"
+ xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
+
+ <bean id="TestAuthenticationDataBuilder"
+ class="at.gv.egiz.eaaf.core.impl.idp.auth.TestAuthenticationDataBuilder" />
+
+
+ <!-- Dummy test classes -->
+ <bean id="DummyConfig"
+ class="at.gv.egiz.eaaf.core.impl.idp.module.test.DummyConfiguration" />
- <bean id="TestAuthenticationDataBuilder"
- class="at.gv.egiz.eaaf.core.impl.idp.auth.TestAuthenticationDataBuilder"/>
-
-
- <!-- Dummy test classes -->
- <bean id="DummyConfig"
- class="at.gv.egiz.eaaf.core.impl.idp.module.test.DummyConfiguration"/>
-
</beans>
diff --git a/eaaf_core/src/test/resources/log4j.xml b/eaaf_core/src/test/resources/log4j.xml
index 90e3c763..83d8b703 100644
--- a/eaaf_core/src/test/resources/log4j.xml
+++ b/eaaf_core/src/test/resources/log4j.xml
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- -->
+<!-- -->
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n" />
- </layout>
- </appender>
+<log4j:configuration
+ xmlns:log4j="http://jakarta.apache.org/log4j/">
+ <appender name="consoleAppender"
+ class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} - %m%n" />
+ </layout>
+ </appender>
- <root>
- <priority value="info" />
- <appender-ref ref="consoleAppender" />
- </root>
+ <root>
+ <priority value="info" />
+ <appender-ref ref="consoleAppender" />
+ </root>
</log4j:configuration>
diff --git a/eaaf_core/src/test/resources/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml b/eaaf_core/src/test/resources/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml
index ebbd89e9..b84aad57 100644
--- a/eaaf_core/src/test/resources/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml
+++ b/eaaf_core/src/test/resources/process/spring/test/SpringExpressionAwareProcessEngineTest-context.xml
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -22,7 +20,7 @@
class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.DummyTransactionStorage"/>
<bean id="ProcessInstanceStoreage"
- class="at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStoreDAOImpl"/>
+ class="at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStoreDaoImpl"/>
<bean id="HelloWorldTask"
class="at.gv.egiz.eaaf.core.impl.idp.process.test.HelloWorldTask"/>
@@ -37,10 +35,10 @@
class="at.gv.egiz.eaaf.core.impl.idp.process.test.ThrowExceptionTask"/>
<bean id="SelectBKUTask"
- class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task.SelectBKUTask"/>
+ class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task.SelectBkuTask"/>
<bean id="CreateSAML1AssertionTask"
- class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task.CreateSAML1AssertionTask"/>
+ class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task.CreateSaml1AssertionTask"/>
<bean id="GetIdentityLinkTask"
class="at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task.GetIdentityLinkTask"/>