Revision 6013
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<groupId>org.gvsig</groupId> |
|
4 |
<artifactId>org.gvsig.vcsgis</artifactId> |
|
5 |
<version>1.0.54</version> |
|
6 |
<packaging>pom</packaging> |
|
7 |
<name>${project.artifactId}</name> |
|
8 |
<description /> |
|
9 |
<parent> |
|
10 |
<groupId>org.gvsig</groupId> |
|
11 |
<artifactId>org.gvsig.desktop</artifactId> |
|
12 |
<version>2.0.364</version> |
|
13 |
</parent> |
|
14 |
|
|
15 |
<properties> |
|
16 |
<org.gvsig.h2spatial.provider>org.gvsig.h2spatial.h2gis132.provider</org.gvsig.h2spatial.provider> |
|
17 |
<org.gvsig.topology.version>1.0.99</org.gvsig.topology.version> |
|
18 |
<org.gvsig.oracle.version>2.0.80</org.gvsig.oracle.version> |
|
19 |
<org.gvsig.postgresql.version>2.0.201</org.gvsig.postgresql.version> |
|
20 |
</properties> |
|
21 |
|
|
22 |
<url>https://devel.gvsig.org/sites/org.gvsig.vcsgis/${project.version}</url> |
|
23 |
<scm> |
|
24 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54</connection> |
|
25 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54</developerConnection> |
|
26 |
<url>https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54</url> |
|
27 |
</scm> |
|
28 |
|
|
29 |
<repositories> |
|
30 |
<repository> |
|
31 |
<id>gvsig-public-http-repository</id> |
|
32 |
<name>gvSIG maven public HTTP repository</name> |
|
33 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
34 |
<releases> |
|
35 |
<enabled>true</enabled> |
|
36 |
<updatePolicy>daily</updatePolicy> |
|
37 |
<checksumPolicy>warn</checksumPolicy> |
|
38 |
</releases> |
|
39 |
<snapshots> |
|
40 |
<enabled>true</enabled> |
|
41 |
<updatePolicy>daily</updatePolicy> |
|
42 |
<checksumPolicy>warn</checksumPolicy> |
|
43 |
</snapshots> |
|
44 |
</repository> |
|
45 |
</repositories> |
|
46 |
|
|
47 |
<distributionManagement> |
|
48 |
<site> |
|
49 |
<id>gvsig-repository</id> |
|
50 |
<url>dav:https://devel.gvsig.org/download/projects/gvsig-vcsgis/pool/${project.artifactId}/${project.version}</url> |
|
51 |
</site> |
|
52 |
</distributionManagement> |
|
53 |
|
|
54 |
<build> |
|
55 |
<pluginManagement> |
|
56 |
<plugins> |
|
57 |
|
|
58 |
<plugin> |
|
59 |
<groupId>org.apache.maven.plugins</groupId> |
|
60 |
<artifactId>maven-compiler-plugin</artifactId> |
|
61 |
<configuration> |
|
62 |
<encoding>UTF-8</encoding> |
|
63 |
</configuration> |
|
64 |
</plugin> |
|
65 |
</plugins> |
|
66 |
</pluginManagement> |
|
67 |
<plugins> |
|
68 |
<plugin> |
|
69 |
<groupId>org.apache.maven.plugins</groupId> |
|
70 |
<artifactId>maven-release-plugin</artifactId> |
|
71 |
<configuration> |
|
72 |
<tagBase>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/tags</tagBase> |
|
73 |
</configuration> |
|
74 |
</plugin> |
|
75 |
</plugins> |
|
76 |
</build> |
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
<dependencyManagement> |
|
81 |
<dependencies> |
|
82 |
<dependency> |
|
83 |
<groupId>org.apache.maven.plugins</groupId> |
|
84 |
<artifactId>maven-war-plugin</artifactId> |
|
85 |
<version>3.2.3</version> |
|
86 |
<type>maven-plugin</type> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.apache.tomcat</groupId> |
|
90 |
<artifactId>tomcat-servlet-api</artifactId> |
|
91 |
<version>9.0.45</version> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>javax.servlet</groupId> |
|
95 |
<artifactId>javax.servlet-api</artifactId> |
|
96 |
<version>3.1.0</version> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.eclipse.jetty</groupId> |
|
100 |
<artifactId>jetty-server</artifactId> |
|
101 |
<version>9.4.34.v20201102</version> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.eclipse.jetty</groupId> |
|
105 |
<artifactId>jetty-servlet</artifactId> |
|
106 |
<version>9.4.34.v20201102</version> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.eclipse.jetty</groupId> |
|
110 |
<artifactId>jetty-webapp</artifactId> |
|
111 |
<version>9.4.34.v20201102</version> |
|
112 |
<exclusions> |
|
113 |
<exclusion> |
|
114 |
<groupId>javax.servlet</groupId> |
|
115 |
<artifactId>servlet-api</artifactId> |
|
116 |
</exclusion> |
|
117 |
</exclusions> |
|
118 |
</dependency> |
|
119 |
<dependency> |
|
120 |
<groupId>org.eclipse.jetty</groupId> |
|
121 |
<artifactId>jetty-util</artifactId> |
|
122 |
<version>9.4.34.v20201102</version> |
|
123 |
</dependency> |
|
124 |
<dependency> |
|
125 |
<groupId>org.eclipse.jetty</groupId> |
|
126 |
<artifactId>jetty-io</artifactId> |
|
127 |
<version>9.4.34.v20201102</version> |
|
128 |
</dependency> |
|
129 |
<dependency> |
|
130 |
<groupId>org.eclipse.jetty</groupId> |
|
131 |
<artifactId>jetty-jndi</artifactId> |
|
132 |
<version>9.4.34.v20201102</version> |
|
133 |
</dependency> |
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
<dependency> |
|
139 |
<groupId>org.gvsig</groupId> |
|
140 |
<artifactId>org.gvsig.topology</artifactId> |
|
141 |
<version>${org.gvsig.topology.version}</version> |
|
142 |
<type>pom</type> |
|
143 |
<scope>import</scope> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.gvsig</groupId> |
|
147 |
<artifactId>${org.gvsig.h2spatial.provider}</artifactId> |
|
148 |
</dependency> |
|
149 |
<dependency> |
|
150 |
<groupId>org.gvsig</groupId> |
|
151 |
<artifactId>org.gvsig.oracle</artifactId> |
|
152 |
<version>${org.gvsig.oracle.version}</version> |
|
153 |
<type>pom</type> |
|
154 |
<scope>import</scope> |
|
155 |
</dependency> |
|
156 |
<dependency> |
|
157 |
<groupId>org.gvsig</groupId> |
|
158 |
<artifactId>org.gvsig.postgresql</artifactId> |
|
159 |
<version>${org.gvsig.postgresql.version}</version> |
|
160 |
<type>pom</type> |
|
161 |
<scope>import</scope> |
|
162 |
</dependency> |
|
163 |
<dependency> |
|
164 |
<groupId>org.gvsig</groupId> |
|
165 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
166 |
<version>1.0.54</version> |
|
167 |
</dependency> |
|
168 |
<dependency> |
|
169 |
<groupId>org.gvsig</groupId> |
|
170 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
171 |
<version>1.0.54</version> |
|
172 |
</dependency> |
|
173 |
<dependency> |
|
174 |
<groupId>org.gvsig</groupId> |
|
175 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
176 |
<scope>test</scope> |
|
177 |
<type>test-jar</type> |
|
178 |
<version>1.0.54</version> |
|
179 |
</dependency> |
|
180 |
<dependency> |
|
181 |
<groupId>org.gvsig</groupId> |
|
182 |
<artifactId>org.gvsig.vcsgis.swing.api</artifactId> |
|
183 |
<version>1.0.54</version> |
|
184 |
</dependency> |
|
185 |
<dependency> |
|
186 |
<groupId>org.gvsig</groupId> |
|
187 |
<artifactId>org.gvsig.vcsgis.swing.impl</artifactId> |
|
188 |
<version>1.0.54</version> |
|
189 |
</dependency> |
|
190 |
<dependency> |
|
191 |
<groupId>org.gvsig</groupId> |
|
192 |
<artifactId>org.gvsig.vcsgis.tomcat.webapp</artifactId> |
|
193 |
<version>1.0.54</version> |
|
194 |
<type>war</type> |
|
195 |
</dependency> |
|
196 |
|
|
197 |
</dependencies> |
|
198 |
</dependencyManagement> |
|
199 |
|
|
200 |
<modules> |
|
201 |
<module>org.gvsig.vcsgis.lib</module> |
|
202 |
<module>org.gvsig.vcsgis.swing</module> |
|
203 |
<module>org.gvsig.vcsgis.app</module> |
|
204 |
<module>org.gvsig.vcsgis.tomcat</module> |
|
205 |
</modules> |
|
206 |
</project> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.vcsgis.app</artifactId> |
|
6 |
<version>1.0.54</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.vcsgis.app.server</artifactId> |
|
9 |
<packaging>jar</packaging> |
|
10 |
<name>${project.artifactId}</name> |
|
11 |
<properties> |
|
12 |
<!-- Package info property values --> |
|
13 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
14 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
15 |
<gvsig.package.info.name>vcsgis-server</gvsig.package.info.name> |
|
16 |
<gvsig.package.info.description>Provides a implementation of a HTTP server of VCSGis protocol (Version Control System for GIS).</gvsig.package.info.description> |
|
17 |
<gvsig.package.info.categories /> |
|
18 |
<gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM> |
|
19 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-vcsgis/pool</gvsig.package.info.poolURL> |
|
20 |
</properties> |
|
21 |
|
|
22 |
<dependencies> |
|
23 |
<dependency> |
|
24 |
<groupId>org.gvsig</groupId> |
|
25 |
<artifactId>org.gvsig.andami</artifactId> |
|
26 |
<scope>compile</scope> |
|
27 |
</dependency> |
|
28 |
<dependency> |
|
29 |
<groupId>org.gvsig</groupId> |
|
30 |
<artifactId>org.gvsig.vcsgis.swing.api</artifactId> |
|
31 |
<scope>compile</scope> |
|
32 |
</dependency> |
|
33 |
<dependency> |
|
34 |
<groupId>org.gvsig</groupId> |
|
35 |
<artifactId>org.gvsig.vcsgis.swing.impl</artifactId> |
|
36 |
<scope>test</scope> |
|
37 |
</dependency> |
|
38 |
<dependency> |
|
39 |
<groupId>org.gvsig</groupId> |
|
40 |
<artifactId>org.gvsig.vcsgis.lib.api</artifactId> |
|
41 |
<scope>compile</scope> |
|
42 |
</dependency> |
|
43 |
<dependency> |
|
44 |
<groupId>org.gvsig</groupId> |
|
45 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
46 |
<scope>test</scope> |
|
47 |
<type>test-jar</type> |
|
48 |
</dependency> |
|
49 |
|
|
50 |
<dependency> |
|
51 |
<groupId>org.gvsig</groupId> |
|
52 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
53 |
<scope>compile</scope> |
|
54 |
</dependency> |
|
55 |
<dependency> |
|
56 |
<groupId>org.gvsig</groupId> |
|
57 |
<artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId> |
|
58 |
<scope>compile</scope> |
|
59 |
</dependency> |
|
60 |
|
|
61 |
<dependency> |
|
62 |
<groupId>org.gvsig</groupId> |
|
63 |
<artifactId>org.gvsig.vcsgis.tomcat.webapp</artifactId> |
|
64 |
<scope>runtime</scope> |
|
65 |
<type>war</type> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<dependency> |
|
69 |
<groupId>org.eclipse.jetty</groupId> |
|
70 |
<artifactId>jetty-server</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>org.eclipse.jetty</groupId> |
|
75 |
<artifactId>jetty-servlet</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.eclipse.jetty</groupId> |
|
80 |
<artifactId>jetty-webapp</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
<exclusions> |
|
83 |
<exclusion> |
|
84 |
<groupId>javax.servlet</groupId> |
|
85 |
<artifactId>servlet-api</artifactId> |
|
86 |
</exclusion> |
|
87 |
</exclusions> |
|
88 |
</dependency> |
|
89 |
<dependency> |
|
90 |
<groupId>org.eclipse.jetty</groupId> |
|
91 |
<artifactId>jetty-util</artifactId> |
|
92 |
<scope>compile</scope> |
|
93 |
</dependency> |
|
94 |
<dependency> |
|
95 |
<groupId>org.eclipse.jetty</groupId> |
|
96 |
<artifactId>jetty-io</artifactId> |
|
97 |
<scope>compile</scope> |
|
98 |
</dependency> |
|
99 |
<dependency> |
|
100 |
<groupId>org.eclipse.jetty</groupId> |
|
101 |
<artifactId>jetty-jndi</artifactId> |
|
102 |
<scope>compile</scope> |
|
103 |
</dependency> |
|
104 |
|
|
105 |
<dependency> |
|
106 |
<groupId>org.gvsig</groupId> |
|
107 |
<artifactId>org.gvsig.vcsgis.lib.impl</artifactId> |
|
108 |
<scope>test</scope> |
|
109 |
</dependency> |
|
110 |
<dependency> |
|
111 |
<groupId>org.gvsig</groupId> |
|
112 |
<artifactId>org.gvsig.fmap.dal.impl</artifactId> |
|
113 |
<scope>test</scope> |
|
114 |
</dependency> |
|
115 |
<dependency> |
|
116 |
<groupId>org.gvsig</groupId> |
|
117 |
<artifactId>${org.gvsig.h2spatial.provider}</artifactId> |
|
118 |
<scope>test</scope> |
|
119 |
</dependency> |
|
120 |
<dependency> |
|
121 |
<groupId>org.gvsig</groupId> |
|
122 |
<artifactId>${org.gvsig.fmap.geometry.impl}</artifactId> |
|
123 |
<scope>test</scope> |
|
124 |
</dependency> |
|
125 |
<dependency> |
|
126 |
<groupId>org.gvsig</groupId> |
|
127 |
<artifactId>org.gvsig.expressionevaluator.lib.impl</artifactId> |
|
128 |
<scope>test</scope> |
|
129 |
</dependency> |
|
130 |
<dependency> |
|
131 |
<groupId>org.gvsig</groupId> |
|
132 |
<artifactId>org.gvsig.expressionevaluator.geometry.lib.impl</artifactId> |
|
133 |
<scope>test</scope> |
|
134 |
</dependency> |
|
135 |
<dependency> |
|
136 |
<groupId>org.gvsig</groupId> |
|
137 |
<artifactId>${org.gvsig.proj.lib.impl}</artifactId> |
|
138 |
<scope>test</scope> |
|
139 |
</dependency> |
|
140 |
<dependency> |
|
141 |
<groupId>org.gvsig</groupId> |
|
142 |
<artifactId>org.gvsig.compat.se</artifactId> |
|
143 |
<scope>test</scope> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.gvsig</groupId> |
|
147 |
<artifactId>org.gvsig.metadata.lib.basic.impl</artifactId> |
|
148 |
<scope>test</scope> |
|
149 |
</dependency> |
|
150 |
<dependency> |
|
151 |
<groupId>org.gvsig</groupId> |
|
152 |
<artifactId>org.gvsig.timesupport.lib.impl</artifactId> |
|
153 |
<scope>test</scope> |
|
154 |
</dependency> |
|
155 |
<dependency> |
|
156 |
<groupId>org.gvsig</groupId> |
|
157 |
<artifactId>org.gvsig.fmap.dal.file.csv</artifactId> |
|
158 |
<scope>test</scope> |
|
159 |
</dependency> |
|
160 |
<dependency> |
|
161 |
<groupId>org.gvsig</groupId> |
|
162 |
<artifactId>org.gvsig.tools.util.impl</artifactId> |
|
163 |
<scope>test</scope> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>org.gvsig</groupId> |
|
167 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
168 |
<scope>test</scope> |
|
169 |
</dependency> |
|
170 |
|
|
171 |
</dependencies> |
|
172 |
<build> |
|
173 |
<plugins> |
|
174 |
|
|
175 |
<plugin> |
|
176 |
<groupId>org.apache.maven.plugins</groupId> |
|
177 |
<artifactId>maven-surefire-plugin</artifactId> |
|
178 |
<configuration> |
|
179 |
<!-- Skip test execution ? --> |
|
180 |
<skipTests>true</skipTests> |
|
181 |
<!-- Ignore test execution failure ? --> |
|
182 |
<testFailureIgnore>false</testFailureIgnore> |
|
183 |
</configuration> |
|
184 |
</plugin> |
|
185 |
|
|
186 |
<!-- Skip test compilation ? --> |
|
187 |
<plugin> |
|
188 |
<groupId>org.apache.maven.plugins</groupId> |
|
189 |
<artifactId>maven-compiler-plugin</artifactId> |
|
190 |
<executions> |
|
191 |
<execution> |
|
192 |
<id>default-testCompile</id> |
|
193 |
<phase>process-test-sources</phase> |
|
194 |
<goals> |
|
195 |
<goal>testCompile</goal> |
|
196 |
</goals> |
|
197 |
<configuration> |
|
198 |
<skip>false</skip> |
|
199 |
</configuration> |
|
200 |
</execution> |
|
201 |
</executions> |
|
202 |
</plugin> |
|
203 |
|
|
204 |
</plugins> |
|
205 |
</build> |
|
206 |
|
|
207 |
</project> |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/buildNumber.properties | ||
---|---|---|
1 |
#Thu Mar 03 00:10:29 CET 2022 |
|
2 |
buildNumber=62 |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/src/test/java/org/gvsig/vcsgis/app/server/TestSrv14UpdateWithConflict.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.app.server; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Locale; |
|
7 |
import junit.framework.TestCase; |
|
8 |
import static junit.framework.TestCase.assertEquals; |
|
9 |
import org.apache.commons.io.FileUtils; |
|
10 |
import org.eclipse.jetty.server.Server; |
|
11 |
import org.gvsig.expressionevaluator.Expression; |
|
12 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
13 |
import org.gvsig.fmap.dal.feature.Feature; |
|
14 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
15 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
16 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
17 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
18 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.createServer; |
|
19 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.utils; |
|
20 |
import static org.gvsig.vcsgis.app.server.VCSGisJettyServerUtils.SERVER_PORT; |
|
21 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
|
22 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
23 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
24 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
25 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_UPDATE_NEED_MERGE; |
|
26 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_DELETE; |
|
27 |
import static org.gvsig.vcsgis.lib.VCSGisManager.OP_INSERT; |
|
28 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_CONFLICT; |
|
29 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
30 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldbImpl; |
|
31 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
32 |
import org.gvsig.vcsgis.lib.workspace.tables.RemoteChangesTable; |
|
33 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
|
34 |
import org.slf4j.Logger; |
|
35 |
import org.slf4j.LoggerFactory; |
|
36 |
|
|
37 |
public class TestSrv14UpdateWithConflict extends TestCase { |
|
38 |
|
|
39 |
private static final Logger LOGGER = LoggerFactory.getLogger(TestSrv14UpdateWithConflict.class); |
|
40 |
private Server server; |
|
41 |
|
|
42 |
static{ |
|
43 |
Locale.setDefault(Locale.forLanguageTag("es-ES")); |
|
44 |
} |
|
45 |
|
|
46 |
public TestSrv14UpdateWithConflict(String testName) { |
|
47 |
super(testName); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
protected void setUp() throws Exception { |
|
52 |
super.setUp(); |
|
53 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
protected void tearDown() throws Exception { |
|
58 |
super.tearDown(); |
|
59 |
} |
|
60 |
|
|
61 |
private VCSGisWorkspace[] initTest() throws Exception { |
|
62 |
|
|
63 |
final String testid = "ServerUpdateWithConflict"; |
|
64 |
final URL serverUrl = new URL("http://localhost:" + SERVER_PORT + "/"); |
|
65 |
|
|
66 |
VCSGisManager vcsgismanager = VCSGisLocator.getVCSGisManager(); |
|
67 |
// JDBCServerExplorer server = TestUtils.openServerExplorer("srv-update"); |
|
68 |
SequentialCodeGenerator.reset(); |
|
69 |
|
|
70 |
JDBCServerExplorerParameters explorerParams = utils().getRepositoryServerExplorerParameters("srv-" + testid); |
|
71 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs", "ws-" + testid)); |
|
72 |
|
|
73 |
// --------------------------------------------------------- |
|
74 |
// Creamos el server y obtenemos el repositorio del server |
|
75 |
int r = vcsgismanager.initRepository(explorerParams, null); |
|
76 |
assertEquals("srv-init status", 0, r); |
|
77 |
|
|
78 |
VCSGisRepositoryLocaldbImpl repositoryLocal = (VCSGisRepositoryLocaldbImpl) vcsgismanager.openRepository(explorerParams); |
|
79 |
|
|
80 |
repositoryLocal.setAllowAssignTheRevisionDate(true); |
|
81 |
|
|
82 |
utils().info_repository(repositoryLocal); |
|
83 |
|
|
84 |
repositoryLocal.dispose(); |
|
85 |
|
|
86 |
server = createServer(utils(), explorerParams); |
|
87 |
|
|
88 |
server.start(); |
|
89 |
|
|
90 |
VCSGisRepository repo = vcsgismanager.openRepository(serverUrl); |
|
91 |
|
|
92 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs", "ws1-update")); |
|
93 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs", "ws2-update")); |
|
94 |
File ws3file = utils().getFile(FileUtils.getFile("test-dbs", "ws3-update")); |
|
95 |
|
|
96 |
vcsgismanager.setCodeGenerator(new SequentialCodeGenerator()); |
|
97 |
|
|
98 |
List<Feature> features; |
|
99 |
FeatureStore store2; |
|
100 |
FeatureStore store3; |
|
101 |
|
|
102 |
// ------------------------------------------------------------ |
|
103 |
// Creamos workspace1 y lo abrimos. |
|
104 |
r = vcsgismanager.initWorkspace(ws1file, repo, "Test update1", null); |
|
105 |
assertEquals("init_ws1 status", ERR_NO_ERROR, r); |
|
106 |
|
|
107 |
VCSGisWorkspace ws1 = vcsgismanager.openWorkspace(ws1file); |
|
108 |
utils().info_workspace(ws1); |
|
109 |
|
|
110 |
// ------------------------------------------------------------ |
|
111 |
// Adicionamos al workspace1 la tabla "test" y la commitamos. |
|
112 |
//REV 0 |
|
113 |
FeatureStore sourceTest = utils().openSourceStore2(); |
|
114 |
r = ws1.add("test", sourceTest, "text"); |
|
115 |
DisposeUtils.disposeQuietly(sourceTest); |
|
116 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
117 |
|
|
118 |
r = ws1.commit(); |
|
119 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
120 |
|
|
121 |
// ------------------------------------------------------------ |
|
122 |
// Inicializamos el workspace2 asociandolo al mismo repositorio que |
|
123 |
// workspace1 y lo abrimos. |
|
124 |
r = vcsgismanager.initWorkspace(ws2file, repo, "Test update2", null); |
|
125 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
126 |
VCSGisWorkspace ws2 = vcsgismanager.openWorkspace(ws2file); |
|
127 |
utils().info_workspace(ws2); |
|
128 |
|
|
129 |
// ------------------------------------------------------------ |
|
130 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
131 |
// y comprobamos que tiene lo que toca. |
|
132 |
r = ws2.checkout("test"); |
|
133 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
134 |
|
|
135 |
store2 = ws2.openFeatureStore("test",false); |
|
136 |
assertEquals("ws2-upfate sizes", 3, store2.size64()); |
|
137 |
features = store2.getFeatures((Expression) null, "id", true); |
|
138 |
|
|
139 |
utils().test_check(features, 0, 1, "AAA"); |
|
140 |
utils().test_check(features, 1, 2, "BBB"); |
|
141 |
utils().test_check(features, 2, 3, "CCC"); |
|
142 |
|
|
143 |
DisposeUtils.disposeQuietly(features); |
|
144 |
DisposeUtils.disposeQuietly(store2); |
|
145 |
|
|
146 |
// ------------------------------------------------------------ |
|
147 |
// Inicializamos el workspace3 asociandolo al mismo repositorio que |
|
148 |
// workspace1 y lo abrimos. |
|
149 |
r = vcsgismanager.initWorkspace(ws3file, repo, "Test update2", null); |
|
150 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
151 |
VCSGisWorkspace ws3 = vcsgismanager.openWorkspace(ws3file); |
|
152 |
utils().info_workspace(ws3); |
|
153 |
|
|
154 |
// ------------------------------------------------------------ |
|
155 |
// Actualizamos (update) la tabla "test" en el workspace3 |
|
156 |
// y comprobamos que tiene lo que toca. |
|
157 |
r = ws3.checkout("test"); |
|
158 |
assertEquals("ws3.update-1 status", ERR_NO_ERROR, r); |
|
159 |
|
|
160 |
store3 = ws3.openFeatureStore("test",false); |
|
161 |
assertEquals("ws3-upfate sizes", 3, store3.size64()); |
|
162 |
features = store3.getFeatures((Expression) null, "id", true); |
|
163 |
|
|
164 |
utils().test_check(features, 0, 1, "AAA"); |
|
165 |
utils().test_check(features, 1, 2, "BBB"); |
|
166 |
utils().test_check(features, 2, 3, "CCC"); |
|
167 |
|
|
168 |
DisposeUtils.disposeQuietly(features); |
|
169 |
DisposeUtils.disposeQuietly(store2); |
|
170 |
DisposeUtils.disposeQuietly(store3); |
|
171 |
|
|
172 |
return new VCSGisWorkspace[]{ws1, ws2, ws3}; |
|
173 |
} |
|
174 |
|
|
175 |
public void testTwoUpdatesAndMerge() throws Exception { |
|
176 |
|
|
177 |
try { |
|
178 |
VCSGisWorkspace[] wss = initTest(); |
|
179 |
VCSGisWorkspace ws1 = wss[0]; |
|
180 |
VCSGisWorkspace ws2 = wss[1]; |
|
181 |
|
|
182 |
int r; |
|
183 |
Feature f; |
|
184 |
EditableFeature ef; |
|
185 |
FeatureStore store1; |
|
186 |
FeatureStore store2; |
|
187 |
|
|
188 |
// Añadimos al workspace1 una feature con una id concreta y la commitamos |
|
189 |
store1 = ws1.openFeatureStore("test",false); |
|
190 |
store1.edit(); |
|
191 |
utils().test_update(store1, 3, "CC1"); |
|
192 |
|
|
193 |
store1.finishEditing(); |
|
194 |
DisposeUtils.disposeQuietly(store1); |
|
195 |
|
|
196 |
r = ws1.commit(); |
|
197 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
198 |
|
|
199 |
// Añadimos al workspace2 una feature con la misma id |
|
200 |
store2 = ws2.openFeatureStore("test",false); |
|
201 |
store2.edit(); |
|
202 |
utils().test_update(store2, 3, "CC2"); |
|
203 |
|
|
204 |
store2.finishEditing(); |
|
205 |
DisposeUtils.disposeQuietly(store2); |
|
206 |
|
|
207 |
// ------------------------------------------------------------ |
|
208 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
209 |
// comprobamos que funciona y que tiene lo que toca. |
|
210 |
r = ws2.updatePrepare("test"); |
|
211 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
212 |
|
|
213 |
// assertTrue(false); |
|
214 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
215 |
// comprobamos que falla |
|
216 |
r = ws2.update("test"); |
|
217 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
218 |
|
|
219 |
// Actualizamos (merge) la tabla "test" en el workspace2 |
|
220 |
// comprobamos que no falla |
|
221 |
r = ws2.merge("test"); |
|
222 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
223 |
|
|
224 |
//Comprobar que en la tabla de cambios locales hay 1 elemento |
|
225 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
226 |
assertEquals("ws2-changes size", 1, changes.size64()); |
|
227 |
DisposeUtils.disposeQuietly(changes); |
|
228 |
} finally { |
|
229 |
server.stop(); |
|
230 |
} |
|
231 |
|
|
232 |
} |
|
233 |
|
|
234 |
public void testTwoUpdatesMergeAndUpdate() throws Exception { |
|
235 |
try { |
|
236 |
VCSGisWorkspace[] wss = initTest(); |
|
237 |
VCSGisWorkspace ws1 = wss[0]; |
|
238 |
VCSGisWorkspace ws2 = wss[1]; |
|
239 |
VCSGisWorkspace ws3 = wss[2]; |
|
240 |
|
|
241 |
int r; |
|
242 |
Feature f; |
|
243 |
EditableFeature ef; |
|
244 |
FeatureStore store1; |
|
245 |
FeatureStore store2; |
|
246 |
FeatureStore store3; |
|
247 |
|
|
248 |
// Editamos en el workspace1 una feature con una id concreta y la commitamos |
|
249 |
store1 = ws1.openFeatureStore("test",false); |
|
250 |
store1.edit(); |
|
251 |
utils().test_update(store1, 3, "CC1"); |
|
252 |
|
|
253 |
store1.finishEditing(); |
|
254 |
DisposeUtils.disposeQuietly(store1); |
|
255 |
|
|
256 |
r = ws1.commit(); |
|
257 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
258 |
|
|
259 |
// Editamos en el workspace2 la feature con la misma id |
|
260 |
store2 = ws2.openFeatureStore("test",false); |
|
261 |
store2.edit(); |
|
262 |
utils().test_update(store2, 3, "CC2"); |
|
263 |
|
|
264 |
store2.finishEditing(); |
|
265 |
DisposeUtils.disposeQuietly(store2); |
|
266 |
|
|
267 |
// ------------------------------------------------------------ |
|
268 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
269 |
// comprobamos que funciona y que tiene lo que toca. |
|
270 |
r = ws2.updatePrepare("test"); |
|
271 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
272 |
|
|
273 |
// assertTrue(false); |
|
274 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
275 |
// comprobamos que falla |
|
276 |
r = ws2.update("test"); |
|
277 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
278 |
|
|
279 |
// Actualizamos (merge) la tabla "test" en el workspace2 |
|
280 |
// comprobamos que no falla |
|
281 |
r = ws2.merge("test"); |
|
282 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
283 |
|
|
284 |
//Comprobar que en la tabla de cambios locales hay 1 elemento |
|
285 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
286 |
assertEquals("ws2-changes size", 1, changes.size64()); |
|
287 |
DisposeUtils.disposeQuietly(changes); |
|
288 |
|
|
289 |
// Commitamos el workspace2 |
|
290 |
r = ws2.commit(); |
|
291 |
assertEquals("ws2.commit-1 status", ERR_NO_ERROR, r); |
|
292 |
|
|
293 |
// ------------------------------------------------------------ |
|
294 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace3 |
|
295 |
// comprobamos que funciona y que tiene lo que toca. |
|
296 |
r = ws3.updatePrepare("test"); |
|
297 |
assertEquals("ws3.update-1 status", ERR_NO_ERROR, r); |
|
298 |
|
|
299 |
//Comprobar que en la tabla de cambios remotos hay 1 elemento |
|
300 |
FeatureStore remoteChanges = ws3.getFeatureStore(RemoteChangesTable.TABLE_NAME); |
|
301 |
assertEquals("ws3-remoteChanges size", 1, remoteChanges.size64()); |
|
302 |
DisposeUtils.disposeQuietly(remoteChanges); |
|
303 |
|
|
304 |
// Actualizamos (update) la tabla "test" en el workspace3 |
|
305 |
// comprobamos que no falla |
|
306 |
r = ws3.update("test"); |
|
307 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
308 |
|
|
309 |
store3 = ws3.openFeatureStore("test",false); |
|
310 |
assertEquals("ws3-update sizes", 3, store3.size64()); |
|
311 |
List<Feature> features = store3.getFeatures((Expression) null, "id", true); |
|
312 |
|
|
313 |
utils().test_check(features, 0, 1, "AAA"); |
|
314 |
utils().test_check(features, 1, 2, "BBB"); |
|
315 |
utils().test_check(features, 2, 3, "CC2"); |
|
316 |
|
|
317 |
DisposeUtils.disposeQuietly(store3); |
|
318 |
} finally { |
|
319 |
server.stop(); |
|
320 |
} |
|
321 |
|
|
322 |
} |
|
323 |
|
|
324 |
public void testTwoUpdatesAndUpdate() throws Exception { |
|
325 |
try { |
|
326 |
|
|
327 |
VCSGisWorkspace[] wss = initTest(); |
|
328 |
VCSGisWorkspace ws1 = wss[0]; |
|
329 |
VCSGisWorkspace ws2 = wss[1]; |
|
330 |
|
|
331 |
int r; |
|
332 |
Feature f; |
|
333 |
EditableFeature ef; |
|
334 |
FeatureStore store1; |
|
335 |
FeatureStore store2; |
|
336 |
|
|
337 |
// Añadimos al workspace1 una feature con una id concreta y la commitamos |
|
338 |
store1 = ws1.openFeatureStore("test",false); |
|
339 |
store1.edit(); |
|
340 |
utils().test_update(store1, 3, "CC1"); |
|
341 |
|
|
342 |
store1.finishEditing(); |
|
343 |
DisposeUtils.disposeQuietly(store1); |
|
344 |
|
|
345 |
r = ws1.commit(); |
|
346 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
347 |
|
|
348 |
// Añadimos al workspace2 una feature con la misma id |
|
349 |
store2 = ws2.openFeatureStore("test",false); |
|
350 |
store2.edit(); |
|
351 |
utils().test_update(store2, 3, "CC2"); |
|
352 |
|
|
353 |
store2.finishEditing(); |
|
354 |
DisposeUtils.disposeQuietly(store2); |
|
355 |
|
|
356 |
// ------------------------------------------------------------ |
|
357 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
358 |
// comprobamos que funciona y que tiene lo que toca. |
|
359 |
r = ws2.updatePrepare("test"); |
|
360 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
361 |
|
|
362 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
363 |
// comprobamos que falla |
|
364 |
r = ws2.update("test"); |
|
365 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
366 |
|
|
367 |
//Seleccionar el cambio conflictivo id=4 |
|
368 |
utils().test_selectRemoteChange(ws2, true, 3, "CC1", ws1); |
|
369 |
|
|
370 |
// Actualizamos (merge) la tabla "test" en el workspace2 |
|
371 |
// comprobamos que no falla |
|
372 |
r = ws2.update("test"); |
|
373 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
374 |
|
|
375 |
//Comprobar que en la tabla de cambios locales no hay nada |
|
376 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
377 |
assertEquals("ws2-changes size", 0, changes.size64()); |
|
378 |
DisposeUtils.disposeQuietly(changes); |
|
379 |
|
|
380 |
} finally { |
|
381 |
server.stop(); |
|
382 |
} |
|
383 |
|
|
384 |
} |
|
385 |
|
|
386 |
public void testTwoInsertsAndUpdate() throws Exception { |
|
387 |
try { |
|
388 |
|
|
389 |
VCSGisWorkspace[] wss = initTest(); |
|
390 |
VCSGisWorkspace ws1 = wss[0]; |
|
391 |
VCSGisWorkspace ws2 = wss[1]; |
|
392 |
|
|
393 |
int r; |
|
394 |
Feature f; |
|
395 |
EditableFeature ef; |
|
396 |
List<Feature> features; |
|
397 |
FeatureStore store1; |
|
398 |
FeatureStore store2; |
|
399 |
|
|
400 |
// Añadimos al workspace1 una feature con una id concreta y la commitamos |
|
401 |
store1 = ws1.openFeatureStore("test",false); |
|
402 |
store1.edit(); |
|
403 |
utils().test_insert(store1, 4, "DD1"); |
|
404 |
|
|
405 |
store1.finishEditing(); |
|
406 |
DisposeUtils.disposeQuietly(store1); |
|
407 |
|
|
408 |
r = ws1.commit(); |
|
409 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
410 |
|
|
411 |
// Añadimos al workspace2 una feature con la misma id |
|
412 |
store2 = ws2.openFeatureStore("test",false); |
|
413 |
store2.edit(); |
|
414 |
utils().test_insert(store2, 4, "DD2"); |
|
415 |
|
|
416 |
store2.finishEditing(); |
|
417 |
DisposeUtils.disposeQuietly(store2); |
|
418 |
|
|
419 |
// ------------------------------------------------------------ |
|
420 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
421 |
// comprobamos que funciona y que tiene lo que toca. |
|
422 |
r = ws2.updatePrepare("test"); |
|
423 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
424 |
|
|
425 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
426 |
// See in console debug message with |
|
427 |
// "===: UPDATE_PREPARE: conflicts. { "id":4, ..." |
|
428 |
// and use here the value of the field VCSGISCODE |
|
429 |
utils().test_checkLocalChange(store2, changes, "00000000000036abcdef0123456789", OP_INSERT, 4, "DD2", STATE_CONFLICT); |
|
430 |
DisposeUtils.disposeQuietly(changes); |
|
431 |
|
|
432 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
433 |
// comprobamos que no falla |
|
434 |
r = ws2.update("test"); |
|
435 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
436 |
|
|
437 |
//Seleccionar el cambio conflictivo id=4 |
|
438 |
utils().test_selectRemoteChange(ws2, true, 4, "DD1", ws1); |
|
439 |
|
|
440 |
//update y comprobar que funciona y se ha borrado la feature conflictiva nuestra |
|
441 |
r = ws2.update("test"); |
|
442 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
443 |
|
|
444 |
store2 = ws2.openFeatureStore("test",false); |
|
445 |
assertEquals("ws2-upfate sizes", 4, store2.size64()); |
|
446 |
features = store2.getFeatures((Expression) null, "id", true); |
|
447 |
|
|
448 |
utils().test_check(features, 0, 1, "AAA"); |
|
449 |
utils().test_check(features, 1, 2, "BBB"); |
|
450 |
utils().test_check(features, 2, 3, "CCC"); |
|
451 |
utils().test_check(features, 3, 4, "DD1"); |
|
452 |
|
|
453 |
//Comprobar que en la tabla de cambios locales no hay nada |
|
454 |
changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
455 |
assertEquals("ws2-changes size", 0, changes.size64()); |
|
456 |
DisposeUtils.disposeQuietly(changes); |
|
457 |
} finally { |
|
458 |
server.stop(); |
|
459 |
} |
|
460 |
|
|
461 |
} |
|
462 |
|
|
463 |
public void testTwoInsertsAndMerge() throws Exception { |
|
464 |
try { |
|
465 |
|
|
466 |
VCSGisWorkspace[] wss = initTest(); |
|
467 |
VCSGisWorkspace ws1 = wss[0]; |
|
468 |
VCSGisWorkspace ws2 = wss[1]; |
|
469 |
|
|
470 |
int r; |
|
471 |
Feature f; |
|
472 |
EditableFeature ef; |
|
473 |
List<Feature> features; |
|
474 |
FeatureStore store1; |
|
475 |
FeatureStore store2; |
|
476 |
|
|
477 |
//Insertamos dos registros nuevos y repetirlo todo sin seleccionar cambio conflictivo y hacer un merge y que funcione |
|
478 |
// Añadimos al workspace1 una feature con una id concreta y la commitamos |
|
479 |
store1 = ws1.openFeatureStore("test",false); |
|
480 |
store1.edit(); |
|
481 |
utils().test_insert(store1, 4, "DD1"); |
|
482 |
|
|
483 |
store1.finishEditing(); |
|
484 |
DisposeUtils.disposeQuietly(store1); |
|
485 |
|
|
486 |
r = ws1.commit(); |
|
487 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
488 |
|
|
489 |
// Añadimos al workspace2 una feature con la misma id |
|
490 |
store2 = ws2.openFeatureStore("test",false); |
|
491 |
store2.edit(); |
|
492 |
utils().test_insert(store2, 4, "DD2"); |
|
493 |
|
|
494 |
store2.finishEditing(); |
|
495 |
DisposeUtils.disposeQuietly(store2); |
|
496 |
|
|
497 |
// ------------------------------------------------------------ |
|
498 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
499 |
// comprobamos que funciona y que tiene lo que toca. |
|
500 |
r = ws2.updatePrepare("test"); |
|
501 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
502 |
|
|
503 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
504 |
// comprobamos que falla |
|
505 |
r = ws2.update("test"); |
|
506 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
507 |
|
|
508 |
//merge y comprobar que funciona y no se insertado el cambio conflictivo |
|
509 |
r = ws2.merge("test"); |
|
510 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
511 |
|
|
512 |
store2 = ws2.openFeatureStore("test",false); |
|
513 |
assertEquals("ws2-upfate sizes", 4, store2.size64()); |
|
514 |
features = store2.getFeatures((Expression) null, "id", true); |
|
515 |
|
|
516 |
utils().test_check(features, 0, 1, "AAA"); |
|
517 |
utils().test_check(features, 1, 2, "BBB"); |
|
518 |
utils().test_check(features, 2, 3, "CCC"); |
|
519 |
utils().test_check(features, 3, 4, "DD2"); |
|
520 |
|
|
521 |
//Comprobamos que se ha añadido a la tabla de cambios local el delete del cambio conflictivo |
|
522 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
523 |
assertEquals("ws2-changes size", 2, changes.size64()); |
|
524 |
|
|
525 |
// See in console debug message with |
|
526 |
// "===: UPDATE: add delete operation to RelatedFeatureCode ..." |
|
527 |
// and use here the value RelatedFeatureCode |
|
528 |
utils().test_checkLocalChange(store2, changes, "00000000000028abcdef0123456789", OP_DELETE, 4, "DD1", -1); |
|
529 |
|
|
530 |
// See in console debug message with |
|
531 |
// "===: UPDATE_PREPARE: conflicts. { "id":4, "text":"DD2"" |
|
532 |
// and use here the value of the field VCSGISCODE |
|
533 |
utils().test_checkLocalChange(store2, changes, "00000000000036abcdef0123456789", OP_INSERT, 4, "DD2", -1); |
|
534 |
DisposeUtils.disposeQuietly(changes); |
|
535 |
} finally { |
|
536 |
server.stop(); |
|
537 |
} |
|
538 |
|
|
539 |
} |
|
540 |
|
|
541 |
public void testOneCommitAndUpdateOverDeleted() throws Exception { |
|
542 |
try { |
|
543 |
|
|
544 |
VCSGisWorkspace[] wss = initTest(); |
|
545 |
VCSGisWorkspace ws1 = wss[0]; |
|
546 |
VCSGisWorkspace ws2 = wss[1]; |
|
547 |
List<Feature> features; |
|
548 |
|
|
549 |
int r; |
|
550 |
Feature f; |
|
551 |
EditableFeature ef; |
|
552 |
FeatureStore store1; |
|
553 |
FeatureStore store2; |
|
554 |
|
|
555 |
// Modificamos en workspace1 una feature con una id concreta y la commitamos |
|
556 |
store1 = ws1.openFeatureStore("test",false); |
|
557 |
store1.edit(); |
|
558 |
utils().test_update(store1, 3, "CC1"); |
|
559 |
|
|
560 |
store1.finishEditing(); |
|
561 |
DisposeUtils.disposeQuietly(store1); |
|
562 |
|
|
563 |
r = ws1.commit(); |
|
564 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
565 |
|
|
566 |
// Borramos en el workspace2 la feature con la misma id |
|
567 |
store2 = ws2.openFeatureStore("test",false); |
|
568 |
store2.edit(); |
|
569 |
utils().test_delete(store2, 3, "CCC"); |
|
570 |
|
|
571 |
store2.finishEditing(); |
|
572 |
DisposeUtils.disposeQuietly(store2); |
|
573 |
|
|
574 |
// ------------------------------------------------------------ |
|
575 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
576 |
// comprobamos que funciona y que tiene lo que toca. |
|
577 |
r = ws2.updatePrepare("test"); |
|
578 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
579 |
|
|
580 |
// assertTrue(false); |
|
581 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
582 |
// comprobamos que falla |
|
583 |
r = ws2.update("test"); |
|
584 |
assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
585 |
|
|
586 |
// // Actualizamos (merge) la tabla "test" en el workspace2 |
|
587 |
// // comprobamos que no falla |
|
588 |
// r = ws2.merge("test"); |
|
589 |
// assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
590 |
//Seleccionar el cambio conflictivo id=4 |
|
591 |
utils().test_selectRemoteChange(ws2, true, 3, "CC1", ws1); |
|
592 |
|
|
593 |
//update y comprobar que funciona y no se ha insertado la feature conflictiva |
|
594 |
r = ws2.update("test"); |
|
595 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
596 |
|
|
597 |
store2 = ws2.openFeatureStore("test",false); |
|
598 |
assertEquals("ws2-update sizes", 3, store2.size64()); |
|
599 |
features = store2.getFeatures((Expression) null, "id", true); |
|
600 |
|
|
601 |
utils().test_check(features, 0, 1, "AAA"); |
|
602 |
utils().test_check(features, 1, 2, "BBB"); |
|
603 |
utils().test_check(features, 2, 3, "CC1"); |
|
604 |
|
|
605 |
//Comprobar que en la tabla de cambios locales no hay nada |
|
606 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
607 |
assertEquals("ws2-changes size", 0, changes.size64()); |
|
608 |
DisposeUtils.disposeQuietly(changes); |
|
609 |
} finally { |
|
610 |
server.stop(); |
|
611 |
} |
|
612 |
|
|
613 |
} |
|
614 |
|
|
615 |
public void testOneCommitAndMergeOverDeleted() throws Exception { |
|
616 |
try { |
|
617 |
|
|
618 |
VCSGisWorkspace[] wss = initTest(); |
|
619 |
VCSGisWorkspace ws1 = wss[0]; |
|
620 |
VCSGisWorkspace ws2 = wss[1]; |
|
621 |
List<Feature> features; |
|
622 |
|
|
623 |
int r; |
|
624 |
Feature f; |
|
625 |
EditableFeature ef; |
|
626 |
FeatureStore store1; |
|
627 |
FeatureStore store2; |
|
628 |
|
|
629 |
// Modificamos en workspace1 una feature con una id concreta y la commitamos |
|
630 |
store1 = ws1.openFeatureStore("test",false); |
|
631 |
store1.edit(); |
|
632 |
utils().test_update(store1, 3, "CC1"); |
|
633 |
|
|
634 |
store1.finishEditing(); |
|
635 |
DisposeUtils.disposeQuietly(store1); |
|
636 |
|
|
637 |
r = ws1.commit(); |
|
638 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
639 |
|
|
640 |
// Borramos en el workspace2 la feature con la misma id |
|
641 |
store2 = ws2.openFeatureStore("test",false); |
|
642 |
store2.edit(); |
|
643 |
utils().test_delete(store2, 3, "CCC"); |
|
644 |
|
|
645 |
store2.finishEditing(); |
|
646 |
DisposeUtils.disposeQuietly(store2); |
|
647 |
|
|
648 |
// ------------------------------------------------------------ |
|
649 |
// Preparamos la actualización de (updatePrepare) la tabla "test" en el workspace2 |
|
650 |
// comprobamos que funciona y que tiene lo que toca. |
|
651 |
r = ws2.updatePrepare("test"); |
|
652 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
653 |
|
|
654 |
// assertTrue(false); |
|
655 |
// Actualizamos (update) la tabla "test" en el workspace2 |
|
656 |
// comprobamos que falla |
|
657 |
// r = ws2.update("test"); |
|
658 |
// assertEquals("ws2.update-1 status", ERR_UPDATE_NEED_MERGE, r); |
|
659 |
// Actualizamos (merge) la tabla "test" en el workspace2 |
|
660 |
// comprobamos que no falla |
|
661 |
r = ws2.merge("test"); |
|
662 |
assertEquals("ws2.update-1 status", ERR_NO_ERROR, r); |
|
663 |
|
|
664 |
//Comprobamos que en workspace2 hay lo que toca |
|
665 |
store2 = ws2.openFeatureStore("test",false); |
|
666 |
assertEquals("ws2-update sizes", 2, store2.size64()); |
|
667 |
features = store2.getFeatures((Expression) null, "id", true); |
|
668 |
|
|
669 |
utils().test_check(features, 0, 1, "AAA"); |
|
670 |
utils().test_check(features, 1, 2, "BBB"); |
|
671 |
// check(features, 2, 3, "CC1"); |
|
672 |
|
|
673 |
//Comprobar que en la tabla de cambios locales permanece el cambio |
|
674 |
FeatureStore changes = ws2.getFeatureStore(WorkspaceChangesTable.TABLE_NAME); |
|
675 |
assertEquals("ws2-changes size", 1, changes.size64()); |
|
676 |
DisposeUtils.disposeQuietly(changes); |
|
677 |
} finally { |
|
678 |
server.stop(); |
|
679 |
} |
|
680 |
|
|
681 |
} |
|
682 |
|
|
683 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/src/test/java/org/gvsig/vcsgis/app/server/TestSrv02Entities.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.app.server; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Locale; |
|
7 |
import junit.framework.TestCase; |
|
8 |
import static junit.framework.TestCase.assertEquals; |
|
9 |
import org.apache.commons.io.FileUtils; |
|
10 |
import org.eclipse.jetty.server.Server; |
|
11 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
12 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
13 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
14 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
15 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.createServer; |
|
16 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.utils; |
|
17 |
import static org.gvsig.vcsgis.app.server.VCSGisJettyServerUtils.SERVER_PORT; |
|
18 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
|
19 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
20 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
21 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
22 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
23 |
import org.slf4j.Logger; |
|
24 |
import org.slf4j.LoggerFactory; |
|
25 |
|
|
26 |
public class TestSrv02Entities extends TestCase { |
|
27 |
|
|
28 |
private static final Logger LOGGER = LoggerFactory.getLogger(TestSrv02Entities.class); |
|
29 |
|
|
30 |
static{ |
|
31 |
Locale.setDefault(Locale.forLanguageTag("es-ES")); |
|
32 |
} |
|
33 |
|
|
34 |
public TestSrv02Entities(String testName) { |
|
35 |
super(testName); |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
protected void setUp() throws Exception { |
|
40 |
super.setUp(); |
|
41 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void tearDown() throws Exception { |
|
46 |
super.tearDown(); |
|
47 |
} |
|
48 |
|
|
49 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
50 |
// public void testHello() {} |
|
51 |
public void testEntities() throws Exception { |
|
52 |
final String testid = "ServerAddCommit"; |
|
53 |
final URL serverUrl = new URL("http://localhost:" + SERVER_PORT + "/"); |
|
54 |
|
|
55 |
VCSGisManager vcsgismanager = VCSGisLocator.getVCSGisManager(); |
|
56 |
JDBCServerExplorerParameters explorerParams = utils().getRepositoryServerExplorerParameters("srv-" + testid); |
|
57 |
File wsfile = utils().getFile(FileUtils.getFile("test-dbs", "ws-" + testid)); |
|
58 |
|
|
59 |
// --------------------------------------------------------- |
|
60 |
// Creamos el server y obtenemos el repositorio del server |
|
61 |
int r = vcsgismanager.initRepository(explorerParams, null); |
|
62 |
assertEquals("srv-init status", 0, r); |
|
63 |
|
|
64 |
Server server = createServer(utils(),explorerParams); |
|
65 |
try { |
|
66 |
server.start(); |
|
67 |
|
|
68 |
VCSGisRepository repositoryRemote = vcsgismanager.openRepository(serverUrl); |
|
69 |
|
|
70 |
// --------------------------------------------------------- |
|
71 |
// Creamos un workspace y preparamos los datos en el para hacer un commit |
|
72 |
r = vcsgismanager.initWorkspace(wsfile, repositoryRemote, "Test add and commit", null); |
|
73 |
assertEquals("ws-init status", 0, r); |
|
74 |
|
|
75 |
VCSGisWorkspace ws = vcsgismanager.openWorkspace(wsfile); |
|
76 |
utils().info_workspace(ws); |
|
77 |
|
|
78 |
FeatureStore sourceStore = utils().openSourceStore1(); |
|
79 |
long expectedRows = sourceStore.getFeatureCount(); |
|
80 |
|
|
81 |
r = ws.add("sourceStore1", sourceStore, "ID"); |
|
82 |
assertEquals("ws-add status", 0, r); |
|
83 |
|
|
84 |
DisposeUtils.disposeQuietly(sourceStore); |
|
85 |
|
|
86 |
r = ws.commit(); |
|
87 |
assertEquals("ws-commit status", 0, r); |
|
88 |
|
|
89 |
// --------------------------------------------------------- |
|
90 |
// Comprobamos que en el server esta la tabla que acabamos de adicionar |
|
91 |
ws.updateEntitiesFromRepository(null); |
|
92 |
List<VCSGisEntity> rentities = ws.getRepositoryEntities(); |
|
93 |
assertEquals("Num entities in server", 1, rentities.size()); |
|
94 |
assertEquals("Name of the entity in server", "sourceStore1", rentities.get(0).getEntityName()); |
|
95 |
} finally { |
|
96 |
server.stop(); |
|
97 |
} |
|
98 |
} |
|
99 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/src/test/java/org/gvsig/vcsgis/app/server/TestSrv05Update.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.app.server; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.sql.Timestamp; |
|
6 |
import java.util.List; |
|
7 |
import java.util.Locale; |
|
8 |
import junit.framework.TestCase; |
|
9 |
import static junit.framework.TestCase.assertEquals; |
|
10 |
import static junit.framework.TestCase.assertNotNull; |
|
11 |
import org.apache.commons.io.FileUtils; |
|
12 |
import org.eclipse.jetty.server.Server; |
|
13 |
import org.gvsig.expressionevaluator.Expression; |
|
14 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
15 |
import org.gvsig.fmap.dal.feature.Feature; |
|
16 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
17 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
18 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
19 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
20 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.createServer; |
|
21 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.utils; |
|
22 |
import static org.gvsig.vcsgis.app.server.VCSGisJettyServerUtils.SERVER_PORT; |
|
23 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
|
24 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
|
25 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
26 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
27 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
|
28 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
29 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldbImpl; |
|
30 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
31 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
32 |
import org.slf4j.Logger; |
|
33 |
import org.slf4j.LoggerFactory; |
|
34 |
|
|
35 |
public class TestSrv05Update extends TestCase { |
|
36 |
|
|
37 |
private static final Logger LOGGER = LoggerFactory.getLogger(TestSrv05Update.class); |
|
38 |
|
|
39 |
static{ |
|
40 |
Locale.setDefault(Locale.forLanguageTag("es-ES")); |
|
41 |
} |
|
42 |
|
|
43 |
public TestSrv05Update(String testName) { |
|
44 |
super(testName); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void setUp() throws Exception { |
|
49 |
super.setUp(); |
|
50 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected void tearDown() throws Exception { |
|
55 |
super.tearDown(); |
|
56 |
} |
|
57 |
|
|
58 |
@SuppressWarnings("UnusedAssignment") |
|
59 |
public void testUpdate() throws Exception { |
|
60 |
final String testid = "ServerUpdate"; |
|
61 |
final URL serverUrl = new URL("http://localhost:" + SERVER_PORT + "/"); |
|
62 |
|
|
63 |
SequentialCodeGenerator.reset(); |
|
64 |
|
|
65 |
VCSGisManager vcsgismanager = VCSGisLocator.getVCSGisManager(); |
|
66 |
vcsgismanager.setCodeGenerator(new SequentialCodeGenerator()); |
|
67 |
JDBCServerExplorerParameters explorerParams = utils().getRepositoryServerExplorerParameters("srv-" + testid); |
|
68 |
File ws1file = utils().getFile(FileUtils.getFile("test-dbs", "ws1-" + testid)); |
|
69 |
File ws2file = utils().getFile(FileUtils.getFile("test-dbs", "ws2-" + testid)); |
|
70 |
|
|
71 |
int r; |
|
72 |
Feature f; |
|
73 |
EditableFeature ef; |
|
74 |
List<Feature> features; |
|
75 |
FeatureStore store1; |
|
76 |
FeatureStore store2; |
|
77 |
|
|
78 |
// --------------------------------------------------------- |
|
79 |
// Creamos el server y obtenemos el repositorio del server |
|
80 |
r = vcsgismanager.initRepository(explorerParams, null); |
|
81 |
assertEquals("srv-init status", 0, r); |
|
82 |
|
|
83 |
Server server = createServer(utils(),explorerParams); |
|
84 |
VCSGisWorkspaceEntity lentity = null; |
|
85 |
|
|
86 |
try { |
|
87 |
server.start(); |
|
88 |
|
|
89 |
VCSGisRepository repositoryRemote = vcsgismanager.openRepository(serverUrl); |
|
90 |
|
|
91 |
// ------------------------------------------------------------ |
|
92 |
// Creamos workspace1 y lo abrimos. |
|
93 |
r = vcsgismanager.initWorkspace(ws1file, repositoryRemote, "Test update1", null); |
|
94 |
assertEquals("init_ws1 status", ERR_NO_ERROR, r); |
|
95 |
|
|
96 |
VCSGisWorkspace ws1 = vcsgismanager.openWorkspace(ws1file); |
|
97 |
utils().info_workspace(ws1); |
|
98 |
|
|
99 |
// ------------------------------------------------------------ |
|
100 |
// Adicionamos al workspace1 la tabla "test" y la commitamos. |
|
101 |
FeatureStore sourceTest = utils().openSourceStore2(); |
|
102 |
r = ws1.add("test", sourceTest, "text"); |
|
103 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
|
104 |
|
|
105 |
store1 = ws1.openFeatureStore("test",false); |
|
106 |
store1.edit(); |
|
107 |
utils().test_insert(store1, 4, "DDD"); |
|
108 |
utils().test_insert(store1, 5, "EEE"); |
|
109 |
utils().test_insert(store1, 6, "FFF"); |
|
110 |
store1.finishEditing(); |
|
111 |
|
|
112 |
r = ws1.commit(); |
|
113 |
assertEquals("ws1.commit-1 status", ERR_NO_ERROR, r); |
|
114 |
DisposeUtils.disposeQuietly(sourceTest); |
|
115 |
|
|
116 |
// ------------------------------------------------------------ |
|
117 |
// Inicializamos el workspace2 asociandolo al mismo repositorio que |
|
118 |
// workspace1 y lo abrimos. |
|
119 |
r = vcsgismanager.initWorkspace(ws2file, repositoryRemote, "Test update2", null); |
|
120 |
assertEquals("init_ws2 status", ERR_NO_ERROR, r); |
|
121 |
VCSGisWorkspace ws2 = vcsgismanager.openWorkspace(ws2file); |
|
122 |
utils().info_workspace(ws2); |
|
123 |
|
|
124 |
// ------------------------------------------------------------ |
|
125 |
// Hacemos un checkout en workspace2 de la tabla "test" |
|
126 |
// y comprobamos que tiene lo que toca. |
|
127 |
r = ws2.checkout("test"); |
|
128 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
|
129 |
|
|
130 |
VCSGisEntity entity = ws2.getWorkspaceEntityByName("test"); |
|
131 |
assertNotNull("ws2.update-1 entity", entity); |
|
132 |
assertEquals("ws2.update-1 label", "text", entity.getFieldForLabel()); |
|
133 |
|
|
134 |
store2 = ws2.openFeatureStore("test",false); |
|
135 |
assertEquals("ws2-checkout sizes", 6, store2.size64()); |
|
136 |
features = store2.getFeatures((Expression) null, "id", true); |
|
137 |
|
|
138 |
utils().test_check(features, 0, 1, "AAA"); |
|
139 |
utils().test_check(features, 1, 2, "BBB"); |
|
140 |
utils().test_check(features, 2, 3, "CCC"); |
|
141 |
utils().test_check(features, 3, 4, "DDD"); |
|
142 |
utils().test_check(features, 4, 5, "EEE"); |
|
143 |
utils().test_check(features, 5, 6, "FFF"); |
|
144 |
|
|
145 |
DisposeUtils.disposeQuietly(features); |
|
146 |
DisposeUtils.disposeQuietly(store2); |
|
147 |
|
|
148 |
// ------------------------------------------------------------ |
|
149 |
// Modificamos la tabla "test" en el workspace1 y la commitamos. |
|
150 |
store1 = ws1.openFeatureStore("test",false); |
|
151 |
store1.edit(); |
|
152 |
utils().test_insert(store1, 7, "GGG"); |
|
153 |
utils().test_update(store1, 2, "BB2"); |
|
154 |
utils().test_delete(store1, 3, "CCC"); |
|
155 |
store1.finishEditing(); |
|
156 |
|
|
157 |
DisposeUtils.disposeQuietly(store1); |
|
158 |
r = ws1.commit(Timestamp.valueOf("2020-02-17 10:11:12.123"), "Insertado DDD y modificado BBB a BB2", null); |
|
159 |
assertEquals("ws1.commit-2 status", ERR_NO_ERROR, r); |
|
160 |
|
|
161 |
String localRevisionCode = ws2.getWorkspaceEntity("test").getRepositoryRevisionCode(); |
|
162 |
assertEquals("ws2 localRevisionCode", "00000000000021abcdef0123456789", localRevisionCode); |
|
163 |
|
|
164 |
r = ws2.updatePrepare("test"); |
|
165 |
assertEquals("ws2-updatePrepare status", ERR_NO_ERROR, r); |
|
166 |
|
|
167 |
r = ws2.update("test"); |
|
168 |
assertEquals("ws2-update status", ERR_NO_ERROR, r); |
|
169 |
|
|
170 |
store2 = ws2.openFeatureStore("test",false); |
|
171 |
assertEquals("ws2-checkout sizes", 6, store2.size64()); |
|
172 |
features = store2.getFeatures((Expression) null, "id", true); |
|
173 |
|
|
174 |
utils().test_check(features, 0, 1, "AAA"); |
|
175 |
utils().test_check(features, 1, 2, "BB2"); |
|
176 |
utils().test_check(features, 2, 4, "DDD"); |
|
177 |
utils().test_check(features, 3, 5, "EEE"); |
|
178 |
utils().test_check(features, 4, 6, "FFF"); |
|
179 |
utils().test_check(features, 5, 7, "GGG"); |
|
180 |
|
|
181 |
DisposeUtils.disposeQuietly(features); |
|
182 |
DisposeUtils.disposeQuietly(store2); |
|
183 |
|
|
184 |
lentity = ws2.getWorkspaceEntity("test"); |
|
185 |
|
|
186 |
ws1.dispose(); |
|
187 |
ws2.dispose(); |
|
188 |
ws1 = null; |
|
189 |
ws2 = null; |
|
190 |
|
|
191 |
// --------------------------------------------------------- |
|
192 |
// Comprobamos que la tabla adicionada al espacio ed trabajo contiene |
|
193 |
// los mismos registros que la original. |
|
194 |
} finally { |
|
195 |
server.stop(); |
|
196 |
} |
|
197 |
|
|
198 |
VCSGisRepositoryLocaldbImpl repositoryLocal = (VCSGisRepositoryLocaldbImpl) vcsgismanager.openRepository(explorerParams); |
|
199 |
VCSGisEntity rentity = repositoryLocal.getEntityByName("test"); |
|
200 |
|
|
201 |
assertEquals("Check local revision code", lentity.getLocalRevisionCode(), rentity.getRepositoryRevisionCode()); |
|
202 |
assertEquals("Check repository revision code", lentity.getRepositoryRevisionCode(), rentity.getRepositoryRevisionCode()); |
|
203 |
|
|
204 |
repositoryLocal.dispose(); |
|
205 |
|
|
206 |
} |
|
207 |
} |
org.gvsig.vcsgis/tags/org.gvsig.vcsgis-1.0.54/org.gvsig.vcsgis.app/org.gvsig.vcsgis.app.server/src/test/java/org/gvsig/vcsgis/app/server/TestSrv03Checkout.java | ||
---|---|---|
1 |
package org.gvsig.vcsgis.app.server; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.sql.Timestamp; |
|
6 |
import java.util.Locale; |
|
7 |
import junit.framework.TestCase; |
|
8 |
import static junit.framework.TestCase.assertEquals; |
|
9 |
import org.apache.commons.io.FileUtils; |
|
10 |
import org.eclipse.jetty.server.Server; |
|
11 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
12 |
import org.gvsig.fmap.dal.feature.Feature; |
|
13 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
14 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
|
15 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
16 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
17 |
import org.gvsig.tools.dispose.DisposeUtils; |
|
18 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
19 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.createServer; |
|
20 |
import static org.gvsig.vcsgis.app.server.TestServerUtils.utils; |
|
21 |
import static org.gvsig.vcsgis.app.server.VCSGisJettyServerUtils.SERVER_PORT; |
|
22 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
|
23 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
|
24 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
|
25 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_OK; |
|
26 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
|
27 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldbImpl; |
|
28 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.DataRepoTable; |
|
29 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
|
30 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
|
31 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
|
32 |
import org.slf4j.Logger; |
|
33 |
import org.slf4j.LoggerFactory; |
|
34 |
|
|
35 |
public class TestSrv03Checkout extends TestCase { |
|
36 |
|
|
37 |
private static final Logger LOGGER = LoggerFactory.getLogger(TestSrv03Checkout.class); |
|
38 |
|
|
39 |
static{ |
|
40 |
Locale.setDefault(Locale.forLanguageTag("es-ES")); |
|
41 |
} |
|
42 |
|
|
43 |
public TestSrv03Checkout(String testName) { |
|
44 |
super(testName); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
protected void setUp() throws Exception { |
|
49 |
super.setUp(); |
|
50 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
51 |
} |
|
52 |
|
|
53 |
@Override |
|
54 |
protected void tearDown() throws Exception { |
|
55 |
super.tearDown(); |
|
56 |
} |
|
57 |
|
|
58 |
// TODO add test methods here. The name must begin with 'test'. For example: |
|
59 |
// public void testHello() {} |
|
60 |
public void testCheckout() throws Exception { |
|
61 |
final String testid = "ServerCheckout"; |
|
62 |
final URL serverUrl = new URL("http://localhost:" + SERVER_PORT + "/"); |
Also available in: Unified diff