summaryrefslogtreecommitdiff
path: root/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java')
-rw-r--r--eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java158
1 files changed, 80 insertions, 78 deletions
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java
index db97f4ca..16c2079a 100644
--- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/auth/IdentityLinkTest.java
@@ -20,82 +20,84 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser
@RunWith(BlockJUnit4ClassRunner.class)
public class IdentityLinkTest {
-
- private IdentityLink idl = null;
-
- /**
- * jUnit test set-up.
- * @throws EaafParserException In case of an error
- * @throws UnsupportedEncodingException In case of an unsupported encoding
- */
- @Before
- public void testInit() throws EaafParserException, UnsupportedEncodingException {
- idl = (IdentityLink) new SimpleIdentityLinkAssertionParser(
- new ByteArrayInputStream(Base64Utils.decode(AuthenticationDataBuilderTest.DUMMY_IDL_2.getBytes("UTF-8")))).parseIdentityLink();
-
- }
-
- @Test
- public void checkElement() {
- Assert.assertNotNull("DateOfBirth", idl.getDateOfBirth());
- Assert.assertNotNull("FamilyName", idl.getFamilyName());
- Assert.assertNotNull("GivenNamae", idl.getGivenName());
- Assert.assertNotNull("baseIdType", idl.getIdentificationType());
- Assert.assertNotNull("baseid", idl.getIdentificationValue());
- Assert.assertNotNull("IssuerInstant", idl.getIssueInstant());
- Assert.assertNotNull("name", idl.getName());
- Assert.assertNotNull("prPerson", idl.getPrPerson());
- Assert.assertNotNull("Assertion element", idl.getSamlAssertion());
- Assert.assertNotNull("Assertion serialized", idl.getSerializedSamlAssertion());
- Assert.assertNotNull("Transform ref", idl.getDsigReferenceTransforms());
- Assert.assertEquals("Transform Size not match", 1, idl.getDsigReferenceTransforms().length);
-
- }
-
- @Test
- public void checkPubKeys() {
- PublicKey[] publicKey = new RSAPublicKey[2];
- publicKey[0] = generatePubKey();
- publicKey[1] = generatePubKey();
-
- idl.setPublicKey(publicKey );
-
- Assert.assertNotNull("PubKey", idl.getPublicKey());
- Assert.assertEquals("PubKeys not match", publicKey.length, idl.getPublicKey().length);
-
- }
-
- private PublicKey generatePubKey() {
- return new RSAPublicKey() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public BigInteger getModulus() {
- return new BigInteger(RandomStringUtils.randomNumeric(10));
- }
-
- @Override
- public String getFormat() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public byte[] getEncoded() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getAlgorithm() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BigInteger getPublicExponent() {
- return new BigInteger(RandomStringUtils.randomNumeric(2));
- }
- };
- }
+
+ private IdentityLink idl = null;
+
+ /**
+ * jUnit test set-up.
+ *
+ * @throws EaafParserException In case of an error
+ * @throws UnsupportedEncodingException In case of an unsupported encoding
+ */
+ @Before
+ public void testInit() throws EaafParserException, UnsupportedEncodingException {
+ idl = (IdentityLink) new SimpleIdentityLinkAssertionParser(
+ new ByteArrayInputStream(Base64Utils.decode(AuthenticationDataBuilderTest.DUMMY_IDL_2.getBytes(
+ "UTF-8")))).parseIdentityLink();
+
+ }
+
+ @Test
+ public void checkElement() {
+ Assert.assertNotNull("DateOfBirth", idl.getDateOfBirth());
+ Assert.assertNotNull("FamilyName", idl.getFamilyName());
+ Assert.assertNotNull("GivenNamae", idl.getGivenName());
+ Assert.assertNotNull("baseIdType", idl.getIdentificationType());
+ Assert.assertNotNull("baseid", idl.getIdentificationValue());
+ Assert.assertNotNull("IssuerInstant", idl.getIssueInstant());
+ Assert.assertNotNull("name", idl.getName());
+ Assert.assertNotNull("prPerson", idl.getPrPerson());
+ Assert.assertNotNull("Assertion element", idl.getSamlAssertion());
+ Assert.assertNotNull("Assertion serialized", idl.getSerializedSamlAssertion());
+ Assert.assertNotNull("Transform ref", idl.getDsigReferenceTransforms());
+ Assert.assertEquals("Transform Size not match", 1, idl.getDsigReferenceTransforms().length);
+
+ }
+
+ @Test
+ public void checkPubKeys() {
+ final PublicKey[] publicKey = new RSAPublicKey[2];
+ publicKey[0] = generatePubKey();
+ publicKey[1] = generatePubKey();
+
+ idl.setPublicKey(publicKey);
+
+ Assert.assertNotNull("PubKey", idl.getPublicKey());
+ Assert.assertEquals("PubKeys not match", publicKey.length, idl.getPublicKey().length);
+
+ }
+
+ private PublicKey generatePubKey() {
+ return new RSAPublicKey() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public BigInteger getModulus() {
+ return new BigInteger(RandomStringUtils.randomNumeric(10));
+ }
+
+ @Override
+ public String getFormat() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public byte[] getEncoded() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAlgorithm() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BigInteger getPublicExponent() {
+ return new BigInteger(RandomStringUtils.randomNumeric(2));
+ }
+ };
+ }
}