Revision 3454
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/repository/localdb/tables/EntitiesRepoTable.java | ||
---|---|---|
50 | 50 |
private static final String LABEL = "ENT_LABEL"; |
51 | 51 |
private static final String AUTHORIZATIONS = "ENT_AUTORIZATIONS"; |
52 | 52 |
private static final String TOPOLOGYPLAN_MODE = "ENT_TOPOLOGYPLAN_MODE"; |
53 |
private static final String RESOURCES = "ENT_RESOURCES";
|
|
54 |
private static final String DATA_MODELS = "ENT_DATA_MODELS";
|
|
53 |
public static final String RESOURCES = "ENT_RESOURCES";
|
|
54 |
public static final String DATA_MODELS = "ENT_DATA_MODELS";
|
|
55 | 55 |
|
56 | 56 |
public static class EntityRepoRow extends AbstractRow implements VCSGisEntityEditable { |
57 | 57 |
|
... | ... | |
139 | 139 |
|
140 | 140 |
@Override |
141 | 141 |
public int getTopologyPlanMode() { |
142 |
return this.feature.getInt(TOPOLOGYPLAN_MODE);
|
|
142 |
return this.feature.getIntOrDefault(TOPOLOGYPLAN_MODE, TOPOLOGYPLAN_MODE_RECOMMENDED);
|
|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
@Override |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/main/java/org/gvsig/vcsgis/lib/workspace/tables/EntitiesTable.java | ||
---|---|---|
14 | 14 |
import org.gvsig.json.JsonObjectBuilder; |
15 | 15 |
import org.gvsig.tools.dataTypes.DataTypes; |
16 | 16 |
import org.gvsig.tools.dispose.DisposeUtils; |
17 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
17 | 18 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
18 | 19 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
19 | 20 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_CONFLICT; |
... | ... | |
26 | 27 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_MODIFIED; |
27 | 28 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_OUTDATED; |
28 | 29 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_OUTDATED_AND_MODIFIED; |
30 |
import static org.gvsig.vcsgis.lib.VCSGisManager.TOPOLOGYPLAN_MODE_MANDATORY; |
|
31 |
import static org.gvsig.vcsgis.lib.VCSGisManager.TOPOLOGYPLAN_MODE_RECOMMENDED; |
|
29 | 32 |
import org.gvsig.vcsgis.lib.VCSGisUser; |
30 | 33 |
|
31 | 34 |
/** |
... | ... | |
143 | 146 |
|
144 | 147 |
@Override |
145 | 148 |
public int getTopologyPlanMode() { |
146 |
return this.getInt(TOPOLOGYPLAN_MODE); |
|
149 |
return this.getInt(TOPOLOGYPLAN_MODE, TOPOLOGYPLAN_MODE_RECOMMENDED);
|
|
147 | 150 |
} |
148 | 151 |
|
149 | 152 |
@Override |
... | ... | |
463 | 466 |
|
464 | 467 |
@Override |
465 | 468 |
public VCSGisEntityEditable setDataModels(String dataModels) { |
466 |
this.set(RESOURCES, dataModels);
|
|
469 |
this.set(DATA_MODELS, dataModels);
|
|
467 | 470 |
return this; |
468 | 471 |
} |
469 | 472 |
|
... | ... | |
597 | 600 |
.setSize(10240) |
598 | 601 |
.setLabel("Feature type"); |
599 | 602 |
ft.add(TOPOLOGYPLAN_MODE, DataTypes.INTEGER) |
600 |
.setLabel("Topology plan mode"); |
|
603 |
.setLabel("Topology plan mode") |
|
604 |
.setAvailableValues(new DynObjectValueItem[] { |
|
605 |
new DynObjectValueItem(TOPOLOGYPLAN_MODE_RECOMMENDED, "Recommended"), |
|
606 |
new DynObjectValueItem(TOPOLOGYPLAN_MODE_MANDATORY, "Mandatory") |
|
607 |
}) |
|
608 |
; |
|
601 | 609 |
ft.add(RESOURCES, DataTypes.STRING) |
602 | 610 |
.setSize(200) |
603 | 611 |
.setLabel("Resources"); |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S01Entities.txt | ||
---|---|---|
29 | 29 |
"Category":null, |
30 | 30 |
"Label":"test", |
31 | 31 |
"Autorizations":null, |
32 |
"TopologyPlanMode":0 |
|
32 |
"TopologyPlanMode":0, |
|
33 |
"Resources":null, |
|
34 |
"DataModels":null |
|
33 | 35 |
} |
34 | 36 |
] |
35 | 37 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S05Update.txt | ||
---|---|---|
22 | 22 |
"StatusMessage":"_No_errors", |
23 | 23 |
"Entity":{ |
24 | 24 |
"DataTableName":"VCSGIS_DATA", |
25 |
"Description":"",
|
|
25 |
"Description":null,
|
|
26 | 26 |
"EntityCode":"00000000000004abcdef0123456789", |
27 | 27 |
"EntityName":"test", |
28 | 28 |
"FeatureIdFieldName":"VCSGISCODE", |
29 | 29 |
"FeatureTypeAsJson":"\n{\n \"__classname__\":\"org.gvsig.fmap.dal.feature.impl.DefaultFeatureType\",\n \"id\":\"testSource2\",\n \"internalID\":\"7c54a6bc\",\n \"label\":null,\n \"description\":null,\n \"allowAtomaticValues\":false,\n \"hasOID\":false,\n \"defaultGeometryAttributeName\":null,\n \"defaultTimeAttributeName\":null,\n \"tags\":{\n \"__classname__\":\"org.gvsig.tools.dynobject.impl.DefaultTags\"\n },\n \"extraColumns\":{\n \"__classname__\":\"org.gvsig.fmap.dal.feature.impl.DefaultFeatureExtraColumns\",\n \"extraColumns\":[\n ]\n },\n \"descriptors\":[\n {\n \"__classname__\":\"org.gvsig.fmap.dal.feature.impl.DefaultFeatureAttributeDescriptor\",\n \"name\":\"id\",\n \"description\":null,\n \"label\":null,\n \"shortLabel\":null,\n \"order\":0,\n \"groupName\":null,\n \"dataType\":{\n \"__classname__\":\"org.gvsig.tools.dataTypes.impl.DefaultDataType\",\n \"name\":\"Integer\",\n \"type\":4,\n \"subtype\":null\n },\n \"size\":0,\n \"precision\":10,\n \"scale\":0,\n \"roundMode\":4,\n \"allowNull\":false,\n \"primaryKey\":false,\n \"readOnly\":false,\n \"isAutomatic\":false,\n \"isTime\":false,\n \"indexed\":true,\n \"isIndexAscending\":true,\n \"allowIndexDuplicateds\":false,\n \"hidden\":false,\n \"avoidCachingAvailableValues\":false,\n \"geometryType\":null,\n \"srs\":null,\n \"relationType\":0,\n \"displaySize\":0,\n \"locale\":{\n \"__classname__\":\"java.util.Locale\",\n \"languageTag\":\"en\"\n },\n \"expression\":null,\n \"availableValuesExpression\":null,\n \"defaultValue\":\"\",\n \"dataProfile\":null,\n \"tags\":{\n \"__classname__\":\"org.gvsig.tools.dynobject.impl.DefaultTags\"\n },\n \"availableValues\":null,\n \"additionalInfo\":null\n },\n {\n \"__classname__\":\"org.gvsig.fmap.dal.feature.impl.DefaultFeatureAttributeDescriptor\",\n \"name\":\"text\",\n \"description\":null,\n \"label\":null,\n \"shortLabel\":null,\n \"order\":10,\n \"groupName\":null,\n \"dataType\":{\n \"__classname__\":\"org.gvsig.tools.dataTypes.impl.DefaultDataType\",\n \"name\":\"String\",\n \"type\":8,\n \"subtype\":null\n },\n \"size\":100,\n \"precision\":-1,\n \"scale\":-1,\n \"roundMode\":4,\n \"allowNull\":true,\n \"primaryKey\":false,\n \"readOnly\":false,\n \"isAutomatic\":false,\n \"isTime\":false,\n \"indexed\":false,\n \"isIndexAscending\":true,\n \"allowIndexDuplicateds\":true,\n \"hidden\":false,\n \"avoidCachingAvailableValues\":false,\n \"geometryType\":null,\n \"srs\":null,\n \"relationType\":0,\n \"displaySize\":0,\n \"locale\":{\n \"__classname__\":\"java.util.Locale\",\n \"languageTag\":\"en\"\n },\n \"expression\":null,\n \"availableValuesExpression\":null,\n \"defaultValue\":\"\",\n \"dataProfile\":null,\n \"tags\":{\n \"__classname__\":\"org.gvsig.tools.dynobject.impl.DefaultTags\"\n },\n \"availableValues\":null,\n \"additionalInfo\":null\n },\n {\n \"__classname__\":\"org.gvsig.fmap.dal.feature.impl.DefaultFeatureAttributeDescriptor\",\n \"name\":\"VCSGISCODE\",\n \"description\":null,\n \"label\":\"VCSGIS Code\",\n \"shortLabel\":null,\n \"order\":20,\n \"groupName\":null,\n \"dataType\":{\n \"__classname__\":\"org.gvsig.tools.dataTypes.impl.DefaultDataType\",\n \"name\":\"String\",\n \"type\":8,\n \"subtype\":null\n },\n \"size\":40,\n \"precision\":-1,\n \"scale\":-1,\n \"roundMode\":4,\n \"allowNull\":true,\n \"primaryKey\":true,\n \"readOnly\":false,\n \"isAutomatic\":false,\n \"isTime\":false,\n \"indexed\":true,\n \"isIndexAscending\":true,\n \"allowIndexDuplicateds\":false,\n \"hidden\":false,\n \"avoidCachingAvailableValues\":false,\n \"geometryType\":null,\n \"srs\":null,\n \"relationType\":0,\n \"displaySize\":0,\n \"locale\":{\n \"__classname__\":\"java.util.Locale\",\n \"languageTag\":\"es-ES\"\n },\n \"expression\":null,\n \"availableValuesExpression\":null,\n \"defaultValue\":\"\",\n \"dataProfile\":null,\n \"tags\":{\n \"__classname__\":\"org.gvsig.tools.dynobject.impl.DefaultTags\"\n },\n \"availableValues\":null,\n \"additionalInfo\":null\n }\n ]\n}", |
30 | 30 |
"FieldForLabel":"text", |
31 | 31 |
"GeometryFieldName":null, |
32 |
"RevisionCode":"00000000000034abcdef0123456789",
|
|
32 |
"RevisionCode":"00000000000032abcdef0123456789",
|
|
33 | 33 |
"TopologyPlanCode":null, |
34 | 34 |
"UserCode":null, |
35 | 35 |
"Category":null, |
36 | 36 |
"Label":"test", |
37 | 37 |
"Autorizations":null, |
38 |
"TopologyPlanMode":0 |
|
38 |
"TopologyPlanMode":0, |
|
39 |
"Resources":null, |
|
40 |
"DataModels":null |
|
39 | 41 |
} |
40 | 42 |
}, |
41 | 43 |
"Data":[ |
42 | 44 |
{ |
43 |
"DataCode":"00000000000038abcdef0123456789",
|
|
45 |
"DataCode":"00000000000036abcdef0123456789",
|
|
44 | 46 |
"EntityCode":"00000000000004abcdef0123456789", |
45 |
"RevisionCode":"00000000000034abcdef0123456789",
|
|
47 |
"RevisionCode":"00000000000032abcdef0123456789",
|
|
46 | 48 |
"RevisionNumber":1, |
47 | 49 |
"EfectiveDate":"2020-02-17 10:11:12.123", |
48 | 50 |
"Operation":2, |
49 |
"FeatureRelatedCode":"00000000000028abcdef0123456789",
|
|
50 |
"Data":"\n{\n \"id\":4,\n \"text\":\"DDD\",\n \"VCSGISCODE\":\"00000000000028abcdef0123456789\"\n}"
|
|
51 |
"FeatureRelatedCode":"00000000000026abcdef0123456789",
|
|
52 |
"Data":"\n{\n \"id\":4,\n \"text\":\"DDD\",\n \"VCSGISCODE\":\"00000000000026abcdef0123456789\"\n}"
|
|
51 | 53 |
}, |
52 | 54 |
{ |
53 |
"DataCode":"00000000000036abcdef0123456789",
|
|
55 |
"DataCode":"00000000000034abcdef0123456789",
|
|
54 | 56 |
"EntityCode":"00000000000004abcdef0123456789", |
55 |
"RevisionCode":"00000000000034abcdef0123456789",
|
|
57 |
"RevisionCode":"00000000000032abcdef0123456789",
|
|
56 | 58 |
"RevisionNumber":1, |
57 | 59 |
"EfectiveDate":"2020-02-17 10:11:12.123", |
58 | 60 |
"Operation":1, |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S03Checkout.txt | ||
---|---|---|
23 | 23 |
"StatusMessage":"_No_errors", |
24 | 24 |
"Entity":{ |
25 | 25 |
"DataTableName":"VCSGIS_DATA", |
26 |
"Description":"",
|
|
26 |
"Description":null,
|
|
27 | 27 |
"EntityCode":"00000000000004abcdef0123456789", |
28 | 28 |
"EntityName":"test", |
29 | 29 |
"FeatureIdFieldName":"VCSGISCODE", |
... | ... | |
36 | 36 |
"Category":null, |
37 | 37 |
"Label":"test", |
38 | 38 |
"Autorizations":null, |
39 |
"TopologyPlanMode":0 |
|
39 |
"TopologyPlanMode":0, |
|
40 |
"Resources":"test_res", |
|
41 |
"DataModels":null |
|
40 | 42 |
}, |
41 | 43 |
"UsershashCode":"d41d8cd98f00b204e9800998ecf8427e", |
42 | 44 |
"TopologyPlansHashCode":"d41d8cd98f00b204e9800998ecf8427e" |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/resources/org/gvsig/vcsgis/lib/impl/expecteds/S02Commit.txt | ||
---|---|---|
27 | 27 |
"Category":null, |
28 | 28 |
"Label":"test", |
29 | 29 |
"Autorizations":null, |
30 |
"TopologyPlanMode":-1, |
|
30 |
"TopologyPlanMode":0, |
|
31 |
"Resources":null, |
|
32 |
"DataModels":null, |
|
31 | 33 |
"LocalRevisionCode":null |
32 | 34 |
} |
33 | 35 |
], |
... | ... | |
82 | 84 |
"Category":null, |
83 | 85 |
"Label":"test", |
84 | 86 |
"Autorizations":null, |
85 |
"TopologyPlanMode":-1, |
|
87 |
"TopologyPlanMode":0, |
|
88 |
"Resources":null, |
|
89 |
"DataModels":null, |
|
86 | 90 |
"LocalRevisionCode":null |
87 | 91 |
} |
88 | 92 |
] |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/Test07Checkout.java | ||
---|---|---|
5 | 5 |
import junit.framework.TestCase; |
6 | 6 |
import static junit.framework.TestCase.assertEquals; |
7 | 7 |
import org.apache.commons.io.FileUtils; |
8 |
import org.gvsig.fmap.dal.DataStore; |
|
9 |
import org.gvsig.fmap.dal.exception.DataException; |
|
10 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
11 |
import org.gvsig.fmap.dal.feature.Feature; |
|
8 | 12 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
13 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
9 | 14 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
10 | 15 |
import org.gvsig.tools.dispose.DisposeUtils; |
11 | 16 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
... | ... | |
22 | 27 |
import org.slf4j.Logger; |
23 | 28 |
import org.slf4j.LoggerFactory; |
24 | 29 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
30 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
|
25 | 31 |
|
26 | 32 |
public class Test07Checkout extends TestCase { |
27 | 33 |
|
... | ... | |
69 | 75 |
assertEquals("ws1.add status", ERR_NO_ERROR, r); |
70 | 76 |
ws1.commit(); |
71 | 77 |
assertEquals("ws1.commit status", ERR_NO_ERROR, r); |
78 |
entities_setResources(server, "sourceStore1", "sourceStore1_res"); |
|
72 | 79 |
|
73 | 80 |
r = manager.initWorkspace(ws2file, repo, "Test checkout2",null); |
74 | 81 |
assertEquals("vcsgis.init_workspace2 status", ERR_NO_ERROR, r); |
... | ... | |
79 | 86 |
r = ws2.checkout("sourceStore1"); |
80 | 87 |
assertEquals("ws2-checkout status", ERR_NO_ERROR, r); |
81 | 88 |
|
89 |
VCSGisEntity ent = ws2.getEntity("sourceStore1"); |
|
90 |
assertEquals("ws2-checkout entity resources", "sourceStore1_res", ent.getResources()); |
|
91 |
|
|
92 |
|
|
82 | 93 |
EntitiesTable.EntityRow entityRow = new EntitiesTable().getByEntityName(ws2, "sourceStore1"); |
83 | 94 |
assertEquals("ws2-checkout entityState", STATE_LOCAL_UNMODIFIED, entityRow.getState()); |
84 | 95 |
|
... | ... | |
151 | 162 |
DisposeUtils.disposeQuietly(store1); |
152 | 163 |
} |
153 | 164 |
|
165 |
public static void entities_setResources(JDBCServerExplorer server, String tableName, String resource) throws Exception { |
|
166 |
JDBCStoreParameters entitiesOpenParameters = server.get(EntitiesRepoTable.TABLE_NAME); |
|
167 |
FeatureStore store = (FeatureStore) server.open(entitiesOpenParameters); |
|
168 |
store.edit(); |
|
169 |
Feature f = store.findFirst("\""+EntitiesRepoTable.ENTITY_NAME+"\" = '"+tableName+"'"); |
|
170 |
EditableFeature ef = f.getEditable(); |
|
171 |
ef.set(EntitiesRepoTable.RESOURCES, resource); |
|
172 |
store.update(ef); |
|
173 |
store.finishEditing(); |
|
174 |
} |
|
175 |
|
|
154 | 176 |
} |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.lib/org.gvsig.vcsgis.lib.impl/src/test/java/org/gvsig/vcsgis/lib/impl/server/TestS03Checkout.java | ||
---|---|---|
13 | 13 |
import org.apache.commons.io.FileUtils; |
14 | 14 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
15 | 15 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
16 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
16 | 17 |
import org.gvsig.tools.dispose.DisposeUtils; |
17 | 18 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
18 | 19 |
import org.gvsig.vcsgis.lib.SequentialCodeGenerator; |
19 | 20 |
import org.gvsig.vcsgis.lib.VCSGisLocator; |
20 | 21 |
import org.gvsig.vcsgis.lib.VCSGisManager; |
21 | 22 |
import static org.gvsig.vcsgis.lib.VCSGisManager.ERR_NO_ERROR; |
23 |
import static org.gvsig.vcsgis.lib.impl.Test07Checkout.entities_setResources; |
|
22 | 24 |
import org.gvsig.vcsgis.lib.impl.TestUtils; |
23 | 25 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
24 | 26 |
import org.gvsig.vcsgis.lib.repository.remoteclient.requests.CheckoutRequestClient; |
... | ... | |
58 | 60 |
VCSGisManager manager = VCSGisLocator.getVCSGisManager(); |
59 | 61 |
manager.setCodeGenerator(new SequentialCodeGenerator()); |
60 | 62 |
|
61 |
JDBCServerExplorerParameters serverParameters = TestUtils.getServerExplorerParameters("srv-"+testid); |
|
63 |
JDBCServerExplorer server = TestUtils.openServerExplorer("srv-"+testid); |
|
64 |
|
|
65 |
JDBCServerExplorerParameters serverParameters = server.getParameters();//TestUtils.getServerExplorerParameters("srv-"+testid); |
|
62 | 66 |
File ws1file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws1-"+testid)); |
63 | 67 |
File ws2file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); |
64 | 68 |
|
... | ... | |
83 | 87 |
|
84 | 88 |
r = ws1.commit(Timestamp.valueOf("2020-02-17 10:11:12.123"), testid, null); |
85 | 89 |
assertEquals("ws1.commit status", ERR_NO_ERROR, r); |
90 |
|
|
91 |
entities_setResources(server, "test", "test_res"); |
|
86 | 92 |
|
93 |
|
|
87 | 94 |
DisposeUtils.disposeQuietly(store2); |
88 | 95 |
|
89 | 96 |
r = manager.initWorkspace(ws2file, repoLocaldb, "Test ws2 "+testid, null); |
org.gvsig.vcsgis/trunk/org.gvsig.vcsgis/org.gvsig.vcsgis.server/org.gvsig.vcsgis.server.lib/src/test/java/org/gvsig/vcsgis/server/lib/TestSrv03Checkout.java | ||
---|---|---|
7 | 7 |
import static junit.framework.TestCase.assertEquals; |
8 | 8 |
import org.apache.commons.io.FileUtils; |
9 | 9 |
import org.eclipse.jetty.server.Server; |
10 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
11 |
import org.gvsig.fmap.dal.feature.Feature; |
|
10 | 12 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
11 | 13 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
14 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
|
15 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
|
12 | 16 |
import org.gvsig.tools.dispose.DisposeUtils; |
13 | 17 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
14 | 18 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
... | ... | |
19 | 23 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
20 | 24 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldb; |
21 | 25 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.DataRepoTable; |
26 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
|
22 | 27 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
23 | 28 |
import static org.gvsig.vcsgis.server.lib.VCSGisServerUtils.SERVER_PORT; |
24 | 29 |
import org.slf4j.Logger; |
... | ... | |
46 | 51 |
// TODO add test methods here. The name must begin with 'test'. For example: |
47 | 52 |
// public void testHello() {} |
48 | 53 |
|
49 |
public void testAddCommit() throws Exception {
|
|
54 |
public void testCheckout() throws Exception {
|
|
50 | 55 |
final String testid = "ServerCheckout"; |
51 | 56 |
final URL serverUrl = new URL("http://localhost:"+SERVER_PORT+"/"); |
52 | 57 |
|
53 | 58 |
VCSGisManager vcsgismanager = VCSGisLocator.getVCSGisManager(); |
54 |
JDBCServerExplorerParameters explorerParams = TestUtils.getServerExplorerParameters("srv-"+testid); |
|
59 |
|
|
60 |
JDBCServerExplorer serverdb = TestUtils.openServerExplorer("srv-"+testid); |
|
61 |
|
|
62 |
JDBCServerExplorerParameters explorerParams = serverdb.getParameters(); |
|
63 |
|
|
64 |
// JDBCServerExplorerParameters explorerParams = TestUtils.getServerExplorerParameters("srv-"+testid); |
|
55 | 65 |
File ws1file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws1-"+testid)); |
56 | 66 |
File ws2file = TestUtils.getFile(FileUtils.getFile("test-dbs","ws2-"+testid)); |
57 | 67 |
|
... | ... | |
81 | 91 |
|
82 | 92 |
r = ws1.commit(Timestamp.valueOf("2020-02-17 10:11:12.123"), testid, null); |
83 | 93 |
assertEquals("ws1.commit status", ERR_OK, r); |
94 |
|
|
95 |
entities_setResources(serverdb, "test", "test_res"); |
|
84 | 96 |
|
97 |
|
|
85 | 98 |
DisposeUtils.disposeQuietly(sourceStore); |
86 | 99 |
|
87 | 100 |
|
... | ... | |
96 | 109 |
|
97 | 110 |
VCSGisWorkspaceEntity lentity = ws2.getWorkspaceEntity("test"); |
98 | 111 |
// --------------------------------------------------------- |
99 |
// Comprobamos que la tabla adicionada al espacio ed trabajo contiene
|
|
112 |
// Comprobamos que la tabla adicionada al espacio de trabajo contiene
|
|
100 | 113 |
// los mismos registros que la original. |
101 | 114 |
server.stop(); |
102 | 115 |
|
... | ... | |
105 | 118 |
|
106 | 119 |
assertEquals("Check revision codes 1", lentity.getLocalRevisionCode(), rentity.getRepositoryRevisionCode()); |
107 | 120 |
assertEquals("Check revision codes 2", lentity.getRepositoryRevisionCode(), rentity.getRepositoryRevisionCode()); |
121 |
assertEquals("Check resources", "test_res", lentity.getResources()); |
|
108 | 122 |
|
109 | 123 |
FeatureStore dataStore = repositoryLocal.getFeatureStore(DataRepoTable.TABLE_NAME); |
110 | 124 |
assertEquals("DataStore", expectedRows, dataStore.size64()); |
... | ... | |
113 | 127 |
|
114 | 128 |
repositoryLocal.dispose(); |
115 | 129 |
} |
130 |
|
|
131 |
|
|
132 |
public static void entities_setResources(JDBCServerExplorer server, String tableName, String resource) throws Exception { |
|
133 |
JDBCStoreParameters entitiesOpenParameters = server.get(EntitiesRepoTable.TABLE_NAME); |
|
134 |
FeatureStore store = (FeatureStore) server.open(entitiesOpenParameters); |
|
135 |
store.edit(); |
|
136 |
Feature f = store.findFirst("\""+EntitiesRepoTable.ENTITY_NAME+"\" = '"+tableName+"'"); |
|
137 |
EditableFeature ef = f.getEditable(); |
|
138 |
ef.set(EntitiesRepoTable.RESOURCES, resource); |
|
139 |
store.update(ef); |
|
140 |
store.finishEditing(); |
|
141 |
} |
|
142 |
|
|
116 | 143 |
} |
Also available in: Unified diff