[jboss-svn-commits] JBL Code SVN: r29507 - in labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm: xml and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 29 13:25:35 EDT 2009
Author: whitingjr
Date: 2009-09-29 13:25:35 -0400 (Tue, 29 Sep 2009)
New Revision: 29507
Added:
labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm/xml/
labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm/xml/TestToXml.java
Log:
added test case.
Added: labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm/xml/TestToXml.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm/xml/TestToXml.java (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/MVCCSampleSTM/src/test/java/uk/ac/ncl/sdia/a8905943/stm/xml/TestToXml.java 2009-09-29 17:25:35 UTC (rev 29507)
@@ -0,0 +1,78 @@
+ /*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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 uk.ac.ncl.sdia.a8905943.stm.xml;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Validator;
+
+import org.jboss.xnio.log.Logger;
+import org.junit.Assert;
+import org.junit.Test;
+
+import uk.ac.ncl.sdia.a8905943.handle.HandleUtils;
+import uk.ac.ncl.sdia.a8905943.model.Car;
+import uk.ac.ncl.sdia.a8905943.model.LeccyCar;
+import uk.ac.ncl.sdia.a8905943.stm.AbstractUnitT;
+import uk.ac.ncl.sdia.a8905943.stm.STM;
+import uk.ac.ncl.sdia.a8905943.stm.object.TransactedObjectReference;
+
+public class TestToXml extends AbstractUnitT
+{
+ private static final Logger logger = Logger.getLogger(TestToXml.class);
+ /**
+ * This test is a proof of concept, checking to see if Betwixt
+ * can be used to create
+ *
+ */
+
+ @Test
+ public void testCheckTORIsSerialized()
+ {
+ Long id = 3l;
+ String make = "Ford";
+ Long version = 1l;
+ Car car = new Car(id);
+ Long handle = new HandleUtils().getHandle(Car.class, id, "make") ;
+ TransactedObjectReference reference = new TransactedObjectReference(handle, make, version);
+ this.fieldStore.put(handle, reference);
+ Writer writer = new StringWriter();
+ try
+ {
+ JAXBContext context = JAXBContext.newInstance(STM.class);
+ Marshaller marshaller = context.createMarshaller();
+ marshaller.setProperty(marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.marshal(this.stm, writer);
+ logger.info(writer.toString());
+ }
+ catch (JAXBException jaxbe)
+ {
+ Assert.fail(jaxbe.getMessage());
+ }
+ }
+}
More information about the jboss-svn-commits
mailing list