KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > event > test > TestOntEvents


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena 2
7  * Web http://sourceforge.net/projects/jena/
8  * Created 22 Feb 2003
9  * Filename $RCSfile: TestOntEvents.java,v $
10  * Revision $Revision: 1.4 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/02/21 12:06:04 $
14  * by $Author: andy_seaborne $
15  *
16  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
17  * (see footer for full conditions)
18  *****************************************************************************/

19
20 // Package
21
///////////////
22
package com.hp.hpl.jena.ontology.event.test;
23
24
25
26 // Imports
27
///////////////
28
import com.hp.hpl.jena.ontology.*;
29 import com.hp.hpl.jena.ontology.event.OntEventHandler;
30 import com.hp.hpl.jena.ontology.impl.test.*;
31 import com.hp.hpl.jena.rdf.model.*;
32
33
34 /**
35  * <p>
36  * Test cases for ontology events
37  * </p>
38  *
39  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com">email</a>)
40  * @version Release @release@ ($Id: TestOntEvents.java,v 1.4 2005/02/21 12:06:04 andy_seaborne Exp $)
41  */

42 public class TestOntEvents
43     extends OntTestBase
44 {
45
46     // Constants
47
//////////////////////////////////
48

49     // Static variables
50
//////////////////////////////////
51

52     // Instance variables
53
//////////////////////////////////
54

55     // Constructors
56
//////////////////////////////////
57

58     public TestOntEvents(String JavaDoc name) {
59         super(name);
60     }
61
62
63     // External signature methods
64
//////////////////////////////////
65

66     // Internal implementation methods
67
//////////////////////////////////
68

69     //==============================================================================
70
// Inner class definitions
71
//==============================================================================
72

73     private static class OntEventTestCase
74         extends OntTestBase
75     {
76         private ModelUpdater m_updater;
77         private OntModel m_model;
78         private Resource m_expected;
79         private boolean m_taleOfExpected = false;
80         private boolean m_taleOfUnexpected = false;
81
82         private OntEventTestCase( String JavaDoc name, ModelUpdater upd, String JavaDoc lang, Resource event ) {
83             super( name );
84             m_updater = upd;
85             m_model = ModelFactory.createOntologyModel( lang );
86             m_expected = event;
87         }
88         
89         public void runTest() {
90             // first register an event handler for the expected event
91
m_model.getEventManager().addHandler( m_expected, new OntEventHandler() {
92                 public void action(Resource event, boolean add, Model source, RDFNode arg0, RDFNode arg1, RDFNode arg2) {
93                     
94                 }
95             });
96         }
97         
98         public void setUp() {
99             // ensure the ont doc manager is in a consistent state
100
OntDocumentManager.getInstance().reset( true );
101         }
102         
103         
104     }
105     
106     private static interface ModelUpdater {
107         public void update( OntModel m );
108     }
109 }
110
111
112
113 /*
114     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
115     All rights reserved.
116
117     Redistribution and use in source and binary forms, with or without
118     modification, are permitted provided that the following conditions
119     are met:
120
121     1. Redistributions of source code must retain the above copyright
122        notice, this list of conditions and the following disclaimer.
123
124     2. Redistributions in binary form must reproduce the above copyright
125        notice, this list of conditions and the following disclaimer in the
126        documentation and/or other materials provided with the distribution.
127
128     3. The name of the author may not be used to endorse or promote products
129        derived from this software without specific prior written permission.
130
131     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
132     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
133     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
134     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
135     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
136     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
137     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
138     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
139     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
140     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
141 */

142
Popular Tags