Revision 29308

View differences:

trunk/extensions/extPublish/.cvsignore
1
bin
2
data
0 3

  
trunk/extensions/extPublish/.settings/org.eclipse.jdt.ui.prefs
1
#Tue Aug 22 08:25:46 CEST 2006
2
eclipse.preferences.version=1
3
internal.default.compliance=user
4
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
0 5

  
trunk/extensions/extPublish/.settings/org.eclipse.core.resources.prefs
1
#Fri May 18 09:28:51 CEST 2007
2
eclipse.preferences.version=1
3
encoding/<project>=ISO-8859-1
0 4

  
trunk/extensions/extPublish/.settings/org.eclipse.jdt.core.prefs
1
#Tue Aug 22 09:00:18 CEST 2006
2
eclipse.preferences.version=1
3
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
5
org.eclipse.jdt.core.compiler.compliance=1.4
6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
7
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
8
org.eclipse.jdt.core.compiler.source=1.4
0 9

  
trunk/extensions/extPublish/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
    <description>
3
        Instala el plugin en Andami
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="src" location="src"/>
7
	<property name="src-test" location="src-test"/>
8
  <property name="build" location="bin"/>
9
  <property name="dist"  location="dist"/>
10
<property name="dist-src" location="dist-src"/>
11
	<property name="build-doc" location="doc"/>
12
  <property name="mainplugin" value="com.iver.cit.gvsig"/>
13
  <property name="plugin" value="org.gvsig.publish"/>
14
  <property name="gvsiglibjar" value="gvsig-publish"/>
15
  <property name="fmapjar" value="fmap-wms"/>
16
  <property name="driverjar" value="confwms"/>
17
  <property name="extensionDir" location="../_fwAndami/gvSIG/extensiones"/>
18
  <property name="drivers-dir" location="${extensionDir}/${mainplugin}/drivers" />
19
  <!-- <property name="lib-dir" location="${extensionDir}/${mainplugin}/lib"/> -->
20
  <property name="fmap" location="../libFMap"/>
21
  <property name="andami" location="../_fwAndami"/>
22
	<property name="encoding" value="ISO-8859-1"/>
23
	
24
  <target name="init">
25
    <!-- Create the time stamp -->
26
    <tstamp/>
27
    <!-- Create the build directory structure used by compile -->
28
    <mkdir dir="${build}"/>
29
    <mkdir dir="${dist}"/>
30

  
31
  </target>
32
	
33
	
34
	  <target name="generate-source-package">
35
	  	<!-- Prepara un zip con los fuentes -->
36
	  	
37
	  	<delete dir="${dist-src}" quiet="yes"/>
38
	  	<mkdir dir="${dist-src}"/>
39
	  	<basename file="${basedir}" property="extensionProjectDir"/>
40
	  	<mkdir dir="${dist-src}/${extensionProjectDir}"/>
41
	    <copy todir="${dist-src}/${extensionProjectDir}">
42
	      <fileset dir="${basedir}"/>
43
	    </copy>
44
	  	<copy todir="${dist-src}">
45
	  		<fileset dir="${basedir}/install/resources" includes="Leeme-publish.txt, Readme-publish.txt"/>
46
	  	</copy>
47
	  	<delete dir="${dist-src}/${extensionProjectDir}/bin"/>
48
	  	<mkdir dir="${dist-src}/${extensionProjectDir}/bin"/>
49
	  <!--	<delete dir="${dist-src}/${extensionProjectDir}/src-test"/>
50
	  	<mkdir dir="${dist-src}/${extensionProjectDir}/src-test"/>
51
	  -->
52
	  	<delete dir="${dist-src}/${extensionProjectDir}/install"/>
53
	  	<delete dir="${dist-src}/${extensionProjectDir}/dist" quiet="yes"/>
54
	  	<delete dir="${dist-src}/${extensionProjectDir}/dist-src" quiet="yes"/>
55
	  	<delete dir="${dist-src}/${extensionProjectDir}/test-files" quiet="yes"/>
56
	  	<delete dir="${dist-src}/${extensionProjectDir}/test-file" quiet="yes"/>
57
	  	<loadproperties srcFile="build.number"/>
58
	  	<replace casesensitive="true"
59
	  	  	token="#build.number#"
60
	  		value="${build.number}"
61
	  		dir="${dist-src}"
62
	  		includes="Leeme-publish.txt, Readme-publish.txt"/>
