summaryrefslogtreecommitdiff
path: root/eaaf_core/src/test/java/at
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-02 10:54:00 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-12-02 10:54:00 +0100
commit95a76182ed4af47c10488bfda3ba7b4578ca411c (patch)
tree605507fead32acec7f6868a560c38f60a438afc1 /eaaf_core/src/test/java/at
parent1732a51b3c8477eec7482e6aa3335199883a4bb8 (diff)
downloadEAAF-Components-95a76182ed4af47c10488bfda3ba7b4578ca411c.tar.gz
EAAF-Components-95a76182ed4af47c10488bfda3ba7b4578ca411c.tar.bz2
EAAF-Components-95a76182ed4af47c10488bfda3ba7b4578ca411c.zip
add attribute-builder for piiTransactionId transfer
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/attributes/PiiTransactionIdAttributeBuilderTest.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/PiiTransactionIdAttributeBuilderTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/PiiTransactionIdAttributeBuilderTest.java
new file mode 100644
index 00000000..82ac0abf
--- /dev/null
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/attributes/PiiTransactionIdAttributeBuilderTest.java
@@ -0,0 +1,64 @@
+package at.gv.egiz.eaaf.core.impl.idp.auth.attributes;
+
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;
+import at.gv.egiz.eaaf.core.api.idp.IAuthData;
+import at.gv.egiz.eaaf.core.exceptions.AttributeBuilderException;
+import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData;
+import at.gv.egiz.eaaf.core.impl.idp.builder.attributes.PiiTransactionIdAttributeBuilder;
+import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
+
+/**
+ * Attribute builder to generate an attribute that holds the unique TransactionId for this process.
+ * <br>
+ * The attribute-value is read from {@link TransactionIdUtils} with method <code>getTransactionId()</code>
+ *
+ * @author tlenz
+ *
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/SpringTest-context_eaaf_core.xml")
+public class PiiTransactionIdAttributeBuilderTest extends AbstractAttributeBuilderTest {
+
+ private final IAttributeBuilder attrBuilder = new PiiTransactionIdAttributeBuilder();
+
+ @Test
+ public void attributeName() {
+ Assert.assertEquals("Wrong attribute name",
+ "urn:eidgvat:attributes.piiTransactionId", attrBuilder.getName());
+
+ }
+
+ @Test
+ public void checkEmptyAttribute() {
+ String value = attrBuilder.buildEmpty(gen);
+ Assert.assertNull("Attr. not null", value);
+
+ }
+
+ @Test
+ public void noPiiTransactionId() throws AttributeBuilderException, Exception {
+ String value = attrBuilder.build(spConfig, buildAuthData(), gen);
+ Assert.assertNull("Attr. not null", value);
+
+ }
+
+ @Test
+ public void withPiiTransactionId() throws AttributeBuilderException, Exception {
+ String piiTransId = UUID.randomUUID().toString();
+ IAuthData authData = buildAuthData();
+ ((AuthenticationData)authData).setGenericData("urn:eidgvat:attributes.piiTransactionId", piiTransId);
+
+ String value = attrBuilder.build(spConfig, authData, gen);
+ Assert.assertEquals("piiTransactionId", piiTransId, value);
+
+ }
+
+}