-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #417 from LD4P/retrieve_rt_from_server_309
Prepare to retrieve resource templates from Sinopia platform
- Loading branch information
Showing
16 changed files
with
218 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
describe('sinopiaServerSpoof', () => { | ||
let sinopiaServer = require('../src/sinopiaServer') | ||
|
||
describe('resourceTemplateIds', () => { | ||
it('array of length 19', () => { | ||
expect(sinopiaServer.resourceTemplateIds).toHaveLength(19) | ||
}) | ||
it('resourceTemplateId is in expected format', () => { | ||
sinopiaServer.resourceTemplateIds.forEach(id => { | ||
expect(id).toMatch(/^resourceTemplate:((bf2)|(bflc)):.*/) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('resourceTemplateId2Json', () => { | ||
it('array of length 19', () => { | ||
expect(sinopiaServer.resourceTemplateId2Json).toHaveLength(19) | ||
}) | ||
it('mapping has id', () => { | ||
expect(sinopiaServer.resourceTemplateId2Json[0]['id']).toBe('resourceTemplate:bf2:Monograph:Instance') | ||
expect(sinopiaServer.resourceTemplateId2Json[10]['id']).toBe('resourceTemplate:bf2:WorkVariantTitle') | ||
}) | ||
it('mapping has json', () => { | ||
expect(sinopiaServer.resourceTemplateId2Json[0]['json']).toBeDefined() | ||
expect(sinopiaServer.resourceTemplateId2Json[10]['json']).toBeDefined() | ||
}) | ||
}) | ||
|
||
describe('getResourceTemplate', () => { | ||
it('known id: returns JSON for resource template', () => { | ||
expect(sinopiaServer.getResourceTemplate('resourceTemplate:bf2:Title').id).toEqual('resourceTemplate:bf2:Title') | ||
expect(sinopiaServer.getResourceTemplate('resourceTemplate:bf2:Title').resourceLabel).toEqual('Instance Title') | ||
}) | ||
it('unknown id: returns empty resource template and logs error', () => { | ||
let output = '' | ||
let storeErr = inputs => (output += inputs) | ||
console["log"] = jest.fn(storeErr) | ||
expect(sinopiaServer.getResourceTemplate('not:there')).toEqual({"propertyTemplates": [{}]}) | ||
expect(output).toEqual('ERROR: un-spoofed resourceTemplate: not:there') | ||
}) | ||
it('null id: returns empty resource template and logs error', () => { | ||
let output = '' | ||
let storeErr = inputs => (output += inputs) | ||
console["log"] = jest.fn(storeErr) | ||
expect(sinopiaServer.getResourceTemplate()).toEqual({"propertyTemplates": [{}]}) | ||
expect(output).toEqual('ERROR: asked for resourceTemplate with null/undefined id') | ||
output = '' | ||
expect(sinopiaServer.getResourceTemplate(null)).toEqual({"propertyTemplates": [{}]}) | ||
expect(output).toEqual('ERROR: asked for resourceTemplate with null/undefined id') | ||
output = '' | ||
expect(sinopiaServer.getResourceTemplate(undefined)).toEqual({"propertyTemplates": [{}]}) | ||
expect(output).toEqual('ERROR: asked for resourceTemplate with null/undefined id') | ||
expect(sinopiaServer.getResourceTemplate('')).toEqual({"propertyTemplates": [{}]}) | ||
}) | ||
|
||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
version: "3" | ||
services: | ||
editor: | ||
build: | ||
context: . | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- pipeline | ||
pipeline: | ||
image: ld4p/sinopia_indexing_pipeline:latest | ||
environment: | ||
INDEX_HOST: search | ||
BROKER_HOST: broker | ||
command: dockerize -wait tcp://broker:61613 -wait tcp://search:9200 -timeout 3m npm start | ||
depends_on: | ||
- broker | ||
- search | ||
- platform | ||
broker: | ||
image: rmohr/activemq | ||
ports: | ||
- 61613:61613 | ||
platform: | ||
image: ld4p/trellis-ext-db:latest | ||
environment: | ||
TRELLIS_BASE_URL: http://platform:8080 | ||
TRELLIS_LOGGING_LEVEL: INFO | ||
TRELLIS_CONSOLE_LOGGING_THRESHOLD: INFO | ||
ports: | ||
- 8080:8080 | ||
- 8081:8081 | ||
depends_on: | ||
- database | ||
- broker | ||
- migration | ||
database: | ||
image: postgres:latest | ||
environment: | ||
POSTGRES_USER: sinopia | ||
POSTGRES_DB: sinopia | ||
POSTGRES_PASSWORD: S1n0p1a | ||
PGDATA: /var/lib/postgresql/data/pgdata/mydata | ||
ports: | ||
- 5432:5432 | ||
search: | ||
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 | ||
entrypoint: | ||
- elasticsearch | ||
- -Ehttp.port=9200 | ||
- -Ehttp.cors.enabled=true | ||
- -Ehttp.cors.allow-origin=http://searchui:1358,http://localhost:1358,http://127.0.0.1:1358 | ||
- -Ehttp.cors.allow-headers=X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization | ||
- -Ehttp.cors.allow-credentials=true | ||
- -Etransport.host=localhost | ||
- -Ebootstrap.system_call_filter=false | ||
user: elasticsearch | ||
ports: | ||
- 9200:9200 | ||
- 9300:9300 | ||
searchui: | ||
image: appbaseio/dejavu:latest | ||
ports: | ||
- 1358:1358 | ||
depends_on: | ||
- search | ||
migration: | ||
image: ld4p/trellis-ext-db:latest | ||
command: ["/opt/trellis/bin/trellis-db", "db", "migrate", "/opt/trellis/etc/config.yml"] | ||
depends_on: | ||
- database |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ module.exports = { | |
}, | ||
server: { | ||
command: 'npm run dev-start', | ||
port: 8080, | ||
port: 8888 | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.