63
	  	 <zip destfile="${dist-src}/gvSIG_extPublish-10_${build.number}-src.zip"
64
	  	       basedir="${dist-src}"
65
	  	       excludes="*.zip,**/.svn" />		
66
	  </target>
67

  
68

  
69
	  <target name="buildNumber">
70
		<propertyfile
71
				file="build.number"
72
				comment="Build Number for ANT. Do not edit!">
73
				<entry  key="build.number" default="0" type="int" operation="+"/>
74
		</propertyfile>
75
		<property file="build.number"/>
76
	  </target>
77
	
78
	
79
	  <target name="distribution"
80
		description="increment build number and generate the distribution without the source file"
81
		depends="buildNumber,generate-without-source">
82
	  </target>
83

  
84
	
85
	<target name="batch-build"
86
			description="compile the sources, create the jar file"
87
			depends="compile,generate-without-source">
88
	</target>
89
	
90
   <target name="compile"
91
	         description="compile the source" >
92
	     <!-- Compile the Java code from ${src} to ${bin} -->
93
	     <mkdir      dir="${build}" />
94
	     <javac      srcdir="${src}"
95
                  destdir="${build}"
96
   					classpath="${andami}/lib/log4j-1.2.8.jar:${andami}/andami.jar:${andami}/lib/beans.jar:${andami}/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar:${andami}/gvSIG/extensiones/com.iver.cit.gvsig/lib/fmap.jar:${andami}/lib/castor-0.9.5.3-xml.jar:${fmap}/lib/cms.jar:${fmap}/lib/driver-manager-1.1.jar"/>
97
  </target>
98
<!--	 			  classpath="${andami}/lib/log4j-1.2.8.jar:${andami}/andami.jar:${andami}/lib/beans.jar:${andami}/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar:${andami}/gvSIG/extensiones/com.iver.cit.gvsig/lib/fmap.jar:${andami}/lib/castor-0.9.5.3-xml.jar:${fmap}/lib/cms.jar:${fmap}/lib/driver-manager-1.1.jar:${andami}/lib/tempFileManager.jar:${andami}/lib/iver-utiles.jar:${fmap}/lib/kxml2.jar:${fmap}/lib/remote-clients.jar"/> -->
99
	
100
	
101
	
102
  <target name="generate-without-source"
103
          description="generate the distribution without the source file">
104
    <!-- Create the distribution directory -->
105
    <mkdir dir="${dist}"/>
106
    <copy todir="${build}/com/iver/cit/gvsig/gui/beans/images/">
107
      <fileset dir="images/" includes="*"/>
108
    </copy>
109

  
110
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
111
    <jar jarfile="${dist}/${plugin}.jar" basedir="${build}"
112
         />
113
    <!--          excludes="com/iver/cit/gvsig/fmap/drivers/wms/**" />-->
114
  <copy file="config/config.xml" todir="${dist}"/>
115
  	<copy file="config/about.htm" todir="${dist}"/>
116
  	<loadproperties srcFile="build.number"/>
117
  	<replace casesensitive="true"
118
  		file="${dist}/about.htm"
119
  	  	token="#build.number#"
120
  		value="${build.number}"/>
121
  	<copy file="build.number" todir="${dist}"/>
122

  
123
  <copy todir="${dist}">
124
    <fileset dir="config" includes="text*.properties"/>
125
  </copy>
126
  <copy todir="${dist}/images">
127
    <fileset dir="images/" includes="*"/>
128
  </copy>
129
 <!-- <copy todir="${lib-dir}">
130
    <fileset dir="./lib" includes="*.jar,*.zip"/>
131
    <fileset dir="." includes=".keystore"/>
132
  </copy>
133
  -->
134
  <move todir="${extensionDir}/${plugin}/">
135
    <fileset dir="${dist}" includes="**/**"/>
136
  </move>
137
</target>
138

  
139

  
140
  <target name="clean"
141
        description="clean up" >
142
    <!-- Delete the ${build} and ${dist} directory trees -->
143
    <delete dir="${dist}"/>
144
	<delete includeemptydirs="true" failonerror="no">
145
        <fileset dir="${build}" includes="**/*"/>
146
    </delete>
147
  </target>
148
	
149
	<target name="build-doc" depends="" description="Generates API documentation">
150
		<delete dir="${build-doc}" quiet="yes"/>
151
			  	<mkdir dir="${build-doc}"/>
152
			<javadoc
153
				packagenames="org.gvsig.publish.*"
154
				sourcepath="src"
