svn-gvsig-desktop / branches / v10 / extensions / extPublish / src-test / org / gvsig / publish / Test_publication.java @ 19900
History | View | Annotate | Download (5.82 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.infoproject.IViewInfo; |
46 |
import org.gvsig.publish.infoproject.ViewInfo; |
47 |
import org.gvsig.publish.serversmodel.PublishException; |
48 |
import org.gvsig.publish.serversmodel.Server; |
49 |
import org.gvsig.publish.util.LocalResourcesTestUtilities; |
50 |
|
51 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
52 |
|
53 |
public abstract class Test_publication extends TestCase { |
54 |
|
55 |
public LocalResourcesTestUtilities util = null; |
56 |
protected void setUp() throws Exception { |
57 |
super.setUp();
|
58 |
//gets the utilities
|
59 |
try {
|
60 |
util = new LocalResourcesTestUtilities();
|
61 |
} catch (Exception e1) { |
62 |
e1.printStackTrace(); |
63 |
} |
64 |
} |
65 |
|
66 |
protected void tearDown() throws Exception { |
67 |
super.tearDown();
|
68 |
} |
69 |
/**
|
70 |
*
|
71 |
* @return server's type
|
72 |
*/
|
73 |
public abstract String getServerRegisterTag(); |
74 |
/**
|
75 |
* testing shapefiles publication
|
76 |
*/
|
77 |
public void test_publish_shape(){ |
78 |
Server server = null;
|
79 |
//gets the server from the register
|
80 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
81 |
this.assertNotNull("I can't get server from the register", server); |
82 |
|
83 |
//gets a gvSIG view with a shape from utilities
|
84 |
//ProjectInfo inf = new ProjectInfo( l.getProject());
|
85 |
//IViewInfo[] v = inf.getViewsInfo();
|
86 |
ProjectView v = util.getView_shape(); |
87 |
IViewInfo iv = new ViewInfo(v,null); |
88 |
server.addInfo(iv); |
89 |
|
90 |
//call publish()
|
91 |
try {
|
92 |
server.publish(); |
93 |
System.err.println("Testing ... shapefiles"); |
94 |
} catch (PublishException e) {
|
95 |
System.err.println("Publish exception"); |
96 |
e.printStackTrace(); |
97 |
} |
98 |
} |
99 |
/**
|
100 |
* testing postgis publication
|
101 |
*/
|
102 |
public void test_publish_postgis(){ |
103 |
Server server = null;
|
104 |
//gets the server from the register
|
105 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
106 |
this.assertNotNull("I can't get server from the register", server); |
107 |
|
108 |
ProjectView v = util.getView_postgis(); |
109 |
IViewInfo iv = new ViewInfo(v,null); |
110 |
server.addInfo(iv); |
111 |
|
112 |
//call publish()
|
113 |
try {
|
114 |
server.publish(); |
115 |
System.err.println("Testing ... postgis"); |
116 |
} catch (PublishException e) {
|
117 |
System.err.println("Publish exception"); |
118 |
e.printStackTrace(); |
119 |
} |
120 |
} |
121 |
/**
|
122 |
* testing raster publication
|
123 |
*/
|
124 |
public void test_publish_raster(){ |
125 |
Server server = null;
|
126 |
//gets the server from the register
|
127 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
128 |
this.assertNotNull("I can't get server from the register", server); |
129 |
|
130 |
ProjectView v = util.getView_raster(); |
131 |
IViewInfo iv = new ViewInfo(v,null); |
132 |
server.addInfo(iv); |
133 |
|
134 |
//call publish()
|
135 |
try {
|
136 |
server.publish(); |
137 |
System.err.println("Testing ... raster"); |
138 |
} catch (PublishException e) {
|
139 |
System.err.println("Publish exception"); |
140 |
e.printStackTrace(); |
141 |
} |
142 |
} |
143 |
/**
|
144 |
* testing unique group layers publication
|
145 |
*/
|
146 |
public void test_publish_group(){ |
147 |
Server server = null;
|
148 |
//gets the server from the register
|
149 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
150 |
this.assertNotNull("I can't get server from the register", server); |
151 |
|
152 |
ProjectView v = util.getView_group(); |
153 |
IViewInfo iv = new ViewInfo(v,null); |
154 |
server.addInfo(iv); |
155 |
|
156 |
//call publish()
|
157 |
try {
|
158 |
server.publish(); |
159 |
System.err.println("Testing ... groups"); |
160 |
} catch (PublishException e) {
|
161 |
System.err.println("Publish exception"); |
162 |
e.printStackTrace(); |
163 |
} |
164 |
} |
165 |
/**
|
166 |
* testing points, polygons and lines legends.
|
167 |
* <p>
|
168 |
* testing multiple views
|
169 |
* <p>
|
170 |
* testing unique values and intervals legends
|
171 |
*/
|
172 |
public void test_publish_legends(){ |
173 |
Server server = null;
|
174 |
//gets the server from the register
|
175 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
176 |
this.assertNotNull("I can't get server from the register", server); |
177 |
|
178 |
//unique values
|
179 |
ProjectView v = util.getView_unique_values(); |
180 |
IViewInfo iv = new ViewInfo(v,null); |
181 |
server.addInfo(iv); |
182 |
//intervals
|
183 |
v = util.getView_intervals(); |
184 |
iv = new ViewInfo(v,null); |
185 |
server.addInfo(iv); |
186 |
//labeling
|
187 |
v = util.getView_label(); |
188 |
iv = new ViewInfo(v,null); |
189 |
server.addInfo(iv); |
190 |
//points
|
191 |
v = util.getView_point(); |
192 |
iv = new ViewInfo(v,null); |
193 |
server.addInfo(iv); |
194 |
//lines
|
195 |
v = util.getView_line(); |
196 |
iv = new ViewInfo(v,null); |
197 |
server.addInfo(iv); |
198 |
//polygons
|
199 |
v = util.getView_polygon(); |
200 |
iv = new ViewInfo(v,null); |
201 |
server.addInfo(iv); |
202 |
|
203 |
//call publish()
|
204 |
try {
|
205 |
server.publish(); |
206 |
System.err.println("Testing ... unique values, labeling, intervals, simple legends"); |
207 |
} catch (PublishException e) {
|
208 |
System.err.println("Publish exception"); |
209 |
e.printStackTrace(); |
210 |
} |
211 |
} |
212 |
/**
|
213 |
* TODO:We are testing the persitence
|
214 |
*/
|
215 |
public void test_persistence(){ |
216 |
|
217 |
} |
218 |
} |