Author: anil.saldhana(a)jboss.com
Date: 2009-01-07 17:07:09 -0500 (Wed, 07 Jan 2009)
New Revision: 206
Added:
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateResultUnitTestCase.java
Removed:
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateRequestUnitTest.java
Modified:
xmlkey/trunk/parent/pom.xml
xmlkey/trunk/xkms/pom.xml
Log:
unit test for LocateResult
Modified: xmlkey/trunk/parent/pom.xml
===================================================================
--- xmlkey/trunk/parent/pom.xml 2009-01-07 21:16:38 UTC (rev 205)
+++ xmlkey/trunk/parent/pom.xml 2009-01-07 22:07:09 UTC (rev 206)
@@ -101,6 +101,11 @@
<version>2.1.9</version>
</dependency>
<dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.9</version>
+ </dependency>
+ <dependency>
<groupId>apache-xmlsec</groupId>
<artifactId>xmlsec</artifactId>
<version>1.3.0</version>
Modified: xmlkey/trunk/xkms/pom.xml
===================================================================
--- xmlkey/trunk/xkms/pom.xml 2009-01-07 21:16:38 UTC (rev 205)
+++ xmlkey/trunk/xkms/pom.xml 2009-01-07 22:07:09 UTC (rev 206)
@@ -71,6 +71,11 @@
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
+ <groupId>sun-jaxb</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
Deleted:
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateRequestUnitTest.java
===================================================================
---
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateRequestUnitTest.java 2009-01-07
21:16:38 UTC (rev 205)
+++
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateRequestUnitTest.java 2009-01-07
22:07:09 UTC (rev 206)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.identity.xkms.v2.model;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.jboss.identity.xkms.v2.model.LocateRequestType;
-import org.jboss.identity.xkms.v2.model.ObjectFactory;
-import org.jboss.identity.xmlkey.common.JBossJAXBUtil;
-import org.junit.Test;
-
-/**
- * Unit Test the LocateRequest construct
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 7, 2009
- */
-public class LocateRequestUnitTest
-{
- String pkg = "org.jboss.identity.xkms.v2.model";
- String schema = "schema/v2/xkms.xsd";
-
- ObjectFactory objectFactory = new ObjectFactory();
-
- /**
- <?xml version="1.0" encoding="utf-8"?>
- <LocateRequest Id="Ia1d6ca7a067fdd545f1a1396d2f26779"
-
Service="http://www.example.org/XKMS"
-
xmlns="http://www.w3.org/2002/03/xkms#">
-
<
ResponseMechanism>http://www.w3.org/2002/03/xkms#Represent</Respons...
- <QueryKeyBinding />
- </LocateRequest>
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- @Test
- public void testConstruction() throws Exception
- {
- String id = "Ia1d6ca7a067fdd545f1a1396d2f26779";
- String service = "http://www.example.org/XKMS";
- String responseMech = "http://www.w3.org/2002/03/xkms#Represent";
-
- LocateRequestType lrt = objectFactory.createLocateRequestType();
- lrt.setId(id);
- lrt.setService(service);
-
- lrt.setQueryKeyBinding(objectFactory.createQueryKeyBindingType());
-
- lrt.getResponseMechanism().add(responseMech);
-
- JAXBElement<LocateRequestType> jaxbLRT =
objectFactory.createLocateRequest(lrt);
-
- Marshaller m = JBossJAXBUtil.getValidatingMarshaller(pkg, schema);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- m.marshal(jaxbLRT, baos);
-
- StringReader sr = new StringReader(baos.toString());
- Unmarshaller um = JBossJAXBUtil.getValidatingUnmarshaller(pkg, schema);
- JAXBElement<LocateRequestType> jaxbLRTUM =
(JAXBElement<LocateRequestType>) um.unmarshal(sr);
-
- LocateRequestType lrtum = jaxbLRTUM.getValue();
- assertEquals(id, lrtum.getId());
- assertEquals(service, lrtum.getService());
- assertEquals(responseMech, lrtum.getResponseMechanism().get(0));
- }
-}
\ No newline at end of file
Added:
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateResultUnitTestCase.java
===================================================================
---
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateResultUnitTestCase.java
(rev 0)
+++
xmlkey/trunk/xkms/src/test/java/org/jboss/test/identity/xkms/v2/model/LocateResultUnitTestCase.java 2009-01-07
22:07:09 UTC (rev 206)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.identity.xkms.v2.model;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.jboss.identity.xkms.v2.model.LocateResultType;
+import org.jboss.identity.xkms.v2.model.ObjectFactory;
+import org.jboss.identity.xmlkey.common.JBossJAXBUtil;
+import org.junit.Test;
+
+/**
+ * Unit Test the LocateResult construct
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 7, 2009
+ */
+public class LocateResultUnitTestCase
+{
+ String pkg = "org.jboss.identity.xkms.v2.model";
+ String schema = "schema/v2/xkms.xsd";
+
+ ObjectFactory objectFactory = new ObjectFactory();
+
+ /**
+ <?xml version="1.0" encoding="utf-8"?>
+ <LocateResult Id="Idbc77142059a3a51c9eccd2425d77757"
+
Service="http://www.example.org/XKMS"
+ Nonce="Rj2BoUZM7PisPX2ytSAAWA=="
+
ResultMajor="http://www.w3.org/2002/03/xkms#Represent"
+ RequestId="Ia1d6ca7a067fdd545f1a1396d2f26779"
+
xmlns="http://www.w3.org/2002/03/xkms#" />
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testConstruction() throws Exception
+ {
+ String id = "Idbc77142059a3a51c9eccd2425d77757";
+ String reqid = "Ia1d6ca7a067fdd545f1a1396d2f26779";
+ String service = "http://www.example.org/XKMS";
+ String resultMajor = "http://www.w3.org/2002/03/xkms#Represent";
+ String nonce = "Rj2BoUZM7PisPX2ytSAAWA==";
+
+ LocateResultType lrt = objectFactory.createLocateResultType();
+ lrt.setId(id);
+ lrt.setRequestId(reqid);
+ lrt.setService(service);
+ lrt.setResultMajor(resultMajor);
+ lrt.setNonce(nonce.getBytes());
+
+ JAXBElement<LocateResultType> jaxbLRT =
objectFactory.createLocateResult(lrt);
+
+ Marshaller m = JBossJAXBUtil.getValidatingMarshaller(pkg, schema);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ m.marshal(jaxbLRT, baos);
+
+ StringReader sr = new StringReader(baos.toString());
+ Unmarshaller um = JBossJAXBUtil.getValidatingUnmarshaller(pkg, schema);
+ JAXBElement<LocateResultType> jaxbLRTUM =
(JAXBElement<LocateResultType>) um.unmarshal(sr);
+
+ LocateResultType lrtum = jaxbLRTUM.getValue();
+ assertEquals(id, lrtum.getId());
+ assertEquals(reqid, lrtum.getRequestId());
+ assertEquals(service, lrtum.getService());
+ assertEquals(resultMajor, lrtum.getResultMajor());
+ assertEquals(nonce, new String(lrtum.getNonce()));
+ }
+}
\ No newline at end of file