001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/test/junit/org/deegree/ogcwebservices/wass/common/URNTest.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042:
043: ---------------------------------------------------------------------------*/
044: package org.deegree.ogcwebservices.wass.common;
045:
046: import junit.framework.TestCase;
047:
048: /**
049: * Test class for URN.
050: *
051: * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
052: * @author last edited by: $Author: apoth $
053: *
054: * @version 2.0, $Revision: 9336 $, $Date: 2007-12-27 03:31:18 -0800 (Thu, 27 Dec 2007) $
055: *
056: * @since 2.0
057: */
058:
059: public class URNTest extends TestCase {
060:
061: /**
062: * Simple test cases.
063: */
064: public void testGetLastName() {
065: assertNull(new URN("urntest:nichts").getLastName());
066: assertNull(new URN("urn").getLastName());
067: assertNotNull(new URN("urn:").getLastName());
068: assertNotNull(new URN("urn:eintest:einzweiter").getLastName());
069: assertNotNull(new URN("urn:").getLastName());
070: }
071:
072: /**
073: * Simple test cases.
074: */
075: public void testIsWellformedGDINRW() {
076: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:password")
077: .isWellformedGDINRW());
078: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:was")
079: .isWellformedGDINRW());
080: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:session")
081: .isWellformedGDINRW());
082: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:anonymous")
083: .isWellformedGDINRW());
084: assertFalse(new URN("urn:x-gdi-nrw:authnMethod:1.0:nichts")
085: .isWellformedGDINRW());
086: assertFalse(new URN("urn:x-gdi-nrw:authnMethod:1.0:")
087: .isWellformedGDINRW());
088: assertFalse(new URN("urn:x-gdi-nrw:authnMethod:1.0")
089: .isWellformedGDINRW());
090: }
091:
092: /**
093: * Simple test cases.
094: */
095: public void testGetAuthenticationMethod() {
096: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:password")
097: .getAuthenticationMethod().equalsIgnoreCase("password"));
098: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:was")
099: .getAuthenticationMethod().equalsIgnoreCase("was"));
100: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:session")
101: .getAuthenticationMethod().equalsIgnoreCase("session"));
102: assertTrue(new URN("urn:x-gdi-nrw:authnMethod:1.0:anonymous")
103: .getAuthenticationMethod()
104: .equalsIgnoreCase("anonymous"));
105: assertNull(new URN("urn:x-gdi-nrw:authnMethod:1.0:nichts")
106: .getAuthenticationMethod());
107: }
108:
109: }
110:
111: /***************************************************************************************************
112: * Changes to this class. What the people have been up to: $Log$
113: * Changes to this class. What the people have been up to: Revision 1.1 2006/06/09 12:58:32 schmitz
114: * Changes to this class. What the people have been up to: Set up some tests for WAS/WSS and the URN class.
115: * Changes to this class. What the people have been up to: Commented out some of the deegree param stuff in order for the
116: * Changes to this class. What the people have been up to: tests to run.
117: * Changes to this class. What the people have been up to: Tests have hardcoded URLs in them, so they won't run just anywhere.
118: * Changes to this class. What the people have been up to:
119: *
120: *
121: **************************************************************************************************/
|