155
				defaultexcludes="yes"
156
				destdir="${build-doc}/publish-api"
157
				encoding="${encoding}"
158
				windowtitle="publish API">
159
				
160
			</javadoc>
161
		</target>
162
	
163
</project>
164

  
0 165

  
trunk/extensions/extPublish/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="/_fwAndami"/>
5
	<classpathentry kind="src" path="/appgvSIG"/>
6
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7
	<classpathentry kind="src" path="/libFMap"/>
8
	<classpathentry kind="lib" path="/_fwAndami/lib/iver-utiles.jar" sourcepath="/libIverUtiles"/>
9
	<classpathentry kind="src" path="src-test"/>
10
	<classpathentry combineaccessrules="false" kind="src" path="/extJDBC"/>
11
	<classpathentry kind="lib" path="/libFMap/lib/driver-manager-1.1.jar" sourcepath="/libDriverManager"/>
12
	<classpathentry kind="lib" path="/libFMap/lib/gdbms-0.8-SNAPSHOT.jar" sourcepath="/libGDBMS"/>
13
	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
14
	<classpathentry kind="lib" path="/_fwAndami/lib/log4j-1.2.8.jar"/>
15
	<classpathentry kind="lib" path="/_fwAndami/lib/castor-0.9.5.3-xml.jar"/>
16
	<classpathentry combineaccessrules="false" kind="src" path="/libProjection"/>
17
	<classpathentry combineaccessrules="false" kind="src" path="/libExceptions"/>
18
	<classpathentry combineaccessrules="false" kind="src" path="/libRaster"/>
19
	<classpathentry combineaccessrules="false" kind="src" path="/extRasterTools-SE"/>
20
	<classpathentry combineaccessrules="false" kind="src" path="/libUIComponent"/>
21
	<classpathentry kind="output" path="bin"/>
22
</classpath>
0 23

  
trunk/extensions/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

  
trunk/extensions/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.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
}
0 225

  
trunk/extensions/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

  
trunk/extensions/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

  
trunk/extensions/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

  
trunk/extensions/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.util.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
		try {
96
			server.setServerURL(new URL("http://server"));
97
		} catch (MalformedURLException e) {
98
			fail("I can't set the server URL");
99
		}
100

  
101
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape());		
102
		
103
		//register service
104
		PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass());
105
		service = PublishRegister.register().getService(server, getServiceRegisterTag());
106
		assertNotNull(service);
107
		server.addService(service);
108
		//register remote resource
109
		PublishRegister.register().addRemoteResource(getServerRegisterTag(), getServiceRegisterTag(), getRemoteResourceRegisterTag(), getRemoteResourceClass());
110
		remote = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag());
111
		assertNotNull(remote);
112
		//init remote (I need to set the layerinfo before add the remote resource)
113
		
114
		IViewInfo[] views = proj.getViewsInfo();
115
		ILayerInfo[] layers = views[0].getLayers();		
116
		remote.setLayerInfo(layers[0]);
117
	}
118

  
119

  
120
	public void testGetRegisterTag() {
121
		assertNotNull(service.getRegisterTag());
122
	}
123

  
124
	public void testGetId() {
125
		assertNotNull(service.getId());
126
	}
127

  
128
	public void testGetFilter() {
129
		if (service.getFilter()==null){
130
			System.out.println("Service without filter");
131
		}
132
	}
133

  
134
	
135
	public void testGetServer() {
136
		assertNotNull(service.getServer());
137
	}
138

  
139
	public void testPublish() throws PublishException {
140
		service.publish();
141
	}
142

  
143
	public void testGetRemoteResourcesCount() {
144
		System.out.println(service.getRemoteResourcesCount());
145
	}
146

  
147
	public void testGetRemoteResource() throws InvalidRemoteResourceException {			
148
		service.addRemoteResource(remote);
149
		int c = service.getRemoteResourcesCount();
150
		assertEquals(remote, service.getRemoteResource(c-1));
151
	}
152

  
153
	public void testAddRemoteResource() throws InvalidRemoteResourceException {	
154
		int c = service.getRemoteResourcesCount();
155
		service.addRemoteResource(remote);
156
		assertEquals(c + 1, service.getRemoteResourcesCount());
157
	}
158

  
159
	public void testAddInfoIViewInfo() throws Exception {	
160
		ProjectView gvView = util.getView_shape();
161
		IViewInfo viewInfo = new ViewInfo(gvView,null);
162
		service.addInfo(viewInfo);
163
	}
