Revision 71
1.X/tags/extremadura-iver/extPublish/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>extPublish</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
16 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
17 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
18 |
</natures> |
|
19 |
</projectDescription> |
|
0 | 20 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/Test_publication.java | ||
---|---|---|
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.gvsig19.ViewInfo; |
|
49 |
import org.gvsig.publish.serversmodel.Server; |
|
50 |
import org.gvsig.publish.test.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 |
} |
|
0 | 225 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/ogcmetadata/OGCWMSLayerMetadataTest.java | ||
---|---|---|
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.ogcmetadata; |
|
42 |
|
|
43 |
import junit.framework.TestCase; |
|
44 |
|
|
45 |
import org.gvsig.publish.IPublishPersistence; |
|
46 |
|
|
47 |
import com.iver.utiles.XMLEntity; |
|
48 |
|
|
49 |
public class OGCWMSLayerMetadataTest extends TestCase { |
|
50 |
public void test_persistence(){ |
|
51 |
IOGCLayerMetadata imetadata = new OGCLayerMetadata(); |
|
52 |
IPublishPersistence ipersist = (IPublishPersistence)imetadata; |
|
53 |
//test basic operations |
|
54 |
imetadata.setName("name"); |
|
55 |
assertEquals("name", imetadata.getName()); |
|
56 |
imetadata.setTitle("title"); |
|
57 |
assertEquals("title", imetadata.getTitle()); |
|
58 |
imetadata.setAbstract("abstract"); |
|
59 |
assertEquals("abstract", imetadata.getAbstract()); |
|
60 |
imetadata.setQueryable(true); |
|
61 |
assertEquals(true, imetadata.isQueryable()); |
|
62 |
//test persist operations |
|
63 |
XMLEntity entity = ipersist.getXMLEntity(); |
|
64 |
assertEquals(ipersist.getClassName(), entity.getName()); |
|
65 |
assertEquals(ipersist.getVersion(), entity.getIntProperty("version")); |
|
66 |
assertNotNull(entity.getChild(0)); |
|
67 |
assertEquals(true, imetadata.isQueryable()); |
|
68 |
System.err.println(entity.toString()); |
|
69 |
ipersist.setXMLEntity(entity); |
|
70 |
assertEquals(ipersist.getClassName(), entity.getName()); |
|
71 |
assertNotNull(entity.getChild(0)); |
|
72 |
assertEquals(true, entity.getBooleanProperty("queryable")); |
|
73 |
} |
|
74 |
|
|
75 |
} |
|
0 | 76 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/ogcmetadata/OGCWMSMetadataTest.java | ||
---|---|---|
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.ogcmetadata; |
|
42 |
|
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
|
|
46 |
import junit.framework.TestCase; |
|
47 |
|
|
48 |
import com.iver.utiles.IPersistence; |
|
49 |
import com.iver.utiles.XMLEntity; |
|
50 |
|
|
51 |
public class OGCWMSMetadataTest extends TestCase { |
|
52 |
public void test_persistence() throws MalformedURLException{ |
|
53 |
IOGCServiceMetadata imetadata = new OGCServiceMetadata(); |
|
54 |
IPersistence ipersist = (IPersistence)imetadata; |
|
55 |
//test basic operations |
|
56 |
imetadata.setName("name"); |
|
57 |
assertEquals("name", imetadata.getName()); |
|
58 |
imetadata.setTitle("title"); |
|
59 |
assertEquals("title", imetadata.getTitle()); |
|
60 |
imetadata.setAbstract("abstract"); |
|
61 |
assertEquals("abstract", imetadata.getAbstract()); |
|
62 |
imetadata.setOnlineResource(new URL("http://localhost/wms")); |
|
63 |
assertEquals("http://localhost/wms", imetadata.getOnlineResource().toString()); |
|
64 |
//test persist operations |
|
65 |
XMLEntity entity = ipersist.getXMLEntity(); |
|
66 |
assertEquals(ipersist.getClassName(), entity.getName()); |
|
67 |
assertEquals("http://localhost/wms", entity.getStringProperty("onlineresource")); |
|
68 |
assertNotNull(entity.getChild(0)); |
|
69 |
System.err.println(entity.toString()); |
|
70 |
ipersist.setXMLEntity(entity); |
|
71 |
assertEquals(ipersist.getClassName(), entity.getName()); |
|
72 |
assertNotNull(entity.getChild(0)); |
|
73 |
assertEquals("http://localhost/wms", entity.getStringProperty("onlineresource")); |
|
74 |
} |
|
75 |
|
|
76 |
} |
|
0 | 77 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/ogcmetadata/OGCCommonMetadataTest.java | ||
---|---|---|
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.ogcmetadata; |
|
42 |
|
|
43 |
import junit.framework.TestCase; |
|
44 |
|
|
45 |
import org.gvsig.publish.IPublishPersistence; |
|
46 |
|
|
47 |
import com.iver.utiles.XMLEntity; |
|
48 |
|
|
49 |
public class OGCCommonMetadataTest extends TestCase { |
|
50 |
|
|
51 |
public void test_persistence(){ |
|
52 |
IOGCCommonMetadata imetadata = new OGCCommonMetadata(); |
|
53 |
IPublishPersistence ipersist = (IPublishPersistence)imetadata; |
|
54 |
//test basic operations |
|
55 |
imetadata.setName("name"); |
|
56 |
assertEquals("name", imetadata.getName()); |
|
57 |
imetadata.setTitle("title"); |
|
58 |
assertEquals("title", imetadata.getTitle()); |
|
59 |
imetadata.setAbstract("abstract"); |
|
60 |
assertEquals("abstract", imetadata.getAbstract()); |
|
61 |
//test persist operations |
|
62 |
XMLEntity entity = ipersist.getXMLEntity(); |
|
63 |
assertEquals(ipersist.getClassName(), entity.getName()); |
|
64 |
assertEquals(ipersist.getVersion(), entity.getIntProperty("version")); |
|
65 |
assertEquals("name", entity.getStringProperty("ogcname")); |
|
66 |
assertEquals("title", entity.getStringProperty("ogctitle")); |
|
67 |
assertEquals("abstract", entity.getStringProperty("ogcabstract")); |
|
68 |
System.err.println(entity.toString()); |
|
69 |
ipersist.setXMLEntity(entity); |
|
70 |
assertEquals("name", imetadata.getName()); |
|
71 |
assertEquals("title", imetadata.getTitle()); |
|
72 |
assertEquals("abstract", imetadata.getAbstract()); |
|
73 |
} |
|
74 |
|
|
75 |
} |
|
0 | 76 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/serversmodel/ServiceTest.java | ||
---|---|---|
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.serversmodel; |
|
42 |
|
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
|
|
46 |
import junit.framework.TestCase; |
|
47 |
|
|
48 |
import org.gvsig.publish.PublishRegister; |
|
49 |
import org.gvsig.publish.exceptions.InvalidRemoteResourceException; |
|
50 |
import org.gvsig.publish.exceptions.PublishException; |
|
51 |
import org.gvsig.publish.infoproject.ILayerInfo; |
|
52 |
import org.gvsig.publish.infoproject.IProjectInfo; |
|
53 |
import org.gvsig.publish.infoproject.IViewInfo; |
|
54 |
import org.gvsig.publish.infoproject.factory.ProjectInfoFactory; |
|
55 |
import org.gvsig.publish.infoproject.gvsig19.ViewInfo; |
|
56 |
import org.gvsig.publish.test.LocalResourcesTestUtilities; |
|
57 |
|
|
58 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
|
59 |
import com.iver.utiles.XMLEntity; |
|
60 |
/** |
|
61 |
* Test which any service must check. |
|
62 |
* Any service must be tested extending this class. |
|
63 |
* This class test methods that will be called the publish framework. |
|
64 |
* |
|
65 |
* @author jvhigon |
|
66 |
* |
|
67 |
*/ |
|
68 |
public abstract class ServiceTest extends TestCase { |
|
69 |
|
|
70 |
protected Server server = null; |
|
71 |
protected Service service = null; |
|
72 |
protected RemoteResource remote = null; |
|
73 |
protected LocalResourcesTestUtilities util = null; |
|
74 |
|
|
75 |
public abstract String getRemoteResourceRegisterTag(); |
|
76 |
public abstract Class getRemoteResourceClass(); |
|
77 |
public abstract String getServiceRegisterTag(); |
|
78 |
public abstract Class getServiceClass(); |
|
79 |
public abstract String getServerRegisterTag(); |
|
80 |
public abstract Class getServerClass(); |
|
81 |
|
|
82 |
public ServiceTest() { |
|
83 |
super(); |
|
84 |
//create utilities |
|
85 |
try { |
|
86 |
util = new LocalResourcesTestUtilities(); |
|
87 |
} catch (Exception e) { |
|
88 |
// TODO Auto-generated catch block |
|
89 |
e.printStackTrace(); |
|
90 |
} |
|
91 |
//register server |
|
92 |
PublishRegister.register().addServer(getServerRegisterTag(), getServerClass()); |
|
93 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
|
94 |
assertNotNull(server); |
|
95 |
server.setAddress("server"); |
|
96 |
server.setPath("path"); |
|
97 |
server.setPort(80); |
|
98 |
|
|
99 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape()); |
|
100 |
|
|
101 |
//register service |
|
102 |
PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass()); |
|
103 |
service = PublishRegister.register().getService(server, getServiceRegisterTag()); |
|
104 |
assertNotNull(service); |
|
105 |
server.addService(service); |
|
106 |
//register remote resource |
|
107 |
PublishRegister.register().addRemoteResource(getServerRegisterTag(), getServiceRegisterTag(), getRemoteResourceRegisterTag(), getRemoteResourceClass()); |
|
108 |
remote = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag()); |
|
109 |
assertNotNull(remote); |
|
110 |
//init remote (I need to set the layerinfo before add the remote resource) |
|
111 |
|
|
112 |
IViewInfo[] views = proj.getViewsInfo(); |
|
113 |
ILayerInfo[] layers = views[0].getLayers(); |
|
114 |
remote.setLayerInfo(layers[0]); |
|
115 |
} |
|
116 |
|
|
117 |
|
|
118 |
public void testGetRegisterTag() { |
|
119 |
assertNotNull(service.getRegisterTag()); |
|
120 |
} |
|
121 |
|
|
122 |
public void testGetId() { |
|
123 |
assertNotNull(service.getId()); |
|
124 |
} |
|
125 |
|
|
126 |
public void testGetFilter() { |
|
127 |
if (service.getFilter()==null){ |
|
128 |
System.out.println("Service without filter"); |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
|
|
133 |
public void testGetServer() { |
|
134 |
assertNotNull(service.getServer()); |
|
135 |
} |
|
136 |
|
|
137 |
public void testPublish() throws PublishException { |
|
138 |
service.publish(); |
|
139 |
} |
|
140 |
|
|
141 |
public void testGetRemoteResourcesCount() { |
|
142 |
System.out.println(service.getRemoteResourcesCount()); |
|
143 |
} |
|
144 |
|
|
145 |
public void testGetRemoteResource() throws InvalidRemoteResourceException { |
|
146 |
service.addRemoteResource(remote); |
|
147 |
int c = service.getRemoteResourcesCount(); |
|
148 |
assertEquals(remote, service.getRemoteResource(c-1)); |
|
149 |
} |
|
150 |
|
|
151 |
public void testAddRemoteResource() throws InvalidRemoteResourceException { |
|
152 |
int c = service.getRemoteResourcesCount(); |
|
153 |
service.addRemoteResource(remote); |
|
154 |
assertEquals(c + 1, service.getRemoteResourcesCount()); |
|
155 |
} |
|
156 |
|
|
157 |
public void testAddInfoIViewInfo() throws Exception { |
|
158 |
ProjectView gvView = util.getView_shape(); |
|
159 |
IViewInfo viewInfo = new ViewInfo(gvView,null); |
|
160 |
service.addInfo(viewInfo); |
|
161 |
} |
|
162 |
/** |
|
163 |
* TODO: missing asserts |
|
164 |
* @throws Exception |
|
165 |
*/ |
|
166 |
public void testAddInfoILayerInfo() throws Exception { |
|
167 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape()); |
|
168 |
IViewInfo[] views = proj.getViewsInfo(); |
|
169 |
ILayerInfo[] layers = views[0].getLayers(); |
|
170 |
service.addInfo(layers[0]); |
|
171 |
} |
|
172 |
|
|
173 |
public void testGetXMLEntity() { |
|
174 |
System.out.println(service.getXMLEntity().toString()); |
|
175 |
} |
|
176 |
|
|
177 |
public void testSetXMLEntity() { |
|
178 |
XMLEntity xml = service.getXMLEntity(); |
|
179 |
service.setXMLEntity(xml); |
|
180 |
} |
|
181 |
|
|
182 |
public void testRemoveRemoteResource() throws InvalidRemoteResourceException { |
|
183 |
|
|
184 |
int c = service.getRemoteResourcesCount(); |
|
185 |
service.addRemoteResource(remote); |
|
186 |
service.removeRemoteResource(remote); |
|
187 |
assertEquals(c, service.getRemoteResourcesCount()); |
|
188 |
} |
|
189 |
|
|
190 |
public void testRemove() { |
|
191 |
int c = server.getServicesCount(); |
|
192 |
service.remove(); |
|
193 |
assertEquals(c-1, server.getServicesCount()); |
|
194 |
} |
|
195 |
|
|
196 |
} |
|
0 | 197 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/serversmodel/RemoteResourceTest.java | ||
---|---|---|
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.serversmodel; |
|
42 |
|
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
|
|
46 |
import junit.framework.TestCase; |
|
47 |
|
|
48 |
import org.gvsig.publish.PublishRegister; |
|
49 |
import org.gvsig.publish.exceptions.InvalidRemoteResourceException; |
|
50 |
import org.gvsig.publish.exceptions.PublishException; |
|
51 |
import org.gvsig.publish.infoproject.ILayerInfo; |
|
52 |
import org.gvsig.publish.infoproject.IProjectInfo; |
|
53 |
import org.gvsig.publish.infoproject.IViewInfo; |
|
54 |
import org.gvsig.publish.infoproject.factory.ProjectInfoFactory; |
|
55 |
import org.gvsig.publish.test.LocalResourcesTestUtilities; |
|
56 |
|
|
57 |
import com.iver.utiles.XMLEntity; |
|
58 |
|
|
59 |
public abstract class RemoteResourceTest extends TestCase { |
|
60 |
protected Server server = null; |
|
61 |
protected Service service = null; |
|
62 |
protected RemoteResource parent = null; |
|
63 |
protected RemoteResource child = null; |
|
64 |
protected LocalResourcesTestUtilities util = null; |
|
65 |
|
|
66 |
public abstract String getRemoteResourceRegisterTag(); |
|
67 |
public abstract Class getRemoteResourceClass(); |
|
68 |
public abstract String getServiceRegisterTag(); |
|
69 |
public abstract Class getServiceClass(); |
|
70 |
public abstract String getServerRegisterTag(); |
|
71 |
public abstract Class getServerClass(); |
|
72 |
|
|
73 |
public RemoteResourceTest() throws InvalidRemoteResourceException { |
|
74 |
super(); |
|
75 |
//create utilities |
|
76 |
try { |
|
77 |
util = new LocalResourcesTestUtilities(); |
|
78 |
} catch (Exception e) { |
|
79 |
// TODO Auto-generated catch block |
|
80 |
e.printStackTrace(); |
|
81 |
} |
|
82 |
//register server |
|
83 |
PublishRegister.register().addServer(getServerRegisterTag(), getServerClass()); |
|
84 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
|
85 |
server.setAddress("localhost"); |
|
86 |
server.setPort(80); |
|
87 |
server.setPath("/path"); |
|
88 |
|
|
89 |
|
|
90 |
assertNotNull(server); |
|
91 |
//register service |
|
92 |
PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass()); |
|
93 |
service = PublishRegister.register().getService(server, getServiceRegisterTag()); |
|
94 |
assertNotNull(service); |
|
95 |
server.addService(service); |
|
96 |
//register remote resource |
|
97 |
PublishRegister.register().addRemoteResource(getServerRegisterTag(), getServiceRegisterTag(), getRemoteResourceRegisterTag(), getRemoteResourceClass()); |
|
98 |
parent = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag()); |
|
99 |
assertNotNull(parent); |
|
100 |
child = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag()); |
|
101 |
assertNotNull(child); |
|
102 |
|
|
103 |
//init parent |
|
104 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape()); |
|
105 |
IViewInfo[] views = proj.getViewsInfo(); |
|
106 |
ILayerInfo[] layers = views[0].getLayers(); |
|
107 |
parent.setLayerInfo(layers[0]); |
|
108 |
//I need to set the layerinfo before add the remote resource |
|
109 |
service.addRemoteResource(parent); |
|
110 |
|
|
111 |
//init child |
|
112 |
proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape()); |
|
113 |
views = proj.getViewsInfo(); |
|
114 |
layers = views[0].getLayers(); |
|
115 |
child.setLayerInfo(layers[1]); |
|
116 |
} |
|
117 |
|
|
118 |
// public abstract RemoteResource getRemoteResource(); |
|
119 |
// public abstract RemoteResource getChild(); |
|
120 |
|
|
121 |
// public void testRemoteResource() { |
|
122 |
// fail("Not yet implemented"); |
|
123 |
// } |
|
124 |
|
|
125 |
public void testGetId() { |
|
126 |
assertNotNull(parent.getId()); |
|
127 |
} |
|
128 |
|
|
129 |
public void testGetRegisterTag() { |
|
130 |
assertNotNull(parent.getRegisterTag()); |
|
131 |
} |
|
132 |
|
|
133 |
public void testGetService() { |
|
134 |
assertNotNull(parent.getService()); |
|
135 |
} |
|
136 |
|
|
137 |
public void testGetLayerInfo() { |
|
138 |
assertNotNull(parent.getLayerInfo()); |
|
139 |
} |
|
140 |
|
|
141 |
public void testGetChildsCount() { |
|
142 |
int c = parent.getChildsCount(); |
|
143 |
parent.addChild(child); |
|
144 |
assertEquals(c+1, parent.getChildsCount()); |
|
145 |
} |
|
146 |
|
|
147 |
public void testGetChild() { |
|
148 |
int c = parent.getChildsCount(); |
|
149 |
parent.addChild(child); |
|
150 |
assertEquals(child, parent.getChild(c)); |
|
151 |
} |
|
152 |
|
|
153 |
public void testAddChild() { |
|
154 |
int c = parent.getChildsCount(); |
|
155 |
parent.addChild(child); |
|
156 |
assertEquals(c+1, parent.getChildsCount()); |
|
157 |
} |
|
158 |
|
|
159 |
public void testRemove() { |
|
160 |
RemoteResource r = parent; |
|
161 |
Service s = parent.getService(); |
|
162 |
int c = s.getRemoteResourcesCount(); |
|
163 |
r.remove(); |
|
164 |
assertEquals(c-1, s.getRemoteResourcesCount()); |
|
165 |
} |
|
166 |
|
|
167 |
public void testPublish() throws PublishException { |
|
168 |
parent.publish(); |
|
169 |
} |
|
170 |
|
|
171 |
public void testSetLayerInfo() throws Exception { |
|
172 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
173 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape()); |
|
174 |
IViewInfo[] views = proj.getViewsInfo(); |
|
175 |
ILayerInfo[] layers = views[0].getLayers(); |
|
176 |
parent.setLayerInfo(layers[0]); |
|
177 |
assertEquals(layers[0].getName(),parent.getLayerInfo().getName()); |
|
178 |
} |
|
179 |
|
|
180 |
public void testGetXMLEntity() { |
|
181 |
assertNotNull(parent.getXMLEntity()); |
|
182 |
} |
|
183 |
|
|
184 |
public void testSetXMLEntity() { |
|
185 |
XMLEntity xml = parent.getXMLEntity(); |
|
186 |
parent.setXMLEntity(xml); |
|
187 |
//assertEquals(xml, parent.getXMLEntity()); |
|
188 |
} |
|
189 |
|
|
190 |
} |
|
0 | 191 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/serversmodel/ServerTest.java | ||
---|---|---|
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.serversmodel; |
|
42 |
|
|
43 |
import java.net.MalformedURLException; |
|
44 |
import java.net.URL; |
|
45 |
|
|
46 |
import junit.framework.TestCase; |
|
47 |
|
|
48 |
import org.gvsig.publish.PublishRegister; |
|
49 |
import org.gvsig.publish.infoproject.ILayerInfo; |
|
50 |
import org.gvsig.publish.infoproject.IProjectInfo; |
|
51 |
import org.gvsig.publish.infoproject.IViewInfo; |
|
52 |
import org.gvsig.publish.infoproject.factory.ProjectInfoFactory; |
|
53 |
import org.gvsig.publish.test.LocalResourcesTestUtilities; |
|
54 |
|
|
55 |
import com.iver.utiles.XMLEntity; |
|
56 |
/** |
|
57 |
* Tests which any server must check. |
|
58 |
* Any service must be tested extending this class. |
|
59 |
* This class test methods that will be called the publish framework. |
|
60 |
* |
|
61 |
* @author jvhigon |
|
62 |
* |
|
63 |
*/ |
|
64 |
public abstract class ServerTest extends TestCase { |
|
65 |
protected Server server = null; |
|
66 |
protected Service service = null; |
|
67 |
|
|
68 |
public abstract String getServiceRegisterTag(); |
|
69 |
public abstract Class getServiceClass(); |
|
70 |
public abstract String getServerRegisterTag(); |
|
71 |
public abstract Class getServerClass(); |
|
72 |
|
|
73 |
public ServerTest() { |
|
74 |
super(); |
|
75 |
//register server |
|
76 |
PublishRegister.register().addServer(getServerRegisterTag(), getServerClass()); |
|
77 |
server = PublishRegister.register().getServer(getServerRegisterTag()); |
|
78 |
server.setAddress("localhost"); |
|
79 |
server.setPort(80); |
|
80 |
server.setPath("/path"); |
|
81 |
|
|
82 |
assertNotNull(server); |
|
83 |
//register service |
|
84 |
PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass()); |
|
85 |
service = PublishRegister.register().getService(server, getServiceRegisterTag()); |
|
86 |
assertNotNull(service); |
|
87 |
} |
|
88 |
public void testGetId() { |
|
89 |
assertNotNull(server.getId()); |
|
90 |
} |
|
91 |
|
|
92 |
public void testGetRegisterTag(){ |
|
93 |
assertNotNull(server.getRegisterTag()); |
|
94 |
} |
|
95 |
|
|
96 |
public void testAddInfoIViewInfo() throws Exception { |
|
97 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
98 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
99 |
IViewInfo[] views = proj.getViewsInfo(); |
|
100 |
for (int i = 0; i < views.length; i++ ){ |
|
101 |
server.addInfo(views[i]); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
public void testAddInfoILayerInfo() throws Exception { |
|
106 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
107 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
108 |
IViewInfo[] views = proj.getViewsInfo(); |
|
109 |
for (int i = 0; i < views.length; i++ ){ |
|
110 |
ILayerInfo[] layers = views[i].getLayers(); |
|
111 |
for (int j = 0; j < layers.length; j++){ |
|
112 |
server.addInfo(layers[j]); |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
116 |
|
|
117 |
public void testGetServiceString() { |
|
118 |
server.addService(service); |
|
119 |
assertEquals(service,server.getService(service.getId())); |
|
120 |
} |
|
121 |
|
|
122 |
public void testAddService(){ |
|
123 |
int c = server.getServicesCount(); |
|
124 |
server.addService(service); |
|
125 |
assertEquals(c + 1, server.getServicesCount()); |
|
126 |
for (int i = 0; i < server.getServicesCount(); i ++){ |
|
127 |
assertNotNull(server.getService(i)); |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
public void testPublish() throws Exception { |
|
132 |
LocalResourcesTestUtilities util = new LocalResourcesTestUtilities(); |
|
133 |
IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete()); |
|
134 |
IViewInfo[] views = proj.getViewsInfo(); |
|
135 |
for (int i = 0; i < views.length; i++){ |
|
136 |
server.addInfo(views[i]);; |
|
137 |
} |
|
138 |
server.publish(); |
|
139 |
} |
|
140 |
|
|
141 |
// public void testPostInitialize() { |
|
142 |
// fail("Not yet implemented"); |
|
143 |
// } |
|
144 |
|
|
145 |
/*public void testGetServerURL() throws MalformedURLException { |
|
146 |
URL url = new URL("http://server.com/service"); |
|
147 |
server.setAddress("localhost"); |
|
148 |
server.setPort(80); |
|
149 |
server.setPath("/path"); |
|
150 |
|
|
151 |
assertNotNull(server.getServerURL()); |
|
152 |
} |
|
153 |
|
|
154 |
public void testSetServerURL() throws MalformedURLException { |
|
155 |
URL url = new URL("http://server.com/service"); |
|
156 |
server.setAddress("localhost"); |
|
157 |
server.setPort(80); |
|
158 |
server.setPath("/path"); |
|
159 |
|
|
160 |
} |
|
161 |
|
|
162 |
public void testGetXMLEntity() throws MalformedURLException { |
|
163 |
URL url = new URL("http://server.com/service"); |
|
164 |
server.setServerURL(url); |
|
165 |
assertNotNull(server.getXMLEntity()); |
|
166 |
} |
|
167 |
|
|
168 |
public void testSetXMLEntity() throws MalformedURLException { |
|
169 |
URL url = new URL("http://server.com/service"); |
|
170 |
server.setServerURL(url); |
|
171 |
XMLEntity xml = server.getXMLEntity(); |
|
172 |
server.setXMLEntity(xml); |
|
173 |
} |
|
174 |
|
|
175 |
public void testRemoveService() { |
|
176 |
int c = server.getServicesCount(); |
|
177 |
server.addService(service); |
|
178 |
server.removeService(service); |
|
179 |
assertEquals(c, server.getServicesCount()); |
|
180 |
}*/ |
|
181 |
|
|
182 |
} |
|
0 | 183 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/serversmodel/PublicationTest.java | ||
---|---|---|
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.serversmodel; |
|
42 |
|
|
43 |
import junit.framework.TestCase; |
|
44 |
|
|
45 |
import com.iver.utiles.XMLEntity; |
|
46 |
|
|
47 |
public class PublicationTest extends TestCase { |
|
48 |
private static Publication publication = null; |
|
49 |
public PublicationTest(String name) { |
|
50 |
super(name); |
|
51 |
publication = new Publication("test"); |
|
52 |
} |
|
53 |
|
|
54 |
public void testSetAccessFileMethod(){ |
|
55 |
publication.setAccessFileMethod(publication.REMOTE_MOUNT_POINT_ACCESS); |
|
56 |
// publication.setLocalMountPoint("/home/jvhigon/data"); |
|
57 |
// publication.setRemoteMountPoint("/data"); |
|
58 |
} |
|
59 |
|
|
60 |
public void testGetXMLEntity(){ |
|
61 |
assertNotNull(publication.getXMLEntity()); |
|
62 |
} |
|
63 |
|
|
64 |
public void testSetXMLEntity(){ |
|
65 |
XMLEntity xml = publication.getXMLEntity(); |
|
66 |
publication.setXMLEntity(xml); |
|
67 |
} |
|
68 |
} |
|
0 | 69 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/test/LayerInfoForTesting.java | ||
---|---|---|
1 |
package org.gvsig.publish.test; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
|
|
5 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
|
6 |
import org.gvsig.publish.infoproject.ILabelingInfo; |
|
7 |
import org.gvsig.publish.infoproject.ILayerInfo; |
|
8 |
import org.gvsig.publish.infoproject.ILegendInfo; |
|
9 |
import org.gvsig.publish.infoproject.IViewInfo; |
|
10 |
|
|
11 |
import com.iver.utiles.XMLEntity; |
|
12 |
|
|
13 |
public class LayerInfoForTesting implements ILayerInfo{ |
|
14 |
|
|
15 |
public ILayerInfo findLayer(String layerName) { |
|
16 |
// TODO Auto-generated method stub |
|
17 |
return null; |
|
18 |
} |
|
19 |
|
|
20 |
public Rectangle2D getBBox() { |
|
21 |
// TODO Auto-generated method stub |
|
22 |
return null; |
|
23 |
} |
|
24 |
|
|
25 |
public ILayerInfo[] getChilds() { |
|
26 |
// TODO Auto-generated method stub |
|
27 |
return null; |
|
28 |
} |
|
29 |
|
|
30 |
public IDataSourceInfo getDataSource() { |
|
31 |
// TODO Auto-generated method stub |
|
32 |
return null; |
|
33 |
} |
|
34 |
|
|
35 |
public String getEPSGString() { |
|
36 |
// TODO Auto-generated method stub |
|
37 |
return null; |
|
38 |
} |
|
39 |
|
|
40 |
public ILabelingInfo getLabeling() { |
|
41 |
// TODO Auto-generated method stub |
|
42 |
return null; |
|
43 |
} |
|
44 |
|
|
45 |
public ILegendInfo getLegend() { |
|
46 |
// TODO Auto-generated method stub |
|
47 |
return null; |
|
48 |
} |
|
49 |
|
|
50 |
public double getMaxscale() { |
|
51 |
// TODO Auto-generated method stub |
|
52 |
return 0; |
|
53 |
} |
|
54 |
|
|
55 |
public double getMinscale() { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
return 0; |
|
58 |
} |
|
59 |
|
|
60 |
public String getName() { |
|
61 |
// TODO Auto-generated method stub |
|
62 |
return null; |
|
63 |
} |
|
64 |
|
|
65 |
public int getOpacityPercent() { |
|
66 |
// TODO Auto-generated method stub |
|
67 |
return 0; |
|
68 |
} |
|
69 |
|
|
70 |
public ILayerInfo getParent() { |
|
71 |
// TODO Auto-generated method stub |
|
72 |
return null; |
|
73 |
} |
|
74 |
|
|
75 |
public String getPathString() { |
|
76 |
// TODO Auto-generated method stub |
|
77 |
return null; |
|
78 |
} |
|
79 |
|
|
80 |
public int getSRID() { |
|
81 |
// TODO Auto-generated method stub |
|
82 |
return 0; |
|
83 |
} |
|
84 |
|
|
85 |
public String getTitle() { |
|
86 |
// TODO Auto-generated method stub |
|
87 |
return null; |
|
88 |
} |
|
89 |
|
|
90 |
public IViewInfo getViewInfo() { |
|
91 |
// TODO Auto-generated method stub |
|
92 |
return null; |
|
93 |
} |
|
94 |
|
|
95 |
public void setChilds(ILayerInfo[] childs) { |
|
96 |
// TODO Auto-generated method stub |
|
97 |
|
|
98 |
} |
|
99 |
|
|
100 |
public void setParent(ILayerInfo parent) { |
|
101 |
// TODO Auto-generated method stub |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
public int getVersion() { |
|
106 |
// TODO Auto-generated method stub |
|
107 |
return 0; |
|
108 |
} |
|
109 |
|
|
110 |
public String getClassName() { |
|
111 |
// TODO Auto-generated method stub |
|
112 |
return null; |
|
113 |
} |
|
114 |
|
|
115 |
public XMLEntity getXMLEntity() { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
return null; |
|
118 |
} |
|
119 |
|
|
120 |
public void setXMLEntity(XMLEntity xml) { |
|
121 |
// TODO Auto-generated method stub |
|
122 |
|
|
123 |
} |
|
124 |
|
|
125 |
public boolean isLabeled() { |
|
126 |
// TODO Auto-generated method stub |
|
127 |
return false; |
|
128 |
} |
|
129 |
|
|
130 |
public String getLayerName() { |
|
131 |
// TODO Auto-generated method stub |
|
132 |
return null; |
|
133 |
} |
|
134 |
|
|
135 |
public void setName(String nameInfo) { |
|
136 |
// TODO Auto-generated method stub |
|
137 |
|
|
138 |
} |
|
139 |
|
|
140 |
public void setTitle(String nameTitle) { |
|
141 |
// TODO Auto-generated method stub |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
} |
|
0 | 146 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/test/PublicationProcessForTesting.java | ||
---|---|---|
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 |
/** |
|
23 |
* @author Jos? Vicente Hig?n (jvhigon@gvsig.org) |
|
24 |
*/ |
|
25 |
|
|
26 |
package org.gvsig.publish.test; |
|
27 |
|
|
28 |
import java.util.Properties; |
|
29 |
|
|
30 |
import org.gvsig.publish.serversmodel.PublicationProcess; |
|
31 |
|
|
32 |
public class PublicationProcessForTesting extends PublicationProcess { |
|
33 |
Properties state = new Properties(); |
|
34 |
public void run() { |
|
35 |
try { |
|
36 |
state.put(PublicationProcess.STATE_NAME, "Creando configuraci?n"); |
|
37 |
state.put(PublicationProcess.CURRENT_TASK_NAME, "Generando Mapfile"); |
|
38 |
state.put(PublicationProcess.PERCENTAGE, "25"); |
|
39 |
Thread.sleep(1000); |
|
40 |
setChanged(); |
|
41 |
notifyObservers(state); |
|
42 |
if (isCancelled()) return; |
|
43 |
|
|
44 |
state.put(PublicationProcess.STATE_NAME, "Sincronizando datos"); |
|
45 |
state.put(PublicationProcess.CURRENT_TASK_NAME, "Copiando fichero X"); |
|
46 |
state.put(PublicationProcess.PERCENTAGE, "50"); |
|
47 |
setChanged(); |
|
48 |
notifyObservers(state); |
|
49 |
Thread.sleep(1000); |
|
50 |
if (isCancelled()) return; |
|
51 |
|
|
52 |
state.put(PublicationProcess.STATE_NAME, "Sincronizando datos"); |
|
53 |
state.put(PublicationProcess.CURRENT_TASK_NAME, "Copiando fichero Y"); |
|
54 |
state.put(PublicationProcess.PERCENTAGE, "75"); |
|
55 |
setChanged(); |
|
56 |
notifyObservers(state); |
|
57 |
Thread.sleep(1000); |
|
58 |
if (isCancelled()) return; |
|
59 |
|
|
60 |
state.put(PublicationProcess.STATE_NAME, "Sincronizando datos"); |
|
61 |
state.put(PublicationProcess.CURRENT_TASK_NAME, "Copiando fichero Z"); |
|
62 |
state.put(PublicationProcess.PERCENTAGE, "100"); |
|
63 |
setChanged(); |
|
64 |
notifyObservers(state); |
|
65 |
Thread.sleep(1000); |
|
66 |
if (isCancelled()) return; |
|
67 |
|
|
68 |
|
|
69 |
} catch (InterruptedException e) { |
|
70 |
e.printStackTrace(); |
|
71 |
// TODO Auto-generated catch block |
|
72 |
//NotificationManager.showMessageError("Interrupcion en ..", e); |
|
73 |
}finally{ |
|
74 |
//setAlive(false); |
|
75 |
} |
|
76 |
} |
|
77 |
|
|
78 |
|
|
79 |
} |
|
0 | 80 |
1.X/tags/extremadura-iver/extPublish/src-test/org/gvsig/publish/test/VectorialFileForTesting.java | ||
---|---|---|
1 |
package org.gvsig.publish.test; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
import java.io.File; |
|
5 |
|
|
6 |
import org.gvsig.publish.infoproject.IDataSourceInfo; |
|
7 |
import org.gvsig.publish.infoproject.datasources.IFileInfo; |
|
8 |
|
|
9 |
public class VectorialFileForTesting implements IFileInfo, IDataSourceInfo{ |
|
10 |
|
|
11 |
public String[] getAbsolutePath() { |
|
12 |
// TODO Auto-generated method stub |
|
13 |
return null; |
|
14 |
} |
|
15 |
|
|
16 |
public String getExtension() { |
|
17 |
// TODO Auto-generated method stub |
|
18 |
return null; |
|
19 |
} |
|
20 |
|
|
21 |
public File getFile() { |
|
22 |
// TODO Auto-generated method stub |
|
23 |
return null; |
|
24 |
} |
|
25 |
|
|
26 |
public String[] getFileName() { |
|
27 |
String[]ret = new String[1]; |
|
28 |
ret[0] ="/home/jvhigon/carto/andalucia/carreteras.shp"; |
|
29 |
return ret; |
|
30 |
} |
|
31 |
|
|
32 |
public String getFilenameWithoutExtension() { |
|
33 |
// TODO Auto-generated method stub |
|
34 |
return null; |
|
35 |
} |
|
36 |
|
|
37 |
public String getEPSG() { |
|
38 |
// TODO Auto-generated method stub |
|
39 |
return null; |
|
40 |
} |
|
41 |
|
|
42 |
public String getGeomType() { |
|
43 |
// TODO Auto-generated method stub |
|
44 |
return null; |
|
45 |
} |
|
46 |
|
Also available in: Unified diff