Statistics
| Revision:

root / branches / v10 / extensions / extPublish / src-test / com / iver / cit / gvsig / publish / infoProject / Test_queryView.java @ 13570

History | View | Annotate | Download (4.78 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

    
42
package com.iver.cit.gvsig.publish.infoProject;
43

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

    
47
import com.iver.cit.gvsig.project.documents.view.ProjectView;
48
import com.iver.cit.gvsig.publish.infoProject.ILayerInfo;
49
import com.iver.cit.gvsig.publish.infoProject.IViewInfo;
50
import com.iver.cit.gvsig.publish.infoProject.InfoFactory;
51
import com.iver.cit.gvsig.publish.infoProject.LayerInfo;
52
import com.iver.cit.gvsig.publish.infoProject.ViewInfo;
53
import com.iver.cit.gvsig.publish.util.LocalResourcesTestUtilities;
54

    
55
import junit.framework.TestCase;
56

    
57
/**
58
 * We are testing all methods of DefaultView.  
59
 * 
60
 * @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
61
 *
62
 */
63
public class Test_queryView extends TestCase {
64
        //gvSIG ProjectView
65
        private ProjectView gvView = null;
66
        //information about the view to publish
67
        private IViewInfo viewInfo = null;
68

    
69
        
70
        /**
71
         * initializes the test
72
         */
73
        protected void setUp() throws Exception {
74
                File f = null;
75
                super.setUp();
76
                //gets absolute path
77
                URL url = this.getClass().getResource("../resources");
78
                if (url == null) 
79
                        throw new Exception("Can't find resources directory");                
80
                f = new File(url.getFile());
81
                if (!f.exists()) 
82
                        throw new Exception("Can't find resources dir");
83
                
84
                //gets a new view from the utilities
85
                LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(f.getAbsolutePath());
86
                this.gvView = util.getBasicView();
87
                //this.gvView = util.getGroupView();
88
                //creates a instance to get view information
89
                this.viewInfo = InfoFactory.getViewInfo(gvView);
90
                //creates a database 
91
                //util.createDBPostGIS();
92
        }
93
        /**
94
         * after the test
95
         */
96
        protected void tearDown() throws Exception {
97
                super.tearDown();
98
        }
99
        /**
100
         * test getName method
101
         */
102
        public void test_getName(){
103
                this.assertEquals("info view fails", "test_view_name",this.viewInfo.getName());
104
                System.out.println(this.viewInfo.getName());        
105
        }
106
        /**
107
         * test getOwner method
108
         */
109
        public void test_getOwner(){
110
                this.assertEquals("info view fails", "test_view_owner",this.viewInfo.getOwner());
111
                System.out.println(this.viewInfo.getOwner());
112
        }
113
        /**
114
         * test getComment method 
115
         */
116
        public void test_getCommnet(){
117
                this.assertEquals("ifo view fails", "test_view_comment",this.viewInfo.getComment());
118
                System.out.println(this.viewInfo.getComment());
119
        }
120
        /**
121
         * test getCreationDate method
122
         */
123
        public void test_getCreationDate(){
124
                this.assertEquals("info view fails", "07/07/07 13:30", this.viewInfo.getCreationDate());
125
                System.out.println(this.viewInfo.getCreationDate());
126
        }
127
        /**
128
         * test getSRS method
129
         */
130
        public void test_getSRS(){
131
                this.assertEquals("info view fails", "EPSG:23031", this.viewInfo.getSRS());
132
                System.out.println(this.viewInfo.getSRS());
133
        }
134
        
135
        /**
136
         * test getMaxX method
137
         */
138
        public void test_getMaxX(){
139
                this.assertEquals("info view fails",110.0, this.viewInfo.getMaxX(),0);
140
                System.out.println(this.viewInfo.getMaxX());
141
        }
142
        /**
143
         * test getMaxX method
144
         */
145
        public void test_getMaxY(){
146
                this.assertEquals("info view fails", 140.0, this.viewInfo.getMaxY(),0);
147
                System.out.println(this.viewInfo.getMaxY());
148
        }
149
        /**
150
         * test getMaxX method
151
         */
152
        public void test_getMinX(){
153
                this.assertEquals("info view fails", 20.0, this.viewInfo.getMinX(),0);
154
                System.out.println(this.viewInfo.getMinX());
155
        }
156
        /**
157
         * test getMaxX method
158
         */
159
        public void test_getMinY(){
160
                this.assertEquals("info view fails", 60.0, this.viewInfo.getMinY(),0);
161
                System.out.println(this.viewInfo.getMinY());
162
        }
163
        /**
164
         * test getLayers method
165
         */
166
        public void test_getLayers(){
167
                ILayerInfo[] layers = this.viewInfo.getLayers();                
168
                for (int i = 0 ; i < layers.length; i++){
169
                        System.out.println(layers[i].getName());                        
170
                }                        
171
        }
172
}