Author: anil.saldhana(a)jboss.com
Date: 2010-11-05 12:45:01 -0400 (Fri, 05 Nov 2010)
New Revision: 536
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAssertionParserTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAuthnRequestParserTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLResponseParserTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloRequestParserTestCase.java
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloResponseParserTestCase.java
Log:
validate writing with dom parsing
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAssertionParserTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAssertionParserTestCase.java 2010-11-05
15:50:37 UTC (rev 535)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAssertionParserTestCase.java 2010-11-05
16:45:01 UTC (rev 536)
@@ -24,6 +24,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
@@ -34,6 +36,7 @@
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLAssertionWriter;
import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
@@ -245,6 +248,12 @@
}
SAMLAssertionWriter writer = new SAMLAssertionWriter();
- writer.write(assertion, System.out );
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writer.write(assertion, baos );
+
+ System.out.println( new String( baos.toByteArray() ));
+
+ ByteArrayInputStream bis = new ByteArrayInputStream( baos.toByteArray() );
+ DocumentUtil.getDocument( bis ); //throws exceptions
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAuthnRequestParserTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAuthnRequestParserTestCase.java 2010-11-05
15:50:37 UTC (rev 535)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLAuthnRequestParserTestCase.java 2010-11-05
16:45:01 UTC (rev 536)
@@ -24,10 +24,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLRequestWriter;
import org.picketlink.identity.federation.saml.v2.protocol.AuthnRequestType;
@@ -67,7 +70,13 @@
assertEquals( Boolean.TRUE , nameIDPolicy.isAllowCreate() );
//Try out writing
- SAMLRequestWriter writer = new SAMLRequestWriter();
- writer.write(authnRequest, System.out );
+ SAMLRequestWriter writer = new SAMLRequestWriter();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writer.write( authnRequest, baos );
+
+ System.out.println( new String( baos.toByteArray() ));
+
+ ByteArrayInputStream bis = new ByteArrayInputStream( baos.toByteArray() );
+ DocumentUtil.getDocument( bis ); //throws exceptions
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLResponseParserTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLResponseParserTestCase.java 2010-11-05
15:50:37 UTC (rev 535)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLResponseParserTestCase.java 2010-11-05
16:45:01 UTC (rev 536)
@@ -24,6 +24,8 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
@@ -31,6 +33,7 @@
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLResponseWriter;
import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
@@ -98,8 +101,14 @@
assertEquals(
"urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport",
authnContextDeclRefJaxb.getValue() );
//Let us do some writing - currently only visual inspection. We will do proper
validation later.
- SAMLResponseWriter writer = new SAMLResponseWriter();
- writer.write(response, System.out );
+ SAMLResponseWriter writer = new SAMLResponseWriter();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writer.write(response, baos );
+
+ System.out.println( new String( baos.toByteArray() ));
+
+ ByteArrayInputStream bis = new ByteArrayInputStream( baos.toByteArray() );
+ DocumentUtil.getDocument( bis ); //throws exceptions
}
@Test
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloRequestParserTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloRequestParserTestCase.java 2010-11-05
15:50:37 UTC (rev 535)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloRequestParserTestCase.java 2010-11-05
16:45:01 UTC (rev 536)
@@ -24,10 +24,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLRequestWriter;
import org.picketlink.identity.federation.saml.v2.protocol.LogoutRequestType;
@@ -56,7 +59,13 @@
assertEquals( "http://localhost:8080/sales/",
lotRequest.getIssuer().getValue() );
//Try out writing
- SAMLRequestWriter writer = new SAMLRequestWriter();
- writer.write( lotRequest, System.out );
+ SAMLRequestWriter writer = new SAMLRequestWriter();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writer.write( lotRequest, baos );
+
+ System.out.println( new String( baos.toByteArray() ));
+
+ ByteArrayInputStream bis = new ByteArrayInputStream( baos.toByteArray() );
+ DocumentUtil.getDocument( bis ); //throws exceptions
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloResponseParserTestCase.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloResponseParserTestCase.java 2010-11-05
15:50:37 UTC (rev 535)
+++
federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/saml/SAMLSloResponseParserTestCase.java 2010-11-05
16:45:01 UTC (rev 536)
@@ -26,12 +26,15 @@
import static
org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLURIConstants.PROTOCOL_NSURI;
import static
org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants.LOGOUT_RESPONSE;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.xml.namespace.QName;
import org.junit.Test;
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
+import org.picketlink.identity.federation.core.saml.v2.util.DocumentUtil;
import org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil;
import org.picketlink.identity.federation.core.saml.v2.writers.SAMLResponseWriter;
import org.picketlink.identity.federation.saml.v2.protocol.StatusResponseType;
@@ -67,7 +70,13 @@
assertEquals( "urn:oasis:names:tc:SAML:2.0:status:Success",
status.getStatusCode().getStatusCode().getValue() );
//Let us do some writing - currently only visual inspection. We will do proper
validation later.
- SAMLResponseWriter writer = new SAMLResponseWriter();
- writer.write(response, new QName( PROTOCOL_NSURI.get(), LOGOUT_RESPONSE.get(),
"samlp"), System.out );
+ SAMLResponseWriter writer = new SAMLResponseWriter();ByteArrayOutputStream baos =
new ByteArrayOutputStream();
+ writer.write(response, new QName( PROTOCOL_NSURI.get(), LOGOUT_RESPONSE.get(),
"samlp"), baos );
+
+ System.out.println( new String( baos.toByteArray() ));
+
+ ByteArrayInputStream bis = new ByteArrayInputStream( baos.toByteArray() );
+ DocumentUtil.getDocument( bis ); //throws exceptions
+
}
}
\ No newline at end of file