@@ -0,0 +1,2349 @@
+/**  '$RCSfile$'%0A *  Copyright: 2010 Regents of the University of California and the%0A *              National Center for Ecological Analysis and Synthesis%0A *%0A * This program is free software; you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation; either version 2 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this program; if not, write to the Free Software%0A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%0A */%0Apackage org.dataone.annotator.matcher.esor;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.fail;%0A%0Aimport java.util.List;%0A%0Aimport org.dataone.annotator.generator.oa.OAAnnotationGenerator;%0Aimport org.dataone.annotator.matcher.ConceptItem;%0Aimport org.dataone.annotator.matcher.bioportal.BioPortalService;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport com.hp.hpl.jena.ontology.OntClass;%0Aimport com.hp.hpl.jena.ontology.OntModel;%0Aimport com.hp.hpl.jena.rdf.model.ModelFactory;%0Aimport com.hp.hpl.jena.rdf.model.Resource;%0A%0Apublic class EsorServiceTest %7B%0A%0A%09%0A%09/**%0A%09 * constructor for the test%0A%09 */%0A%09public EsorServiceTest() %7B%0A%09%7D%0A%0A%09/**%0A%09 * Establish a testing framework by initializing appropriate objects%0A%09 */%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%7D%0A%0A%09/**%0A%09 * Release any objects after tests are complete%0A%09 */%0A%09@After%0A%09public void tearDown() %7B%0A%09%7D%0A%0A%09%0A%09@Test%0A%09public void testLookup() %7B%0A%09%09%0A%09%09try %7B%0A%0A%09%09%09// look up the annotation recommendation from ESOR%0A%09%09%09String text = %22carbon flux%22;%0A%09%09%09EsorService service = new EsorService();%0A%09%09%09List%3CConceptItem%3E results;%0A%09%09%09results = service.getConcepts(text);%0A%09%09%09String retConcept = results.get(0).getUri().toString();%0A%09%09%09System.out.println(%22retConcept=%22 + retConcept);%0A%09%09%09assertEquals(%22http://purl.dataone.org/odo/ECSO_00000011%22, retConcept);%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09e.printStackTrace();%0A%09%09%09fail(e.getMessage());%0A%09%09%7D%0A%09%09%0A%09%7D%0A%0A%7D%0A

test case for ESOR service