001: //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/test/junit/org/deegree/ogcwebservices/wass/was/WAServiceTest.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.was;
045:
046: import java.io.File;
047: import java.net.URL;
048:
049: import junit.framework.Test;
050: import junit.framework.TestCase;
051: import junit.framework.TestSuite;
052:
053: import org.deegree.framework.log.ILogger;
054: import org.deegree.framework.log.LoggerFactory;
055: import org.deegree.framework.xml.XMLFragment;
056: import org.deegree.ogcwebservices.wass.common.WASServiceFactory;
057: import org.deegree.ogcwebservices.wass.common.XMLFactory;
058: import org.deegree.ogcwebservices.wass.was.capabilities.WASCapabilities;
059:
060: /**
061: * This is the general test class for the new WAService implementation.
062: *
063: * @author <a href="mailto:schmitz@lat-lon.de">Andreas Schmitz</a>
064: * @author last edited by: $Author: apoth $
065: *
066: * @version 2.0, $Revision: 9336 $, $Date: 2007-12-27 03:31:18 -0800 (Thu, 27 Dec 2007) $
067: *
068: * @since 2.0
069: */
070:
071: public class WAServiceTest extends TestCase {
072:
073: private static final ILogger LOG = LoggerFactory
074: .getLogger(WAServiceTest.class);
075:
076: private WAService service;
077:
078: /**
079: * Constructor for WAServiceTest.
080: *
081: * @param arg0
082: */
083: public WAServiceTest(String arg0) {
084: super (arg0);
085: }
086:
087: /*
088: * @see TestCase#setUp()
089: */
090: @Override
091: protected void setUp() throws Exception {
092: super .setUp();
093: try {
094: LOG.logInfo("Setting up WAS...");
095: File file = new File(
096: "./resources/wass/was/example/deegree/example_was_capabilities.xml");
097: URL url = file.toURL();
098: WASServiceFactory.setConfiguration(url);
099: service = WASServiceFactory.getUncachedWAService();
100: LOG.logInfo("Setting up WAS...done.");
101: } catch (Exception e) {
102: throw e;
103: }
104: }
105:
106: /*
107: * @see TestCase#tearDown()
108: */
109: @Override
110: protected void tearDown() throws Exception {
111: super .tearDown();
112: }
113:
114: /**
115: * @return the Test
116: */
117: public static Test suite() {
118: return new TestSuite(WAServiceTest.class);
119: }
120:
121: /**
122: * @throws Exception
123: */
124: public void testGetCapabilities() throws Exception {
125: assertNotNull("Service not initialized", service);
126: WASCapabilities capabilities = (WASCapabilities) service
127: .getCapabilities();
128: assertNotNull("Capabilities are null", capabilities);
129: XMLFragment xml = XMLFactory.export(capabilities);
130: assertNotNull("XMLFragment is null", xml);
131: xml.prettyPrint(System.out);
132: }
133:
134: /*
135: * public void _testAuthenticate() throws Exception { assertNotNull("Service not initialized",
136: * service); HashMap<String, String> map = new HashMap<String, String>(); map.put( "VERSION",
137: * "1.0.0" ); map.put( "ID", "754h" ); map.put( "METHOD",
138: * "urn:oasis:names:tc:SAML:1.0:am:password" ); map.put( "CREDENTIALS", "SEC_ADMIN,JOSE67" );
139: * Authenticate auth = Authenticate.create( map ); Object o = service.doService( auth );
140: * assertTrue( o instanceof Session );
141: *
142: * o = service.doService( auth ); assertTrue( o instanceof Session ); }
143: */
144:
145: /*
146: * public void _testDescribeUser() throws Exception { assertNotNull("Service not initialized",
147: * service); Map map = new HashMap(); map.put( "VERSION", "1.0.0" ); map.put( "ID", "754h" );
148: * map.put( "METHOD", "urn:oasis:names:tc:SAML:1.0:am:password" ); map.put( "CREDENTIALS",
149: * "SEC_ADMIN,JOSE67" ); Authenticate auth = Authenticate.create( map ); Session session =
150: * (Session)service.doService( auth ); map.put( "VERSION", "1.0.0" ); map.put( "ID", "754h" );
151: * map.put( "METHOD", "urn:latlon:names:sessionid" ); map.put( "CREDENTIALS",
152: * session.getSessionID().getId() );
153: *
154: * DescribeUser du = DescribeUser.create( map ); User user = (User)service.doService( du );
155: * assertEquals( user.getName(), "SEC_ADMIN" ); assertEquals( user.getPassword(), "JOSE67" ); }
156: */
157:
158: }
159:
160: /***************************************************************************************************
161: * Changes to this class. What the people have been up to: $Log$
162: * Changes to this class. What the people have been up to: Revision 1.6 2006/06/20 15:37:10 bezema
163: * Changes to this class. What the people have been up to: Changed the test just alittle so they can compile.
164: * Changes to this class. What the people have been up to:
165: * Changes to this class. What the people have been up to: Revision 1.5 2006/06/19 15:31:40 bezema
166: * Changes to this class. What the people have been up to: added the function calls handling the id etc.
167: * Changes to this class. What the people have been up to:
168: * Changes to this class. What the people have been up to: Revision 1.4 2006/06/12 16:12:32 bezema
169: * Changes to this class. What the people have been up to: JUnit test work with for a GetCapabilities request - example configurationfiles in resources added
170: * Changes to this class. What the people have been up to:
171: * Changes to this class. What the people have been up to: Revision 1.2 2006/06/09 12:58:32 schmitz
172: * Changes to this class. What the people have been up to: Set up some tests for WAS/WSS and the URN class.
173: * Changes to this class. What the people have been up to: Commented out some of the deegree param stuff in order for the
174: * Changes to this class. What the people have been up to: tests to run.
175: * Changes to this class. What the people have been up to: Tests have hardcoded URLs in them, so they won't run just anywhere.
176: * Changes to this class. What the people have been up to: Revision 1.1
177: * 2006/05/29 16:13:00 schmitz Added an XMLFactory to create WAS and WSS GetCapabilities responses.
178: * Also added the XML templates for this purpose. Renamed the WASOperationsMetadata to
179: * OperationsMetadata_1_0 and made some minor changes to some of the related bean classes.
180: *
181: *
182: **************************************************************************************************/
|