164
	/**
165
	 * TODO: missing asserts
166
	 * @throws Exception
167
	 */
168
	public void testAddInfoILayerInfo() throws Exception {
169
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape());
170
		IViewInfo[] views = proj.getViewsInfo();
171
		ILayerInfo[] layers = views[0].getLayers();
172
		service.addInfo(layers[0]);				
173
	}
174

  
175
	public void testGetXMLEntity() {
176
		System.out.println(service.getXMLEntity().toString());
177
	}
178

  
179
	public void testSetXMLEntity() {
180
		XMLEntity xml = service.getXMLEntity();
181
		service.setXMLEntity(xml);
182
	}
183

  
184
	public void testRemoveRemoteResource() throws InvalidRemoteResourceException {
185

  
186
		int c = service.getRemoteResourcesCount();
187
		service.addRemoteResource(remote);
188
		service.removeRemoteResource(remote);
189
		assertEquals(c, service.getRemoteResourcesCount());
190
	}
191

  
192
	public void testRemove() {
193
		int c = server.getServicesCount();
194
		service.remove();
195
		assertEquals(c-1, server.getServicesCount());
196
	}
197

  
198
}
0 199

  
trunk/extensions/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.util.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
		try {
86
			server.setServerURL(new URL("http://server"));
87
		} catch (MalformedURLException e) {
88
			fail("I can't set the server URL");
89
		}
90

  
91
		assertNotNull(server);
92
		//register service
93
		PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass());
94
		service = PublishRegister.register().getService(server, getServiceRegisterTag());
95
		assertNotNull(service);
96
		server.addService(service);
97
		//register remote resource
98
		PublishRegister.register().addRemoteResource(getServerRegisterTag(), getServiceRegisterTag(), getRemoteResourceRegisterTag(), getRemoteResourceClass());
99
		parent = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag());
100
		assertNotNull(parent);
101
		child = PublishRegister.register().getRemoteResource(service, getRemoteResourceRegisterTag());
102
		assertNotNull(child);
103
		
104
		//init parent
105
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape());
106
		IViewInfo[] views = proj.getViewsInfo();
107
		ILayerInfo[] layers = views[0].getLayers();		
108
		parent.setLayerInfo(layers[0]);
109
		//I need to set the layerinfo before add the remote resource
110
		service.addRemoteResource(parent);
111
		
112
		//init child
113
		proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape());
114
		views = proj.getViewsInfo();
115
		layers = views[0].getLayers();		
116
		child.setLayerInfo(layers[1]);
117
	}
118
	
119
//	public abstract RemoteResource getRemoteResource();
120
//	public abstract RemoteResource getChild();
121
	
122
//	public void testRemoteResource() {
123
//		fail("Not yet implemented");
124
//	}
125

  
126
	public void testGetId() {
127
		assertNotNull(parent.getId());
128
	}
129

  
130
	public void testGetRegisterTag() {
131
		assertNotNull(parent.getRegisterTag());
132
	}
133

  
134
	public void testGetService() {
135
		assertNotNull(parent.getService());
136
	}
137

  
138
	public void testGetLayerInfo() { 
139
		assertNotNull(parent.getLayerInfo());
140
	}
141

  
142
	public void testGetChildsCount() {
143
		int c = parent.getChildsCount();
144
		parent.addChild(child);
145
		assertEquals(c+1, parent.getChildsCount());
146
	}
147

  
148
	public void testGetChild() {		
149
		int c = parent.getChildsCount();
150
		parent.addChild(child);
151
		assertEquals(child, parent.getChild(c));
152
	}
153

  
154
	public void testAddChild() {
155
		int c = parent.getChildsCount();
156
		parent.addChild(child);
157
		assertEquals(c+1, parent.getChildsCount());
158
	}
159

  
160
	public void testRemove() {
161
		RemoteResource r = parent;
162
		Service s = parent.getService();
163
		int c = s.getRemoteResourcesCount();
164
		r.remove();
165
		assertEquals(c-1, s.getRemoteResourcesCount());
166
	}
167

  
168
	public void testPublish() throws PublishException {
169
		parent.publish();
170
	}
171

  
172
	public void testSetLayerInfo() throws Exception {
173
		LocalResourcesTestUtilities util = new LocalResourcesTestUtilities();
174
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_shape());
175
		IViewInfo[] views = proj.getViewsInfo();
