From 03550edd314243647824acdbf7c38ca16da8402b Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Wed, 26 Jul 2006 15:45:48 +0000 Subject: [PATCH] MessageHistory Tests Changed name to be written in CDATA and name not to be the first field, as there are some situations with xpath where the results are found only when the node is the first one. --- .../slick/history/TestHistoryService.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/net/java/sip/communicator/slick/history/TestHistoryService.java b/test/net/java/sip/communicator/slick/history/TestHistoryService.java index fb3bd0744..d98b11ece 100644 --- a/test/net/java/sip/communicator/slick/history/TestHistoryService.java +++ b/test/net/java/sip/communicator/slick/history/TestHistoryService.java @@ -25,8 +25,8 @@ public class TestHistoryService extends TestCase { - private static HistoryRecordStructure recordStructure = new HistoryRecordStructure( - new String[] { "name", "age", "sex" }); + private static HistoryRecordStructure recordStructure = + new HistoryRecordStructure(new String[] { "age", "name_CDATA", "sex" }); /** * The ConfigurationService that we will be testing. @@ -113,8 +113,9 @@ public void testWriteRecords() { try { for (int i = 0; i < 202; i++) { - writer.addRecord(new String[] { "name" + i, - "" + random.nextInt(), i % 2 == 0 ? "m" : "f" }); + writer.addRecord(new String[] { "" + random.nextInt(), + "name" + i, + i % 2 == 0 ? "m" : "f" }); } } catch (Exception e) { fail("Could not write records. Reason: " + e); @@ -124,9 +125,9 @@ public void testWriteRecords() { public void testReadRecords() { HistoryReader reader = this.history.getReader(); - QueryResultSet result = reader.findByKeyword("name2"); + QueryResultSet result = reader.findByKeyword("name2", "name"); - assertTrue(result.hasNext()); + assertTrue("Nothing found", result.hasNext()); while (result.hasNext()) { HistoryRecord record = result.nextRecord(); @@ -134,7 +135,7 @@ public void testReadRecords() { String[] vals = record.getPropertyValues(); try { - int n = Integer.parseInt(vals[0].substring(4)); + int n = Integer.parseInt(vals[1].substring(4)); assertEquals(3, vals.length); assertEquals(n % 2 == 0 ? "m" : "f", vals[2]); @@ -144,5 +145,4 @@ public void testReadRecords() { } } } - }