[Nodal-cvs] j-test/src/test/org/nodal/schemata/text/plain TestDecTextPlain.java,1.2,1.3 TestEncTextP
Status: Pre-Alpha
Brought to you by:
leei
From: Lee I. <le...@us...> - 2005-01-08 00:54:59
|
Update of /cvsroot/nodal/j-test/src/test/org/nodal/schemata/text/plain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1818/src/test/org/nodal/schemata/text/plain Modified Files: TestDecTextPlain.java TestEncTextPlain.java Log Message: Reflect IOException throws from Repository and Document access. Index: TestDecTextPlain.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/org/nodal/schemata/text/plain/TestDecTextPlain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestDecTextPlain.java 12 Nov 2004 19:24:51 -0000 1.2 --- TestDecTextPlain.java 8 Jan 2005 00:54:49 -0000 1.3 *************** *** 22,26 **** import org.nodal.model.Node; import org.nodal.model.SequenceNode; ! import org.nodal.nav.Path.Failure; import org.nodal.type.SequenceType; import org.nodal.type.Schema; --- 22,26 ---- import org.nodal.model.Node; import org.nodal.model.SequenceNode; ! import org.nodal.nav.Path; import org.nodal.type.SequenceType; import org.nodal.type.Schema; *************** *** 32,36 **** /** ! * * @author Nelson Siu */ --- 32,36 ---- /** ! * * @author Nelson Siu */ *************** *** 51,72 **** } ! /** Sets up the repository and context node ! *This method is called before a test is executed. */ protected void setUp() { //Create a new repository try { repo = (TransientRepository) Nodal.openRepository("memory://audited"); ! } catch (Failure e) { ! fail(); ! } ! typeDoc = Types.createSchema("memory://audited/testme.nls"); ! try { sSeqType = typeDoc.createSequenceType(Types.STRING); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Cannot create sequence of strings: "+e1); } ! //Special mode created by Lee to allow for node creation straight from the repo // o This node is used to create the factory for the decoder in the test n = repo.createNode(sSeqType.asSequenceType()); --- 51,76 ---- } ! /** ! * Sets up the repository and context node This method is called before a test ! * is executed. ! */ protected void setUp() { //Create a new repository try { repo = (TransientRepository) Nodal.openRepository("memory://audited"); ! ! typeDoc = Types.createSchema("memory://audited/testme.nls"); sSeqType = typeDoc.createSequenceType(Types.STRING); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Cannot create sequence of strings: " + e1); ! } catch (Path.Failure e) { ! fail(); ! } catch (IOException e) { ! fail(); } ! //Special mode created by Lee to allow for node creation straight from the ! // repo // o This node is used to create the factory for the decoder in the test n = repo.createNode(sSeqType.asSequenceType()); *************** *** 81,86 **** } ! //========================================================================== ! /**Test Decoder open text file and encode into a sequence of nodes*/ public void testDecode() { //Open a stream from text file --- 85,90 ---- } ! //========================================================================== ! /** Test Decoder open text file and encode into a sequence of nodes */ public void testDecode() { //Open a stream from text file *************** *** 120,122 **** } ! } --- 124,126 ---- } ! } \ No newline at end of file Index: TestEncTextPlain.java =================================================================== RCS file: /cvsroot/nodal/j-test/src/test/org/nodal/schemata/text/plain/TestEncTextPlain.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestEncTextPlain.java 12 Nov 2004 19:24:51 -0000 1.2 --- TestEncTextPlain.java 8 Jan 2005 00:54:50 -0000 1.3 *************** *** 20,24 **** import org.nodal.model.SequenceNode; import org.nodal.model.Setter; ! import org.nodal.nav.Path.Failure; import org.nodal.format.text.plain.Format; import org.nodal.type.SequenceType; --- 20,24 ---- import org.nodal.model.SequenceNode; import org.nodal.model.Setter; ! import org.nodal.nav.Path; import org.nodal.format.text.plain.Format; import org.nodal.type.SequenceType; *************** *** 29,35 **** import storage.trans.TransientRepository; /** ! * ! * @author Maryam */ public class TestEncTextPlain extends TestCase { --- 29,36 ---- import storage.trans.TransientRepository; + /** ! * ! * @author Maryam */ public class TestEncTextPlain extends TestCase { *************** *** 48,74 **** } ! /** Sets up the repository and the test node tree ! *This method is called before a test is executed. */ protected void setUp() { //Create a new repository try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); - } catch (Failure e) { - fail(); - } ! //Create a new encoder ! testTextSchema = Format.documentFormat(); ! testEncoder = testTextSchema.encoder(); - typeDoc = Types.createSchema("testme.nls"); - try { sSeqType = typeDoc.createSequenceType(Types.STRING); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail ("Unable to create sequence of strings: "+e1); } ! //Special mode created by Lee to allow for node creation straight from the repo myTestNode = repo.createNode(sSeqType); --- 49,79 ---- } ! /** ! * Sets up the repository and the test node tree This method is called before ! * a test is executed. ! */ protected void setUp() { //Create a new repository try { repo = (TransientRepository) Nodal.openRepository("memory://transient"); ! //Create a new encoder ! testTextSchema = Format.documentFormat(); ! testEncoder = testTextSchema.encoder(); ! ! typeDoc = Types.createSchema("testme.nls"); sSeqType = typeDoc.createSequenceType(Types.STRING); } catch (Type.CreationFailure e1) { e1.printStackTrace(); ! fail("Unable to create sequence of strings: " + e1); ! } catch (Path.Failure e) { ! fail(); ! } catch (IOException e) { ! fail(); } ! //Special mode created by Lee to allow for node creation straight from the ! // repo myTestNode = repo.createNode(sSeqType); *************** *** 77,97 **** try { ! // Create a node tree with 2 nodes sSeqSetter = sSeqEd.insertAfter(-1); ! SequenceNode.Editor newNode1 = ! sSeqEd.createNode(Types.STRING).editSequence(); newNode1.insertAfter(-1).set("line 1"); sSeqSetter.set(newNode1.bareNode()); ! SequenceNode.Editor newNode2 = ! sSeqEd.createNode(Types.STRING).editSequence(); newNode2.insertAfter(-1).set("line 2"); sSeqSetter.set(newNode2.bareNode()); /* ! System.err.println ("Get [-2] = "+sSeqEd.item(-2).get()); ! System.err.println ("Get [-1] = "+sSeqEd.item(-1).get()); ! System.err.println ("Get [ 0] = "+sSeqEd.item(0).get()); ! System.err.println ("Get [ 1] = "+sSeqEd.item(1).get()); ! */ } catch (ConstraintFailure f) { System.out.println("Constraint Failure in TestEncTextPlain"); --- 82,102 ---- try { ! // Create a node tree with 2 nodes sSeqSetter = sSeqEd.insertAfter(-1); ! SequenceNode.Editor newNode1 = sSeqEd.createNode(Types.STRING) ! .editSequence(); newNode1.insertAfter(-1).set("line 1"); sSeqSetter.set(newNode1.bareNode()); ! SequenceNode.Editor newNode2 = sSeqEd.createNode(Types.STRING) ! .editSequence(); newNode2.insertAfter(-1).set("line 2"); sSeqSetter.set(newNode2.bareNode()); /* ! * System.err.println ("Get [-2] = "+sSeqEd.item(-2).get()); ! * System.err.println ("Get [-1] = "+sSeqEd.item(-1).get()); ! * System.err.println ("Get [ 0] = "+sSeqEd.item(0).get()); ! * System.err.println ("Get [ 1] = "+sSeqEd.item(1).get()); ! */ } catch (ConstraintFailure f) { System.out.println("Constraint Failure in TestEncTextPlain"); *************** *** 111,115 **** fail(); } ! //Examine that the nodes were indeed encoded into the output stream String lineEnd = System.getProperty("line.separator"); --- 116,120 ---- fail(); } ! //Examine that the nodes were indeed encoded into the output stream String lineEnd = System.getProperty("line.separator"); *************** *** 117,119 **** } ! } --- 122,124 ---- } ! } \ No newline at end of file |