176
		ILayerInfo[] layers = views[0].getLayers();		
177
		parent.setLayerInfo(layers[0]);
178
		assertEquals(layers[0].getName(),parent.getLayerInfo().getName());
179
	}
180

  
181
	public void testGetXMLEntity() {
182
		assertNotNull(parent.getXMLEntity());
183
	}
184

  
185
	public void testSetXMLEntity() {
186
		XMLEntity xml = parent.getXMLEntity();
187
		parent.setXMLEntity(xml);
188
		//assertEquals(xml, parent.getXMLEntity());
189
	}
190

  
191
}
0 192

  
trunk/extensions/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.util.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
		try {
79
			server.setServerURL(new URL("http://server"));
80
		} catch (MalformedURLException e) {
81
			fail("I can't set the server URL");
82
		}
83
		assertNotNull(server);
84
		//register service
85
		PublishRegister.register().addService(getServerRegisterTag(),getServiceRegisterTag(), getServiceClass());
86
		service = PublishRegister.register().getService(server, getServiceRegisterTag());
87
		assertNotNull(service);
88
	}
89
	public void testGetId() {
90
		assertNotNull(server.getId());
91
	}
92

  
93
	public void testGetRegisterTag(){
94
		assertNotNull(server.getRegisterTag());
95
	}
96

  
97
	public void testAddInfoIViewInfo() throws Exception {
98
		LocalResourcesTestUtilities util = new LocalResourcesTestUtilities();
99
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete());
100
		IViewInfo[] views = proj.getViewsInfo();
101
		for (int i = 0; i < views.length; i++ ){
102
			server.addInfo(views[i]);
103
		}		
104
	}
105

  
106
	public void testAddInfoILayerInfo() throws Exception {
107
		LocalResourcesTestUtilities util = new LocalResourcesTestUtilities();
108
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete());
109
		IViewInfo[] views = proj.getViewsInfo();
110
		for (int i = 0; i < views.length; i++ ){
111
			ILayerInfo[] layers = views[i].getLayers();
112
			for (int j = 0; j < layers.length; j++){
113
				server.addInfo(layers[j]);
114
			}
115
		}		
116
	}
117

  
118
	public void testGetServiceString() {
119
		server.addService(service);
120
		assertEquals(service,server.getService(service.getId()));
121
	}
122

  
123
	public void testAddService(){
124
		int c = server.getServicesCount();
125
		server.addService(service);		
126
		assertEquals(c + 1, server.getServicesCount());
127
		for (int i = 0; i < server.getServicesCount(); i ++){
128
			assertNotNull(server.getService(i));
129
		}		
130
	}
131

  
132
	public void testPublish() throws Exception {
133
		LocalResourcesTestUtilities util = new LocalResourcesTestUtilities();
134
		IProjectInfo proj = ProjectInfoFactory.getProjectInfo(util.getProject_complete());
135
		IViewInfo[] views = proj.getViewsInfo();
136
		for (int i = 0; i < views.length; i++){
137
			server.addInfo(views[i]);;
138
		}		
139
		server.publish();
140
	}
141

  
142
//	public void testPostInitialize() {
143
//		fail("Not yet implemented");
144
//	}
145

  
146
	public void testGetServerURL() throws MalformedURLException {
147
		URL url = new URL("http://server.com/service");
148
		server.setServerURL(url);
149
		assertNotNull(server.getServerURL());
150
	}
151

  
152
	public void testSetServerURL() throws MalformedURLException {
153
		URL url = new URL("http://server.com/service");
154
		server.setServerURL(url);
155
	}
156

  
157
	public void testGetXMLEntity() throws MalformedURLException {
158
		URL url = new URL("http://server.com/service");
159
		server.setServerURL(url);
160
		assertNotNull(server.getXMLEntity());		
161
	}
162

  
163
	public void testSetXMLEntity() throws MalformedURLException {
164
		URL url = new URL("http://server.com/service");
165
		server.setServerURL(url);
166
		XMLEntity xml = server.getXMLEntity();
167
		server.setXMLEntity(xml);
168
	}
169

  
170
	public void testRemoveService() {
171
		int c = server.getServicesCount();		
172
		server.addService(service);
173
		server.removeService(service);
174
		assertEquals(c, server.getServicesCount());
175
	}
176

  
177
}
0 178

  
trunk/extensions/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();
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

  
trunk/extensions/extPublish/src-test/org/gvsig/publish/util/test_LocalResourcesTestUtilities.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
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff