Skip to content

Commit

Permalink
commit from estat bitbucket v${bamboo.tck.version}
Browse files Browse the repository at this point in the history
  • Loading branch information
CITnet Bamboo committed Nov 1, 2023
1 parent c331057 commit f02e06b
Show file tree
Hide file tree
Showing 39 changed files with 1,579 additions and 326 deletions.
71 changes: 38 additions & 33 deletions RUNME.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,46 @@
1. Having installed Node v14.16.0
2. With Node installation Node Package Manager (npm) is also installed.
3. In order to verify that you have the correct Node version run the following command in terminal:
> node -v
<code>node -v</code>
4. In order to verify that you have the correct npm version run the following command in terminal:
> npm -v
5. Navigate inside every module's folder (ex. cd sdmx-tck-manager) and run the following command in order to install all necessary packages:

> npm install
Note: The order in installing these packages inside every module should be the following:
1.sdmx-tck-api
2.sdmx-tck-parsers
3.sdmx-tck-manager
4.sdmx-tck-client
5.sdmx-tck-reporter

## To start:

<code>npm -v</code>
5. Navigate inside every module's folder (ex. cd sdmx-tck-manager) and run <code>npm install</code> to install all necessary packages.
The order in installing these packages inside every module should be the following:
1. sdmx-tck-api
2. sdmx-tck-parsers
3. sdmx-tck-manager
4. sdmx-tck-client
5. sdmx-tck-reporter

## To run TCK in Development Mode:
1. Navigate to the directory of TCK.
2. Run TCK server:
<code>
cd sdmx-tck-manager
npm run start-server
</code>
3. Run TCK client:
<code>
cd sdmx-tck-client
npm start
</code>
Note: In Unix-based environments, steps 2 and 3 can be executed with one command: <code>cd sdmx-tck-manager && npm run dev</code>

3. When ready the app will load in your browser in the following address: http://localhost:3000

## To run TCK in Production Mode:
1. Navigate to the directory of TCK.
2. Use the following commands in order to start TCK :
> cd sdmx-tck-manager && npm run dev
3. In Windows env. there is a possibility that the command above will not work, so server and client should be started sepparately:
Please make sure that you are in sdmx-tck-modules directory in order to navigate from a module to another.

Note:
Start server in a terminal using the following commands:

1. cd sdmx-tck-manager
2. npm run start-server

Start client separately in another terminal
using the following commands:

1. cd sdmx-tck-client
2. npm start

4. When ready the app will load in your browser in the following address: http://localhost:3000
2. Run TCK server as described above.
3. Run TCK client:
1. <code>cd sdmx-tck-client</code>
2. Open the <code>package.json</code> file, and configure the production environment variable <code>REACT_APP_API_URL</code> to point to the address of TCK server.
3. Package TCK client for production:
<code>npm run build</code> (This will create a "build" folder in the project root directory)
4. Deploy the application production build on port <code>PORT</code> (e.g., 8102) using pm2 and serve:
<code>pm2 serve build PORT --name tckclient</code>
Prerequisite: pm2 to have been installed (<code>npm install pm2 -g</code>)
The command <code>pm2 stop tckclient</code> can terminate the tckclient process


## How to use it:

Expand Down
2 changes: 1 addition & 1 deletion sdmx-tck-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sdmx-tck-api",
"version": "3.3.0",
"version": "4.3.0",
"description": "SDMX TCK API",
"main": "src/index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions sdmx-tck-api/src/constants/ApiVersions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const API_VERSIONS = {
"v1.2.0": "5",
"v1.3.0": "6",
"v1.4.0": "7",
"v2.0.0": "8"
}

