source: trunk/gsdl3/packages/gsdl-as/test-src/org/greenstone/gsdlas/ProfileStoreTest.java@ 8717

Last change on this file since 8717 was 8717, checked in by schweer, 19 years ago

started to rework control flow, user authentication

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/*
2 * Created on Nov 18, 2004
3 * Copyright (C) Andrea Schweer, 2004
4 *
5 * This file is part of the Greenstone Alerting Service.
6 * Refer to the COPYING file in the base directory of this package
7 * for licensing information.
8 */
9package org.greenstone.gsdlas;
10
11import java.net.URL;
12import java.util.*;
13
14import junit.framework.TestCase;
15
16import org.greenstone.gsdlas.profiles.*;
17
18/**
19 * @author schweer
20 *
21 * TODO To change the template for this generated type comment go to
22 * Window - Preferences - Java - Code Style - Code Templates
23 */
24public class ProfileStoreTest extends TestCase {
25
26 public static void main(String[] args) {
27 junit.textui.TestRunner.run(ProfileStoreTest.class);
28 }
29
30 public final void testAddSubscription() {
31 try {
32 addSubscriptions();
33 } catch (ParseException e) {
34 e.printStackTrace();
35 fail(e.getMessage());
36 }
37 }
38
39 public final void testFilter() {
40 try {
41 addSubscriptions();
42
43 URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
44 GreenstoneCommunicator gsComm = new GreenstoneCommunicator(url);
45
46 Map event = new TreeMap();
47
48 event.put("documentID", "20041118:5");
49 event.put("collectionID", "gs3mgdemo");
50 event.put("host", "http://localhost:8080/soap/servlet/rpcrouter");
51
52 Set result = ProfileStore.getInstance().filter(event, gsComm);
53
54 System.out.println(result.size());
55
56 } catch (Exception e) {
57 e.printStackTrace();
58 fail(e.getMessage());
59 }
60 }
61
62 private void addSubscriptions() throws ParseException {
63 Map valueMap = new TreeMap();
64
65 valueMap.put("collectionID", "gs3mgdemo");
66 valueMap.put("document_content", "Tomatensalat");
67
68 addSubscription(valueMap);
69
70 valueMap.clear();
71
72 valueMap.put("collectionID", "gs3mgdemo");
73 valueMap.put("document_content", "Water+Buffalo");
74
75 addSubscription(valueMap);
76
77 valueMap.clear();
78
79 valueMap.put("collectionID", "gs3mgdemo");
80 valueMap.put("document_content", "gender+equality");
81
82 addSubscription(valueMap);
83 }
84
85 private void addSubscription(Map valueMap) throws ParseException {
86 ProfileStore.getInstance().createSubscription(valueMap);
87 }
88
89}
Note: See TracBrowser for help on using the repository browser.