diff options
| author | Thomas <> | 2023-05-13 15:18:03 +0200 | 
|---|---|---|
| committer | Thomas <> | 2023-05-13 15:18:03 +0200 | 
| commit | 54f16e552a3d6c5579282de5c8d6a92395f6c049 (patch) | |
| tree | b01be728915391f1ed40cdf07fc6248fc3365f83 /eaaf_core/src/test/java/at | |
| parent | 77ce26202ad7f1c36c2c5c385a4388b96d6bad65 (diff) | |
| download | EAAF-Components-54f16e552a3d6c5579282de5c8d6a92395f6c049.tar.gz EAAF-Components-54f16e552a3d6c5579282de5c8d6a92395f6c049.tar.bz2 EAAF-Components-54f16e552a3d6c5579282de5c8d6a92395f6c049.zip | |
refact(core): remove double serialization in central error handling
Diffstat (limited to 'eaaf_core/src/test/java/at')
| -rw-r--r-- | eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java | 29 | 
1 files changed, 12 insertions, 17 deletions
| diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java index 4341d141..e165f84b 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/controller/ProtocolFinalizationControllerTest.java @@ -19,7 +19,6 @@ import org.springframework.mock.web.MockHttpServletRequest;  import org.springframework.mock.web.MockHttpServletResponse;  import org.springframework.test.context.ContextConfiguration;  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.SerializationUtils;  import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;  import at.gv.egiz.eaaf.core.api.data.EaafConstants; @@ -107,8 +106,7 @@ public class ProtocolFinalizationControllerTest {      protocolRequest.setSpConfig(new DummySpConfiguration(spConfig, config));      Throwable throwable = new EaafException("internal.00");      final ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); -    final byte[] serialized = SerializationUtils.serialize(exceptionContainer); -    storage.put(token, serialized, -1); +    storage.put(token, exceptionContainer, -1);      // perform test      controller.errorRedirect(httpReq, httpResp);     @@ -174,8 +172,7 @@ public class ProtocolFinalizationControllerTest {      protocolRequest.setSpConfig(new DummySpConfiguration(spConfig, config));      Throwable throwable = new EaafException("internal.00");      final ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); -    final byte[] serialized = SerializationUtils.serialize(exceptionContainer); -    storage.put(token, serialized, -1); +    storage.put(token, exceptionContainer, -1);      // perform test      controller.errorHandling(httpReq, httpResp);     @@ -218,8 +215,7 @@ public class ProtocolFinalizationControllerTest {      Throwable throwable = new EaafException("internal.00");      final ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); -    final byte[] serialized = SerializationUtils.serialize(exceptionContainer); -    storage.put(token, serialized, -1); +    storage.put(token, exceptionContainer, -1);      String secondErrorTicket = requestIdValidationStragegy.generateExternalPendingRequestId();      errorService.setErrorIdTokenForRedirect(secondErrorTicket); @@ -241,10 +237,10 @@ public class ProtocolFinalizationControllerTest {      assertEquals("wrong intErrorCode", "internal.00", params.get("errorCode"));      assertTrue("wrong extErrorCode", ((String) params.get("extErrorCode")).contains("internal.00")); -    byte[] secondErrorSerialized = storage.get( -        requestIdValidationStragegy.getPendingRequestIdWithOutChecks(secondErrorTicket), byte[].class); -    assertNotNull("Exception not removed from cache", secondErrorSerialized); -    ExceptionContainer secondError = (ExceptionContainer)  SerializationUtils.deserialize(secondErrorSerialized); +    ExceptionContainer secondError = storage.get( +        requestIdValidationStragegy.getPendingRequestIdWithOutChecks(secondErrorTicket), +        ExceptionContainer.class); +    assertNotNull("Exception not removed from cache", secondError);      assertEquals("wrong pengingReq", protocolRequest.getUniqueTransactionIdentifier(),           secondError.getPendingRequest().getUniqueTransactionIdentifier());      assertEquals("wrong exception", throwable.getMessage(), secondError.getExceptionThrown().getMessage()); @@ -274,8 +270,7 @@ public class ProtocolFinalizationControllerTest {      Throwable throwable = new EaafException("internal.00");      final ExceptionContainer exceptionContainer = new ExceptionContainer(protocolRequest, throwable); -    final byte[] serialized = SerializationUtils.serialize(exceptionContainer); -    storage.put(token, serialized, -1); +    storage.put(token, exceptionContainer, -1);      String secondErrorTicket = requestIdValidationStragegy.generateExternalPendingRequestId();      errorService.setErrorIdTokenForRedirect(secondErrorTicket); @@ -296,10 +291,10 @@ public class ProtocolFinalizationControllerTest {      assertEquals("wrong intErrorCode", "internal.00", params.get("errorCode"));      assertTrue("wrong extErrorCode", ((String) params.get("extErrorCode")).contains("internal.00")); -    byte[] secondErrorSerialized = storage.get( -        requestIdValidationStragegy.getPendingRequestIdWithOutChecks(secondErrorTicket), byte[].class); -    assertNotNull("Exception not removed from cache", secondErrorSerialized); -    ExceptionContainer secondError = (ExceptionContainer)  SerializationUtils.deserialize(secondErrorSerialized); +    ExceptionContainer secondError = storage.get( +        requestIdValidationStragegy.getPendingRequestIdWithOutChecks(secondErrorTicket), +        ExceptionContainer.class); +    assertNotNull("Exception not removed from cache", secondError);      assertEquals("wrong pengingReq", protocolRequest.getUniqueTransactionIdentifier(),           secondError.getPendingRequest().getUniqueTransactionIdentifier());      assertEquals("wrong exception", throwable.getMessage(), secondError.getExceptionThrown().getMessage()); | 