module.exports.API_VERSIONS = Object.freeze(API_VERSIONS);
80 changes: 71 additions & 9 deletions sdmx-tck-api/src/constants/SdmxStructureType.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,33 @@ var SDMX_STRUCTURE_TYPE = {
CONTENT_CONSTRAINT: { key: "CONTENT_CONSTRAINT", getClass() { return "ContentConstraint" }, isBasic: true },
ATTACHMENT_CONSTRAINT: { key: "ATTACHMENT_CONSTRAINT", getClass() { return "AttachmentConstraint" }, isBasic: false },
ALLOWED_CONTRAINT: { key: "ALLOWED_CONTRAINT", getClass() { return "AllowedConstraint" }, isBasic: false },
ACTUAL_CONSTRAINT: { key: "ACTUAL_CONSTRAINT", getClass() { return "ActualConstraint" }, isBasic: false }
ACTUAL_CONSTRAINT: { key: "ACTUAL_CONSTRAINT", getClass() { return "ActualConstraint" }, isBasic: false },
HIERARCHY: { key: "HIERARCHY", getClass() { return "Hierarchy" }, isBasic: false }, // or true
HIERARCHY_ASSOCIATION: { key: "HIERARCHY_ASSOCIATION", getClass() { return "HierarchyAssociation" }, isBasic: false }, // or true
VALUE_LIST: { key: "VALUE_LIST", getClass() { return "ValueList" }, isBasic: false },
STRUCTURE_MAP: { key: "STRUCTURE_MAP", getClass() { return "StructureMap" }, isBasic: false },
REPRESENTATION_MAP: { key: "REPRESENTATION_MAP", getClass() { return "RepresentationMap" }, isBasic: false },
CONCEPT_SCHEME_MAP: { key: "CONCEPT_SCHEME_MAP", getClass() { return "ConceptSchemeMap" }, isBasic: false },
CATEGORY_SCHEME_MAP: { key: "CATEGORY_SCHEME_MAP", getClass() { return "CategorySchemeMap" }, isBasic: false },
ORGANISATION_SCHEME_MAP: { key: "ORGANISATION_SCHEME_MAP", getClass() { return "OrganisationSchemeMap" }, isBasic: false },
REPORTING_TAXONOMY_MAP: { key: "REPORTING_TAXONOMY_MAP", getClass() { return "ReportingTaxonomyMap" }, isBasic: false },
METADATA_PROVIDER_SCHEME: { key: "METADATA_PROVIDER_SCHEME", getClass() { return "MetadataProviderScheme" }, isBasic: false },
METADATA_PROVISION_AGREEMENT: { key: "METADATA_PROVISION_AGREEMENT", getClass() { return "MetadataProvisionAgreement" }, isBasic: false },
DATA_CONSTRAINT: { key: "DATA_CONSTRAINT", getClass() { return "DataConstraint" }, isBasic: true },
METADATA_CONSTRAINT: { key: "METADATA_CONSTRAINT", getClass() { return "MetadataConstraint" }, isBasic: false }
// TRANSFORMATION_SCHEME: { key: "TRANSFORMATION_SCHEME", getClass() { return "TransformationScheme" }, isBasic: false },
// RULESET_SCHEME: { key: "RULESET_SCHEME", getClass() { return "RulesetScheme" }, isBasic: false },
// USER_DEFINED_OPERATOR_SCHEME: { key: "USER_DEFINED_OPERATOR_SCHEME", getClass() { return "UserDefinedOperatorScheme" }, isBasic: false },
// CUSTOM_TYPE_SCHEME: { key: "CUSTOM_TYPE_SCHEME", getClass() { return "CustomTypeScheme" }, isBasic: false },
// NAME_PERSONALISATION_SCHEME: { key: "NAME_PERSONALISATION_SCHEME", getClass() { return "NamePersonalisationScheme" }, isBasic: false },
// VTL_MAPPING_SCHEME: { key: "VTL_MAPPING_SCHEME", getClass() { return "VtlMappingScheme" }, isBasic: false }

};

