SAML 2.0 artifact bits plus tests
[shibboleth/cpp-opensaml.git] / samltest / SAMLArtifactType0002Test.h
diff --git a/samltest/SAMLArtifactType0002Test.h b/samltest/SAMLArtifactType0002Test.h
new file mode 100644 (file)
index 0000000..8556105
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ *  Copyright 2001-2005 Internet2\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include "internal.h"\r
+#include <saml/saml1/core/SAMLArtifactType0002.h>\r
+\r
+using namespace opensaml::saml1p;\r
+using namespace opensaml;\r
+using namespace std;\r
+\r
+class SAMLArtifactType0002Test : public CxxTest::TestSuite\r
+{\r
+public:\r
+    string providerIdStr;\r
+\r
+    void setUp() {\r
+        providerIdStr = "https://idp.org/SAML";\r
+    }\r
+    \r
+    void testSAMLArtifactType0002(void) {\r
+        auto_ptr<SAMLArtifactType0002> artifact(new SAMLArtifactType0002(providerIdStr));\r
+        auto_ptr<SAMLArtifact> tempArtifact(SAMLArtifact::parse(artifact->encode().c_str()));\r
+        \r
+        TS_ASSERT_SAME_DATA(artifact->getSource().c_str(),tempArtifact->getSource().c_str(),artifact->getSource().length());\r
+        TS_ASSERT_EQUALS(artifact->getMessageHandle(),tempArtifact->getMessageHandle());\r
+\r
+        TS_ASSERT_THROWS(auto_ptr<SAMLArtifact> bogus1(new SAMLArtifactType0002(providerIdStr, artifact->getMessageHandle() + artifact->getMessageHandle())), ArtifactException);\r
+    }\r
+};\r