Revision 25156
tags/tmp_build/libraries/libGPE/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|
2 |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
4 |
<modelVersion>4.0.0</modelVersion> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>libGPE</artifactId> |
|
7 |
<packaging>jar</packaging> |
|
8 |
<version>1.0-SNAPSHOT</version> |
|
9 |
<name>libGPE</name> |
|
10 |
<url>http://gvsig.org</url> |
|
11 |
<parent> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>gvsig-library-base-pom</artifactId> |
|
14 |
<version>1.0-SNAPSHOT</version> |
|
15 |
</parent> |
|
16 |
<dependencies> |
|
17 |
<dependency> |
|
18 |
<groupId>org.gvsig</groupId> |
|
19 |
<artifactId>libExceptions</artifactId> |
|
20 |
<version>1.0-SNAPSHOT</version> |
|
21 |
</dependency> |
|
22 |
</dependencies> |
|
23 |
<build> |
|
24 |
<sourceDirectory>src</sourceDirectory> |
|
25 |
<testSourceDirectory>src-test</testSourceDirectory> |
|
26 |
</build> |
|
27 |
</project> |
tags/tmp_build/libraries/libGPE/.settings/org.eclipse.jdt.core.prefs | ||
---|---|---|
1 |
#Tue Feb 05 17:22:44 CET 2008 |
|
2 |
eclipse.preferences.version=1 |
|
3 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
4 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 |
|
5 |
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve |
|
6 |
org.eclipse.jdt.core.compiler.compliance=1.4 |
|
7 |
org.eclipse.jdt.core.compiler.debug.lineNumber=generate |
|
8 |
org.eclipse.jdt.core.compiler.debug.localVariable=generate |
|
9 |
org.eclipse.jdt.core.compiler.debug.sourceFile=generate |
|
10 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning |
|
11 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning |
|
12 |
org.eclipse.jdt.core.compiler.source=1.3 |
|
0 | 13 |
tags/tmp_build/libraries/libGPE/build.xml | ||
---|---|---|
1 |
<project name="libGPE" default="create-jar" basedir="."> |
|
2 |
<!-- set global properties for this build --> |
|
3 |
<property name="src" location="src"/> |
|
4 |
<property name="build" location="bin"/> |
|
5 |
<property name="targetDir" location="dist"/> |
|
6 |
<property name="gpeLibs" location="lib" /> |
|
7 |
<property name="schemaJarName" value="org.gvsig.xmlschema"/> |
|
8 |
<property name="resources" location="../resources/jars" /> |
|
9 |
<property name="gpeJarName" value="org.gvsig.gpe"/> |
|
10 |
<property name="compile-classpath" value="" /> |
|
11 |
|
|
12 |
<target name="init"> |
|
13 |
<!-- Create the time stamp --> |
|
14 |
<tstamp/> |
|
15 |
<echo> |
|
16 |
Compiling ${ant.project.name}...</echo> |
|
17 |
</target> |
|
18 |
|
|
19 |
<target name="batch-build" |
|
20 |
description="compile the sources, create the jar file" |
|
21 |
depends="init,compile,create-jar"> |
|
22 |
</target> |
|
23 |
|
|
24 |
<target name="compile" description="compile the source"> |
|
25 |
<!-- Compile the Java code from ${src} to ${build} --> |
|
26 |
<mkdir dir="${build}" /> |
|
27 |
<javac srcdir="${src}" |
|
28 |
destdir="${build}" |
|
29 |
source="1.4" |
|
30 |
target="1.4" |
|
31 |
debug="${debug}" |
|
32 |
debuglevel="${debuglevel}" |
|
33 |
classpath="${compile-classpath}"/> |
|
34 |
<!-- copy any images or resources present in the src dir --> |
|
35 |
<copy todir="${build}"> |
|
36 |
<fileset dir="${src}" excludes="**/*.java" casesensitive="false"/> |
|
37 |
</copy> |
|
38 |
</target> |
|
39 |
|
|
40 |
<target name="create-jar" description="Crea el jar de la aplicacion"> |
|
41 |
<mkdir dir="${targetDir}" /> |
|
42 |
<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="${build}" includes="org/gvsig/gpe/**"/> |
|
43 |
<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="." includes="build.number" update="true"/> |
|
44 |
<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="${build}" includes="org/gvsig/xmlschema/**"/> |
|
45 |
<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="${build}" includes="javax/xml/namespace/**" update="true"/> |
|
46 |
<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="." includes="build.number" update="true"/> |
|
47 |
<move todir="${gpeLibs}"> |
|
48 |
<fileset dir="${targetDir}" includes="*.jar" /> |
|
49 |
</move> |
|
50 |
<delete dir="${targetDir}"/> |
|
51 |
</target> |
|
52 |
|
|
53 |
<target name="create-mobile-jar" description="Crea el jar de la aplicacion"> |
|
54 |
<mkdir dir="${targetDir}" /> |
|
55 |
<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="${build}" includes="org/gvsig/gpe/**"/> |
|
56 |
<jar jarfile="${targetDir}/${gpeJarName}.jar" basedir="." includes="build.number" update="true"/> |
|
57 |
<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="${build}" includes="org/gvsig/xmlschema/**"/> |
|
58 |
<jar jarfile="${targetDir}/${schemaJarName}.jar" basedir="." includes="build.number" update="true"/> |
|
59 |
<move todir="${gpeLibs}"> |
|
60 |
<fileset dir="${targetDir}" includes="*.jar" /> |
|
61 |
</move> |
|
62 |
<copy todir="${resources}/libGPE" file="${gpeLibs}/org.gvsig.gpe.jar"/> |
|
63 |
<copy todir="${resources}/libGPE" file="${gpeLibs}/org.gvsig.xmlschema.jar"/> |
|
64 |
<delete dir="${targetDir}"/> |
|
65 |
</target> |
|
66 |
|
|
67 |
<target name="clean" description="clean up"> |
|
68 |
<!-- Delete the ${build} and ${dist} directory trees --> |
|
69 |
<delete dir="${build}" /> |
|
70 |
<delete dir="${targetDir}" /> |
|
71 |
</target> |
|
72 |
|
|
73 |
</project> |
|
0 | 74 |
tags/tmp_build/libraries/libGPE/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="src" path="src-test"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> |
|
6 |
<classpathentry kind="lib" path="lib/gvsig-exceptions.jar"/> |
|
7 |
<classpathentry kind="var" path="JUNIT_HOME/junit.jar"/> |
|
8 |
<classpathentry kind="output" path="bin"/> |
|
9 |
</classpath> |
|
0 | 10 |
tags/tmp_build/libraries/libGPE/.umlproject | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ASCII"?> |
|
2 |
<properties:ProjectDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:properties="properties.xmi" modelDir="model" libraryDir="libraries" profileDir="profiles" templateDir="templates"> |
|
3 |
<profiles id="org.eclipse.uml2.resources.UML2Profile" description="Basic Profile" uri="platform:/plugin/org.eclipse.uml2.uml.resources/profiles/UML2.profile.uml" exported="false" kind="system"/> |
|
4 |
<profiles id="org.eclipse.uml2.resources.StandardProfile" description="Complete Profile" uri="platform:/plugin/org.eclipse.uml2.uml.resources/profiles/Standard.profile.uml" exported="false" kind="system"/> |
|
5 |
<profiles id="com.omondo.uml.core.JavaProfile" description="Java Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Java.profile.uml" exported="false" kind="system"/> |
|
6 |
<profiles id="com.omondo.uml2.core.OmondoProfile" description="Omondo Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo.profile.uml" exported="false" kind="system"/> |
|
7 |
<profiles id="com.omondo.uml2.core.ArchetypeProfile" description="Archetype Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Archetype.profile.uml" exported="false" kind="system"/> |
|
8 |
<profiles id="com.omondo.uml2.core.MetaProfile" description="Meta Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Meta.profile.uml" exported="false" kind="system"/> |
|
9 |
<profiles id="com.omondo.32SN.Common" description="Omondo Common Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Common_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
10 |
<profiles id="com.omondo.32SN.Meta" description="Omondo META Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Meta_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
11 |
<profiles id="com.omondo.32SN.Persistence" description="Omondo Persistence Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Persistence_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
12 |
<profiles id="com.omondo.32SN.Presentation" description="Omondo Presentation Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Presentation_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
13 |
<profiles id="com.omondo.32SN.Process" description="Omondo Process Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Process_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
14 |
<profiles id="com.omondo.32SN.Service" description="Omondo Service Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Service_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
15 |
<profiles id="com.omondo.32SN.Webservice" description="Omondo Webservice Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Webservice_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
16 |
<profiles id="com.omondo.32SN.Xml" description="Omondo XML Profile" uri="platform:/plugin/com.omondo.uml.core/profiles/Omondo_Xml_3.2_SN.profile.uml" exported="false" kind="system"/> |
|
17 |
</properties:ProjectDescription> |
tags/tmp_build/libraries/libGPE/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>libGPE</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 |
<buildCommand> |
|
14 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
21 |
</natures> |
|
22 |
</projectDescription> |
|
0 | 23 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/AllSchemaTests.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
import org.gvsig.xmlschema.reader.AllReadingTests; |
|
7 |
import org.gvsig.xmlschema.writer.AllWriting; |
|
8 |
|
|
9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
10 |
* |
|
11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
12 |
* |
|
13 |
* This program is free software; you can redistribute it and/or |
|
14 |
* modify it under the terms of the GNU General Public License |
|
15 |
* as published by the Free Software Foundation; either version 2 |
|
16 |
* of the License, or (at your option) any later version. |
|
17 |
* |
|
18 |
* This program is distributed in the hope that it will be useful, |
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
* GNU General Public License for more details. |
|
22 |
* |
|
23 |
* You should have received a copy of the GNU General Public License |
|
24 |
* along with this program; if not, write to the Free Software |
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
26 |
* |
|
27 |
* For more information, contact: |
|
28 |
* |
|
29 |
* Generalitat Valenciana |
|
30 |
* Conselleria d'Infraestructures i Transport |
|
31 |
* Av. Blasco Ib??ez, 50 |
|
32 |
* 46010 VALENCIA |
|
33 |
* SPAIN |
|
34 |
* |
|
35 |
* +34 963862235 |
|
36 |
* gvsig@gva.es |
|
37 |
* www.gvsig.gva.es |
|
38 |
* |
|
39 |
* or |
|
40 |
* |
|
41 |
* IVER T.I. S.A |
|
42 |
* Salamanca 50 |
|
43 |
* 46005 Valencia |
|
44 |
* Spain |
|
45 |
* |
|
46 |
* +34 963163400 |
|
47 |
* dac@iver.es |
|
48 |
*/ |
|
49 |
/* CVS MESSAGES: |
|
50 |
* |
|
51 |
* $Id: AllSchemaTests.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
52 |
* $Log$ |
|
53 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
54 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
55 |
* |
|
56 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
57 |
* The schema jar name has been changed |
|
58 |
* |
|
59 |
* Revision 1.1 2007/06/08 07:31:20 jorpiell |
|
60 |
* Add the euroRoadS test |
|
61 |
* |
|
62 |
* |
|
63 |
*/ |
|
64 |
/** |
|
65 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
66 |
*/ |
|
67 |
public class AllSchemaTests { |
|
68 |
|
|
69 |
public static Test suite() { |
|
70 |
TestSuite suite = new TestSuite("Test for org.gvsig.gpe.schema"); |
|
71 |
//$JUnit-BEGIN$ |
|
72 |
suite.addTest(AllReadingTests.suite()); |
|
73 |
suite.addTest(AllWriting.suite()); |
|
74 |
//$JUnit-END$ |
|
75 |
return suite; |
|
76 |
} |
|
77 |
|
|
78 |
} |
|
0 | 79 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/SequenceWrittingTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import java.util.Iterator; |
|
4 |
|
|
5 |
import org.gvsig.xmlschema.som.IXSComplexTypeDefinition; |
|
6 |
import org.gvsig.xmlschema.som.IXSContentType; |
|
7 |
import org.gvsig.xmlschema.som.IXSSequence; |
|
8 |
import org.gvsig.xmlschema.som.IXSTypeDefinition; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id: SequenceWrittingTest.java 161 2007-06-28 13:05:27Z jorpiell $ |
|
53 |
* $Log$ |
|
54 |
* Revision 1.3 2007/06/28 13:04:33 jorpiell |
|
55 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class |
|
56 |
* |
|
57 |
* Revision 1.2 2007/06/22 12:21:18 jorpiell |
|
58 |
* The typeNotFoundException has been deleted. It never was thrown |
|
59 |
* |
|
60 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
61 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
62 |
* |
|
63 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
64 |
* The schema jar name has been changed |
|
65 |
* |
|
66 |
* Revision 1.3 2007/06/08 11:35:16 jorpiell |
|
67 |
* IXSSchema interface updated |
|
68 |
* |
|
69 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
70 |
* Add the schema support |
|
71 |
* |
|
72 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
73 |
* Add the element collection |
|
74 |
* |
|
75 |
* |
|
76 |
*/ |
|
77 |
/** |
|
78 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
79 |
*/ |
|
80 |
public class SequenceWrittingTest extends WriterBaseTest { |
|
81 |
private String typeName1 = "river_type"; |
|
82 |
private String typeType1 = IXSComplexTypeDefinition.SEQUENCE; |
|
83 |
private String contentType1 = IXSContentType.WITOUT_CONTENT; |
|
84 |
private String contentRestriction1 = IXSContentType.WITOUT_RESTRICTION; |
|
85 |
private String type1ElementName1 = "length"; |
|
86 |
private String type1ElementType1 = "xs:double"; |
|
87 |
private String type1ElementName2 = "name"; |
|
88 |
private String type1ElementType2 = "xs:string"; |
|
89 |
|
|
90 |
/* |
|
91 |
* (non-Javadoc) |
|
92 |
* @see org.gvsig.gpe.schema.writer.WriterBaseTest#readSchema() |
|
93 |
*/ |
|
94 |
public void readSchema(){ |
|
95 |
IXSTypeDefinition type = getSchema().getTypeByName(getNamespaceURI(), typeName1); |
|
96 |
assertNotNull(type); |
|
97 |
assertEquals(type.getQName().getLocalPart(), typeName1); |
|
98 |
IXSComplexTypeDefinition cType = (IXSComplexTypeDefinition)type; |
|
99 |
Iterator it = cType.getItems().iterator(); |
|
100 |
IXSSequence sequence = null; |
|
101 |
while (it.hasNext()){ |
|
102 |
sequence = (IXSSequence) it.next(); |
|
103 |
} |
|
104 |
assertNotNull(sequence); |
|
105 |
} |
|
106 |
|
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* @see org.gvsig.gpe.schema.writer.WriterBaseTest#writeSchema() |
|
110 |
*/ |
|
111 |
public void writeSchema() { |
|
112 |
IXSComplexTypeDefinition complexType = getSchema().addComplexType( |
|
113 |
typeName1, typeType1, contentType1, contentRestriction1); |
|
114 |
complexType.addElement( |
|
115 |
type1ElementName1, |
|
116 |
type1ElementType1); |
|
117 |
complexType.addElement( |
|
118 |
type1ElementName2, |
|
119 |
type1ElementType2); |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
0 | 123 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/WriterBaseTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.FileInputStream; |
|
5 |
import java.io.FileOutputStream; |
|
6 |
import java.io.IOException; |
|
7 |
|
|
8 |
import javax.xml.parsers.ParserConfigurationException; |
|
9 |
|
|
10 |
import junit.framework.TestCase; |
|
11 |
|
|
12 |
import org.gvsig.xmlschema.exceptions.SchemaCreationException; |
|
13 |
import org.gvsig.xmlschema.exceptions.SchemaWrittingException; |
|
14 |
import org.gvsig.xmlschema.som.IXSSchema; |
|
15 |
import org.gvsig.xmlschema.utils.DOMObjectsFactory; |
|
16 |
import org.gvsig.xmlschema.utils.SchemaDocumentBuilder; |
|
17 |
import org.xml.sax.SAXException; |
|
18 |
|
|
19 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
20 |
* |
|
21 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
22 |
* |
|
23 |
* This program is free software; you can redistribute it and/or |
|
24 |
* modify it under the terms of the GNU General Public License |
|
25 |
* as published by the Free Software Foundation; either version 2 |
|
26 |
* of the License, or (at your option) any later version. |
|
27 |
* |
|
28 |
* This program is distributed in the hope that it will be useful, |
|
29 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
30 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
31 |
* GNU General Public License for more details. |
|
32 |
* |
|
33 |
* You should have received a copy of the GNU General Public License |
|
34 |
* along with this program; if not, write to the Free Software |
|
35 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
36 |
* |
|
37 |
* For more information, contact: |
|
38 |
* |
|
39 |
* Generalitat Valenciana |
|
40 |
* Conselleria d'Infraestructures i Transport |
|
41 |
* Av. Blasco Ib??ez, 50 |
|
42 |
* 46010 VALENCIA |
|
43 |
* SPAIN |
|
44 |
* |
|
45 |
* +34 963862235 |
|
46 |
* gvsig@gva.es |
|
47 |
* www.gvsig.gva.es |
|
48 |
* |
|
49 |
* or |
|
50 |
* |
|
51 |
* IVER T.I. S.A |
|
52 |
* Salamanca 50 |
|
53 |
* 46005 Valencia |
|
54 |
* Spain |
|
55 |
* |
|
56 |
* +34 963163400 |
|
57 |
* dac@iver.es |
|
58 |
*/ |
|
59 |
/* CVS MESSAGES: |
|
60 |
* |
|
61 |
* $Id: WriterBaseTest.java 164 2007-07-02 10:00:46Z jorpiell $ |
|
62 |
* $Log$ |
|
63 |
* Revision 1.3 2007/07/02 09:59:03 jorpiell |
|
64 |
* The generated xsd schemas have to be valid |
|
65 |
* |
|
66 |
* Revision 1.2 2007/06/22 12:21:18 jorpiell |
|
67 |
* The typeNotFoundException has been deleted. It never was thrown |
|
68 |
* |
|
69 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
70 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
71 |
* |
|
72 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
73 |
* The schema jar name has been changed |
|
74 |
* |
|
75 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
76 |
* Add the schema support |
|
77 |
* |
|
78 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
79 |
* Add the element collection |
|
80 |
* |
|
81 |
* |
|
82 |
*/ |
|
83 |
/** |
|
84 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
85 |
*/ |
|
86 |
public abstract class WriterBaseTest extends TestCase { |
|
87 |
private IXSSchema schema = null; |
|
88 |
private String fileName = "FILETEMP.xsd"; |
|
89 |
private SchemaDocumentBuilder documentBuilder = null; |
|
90 |
private DOMObjectsFactory elementsFactory = null; |
|
91 |
|
|
92 |
/** |
|
93 |
* @return the documentBuilder |
|
94 |
*/ |
|
95 |
public SchemaDocumentBuilder getDocumentBuilder() { |
|
96 |
return documentBuilder; |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* @return the elementsFactory |
|
101 |
*/ |
|
102 |
public DOMObjectsFactory getElementsFactory() { |
|
103 |
return elementsFactory; |
|
104 |
} |
|
105 |
|
|
106 |
public void setUp() throws SchemaCreationException{ |
|
107 |
documentBuilder = SchemaDocumentBuilder.getInstance(); |
|
108 |
schema = documentBuilder.createXSSchema(getNamespaceURI(),getNamespacePrefix()); |
|
109 |
elementsFactory = DOMObjectsFactory.getInstance(); |
|
110 |
} |
|
111 |
|
|
112 |
public void tearDown() throws Exception{ |
|
113 |
new File(fileName).delete(); |
|
114 |
} |
|
115 |
|
|
116 |
public void testCompare() throws SchemaWrittingException, ParserConfigurationException, SAXException, IOException, SchemaCreationException{ |
|
117 |
writeSchema(); |
|
118 |
schema.write(new FileOutputStream(fileName)); |
|
119 |
schema = SchemaDocumentBuilder.getInstance().parse(new FileInputStream(fileName)); |
|
120 |
readSchema(); |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* @return the schema |
|
125 |
*/ |
|
126 |
public IXSSchema getSchema() { |
|
127 |
return schema; |
|
128 |
} |
|
129 |
|
|
130 |
public String getNamespaceURI(){ |
|
131 |
return "http://www.gvsig.org/cit"; |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* Gets the namespace prefix |
|
136 |
* @return |
|
137 |
*/ |
|
138 |
public String getNamespacePrefix(){ |
|
139 |
return "cit"; |
|
140 |
} |
|
141 |
|
|
142 |
public abstract void writeSchema(); |
|
143 |
|
|
144 |
public abstract void readSchema(); |
|
145 |
|
|
146 |
|
|
147 |
} |
|
0 | 148 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/ElementWithComplexTypesWrittingTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import org.gvsig.xmlschema.som.IXSComplexContent; |
|
4 |
import org.gvsig.xmlschema.som.IXSComplexTypeDefinition; |
|
5 |
import org.gvsig.xmlschema.som.IXSContentType; |
|
6 |
import org.gvsig.xmlschema.som.IXSElementDeclaration; |
|
7 |
|
|
8 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
9 |
* |
|
10 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
11 |
* |
|
12 |
* This program is free software; you can redistribute it and/or |
|
13 |
* modify it under the terms of the GNU General Public License |
|
14 |
* as published by the Free Software Foundation; either version 2 |
|
15 |
* of the License, or (at your option) any later version. |
|
16 |
* |
|
17 |
* This program is distributed in the hope that it will be useful, |
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
* GNU General Public License for more details. |
|
21 |
* |
|
22 |
* You should have received a copy of the GNU General Public License |
|
23 |
* along with this program; if not, write to the Free Software |
|
24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
25 |
* |
|
26 |
* For more information, contact: |
|
27 |
* |
|
28 |
* Generalitat Valenciana |
|
29 |
* Conselleria d'Infraestructures i Transport |
|
30 |
* Av. Blasco Ib??ez, 50 |
|
31 |
* 46010 VALENCIA |
|
32 |
* SPAIN |
|
33 |
* |
|
34 |
* +34 963862235 |
|
35 |
* gvsig@gva.es |
|
36 |
* www.gvsig.gva.es |
|
37 |
* |
|
38 |
* or |
|
39 |
* |
|
40 |
* IVER T.I. S.A |
|
41 |
* Salamanca 50 |
|
42 |
* 46005 Valencia |
|
43 |
* Spain |
|
44 |
* |
|
45 |
* +34 963163400 |
|
46 |
* dac@iver.es |
|
47 |
*/ |
|
48 |
/* CVS MESSAGES: |
|
49 |
* |
|
50 |
* $Id: ElementWithComplexTypesWrittingTest.java 164 2007-07-02 10:00:46Z jorpiell $ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.4 2007/07/02 09:59:03 jorpiell |
|
53 |
* The generated xsd schemas have to be valid |
|
54 |
* |
|
55 |
* Revision 1.3 2007/06/28 13:04:33 jorpiell |
|
56 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class |
|
57 |
* |
|
58 |
* Revision 1.2 2007/06/22 12:21:18 jorpiell |
|
59 |
* The typeNotFoundException has been deleted. It never was thrown |
|
60 |
* |
|
61 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
62 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
63 |
* |
|
64 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
65 |
* The schema jar name has been changed |
|
66 |
* |
|
67 |
* Revision 1.3 2007/06/08 11:35:16 jorpiell |
|
68 |
* IXSSchema interface updated |
|
69 |
* |
|
70 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
71 |
* Add the schema support |
|
72 |
* |
|
73 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
74 |
* Add the element collection |
|
75 |
* |
|
76 |
* |
|
77 |
*/ |
|
78 |
/** |
|
79 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
80 |
*/ |
|
81 |
public class ElementWithComplexTypesWrittingTest extends WriterBaseTest { |
|
82 |
private String elementName1 = "people"; |
|
83 |
private String elementType1 = "people_type"; |
|
84 |
//People |
|
85 |
private String typeName1 = "people_type"; |
|
86 |
private String typeType1 = IXSComplexTypeDefinition.SEQUENCE; |
|
87 |
private String contentType1 = IXSContentType.COMPLEX_CONTENT; |
|
88 |
private String contentRestriction1 = IXSContentType.EXTENSION; |
|
89 |
private String type11ElementName = "name"; |
|
90 |
private String type11ElementType = null; |
|
91 |
private String type12ElementName = "age"; |
|
92 |
private String type12ElementType = "xs:integer"; |
|
93 |
private String type13ElementName = "address"; |
|
94 |
private String type13ElementType = null; |
|
95 |
//Name |
|
96 |
private String typeType11 = IXSComplexTypeDefinition.SEQUENCE; |
|
97 |
private String contentType11 = IXSContentType.WITOUT_CONTENT; |
|
98 |
private String contentRestriction11 = IXSContentType.WITOUT_RESTRICTION; |
|
99 |
private String type111ElementName = "first name"; |
|
100 |
private String type111ElementType = "xs:string"; |
|
101 |
private String type112ElementName = "second name"; |
|
102 |
private String type112ElementType = "xs:string"; |
|
103 |
//Address |
|
104 |
private String typeType13 = IXSComplexTypeDefinition.SEQUENCE; |
|
105 |
private String contentType13 = IXSContentType.WITOUT_CONTENT; |
|
106 |
private String contentRestriction13 = IXSContentType.WITOUT_RESTRICTION; |
|
107 |
private String type131ElementName = "street"; |
|
108 |
private String type131ElementType = "xs:string"; |
|
109 |
private String type132ElementName = "number"; |
|
110 |
private String type132ElementType = "xs:integer"; |
|
111 |
private String type133ElementName = "city"; |
|
112 |
private String type133ElementType = "xs:string"; |
|
113 |
private String type134ElementName = "postal code"; |
|
114 |
private String type134ElementType = "xs:integer"; |
|
115 |
|
|
116 |
public void readSchema() { |
|
117 |
IXSElementDeclaration element = getSchema().getElementDeclarationByName(getNamespaceURI(), elementName1); |
|
118 |
assertNotNull(element); |
|
119 |
assertEquals(element.getQName().getLocalPart(), elementName1); |
|
120 |
assertTrue(element.getTypeDefinition() instanceof IXSComplexTypeDefinition); |
|
121 |
IXSComplexTypeDefinition type = (IXSComplexTypeDefinition)element.getTypeDefinition(); |
|
122 |
assertTrue(type.getContentType() instanceof IXSComplexContent); |
|
123 |
IXSComplexContent content = (IXSComplexContent)type.getContentType(); |
|
124 |
assertTrue(content.getExtension() != null); |
|
125 |
} |
|
126 |
|
|
127 |
public void writeSchema() { |
|
128 |
//Add the element |
|
129 |
IXSElementDeclaration element1 = getSchema().addElement( |
|
130 |
elementName1, |
|
131 |
elementType1); |
|
132 |
|
|
133 |
IXSComplexTypeDefinition complexType = element1.addComplexType( |
|
134 |
typeType1, contentType1, contentRestriction1); |
|
135 |
IXSElementDeclaration element11 = complexType.addElement( |
|
136 |
type11ElementName, |
|
137 |
type11ElementType); |
|
138 |
IXSElementDeclaration element12 = complexType.addElement( |
|
139 |
type12ElementName, |
|
140 |
type12ElementType); |
|
141 |
IXSElementDeclaration element13 = complexType.addElement( |
|
142 |
type13ElementName, |
|
143 |
type13ElementType); |
|
144 |
|
|
145 |
IXSComplexTypeDefinition eComplex11 = element11.addComplexType(typeType11, |
|
146 |
contentType11, |
|
147 |
contentRestriction11); |
|
148 |
eComplex11.addElement(type111ElementName, |
|
149 |
type111ElementType); |
|
150 |
eComplex11.addElement(type112ElementName, |
|
151 |
type112ElementType); |
|
152 |
|
|
153 |
IXSComplexTypeDefinition eComplex13 = element13.addComplexType(typeType13, |
|
154 |
contentType13, |
|
155 |
contentRestriction13); |
|
156 |
eComplex13.addElement(type131ElementName, |
|
157 |
type131ElementType); |
|
158 |
eComplex13.addElement(type132ElementName, |
|
159 |
type132ElementType); |
|
160 |
eComplex13.addElement(type133ElementName, |
|
161 |
type133ElementType); |
|
162 |
eComplex13.addElement(type134ElementName, |
|
163 |
type134ElementType); |
|
164 |
} |
|
165 |
|
|
166 |
} |
|
0 | 167 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/AllWriting.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
7 |
* |
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
23 |
* |
|
24 |
* For more information, contact: |
|
25 |
* |
|
26 |
* Generalitat Valenciana |
|
27 |
* Conselleria d'Infraestructures i Transport |
|
28 |
* Av. Blasco Ib??ez, 50 |
|
29 |
* 46010 VALENCIA |
|
30 |
* SPAIN |
|
31 |
* |
|
32 |
* +34 963862235 |
|
33 |
* gvsig@gva.es |
|
34 |
* www.gvsig.gva.es |
|
35 |
* |
|
36 |
* or |
|
37 |
* |
|
38 |
* IVER T.I. S.A |
|
39 |
* Salamanca 50 |
|
40 |
* 46005 Valencia |
|
41 |
* Spain |
|
42 |
* |
|
43 |
* +34 963163400 |
|
44 |
* dac@iver.es |
|
45 |
*/ |
|
46 |
/* CVS MESSAGES: |
|
47 |
* |
|
48 |
* $Id: AllWriting.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
49 |
* $Log$ |
|
50 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
51 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
52 |
* |
|
53 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
54 |
* The schema jar name has been changed |
|
55 |
* |
|
56 |
* Revision 1.1 2007/06/08 07:31:20 jorpiell |
|
57 |
* Add the euroRoadS test |
|
58 |
* |
|
59 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
60 |
* Add the schema support |
|
61 |
* |
|
62 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
63 |
* Add the element collection |
|
64 |
* |
|
65 |
* |
|
66 |
*/ |
|
67 |
/** |
|
68 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
69 |
*/ |
|
70 |
public class AllWriting { |
|
71 |
|
|
72 |
public static Test suite() { |
|
73 |
TestSuite suite = new TestSuite("Test for org.gvsig.gpe.schema.writer"); |
|
74 |
//$JUnit-BEGIN$ |
|
75 |
suite.addTestSuite(SequenceWrittingTest.class); |
|
76 |
suite.addTestSuite(ElementWritingTest.class); |
|
77 |
suite.addTestSuite(ChoiceWritingTest.class); |
|
78 |
suite.addTestSuite(ElementWithComplexTypesWrittingTest.class); |
|
79 |
//$JUnit-END$ |
|
80 |
return suite; |
|
81 |
} |
|
82 |
|
|
83 |
} |
|
0 | 84 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/ElementWritingTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import org.gvsig.xmlschema.som.IXSElementDeclaration; |
|
4 |
|
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
6 |
* |
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation; either version 2 |
|
12 |
* of the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
22 |
* |
|
23 |
* For more information, contact: |
|
24 |
* |
|
25 |
* Generalitat Valenciana |
|
26 |
* Conselleria d'Infraestructures i Transport |
|
27 |
* Av. Blasco Ib??ez, 50 |
|
28 |
* 46010 VALENCIA |
|
29 |
* SPAIN |
|
30 |
* |
|
31 |
* +34 963862235 |
|
32 |
* gvsig@gva.es |
|
33 |
* www.gvsig.gva.es |
|
34 |
* |
|
35 |
* or |
|
36 |
* |
|
37 |
* IVER T.I. S.A |
|
38 |
* Salamanca 50 |
|
39 |
* 46005 Valencia |
|
40 |
* Spain |
|
41 |
* |
|
42 |
* +34 963163400 |
|
43 |
* dac@iver.es |
|
44 |
*/ |
|
45 |
/* CVS MESSAGES: |
|
46 |
* |
|
47 |
* $Id: ElementWritingTest.java 164 2007-07-02 10:00:46Z jorpiell $ |
|
48 |
* $Log$ |
|
49 |
* Revision 1.4 2007/07/02 09:59:03 jorpiell |
|
50 |
* The generated xsd schemas have to be valid |
|
51 |
* |
|
52 |
* Revision 1.3 2007/06/28 13:04:33 jorpiell |
|
53 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class |
|
54 |
* |
|
55 |
* Revision 1.2 2007/06/22 12:21:18 jorpiell |
|
56 |
* The typeNotFoundException has been deleted. It never was thrown |
|
57 |
* |
|
58 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
59 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
60 |
* |
|
61 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
62 |
* The schema jar name has been changed |
|
63 |
* |
|
64 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
65 |
* Add the schema support |
|
66 |
* |
|
67 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
68 |
* Add the element collection |
|
69 |
* |
|
70 |
* |
|
71 |
*/ |
|
72 |
/** |
|
73 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
74 |
*/ |
|
75 |
public class ElementWritingTest extends WriterBaseTest{ |
|
76 |
private String elementName1 = "river"; |
|
77 |
private String elementType1 = "river_type"; |
|
78 |
|
|
79 |
public void readSchema() { |
|
80 |
IXSElementDeclaration element = getSchema().getElementDeclarationByName(getNamespaceURI(), elementName1); |
|
81 |
assertNotNull(element); |
|
82 |
assertEquals(element.getQName().getLocalPart(), elementName1); |
|
83 |
assertEquals(element.getTypeName(), getSchema().getTargetNamespacePrefix() + ":" + elementType1); |
|
84 |
} |
|
85 |
|
|
86 |
public void writeSchema() { |
|
87 |
getSchema().addElement( |
|
88 |
elementName1, |
|
89 |
elementType1); |
|
90 |
} |
|
91 |
|
|
92 |
} |
|
0 | 93 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/writer/ChoiceWritingTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.writer; |
|
2 |
|
|
3 |
import java.util.Iterator; |
|
4 |
|
|
5 |
import org.gvsig.xmlschema.som.IXSChoice; |
|
6 |
import org.gvsig.xmlschema.som.IXSComplexTypeDefinition; |
|
7 |
import org.gvsig.xmlschema.som.IXSContentType; |
|
8 |
import org.gvsig.xmlschema.som.IXSTypeDefinition; |
|
9 |
|
|
10 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
11 |
* |
|
12 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
13 |
* |
|
14 |
* This program is free software; you can redistribute it and/or |
|
15 |
* modify it under the terms of the GNU General Public License |
|
16 |
* as published by the Free Software Foundation; either version 2 |
|
17 |
* of the License, or (at your option) any later version. |
|
18 |
* |
|
19 |
* This program is distributed in the hope that it will be useful, |
|
20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
22 |
* GNU General Public License for more details. |
|
23 |
* |
|
24 |
* You should have received a copy of the GNU General Public License |
|
25 |
* along with this program; if not, write to the Free Software |
|
26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
27 |
* |
|
28 |
* For more information, contact: |
|
29 |
* |
|
30 |
* Generalitat Valenciana |
|
31 |
* Conselleria d'Infraestructures i Transport |
|
32 |
* Av. Blasco Ib??ez, 50 |
|
33 |
* 46010 VALENCIA |
|
34 |
* SPAIN |
|
35 |
* |
|
36 |
* +34 963862235 |
|
37 |
* gvsig@gva.es |
|
38 |
* www.gvsig.gva.es |
|
39 |
* |
|
40 |
* or |
|
41 |
* |
|
42 |
* IVER T.I. S.A |
|
43 |
* Salamanca 50 |
|
44 |
* 46005 Valencia |
|
45 |
* Spain |
|
46 |
* |
|
47 |
* +34 963163400 |
|
48 |
* dac@iver.es |
|
49 |
*/ |
|
50 |
/* CVS MESSAGES: |
|
51 |
* |
|
52 |
* $Id: ChoiceWritingTest.java 161 2007-06-28 13:05:27Z jorpiell $ |
|
53 |
* $Log$ |
|
54 |
* Revision 1.3 2007/06/28 13:04:33 jorpiell |
|
55 |
* The Qname has been updated to the 1.5 JVM machine. The schema validation is made in the GPEWriterHandlerImplementor class |
|
56 |
* |
|
57 |
* Revision 1.2 2007/06/22 12:21:18 jorpiell |
|
58 |
* The typeNotFoundException has been deleted. It never was thrown |
|
59 |
* |
|
60 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
61 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
62 |
* |
|
63 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
64 |
* The schema jar name has been changed |
|
65 |
* |
|
66 |
* Revision 1.3 2007/06/08 11:35:16 jorpiell |
|
67 |
* IXSSchema interface updated |
|
68 |
* |
|
69 |
* Revision 1.2 2007/06/07 14:54:13 jorpiell |
|
70 |
* Add the schema support |
|
71 |
* |
|
72 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
73 |
* Add the element collection |
|
74 |
* |
|
75 |
* |
|
76 |
*/ |
|
77 |
/** |
|
78 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
79 |
*/ |
|
80 |
public class ChoiceWritingTest extends WriterBaseTest { |
|
81 |
private String typeName1 = "river_type"; |
|
82 |
private String typeType1 = IXSComplexTypeDefinition.CHOICE; |
|
83 |
private String contentType1 = IXSContentType.WITOUT_CONTENT; |
|
84 |
private String contentRestriction1 = IXSContentType.WITOUT_RESTRICTION; |
|
85 |
private String type1ElementName1 = "length"; |
|
86 |
private String type1ElementType1 = "xs:double"; |
|
87 |
private String type1ElementName2 = "name"; |
|
88 |
private String type1ElementType2 = "xs:string"; |
|
89 |
|
|
90 |
/* |
|
91 |
* (non-Javadoc) |
|
92 |
* @see org.gvsig.gpe.schema.writer.WriterBaseTest#readSchema() |
|
93 |
*/ |
|
94 |
public void readSchema(){ |
|
95 |
IXSTypeDefinition type = getSchema().getTypeByName(getNamespaceURI(), typeName1); |
|
96 |
assertNotNull(type); |
|
97 |
assertEquals(type.getQName().getLocalPart(), typeName1); |
|
98 |
IXSComplexTypeDefinition cType = (IXSComplexTypeDefinition)type; |
|
99 |
Iterator it = cType.getItems().iterator(); |
|
100 |
IXSChoice choice = null; |
|
101 |
while (it.hasNext()){ |
|
102 |
choice = (IXSChoice) it.next(); |
|
103 |
} |
|
104 |
assertNotNull(choice); |
|
105 |
} |
|
106 |
|
|
107 |
/* |
|
108 |
* (non-Javadoc) |
|
109 |
* @see org.gvsig.gpe.schema.writer.WriterBaseTest#writeSchema() |
|
110 |
*/ |
|
111 |
public void writeSchema() { |
|
112 |
IXSComplexTypeDefinition complexType = getSchema().addComplexType( |
|
113 |
typeName1, typeType1, contentType1, contentRestriction1); |
|
114 |
complexType.addElement( |
|
115 |
type1ElementName1, |
|
116 |
type1ElementType1); |
|
117 |
complexType.addElement( |
|
118 |
type1ElementName2, |
|
119 |
type1ElementType2); |
|
120 |
} |
|
121 |
} |
|
0 | 122 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/performance/DOMMemoryUsageTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.performance; |
|
2 |
import javax.xml.parsers.DocumentBuilder; |
|
3 |
import javax.xml.parsers.DocumentBuilderFactory; |
|
4 |
|
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
6 |
* |
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
8 |
* |
|
9 |
* This program is free software; you can redistribute it and/or |
|
10 |
* modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation; either version 2 |
|
12 |
* of the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* This program is distributed in the hope that it will be useful, |
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17 |
* GNU General Public License for more details. |
|
18 |
* |
|
19 |
* You should have received a copy of the GNU General Public License |
|
20 |
* along with this program; if not, write to the Free Software |
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
22 |
* |
|
23 |
* For more information, contact: |
|
24 |
* |
|
25 |
* Generalitat Valenciana |
|
26 |
* Conselleria d'Infraestructures i Transport |
|
27 |
* Av. Blasco Ib??ez, 50 |
|
28 |
* 46010 VALENCIA |
|
29 |
* SPAIN |
|
30 |
* |
|
31 |
* +34 963862235 |
|
32 |
* gvsig@gva.es |
|
33 |
* www.gvsig.gva.es |
|
34 |
* |
|
35 |
* or |
|
36 |
* |
|
37 |
* IVER T.I. S.A |
|
38 |
* Salamanca 50 |
|
39 |
* 46005 Valencia |
|
40 |
* Spain |
|
41 |
* |
|
42 |
* +34 963163400 |
|
43 |
* dac@iver.es |
|
44 |
*/ |
|
45 |
/* CVS MESSAGES: |
|
46 |
* |
|
47 |
* $Id: DOMMemoryUsageTest.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
48 |
* $Log$ |
|
49 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
50 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
51 |
* |
|
52 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
53 |
* The schema jar name has been changed |
|
54 |
* |
|
55 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
56 |
* Add the element collection |
|
57 |
* |
|
58 |
* Revision 1.1 2007/05/25 11:55:00 jorpiell |
|
59 |
* First update |
|
60 |
* |
|
61 |
* |
|
62 |
*/ |
|
63 |
/** |
|
64 |
* This test parses a XSD file using the DOM strategy. |
|
65 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
66 |
*/ |
|
67 |
public class DOMMemoryUsageTest extends MemoryUsageTest { |
|
68 |
|
|
69 |
protected void parse(String file) throws Exception { |
|
70 |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
|
71 |
DocumentBuilder builder = factory.newDocumentBuilder(); |
|
72 |
builder.parse(file); |
|
73 |
} |
|
74 |
|
|
75 |
} |
|
0 | 76 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/performance/MemoryUsageTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.performance; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
|
|
5 |
import junit.framework.TestCase; |
|
6 |
|
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
11 |
* This program is free software; you can redistribute it and/or |
|
12 |
* modify it under the terms of the GNU General Public License |
|
13 |
* as published by the Free Software Foundation; either version 2 |
|
14 |
* of the License, or (at your option) any later version. |
|
15 |
* |
|
16 |
* This program is distributed in the hope that it will be useful, |
|
17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
* GNU General Public License for more details. |
|
20 |
* |
|
21 |
* You should have received a copy of the GNU General Public License |
|
22 |
* along with this program; if not, write to the Free Software |
|
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
46 |
*/ |
|
47 |
/* CVS MESSAGES: |
|
48 |
* |
|
49 |
* $Id: MemoryUsageTest.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
50 |
* $Log$ |
|
51 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
52 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
53 |
* |
|
54 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
55 |
* The schema jar name has been changed |
|
56 |
* |
|
57 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
58 |
* Add the element collection |
|
59 |
* |
|
60 |
* Revision 1.1 2007/05/25 11:55:00 jorpiell |
|
61 |
* First update |
|
62 |
* |
|
63 |
* |
|
64 |
*/ |
|
65 |
/** |
|
66 |
* This test parses some XSD files and calculates the |
|
67 |
* used memory for each of them. The parsing process |
|
68 |
* must to be implemented by the classes tha inherit |
|
69 |
* from this. |
|
70 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
71 |
*/ |
|
72 |
public abstract class MemoryUsageTest extends TestCase { |
|
73 |
private static final int TIMES_TO_LOOP = 5; |
|
74 |
private static final float KB = 1024.0f; |
|
75 |
private static final float MB = 1048576.0f; |
|
76 |
private static final String SKB="KB"; |
|
77 |
private static final String SMB="MB"; |
|
78 |
|
|
79 |
private String file1 = "testdata/schemas/localidad.xsd"; |
|
80 |
private String file2 = "testdata/schemas/municipios.xsd"; |
|
81 |
private String file3 = "testdata/schemas/WithSchemaLocationLink.xsd"; |
|
82 |
private String file4 = "testdata/schemas/WFSDescribeFeatureType.xsd"; |
|
83 |
private String file5 = "testdata/schemas/CityGML.xsd"; |
|
84 |
|
|
85 |
|
|
86 |
public void test1() throws Exception{ |
|
87 |
parseSchemaXTimes(file1); |
|
88 |
} |
|
89 |
|
|
90 |
public void test2() throws Exception{ |
|
91 |
parseSchemaXTimes(file2); |
|
92 |
} |
|
93 |
|
|
94 |
public void test3() throws Exception{ |
|
95 |
parseSchemaXTimes(file3); |
|
96 |
} |
|
97 |
|
|
98 |
public void test4() throws Exception{ |
|
99 |
parseSchemaXTimes(file4); |
|
100 |
} |
|
101 |
|
|
102 |
public void test5() throws Exception{ |
|
103 |
parseSchemaXTimes(file5); |
|
104 |
} |
|
105 |
|
|
106 |
|
|
107 |
/** |
|
108 |
* Parser the same XSD file the number of times |
|
109 |
* specified by TIMES_TO_LOOP |
|
110 |
* @param file |
|
111 |
* XSD file to parse |
|
112 |
* @throws Exception |
|
113 |
*/ |
|
114 |
private void parseSchemaXTimes(String file) throws Exception{ |
|
115 |
float usedMemory = 0; |
|
116 |
float usedTime = 0; |
|
117 |
for (int i=0 ; i<TIMES_TO_LOOP ; i++){ |
|
118 |
usedMemory = usedMemory + parseSchemaMemory(file); |
|
119 |
usedTime = usedTime + parseSchemaTime(file); |
|
120 |
} |
|
121 |
usedMemory = usedMemory / TIMES_TO_LOOP; |
|
122 |
usedTime = usedTime / TIMES_TO_LOOP; |
|
123 |
float divisor = (usedMemory<MB) ? KB : MB; |
|
124 |
String sufix = (usedMemory<MB) ? SKB : SMB; |
|
125 |
usedMemory = usedMemory/divisor; |
|
126 |
System.out.println(usedMemory + " " + sufix + " used to parse " + file + " wich size is " |
|
127 |
+ new File(file).length()/KB + " KB in " + usedTime + " milis"); |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* Parses one schema and returns the used memory |
|
132 |
* @param file |
|
133 |
* XSD file |
|
134 |
* @return |
|
135 |
* The memory |
|
136 |
* @throws Exception |
|
137 |
*/ |
|
138 |
public float parseSchemaMemory(String file) throws Exception{ |
|
139 |
//Call the garbage collector |
|
140 |
Runtime.getRuntime().gc(); |
|
141 |
float totalBefore = Runtime.getRuntime().totalMemory(); |
|
142 |
float freeBefore = Runtime.getRuntime().freeMemory(); |
|
143 |
//Parse the file |
|
144 |
parse(file); |
|
145 |
float freeAfter = Runtime.getRuntime().freeMemory(); |
|
146 |
float totalAfter = Runtime.getRuntime().totalMemory(); |
|
147 |
float usedMemory = (totalAfter - freeAfter) - (totalBefore - freeBefore); |
|
148 |
//Call the garbage collector |
|
149 |
Runtime.getRuntime().gc(); |
|
150 |
return usedMemory; |
|
151 |
} |
|
152 |
|
|
153 |
/** |
|
154 |
* Parses one schema and returns the used time |
|
155 |
* @param file |
|
156 |
* XSD file |
|
157 |
* @return |
|
158 |
* The memory |
|
159 |
* @throws Exception |
|
160 |
*/ |
|
161 |
public long parseSchemaTime(String file) throws Exception{ |
|
162 |
long t1 = System.currentTimeMillis(); |
|
163 |
//Parse the file |
|
164 |
parse(file); |
|
165 |
long t2 = System.currentTimeMillis(); |
|
166 |
return t2 - t1; |
|
167 |
} |
|
168 |
|
|
169 |
/** |
|
170 |
* Parse the schema |
|
171 |
* @param file |
|
172 |
* XSD to parse |
|
173 |
* @throws Exception |
|
174 |
*/ |
|
175 |
protected abstract void parse(String file) throws Exception; |
|
176 |
|
|
177 |
} |
|
0 | 178 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/performance/DOMWithObjectsMemoryUsageTest.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.performance; |
|
2 |
|
|
3 |
import java.io.FileInputStream; |
|
4 |
|
|
5 |
import org.gvsig.xmlschema.som.IXSSchema; |
|
6 |
import org.gvsig.xmlschema.utils.SchemaDocumentBuilder; |
|
7 |
|
|
8 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
9 |
* |
|
10 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
11 |
* |
|
12 |
* This program is free software; you can redistribute it and/or |
|
13 |
* modify it under the terms of the GNU General Public License |
|
14 |
* as published by the Free Software Foundation; either version 2 |
|
15 |
* of the License, or (at your option) any later version. |
|
16 |
* |
|
17 |
* This program is distributed in the hope that it will be useful, |
|
18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
* GNU General Public License for more details. |
|
21 |
* |
|
22 |
* You should have received a copy of the GNU General Public License |
|
23 |
* along with this program; if not, write to the Free Software |
|
24 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
25 |
* |
|
26 |
* For more information, contact: |
|
27 |
* |
|
28 |
* Generalitat Valenciana |
|
29 |
* Conselleria d'Infraestructures i Transport |
|
30 |
* Av. Blasco Ib??ez, 50 |
|
31 |
* 46010 VALENCIA |
|
32 |
* SPAIN |
|
33 |
* |
|
34 |
* +34 963862235 |
|
35 |
* gvsig@gva.es |
|
36 |
* www.gvsig.gva.es |
|
37 |
* |
|
38 |
* or |
|
39 |
* |
|
40 |
* IVER T.I. S.A |
|
41 |
* Salamanca 50 |
|
42 |
* 46005 Valencia |
|
43 |
* Spain |
|
44 |
* |
|
45 |
* +34 963163400 |
|
46 |
* dac@iver.es |
|
47 |
*/ |
|
48 |
/* CVS MESSAGES: |
|
49 |
* |
|
50 |
* $Id: DOMWithObjectsMemoryUsageTest.java 151 2007-06-14 16:15:05Z jorpiell $ |
|
51 |
* $Log$ |
|
52 |
* Revision 1.1 2007/06/14 16:15:03 jorpiell |
|
53 |
* builds to create the jars generated and add the schema code to the libGPEProject |
|
54 |
* |
|
55 |
* Revision 1.1 2007/06/14 13:50:07 jorpiell |
|
56 |
* The schema jar name has been changed |
|
57 |
* |
|
58 |
* Revision 1.1 2007/05/30 12:25:48 jorpiell |
|
59 |
* Add the element collection |
|
60 |
* |
|
61 |
* Revision 1.1 2007/05/25 11:55:00 jorpiell |
|
62 |
* First update |
|
63 |
* |
|
64 |
* |
|
65 |
*/ |
|
66 |
/** |
|
67 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es) |
|
68 |
*/ |
|
69 |
public class DOMWithObjectsMemoryUsageTest extends MemoryUsageTest { |
|
70 |
|
|
71 |
protected void parse(String file) throws Exception { |
|
72 |
IXSSchema schema = SchemaDocumentBuilder.getInstance().parse(new FileInputStream(file)); |
|
73 |
schema.getElementDeclarations(); |
|
74 |
schema.getTypeDefinitions(); |
|
75 |
} |
|
76 |
} |
|
0 | 77 |
tags/tmp_build/libraries/libGPE/src-test/org/gvsig/xmlschema/reader/AllReadingTests.java | ||
---|---|---|
1 |
package org.gvsig.xmlschema.reader; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
7 |
* |
|
8 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
9 |
* |
|
10 |
* This program is free software; you can redistribute it and/or |
|
11 |
* modify it under the terms of the GNU General Public License |
|
12 |
* as published by the Free Software Foundation; either version 2 |
|
13 |
* of the License, or (at your option) any later version. |
|
14 |
* |
|
15 |
* This program is distributed in the hope that it will be useful, |
|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18 |
* GNU General Public License for more details. |
|
19 |
* |
|
20 |
* You should have received a copy of the GNU General Public License |
|
21 |
* along with this program; if not, write to the Free Software |
|
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
23 |
* |
|
24 |
* For more information, contact: |
|
25 |
* |
|
26 |
* Generalitat Valenciana |
|
27 |
* Conselleria d'Infraestructures i Transport |
|
28 |
* Av. Blasco Ib??ez, 50 |
Also available in: Unified diff