Statistics
| Revision:

gvsig-raster / org.gvsig.raster.wmts / trunk / org.gvsig.raster.wmts / org.gvsig.raster.wmts.app / org.gvsig.raster.wmts.app.wmtsclient / src / test / java / org / gvsig / raster / wmts / io / TestWMTSDriver.java @ 393

History | View | Annotate | Download (3.55 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.raster.wmts.io;
23

    
24
import java.net.MalformedURLException;
25
import java.net.URL;
26

    
27
import org.gvsig.fmap.dal.coverage.dataset.io.wms.DefaultWMSServerExplorerParameters;
28
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorer;
29
import org.gvsig.fmap.dal.coverage.explorer.WMTSServerExplorerParameters;
30
import org.gvsig.fmap.dal.exception.InitializeException;
31
import org.gvsig.remoteclient.wmts.exception.WMTSException;
32
import org.gvsig.remoteclient.wmts.struct.WMTSServiceIdentification;
33
import org.gvsig.remoteclient.wmts.struct.WMTSServiceProvider;
34
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
35

    
36
/**
37
 * @author Nacho Brodin (nachobrodin@gmail.com)
38
 */
39
public class TestWMTSDriver extends AbstractLibraryAutoInitTestCase {
40
        
41
        protected void doSetUp() throws Exception {
42
                System.err.println("TestWMTSDriver running...");
43
        }
44
        
45
        public void testStack() {
46
                
47
                URL url = null;
48
                try {
49
                        url = new URL("http://scolab.es:9090/geoserver/gwc/service/wmts");
50
                        
51
                        //Crea el manejador para la versi?n del servidor y devuelve la versi?n 
52
                        //WMTSConnector conn = WMTSDriver.getConnectorFromURL(url);
53
                        //String version = conn.getVersion();
54
                        
55
                        //Creamos un explorer para obtener los datos del servidor
56
                        DefaultWMSServerExplorerParameters.registerDynClass();
57
                        WMTSServerExplorerParameters param = new DefaultWMTSServerExplorerParameters();
58
                        param.setHost(url.toString());
59
                        WMTSServerExplorer explorer = new WMTSServerExplorerImpl(param, null);
60
                        explorer.connect(null);
61
                        
62
                        WMTSServiceIdentification id = explorer.getServiceIdentification();
63
                        String title = id.getTitle();
64
                        String version = id.getServiceTypeVersion();
65
                        String type = id.getServiceType();
66
                        
67
                        WMTSServiceProvider prov = explorer.getServiceProvider();
68
                        String pN = prov.getProviderName();
69
                        String pS = prov.getProviderSite();
70
                        String pC = prov.getServiceContact();
71
                        
72
                        //WMTSThemes themes = explorer.getThemes();
73
                        System.out.println("Title: " + title);
74
                        System.out.println("Version: " + version);
75
                        System.out.println("Type: " + type);
76
                        System.out.println("Provider Name: " + pN);
77
                        System.out.println("Provider Site: " + pS);
78
                        System.out.println("Service Contact: " + pC);
79
                        
80
                        //En este caso solo hay una lista de temas con una capa por cada uno
81
                        //pero en un caso corriente seria un ?rbol de themas con una capa asociada a cada uno
82
                        /*for (int i = 0; i < themes.size(); i++) {
83
                                WMTSLayer layer = ((WMTSTheme)themes.get(i)).getLayer();
84
                                if(layer != null)
85
                                        layer.print();
86
                        }*/
87
                        
88
                } catch (MalformedURLException e) {
89
                        e.printStackTrace();
90
                } catch (InitializeException e) {
91
                        e.printStackTrace();
92
                } catch (WMTSException e) {
93
                        e.printStackTrace();
94
                }
95
                
96
        }
97
}