Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extPublish / src-test / org / gvsig / publish / Test_publication.java @ 22616

History | View | Annotate | Download (6.29 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;
42

    
43
import junit.framework.TestCase;
44

    
45
import org.gvsig.publish.exceptions.InvalidRemoteResourceException;
46
import org.gvsig.publish.exceptions.PublishException;
47
import org.gvsig.publish.infoproject.IViewInfo;
48
import org.gvsig.publish.infoproject.ViewInfo;
49
import org.gvsig.publish.serversmodel.Server;
50
import org.gvsig.publish.util.LocalResourcesTestUtilities;
51

    
52
import com.iver.cit.gvsig.project.documents.view.ProjectView;
53

    
54
public abstract class Test_publication extends TestCase {
55

    
56
        public LocalResourcesTestUtilities util = null;
57
        protected void setUp() throws Exception {
58
                super.setUp();                
59
                //gets the utilities
60
                try {
61
                        util = new LocalResourcesTestUtilities();
62
                } catch (Exception e1) {                
63
                        e1.printStackTrace();
64
                }
65
        }
66

    
67
        protected void tearDown() throws Exception {
68
                super.tearDown();
69
        }
70
        /**
71
         * 
72
         * @return server's type
73
         */
74
        public abstract String getServerRegisterTag(); 
75
        /**
76
         * testing shapefiles publication
77
         * @throws InvalidRemoteResourceException 
78
         */
79
        public void test_publish_shape() throws InvalidRemoteResourceException{
80
                Server server = null;
81
                //gets the server from the register
82
                server = PublishRegister.register().getServer(getServerRegisterTag());                
83
                this.assertNotNull("I can't get server from the register", server);
84
                
85
                //gets a gvSIG view with a shape from utilities
86
                //ProjectInfo inf = new ProjectInfo( l.getProject());
87
                //IViewInfo[] v =  inf.getViewsInfo();
88
                ProjectView v = util.getView_shape();
89
                IViewInfo iv = new ViewInfo(v,null);                
90
                server.addInfo(iv); 
91
                 
92
                //call publish()
93
                try {
94
                        server.publish();
95
                        System.err.println("Testing ... shapefiles");
96
                } catch (PublishException e) {
97
                        System.err.println("Publish exception");
98
                        e.printStackTrace();
99
                }
100
        }
101
        /**
102
         * testing postgis publication
103
         * @throws InvalidRemoteResourceException 
104
         */
105
        public void test_publish_postgis() throws InvalidRemoteResourceException{
106
                Server server = null;
107
                //gets the server from the register
108
                server = PublishRegister.register().getServer(getServerRegisterTag());                
109
                this.assertNotNull("I can't get server from the register", server);
110
                
111
                ProjectView v = util.getView_postgis();
112
                IViewInfo iv = new ViewInfo(v,null);                
113
                server.addInfo(iv); 
114
                 
115
                //call publish()
116
                try {
117
                        server.publish();
118
                        System.err.println("Testing ... postgis");
119
                } catch (PublishException e) {
120
                        System.err.println("Publish exception");
121
                        e.printStackTrace();
122
                }
123
        }
124
        /**
125
         * testing raster publication
126
         * @throws InvalidRemoteResourceException 
127
         */
128
        public void test_publish_raster() throws InvalidRemoteResourceException{
129
                Server server = null;
130
                //gets the server from the register
131
                server = PublishRegister.register().getServer(getServerRegisterTag());                
132
                this.assertNotNull("I can't get server from the register", server);
133
                
134
                ProjectView v = util.getView_raster();
135
                IViewInfo iv = new ViewInfo(v,null);                
136
                server.addInfo(iv); 
137
                 
138
                //call publish()
139
                try {
140
                        server.publish();
141
                        System.err.println("Testing ... raster");
142
                } catch (PublishException e) {
143
                        System.err.println("Publish exception");
144
                        e.printStackTrace();
145
                }
146
        }
147
        /**
148
         * testing unique group layers publication
149
         * @throws InvalidRemoteResourceException 
150
         */
151
        public void test_publish_group() throws InvalidRemoteResourceException{
152
                Server server = null;
153
                //gets the server from the register
154
                server = PublishRegister.register().getServer(getServerRegisterTag());                
155
                this.assertNotNull("I can't get server from the register", server);
156
                
157
                ProjectView v = util.getView_group();
158
                IViewInfo iv = new ViewInfo(v,null);                
159
                server.addInfo(iv); 
160
                 
161
                //call publish()
162
                try {
163
                        server.publish();
164
                        System.err.println("Testing ... groups");
165
                } catch (PublishException e) {
166
                        System.err.println("Publish exception");
167
                        e.printStackTrace();
168
                }
169
        }
170
        /**
171
         * testing points, polygons and lines legends.
172
         * <p>
173
         * testing multiple views
174
         * <p>
175
         * testing unique values and intervals legends
176
         * @throws InvalidRemoteResourceException 
177
         */
178
        public void test_publish_legends() throws InvalidRemoteResourceException{
179
                Server server = null;
180
                //gets the server from the register
181
                server = PublishRegister.register().getServer(getServerRegisterTag());                
182
                this.assertNotNull("I can't get server from the register", server);
183
                
184
                //unique values
185
                ProjectView v = util.getView_unique_values();
186
                IViewInfo iv = new ViewInfo(v,null);                
187
                server.addInfo(iv); 
188
                //intervals
189
                v = util.getView_intervals();
190
                iv = new ViewInfo(v,null);                
191
                server.addInfo(iv);
192
                //labeling
193
                v = util.getView_label();
194
                iv = new ViewInfo(v,null);                
195
                server.addInfo(iv);
196
                //points
197
                v = util.getView_point();
198
                iv = new ViewInfo(v,null);                
199
                server.addInfo(iv);
200
                //lines
201
                v = util.getView_line();
202
                iv = new ViewInfo(v,null);                
203
                server.addInfo(iv);
204
                //polygons
205
                v = util.getView_polygon();
206
                iv = new ViewInfo(v,null);                
207
                server.addInfo(iv);
208
                 
209
                //call publish()
210
                try {
211
                        server.publish();
212
                        System.err.println("Testing ... unique values, labeling, intervals, simple legends");
213
                } catch (PublishException e) {
214
                        System.err.println("Publish exception");
215
                        e.printStackTrace();
216
                }
217
        }
218
        /**
219
         * TODO:We are testing the persistence
220
         */
221
        public void test_persistence(){
222
                
223
        }
224
}