SDMX_STRUCTURE_TYPE.CATEGORY = { key: "CATEGORY", getClass() { return "Category" }, maintainableParent: SDMX_STRUCTURE_TYPE.CATEGORY_SCHEME };
SDMX_STRUCTURE_TYPE.CONCEPT = { key: "CONCEPT", getClass() { return "Concept" }, maintainableParent: SDMX_STRUCTURE_TYPE.CONCEPT_SCHEME };
SDMX_STRUCTURE_TYPE.CODE = { key: "CODE", getClass() { return "Code" }, maintainableParent: SDMX_STRUCTURE_TYPE.CODE_LIST };
SDMX_STRUCTURE_TYPE.HIERARCHY = { key: "HIERARCHY", getClass() { return "Hierarchy" }, maintainableParent: SDMX_STRUCTURE_TYPE.HIERARCHICAL_CODELIST };
//SDMX_STRUCTURE_TYPE.HIERARCHY = { key: "HIERARCHY", getClass() { return "Hierarchy" }, maintainableParent: SDMX_STRUCTURE_TYPE.HIERARCHICAL_CODELIST };
SDMX_STRUCTURE_TYPE.AGENCY = { key: "AGENCY", getClass() { return "Agency" }, maintainableParent: SDMX_STRUCTURE_TYPE.AGENCY_SCHEME };
SDMX_STRUCTURE_TYPE.DATA_PROVIDER = { key: "DATA_PROVIDER", getClass() { return "DataProvider" }, maintainableParent: SDMX_STRUCTURE_TYPE.DATA_PROVIDER_SCHEME };
SDMX_STRUCTURE_TYPE.DATA_CONSUMER = { key: "DATA_CONSUMER", getClass() { return "DataConsumer" }, maintainableParent: SDMX_STRUCTURE_TYPE.DATA_CONSUMER_SCHEME };
Expand Down Expand Up @@ -89,6 +108,44 @@ SDMX_STRUCTURE_TYPE.fromRestResource = function (restResource) {
return this.ACTUAL_CONSTRAINT.key;
case "reportingtaxonomy":
return this.REPORTING_TAXONOMY.key;
case "hierarchy":
return this.HIERARCHY.key;
case "hierarchyassociation":
return this.HIERARCHY_ASSOCIATION.key;
case "valuelist":
return this.VALUE_LIST.key;
case "structuremap":
return this.STRUCTURE_MAP.key;
case "representationmap":
return this.REPRESENTATION_MAP.key;
case "conceptschememap":
return this.CONCEPT_SCHEME_MAP.key;
case "categoryschememap":
return this.CATEGORY_SCHEME_MAP.key;
case "organisationschememap":
return this.ORGANISATION_SCHEME_MAP.key;
case "reportingtaxonomymap":
return this.REPORTING_TAXONOMY_MAP.key;
case "metadataproviderscheme":
return this.METADATA_PROVIDER_SCHEME.key;
case "metadataprovisionagreement":
return this.METADATA_PROVISION_AGREEMENT.key;
case "dataconstraint":
return this.DATA_CONSTRAINT.key;
case "metadataconstraint":
return this.METADATA_CONSTRAINT.key;
// case "transformationscheme":
// return this.TRANSFORMATION_SCHEME.key;
// case "rulesetscheme":
// return this.RULESET_SCHEME.key;
// case "userdefinedoperatorscheme":
// return this.USER_DEFINED_OPERATOR_SCHEME.key;
// case "customtypescheme":
// return this.CUSTOM_TYPE_SCHEME.key;
// case "namepersonalisationscheme":
// return this.NAME_PERSONALISATION_SCHEME.key;
// case "vtlmappingscheme":
// return this.VTL_MAPPING_SCHEME.key;
default:
return null;
}
Expand Down Expand Up @@ -152,13 +209,7 @@ SDMX_STRUCTURE_TYPE.matchPathToMaintainable = function(path){
}

