geoserver-node-client 0.0.7 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -9
- package/dist/geoserver-rest-client.js +92 -0
- package/dist/package.json +56 -0
- package/dist/src/about.js +145 -0
- package/dist/src/datastore.js +1117 -0
- package/dist/src/imagemosaic.js +297 -0
- package/dist/src/layer.js +1263 -0
- package/dist/src/namespace.js +315 -0
- package/dist/src/reset-reload.js +160 -0
- package/dist/src/security.js +297 -0
- package/dist/src/settings.js +345 -0
- package/dist/src/style.js +597 -0
- package/dist/src/util/geoserver.js +97 -0
- package/dist/src/workspace.js +321 -0
- package/geoserver-rest-client.js +18 -52
- package/package.json +24 -6
- package/src/about.js +59 -0
- package/src/datastore.js +196 -200
- package/src/imagemosaic.js +75 -98
- package/src/layer.js +469 -328
- package/src/namespace.js +84 -83
- package/src/reset-reload.js +70 -0
- package/src/security.js +61 -84
- package/src/settings.js +76 -91
- package/src/style.js +165 -171
- package/src/util/geoserver.js +41 -0
- package/src/workspace.js +89 -81
- package/.eslintrc.json +0 -20
- package/.github/workflows/ci-geoserver-node-client.yml +0 -54
- package/.github/workflows/ci-publish-docs.yml +0 -24
- package/.github/workflows/wait-for.sh +0 -145
- package/.vscode/settings.json +0 -3
- package/DOCS_HOME.md +0 -26
- package/demo/index.js +0 -188
- package/release-it.json +0 -8
- package/test/sample_data/iceland.gpkg +0 -0
- package/test/sample_data/world.geotiff +0 -0
- package/test/test.js +0 -502
package/test/test.js
DELETED
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
/* global describe:false, it:false, before:false, after:false */
|
|
2
|
-
/* eslint-disable no-unused-expressions */
|
|
3
|
-
import { expect } from 'chai';
|
|
4
|
-
import GeoServerRestClient from '../geoserver-rest-client.js';
|
|
5
|
-
|
|
6
|
-
const url = 'http://localhost:8080/geoserver/rest/';
|
|
7
|
-
const user = 'admin';
|
|
8
|
-
const pw = 'geoserver';
|
|
9
|
-
const grc = new GeoServerRestClient(url, user, pw);
|
|
10
|
-
|
|
11
|
-
const workSpace = 'my-workspace';
|
|
12
|
-
|
|
13
|
-
const nameSpace = 'my-namespace';
|
|
14
|
-
const nameSpaceUri = 'http://www.example.com';
|
|
15
|
-
|
|
16
|
-
const geoServerVersion = process.env.GEOSERVER_VERSION;
|
|
17
|
-
|
|
18
|
-
describe('Basic GeoServer', () => {
|
|
19
|
-
it('should exist', async () => {
|
|
20
|
-
const result = await grc.exists();
|
|
21
|
-
expect(result).to.be.true;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('returns correct version', async () => {
|
|
25
|
-
const result = await grc.getVersion();
|
|
26
|
-
expect(result.about.resource[0].Version).to.equal(geoServerVersion);
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe('Settings', () => {
|
|
31
|
-
after(async () => {
|
|
32
|
-
await grc.settings.updateSettings({
|
|
33
|
-
global: {
|
|
34
|
-
settings: {
|
|
35
|
-
verbose: true
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
await grc.settings.updateProxyBaseUrl('');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('returns settings object', async () => {
|
|
43
|
-
const settings = await grc.settings.getSettings();
|
|
44
|
-
expect(settings).to.not.be.false;
|
|
45
|
-
expect(settings.global.settings.charset).to.not.be.false;
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('updates settings object', async () => {
|
|
49
|
-
const settingsJson = {
|
|
50
|
-
global: {
|
|
51
|
-
settings: {
|
|
52
|
-
verbose: false
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const updateOk = await grc.settings.updateSettings(settingsJson);
|
|
57
|
-
expect(updateOk).to.be.true;
|
|
58
|
-
|
|
59
|
-
const settings = await grc.settings.getSettings();
|
|
60
|
-
expect(settings.global.settings.verbose).to.equal(settingsJson.global.settings.verbose);
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('updates proxyBaseUrl', async () => {
|
|
64
|
-
const url = 'http://foobar.de/geoserver';
|
|
65
|
-
const updateOk = await grc.settings.updateProxyBaseUrl(url);
|
|
66
|
-
expect(updateOk).to.be.true;
|
|
67
|
-
|
|
68
|
-
const settings = await grc.settings.getSettings();
|
|
69
|
-
expect(settings.global.settings.proxyBaseUrl).to.equal(url);
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('returns contact information', async () => {
|
|
73
|
-
const contactInfo = await grc.settings.getContactInformation();
|
|
74
|
-
expect(contactInfo).to.not.be.false;
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('can update contact information', async () => {
|
|
78
|
-
const address = 'Unter den Linden';
|
|
79
|
-
const city = 'Berlin';
|
|
80
|
-
const country = 'Deutschland';
|
|
81
|
-
const postalCode = 123445;
|
|
82
|
-
const state = 'Berlin';
|
|
83
|
-
const email = 'example email address';
|
|
84
|
-
const organization = 'A organization';
|
|
85
|
-
const contactPerson = 'My contact persion';
|
|
86
|
-
const phoneNumber = 1231234234123;
|
|
87
|
-
|
|
88
|
-
const result = await grc.settings.updateContactInformation(address, city, country, postalCode, state, email, organization, contactPerson, phoneNumber);
|
|
89
|
-
expect(result).to.be.true;
|
|
90
|
-
|
|
91
|
-
const contactResponse = await grc.settings.getContactInformation();
|
|
92
|
-
|
|
93
|
-
// test two sample values
|
|
94
|
-
expect(address).to.equal(contactResponse.contact.address);
|
|
95
|
-
expect(state).to.equal(contactResponse.contact.addressState);
|
|
96
|
-
})
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
describe('Workspace', () => {
|
|
100
|
-
it('has no workspace', async () => {
|
|
101
|
-
const gsWorkspaces = await grc.workspaces.getAll();
|
|
102
|
-
expect(gsWorkspaces.workspaces).to.equal('');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('creates one workspace', async () => {
|
|
106
|
-
const result = await grc.workspaces.create(workSpace);
|
|
107
|
-
expect(result).to.equal(workSpace);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('has one workspace', async () => {
|
|
111
|
-
const gsWorkspaces = await grc.workspaces.getAll();
|
|
112
|
-
expect(gsWorkspaces.workspaces.workspace.length).to.equal(1);
|
|
113
|
-
expect(gsWorkspaces.workspaces.workspace[0].name).to.equal(workSpace);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it('query dedicated workspace', async () => {
|
|
117
|
-
const gsWorkspace = await grc.workspaces.get(workSpace);
|
|
118
|
-
expect(gsWorkspace.workspace.name).to.equal(workSpace);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('delete workspace', async () => {
|
|
122
|
-
const recursive = true;
|
|
123
|
-
const result = await grc.workspaces.delete(workSpace, recursive);
|
|
124
|
-
expect(result).to.be.true;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('has no workspace', async () => {
|
|
128
|
-
const gsWorkspaces = await grc.workspaces.getAll();
|
|
129
|
-
expect(gsWorkspaces.workspaces).to.equal('');
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
describe('Namespace', () => {
|
|
134
|
-
it('has no namespaces', async () => {
|
|
135
|
-
const gsNamespaces = await grc.namespaces.getAll();
|
|
136
|
-
expect(gsNamespaces.namespaces).to.equal('');
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('creates one namespace', async () => {
|
|
140
|
-
const result = await grc.namespaces.create(nameSpace, nameSpaceUri);
|
|
141
|
-
expect(result).to.equal(nameSpace);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('has one namespace', async () => {
|
|
145
|
-
const gsNameSpaces = await grc.namespaces.getAll();
|
|
146
|
-
expect(gsNameSpaces.namespaces.namespace.length).to.equal(1);
|
|
147
|
-
expect(gsNameSpaces.namespaces.namespace[0].name).to.equal(nameSpace);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('query dedicated namespace', async () => {
|
|
151
|
-
const gsNameSpace = await grc.namespaces.get(nameSpace);
|
|
152
|
-
expect(gsNameSpace.namespace.prefix).to.equal(nameSpace);
|
|
153
|
-
expect(gsNameSpace.namespace.uri).to.equal(nameSpaceUri);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('delete namespace', async () => {
|
|
157
|
-
const result = await grc.namespaces.delete(nameSpace);
|
|
158
|
-
expect(result).to.be.true;
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it('has no namespace', async () => {
|
|
162
|
-
const gsNameSpaces = await grc.namespaces.getAll();
|
|
163
|
-
expect(gsNameSpaces.namespaces).to.equal('');
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('Datastore', () => {
|
|
168
|
-
let createdWorkSpace;
|
|
169
|
-
|
|
170
|
-
before('create workspace', async () => {
|
|
171
|
-
createdWorkSpace = await grc.workspaces.create(workSpace);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// TODO: test PostGIS store
|
|
175
|
-
// TODO: test image mosaic
|
|
176
|
-
// TODO: test WMTS-Stores
|
|
177
|
-
|
|
178
|
-
// TODO: copy test data to GeoServer before
|
|
179
|
-
it('can create GeoTIFF', async () => {
|
|
180
|
-
const geotiff = 'test/sample_data/world.geotiff'
|
|
181
|
-
const result = await grc.datastores.createGeotiffFromFile(
|
|
182
|
-
workSpace,
|
|
183
|
-
'my-rasterstore',
|
|
184
|
-
'my-raster-name',
|
|
185
|
-
'My Raster Title',
|
|
186
|
-
geotiff);
|
|
187
|
-
expect(result).to.not.be.false;
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
it('can create a WMS Store', async () => {
|
|
191
|
-
// TODO: make sure the WMS actually exists
|
|
192
|
-
const wmsUrl = 'https://ows.terrestris.de/osm/service?';
|
|
193
|
-
const result = await grc.datastores.createWmsStore(
|
|
194
|
-
workSpace,
|
|
195
|
-
'my-wms-datastore',
|
|
196
|
-
wmsUrl);
|
|
197
|
-
expect(result).to.not.be.false;
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it('can create a WFS Store', async () => {
|
|
201
|
-
// TODO: make sure the WFS actually exists
|
|
202
|
-
const wfsCapsUrl = 'https://ows-demo.terrestris.de/geoserver/osm/wfs?service=wfs&version=1.1.0&request=GetCapabilities';
|
|
203
|
-
const namespaceUrl = 'http://test';
|
|
204
|
-
const result = await grc.datastores.createWfsStore(
|
|
205
|
-
workSpace,
|
|
206
|
-
'my-wfs-datastore',
|
|
207
|
-
wfsCapsUrl,
|
|
208
|
-
namespaceUrl);
|
|
209
|
-
expect(result).to.be.true;
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
// TODO: copy test data to GeoServer
|
|
213
|
-
it('can create a GeoPackage Store', async () => {
|
|
214
|
-
const gpkg = 'test/sample_data/iceland.gpkg'
|
|
215
|
-
const result = await grc.datastores.createGpkgStore(
|
|
216
|
-
workSpace,
|
|
217
|
-
'my-gpkg-store',
|
|
218
|
-
gpkg)
|
|
219
|
-
expect(result).to.be.true;
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('can retrive the data stores', async () => {
|
|
223
|
-
const result = await grc.datastores.getDataStores(workSpace);
|
|
224
|
-
const dataStores = result.dataStores.dataStore;
|
|
225
|
-
expect(dataStores.length).to.equal(2);
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it('can retrive the coverage stores', async () => {
|
|
229
|
-
const result = await grc.datastores.getCoverageStores(workSpace);
|
|
230
|
-
const coverageStores = result.coverageStores.coverageStore;
|
|
231
|
-
expect(coverageStores.length).to.equal(1);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it('can retrive the WMS stores', async () => {
|
|
235
|
-
const result = await grc.datastores.getWmsStores(workSpace);
|
|
236
|
-
const wmsStores = result.wmsStores.wmsStore;
|
|
237
|
-
expect(wmsStores.length).to.equal(1);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
after('delete Workspace', async () => {
|
|
241
|
-
const recursive = true;
|
|
242
|
-
await grc.workspaces.delete(createdWorkSpace, recursive);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
describe('Layer', () => {
|
|
247
|
-
let createdWorkSpace;
|
|
248
|
-
const wmsLayerName = 'my-wms-layer-name';
|
|
249
|
-
const featureLayerName = 'my-feature-layer-name'
|
|
250
|
-
const wfsDataStore = 'my-wfs-datastore';
|
|
251
|
-
|
|
252
|
-
before('create workspace', async () => {
|
|
253
|
-
createdWorkSpace = await grc.workspaces.create(workSpace);
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it('can publish a FeatureType', async () => {
|
|
257
|
-
const wfsCapsUrl = 'https://ows-demo.terrestris.de/geoserver/osm/wfs?service=wfs&version=1.1.0&request=GetCapabilities';
|
|
258
|
-
const namespaceUrl = 'http://test';
|
|
259
|
-
const dataStoreResult = await grc.datastores.createWfsStore(
|
|
260
|
-
workSpace,
|
|
261
|
-
wfsDataStore,
|
|
262
|
-
wfsCapsUrl,
|
|
263
|
-
namespaceUrl
|
|
264
|
-
);
|
|
265
|
-
expect(dataStoreResult).to.be.true;
|
|
266
|
-
|
|
267
|
-
const result = await grc.layers.publishFeatureType(
|
|
268
|
-
workSpace,
|
|
269
|
-
wfsDataStore,
|
|
270
|
-
'osm_osm-country-borders',
|
|
271
|
-
featureLayerName,
|
|
272
|
-
'My Feature title',
|
|
273
|
-
'EPSG:4326',
|
|
274
|
-
true,
|
|
275
|
-
'Sample Abstract'
|
|
276
|
-
);
|
|
277
|
-
expect(result).to.be.true;
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('can publish a FeatureType with explicit native BBOX', async () => {
|
|
281
|
-
const ftName = featureLayerName + '_native_bbox';
|
|
282
|
-
const nativeBoundingBox = {
|
|
283
|
-
minx: 8.15,
|
|
284
|
-
maxx: 8.16,
|
|
285
|
-
miny: 50.0,
|
|
286
|
-
maxy: 50.1
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
const result = await grc.layers.publishFeatureType(
|
|
290
|
-
workSpace,
|
|
291
|
-
wfsDataStore,
|
|
292
|
-
'osm_osm-country-borders',
|
|
293
|
-
ftName,
|
|
294
|
-
'My Feature title native BBOX',
|
|
295
|
-
'EPSG:4326',
|
|
296
|
-
true,
|
|
297
|
-
'Sample Abstract native BBOX',
|
|
298
|
-
nativeBoundingBox
|
|
299
|
-
);
|
|
300
|
-
expect(result).to.be.true;
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
it('can publish a WMS layer', async () => {
|
|
304
|
-
// TODO: make sure WMS url is still working
|
|
305
|
-
const wmsUrl = 'https://ows.terrestris.de/osm/service?';
|
|
306
|
-
const wmsDataStore = 'my-wms-datastore';
|
|
307
|
-
const wmsStoreResult = await grc.datastores.createWmsStore(
|
|
308
|
-
workSpace,
|
|
309
|
-
wmsDataStore,
|
|
310
|
-
wmsUrl);
|
|
311
|
-
|
|
312
|
-
expect(wmsStoreResult).to.be.true;
|
|
313
|
-
const result = await grc.layers.publishWmsLayer(
|
|
314
|
-
workSpace,
|
|
315
|
-
wmsDataStore,
|
|
316
|
-
'OSM-Overlay-WMS',
|
|
317
|
-
wmsLayerName,
|
|
318
|
-
'My WMS Title',
|
|
319
|
-
'EPSG:900913',
|
|
320
|
-
true,
|
|
321
|
-
'Sample Abstract'
|
|
322
|
-
);
|
|
323
|
-
expect(result).to.be.true;
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
it('can modify the attribution', async () => {
|
|
327
|
-
const attributionText = 'sample attribution';
|
|
328
|
-
const attributionLink = 'http://www.example.com';
|
|
329
|
-
|
|
330
|
-
const attributionResult = await grc.layers.modifyAttribution(`${workSpace}:${wmsLayerName}`, attributionText, attributionLink);
|
|
331
|
-
|
|
332
|
-
const layerProperties = await grc.layers.get(`${workSpace}:${wmsLayerName}`);
|
|
333
|
-
|
|
334
|
-
expect(attributionResult).to.be.true;
|
|
335
|
-
expect(layerProperties.layer.attribution.title).to.equal(attributionText);
|
|
336
|
-
expect(layerProperties.layer.attribution.href).to.equal(attributionLink);
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
it('can get retrieve all layers', async () => {
|
|
340
|
-
const result = await grc.layers.getAll();
|
|
341
|
-
expect(result.layers.layer.length).to.equal(3);
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
it('can get a layer by qualified name', async () => {
|
|
345
|
-
const nonExistentLayer = 'non-existent-layer';
|
|
346
|
-
let result = await grc.layers.get(workSpace + ':' + nonExistentLayer);
|
|
347
|
-
expect(result).to.be.false;
|
|
348
|
-
|
|
349
|
-
result = await grc.layers.get(workSpace + ':' + wmsLayerName);
|
|
350
|
-
expect(result.layer.name).to.equal(wmsLayerName);
|
|
351
|
-
})
|
|
352
|
-
|
|
353
|
-
// TODO: publishFeatureTypeDefaultDataStore
|
|
354
|
-
|
|
355
|
-
it('can delete a feature type', async () => {
|
|
356
|
-
const recursive = true;
|
|
357
|
-
const result = await grc.layers.deleteFeatureType(
|
|
358
|
-
workSpace,
|
|
359
|
-
wfsDataStore,
|
|
360
|
-
featureLayerName,
|
|
361
|
-
recursive
|
|
362
|
-
);
|
|
363
|
-
expect(result).to.be.true;
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
it('has function to query coverages', async () => {
|
|
367
|
-
// query a non-existing coverage to check that the function exists
|
|
368
|
-
// TODO test valid response once we have coverages in test setup
|
|
369
|
-
const result = await grc.layers.getCoverage(workSpace, 'testCovStore', 'testCoverage');
|
|
370
|
-
expect(result).to.be.false;
|
|
371
|
-
})
|
|
372
|
-
|
|
373
|
-
after('delete Workspace', async () => {
|
|
374
|
-
const recursive = true;
|
|
375
|
-
await grc.workspaces.delete(createdWorkSpace, recursive);
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
describe('style', () => {
|
|
380
|
-
let createdWorkSpace;
|
|
381
|
-
const styleName = 'my-style-name';
|
|
382
|
-
const featureLayerName = 'my-feature-layer-name'
|
|
383
|
-
const wfsDataStore = 'my-wfs-datastore';
|
|
384
|
-
|
|
385
|
-
before('create workspace', async () => {
|
|
386
|
-
createdWorkSpace = await grc.workspaces.create(workSpace);
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
it('can get default styles', async () => {
|
|
390
|
-
const result = await grc.styles.getDefaults();
|
|
391
|
-
expect(result.styles.style.length).to.equal(5)
|
|
392
|
-
})
|
|
393
|
-
|
|
394
|
-
it('can publish a style', async () => {
|
|
395
|
-
const sldBody = '<?xml version="1.0" encoding="UTF-8"?>\n<StyledLayerDescriptor version="1.0.0" \n xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" \n xmlns="http://www.opengis.net/sld" \n xmlns:ogc="http://www.opengis.net/ogc" \n xmlns:xlink="http://www.w3.org/1999/xlink" \n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n <NamedLayer>\n <Name>default_line</Name>\n <UserStyle>\n <Title>Default Line</Title>\n <Abstract>A sample style that draws a line</Abstract>\n <FeatureTypeStyle>\n <Rule>\n <Name>rule1</Name>\n <Title>Blue Line</Title>\n <Abstract>A solid blue line with a 1 pixel width</Abstract>\n <LineSymbolizer>\n <Stroke>\n <CssParameter name="stroke">#0000FF</CssParameter>\n </Stroke>\n </LineSymbolizer>\n </Rule>\n </FeatureTypeStyle>\n </UserStyle>\n </NamedLayer>\n</StyledLayerDescriptor>\n';
|
|
396
|
-
|
|
397
|
-
const result = await grc.styles.publish(
|
|
398
|
-
workSpace,
|
|
399
|
-
styleName,
|
|
400
|
-
sldBody
|
|
401
|
-
);
|
|
402
|
-
expect(result).to.be.true;
|
|
403
|
-
})
|
|
404
|
-
|
|
405
|
-
it('can get all styles', async () => {
|
|
406
|
-
const result = await grc.styles.getAll();
|
|
407
|
-
expect(result.length).to.equal(6)
|
|
408
|
-
})
|
|
409
|
-
|
|
410
|
-
it('can assign a style to a layer', async () => {
|
|
411
|
-
const wfsCapsUrl = 'https://ows-demo.terrestris.de/geoserver/osm/wfs?service=wfs&version=1.1.0&request=GetCapabilities';
|
|
412
|
-
const namespaceUrl = 'http://test';
|
|
413
|
-
|
|
414
|
-
const dataStoreResult = await grc.datastores.createWfsStore(
|
|
415
|
-
workSpace,
|
|
416
|
-
wfsDataStore,
|
|
417
|
-
wfsCapsUrl,
|
|
418
|
-
namespaceUrl
|
|
419
|
-
);
|
|
420
|
-
expect(dataStoreResult).to.be.true;
|
|
421
|
-
|
|
422
|
-
const layerResult = await grc.layers.publishFeatureType(
|
|
423
|
-
workSpace,
|
|
424
|
-
wfsDataStore,
|
|
425
|
-
'osm_osm-country-borders',
|
|
426
|
-
featureLayerName,
|
|
427
|
-
'My Feature title',
|
|
428
|
-
'EPSG:4326',
|
|
429
|
-
true
|
|
430
|
-
);
|
|
431
|
-
expect(layerResult).to.be.true;
|
|
432
|
-
|
|
433
|
-
const qualifiedName = workSpace + ':' + featureLayerName;
|
|
434
|
-
const workspaceStyle = workSpace;
|
|
435
|
-
const isDefaultStyle = true;
|
|
436
|
-
const result = await grc.styles.assignStyleToLayer(qualifiedName, styleName, workspaceStyle, isDefaultStyle);
|
|
437
|
-
expect(result).to.be.true;
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
it('can get style information', async () => {
|
|
441
|
-
const result = await grc.styles.getStyleInformation(styleName, workSpace);
|
|
442
|
-
expect(result.style.name).to.equal(styleName);
|
|
443
|
-
})
|
|
444
|
-
|
|
445
|
-
it('can get styles in specific workspace', async () => {
|
|
446
|
-
const result = await grc.styles.getInWorkspace(workSpace);
|
|
447
|
-
expect(result.styles.style.length).to.equal(1);
|
|
448
|
-
})
|
|
449
|
-
|
|
450
|
-
it('can get styles in all workspaces', async () => {
|
|
451
|
-
const result = await grc.styles.getAllWorkspaceStyles();
|
|
452
|
-
expect(result.length).to.equal(1);
|
|
453
|
-
})
|
|
454
|
-
|
|
455
|
-
it('can delete a style', async () => {
|
|
456
|
-
let recurse = false;
|
|
457
|
-
const purge = false;
|
|
458
|
-
const withOutRecurse = await grc.styles.delete(workSpace, styleName, recurse, purge)
|
|
459
|
-
expect(withOutRecurse).to.be.false;
|
|
460
|
-
|
|
461
|
-
recurse = true;
|
|
462
|
-
const withRecurse = await grc.styles.delete(workSpace, styleName, recurse, purge)
|
|
463
|
-
expect(withRecurse).to.be.true;
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
after('delete Workspace', async () => {
|
|
467
|
-
const recursive = true;
|
|
468
|
-
await grc.workspaces.delete(createdWorkSpace, recursive);
|
|
469
|
-
});
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
describe('Security', () => {
|
|
473
|
-
let createdWorkSpace;
|
|
474
|
-
|
|
475
|
-
const dummyUser = 'dummyUser';
|
|
476
|
-
const dummyPassword = 'dummyPassword';
|
|
477
|
-
|
|
478
|
-
before('create workspace', async () => {
|
|
479
|
-
createdWorkSpace = await grc.workspaces.create(workSpace);
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
it('can create a user', async () => {
|
|
483
|
-
const result = await grc.security.createUser(dummyUser, dummyPassword);
|
|
484
|
-
expect(result).to.be.true;
|
|
485
|
-
})
|
|
486
|
-
|
|
487
|
-
it('can associate a user role', async () => {
|
|
488
|
-
const result = await grc.security.associateUserRole(dummyUser, 'ADMIN');
|
|
489
|
-
expect(result).to.be.true;
|
|
490
|
-
})
|
|
491
|
-
|
|
492
|
-
it('can update a user', async () => {
|
|
493
|
-
const enabled = false;
|
|
494
|
-
const result = await grc.security.updateUser(dummyUser, dummyPassword, enabled);
|
|
495
|
-
expect(result).to.be.true;
|
|
496
|
-
})
|
|
497
|
-
|
|
498
|
-
after(async () => {
|
|
499
|
-
const recursive = true;
|
|
500
|
-
await grc.workspaces.delete(createdWorkSpace, recursive);
|
|
501
|
-
});
|
|
502
|
-
});
|