1   /*
2   wsmo4j - a WSMO API and Reference Implementation
3   
4   Copyright (c) 2004-2005 , OntoText Lab. / SIRMA
5                             University of Innsbruck, Austria  
6   
7   This library is free software; you can redistribute it and/or modify it under
8   the terms of the GNU Lesser General Public License as published by the Free
9   Software Foundation; either version 2.1 of the License, or (at your option)
10  any later version.
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  details.
15  You should have received a copy of the GNU Lesser General Public License along
16  with this library; if not, write to the Free Software Foundation, Inc.,
17  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  
20  package test.wsmo4j.common;
21  
22  /**
23   * <p>Title: WSMO4J</p>
24   * <p>Description: WSMO API and a Reference Implementation</p>
25   * <p>Copyright:  Copyright (c) 2004</p>
26   * <p>Company: OntoText Lab. / SIRMA </p>
27   * @author not attributable
28   * @version 1.0
29   *
30   */
31  import org.omwg.ontology.Ontology;
32  import org.wsmo.common.IRI;
33  
34  import test.wsmo4j.Wsmo4jTestCase;
35  
36  public class TopEntityTest extends Wsmo4jTestCase {
37  
38      private Ontology testedOContainer;
39      private IRI myOntologyRef;
40  
41      protected void setUp() throws Exception {
42          super.setUp();
43          myOntologyRef = factory.createIRI("http://myOntologyLocation.com/ontology");
44          testedOContainer = factory.createOntology(myOntologyRef);
45      }
46  
47      protected void tearDown() throws Exception {
48          super.tearDown();
49          testedOContainer = null;
50          myOntologyRef = null;
51      }
52  
53      public void testAddImportedOntology() {
54          if (testedOContainer.listOntologies().contains(testedOContainer)) {
55              testedOContainer.removeOntology(myOntologyRef);
56              assertFalse("Unable to remove an ontology reference!", 
57                      testedOContainer.listOntologies().contains(testedOContainer));
58          }
59          testedOContainer.addOntology(testedOContainer);
60          assertTrue("Unable to add an ontology reference!",
61                  testedOContainer.listOntologies().contains(testedOContainer));
62      }
63  
64      public void testRemoveImportedOntology() {
65          if (!testedOContainer.listOntologies().contains(testedOContainer)) {
66              testedOContainer.addOntology(testedOContainer);
67          }
68          testedOContainer.removeOntology(myOntologyRef);
69          assertFalse("Unable to remove an ontology reference!",
70                  testedOContainer.listOntologies().contains(testedOContainer));
71      }
72  }
73  
74  /*
75   * $Log$
76   * Revision 1.4  2005/09/12 14:31:35  vassil_momtchev
77   * extends Wsmo4jTestCase
78   *
79   */