SDMX_STRUCTURE_TYPE.getMaintainableStructureTypeByClass = function (urnClass) {
if (urnClass == null) {
throw new Error("SDMX structure type cannot be extracted from a null urn class.");
}
let structureType = this.getStructureTypeByClass(urnClass);
if (!structureType) {
throw new Error("Could not find structure type for urn class '" + urnClass + "'");
}
let structureType = this.getIdentifiableStructureTypeByClass(urnClass);
if (!this[structureType].maintainableParent) {
return structureType;
} else {
Expand All @@ -172,6 +223,17 @@ SDMX_STRUCTURE_TYPE.getStructureTypeByClass = function (urnClass) {
);
};

SDMX_STRUCTURE_TYPE.getIdentifiableStructureTypeByClass = function (urnClass) {
if (urnClass == null) {
throw new Error("SDMX structure type cannot be extracted from a null urn class.");
}
let structureType = this.getStructureTypeByClass(urnClass);
if (!structureType) {
throw new Error("Could not find structure type for urn class '" + urnClass + "'");
}
return structureType;
};

SDMX_STRUCTURE_TYPE.getMaintainableTypes = function () {
let maintainableTypes = Object.keys(SDMX_STRUCTURE_TYPE).filter((key) => {
return SDMX_STRUCTURE_TYPE.isMaintainable(key) === true;
Expand Down
86 changes: 76 additions & 10 deletions sdmx-tck-api/src/constants/StructuresRestResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,38 @@ const STRUCTURES_REST_RESOURCE = {
conceptscheme: "conceptscheme",
codelist: "codelist",
hierarchicalcodelist: "hierarchicalcodelist",
hierarchy: "hierarchy",
hierarchyassociation: "hierarchyassociation",
valuelist: "valuelist",
organisationscheme: "organisationscheme",
agencyscheme: "agencyscheme",
dataproviderscheme: "dataproviderscheme",
metadataproviderscheme: "metadataproviderscheme",
dataconsumerscheme: "dataconsumerscheme",
organisationunitscheme: "organisationunitscheme",
dataflow: "dataflow",
metadataflow: "metadataflow",
reportingtaxonomy: "reportingtaxonomy",
provisionagreement: "provisionagreement",
metadataprovisionagreement: "metadataprovisionagreement",
structureset: "structureset",
structuremap: "structuremap",
representationmap: "representationmap",
conceptschememap: "conceptschememap",
categoryschememap: "categoryschememap",
organisationschememap: "organisationschememap",
reportingtaxonomymap: "reportingtaxonomymap",
process: "process",
categorisation: "categorisation",
contentconstraint: "contentconstraint",
dataconstraint: "dataconstraint",
metadataconstraint: "metadataconstraint",
// transformationscheme: "transformationscheme",
// rulesetscheme: "rulesetscheme",
// userdefinedoperatorscheme: "userdefinedoperatorscheme",
// customtypescheme: "customtypescheme",
// namepersonalisationscheme: "namepersonalisationscheme",
// vtlmappingscheme: "vtlmappingscheme",
attachmentconstraint: "attachmentconstraint",
structure: "structure",

Expand All @@ -37,28 +56,75 @@ const STRUCTURES_REST_RESOURCE = {
},
getStructureResources(apiVersion, requestMode) {
if (requestMode === TEST_REQUEST_MODE.BASIC) {
let resourcesArr = this.getValues().filter((value) => {
let resourcesArr = this.getStructureRestResources(apiVersion).filter((value) => {
let structureType = SDMX_STRUCTURE_TYPE.fromRestResource(value);
return (SDMX_STRUCTURE_TYPE.isStructureBasic(structureType) || value === STRUCTURES_REST_RESOURCE.structure);
});
return resourcesArr;
}
// Full mode depends on API version, i.e. exclude allowedconstraint and actualconstraint for old versions
// For any other case return all resources
if (API_VERSIONS[apiVersion] < API_VERSIONS["v1.3.0"]) {
return this.getValues().filter((value) => {
return (value !== STRUCTURES_REST_RESOURCE.allowedconstraint &&
value !== STRUCTURES_REST_RESOURCE.actualconstraint);
});
}
return this.getValues();
// Full mode: return all available resources for the given api version
return this.getStructureRestResources(apiVersion);
},
getSchemaResources() {
var resources = [];
resources.push(STRUCTURES_REST_RESOURCE.datastructure);
resources.push(STRUCTURES_REST_RESOURCE.dataflow);
resources.push(STRUCTURES_REST_RESOURCE.provisionagreement);
return resources;
},
getStructureRestResources(apiVersion) {
let resources = [];
resources.push(this.datastructure);
resources.push(this.metadatastructure);
resources.push(this.categoryscheme);
resources.push(this.conceptscheme);
resources.push(this.codelist);
resources.push(this.agencyscheme);
resources.push(this.dataproviderscheme);
resources.push(this.dataconsumerscheme);
resources.push(this.organisationunitscheme);
resources.push(this.dataflow);
resources.push(this.metadataflow);
resources.push(this.reportingtaxonomy);
resources.push(this.provisionagreement);
resources.push(this.process);
resources.push(this.categorisation);
resources.push(this.structure);

if (API_VERSIONS[apiVersion] <= API_VERSIONS["v1.4.0"]) {
resources.push(this.hierarchicalcodelist);
resources.push(this.organisationscheme);
resources.push(this.structureset);
resources.push(this.contentconstraint);
resources.push(this.attachmentconstraint);

if (API_VERSIONS[apiVersion] >= API_VERSIONS["v1.3.0"]) {
resources.push(this.allowedconstraint);
resources.push(this.actualconstraint);
}
}
if (API_VERSIONS[apiVersion] >= API_VERSIONS["v2.0.0"]) {
resources.push(this.hierarchy);
resources.push(this.hierarchyassociation);
resources.push(this.valuelist);
resources.push(this.structuremap);
resources.push(this.representationmap);
resources.push(this.conceptschememap);
resources.push(this.categoryschememap);
resources.push(this.organisationschememap);
resources.push(this.reportingtaxonomymap);
resources.push(this.metadataproviderscheme);
resources.push(this.metadataprovisionagreement);
resources.push(this.dataconstraint);
resources.push(this.metadataconstraint);
// resources.push(this.transformationscheme);
// resources.push(this.rulesetscheme);
// resources.push(this.userdefinedoperatorscheme);
// resources.push(this.customtypescheme);
// resources.push(this.namepersonalisationscheme);
// resources.push(this.vtlmappingscheme);
}
return resources;
}
};

Expand Down
2 changes: 1 addition & 1 deletion sdmx-tck-api/src/constants/TCKVersion.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const TCK_VERSION = "3.4.0"
const TCK_VERSION = "4.3.0"

module.exports.TCK_VERSION = Object.freeze(TCK_VERSION);
1 change: 1 addition & 0 deletions sdmx-tck-api/src/constants/TestIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const TEST_INDEX = {
Structure: 'Structure',
Data: 'Data',
Schema: 'Schema',
Availability: "Availability",
Metadata: 'Metadata'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const ITEM_SCHEME_TYPES = {
DATA_CONSUMER_SCHEME: "DATA_CONSUMER_SCHEME",
ORGANISATION_UNIT_SCHEME: "ORGANISATION_UNIT_SCHEME",
REPORTING_TAXONOMY: "REPORTING_TAXONOMY",
HIERARCHICAL_CODELIST: "HIERARCHICAL_CODELIST"
HIERARCHICAL_CODELIST: "HIERARCHICAL_CODELIST",
METADATA_PROVIDER_SCHEME: "METADATA_PROVIDER_SCHEME",
VALUE_LIST: "VALUE_LIST"
};

module.exports.ITEM_SCHEME_TYPES = Object.freeze(ITEM_SCHEME_TYPES);
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const STRUCTURE_QUERY_DETAIL = {
REFERENCE_PARTIAL: "referencepartial",
ALL_COMPLETE_STUBS: "allcompletestubs",
REFERENCE_COMPLETE_STUBS: "referencecompletestubs",
RAW: "raw",

getStructureQueryDetail(apiVersion) {
var availableDetailValues = [];
Expand All @@ -19,6 +20,9 @@ const STRUCTURE_QUERY_DETAIL = {
availableDetailValues.push(STRUCTURE_QUERY_DETAIL.ALL_COMPLETE_STUBS)
availableDetailValues.push(STRUCTURE_QUERY_DETAIL.REFERENCE_COMPLETE_STUBS)
}
if (API_VERSIONS[apiVersion] >= API_VERSIONS["v2.0.0"]) {
availableDetailValues.push(STRUCTURE_QUERY_DETAIL.RAW);
}
return availableDetailValues;
}
};
Expand Down
Loading

0 comments on commit f02e06b

Please sign in to comment.