01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.discussions.providers;
07:
08: import java.util.*;
09: import java.io.*;
10:
11: import com.sun.portal.search.soif.*;
12:
13: /**
14: * Comments test routines.
15: */
16: class TestComments {
17:
18: static public void main(String[] args) throws Exception {
19:
20: // Test Data
21: String[] fname = { new String(
22: "/u/sushmac/projects/compass/soif/comments5.soif") };
23: String[] vurl = { new String("comment-2019130630") };
24: String[] expectedResult = { new String(
25: "Expected: comment-2019130630") };
26:
27: // Begin Testing
28: for (int i = 0; i < fname.length; i++) {
29: SOIFInputStream sp = new SOIFInputStream(
30: new DataInputStream(new BufferedInputStream(
31: new FileInputStream(fname[i]))));
32: System.out
33: .println("\n************************************************");
34: System.out.println("File " + fname[i]);
35:
36: Comments c = new Comments();
37: if (fname[i].endsWith("comments4.soif")) {
38: // file contains comments sorted by author not by date
39: System.out.println("** Sorted by author example");
40: c.resetSortByDate();
41: }
42:
43: c.clusterComments(sp, vurl[i]);
44: System.out.println("");
45: System.out.println("** hasComments: " + c.hasComments());
46: System.out.println("** getRootSOIF: "
47: + c.getRootSOIF().getURL());
48: System.out.println("** getDiscussionID = "
49: + c.getDiscussionID());
50: System.out.println("** " + expectedResult[i]);
51:
52: ArrayList v = (ArrayList) c.getComments();
53: System.out.println("size: " + v.size());
54: for (int j = 0; j < v.size(); j++) {
55: SOIF s = (SOIF) v.get(j);
56: System.out.println("** ClusterComments: " + s.getURL());
57: System.out.println("* findDepth = " + c.findDepth(s));
58: System.out.println("* getParentID = "
59: + c.getParentID(s));
60: }
61: }
62: }
63: }
|