Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublishGeoserver / src-test / org / gvsig / publish / geoserver / conf / GSConfigurationTest.java @ 22616

History | View | Annotate | Download (2.81 KB)

1
/* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ibañez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package org.gvsig.publish.geoserver.conf;
42

    
43
import java.io.File;
44
import java.net.MalformedURLException;
45
import java.net.URL;
46

    
47
import junit.framework.TestCase;
48

    
49
import org.gvsig.publish.exceptions.PublishException;
50
import org.gvsig.publish.geoserver.model.Geoserver;
51
import org.gvsig.publish.geoserver.model.GeoserverWFSService;
52

    
53
public class GSConfigurationTest extends TestCase {
54
        private static Geoserver geoserver=null;
55
        private static GeoserverWFSService geoserverwfs = null;
56
        private static File data_dir=null;
57
        /**
58
         * Creates the data for testing (a Geoserver instance) 
59
         * 
60
         * @param name
61
         * @throws MalformedURLException 
62
         * @throws PublishException 
63
         */
64
        public GSConfigurationTest(String name) throws MalformedURLException{
65
                super(name);
66
                if (geoserver == null){
67
                        initialize();
68
                }
69
        }
70
        private void initialize() throws MalformedURLException{
71
                geoserver = new Geoserver();
72
                data_dir = new File ("test");
73
                geoserver.setServerURL(new URL("http://localhost:8080/geoserver"));
74
                geoserver.setAdminUser("test_user");
75
                geoserver.setAdminPassword("test_password");
76
                geoserver.setConfigDirectory(data_dir);
77
                geoserverwfs = new GeoserverWFSService(geoserver);
78
        }
79
        /**
80
         * Writes global configuration
81
         * @throws LayerInfoNotAvailableException 
82
         */
83
        public void test_generateGlobalConfiguration() {
84
                GSConfiguration conf = new GSConfiguration(geoserver);                                
85
                conf.toXML();
86
        }
87
        /**
88
         * Writes wfs configuration
89
         * @throws LayerInfoNotAvailableException 
90
         */
91
        public void test_generateWFSConfiguration() {
92
                GSConfiguration conf = new GSConfiguration(geoserver);                
93
                conf.getGlobals().setWFSService(geoserverwfs);
94
                conf.toXML();
95
        }
96
}