001: package org.deegree.ogcwebservices.csw.discovery;
002:
003: /*---------------- FILE HEADER ------------------------------------------
004:
005: This file is part of deegree.
006: Copyright (C) 2001-2008 by:
007: EXSE, Department of Geography, University of Bonn
008: http://www.giub.uni-bonn.de/deegree/
009: lat/lon GmbH
010: http://www.lat-lon.de
011:
012: This library is free software; you can redistribute it and/or
013: modify it under the terms of the GNU Lesser General Public
014: License as published by the Free Software Foundation; either
015: version 2.1 of the License, or (at your option) any later version.
016:
017: This library is distributed in the hope that it will be useful,
018: but WITHOUT ANY WARRANTY; without even the implied warranty of
019: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
020: Lesser General Public License for more details.
021:
022: You should have received a copy of the GNU Lesser General Public
023: License along with this library; if not, write to the Free Software
024: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
025:
026: Contact:
027:
028: Andreas Poth
029: lat/lon GmbH
030: Aennchenstr. 19
031: 53115 Bonn
032: Germany
033: E-Mail: poth@lat-lon.de
034:
035: Prof. Dr. Klaus Greve
036: Department of Geography
037: University of Bonn
038: Meckenheimer Allee 166
039: 53115 Bonn
040: Germany
041: E-Mail: greve@giub.uni-bonn.de
042:
043: ---------------------------------------------------------------------------*/
044: import java.util.Map;
045:
046: import junit.framework.Test;
047: import junit.framework.TestCase;
048: import junit.framework.TestSuite;
049:
050: import org.deegree.framework.util.KVP2Map;
051: import org.deegree.ogcwebservices.OGCRequestFactory;
052: import org.deegree.ogcwebservices.OGCWebServiceException;
053:
054: /**
055: *
056: *
057: *
058: * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
059: * @author last edited by: $Author: poth $
060: *
061: * @version. $Revision: 6251 $, $Date: 2007-03-19 16:59:28 +0100 (Mo, 19 Mrz 2007) $
062: */
063: public class GetRecordByIdTest extends TestCase {
064:
065: public static Test suite() {
066: return new TestSuite(GetRecordByIdTest.class);
067: }
068:
069: /*
070: * @see TestCase#setUp()
071: */
072: @Override
073: protected void setUp() throws Exception {
074: super .setUp();
075: }
076:
077: /*
078: * @see TestCase#tearDown()
079: */
080: @Override
081: protected void tearDown() throws Exception {
082: super .tearDown();
083: }
084:
085: public void testGetRecordById1() {
086:
087: String s = "http://localhost/csw?request=GetRecordById&version=2.0.0&ELEMENTSETNAME=Full&ID=1234,4321";
088: Map<String, String> kvp = KVP2Map.toMap(s);
089: GetRecordById getRecordById = GetRecordById.create(kvp);
090: assertEquals(getRecordById.getIds()[0], "1234");
091: assertEquals(getRecordById.getIds()[1], "4321");
092: assertEquals(getRecordById.getElementSetName(), "Full");
093: assertEquals(getRecordById.getVersion(), "2.0.0");
094:
095: }
096:
097: public void testGetRecordById2() throws OGCWebServiceException {
098:
099: String s = "http://localhost/csw?request=GetRecordById&version=2.0.0&ELEMENTSETNAME=Full&ID=1234,4321";
100: Map<String, String> kvp = KVP2Map.toMap(s);
101: GetRecordById getRecordById = (GetRecordById) OGCRequestFactory
102: .createFromKVP(kvp);
103: assertEquals(getRecordById.getIds()[0], "1234");
104: assertEquals(getRecordById.getIds()[1], "4321");
105: assertEquals(getRecordById.getElementSetName(), "Full");
106: assertEquals(getRecordById.getVersion(), "2.0.0");
107:
108: }
109: }
|