{
"components": {"schemas": {
- "producer_ei_job_request": {
- "description": "The body of the EI producer callbacks for EI job creation and deletion",
+ "consumer_information_type": {
+ "description": "Information for an Information type",
"type": "object",
- "required": ["ei_job_identity"],
- "properties": {
- "owner": {
- "description": "The owner of the job",
- "type": "string"
- },
- "ei_job_identity": {
- "description": "Idenitity of the EI job",
- "type": "string"
- },
- "last_updated": {
- "description": "The time when the job was last updated or created (ISO-8601)",
- "type": "string"
- },
- "ei_job_data": {
- "description": "Json for the job data",
- "type": "object"
- },
- "target_uri": {
- "description": "URI for the target of the EI",
- "type": "string"
- },
- "ei_type_identity": {
- "description": "Type idenitity for the job",
- "type": "string"
- }
- }
+ "required": ["job_data_schema"],
+ "properties": {"job_data_schema": {
+ "description": "Json schema for the job data",
+ "type": "object"
+ }}
},
"EiTypeObject": {
"description": "Information for an EI type",
"properties": {
"no_of_producers": {
"format": "int32",
- "description": "Number of EI producers",
+ "description": "Number of Information Producers",
"type": "integer"
},
"no_of_types": {
"format": "int32",
- "description": "Number of EI types",
+ "description": "Number of Information Types",
"type": "integer"
},
"no_of_jobs": {
"format": "int32",
- "description": "Number of EI jobs",
+ "description": "Number of Information Jobs",
"type": "integer"
},
"status": {
}
}
},
- "producer_ei_type_info": {
- "description": "Information for an EI type",
- "type": "object",
- "required": ["ei_job_data_schema"],
- "properties": {"ei_job_data_schema": {
- "description": "Json schema for the job data",
- "type": "object"
- }}
- },
"producer_registration_info": {
- "description": "Information for an EI producer",
+ "description": "Information for an Information Producer",
"type": "object",
"required": [
- "ei_job_callback_url",
- "ei_producer_supervision_callback_url",
- "supported_ei_types"
+ "info_job_callback_url",
+ "info_producer_supervision_callback_url",
+ "supported_info_types"
],
"properties": {
- "supported_ei_types": {
- "description": "Supported EI type IDs",
+ "info_producer_supervision_callback_url": {
+ "description": "callback for producer supervision",
+ "type": "string"
+ },
+ "supported_info_types": {
+ "description": "Supported Information Type IDs",
"type": "array",
"items": {
- "description": "Supported EI type IDs",
+ "description": "Supported Information Type IDs",
"type": "string"
}
},
- "ei_producer_supervision_callback_url": {
- "description": "callback for producer supervision",
- "type": "string"
- },
- "ei_job_callback_url": {
- "description": "callback for EI job",
+ "info_job_callback_url": {
+ "description": "callback for Information Job",
"type": "string"
}
}
"detail": {
"description": "A human-readable explanation specific to this occurrence of the problem.",
"type": "string",
- "example": "EI job type not found"
+ "example": "Information Job type not found"
},
"status": {
"format": "int32",
]
}}
},
+ "consumer_job_status": {
+ "description": "Status for an Information Job",
+ "type": "object",
+ "required": ["info_job_status"],
+ "properties": {"info_job_status": {
+ "description": "Allowed values for Information Job status",
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ }}
+ },
"EiJobObject": {
"description": "Information for an Enrichment Information Job",
"type": "object",
}
}
},
- "JobStatus": {
- "description": "Status for an EI job",
+ "producer_info_type_info": {
+ "description": "Information for an Information Type",
"type": "object",
- "required": ["eiJobStatus"],
- "properties": {"eiJobStatus": {
- "description": "Allowed values for EI job status",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
+ "required": ["info_job_data_schema"],
+ "properties": {"info_job_data_schema": {
+ "description": "Json schema for the job data",
+ "type": "object"
}}
},
- "producer_status": {
- "description": "Status for an EI Producer",
+ "producer_info_job_request": {
+ "description": "The body of the Information Producer callbacks for Information Job creation and deletion",
"type": "object",
- "required": ["operational_state"],
- "properties": {"operational_state": {
- "description": "Represents the operational states",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
- }}
- },
- "Void": {
- "description": "Void/empty ",
- "type": "object"
+ "required": ["info_job_identity"],
+ "properties": {
+ "owner": {
+ "description": "The owner of the job",
+ "type": "string"
+ },
+ "last_updated": {
+ "description": "The time when the job was last updated or created (ISO-8601)",
+ "type": "string"
+ },
+ "info_job_identity": {
+ "description": "Identity of the Information Job",
+ "type": "string"
+ },
+ "target_uri": {
+ "description": "URI for the target of the produced Information",
+ "type": "string"
+ },
+ "info_job_data": {
+ "description": "Json for the job data",
+ "type": "object"
+ },
+ "info_type_identity": {
+ "description": "Type identity for the job",
+ "type": "string"
+ }
+ }
},
- "Job": {
- "description": "Information for an Enrichment Information Job",
+ "consumer_job": {
+ "description": "Information for an Enrichment Information Job",
"type": "object",
"required": [
- "infoTypeId",
- "jobDefinition",
- "jobOwner",
- "jobResultUri"
+ "info_type_id",
+ "job_definition",
+ "job_owner",
+ "job_result_uri"
],
"properties": {
- "jobResultUri": {
- "description": "The target URI of the subscribed information",
- "type": "string"
- },
- "infoTypeId": {
+ "info_type_id": {
"description": "Information type Idenitifier of the subscription job",
"type": "string"
},
- "jobOwner": {
- "description": "Identity of the owner of the job",
+ "job_result_uri": {
+ "description": "The target URI of the subscribed information",
"type": "string"
},
- "statusNotificationUri": {
- "description": "The target of Information subscription job status notifications",
+ "job_owner": {
+ "description": "Identity of the owner of the job",
"type": "string"
},
- "jobDefinition": {
+ "job_definition": {
"description": "Information type specific job data",
"type": "object"
+ },
+ "status_notification_uri": {
+ "description": "The target of Information subscription job status notifications",
+ "type": "string"
}
}
},
- "InformationType": {
- "description": "Information for an Information type",
+ "producer_status": {
+ "description": "Status for an Info Producer",
"type": "object",
- "required": ["consumer_job_data_schema"],
- "properties": {"consumer_job_data_schema": {
- "description": "Json schema for the job data",
- "type": "object"
+ "required": ["operational_state"],
+ "properties": {"operational_state": {
+ "description": "Represents the operational states",
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
}}
+ },
+ "Void": {
+ "description": "Void/empty ",
+ "type": "object"
}
}},
"openapi": "3.0.1",
"paths": {
- "/producer_simulator/ei_job": {"post": {
- "summary": "Callback for EI job creation/modification",
- "requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_job_request"}}},
- "required": true
- },
- "description": "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the EI producer.",
- "operationId": "jobCreatedCallback",
+ "/data-producer/v1/info-types": {"get": {
+ "summary": "Info Type identifiers",
+ "operationId": "getInfoTypdentifiers",
"responses": {"200": {
- "description": "OK",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ "description": "Info Type identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
}},
- "tags": ["Data producer (callbacks)"]
+ "tags": ["Data producer (registration)"]
}},
"/A1-EI/v1/eitypes/{eiTypeId}": {"get": {
"summary": "Individual EI type",
- "operationId": "getEiType_1",
+ "operationId": "getEiType",
"responses": {
"200": {
"description": "EI type",
}],
"tags": ["A1-EI (registration)"]
}},
- "/ei-producer/v1/eitypes": {"get": {
- "summary": "EI type identifiers",
- "operationId": "getEiTypeIdentifiers",
- "responses": {"200": {
- "description": "EI type identifiers",
- "content": {"application/json": {"schema": {
- "type": "array",
- "items": {"type": "string"}
- }}}
- }},
- "tags": ["Data producer (registration)"]
- }},
- "/A1-EI/v1/eitypes": {"get": {
- "summary": "EI type identifiers",
- "operationId": "getEiTypeIdentifiers_1",
- "responses": {"200": {
- "description": "EI type identifiers",
- "content": {"application/json": {"schema": {
- "type": "array",
- "items": {"type": "string"}
- }}}
- }},
- "tags": ["A1-EI (registration)"]
- }},
- "/data-consumer/v1/info-types": {"get": {
- "summary": "Information type identifiers",
- "operationId": "getinfoTypeIdentifiers",
- "responses": {"200": {
- "description": "Information type identifiers",
- "content": {"application/json": {"schema": {
- "type": "array",
- "items": {"type": "string"}
- }}}
- }},
- "tags": ["Data consumer"]
- }},
- "/ei-producer/v1/eiproducers/{eiProducerId}/status": {"get": {
- "summary": "EI producer status",
- "operationId": "getEiProducerStatus",
- "responses": {
- "200": {
- "description": "EI producer status",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_status"}}}
- },
- "404": {
- "description": "Enrichment Information producer is not found",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
- }
- },
- "parameters": [{
- "schema": {"type": "string"},
- "in": "path",
- "name": "eiProducerId",
- "required": true
- }],
- "tags": ["Data producer (registration)"]
- }},
- "/producer_simulator/ei_job/{eiJobId}": {"delete": {
- "summary": "Callback for EI job deletion",
- "description": "The call is invoked to terminate a data subscription. The endpoint is provided by the EI producer.",
- "operationId": "jobDeletedCallback",
- "responses": {"200": {
- "description": "OK",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
- }},
- "parameters": [{
- "schema": {"type": "string"},
- "in": "path",
- "name": "eiJobId",
- "required": true
- }],
- "tags": ["Data producer (callbacks)"]
- }},
- "/ei-producer/v1/eitypes/{eiTypeId}": {
+ "/data-producer/v1/info-types/{infoTypeId}": {
"get": {
- "summary": "Individual EI type",
- "operationId": "getEiType",
+ "summary": "Individual Information Type",
+ "operationId": "getInfoType",
"responses": {
"200": {
- "description": "EI type",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_type_info"}}}
+ "description": "Info Type",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_info_type_info"}}}
},
"404": {
- "description": "Enrichment Information type is not found",
+ "description": "Information type is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiTypeId",
+ "name": "infoTypeId",
"required": true
}],
"tags": ["Data producer (registration)"]
},
"delete": {
- "summary": "Individual EI type",
- "operationId": "deleteEiType",
+ "summary": "Individual Information Type",
+ "operationId": "deleteInfoType",
"responses": {
"200": {
"description": "Not used",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Enrichment Information type is not found",
+ "description": "Information type is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
},
"406": {
- "description": "The Enrichment Information type has one or several active producers",
+ "description": "The Information type has one or several active producers",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiTypeId",
+ "name": "infoTypeId",
"required": true
}],
"tags": ["Data producer (registration)"]
},
"put": {
- "summary": "Individual EI type",
+ "summary": "Individual Information Type",
"requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_ei_type_info"}}},
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_info_type_info"}}},
"required": true
},
- "operationId": "putEiType",
+ "operationId": "putInfoType",
"responses": {
"200": {
"description": "Type updated",
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiTypeId",
+ "name": "infoTypeId",
"required": true
}],
"tags": ["Data producer (registration)"]
}
},
- "/status": {"get": {
- "summary": "Returns status and statistics of this service",
- "operationId": "getStatus",
+ "/A1-EI/v1/eitypes": {"get": {
+ "summary": "EI type identifiers",
+ "operationId": "getEiTypeIdentifiers",
"responses": {"200": {
- "description": "Service is living",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/status_info"}}}
+ "description": "EI type identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
}},
- "tags": ["Service status"]
+ "tags": ["A1-EI (registration)"]
}},
- "/ei-producer/v1/eiproducers": {"get": {
- "summary": "EI producer identifiers",
- "operationId": "getEiProducerIdentifiers",
+ "/data-consumer/v1/info-types": {"get": {
+ "summary": "Information type identifiers",
+ "operationId": "getinfoTypeIdentifiers",
"responses": {"200": {
- "description": "EI producer identifiers",
+ "description": "Information type identifiers",
"content": {"application/json": {"schema": {
"type": "array",
"items": {"type": "string"}
}}}
}},
- "parameters": [{
- "schema": {"type": "string"},
- "in": "query",
- "name": "ei_type_id",
- "description": "If given, only the producers for the EI Data type is returned.",
- "required": false
- }],
- "tags": ["Data producer (registration)"]
+ "tags": ["Data consumer"]
}},
- "/A1-EI/v1/eijobs/{eiJobId}": {
+ "/data-producer/v1/info-producers/{infoProducerId}": {
"get": {
- "summary": "Individual EI job",
- "operationId": "getIndividualEiJob_1",
+ "summary": "Individual Information Producer",
+ "operationId": "getInfoProducer",
"responses": {
"200": {
- "description": "EI job",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}}
+ "description": "Information producer",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}}
},
"404": {
- "description": "Enrichment Information job is not found",
+ "description": "Information producer is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiJobId",
+ "name": "infoProducerId",
"required": true
}],
- "tags": ["A1-EI (registration)"]
+ "tags": ["Data producer (registration)"]
},
"delete": {
- "summary": "Individual EI job",
- "operationId": "deleteIndividualEiJob_1",
+ "summary": "Individual Information Producer",
+ "operationId": "deleteInfoProducer",
"responses": {
"200": {
"description": "Not used",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"204": {
- "description": "Job deleted",
+ "description": "Producer deleted",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Enrichment Information job is not found",
+ "description": "Producer is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiJobId",
+ "name": "infoProducerId",
"required": true
}],
- "tags": ["A1-EI (registration)"]
+ "tags": ["Data producer (registration)"]
},
"put": {
- "summary": "Individual EI job",
+ "summary": "Individual Information Producer",
"requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}},
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}},
"required": true
},
- "operationId": "putIndividualEiJob",
+ "operationId": "putInfoProducer",
"responses": {
"200": {
- "description": "Job updated",
+ "description": "Producer updated",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"201": {
- "description": "Job created",
+ "description": "Producer created",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Enrichment Information type is not found",
+ "description": "Producer not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiJobId",
+ "name": "infoProducerId",
"required": true
}],
- "tags": ["A1-EI (registration)"]
+ "tags": ["Data producer (registration)"]
}
},
- "/ei-producer/v1/eiproducers/{eiProducerId}": {
+ "/producer_simulator/info_job/{infoJobId}": {"delete": {
+ "summary": "Callback for Information Job deletion",
+ "description": "The call is invoked to terminate a data subscription. The endpoint is provided by the Information Producer.",
+ "operationId": "jobDeletedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "infoJobId",
+ "required": true
+ }],
+ "tags": ["Data producer (callbacks)"]
+ }},
+ "/status": {"get": {
+ "summary": "Returns status and statistics of this service",
+ "operationId": "getStatus",
+ "responses": {"200": {
+ "description": "Service is living",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/status_info"}}}
+ }},
+ "tags": ["Service status"]
+ }},
+ "/A1-EI/v1/eijobs/{eiJobId}": {
"get": {
- "summary": "Individual EI producer",
- "operationId": "getEiProducer",
+ "summary": "Individual EI job",
+ "operationId": "getIndividualEiJob_1",
"responses": {
"200": {
- "description": "EI producer",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}}
+ "description": "EI job",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}}
},
"404": {
- "description": "Enrichment Information producer is not found",
+ "description": "Enrichment Information job is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiProducerId",
+ "name": "eiJobId",
"required": true
}],
- "tags": ["Data producer (registration)"]
+ "tags": ["A1-EI (registration)"]
},
"delete": {
- "summary": "Individual EI producer",
- "operationId": "deleteEiProducer",
+ "summary": "Individual EI job",
+ "operationId": "deleteIndividualEiJob_1",
"responses": {
"200": {
"description": "Not used",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"204": {
- "description": "Producer deleted",
+ "description": "Job deleted",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Producer is not found",
+ "description": "Enrichment Information job is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiProducerId",
+ "name": "eiJobId",
"required": true
}],
- "tags": ["Data producer (registration)"]
+ "tags": ["A1-EI (registration)"]
},
"put": {
- "summary": "Individual EI producer",
+ "summary": "Individual EI job",
"requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_registration_info"}}},
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobObject"}}},
"required": true
},
- "operationId": "putEiProducer",
+ "operationId": "putIndividualEiJob",
"responses": {
"200": {
- "description": "Producer updated",
+ "description": "Job updated",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"201": {
- "description": "Producer created",
+ "description": "Job created",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Producer not found",
+ "description": "Enrichment Information type is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiProducerId",
+ "name": "eiJobId",
"required": true
}],
- "tags": ["Data producer (registration)"]
+ "tags": ["A1-EI (registration)"]
}
},
"/producer_simulator/health_check": {"get": {
"summary": "Producer supervision",
- "description": "The endpoint is provided by the EI producer and is used for supervision of the producer.",
+ "description": "The endpoint is provided by the Information Producer and is used for supervision of the producer.",
"operationId": "producerSupervision",
"responses": {"200": {
"description": "The producer is OK",
"tags": ["Data producer (callbacks)"]
}},
"/data-consumer/v1/info-jobs": {"get": {
- "summary": "EI job identifiers",
+ "summary": "Information Job identifiers",
"description": "query for information job identifiers",
"operationId": "getJobIds",
"responses": {
"responses": {
"200": {
"description": "Information subscription job",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Job"}}}
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_job"}}}
},
"404": {
"description": "Information subscription job is not found",
"put": {
"summary": "Individual data subscription job",
"requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Job"}}},
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_job"}}},
"required": true
},
"description": "The job will be enabled when a producer is available",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
},
"404": {
- "description": "Enrichment Information type is not found",
+ "description": "Information type is not found",
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
}
},
"tags": ["Data consumer"]
}
},
- "/ei-producer/v1/eiproducers/{eiProducerId}/eijobs": {"get": {
- "summary": "EI job definitions",
- "description": "EI job definitions for one EI producer",
- "operationId": "getEiProducerJobs",
- "responses": {
- "200": {
- "description": "EI producer",
- "content": {"application/json": {"schema": {
- "type": "array",
- "items": {"$ref": "#/components/schemas/producer_ei_job_request"}
- }}}
- },
- "404": {
- "description": "Enrichment Information producer is not found",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
- }
- },
+ "/data-producer/v1/info-producers": {"get": {
+ "summary": "Information producer identifiers",
+ "operationId": "getInfoProducerIdentifiers",
+ "responses": {"200": {
+ "description": "Information producer identifiers",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"type": "string"}
+ }}}
+ }},
"parameters": [{
"schema": {"type": "string"},
- "in": "path",
- "name": "eiProducerId",
- "required": true
+ "in": "query",
+ "name": "info_type_id",
+ "description": "If given, only the producers for the EI Data type is returned.",
+ "required": false
}],
"tags": ["Data producer (registration)"]
}},
"/data-consumer/v1/info-types/{infoTypeId}": {"get": {
"summary": "Individual information type",
- "operationId": "getInfoType",
+ "operationId": "getInfoType_1",
"responses": {
"200": {
"description": "Information type",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/InformationType"}}}
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_information_type"}}}
},
"404": {
"description": "Information type is not found",
}],
"tags": ["Data consumer"]
}},
+ "/producer_simulator/info_job": {"post": {
+ "summary": "Callback for Information Job creation/modification",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_info_job_request"}}},
+ "required": true
+ },
+ "description": "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the Information Producer.",
+ "operationId": "jobCreatedCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "tags": ["Data producer (callbacks)"]
+ }},
+ "/example_dataconsumer/info_jobs/{infoJobId}/status": {"post": {
+ "summary": "Callback for changed Information Job status",
+ "requestBody": {
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobStatusObject"}}},
+ "required": true
+ },
+ "description": "The primitive is implemented by the data consumer and is invoked when a Information Job status has been changed.",
+ "operationId": "jobStatusCallback",
+ "responses": {"200": {
+ "description": "OK",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
+ }},
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "infoJobId",
+ "required": true
+ }],
+ "tags": ["A1-EI (callbacks)"]
+ }},
"/A1-EI/v1/eijobs": {"get": {
"summary": "EI job identifiers",
"description": "query for EI job identifiers",
}],
"tags": ["A1-EI (registration)"]
}},
- "/example_dataconsumer/eijobs/{eiJobId}/status": {"post": {
- "summary": "Callback for changed EI job status",
- "requestBody": {
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/EiJobStatusObject"}}},
+ "/data-producer/v1/info-producers/{infoProducerId}/status": {"get": {
+ "summary": "Information producer status",
+ "operationId": "getInfoProducerStatus",
+ "responses": {
+ "200": {
+ "description": "Information producer status",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/producer_status"}}}
+ },
+ "404": {
+ "description": "Information producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
+ }
+ },
+ "parameters": [{
+ "schema": {"type": "string"},
+ "in": "path",
+ "name": "infoProducerId",
"required": true
+ }],
+ "tags": ["Data producer (registration)"]
+ }},
+ "/data-producer/v1/info-producers/{infoProducerId}/info-jobs": {"get": {
+ "summary": "Information Job definitions",
+ "description": "Information Job definitions for one Information Producer",
+ "operationId": "getInfoProducerJobs",
+ "responses": {
+ "200": {
+ "description": "Information producer",
+ "content": {"application/json": {"schema": {
+ "type": "array",
+ "items": {"$ref": "#/components/schemas/producer_info_job_request"}
+ }}}
+ },
+ "404": {
+ "description": "Information producer is not found",
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/ProblemDetails"}}}
+ }
},
- "description": "The primitive is implemented by the data consumer and is invoked when a EI job status has been changed.",
- "operationId": "jobStatusCallback",
- "responses": {"200": {
- "description": "OK",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Void"}}}
- }},
"parameters": [{
"schema": {"type": "string"},
"in": "path",
- "name": "eiJobId",
+ "name": "infoProducerId",
"required": true
}],
- "tags": ["A1-EI (callbacks)"]
+ "tags": ["Data producer (registration)"]
}},
"/data-consumer/v1/info-jobs/{infoJobId}/status": {"get": {
"summary": "Job status",
"responses": {
"200": {
"description": "Information subscription job status",
- "content": {"application/json": {"schema": {"$ref": "#/components/schemas/JobStatus"}}}
+ "content": {"application/json": {"schema": {"$ref": "#/components/schemas/consumer_job_status"}}}
},
"404": {
"description": "Information subscription job is not found",
"name": "Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
},
- "description": "<h1>API documentation<\/h1><h2>General<\/h2><p> The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (EI type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (EI job). One EI job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p><h2>APIs provided by the service<\/h2><h4>A1-EI<\/h4><p> This API is between Near-RT RIC and the Non-RT RIC. The Near-RT RIC is a data consumer, which creates Enrichment Information Jobs to subscribe for data.<\/p><h4>Data producer API<\/h4><p> This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data producers and provides support for:<ul><li>Registry of supported information types and which parameters needed to setup a subscription.<\/li><li>Registry of existing data producers.<\/li><li>Callback API provided by producers to setup subscriptions.<\/li><\/ul><\/p><h4>Data consumer API<\/h4><p> This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data consumers and provides support for:<ul><li>Querying of available types of data to consume.<\/li><li>Management of data subscription jobs<\/li><\/ul><\/p><h4>EI Service status<\/h4><p> This API provides a means to monitor the service.<\/p>",
+ "description": "<h1>API documentation<\/h1><h2>General<\/h2><p> The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (Information Type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (Information Job). One Information Job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types.<\/p><h2>APIs provided by the service<\/h2><h4>A1-EI<\/h4><p> This API is between Near-RT RIC and the Non-RT RIC. The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe for data. In this context, the information is referred to as 'Enrichment Information', EI.<\/p><h4>Data producer API<\/h4><p> This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data producers and provides support for:<ul><li>Registry of supported information types and which parameters needed to setup a subscription.<\/li><li>Registry of existing data producers.<\/li><li>Callback API provided by producers to setup subscriptions.<\/li><\/ul><\/p><h4>Data consumer API<\/h4><p> This API is provided by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The API is for use by different kinds of data consumers and provides support for:<ul><li>Querying of available types of data to consume.<\/li><li>Management of data subscription jobs<\/li><\/ul><\/p><h4>Service status<\/h4><p> This API provides a means to monitor the health of this service.<\/p>",
"title": "Data management and exposure",
"version": "1.0"
},
title: Data management and exposure
description: <h1>API documentation</h1><h2>General</h2><p> The service is mainly
a broker between data producers and data consumers. A data producer has the ability
- to produce one or several types of data (EI type). One type of data can be produced
- by zero to many producers. <br /><br />A data consumer can have several active
- data subscriptions (EI job). One EI job consists of the type of data to produce
- and additional parameters for filtering of the data. These parameters are different
- for different data types.</p><h2>APIs provided by the service</h2><h4>A1-EI</h4><p> This
- API is between Near-RT RIC and the Non-RT RIC. The Near-RT RIC is a data consumer,
- which creates Enrichment Information Jobs to subscribe for data.</p><h4>Data producer
- API</h4><p> This API is provided by the Non-RT RIC platform and is intended to
- be part of the O-RAN R1 interface. The API is for use by different kinds of data
- producers and provides support for:<ul><li>Registry of supported information types
- and which parameters needed to setup a subscription.</li><li>Registry of existing
- data producers.</li><li>Callback API provided by producers to setup subscriptions.</li></ul></p><h4>Data
- consumer API</h4><p> This API is provided by the Non-RT RIC platform and is intended
- to be part of the O-RAN R1 interface. The API is for use by different kinds of
- data consumers and provides support for:<ul><li>Querying of available types of
- data to consume.</li><li>Management of data subscription jobs</li></ul></p><h4>EI
- Service status</h4><p> This API provides a means to monitor the service.</p>
+ to produce one or several types of data (Information Type). One type of data can
+ be produced by zero to many producers. <br /><br />A data consumer can have several
+ active data subscriptions (Information Job). One Information Job consists of the
+ type of data to produce and additional parameters for filtering of the data. These
+ parameters are different for different data types.</p><h2>APIs provided by the
+ service</h2><h4>A1-EI</h4><p> This API is between Near-RT RIC and the Non-RT
+ RIC. The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe
+ for data. In this context, the information is referred to as 'Enrichment Information',
+ EI.</p><h4>Data producer API</h4><p> This API is provided by the Non-RT RIC platform
+ and is intended to be part of the O-RAN R1 interface. The API is for use by different
+ kinds of data producers and provides support for:<ul><li>Registry of supported
+ information types and which parameters needed to setup a subscription.</li><li>Registry
+ of existing data producers.</li><li>Callback API provided by producers to setup
+ subscriptions.</li></ul></p><h4>Data consumer API</h4><p> This API is provided
+ by the Non-RT RIC platform and is intended to be part of the O-RAN R1 interface. The
+ API is for use by different kinds of data consumers and provides support for:<ul><li>Querying
+ of available types of data to consume.</li><li>Management of data subscription
+ jobs</li></ul></p><h4>Service status</h4><p> This API provides a means to monitor
+ the health of this service.</p>
license:
name: Copyright (C) 2020 Nordix Foundation. Licensed under the Apache License.
url: http://www.apache.org/licenses/LICENSE-2.0
- name: Data consumer
description: API for data consumers
paths:
- /producer_simulator/ei_job:
- post:
+ /data-producer/v1/info-types:
+ get:
tags:
- - Data producer (callbacks)
- summary: Callback for EI job creation/modification
- description: The call is invoked to activate or to modify a data subscription.
- The endpoint is provided by the EI producer.
- operationId: jobCreatedCallback
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/producer_ei_job_request'
- required: true
+ - Data producer (registration)
+ summary: Info Type identifiers
+ operationId: getInfoTypdentifiers
responses:
200:
- description: OK
+ description: Info Type identifiers
content:
application/json:
schema:
- $ref: '#/components/schemas/Void'
+ type: array
+ items:
+ type: string
/A1-EI/v1/eitypes/{eiTypeId}:
get:
tags:
- A1-EI (registration)
summary: Individual EI type
- operationId: getEiType_1
+ operationId: getEiType
parameters:
- name: eiTypeId
in: path
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /ei-producer/v1/eitypes:
+ /data-producer/v1/info-types/{infoTypeId}:
get:
tags:
- Data producer (registration)
- summary: EI type identifiers
- operationId: getEiTypeIdentifiers
- responses:
- 200:
- description: EI type identifiers
- content:
- application/json:
- schema:
- type: array
- items:
- type: string
- /A1-EI/v1/eitypes:
- get:
- tags:
- - A1-EI (registration)
- summary: EI type identifiers
- operationId: getEiTypeIdentifiers_1
- responses:
- 200:
- description: EI type identifiers
- content:
- application/json:
- schema:
- type: array
- items:
- type: string
- /data-consumer/v1/info-types:
- get:
- tags:
- - Data consumer
- summary: Information type identifiers
- operationId: getinfoTypeIdentifiers
- responses:
- 200:
- description: Information type identifiers
- content:
- application/json:
- schema:
- type: array
- items:
- type: string
- /ei-producer/v1/eiproducers/{eiProducerId}/status:
- get:
- tags:
- - Data producer (registration)
- summary: EI producer status
- operationId: getEiProducerStatus
- parameters:
- - name: eiProducerId
- in: path
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- 200:
- description: EI producer status
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/producer_status'
- 404:
- description: Enrichment Information producer is not found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ProblemDetails'
- /producer_simulator/ei_job/{eiJobId}:
- delete:
- tags:
- - Data producer (callbacks)
- summary: Callback for EI job deletion
- description: The call is invoked to terminate a data subscription. The endpoint
- is provided by the EI producer.
- operationId: jobDeletedCallback
- parameters:
- - name: eiJobId
- in: path
- required: true
- style: simple
- explode: false
- schema:
- type: string
- responses:
- 200:
- description: OK
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/Void'
- /ei-producer/v1/eitypes/{eiTypeId}:
- get:
- tags:
- - Data producer (registration)
- summary: Individual EI type
- operationId: getEiType
+ summary: Individual Information Type
+ operationId: getInfoType
parameters:
- - name: eiTypeId
+ - name: infoTypeId
in: path
required: true
style: simple
type: string
responses:
200:
- description: EI type
+ description: Info Type
content:
application/json:
schema:
- $ref: '#/components/schemas/producer_ei_type_info'
+ $ref: '#/components/schemas/producer_info_type_info'
404:
- description: Enrichment Information type is not found
+ description: Information type is not found
content:
application/json:
schema:
put:
tags:
- Data producer (registration)
- summary: Individual EI type
- operationId: putEiType
+ summary: Individual Information Type
+ operationId: putInfoType
parameters:
- - name: eiTypeId
+ - name: infoTypeId
in: path
required: true
style: simple
content:
application/json:
schema:
- $ref: '#/components/schemas/producer_ei_type_info'
+ $ref: '#/components/schemas/producer_info_type_info'
required: true
responses:
200:
delete:
tags:
- Data producer (registration)
- summary: Individual EI type
- operationId: deleteEiType
+ summary: Individual Information Type
+ operationId: deleteInfoType
parameters:
- - name: eiTypeId
+ - name: infoTypeId
in: path
required: true
style: simple
schema:
$ref: '#/components/schemas/Void'
404:
- description: Enrichment Information type is not found
+ description: Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
406:
- description: The Enrichment Information type has one or several active producers
+ description: The Information type has one or several active producers
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /status:
+ /A1-EI/v1/eitypes:
get:
tags:
- - Service status
- summary: Returns status and statistics of this service
- operationId: getStatus
+ - A1-EI (registration)
+ summary: EI type identifiers
+ operationId: getEiTypeIdentifiers
responses:
200:
- description: Service is living
+ description: EI type identifiers
content:
application/json:
schema:
- $ref: '#/components/schemas/status_info'
- /ei-producer/v1/eiproducers:
+ type: array
+ items:
+ type: string
+ /data-consumer/v1/info-types:
get:
tags:
- - Data producer (registration)
- summary: EI producer identifiers
- operationId: getEiProducerIdentifiers
- parameters:
- - name: ei_type_id
- in: query
- description: If given, only the producers for the EI Data type is returned.
- required: false
- style: form
- explode: true
- schema:
- type: string
+ - Data consumer
+ summary: Information type identifiers
+ operationId: getinfoTypeIdentifiers
responses:
200:
- description: EI producer identifiers
+ description: Information type identifiers
content:
application/json:
schema:
type: array
items:
type: string
- /A1-EI/v1/eijobs/{eiJobId}:
+ /data-producer/v1/info-producers/{infoProducerId}:
get:
tags:
- - A1-EI (registration)
- summary: Individual EI job
- operationId: getIndividualEiJob_1
+ - Data producer (registration)
+ summary: Individual Information Producer
+ operationId: getInfoProducer
parameters:
- - name: eiJobId
+ - name: infoProducerId
in: path
required: true
style: simple
type: string
responses:
200:
- description: EI job
+ description: Information producer
content:
application/json:
schema:
- $ref: '#/components/schemas/EiJobObject'
+ $ref: '#/components/schemas/producer_registration_info'
404:
- description: Enrichment Information job is not found
+ description: Information producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
put:
tags:
- - A1-EI (registration)
- summary: Individual EI job
- operationId: putIndividualEiJob
+ - Data producer (registration)
+ summary: Individual Information Producer
+ operationId: putInfoProducer
parameters:
- - name: eiJobId
+ - name: infoProducerId
in: path
required: true
style: simple
content:
application/json:
schema:
- $ref: '#/components/schemas/EiJobObject'
+ $ref: '#/components/schemas/producer_registration_info'
required: true
responses:
200:
- description: Job updated
+ description: Producer updated
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
201:
- description: Job created
+ description: Producer created
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
404:
- description: Enrichment Information type is not found
+ description: Producer not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
delete:
tags:
- - A1-EI (registration)
- summary: Individual EI job
- operationId: deleteIndividualEiJob_1
+ - Data producer (registration)
+ summary: Individual Information Producer
+ operationId: deleteInfoProducer
parameters:
- - name: eiJobId
+ - name: infoProducerId
in: path
required: true
style: simple
schema:
$ref: '#/components/schemas/Void'
204:
- description: Job deleted
+ description: Producer deleted
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
404:
- description: Enrichment Information job is not found
+ description: Producer is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /ei-producer/v1/eiproducers/{eiProducerId}:
+ /producer_simulator/info_job/{infoJobId}:
+ delete:
+ tags:
+ - Data producer (callbacks)
+ summary: Callback for Information Job deletion
+ description: The call is invoked to terminate a data subscription. The endpoint
+ is provided by the Information Producer.
+ operationId: jobDeletedCallback
+ parameters:
+ - name: infoJobId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ /status:
get:
tags:
- - Data producer (registration)
- summary: Individual EI producer
- operationId: getEiProducer
+ - Service status
+ summary: Returns status and statistics of this service
+ operationId: getStatus
+ responses:
+ 200:
+ description: Service is living
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/status_info'
+ /A1-EI/v1/eijobs/{eiJobId}:
+ get:
+ tags:
+ - A1-EI (registration)
+ summary: Individual EI job
+ operationId: getIndividualEiJob_1
parameters:
- - name: eiProducerId
+ - name: eiJobId
in: path
required: true
style: simple
type: string
responses:
200:
- description: EI producer
+ description: EI job
content:
application/json:
schema:
- $ref: '#/components/schemas/producer_registration_info'
+ $ref: '#/components/schemas/EiJobObject'
404:
- description: Enrichment Information producer is not found
+ description: Enrichment Information job is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
put:
tags:
- - Data producer (registration)
- summary: Individual EI producer
- operationId: putEiProducer
+ - A1-EI (registration)
+ summary: Individual EI job
+ operationId: putIndividualEiJob
parameters:
- - name: eiProducerId
+ - name: eiJobId
in: path
required: true
style: simple
content:
application/json:
schema:
- $ref: '#/components/schemas/producer_registration_info'
+ $ref: '#/components/schemas/EiJobObject'
required: true
responses:
200:
- description: Producer updated
+ description: Job updated
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
201:
- description: Producer created
+ description: Job created
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
404:
- description: Producer not found
+ description: Enrichment Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
delete:
tags:
- - Data producer (registration)
- summary: Individual EI producer
- operationId: deleteEiProducer
+ - A1-EI (registration)
+ summary: Individual EI job
+ operationId: deleteIndividualEiJob_1
parameters:
- - name: eiProducerId
+ - name: eiJobId
in: path
required: true
style: simple
schema:
$ref: '#/components/schemas/Void'
204:
- description: Producer deleted
+ description: Job deleted
content:
application/json:
schema:
$ref: '#/components/schemas/Void'
404:
- description: Producer is not found
+ description: Enrichment Information job is not found
content:
application/json:
schema:
tags:
- Data producer (callbacks)
summary: Producer supervision
- description: The endpoint is provided by the EI producer and is used for supervision
- of the producer.
+ description: The endpoint is provided by the Information Producer and is used
+ for supervision of the producer.
operationId: producerSupervision
responses:
200:
get:
tags:
- Data consumer
- summary: EI job identifiers
+ summary: Information Job identifiers
description: query for information job identifiers
operationId: getJobIds
parameters:
content:
application/json:
schema:
- $ref: '#/components/schemas/Job'
+ $ref: '#/components/schemas/consumer_job'
404:
description: Information subscription job is not found
content:
content:
application/json:
schema:
- $ref: '#/components/schemas/Job'
+ $ref: '#/components/schemas/consumer_job'
required: true
responses:
200:
schema:
$ref: '#/components/schemas/Void'
404:
- description: Enrichment Information type is not found
+ description: Information type is not found
content:
application/json:
schema:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /ei-producer/v1/eiproducers/{eiProducerId}/eijobs:
+ /data-producer/v1/info-producers:
get:
tags:
- Data producer (registration)
- summary: EI job definitions
- description: EI job definitions for one EI producer
- operationId: getEiProducerJobs
+ summary: Information producer identifiers
+ operationId: getInfoProducerIdentifiers
parameters:
- - name: eiProducerId
- in: path
- required: true
- style: simple
- explode: false
+ - name: info_type_id
+ in: query
+ description: If given, only the producers for the EI Data type is returned.
+ required: false
+ style: form
+ explode: true
schema:
type: string
responses:
200:
- description: EI producer
+ description: Information producer identifiers
content:
application/json:
schema:
type: array
items:
- $ref: '#/components/schemas/producer_ei_job_request'
- 404:
- description: Enrichment Information producer is not found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ProblemDetails'
+ type: string
/data-consumer/v1/info-types/{infoTypeId}:
get:
tags:
- Data consumer
summary: Individual information type
- operationId: getInfoType
+ operationId: getInfoType_1
parameters:
- name: infoTypeId
in: path
content:
application/json:
schema:
- $ref: '#/components/schemas/InformationType'
+ $ref: '#/components/schemas/consumer_information_type'
404:
description: Information type is not found
content:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
+ /producer_simulator/info_job:
+ post:
+ tags:
+ - Data producer (callbacks)
+ summary: Callback for Information Job creation/modification
+ description: The call is invoked to activate or to modify a data subscription.
+ The endpoint is provided by the Information Producer.
+ operationId: jobCreatedCallback
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/producer_info_job_request'
+ required: true
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
+ /example_dataconsumer/info_jobs/{infoJobId}/status:
+ post:
+ tags:
+ - A1-EI (callbacks)
+ summary: Callback for changed Information Job status
+ description: The primitive is implemented by the data consumer and is invoked
+ when a Information Job status has been changed.
+ operationId: jobStatusCallback
+ parameters:
+ - name: infoJobId
+ in: path
+ required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/EiJobStatusObject'
+ required: true
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Void'
/A1-EI/v1/eijobs:
get:
tags:
application/json:
schema:
$ref: '#/components/schemas/ProblemDetails'
- /example_dataconsumer/eijobs/{eiJobId}/status:
- post:
+ /data-producer/v1/info-producers/{infoProducerId}/status:
+ get:
tags:
- - A1-EI (callbacks)
- summary: Callback for changed EI job status
- description: The primitive is implemented by the data consumer and is invoked
- when a EI job status has been changed.
- operationId: jobStatusCallback
+ - Data producer (registration)
+ summary: Information producer status
+ operationId: getInfoProducerStatus
parameters:
- - name: eiJobId
+ - name: infoProducerId
in: path
required: true
style: simple
explode: false
schema:
type: string
- requestBody:
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/EiJobStatusObject'
+ responses:
+ 200:
+ description: Information producer status
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/producer_status'
+ 404:
+ description: Information producer is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetails'
+ /data-producer/v1/info-producers/{infoProducerId}/info-jobs:
+ get:
+ tags:
+ - Data producer (registration)
+ summary: Information Job definitions
+ description: Information Job definitions for one Information Producer
+ operationId: getInfoProducerJobs
+ parameters:
+ - name: infoProducerId
+ in: path
required: true
+ style: simple
+ explode: false
+ schema:
+ type: string
responses:
200:
- description: OK
+ description: Information producer
content:
application/json:
schema:
- $ref: '#/components/schemas/Void'
+ type: array
+ items:
+ $ref: '#/components/schemas/producer_info_job_request'
+ 404:
+ description: Information producer is not found
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ProblemDetails'
/data-consumer/v1/info-jobs/{infoJobId}/status:
get:
tags:
content:
application/json:
schema:
- $ref: '#/components/schemas/JobStatus'
+ $ref: '#/components/schemas/consumer_job_status'
404:
description: Information subscription job is not found
content:
$ref: '#/components/schemas/ProblemDetails'
components:
schemas:
- producer_ei_job_request:
+ consumer_information_type:
required:
- - ei_job_identity
+ - job_data_schema
type: object
properties:
- owner:
- type: string
- description: The owner of the job
- ei_job_identity:
- type: string
- description: Idenitity of the EI job
- last_updated:
- type: string
- description: The time when the job was last updated or created (ISO-8601)
- ei_job_data:
+ job_data_schema:
type: object
- description: Json for the job data
- target_uri:
- type: string
- description: URI for the target of the EI
- ei_type_identity:
- type: string
- description: Type idenitity for the job
- description: The body of the EI producer callbacks for EI job creation and deletion
+ description: Json schema for the job data
+ description: Information for an Information type
EiTypeObject:
type: object
description: Information for an EI type
properties:
no_of_producers:
type: integer
- description: Number of EI producers
+ description: Number of Information Producers
format: int32
no_of_types:
type: integer
- description: Number of EI types
+ description: Number of Information Types
format: int32
no_of_jobs:
type: integer
- description: Number of EI jobs
+ description: Number of Information Jobs
format: int32
status:
type: string
description: status text
- producer_ei_type_info:
- required:
- - ei_job_data_schema
- type: object
- properties:
- ei_job_data_schema:
- type: object
- description: Json schema for the job data
- description: Information for an EI type
producer_registration_info:
required:
- - ei_job_callback_url
- - ei_producer_supervision_callback_url
- - supported_ei_types
+ - info_job_callback_url
+ - info_producer_supervision_callback_url
+ - supported_info_types
type: object
properties:
- supported_ei_types:
+ info_producer_supervision_callback_url:
+ type: string
+ description: callback for producer supervision
+ supported_info_types:
type: array
- description: Supported EI type IDs
+ description: Supported Information Type IDs
items:
type: string
- description: Supported EI type IDs
- ei_producer_supervision_callback_url:
+ description: Supported Information Type IDs
+ info_job_callback_url:
type: string
- description: callback for producer supervision
- ei_job_callback_url:
- type: string
- description: callback for EI job
- description: Information for an EI producer
+ description: callback for Information Job
+ description: Information for an Information Producer
ProblemDetails:
type: object
properties:
type: string
description: A human-readable explanation specific to this occurrence of
the problem.
- example: EI job type not found
+ example: Information Job type not found
status:
type: integer
description: The HTTP status code generated by the origin server for this
- ENABLED
- DISABLED
description: Status for an EI job
+ consumer_job_status:
+ required:
+ - info_job_status
+ type: object
+ properties:
+ info_job_status:
+ type: string
+ description: Allowed values for Information Job status
+ enum:
+ - ENABLED
+ - DISABLED
+ description: Status for an Information Job
EiJobObject:
required:
- eiTypeId
type: object
description: EI type specific job data
description: Information for an Enrichment Information Job
- JobStatus:
+ producer_info_type_info:
required:
- - eiJobStatus
+ - info_job_data_schema
type: object
properties:
- eiJobStatus:
- type: string
- description: Allowed values for EI job status
- enum:
- - ENABLED
- - DISABLED
- description: Status for an EI job
- producer_status:
+ info_job_data_schema:
+ type: object
+ description: Json schema for the job data
+ description: Information for an Information Type
+ producer_info_job_request:
required:
- - operational_state
+ - info_job_identity
type: object
properties:
- operational_state:
+ owner:
type: string
- description: Represents the operational states
- enum:
- - ENABLED
- - DISABLED
- description: Status for an EI Producer
- Void:
- type: object
- description: 'Void/empty '
- Job:
+ description: The owner of the job
+ last_updated:
+ type: string
+ description: The time when the job was last updated or created (ISO-8601)
+ info_job_identity:
+ type: string
+ description: Identity of the Information Job
+ target_uri:
+ type: string
+ description: URI for the target of the produced Information
+ info_job_data:
+ type: object
+ description: Json for the job data
+ info_type_identity:
+ type: string
+ description: Type identity for the job
+ description: The body of the Information Producer callbacks for Information
+ Job creation and deletion
+ consumer_job:
required:
- - infoTypeId
- - jobDefinition
- - jobOwner
- - jobResultUri
+ - info_type_id
+ - job_definition
+ - job_owner
+ - job_result_uri
type: object
properties:
- jobResultUri:
- type: string
- description: The target URI of the subscribed information
- infoTypeId:
+ info_type_id:
type: string
description: Information type Idenitifier of the subscription job
- jobOwner:
+ job_result_uri:
type: string
- description: Identity of the owner of the job
- statusNotificationUri:
+ description: The target URI of the subscribed information
+ job_owner:
type: string
- description: The target of Information subscription job status notifications
- jobDefinition:
+ description: Identity of the owner of the job
+ job_definition:
type: object
description: Information type specific job data
- description: Information for an Enrichment Information Job
- InformationType:
+ status_notification_uri:
+ type: string
+ description: The target of Information subscription job status notifications
+ description: Information for an Enrichment Information Job
+ producer_status:
required:
- - consumer_job_data_schema
+ - operational_state
type: object
properties:
- consumer_job_data_schema:
- type: object
- description: Json schema for the job data
- description: Information for an Information type
+ operational_state:
+ type: string
+ description: Represents the operational states
+ enum:
+ - ENABLED
+ - DISABLED
+ description: Status for an Info Producer
+ Void:
+ type: object
+ description: 'Void/empty '
import org.apache.catalina.connector.Connector;
import org.oransc.enrichment.configuration.ApplicationConfig;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ProducerCallbacks producerCallbacks;
- private EiTypes eiTypes;
- private EiJobs eiJobs;
+ private InfoTypes infoTypes;
+ private InfoJobs infoJobs;
@Bean
public ObjectMapper mapper() {
}
@Bean
- public EiJobs eiJobs() {
- if (eiJobs == null) {
- eiJobs = new EiJobs(getApplicationConfig(), producerCallbacks());
+ public InfoJobs infoJobs() {
+ if (infoJobs == null) {
+ infoJobs = new InfoJobs(getApplicationConfig(), producerCallbacks());
try {
- eiJobs.restoreJobsFromDatabase();
+ infoJobs.restoreJobsFromDatabase();
} catch (Exception e) {
logger.error("Could not restore jobs from database: {}", e.getMessage());
}
}
- return eiJobs;
+ return infoJobs;
}
@Bean
- public EiTypes eiTypes() {
- if (this.eiTypes == null) {
- eiTypes = new EiTypes(getApplicationConfig());
+ public InfoTypes infoTypes() {
+ if (this.infoTypes == null) {
+ infoTypes = new InfoTypes(getApplicationConfig());
try {
- eiTypes.restoreTypesFromDatabase();
+ infoTypes.restoreTypesFromDatabase();
} catch (Exception e) {
- logger.error("Could not restore EI types from database: {}", e.getMessage());
+ logger.error("Could not restore Information Types from database: {}", e.getMessage());
}
}
- return eiTypes;
+ return infoTypes;
}
@Bean
static final String DESCRIPTION = "<h1>API documentation</h1>" //
+ "<h2>General</h2>" //
+ "<p>" //
- + " The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (EI type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (EI job). One EI job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types." //
+ + " The service is mainly a broker between data producers and data consumers. A data producer has the ability to produce one or several types of data (Information Type). One type of data can be produced by zero to many producers. <br /><br />A data consumer can have several active data subscriptions (Information Job). One Information Job consists of the type of data to produce and additional parameters for filtering of the data. These parameters are different for different data types." //
+ "</p>" //
+ "<h2>APIs provided by the service</h2>" //
+ "<h4>A1-EI</h4>" //
+ "<p>" //
+ " This API is between Near-RT RIC and the Non-RT RIC." //
- + " The Near-RT RIC is a data consumer, which creates Enrichment Information Jobs to subscribe for data." //
+ + " The Near-RT RIC is a data consumer, which creates Information Jobs to subscribe for data." //
+ + " In this context, the information is referred to as 'Enrichment Information', EI." //
+ "</p>" //
+ "<h4>Data producer API</h4>" //
+ "<p>" //
+ "<li>Management of data subscription jobs</li>" //
+ "</ul>" //
+ "</p>" //
- + "<h4>EI Service status</h4>" //
+ + "<h4>Service status</h4>" //
+ "<p>" //
- + " This API provides a means to monitor the service." //
+ + " This API provides a means to monitor the health of this service." //
+ "</p>";
}
}
@Schema(
- example = "EI job type not found",
+ example = "Information Job type not found",
description = "A human-readable explanation specific to this occurrence of the problem.")
public String getDetail() {
return this.detail;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.immutables.gson.Gson;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
public static final String API_DESCRIPTION = "API for monitoring of the service";
@Autowired
- private EiJobs eiJobs;
+ private InfoJobs infoJobs;
@Autowired
- private EiTypes eiTypes;
+ private InfoTypes infoTypes;
@Autowired
- private EiProducers eiProducers;
+ private InfoProducers infoProducers;
@Gson.TypeAdapters
@Schema(name = "status_info")
@JsonProperty(value = "status", required = true)
public final String status;
- @Schema(name = "no_of_producers", description = "Number of EI producers")
+ @Schema(name = "no_of_producers", description = "Number of Information Producers")
@SerializedName("no_of_producers")
@JsonProperty(value = "no_of_producers", required = true)
public final int noOfProducers;
- @Schema(name = "no_of_types", description = "Number of EI types")
+ @Schema(name = "no_of_types", description = "Number of Information Types")
@SerializedName("no_of_types")
@JsonProperty(value = "no_of_types", required = true)
public final int noOfTypes;
- @Schema(name = "no_of_jobs", description = "Number of EI jobs")
+ @Schema(name = "no_of_jobs", description = "Number of Information Jobs")
@SerializedName("no_of_jobs")
@JsonProperty(value = "no_of_jobs", required = true)
public final int noOfJobs;
- public StatusInfo(String status, EiProducers producers, EiTypes types, EiJobs jobs) {
+ public StatusInfo(String status, InfoProducers producers, InfoTypes types, InfoJobs jobs) {
this.status = status;
this.noOfJobs = jobs.size();
this.noOfProducers = producers.size();
content = @Content(schema = @Schema(implementation = StatusInfo.class))) //
})
public Mono<ResponseEntity<Object>> getStatus() {
- StatusInfo info = new StatusInfo("hunky dory", this.eiProducers, this.eiTypes, this.eiJobs);
+ StatusInfo info = new StatusInfo("hunky dory", this.infoProducers, this.infoTypes, this.infoJobs);
return Mono.just(new ResponseEntity<>(info, HttpStatus.OK));
}
import org.oransc.enrichment.clients.AsyncRestClient;
import org.oransc.enrichment.clients.AsyncRestClientFactory;
import org.oransc.enrichment.configuration.ApplicationConfig;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiType;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
private static Gson gson = new GsonBuilder().create();
private final AsyncRestClient restClient;
- private final EiJobs eiJobs;
- private final EiProducers eiProducers;
+ private final InfoJobs eiJobs;
+ private final InfoProducers eiProducers;
@Autowired
- public A1eCallbacks(ApplicationConfig config, EiJobs eiJobs, EiProducers eiProducers) {
+ public A1eCallbacks(ApplicationConfig config, InfoJobs eiJobs, InfoProducers eiProducers) {
AsyncRestClientFactory restClientFactory = new AsyncRestClientFactory(config.getWebClientConfig());
this.restClient = restClientFactory.createRestClientUseHttpProxy("");
this.eiJobs = eiJobs;
this.eiProducers = eiProducers;
}
- public Flux<String> notifyJobStatus(Collection<EiType> eiTypes) {
+ public Flux<String> notifyJobStatus(Collection<InfoType> eiTypes) {
return Flux.fromIterable(eiTypes) //
.flatMap(eiType -> Flux.fromIterable(this.eiJobs.getJobsForType(eiType))) //
.filter(eiJob -> !eiJob.getJobStatusUrl().isEmpty()) //
.flatMap(this::noifyStatusToJobOwner);
}
- private Mono<String> noifyStatusToJobOwner(EiJob job) {
+ private Mono<String> noifyStatusToJobOwner(InfoJob job) {
boolean isJobEnabled = this.eiProducers.isJobEnabled(job);
A1eEiJobStatus status = isJobEnabled ? new A1eEiJobStatus(A1eEiJobStatus.EiJobStatusValues.ENABLED)
: new A1eEiJobStatus(A1eEiJobStatus.EiJobStatusValues.DISABLED);
import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import org.oransc.enrichment.controllers.VoidResponse;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
import org.oransc.enrichment.exceptions.ServiceException;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiType;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
ApplicationConfig applicationConfig;
@Autowired
- private EiJobs eiJobs;
+ private InfoJobs eiJobs;
@Autowired
- private EiTypes eiTypes;
+ private InfoTypes eiTypes;
@Autowired
- private EiProducers eiProducers;
+ private InfoProducers infoProducers;
@Autowired
ProducerCallbacks producerCallbacks;
public ResponseEntity<Object> getEiTypeIdentifiers( //
) {
List<String> result = new ArrayList<>();
- for (EiType eiType : this.eiTypes.getAllInfoTypes()) {
+ for (InfoType eiType : this.eiTypes.getAllInfoTypes()) {
result.add(eiType.getId());
}
try {
List<String> result = new ArrayList<>();
if (owner != null) {
- for (EiJob job : this.eiJobs.getJobsForOwner(owner)) {
+ for (InfoJob job : this.eiJobs.getJobsForOwner(owner)) {
if (eiTypeId == null || job.getTypeId().equals(eiTypeId)) {
result.add(job.getId());
}
public ResponseEntity<Object> getIndividualEiJob( //
@PathVariable("eiJobId") String eiJobId) {
try {
- EiJob job = this.eiJobs.getJob(eiJobId);
+ InfoJob job = this.eiJobs.getJob(eiJobId);
return new ResponseEntity<>(gson.toJson(toEiJobInfo(job)), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
public ResponseEntity<Object> getEiJobStatus( //
@PathVariable("eiJobId") String eiJobId) {
try {
- EiJob job = this.eiJobs.getJob(eiJobId);
+ InfoJob job = this.eiJobs.getJob(eiJobId);
return new ResponseEntity<>(gson.toJson(toEiJobStatus(job)), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
- private A1eEiJobStatus toEiJobStatus(EiJob job) {
- return this.eiProducers.isJobEnabled(job) ? new A1eEiJobStatus(A1eEiJobStatus.EiJobStatusValues.ENABLED)
+ private A1eEiJobStatus toEiJobStatus(InfoJob job) {
+ return this.infoProducers.isJobEnabled(job) ? new A1eEiJobStatus(A1eEiJobStatus.EiJobStatusValues.ENABLED)
: new A1eEiJobStatus(A1eEiJobStatus.EiJobStatusValues.DISABLED);
}
public ResponseEntity<Object> deleteIndividualEiJob( //
@PathVariable("eiJobId") String eiJobId) {
try {
- EiJob job = this.eiJobs.getJob(eiJobId);
- this.eiJobs.remove(job, this.eiProducers);
+ InfoJob job = this.eiJobs.getJob(eiJobId);
+ this.eiJobs.remove(job, this.infoProducers);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
.onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
}
- private Mono<EiJob> startEiJob(EiJob newEiJob) {
- return this.producerCallbacks.startInfoSubscriptionJob(newEiJob, eiProducers) //
+ private Mono<InfoJob> startEiJob(InfoJob newEiJob) {
+ return this.producerCallbacks.startInfoSubscriptionJob(newEiJob, infoProducers) //
.doOnNext(noOfAcceptingProducers -> this.logger.debug(
"Started EI job {}, number of activated producers: {}", newEiJob.getId(), noOfAcceptingProducers)) //
.flatMap(noOfAcceptingProducers -> Mono.just(newEiJob));
}
- private Mono<EiJob> validatePutEiJob(String eiJobId, A1eEiJobInfo eiJobInfo) {
+ private Mono<InfoJob> validatePutEiJob(String eiJobId, A1eEiJobInfo eiJobInfo) {
try {
- EiType eiType = this.eiTypes.getType(eiJobInfo.eiTypeId);
+ InfoType eiType = this.eiTypes.getType(eiJobInfo.eiTypeId);
validateJsonObjectAgainstSchema(eiType.getJobDataSchema(), eiJobInfo.jobDefinition);
- EiJob existingEiJob = this.eiJobs.get(eiJobId);
+ InfoJob existingEiJob = this.eiJobs.get(eiJobId);
+ validateUri(eiJobInfo.jobResultUri);
+ validateUri(eiJobInfo.statusNotificationUri);
if (existingEiJob != null && !existingEiJob.getTypeId().equals(eiJobInfo.eiTypeId)) {
throw new ServiceException("Not allowed to change type for existing EI job", HttpStatus.CONFLICT);
}
}
+ private void validateUri(String url) throws URISyntaxException, ServiceException {
+ if (url != null && !url.isEmpty()) {
+ URI uri = new URI(url);
+ if (!uri.isAbsolute()) {
+ throw new ServiceException("URI: " + url + " is not absolute", HttpStatus.CONFLICT);
+ }
+ }
+ }
+
private void validateJsonObjectAgainstSchema(Object schemaObj, Object object) throws ServiceException {
if (schemaObj != null) { // schema is optional for now
try {
}
}
- private EiJob toEiJob(A1eEiJobInfo info, String id, EiType type) {
- return EiJob.builder() //
+ private InfoJob toEiJob(A1eEiJobInfo info, String id, InfoType type) {
+ return InfoJob.builder() //
.id(id) //
.typeId(type.getId()) //
.owner(info.owner) //
return new A1eEiTypeInfo();
}
- private A1eEiJobInfo toEiJobInfo(EiJob s) {
+ private A1eEiJobInfo toEiJobInfo(InfoJob s) {
return new A1eEiJobInfo(s.getTypeId(), s.getJobData(), s.getOwner(), s.getTargetUrl(), s.getJobStatusUrl());
}
}
@Schema(name = "eiTypeId", description = "EI type Idenitifier of the EI job", required = true)
@SerializedName("eiTypeId")
@JsonProperty(value = "eiTypeId", required = true)
- public String eiTypeId;
+ public String eiTypeId = "";
@Schema(name = "jobOwner", description = "Identity of the owner of the job", required = true)
@SerializedName("jobOwner")
@JsonProperty(value = "jobOwner", required = true)
- public String owner;
+ public String owner = "";
@Schema(name = "jobDefinition", description = "EI type specific job data", required = true)
@SerializedName("jobDefinition")
@Schema(name = "jobResultUri", description = "The target URI of the EI data", required = true)
@SerializedName("jobResultUri")
@JsonProperty(value = "jobResultUri", required = true)
- public String jobResultUri;
+ public String jobResultUri = "";
@Schema(name = "statusNotificationUri", description = "The target of EI job status notifications", required = false)
@SerializedName("jobStatusNotificationUri")
@JsonProperty(value = "jobStatusNotificationUri", required = false)
- public String statusNotificationUri;
+ public String statusNotificationUri = "";
public A1eEiJobInfo() {
}
import io.swagger.v3.oas.annotations.tags.Tag;
import java.lang.invoke.MethodHandles;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import org.oransc.enrichment.controllers.VoidResponse;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
import org.oransc.enrichment.exceptions.ServiceException;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiType;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
ApplicationConfig applicationConfig;
@Autowired
- private EiJobs jobs;
+ private InfoJobs jobs;
@Autowired
- private EiTypes infoTypes;
+ private InfoTypes infoTypes;
@Autowired
- private EiProducers infoProducers;
+ private InfoProducers infoProducers;
@Autowired
ProducerCallbacks producerCallbacks;
public ResponseEntity<Object> getinfoTypeIdentifiers( //
) {
List<String> result = new ArrayList<>();
- for (EiType infoType : this.infoTypes.getAllInfoTypes()) {
+ for (InfoType infoType : this.infoTypes.getAllInfoTypes()) {
result.add(infoType.getId());
}
public ResponseEntity<Object> getInfoType( //
@PathVariable("infoTypeId") String infoTypeId) {
try {
- EiType type = this.infoTypes.getType(infoTypeId);
+ InfoType type = this.infoTypes.getType(infoTypeId);
ConsumerInfoTypeInfo info = toInfoTypeInfo(type);
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
} catch (Exception e) {
}
@GetMapping(path = "/info-jobs", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "EI job identifiers", description = "query for information job identifiers")
+ @Operation(summary = "Information Job identifiers", description = "query for information job identifiers")
@ApiResponses(
value = { //
@ApiResponse(
try {
List<String> result = new ArrayList<>();
if (owner != null) {
- for (EiJob job : this.jobs.getJobsForOwner(owner)) {
+ for (InfoJob job : this.jobs.getJobsForOwner(owner)) {
if (infoTypeId == null || job.getTypeId().equals(infoTypeId)) {
result.add(job.getId());
}
public ResponseEntity<Object> getIndividualEiJob( //
@PathVariable("infoJobId") String infoJobId) {
try {
- EiJob job = this.jobs.getJob(infoJobId);
+ InfoJob job = this.jobs.getJob(infoJobId);
return new ResponseEntity<>(gson.toJson(toInfoJobInfo(job)), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
public ResponseEntity<Object> getEiJobStatus( //
@PathVariable("infoJobId") String jobId) {
try {
- EiJob job = this.jobs.getJob(jobId);
+ InfoJob job = this.jobs.getJob(jobId);
return new ResponseEntity<>(gson.toJson(toInfoJobStatus(job)), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
- private ConsumerJobStatus toInfoJobStatus(EiJob job) {
+ private ConsumerJobStatus toInfoJobStatus(InfoJob job) {
return this.infoProducers.isJobEnabled(job)
? new ConsumerJobStatus(ConsumerJobStatus.InfoJobStatusValues.ENABLED)
: new ConsumerJobStatus(ConsumerJobStatus.InfoJobStatusValues.DISABLED);
@ApiResponse(
responseCode = "204",
description = "Job deleted", //
- content = @Content(schema = @Schema(implementation = VoidResponse.class))), // "Individual EI job"
+ content = @Content(schema = @Schema(implementation = VoidResponse.class))), // "Individual
+ // Information Job"
@ApiResponse(
responseCode = "404",
description = "Information subscription job is not found", //
public ResponseEntity<Object> deleteIndividualEiJob( //
@PathVariable("infoJobId") String jobId) {
try {
- EiJob job = this.jobs.getJob(jobId);
+ InfoJob job = this.jobs.getJob(jobId);
this.jobs.remove(job, this.infoProducers);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information type is not found", //
+ description = "Information type is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
public Mono<ResponseEntity<Object>> putIndividualInfoJob( //
.onErrorResume(throwable -> Mono.just(ErrorResponse.create(throwable, HttpStatus.NOT_FOUND)));
}
- private Mono<EiJob> startInfoSubscriptionJob(EiJob newInfoJob) {
+ private Mono<InfoJob> startInfoSubscriptionJob(InfoJob newInfoJob) {
return this.producerCallbacks.startInfoSubscriptionJob(newInfoJob, infoProducers) //
.doOnNext(noOfAcceptingProducers -> this.logger.debug("Started job {}, number of activated producers: {}",
newInfoJob.getId(), noOfAcceptingProducers)) //
.flatMap(noOfAcceptingProducers -> Mono.just(newInfoJob));
}
- private Mono<EiJob> validatePutInfoJob(String jobId, ConsumerJobInfo jobInfo, boolean performTypeCheck) {
+ private Mono<InfoJob> validatePutInfoJob(String jobId, ConsumerJobInfo jobInfo, boolean performTypeCheck) {
try {
if (performTypeCheck) {
- EiType infoType = this.infoTypes.getType(jobInfo.infoTypeId);
+ InfoType infoType = this.infoTypes.getType(jobInfo.infoTypeId);
validateJsonObjectAgainstSchema(infoType.getJobDataSchema(), jobInfo.jobDefinition);
}
- EiJob existingEiJob = this.jobs.get(jobId);
+ InfoJob existingEiJob = this.jobs.get(jobId);
+ validateUri(jobInfo.statusNotificationUri);
+ validateUri(jobInfo.jobResultUri);
if (existingEiJob != null && !existingEiJob.getTypeId().equals(jobInfo.infoTypeId)) {
throw new ServiceException("Not allowed to change type for existing job", HttpStatus.CONFLICT);
}
}
+ private void validateUri(String url) throws URISyntaxException, ServiceException {
+ if (url != null && !url.isEmpty()) {
+ URI uri = new URI(url);
+ if (!uri.isAbsolute()) {
+ throw new ServiceException("URI: " + url + " is not absolute", HttpStatus.CONFLICT);
+ }
+ }
+ }
+
private void validateJsonObjectAgainstSchema(Object schemaObj, Object object) throws ServiceException {
if (schemaObj != null) { // schema is optional for now
try {
}
}
- private EiJob toEiJob(ConsumerJobInfo info, String id, String typeId) {
- return EiJob.builder() //
+ private InfoJob toEiJob(ConsumerJobInfo info, String id, String typeId) {
+ return InfoJob.builder() //
.id(id) //
.typeId(typeId) //
.owner(info.owner) //
.build();
}
- private EiJob toEiJob(ConsumerJobInfo info, String id, EiType type) {
- return toEiJob(info, id, type.getId());
- }
-
- private ConsumerInfoTypeInfo toInfoTypeInfo(EiType type) {
+ private ConsumerInfoTypeInfo toInfoTypeInfo(InfoType type) {
return new ConsumerInfoTypeInfo(type.getJobDataSchema());
}
- private ConsumerJobInfo toInfoJobInfo(EiJob s) {
+ private ConsumerJobInfo toInfoJobInfo(InfoJob s) {
return new ConsumerJobInfo(s.getTypeId(), s.getJobData(), s.getOwner(), s.getTargetUrl(), s.getJobStatusUrl());
}
}
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "InformationType", description = "Information for an Information type")
+@Schema(name = "consumer_information_type", description = "Information for an Information type")
public class ConsumerInfoTypeInfo {
- @Schema(name = "consumer_job_data_schema", description = "Json schema for the job data", required = true)
- @SerializedName("consumer_job_data_schema")
- @JsonProperty(value = "consumer_job_data_schema", required = true)
+ @Schema(name = "job_data_schema", description = "Json schema for the job data", required = true)
+ @SerializedName("job_data_schema")
+ @JsonProperty(value = "job_data_schema", required = true)
public Object jobDataSchema;
public ConsumerInfoTypeInfo(Object jobDataSchema) {
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "Job", description = "Information for an Enrichment Information Job")
+@Schema(name = "consumer_job", description = "Information for an Enrichment Information Job")
public class ConsumerJobInfo {
- @Schema(name = "infoTypeId", description = "Information type Idenitifier of the subscription job", required = true)
- @SerializedName("infoTypeId")
- @JsonProperty(value = "infoTypeId", required = true)
- public String infoTypeId;
+ @Schema(
+ name = "info_type_id",
+ description = "Information type Idenitifier of the subscription job",
+ required = true)
+ @SerializedName("info_type_id")
+ @JsonProperty(value = "info_type_id", required = true)
+ public String infoTypeId = "";
- @Schema(name = "jobOwner", description = "Identity of the owner of the job", required = true)
- @SerializedName("jobOwner")
- @JsonProperty(value = "jobOwner", required = true)
- public String owner;
+ @Schema(name = "job_owner", description = "Identity of the owner of the job", required = true)
+ @SerializedName("job_owner")
+ @JsonProperty(value = "job_owner", required = true)
+ public String owner = "";
- @Schema(name = "jobDefinition", description = "Information type specific job data", required = true)
- @SerializedName("jobDefinition")
- @JsonProperty(value = "jobDefinition", required = true)
+ @Schema(name = "job_definition", description = "Information type specific job data", required = true)
+ @SerializedName("job_definition")
+ @JsonProperty(value = "job_definition", required = true)
public Object jobDefinition;
- @Schema(name = "jobResultUri", description = "The target URI of the subscribed information", required = true)
- @SerializedName("jobResultUri")
- @JsonProperty(value = "jobResultUri", required = true)
- public String jobResultUri;
+ @Schema(name = "job_result_uri", description = "The target URI of the subscribed information", required = true)
+ @SerializedName("job_result_uri")
+ @JsonProperty(value = "job_result_uri", required = true)
+ public String jobResultUri = "";
@Schema(
- name = "statusNotificationUri",
+ name = "status_notification_uri",
description = "The target of Information subscription job status notifications",
required = false)
- @SerializedName("jobStatusNotificationUri")
- @JsonProperty(value = "jobStatusNotificationUri", required = false)
- public String statusNotificationUri;
+ @SerializedName("status_notification_uri")
+ @JsonProperty(value = "status_notification_uri", required = false)
+ public String statusNotificationUri = "";
public ConsumerJobInfo() {
}
- public ConsumerJobInfo(String eiTypeId, Object jobData, String owner, String targetUri,
+ public ConsumerJobInfo(String infoTypeId, Object jobData, String owner, String targetUri,
String statusNotificationUri) {
- this.infoTypeId = eiTypeId;
+ this.infoTypeId = infoTypeId;
this.jobDefinition = jobData;
this.owner = owner;
this.jobResultUri = targetUri;
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "JobStatus", description = "Status for an EI job")
+@Schema(name = "consumer_job_status", description = "Status for an Information Job")
public class ConsumerJobStatus {
@Gson.TypeAdapters
- @Schema(name = "JobStatusValues", description = "Allowed values for EI job status")
+ @Schema(name = "info_job_status_values", description = "Allowed values for Information Job status")
public enum InfoJobStatusValues {
ENABLED, DISABLED
}
private static final String OPERATIONAL_STATE_DESCRIPTION = "values:\n" //
- + "ENABLED: the A1-EI producer is able to deliver EI result for the EI job\n" //
- + "DISABLED: the A1-EI producer is unable to deliver EI result for the EI job";
+ + "ENABLED: the A1-Information producer is able to deliver result for the Information Job\n" //
+ + "DISABLED: the A1-Information producer is unable to deliver result for the Information Job";
- @Schema(name = "eiJobStatus", description = OPERATIONAL_STATE_DESCRIPTION, required = true)
- @SerializedName("eiJobStatus")
- @JsonProperty(value = "eiJobStatus", required = true)
+ @Schema(name = "info_job_status", description = OPERATIONAL_STATE_DESCRIPTION, required = true)
+ @SerializedName("info_job_status")
+ @JsonProperty(value = "info_job_status", required = true)
public InfoJobStatusValues state;
public ConsumerJobStatus() {
import org.oransc.enrichment.clients.AsyncRestClient;
import org.oransc.enrichment.clients.AsyncRestClientFactory;
import org.oransc.enrichment.configuration.ApplicationConfig;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
-import org.oransc.enrichment.repository.EiProducers;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducer;
+import org.oransc.enrichment.repository.InfoProducers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.util.retry.Retry;
/**
- * Callbacks to the EiProducer
+ * Callbacks to the Producer
*/
@SuppressWarnings("java:S3457") // No need to call "toString()" method as formatting and string ..
public class ProducerCallbacks {
this.restClient = restClientFactory.createRestClientNoHttpProxy("");
}
- public Mono<String> healthCheck(EiProducer producer) {
+ public Mono<String> healthCheck(InfoProducer producer) {
return restClient.get(producer.getProducerSupervisionCallbackUrl());
}
- public void stopEiJob(EiJob eiJob, EiProducers eiProducers) {
- for (EiProducer producer : getProducersForJob(eiJob, eiProducers)) {
- String url = producer.getJobCallbackUrl() + "/" + eiJob.getId();
- producer.setJobDisabled(eiJob);
+ public void stopInfoJob(InfoJob infoJob, InfoProducers infoProducers) {
+ for (InfoProducer producer : getProducersForJob(infoJob, infoProducers)) {
+ String url = producer.getJobCallbackUrl() + "/" + infoJob.getId();
+ producer.setJobDisabled(infoJob);
restClient.delete(url) //
.subscribe(response -> logger.debug("Producer job deleted OK {}", producer.getId()), //
throwable -> logger.warn("Producer job delete failed {} {}", producer.getId(),
/**
* Start a job in all producers that suports the job type
*
- * @param eiJob an EI job
+ * @param infoJob an Information Job
* @return the number of producers that returned OK
*/
- public Mono<Integer> startInfoSubscriptionJob(EiJob eiJob, EiProducers eiProducers) {
+ public Mono<Integer> startInfoSubscriptionJob(InfoJob infoJob, InfoProducers infoProducers) {
Retry retrySpec = Retry.fixedDelay(1, Duration.ofSeconds(1));
- return Flux.fromIterable(getProducersForJob(eiJob, eiProducers)) //
- .flatMap(eiProducer -> startEiJob(eiProducer, eiJob, retrySpec)) //
+ return Flux.fromIterable(getProducersForJob(infoJob, infoProducers)) //
+ .flatMap(infoProducer -> startInfoJob(infoProducer, infoJob, retrySpec)) //
.collectList() //
.flatMap(okResponses -> Mono.just(Integer.valueOf(okResponses.size()))); //
}
* Start all jobs for one producer
*
* @param producer
- * @param eiJobs
+ * @param infoJobs
*/
- public Flux<String> startEiJobs(EiProducer producer, EiJobs eiJobs) {
+ public Flux<String> startInfoJobs(InfoProducer producer, InfoJobs infoJobs) {
final int maxNoOfParalellRequests = 10;
Retry retrySpec = Retry.backoff(3, Duration.ofSeconds(1));
- return Flux.fromIterable(producer.getEiTypes()) //
- .flatMap(type -> Flux.fromIterable(eiJobs.getJobsForType(type))) //
- .flatMap(job -> startEiJob(producer, job, retrySpec), maxNoOfParalellRequests);
+ return Flux.fromIterable(producer.getInfoTypes()) //
+ .flatMap(type -> Flux.fromIterable(infoJobs.getJobsForType(type))) //
+ .flatMap(job -> startInfoJob(producer, job, retrySpec), maxNoOfParalellRequests);
}
- public Mono<String> startEiJob(EiProducer producer, EiJob eiJob, Retry retrySpec) {
- ProducerJobInfo request = new ProducerJobInfo(eiJob);
+ public Mono<String> startInfoJob(InfoProducer producer, InfoJob infoJob, Retry retrySpec) {
+ ProducerJobInfo request = new ProducerJobInfo(infoJob);
String body = gson.toJson(request);
return restClient.post(producer.getJobCallbackUrl(), body) //
.retryWhen(retrySpec) //
- .doOnNext(resp -> logger.debug("Job subscription {} started OK {}", eiJob.getId(), producer.getId())) //
+ .doOnNext(resp -> logger.debug("Job subscription {} started OK {}", infoJob.getId(), producer.getId())) //
.onErrorResume(throwable -> {
- producer.setJobDisabled(eiJob);
+ producer.setJobDisabled(infoJob);
logger.warn("Job subscription failed {}", producer.getId(), throwable.toString());
return Mono.empty();
}) //
- .doOnNext(resp -> producer.setJobEnabled(eiJob));
+ .doOnNext(resp -> producer.setJobEnabled(infoJob));
}
- private Collection<EiProducer> getProducersForJob(EiJob eiJob, EiProducers eiProducers) {
- return eiProducers.getProducersForType(eiJob.getTypeId());
+ private Collection<InfoProducer> getProducersForJob(InfoJob infoJob, InfoProducers infoProducers) {
+ return infoProducers.getProducersForType(infoJob.getTypeId());
}
}
public class ProducerConsts {
public static final String PRODUCER_API_NAME = "Data producer (registration)";
- public static final String API_ROOT = "/ei-producer/v1";
+ public static final String API_ROOT = "/data-producer/v1";
public static final String PRODUCER_API_DESCRIPTION = "API for data producers";
public static final String PRODUCER_API_CALLBACKS_NAME = "Data producer (callbacks)";
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.oransc.enrichment.controllers.ErrorResponse;
import org.oransc.enrichment.controllers.VoidResponse;
import org.oransc.enrichment.exceptions.ServiceException;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiType;
-import org.oransc.enrichment.repository.EiTypes;
-import org.oransc.enrichment.repository.ImmutableEiProducerRegistrationInfo;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducer;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
private static Gson gson = new GsonBuilder().create();
@Autowired
- private EiJobs eiJobs;
+ private InfoJobs infoJobs;
@Autowired
- private EiTypes eiTypes;
+ private InfoTypes infoTypes;
@Autowired
- private EiProducers eiProducers;
+ private InfoProducers infoProducers;
- @GetMapping(path = ProducerConsts.API_ROOT + "/eitypes", produces = MediaType.APPLICATION_JSON_VALUE) //
- @Operation(summary = "EI type identifiers", description = "") //
+ @GetMapping(path = ProducerConsts.API_ROOT + "/info-types", produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Info Type identifiers", description = "") //
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "200",
- description = "EI type identifiers", //
+ description = "Info Type identifiers", //
content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) //
})
- public ResponseEntity<Object> getEiTypeIdentifiers( //
+ public ResponseEntity<Object> getInfoTypdentifiers( //
) {
List<String> result = new ArrayList<>();
- for (EiType eiType : this.eiTypes.getAllInfoTypes()) {
- result.add(eiType.getId());
+ for (InfoType infoType : this.infoTypes.getAllInfoTypes()) {
+ result.add(infoType.getId());
}
return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
}
- @GetMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Individual EI type", description = "")
+ @GetMapping(
+ path = ProducerConsts.API_ROOT + "/info-types/{infoTypeId}",
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(summary = "Individual Information Type", description = "")
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "200",
- description = "EI type", //
- content = @Content(schema = @Schema(implementation = ProducerEiTypeInfo.class))), //
+ description = "Info Type", //
+ content = @Content(schema = @Schema(implementation = ProducerInfoTypeInfo.class))), //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information type is not found", //
+ description = "Information type is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
- public ResponseEntity<Object> getEiType( //
- @PathVariable("eiTypeId") String eiTypeId) {
+ public ResponseEntity<Object> getInfoType( //
+ @PathVariable("infoTypeId") String infoTypeId) {
try {
- EiType t = this.eiTypes.getType(eiTypeId);
- ProducerEiTypeInfo info = toEiTypeInfo(t);
+ InfoType t = this.infoTypes.getType(infoTypeId);
+ ProducerInfoTypeInfo info = toInfoTypeInfo(t);
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
- @PutMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ @PutMapping(
+ path = ProducerConsts.API_ROOT + "/info-types/{infoTypeId}",
+ produces = MediaType.APPLICATION_JSON_VALUE)
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "400",
description = "Bad request", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))})
- @Operation(summary = "Individual EI type", description = "")
- public ResponseEntity<Object> putEiType( //
- @PathVariable("eiTypeId") String eiTypeId, //
- @RequestBody ProducerEiTypeInfo registrationInfo) {
+ @Operation(summary = "Individual Information Type", description = "")
+ public ResponseEntity<Object> putInfoType( //
+ @PathVariable("infoTypeId") String infoTypeId, //
+ @RequestBody ProducerInfoTypeInfo registrationInfo) {
- EiType previousDefinition = this.eiTypes.get(eiTypeId);
+ InfoType previousDefinition = this.infoTypes.get(infoTypeId);
if (registrationInfo.jobDataSchema == null) {
return ErrorResponse.create("No schema provided", HttpStatus.BAD_REQUEST);
}
- this.eiTypes.put(new EiType(eiTypeId, registrationInfo.jobDataSchema));
+ this.infoTypes.put(new InfoType(infoTypeId, registrationInfo.jobDataSchema));
return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
}
- @DeleteMapping(path = ProducerConsts.API_ROOT + "/eitypes/{eiTypeId}", produces = MediaType.APPLICATION_JSON_VALUE) //
- @Operation(summary = "Individual EI type", description = "") //
+ @DeleteMapping(
+ path = ProducerConsts.API_ROOT + "/info-types/{infoTypeId}",
+ produces = MediaType.APPLICATION_JSON_VALUE) //
+ @Operation(summary = "Individual Information Type", description = "") //
@ApiResponses(
value = { //
@ApiResponse(
content = @Content(schema = @Schema(implementation = VoidResponse.class))), //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information type is not found", //
+ description = "Information type is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
@ApiResponse(
responseCode = "406",
- description = "The Enrichment Information type has one or several active producers", //
+ description = "The Information type has one or several active producers", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
- public ResponseEntity<Object> deleteEiType( //
- @PathVariable("eiTypeId") String eiTypeId) {
+ public ResponseEntity<Object> deleteInfoType( //
+ @PathVariable("infoTypeId") String infoTypeId) {
- EiType type = this.eiTypes.get(eiTypeId);
+ InfoType type = this.infoTypes.get(infoTypeId);
if (type == null) {
return ErrorResponse.create("Information type not found", HttpStatus.NOT_FOUND);
}
- if (!this.eiProducers.getProducersForType(type).isEmpty()) {
- String firstProducerId = this.eiProducers.getProducersForType(type).iterator().next().getId();
+ if (!this.infoProducers.getProducersForType(type).isEmpty()) {
+ String firstProducerId = this.infoProducers.getProducersForType(type).iterator().next().getId();
return ErrorResponse.create("The type has active producers: " + firstProducerId, HttpStatus.NOT_ACCEPTABLE);
}
- this.eiTypes.remove(type);
+ this.infoTypes.remove(type);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
- @GetMapping(path = ProducerConsts.API_ROOT + "/eiproducers", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "EI producer identifiers", description = "")
+ @GetMapping(path = ProducerConsts.API_ROOT + "/info-producers", produces = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(summary = "Information producer identifiers", description = "")
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "200",
- description = "EI producer identifiers", //
+ description = "Information producer identifiers", //
content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) //
})
- public ResponseEntity<Object> getEiProducerIdentifiers( //
+ public ResponseEntity<Object> getInfoProducerIdentifiers( //
@Parameter(
- name = "ei_type_id",
+ name = "info_type_id",
required = false,
description = "If given, only the producers for the EI Data type is returned.") //
- @RequestParam(name = "ei_type_id", required = false) String typeId //
+ @RequestParam(name = "info_type_id", required = false) String typeId //
) {
List<String> result = new ArrayList<>();
- for (EiProducer eiProducer : typeId == null ? this.eiProducers.getAllProducers()
- : this.eiProducers.getProducersForType(typeId)) {
- result.add(eiProducer.getId());
+ for (InfoProducer infoProducer : typeId == null ? this.infoProducers.getAllProducers()
+ : this.infoProducers.getProducersForType(typeId)) {
+ result.add(infoProducer.getId());
}
return new ResponseEntity<>(gson.toJson(result), HttpStatus.OK);
}
@GetMapping(
- path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
+ path = ProducerConsts.API_ROOT + "/info-producers/{infoProducerId}",
produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Individual EI producer", description = "")
+ @Operation(summary = "Individual Information Producer", description = "")
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "200",
- description = "EI producer", //
+ description = "Information producer", //
content = @Content(schema = @Schema(implementation = ProducerRegistrationInfo.class))), //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information producer is not found", //
+ description = "Information producer is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class)))//
})
- public ResponseEntity<Object> getEiProducer( //
- @PathVariable("eiProducerId") String eiProducerId) {
+ public ResponseEntity<Object> getInfoProducer( //
+ @PathVariable("infoProducerId") String infoProducerId) {
try {
- EiProducer p = this.eiProducers.getProducer(eiProducerId);
- ProducerRegistrationInfo info = toEiProducerRegistrationInfo(p);
+ InfoProducer p = this.infoProducers.getProducer(infoProducerId);
+ ProducerRegistrationInfo info = toProducerRegistrationInfo(p);
return new ResponseEntity<>(gson.toJson(info), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
@GetMapping(
- path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}/eijobs",
+ path = ProducerConsts.API_ROOT + "/info-producers/{infoProducerId}/info-jobs",
produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "EI job definitions", description = "EI job definitions for one EI producer")
+ @Operation(
+ summary = "Information Job definitions",
+ description = "Information Job definitions for one Information Producer")
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information producer is not found", //
+ description = "Information producer is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))), //
@ApiResponse(
responseCode = "200",
- description = "EI producer", //
+ description = "Information producer", //
content = @Content(array = @ArraySchema(schema = @Schema(implementation = ProducerJobInfo.class)))), //
})
- public ResponseEntity<Object> getEiProducerJobs( //
- @PathVariable("eiProducerId") String eiProducerId) {
+ public ResponseEntity<Object> getInfoProducerJobs( //
+ @PathVariable("infoProducerId") String infoProducerId) {
try {
- EiProducer producer = this.eiProducers.getProducer(eiProducerId);
+ InfoProducer producer = this.infoProducers.getProducer(infoProducerId);
Collection<ProducerJobInfo> producerJobs = new ArrayList<>();
- for (EiType type : producer.getEiTypes()) {
- for (EiJob eiJob : this.eiJobs.getJobsForType(type)) {
- ProducerJobInfo request = new ProducerJobInfo(eiJob);
+ for (InfoType type : producer.getInfoTypes()) {
+ for (InfoJob infoJob : this.infoJobs.getJobsForType(type)) {
+ ProducerJobInfo request = new ProducerJobInfo(infoJob);
producerJobs.add(request);
}
}
}
@GetMapping(
- path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}/status",
+ path = ProducerConsts.API_ROOT + "/info-producers/{infoProducerId}/status",
produces = MediaType.APPLICATION_JSON_VALUE) //
- @Operation(summary = "EI producer status") //
+ @Operation(summary = "Information producer status") //
@ApiResponses(
value = { //
@ApiResponse(
responseCode = "200",
- description = "EI producer status", //
+ description = "Information producer status", //
content = @Content(schema = @Schema(implementation = ProducerStatusInfo.class))), //
@ApiResponse(
responseCode = "404",
- description = "Enrichment Information producer is not found", //
+ description = "Information producer is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
- public ResponseEntity<Object> getEiProducerStatus( //
- @PathVariable("eiProducerId") String eiProducerId) {
+ public ResponseEntity<Object> getInfoProducerStatus( //
+ @PathVariable("infoProducerId") String infoProducerId) {
try {
- EiProducer producer = this.eiProducers.getProducer(eiProducerId);
+ InfoProducer producer = this.infoProducers.getProducer(infoProducerId);
return new ResponseEntity<>(gson.toJson(producerStatusInfo(producer)), HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
- private ProducerStatusInfo producerStatusInfo(EiProducer producer) {
+ private ProducerStatusInfo producerStatusInfo(InfoProducer producer) {
ProducerStatusInfo.OperationalState opState =
producer.isAvailable() ? ProducerStatusInfo.OperationalState.ENABLED
: ProducerStatusInfo.OperationalState.DISABLED;
}
@PutMapping(
- path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}", //
+ path = ProducerConsts.API_ROOT + "/info-producers/{infoProducerId}", //
produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Individual EI producer", description = "")
+ @Operation(summary = "Individual Information Producer", description = "")
@ApiResponses(
value = { //
@ApiResponse(
description = "Producer not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
- public ResponseEntity<Object> putEiProducer( //
- @PathVariable("eiProducerId") String eiProducerId, //
+ public ResponseEntity<Object> putInfoProducer( //
+ @PathVariable("infoProducerId") String infoProducerId, //
@RequestBody ProducerRegistrationInfo registrationInfo) {
try {
- EiProducer previousDefinition = this.eiProducers.get(eiProducerId);
- this.eiProducers.registerProducer(toEiProducerRegistrationInfo(eiProducerId, registrationInfo));
+ validateUri(registrationInfo.jobCallbackUrl);
+ validateUri(registrationInfo.producerSupervisionCallbackUrl);
+ InfoProducer previousDefinition = this.infoProducers.get(infoProducerId);
+ this.infoProducers.registerProducer(toProducerRegistrationInfo(infoProducerId, registrationInfo));
return new ResponseEntity<>(previousDefinition == null ? HttpStatus.CREATED : HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
+ private void validateUri(String url) throws URISyntaxException, ServiceException {
+ if (url != null && !url.isEmpty()) {
+ URI uri = new URI(url);
+ if (!uri.isAbsolute()) {
+ throw new ServiceException("URI: " + url + " is not absolute", HttpStatus.CONFLICT);
+ }
+ } else {
+ throw new ServiceException("Missing required URL", HttpStatus.CONFLICT);
+ }
+ }
+
@DeleteMapping(
- path = ProducerConsts.API_ROOT + "/eiproducers/{eiProducerId}",
+ path = ProducerConsts.API_ROOT + "/info-producers/{infoProducerId}",
produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Individual EI producer", description = "")
+ @Operation(summary = "Individual Information Producer", description = "")
@ApiResponses(
value = { //
@ApiResponse(
description = "Producer is not found", //
content = @Content(schema = @Schema(implementation = ErrorResponse.ErrorInfo.class))) //
})
- public ResponseEntity<Object> deleteEiProducer(@PathVariable("eiProducerId") String eiProducerId) {
+ public ResponseEntity<Object> deleteInfoProducer(@PathVariable("infoProducerId") String infoProducerId) {
try {
- final EiProducer producer = this.eiProducers.getProducer(eiProducerId);
- this.eiProducers.deregisterProducer(producer);
+ final InfoProducer producer = this.infoProducers.getProducer(infoProducerId);
+ this.infoProducers.deregisterProducer(producer);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
}
- private ProducerRegistrationInfo toEiProducerRegistrationInfo(EiProducer p) {
+ private ProducerRegistrationInfo toProducerRegistrationInfo(InfoProducer p) {
Collection<String> types = new ArrayList<>();
- for (EiType type : p.getEiTypes()) {
+ for (InfoType type : p.getInfoTypes()) {
types.add(type.getId());
}
return new ProducerRegistrationInfo(types, p.getJobCallbackUrl(), p.getProducerSupervisionCallbackUrl());
}
- private ProducerEiTypeInfo toEiTypeInfo(EiType t) {
- return new ProducerEiTypeInfo(t.getJobDataSchema());
+ private ProducerInfoTypeInfo toInfoTypeInfo(InfoType t) {
+ return new ProducerInfoTypeInfo(t.getJobDataSchema());
}
- private EiProducers.EiProducerRegistrationInfo toEiProducerRegistrationInfo(String eiProducerId,
+ private InfoProducers.InfoProducerRegistrationInfo toProducerRegistrationInfo(String infoProducerId,
ProducerRegistrationInfo info) throws ServiceException {
- Collection<EiType> supportedTypes = new ArrayList<>();
+ Collection<InfoType> supportedTypes = new ArrayList<>();
for (String typeId : info.supportedTypeIds) {
- EiType type = this.eiTypes.getType(typeId);
+ InfoType type = this.infoTypes.getType(typeId);
supportedTypes.add(type);
}
- return ImmutableEiProducerRegistrationInfo.builder() //
- .id(eiProducerId) //
+ return InfoProducers.InfoProducerRegistrationInfo.builder() //
+ .id(infoProducerId) //
.jobCallbackUrl(info.jobCallbackUrl) //
.producerSupervisionCallbackUrl(info.producerSupervisionCallbackUrl) //
.supportedTypes(supportedTypes) //
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "producer_ei_type_info", description = "Information for an EI type")
-public class ProducerEiTypeInfo {
+@Schema(name = "producer_info_type_info", description = "Information for an Information Type")
+public class ProducerInfoTypeInfo {
- @Schema(name = "ei_job_data_schema", description = "Json schema for the job data", required = true)
- @SerializedName("ei_job_data_schema")
- @JsonProperty(value = "ei_job_data_schema", required = true)
+ @Schema(name = "info_job_data_schema", description = "Json schema for the job data", required = true)
+ @SerializedName("info_job_data_schema")
+ @JsonProperty(value = "info_job_data_schema", required = true)
public Object jobDataSchema;
- public ProducerEiTypeInfo(Object jobDataSchema) {
+ public ProducerInfoTypeInfo(Object jobDataSchema) {
this.jobDataSchema = jobDataSchema;
}
- public ProducerEiTypeInfo() {
+ public ProducerInfoTypeInfo() {
}
}
import io.swagger.v3.oas.annotations.media.Schema;
import org.immutables.gson.Gson;
-import org.oransc.enrichment.repository.EiJob;
+import org.oransc.enrichment.repository.InfoJob;
@Gson.TypeAdapters
@Schema(
- name = "producer_ei_job_request",
- description = "The body of the EI producer callbacks for EI job creation and deletion")
+ name = "producer_info_job_request",
+ description = "The body of the Information Producer callbacks for Information Job creation and deletion")
public class ProducerJobInfo {
- @Schema(name = "ei_job_identity", description = "Idenitity of the EI job", required = true)
- @SerializedName("ei_job_identity")
- @JsonProperty("ei_job_identity")
- public String id;
+ @Schema(name = "info_job_identity", description = "Identity of the Information Job", required = true)
+ @SerializedName("info_job_identity")
+ @JsonProperty("info_job_identity")
+ public String id = "";
- @Schema(name = "ei_type_identity", description = "Type idenitity for the job")
- @SerializedName("ei_type_identity")
- @JsonProperty("ei_type_identity")
- public String typeId;
+ @Schema(name = "info_type_identity", description = "Type identity for the job")
+ @SerializedName("info_type_identity")
+ @JsonProperty("info_type_identity")
+ public String typeId = "";
- @Schema(name = "ei_job_data", description = "Json for the job data")
- @SerializedName("ei_job_data")
- @JsonProperty("ei_job_data")
+ @Schema(name = "info_job_data", description = "Json for the job data")
+ @SerializedName("info_job_data")
+ @JsonProperty("info_job_data")
public Object jobData;
- @Schema(name = "target_uri", description = "URI for the target of the EI")
+ @Schema(name = "target_uri", description = "URI for the target of the produced Information")
@SerializedName("target_uri")
@JsonProperty("target_uri")
- public String targetUri;
+ public String targetUri = "";
@Schema(name = "owner", description = "The owner of the job")
@SerializedName("owner")
@JsonProperty("owner")
- public String owner;
+ public String owner = "";
@Schema(name = "last_updated", description = "The time when the job was last updated or created (ISO-8601)")
@SerializedName("last_updated")
@JsonProperty("last_updated")
- public String lastUpdated;
+ public String lastUpdated = "";
public ProducerJobInfo(Object jobData, String id, String typeId, String targetUri, String owner,
String lastUpdated) {
this.lastUpdated = lastUpdated;
}
- public ProducerJobInfo(EiJob job) {
+ public ProducerJobInfo(InfoJob job) {
this(job.getJobData(), job.getId(), job.getTypeId(), job.getTargetUrl(), job.getOwner(), job.getLastUpdated());
}
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "producer_registration_info", description = "Information for an EI producer")
+@Schema(name = "producer_registration_info", description = "Information for an Information Producer")
public class ProducerRegistrationInfo {
- @Schema(name = "supported_ei_types", description = "Supported EI type IDs", required = true)
- @SerializedName("supported_ei_types")
- @JsonProperty(value = "supported_ei_types", required = true)
+ @Schema(name = "supported_info_types", description = "Supported Information Type IDs", required = true)
+ @SerializedName("supported_info_types")
+ @JsonProperty(value = "supported_info_types", required = true)
public Collection<String> supportedTypeIds;
- @Schema(name = "ei_job_callback_url", description = "callback for EI job", required = true)
- @SerializedName("ei_job_callback_url")
- @JsonProperty(value = "ei_job_callback_url", required = true)
- public String jobCallbackUrl;
+ @Schema(name = "info_job_callback_url", description = "callback for Information Job", required = true)
+ @SerializedName("info_job_callback_url")
+ @JsonProperty(value = "info_job_callback_url", required = true)
+ public String jobCallbackUrl = "";
@Schema(
- name = "ei_producer_supervision_callback_url",
+ name = "info_producer_supervision_callback_url",
description = "callback for producer supervision",
required = true)
- @SerializedName("ei_producer_supervision_callback_url")
- @JsonProperty(value = "ei_producer_supervision_callback_url", required = true)
- public String producerSupervisionCallbackUrl;
+ @SerializedName("info_producer_supervision_callback_url")
+ @JsonProperty(value = "info_producer_supervision_callback_url", required = true)
+ public String producerSupervisionCallbackUrl = "";
public ProducerRegistrationInfo(Collection<String> types, String jobCallbackUrl,
String producerSupervisionCallbackUrl) {
import org.immutables.gson.Gson;
@Gson.TypeAdapters
-@Schema(name = "producer_status", description = "Status for an EI Producer")
+@Schema(name = "producer_status", description = "Status for an Info Producer")
public class ProducerStatusInfo {
@Gson.TypeAdapters
import org.slf4j.LoggerFactory;
/**
- * Represents the dynamic information about a EI job
+ * Represents the dynamic information about a information job
*/
@Builder
-public class EiJob {
+public class InfoJob {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Getter
import org.springframework.util.FileSystemUtils;
/**
- * Dynamic representation of all existing EI jobs.
+ * Dynamic representation of all existing Information Jobs.
*/
-public class EiJobs {
- private Map<String, EiJob> allEiJobs = new HashMap<>();
+public class InfoJobs {
+ private Map<String, InfoJob> allEiJobs = new HashMap<>();
- private MultiMap<EiJob> jobsByType = new MultiMap<>();
- private MultiMap<EiJob> jobsByOwner = new MultiMap<>();
+ private MultiMap<InfoJob> jobsByType = new MultiMap<>();
+ private MultiMap<InfoJob> jobsByOwner = new MultiMap<>();
private final Gson gson;
private final ApplicationConfig config;
private final ProducerCallbacks producerCallbacks;
- public EiJobs(ApplicationConfig config, ProducerCallbacks producerCallbacks) {
+ public InfoJobs(ApplicationConfig config, ProducerCallbacks producerCallbacks) {
this.config = config;
GsonBuilder gsonBuilder = new GsonBuilder();
ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
for (File file : dbDir.listFiles()) {
String json = Files.readString(file.toPath());
- EiJob job = gson.fromJson(json, EiJob.class);
+ InfoJob job = gson.fromJson(json, InfoJob.class);
this.doPut(job);
}
}
- public synchronized void put(EiJob job) {
+ public synchronized void put(InfoJob job) {
this.doPut(job);
storeJobInFile(job);
}
- public synchronized Collection<EiJob> getJobs() {
+ public synchronized Collection<InfoJob> getJobs() {
return new Vector<>(allEiJobs.values());
}
- public synchronized EiJob getJob(String id) throws ServiceException {
- EiJob ric = allEiJobs.get(id);
+ public synchronized InfoJob getJob(String id) throws ServiceException {
+ InfoJob ric = allEiJobs.get(id);
if (ric == null) {
throw new ServiceException("Could not find Information job: " + id);
}
return ric;
}
- public synchronized Collection<EiJob> getJobsForType(String typeId) {
+ public synchronized Collection<InfoJob> getJobsForType(String typeId) {
return jobsByType.get(typeId);
}
- public synchronized Collection<EiJob> getJobsForType(EiType type) {
+ public synchronized Collection<InfoJob> getJobsForType(InfoType type) {
return jobsByType.get(type.getId());
}
- public synchronized Collection<EiJob> getJobsForOwner(String owner) {
+ public synchronized Collection<InfoJob> getJobsForOwner(String owner) {
return jobsByOwner.get(owner);
}
- public synchronized EiJob get(String id) {
+ public synchronized InfoJob get(String id) {
return allEiJobs.get(id);
}
- public synchronized EiJob remove(String id, EiProducers eiProducers) {
- EiJob job = allEiJobs.get(id);
+ public synchronized InfoJob remove(String id, InfoProducers infoProducers) {
+ InfoJob job = allEiJobs.get(id);
if (job != null) {
- remove(job, eiProducers);
+ remove(job, infoProducers);
}
return job;
}
- public synchronized void remove(EiJob job, EiProducers eiProducers) {
+ public synchronized void remove(InfoJob job, InfoProducers infoProducers) {
this.allEiJobs.remove(job.getId());
jobsByType.remove(job.getTypeId(), job.getId());
jobsByOwner.remove(job.getOwner(), job.getId());
} catch (IOException e) {
logger.warn("Could not remove file: {}", e.getMessage());
}
- this.producerCallbacks.stopEiJob(job, eiProducers);
+ this.producerCallbacks.stopInfoJob(job, infoProducers);
}
public synchronized int size() {
}
}
- private void doPut(EiJob job) {
+ private void doPut(InfoJob job) {
allEiJobs.put(job.getId(), job);
jobsByType.put(job.getTypeId(), job.getId(), job);
jobsByOwner.put(job.getOwner(), job.getId(), job);
}
- private void storeJobInFile(EiJob job) {
+ private void storeJobInFile(InfoJob job) {
try {
try (PrintStream out = new PrintStream(new FileOutputStream(getFile(job)))) {
out.print(gson.toJson(job));
}
}
- private File getFile(EiJob job) {
+ private File getFile(InfoJob job) {
return getPath(job).toFile();
}
- private Path getPath(EiJob job) {
+ private Path getPath(InfoJob job) {
return Path.of(getDatabaseDirectory(), job.getId());
}
import lombok.Getter;
-public class EiProducer {
+public class InfoProducer {
@Getter
private final String id;
@Getter
- private final Collection<EiType> eiTypes;
+ private final Collection<InfoType> infoTypes;
@Getter
private final String jobCallbackUrl;
private int unresponsiveCounter = 0;
- public EiProducer(String id, Collection<EiType> eiTypes, String jobCallbackUrl,
+ public InfoProducer(String id, Collection<InfoType> infoTypes, String jobCallbackUrl,
String producerSupervisionCallbackUrl) {
this.id = id;
- this.eiTypes = eiTypes;
+ this.infoTypes = infoTypes;
this.jobCallbackUrl = jobCallbackUrl;
this.producerSupervisionCallbackUrl = producerSupervisionCallbackUrl;
}
return this.unresponsiveCounter == 0;
}
- public synchronized void setJobEnabled(EiJob job) {
+ public synchronized void setJobEnabled(InfoJob job) {
this.enabledJobs.add(job.getId());
}
- public synchronized void setJobDisabled(EiJob job) {
+ public synchronized void setJobDisabled(InfoJob job) {
this.enabledJobs.remove(job.getId());
}
/**
* Is the job enabled for this producer?
*/
- public synchronized boolean isJobEnabled(EiJob job) {
+ public synchronized boolean isJobEnabled(InfoJob job) {
return this.enabledJobs.contains(job.getId());
}
import java.util.Map;
import java.util.Vector;
-import org.immutables.value.Value.Immutable;
+import lombok.Builder;
+import lombok.Getter;
+
import org.oransc.enrichment.controllers.a1e.A1eCallbacks;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
import org.oransc.enrichment.exceptions.ServiceException;
*/
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
@Component
-public class EiProducers {
+public class InfoProducers {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private final Map<String, EiProducer> allEiProducers = new HashMap<>();
- private final MultiMap<EiProducer> producersByType = new MultiMap<>();
+ private final Map<String, InfoProducer> allEiProducers = new HashMap<>();
+ private final MultiMap<InfoProducer> producersByType = new MultiMap<>();
@Autowired
private ProducerCallbacks producerCallbacks;
private A1eCallbacks consumerCallbacks;
@Autowired
- private EiJobs eiJobs;
+ private InfoJobs infoJobs;
- @Immutable
- public interface EiProducerRegistrationInfo {
- String id();
+ @Builder
+ @Getter
+ public static class InfoProducerRegistrationInfo {
+ String id;
- Collection<EiType> supportedTypes();
+ Collection<InfoType> supportedTypes;
- String jobCallbackUrl();
+ String jobCallbackUrl;
- String producerSupervisionCallbackUrl();
+ String producerSupervisionCallbackUrl;
}
- public EiProducer registerProducer(EiProducerRegistrationInfo producerInfo) {
- final String producerId = producerInfo.id();
- EiProducer previousDefinition = this.get(producerId);
+ public InfoProducer registerProducer(InfoProducerRegistrationInfo producerInfo) {
+ final String producerId = producerInfo.getId();
+ InfoProducer previousDefinition = this.get(producerId);
if (previousDefinition != null) {
- for (EiType type : previousDefinition.getEiTypes()) {
+ for (InfoType type : previousDefinition.getInfoTypes()) {
producersByType.remove(type.getId(), producerId);
}
allEiProducers.remove(producerId);
}
- EiProducer producer = createProducer(producerInfo);
+ InfoProducer producer = createProducer(producerInfo);
allEiProducers.put(producer.getId(), producer);
- for (EiType type : producer.getEiTypes()) {
+ for (InfoType type : producer.getInfoTypes()) {
producersByType.put(type.getId(), producer.getId(), producer);
}
- Collection<EiType> previousTypes =
- previousDefinition != null ? previousDefinition.getEiTypes() : new ArrayList<>();
+ Collection<InfoType> previousTypes =
+ previousDefinition != null ? previousDefinition.getInfoTypes() : new ArrayList<>();
- producerCallbacks.startEiJobs(producer, this.eiJobs) //
+ producerCallbacks.startInfoJobs(producer, this.infoJobs) //
.collectList() //
- .flatMapMany(list -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
+ .flatMapMany(list -> consumerCallbacks.notifyJobStatus(producer.getInfoTypes())) //
.collectList() //
.flatMapMany(list -> consumerCallbacks.notifyJobStatus(previousTypes)) //
.subscribe();
return producer;
}
- private EiProducer createProducer(EiProducerRegistrationInfo producerInfo) {
- return new EiProducer(producerInfo.id(), producerInfo.supportedTypes(), producerInfo.jobCallbackUrl(),
- producerInfo.producerSupervisionCallbackUrl());
+ private InfoProducer createProducer(InfoProducerRegistrationInfo producerInfo) {
+ return new InfoProducer(producerInfo.getId(), producerInfo.getSupportedTypes(),
+ producerInfo.getJobCallbackUrl(), producerInfo.getProducerSupervisionCallbackUrl());
}
- public synchronized Collection<EiProducer> getAllProducers() {
+ public synchronized Collection<InfoProducer> getAllProducers() {
return new Vector<>(allEiProducers.values());
}
- public synchronized EiProducer getProducer(String id) throws ServiceException {
- EiProducer p = allEiProducers.get(id);
+ public synchronized InfoProducer getProducer(String id) throws ServiceException {
+ InfoProducer p = allEiProducers.get(id);
if (p == null) {
- throw new ServiceException("Could not find EI producer: " + id);
+ throw new ServiceException("Could not find Information Producer: " + id);
}
return p;
}
- public synchronized EiProducer get(String id) {
+ public synchronized InfoProducer get(String id) {
return allEiProducers.get(id);
}
this.producersByType.clear();
}
- public void deregisterProducer(EiProducer producer) {
+ public void deregisterProducer(InfoProducer producer) {
allEiProducers.remove(producer.getId());
- for (EiType type : producer.getEiTypes()) {
+ for (InfoType type : producer.getInfoTypes()) {
if (producersByType.remove(type.getId(), producer.getId()) == null) {
this.logger.error("Bug, no producer found");
}
}
- this.consumerCallbacks.notifyJobStatus(producer.getEiTypes()) //
+ this.consumerCallbacks.notifyJobStatus(producer.getInfoTypes()) //
.subscribe();
}
- public synchronized Collection<EiProducer> getProducersForType(EiType type) {
+ public synchronized Collection<InfoProducer> getProducersForType(InfoType type) {
return this.producersByType.get(type.getId());
}
- public synchronized Collection<EiProducer> getProducersForType(String typeId) {
+ public synchronized Collection<InfoProducer> getProducersForType(String typeId) {
return this.producersByType.get(typeId);
}
public synchronized Collection<String> getProducerIdsForType(String typeId) {
Collection<String> producerIds = new ArrayList<>();
- for (EiProducer p : this.getProducersForType(typeId)) {
+ for (InfoProducer p : this.getProducersForType(typeId)) {
producerIds.add(p.getId());
}
return producerIds;
}
- public synchronized boolean isJobEnabled(EiJob job) {
- for (EiProducer producer : this.producersByType.get(job.getTypeId())) {
+ public synchronized boolean isJobEnabled(InfoJob job) {
+ for (InfoProducer producer : this.producersByType.get(job.getTypeId())) {
if (producer.isJobEnabled(job)) {
return true;
}
import lombok.Getter;
-public class EiType {
+public class InfoType {
@Getter
private final String id;
@Getter
private final Object jobDataSchema;
- public EiType(String id, Object jobDataSchema) {
+ public InfoType(String id, Object jobDataSchema) {
this.id = id;
this.jobDataSchema = jobDataSchema;
}
import org.springframework.util.FileSystemUtils;
/**
- * Dynamic representation of all EI types in the system.
+ * Dynamic representation of all Information Types in the system.
*/
@SuppressWarnings("squid:S2629") // Invoke method(s) only conditionally
-public class EiTypes {
+public class InfoTypes {
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private final Map<String, EiType> allEiTypes = new HashMap<>();
+ private final Map<String, InfoType> allEiTypes = new HashMap<>();
private final ApplicationConfig config;
private final Gson gson;
- public EiTypes(ApplicationConfig config) {
+ public InfoTypes(ApplicationConfig config) {
this.config = config;
GsonBuilder gsonBuilder = new GsonBuilder();
ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory);
for (File file : dbDir.listFiles()) {
String json = Files.readString(file.toPath());
- EiType type = gson.fromJson(json, EiType.class);
+ InfoType type = gson.fromJson(json, InfoType.class);
allEiTypes.put(type.getId(), type);
}
}
- public synchronized void put(EiType type) {
+ public synchronized void put(InfoType type) {
allEiTypes.put(type.getId(), type);
storeInFile(type);
}
- public synchronized Collection<EiType> getAllInfoTypes() {
+ public synchronized Collection<InfoType> getAllInfoTypes() {
return new Vector<>(allEiTypes.values());
}
- public synchronized EiType getType(String id) throws ServiceException {
- EiType type = allEiTypes.get(id);
+ public synchronized InfoType getType(String id) throws ServiceException {
+ InfoType type = allEiTypes.get(id);
if (type == null) {
throw new ServiceException("Information type not found: " + id);
}
return type;
}
- public synchronized EiType get(String id) {
+ public synchronized InfoType get(String id) {
return allEiTypes.get(id);
}
- public synchronized void remove(EiType type) {
+ public synchronized void remove(InfoType type) {
allEiTypes.remove(type.getId());
try {
Files.delete(getPath(type));
}
}
- private void storeInFile(EiType type) {
+ private void storeInFile(InfoType type) {
try {
try (PrintStream out = new PrintStream(new FileOutputStream(getFile(type)))) {
out.print(gson.toJson(type));
}
}
- private File getFile(EiType type) {
+ private File getFile(InfoType type) {
return getPath(type).toFile();
}
- private Path getPath(EiType type) {
+ private Path getPath(InfoType type) {
return getPath(type.getId());
}
import org.oransc.enrichment.configuration.ApplicationConfig;
import org.oransc.enrichment.controllers.a1e.A1eCallbacks;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
-import org.oransc.enrichment.repository.EiProducers;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducer;
+import org.oransc.enrichment.repository.InfoProducers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.util.retry.Retry;
/**
- * Regularly checks the availability of the EI Producers
+ * Regularly checks the availability of the Info Producers
*/
@Component
@EnableScheduling
public class ProducerSupervision {
private static final Logger logger = LoggerFactory.getLogger(ProducerSupervision.class);
- private final EiProducers eiProducers;
- private final EiJobs eiJobs;
+ private final InfoProducers infoProducers;
+ private final InfoJobs infoJobs;
private final ProducerCallbacks producerCallbacks;
private final A1eCallbacks consumerCallbacks;
@Autowired
- public ProducerSupervision(ApplicationConfig applicationConfig, EiProducers eiProducers, EiJobs eiJobs,
+ public ProducerSupervision(ApplicationConfig applicationConfig, InfoProducers infoProducers, InfoJobs infoJobs,
ProducerCallbacks producerCallbacks, A1eCallbacks consumerCallbacks) {
- this.eiProducers = eiProducers;
- this.eiJobs = eiJobs;
+ this.infoProducers = infoProducers;
+ this.infoJobs = infoJobs;
this.producerCallbacks = producerCallbacks;
this.consumerCallbacks = consumerCallbacks;
}
createTask().subscribe(null, null, () -> logger.debug("Checking all Producers completed"));
}
- public Flux<EiProducer> createTask() {
- return Flux.fromIterable(eiProducers.getAllProducers()) //
+ public Flux<InfoProducer> createTask() {
+ return Flux.fromIterable(infoProducers.getAllProducers()) //
.flatMap(this::checkOneProducer);
}
- private Mono<EiProducer> checkOneProducer(EiProducer producer) {
+ private Mono<InfoProducer> checkOneProducer(InfoProducer producer) {
return this.producerCallbacks.healthCheck(producer) //
.onErrorResume(throwable -> {
handleNonRespondingProducer(throwable, producer);
.flatMap(responses -> Mono.just(producer));
}
- private Mono<?> checkProducerJobs(EiProducer producer) {
+ private Mono<?> checkProducerJobs(InfoProducer producer) {
final int MAX_CONCURRENCY = 10;
return getEiJobs(producer) //
- .filter(eiJob -> !producer.isJobEnabled(eiJob)) //
- .flatMap(eiJob -> producerCallbacks.startEiJob(producer, eiJob, Retry.max(1)), MAX_CONCURRENCY) //
+ .filter(infoJob -> !producer.isJobEnabled(infoJob)) //
+ .flatMap(infoJob -> producerCallbacks.startInfoJob(producer, infoJob, Retry.max(1)), MAX_CONCURRENCY) //
.collectList() //
- .flatMapMany(startedJobs -> consumerCallbacks.notifyJobStatus(producer.getEiTypes())) //
+ .flatMapMany(startedJobs -> consumerCallbacks.notifyJobStatus(producer.getInfoTypes())) //
.collectList();
}
- private Flux<EiJob> getEiJobs(EiProducer producer) {
- return Flux.fromIterable(producer.getEiTypes()) //
- .flatMap(eiType -> Flux.fromIterable(eiJobs.getJobsForType(eiType)));
+ private Flux<InfoJob> getEiJobs(InfoProducer producer) {
+ return Flux.fromIterable(producer.getInfoTypes()) //
+ .flatMap(infoType -> Flux.fromIterable(infoJobs.getJobsForType(infoType)));
}
- private void handleNonRespondingProducer(Throwable throwable, EiProducer producer) {
+ private void handleNonRespondingProducer(Throwable throwable, InfoProducer producer) {
logger.warn("Unresponsive producer: {} exception: {}", producer.getId(), throwable.getMessage());
producer.setAliveStatus(false);
if (producer.isDead()) {
- this.eiProducers.deregisterProducer(producer);
+ this.infoProducers.deregisterProducer(producer);
}
}
- private void handleRespondingProducer(String response, EiProducer producer) {
+ private void handleRespondingProducer(String response, InfoProducer producer) {
logger.debug("{}", response);
producer.setAliveStatus(true);
}
import org.oransc.enrichment.controllers.r1consumer.ConsumerJobInfo;
import org.oransc.enrichment.controllers.r1producer.ProducerCallbacks;
import org.oransc.enrichment.controllers.r1producer.ProducerConsts;
-import org.oransc.enrichment.controllers.r1producer.ProducerEiTypeInfo;
+import org.oransc.enrichment.controllers.r1producer.ProducerInfoTypeInfo;
import org.oransc.enrichment.controllers.r1producer.ProducerJobInfo;
import org.oransc.enrichment.controllers.r1producer.ProducerRegistrationInfo;
import org.oransc.enrichment.controllers.r1producer.ProducerStatusInfo;
import org.oransc.enrichment.exceptions.ServiceException;
-import org.oransc.enrichment.repository.EiJob;
-import org.oransc.enrichment.repository.EiJobs;
-import org.oransc.enrichment.repository.EiProducer;
-import org.oransc.enrichment.repository.EiProducers;
-import org.oransc.enrichment.repository.EiType;
-import org.oransc.enrichment.repository.EiTypes;
+import org.oransc.enrichment.repository.InfoJob;
+import org.oransc.enrichment.repository.InfoJobs;
+import org.oransc.enrichment.repository.InfoProducer;
+import org.oransc.enrichment.repository.InfoProducers;
+import org.oransc.enrichment.repository.InfoType;
+import org.oransc.enrichment.repository.InfoTypes;
import org.oransc.enrichment.tasks.ProducerSupervision;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
ApplicationContext context;
@Autowired
- EiJobs eiJobs;
+ InfoJobs infoJobs;
@Autowired
- EiTypes eiTypes;
+ InfoTypes infoTypes;
@Autowired
- EiProducers eiProducers;
+ InfoProducers infoProducers;
@Autowired
ApplicationConfig applicationConfig;
@BeforeEach
void reset() {
- this.eiJobs.clear();
- this.eiTypes.clear();
- this.eiProducers.clear();
+ this.infoJobs.clear();
+ this.infoTypes.clear();
+ this.infoProducers.clear();
this.producerSimulator.getTestResults().reset();
this.consumerSimulator.getTestResults().reset();
}
@Test
void a1eGetEiTypes() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, "test");
+ putInfoProducerWithOneType(PRODUCER_ID, "test");
String url = A1eConsts.API_ROOT + "/eitypes";
String rsp = restClient().get(url).block();
assertThat(rsp).isEqualTo("[\"test\"]");
}
@Test
- void consumerGetEiTypes() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, "test");
+ void consumerGetInfoTypes() throws Exception {
+ putInfoProducerWithOneType(PRODUCER_ID, "test");
String url = ConsumerConsts.API_ROOT + "/info-types";
String rsp = restClient().get(url).block();
assertThat(rsp).isEqualTo("[\"test\"]");
@Test
void a1eGetEiType() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, "test");
+ putInfoProducerWithOneType(PRODUCER_ID, "test");
String url = A1eConsts.API_ROOT + "/eitypes/test";
String rsp = restClient().get(url).block();
A1eEiTypeInfo info = gson.fromJson(rsp, A1eEiTypeInfo.class);
@Test
void consumerGetEiType() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, "test");
+ putInfoProducerWithOneType(PRODUCER_ID, "test");
String url = ConsumerConsts.API_ROOT + "/info-types/test";
String rsp = restClient().get(url).block();
ConsumerInfoTypeInfo info = gson.fromJson(rsp, ConsumerInfoTypeInfo.class);
@Test
void a1eGetEiJobsIds() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
final String JOB_ID_JSON = "[\"jobId\"]";
- String url = A1eConsts.API_ROOT + "/eijobs?eiTypeId=typeId";
+ String url = A1eConsts.API_ROOT + "/eijobs?infoTypeId=typeId";
String rsp = restClient().get(url).block();
assertThat(rsp).isEqualTo(JOB_ID_JSON);
@Test
void consumerGetInformationJobsIds() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
final String JOB_ID_JSON = "[\"jobId\"]";
String url = ConsumerConsts.API_ROOT + "/info-jobs?infoTypeId=typeId";
@Test
void a1eGetEiJob() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
String url = A1eConsts.API_ROOT + "/eijobs/jobId";
String rsp = restClient().get(url).block();
@Test
void consumerGetEiJob() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId";
String rsp = restClient().get(url).block();
@Test
void a1eGetEiJobNotFound() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = A1eConsts.API_ROOT + "/eijobs/junk";
testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "Could not find Information job: junk");
}
@Test
void consumerGetInfoJobNotFound() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = ConsumerConsts.API_ROOT + "/info-jobs/junk";
testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "Could not find Information job: junk");
}
@Test
void a1eGetEiJobStatus() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
verifyJobStatus("jobId", "ENABLED");
@Test
void consumerGetEiJobStatus() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId/status";
@Test
void a1eDeleteEiJob() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
String url = A1eConsts.API_ROOT + "/eijobs/jobId";
restClient().delete(url).block();
- assertThat(this.eiJobs.size()).isZero();
+ assertThat(this.infoJobs.size()).isZero();
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
await().untilAsserted(() -> assertThat(simulatorResults.jobsStopped.size()).isEqualTo(1));
@Test
void consumerDeleteEiJob() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId";
restClient().delete(url).block();
- assertThat(this.eiJobs.size()).isZero();
+ assertThat(this.infoJobs.size()).isZero();
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
await().untilAsserted(() -> assertThat(simulatorResults.jobsStopped.size()).isEqualTo(1));
@Test
void a1eDeleteEiJobNotFound() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = A1eConsts.API_ROOT + "/eijobs/junk";
testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "Could not find Information job: junk");
}
@Test
void consumerDeleteEiJobNotFound() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = ConsumerConsts.API_ROOT + "/info-jobs/junk";
testErrorCode(restClient().get(url), HttpStatus.NOT_FOUND, "Could not find Information job: junk");
}
@Test
void a1ePutEiJob() throws Exception {
// Test that one producer accepting a job is enough
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiProducerWithOneTypeRejecting("simulateProducerError", TYPE_ID);
String url = A1eConsts.API_ROOT + "/eijobs/jobId";
- String body = gson.toJson(eiJobInfo());
+ String body = gson.toJson(infoJobInfo());
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.CREATED);
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
resp = restClient().putForEntity(url, body).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
- EiJob job = this.eiJobs.getJob("jobId");
+ InfoJob job = this.infoJobs.getJob("jobId");
assertThat(job.getOwner()).isEqualTo("owner");
verifyJobStatus(EI_JOB_ID, "ENABLED");
@Test
void consumerPutInformationJob() throws Exception {
// Test that one producer accepting a job is enough
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId";
String body = gson.toJson(consumerJobInfo());
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.CREATED);
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
resp = restClient().putForEntity(url, body).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
- EiJob job = this.eiJobs.getJob("jobId");
+ InfoJob job = this.infoJobs.getJob("jobId");
assertThat(job.getOwner()).isEqualTo("owner");
verifyJobStatus(EI_JOB_ID, "ENABLED");
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId?typeCheck=false";
String body = gson.toJson(consumerJobInfo());
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.CREATED);
verifyJobStatus(EI_JOB_ID, "DISABLED");
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
verifyJobStatus(EI_JOB_ID, "ENABLED");
@Test
void a1ePutEiJob_jsonSchemavalidationError() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = A1eConsts.API_ROOT + "/eijobs/jobId";
// The element with name "property1" is mandatory in the schema
@Test
void consumerPutJob_jsonSchemavalidationError() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId?typeCheck=true";
// The element with name "property1" is mandatory in the schema
- ConsumerJobInfo jobInfo = new ConsumerJobInfo("typeId", jsonObject("{ \"XXstring\" : \"value\" }"), "owner",
- "targetUri", "jobStatusUrl");
+ ConsumerJobInfo jobInfo =
+ new ConsumerJobInfo("typeId", jsonObject("{ \"XXstring\" : \"value\" }"), "owner", "targetUri", null);
String body = gson.toJson(jobInfo);
testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT, "Json validation failure");
}
+ @Test
+ void consumerPutJob_uriError() throws Exception {
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
+
+ String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId?typeCheck=true";
+
+ ConsumerJobInfo jobInfo = new ConsumerJobInfo(TYPE_ID, jsonObject(), "owner", "junk", null);
+ String body = gson.toJson(jobInfo);
+
+ testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT, "URI: junk is not absolute");
+ }
+
@Test
void a1eChangingEiTypeGetRejected() throws Exception {
- putEiProducerWithOneType("producer1", "typeId1");
- putEiProducerWithOneType("producer2", "typeId2");
+ putInfoProducerWithOneType("producer1", "typeId1");
+ putInfoProducerWithOneType("producer2", "typeId2");
putEiJob("typeId1", "jobId");
String url = A1eConsts.API_ROOT + "/eijobs/jobId";
- String body = gson.toJson(eiJobInfo("typeId2", "jobId"));
+ String body = gson.toJson(infoJobInfo("typeId2", "jobId"));
testErrorCode(restClient().put(url, body), HttpStatus.CONFLICT,
"Not allowed to change type for existing EI job");
}
@Test
void consumerChangingInfoTypeGetRejected() throws Exception {
- putEiProducerWithOneType("producer1", "typeId1");
- putEiProducerWithOneType("producer2", "typeId2");
+ putInfoProducerWithOneType("producer1", "typeId1");
+ putInfoProducerWithOneType("producer2", "typeId2");
putEiJob("typeId1", "jobId");
String url = ConsumerConsts.API_ROOT + "/info-jobs/jobId";
@Test
void producerPutEiType() throws JsonMappingException, JsonProcessingException, ServiceException {
- assertThat(putEiType(TYPE_ID)).isEqualTo(HttpStatus.CREATED);
- assertThat(putEiType(TYPE_ID)).isEqualTo(HttpStatus.OK);
+ assertThat(putInfoType(TYPE_ID)).isEqualTo(HttpStatus.CREATED);
+ assertThat(putInfoType(TYPE_ID)).isEqualTo(HttpStatus.OK);
}
@Test
void producerPutEiType_noSchema() {
- String url = ProducerConsts.API_ROOT + "/eitypes/" + TYPE_ID;
+ String url = ProducerConsts.API_ROOT + "/info-types/" + TYPE_ID;
String body = "{}";
testErrorCode(restClient().put(url, body), HttpStatus.BAD_REQUEST, "No schema provided");
}
@Test
void producerDeleteEiType() throws Exception {
- putEiType(TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eitypes/" + TYPE_ID;
+ putInfoType(TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-types/" + TYPE_ID;
restClient().delete(url).block();
- assertThat(this.eiTypes.size()).isEqualTo(0);
+ assertThat(this.infoTypes.size()).isEqualTo(0);
testErrorCode(restClient().delete(url), HttpStatus.NOT_FOUND, "Information type not found");
}
@Test
void producerDeleteEiTypeExistingProducer() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eitypes/" + TYPE_ID;
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-types/" + TYPE_ID;
testErrorCode(restClient().delete(url), HttpStatus.NOT_ACCEPTABLE,
"The type has active producers: " + PRODUCER_ID);
- assertThat(this.eiTypes.size()).isEqualTo(1);
+ assertThat(this.infoTypes.size()).isEqualTo(1);
}
@Test
throws JsonMappingException, JsonProcessingException, ServiceException {
putEiProducerWithOneTypeRejecting("simulateProducerError", TYPE_ID);
String url = A1eConsts.API_ROOT + "/eijobs/" + EI_JOB_ID;
- String body = gson.toJson(eiJobInfo());
+ String body = gson.toJson(infoJobInfo());
restClient().put(url, body).block();
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
@Test
void producerGetEiProducerTypes() throws Exception {
final String EI_TYPE_ID_2 = TYPE_ID + "_2";
- putEiProducerWithOneType("producer1", TYPE_ID);
+ putInfoProducerWithOneType("producer1", TYPE_ID);
putEiJob(TYPE_ID, "jobId");
- putEiProducerWithOneType("producer2", EI_TYPE_ID_2);
+ putInfoProducerWithOneType("producer2", EI_TYPE_ID_2);
putEiJob(EI_TYPE_ID_2, "jobId2");
- String url = ProducerConsts.API_ROOT + "/eitypes";
+ String url = ProducerConsts.API_ROOT + "/info-types";
ResponseEntity<String> resp = restClient().getForEntity(url).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
@Test
void producerPutEiProducer() throws Exception {
- this.putEiType(TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
- String body = gson.toJson(producerEiRegistratioInfo(TYPE_ID));
+ this.putInfoType(TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId";
+ String body = gson.toJson(producerInfoRegistratioInfo(TYPE_ID));
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.CREATED);
- assertThat(this.eiTypes.size()).isEqualTo(1);
- assertThat(this.eiProducers.getProducersForType(TYPE_ID).size()).isEqualTo(1);
- assertThat(this.eiProducers.size()).isEqualTo(1);
- assertThat(this.eiProducers.get("eiProducerId").getEiTypes().iterator().next().getId()).isEqualTo(TYPE_ID);
+ assertThat(this.infoTypes.size()).isEqualTo(1);
+ assertThat(this.infoProducers.getProducersForType(TYPE_ID).size()).isEqualTo(1);
+ assertThat(this.infoProducers.size()).isEqualTo(1);
+ assertThat(this.infoProducers.get("infoProducerId").getInfoTypes().iterator().next().getId())
+ .isEqualTo(TYPE_ID);
resp = restClient().putForEntity(url, body).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
@Test
void producerPutEiProducerExistingJob() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId");
- String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
- String body = gson.toJson(producerEiRegistratioInfo(TYPE_ID));
+ String url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId";
+ String body = gson.toJson(producerInfoRegistratioInfo(TYPE_ID));
restClient().putForEntity(url, body).block();
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
@Test
void testPutEiProducer_noType() throws Exception {
- String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
- String body = gson.toJson(producerEiRegistratioInfo(TYPE_ID));
+ String url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId";
+ String body = gson.toJson(producerInfoRegistratioInfo(TYPE_ID));
testErrorCode(restClient().put(url, body), HttpStatus.NOT_FOUND, "Information type not found");
}
@Test
void producerPutProducerAndEiJob() throws Exception {
- this.putEiType(TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
- String body = gson.toJson(producerEiRegistratioInfo(TYPE_ID));
+ this.putInfoType(TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId";
+ String body = gson.toJson(producerInfoRegistratioInfo(TYPE_ID));
restClient().putForEntity(url, body).block();
- assertThat(this.eiTypes.size()).isEqualTo(1);
- this.eiTypes.getType(TYPE_ID);
+ assertThat(this.infoTypes.size()).isEqualTo(1);
+ this.infoTypes.getType(TYPE_ID);
url = A1eConsts.API_ROOT + "/eijobs/jobId";
- body = gson.toJson(eiJobInfo());
+ body = gson.toJson(infoJobInfo());
restClient().putForEntity(url, body).block();
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
@Test
void producerGetEiJobsForProducer() throws JsonMappingException, JsonProcessingException, ServiceException {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId1");
putEiJob(TYPE_ID, "jobId2");
// PUT a consumerRestApiTestBase.java
- String url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId";
- String body = gson.toJson(producerEiRegistratioInfo(TYPE_ID));
+ String url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId";
+ String body = gson.toJson(producerInfoRegistratioInfo(TYPE_ID));
restClient().putForEntity(url, body).block();
- url = ProducerConsts.API_ROOT + "/eiproducers/eiProducerId/eijobs";
+ url = ProducerConsts.API_ROOT + "/info-producers/infoProducerId/info-jobs";
ResponseEntity<String> resp = restClient().getForEntity(url).block();
assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK);
@Test
void producerDeleteEiProducer() throws Exception {
- putEiProducerWithOneType("eiProducerId", TYPE_ID);
- putEiProducerWithOneType("eiProducerId2", TYPE_ID);
+ putInfoProducerWithOneType("infoProducerId", TYPE_ID);
+ putInfoProducerWithOneType("infoProducerId2", TYPE_ID);
- assertThat(this.eiProducers.size()).isEqualTo(2);
- EiType type = this.eiTypes.getType(TYPE_ID);
- assertThat(this.eiProducers.getProducerIdsForType(type.getId())).contains("eiProducerId");
- assertThat(this.eiProducers.getProducerIdsForType(type.getId())).contains("eiProducerId2");
+ assertThat(this.infoProducers.size()).isEqualTo(2);
+ InfoType type = this.infoTypes.getType(TYPE_ID);
+ assertThat(this.infoProducers.getProducerIdsForType(type.getId())).contains("infoProducerId");
+ assertThat(this.infoProducers.getProducerIdsForType(type.getId())).contains("infoProducerId2");
putEiJob(TYPE_ID, "jobId");
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
- deleteEiProducer("eiProducerId");
- assertThat(this.eiProducers.size()).isEqualTo(1);
- assertThat(this.eiProducers.getProducerIdsForType(TYPE_ID)).doesNotContain("eiProducerId");
+ deleteEiProducer("infoProducerId");
+ assertThat(this.infoProducers.size()).isEqualTo(1);
+ assertThat(this.infoProducers.getProducerIdsForType(TYPE_ID)).doesNotContain("infoProducerId");
verifyJobStatus("jobId", "ENABLED");
- deleteEiProducer("eiProducerId2");
- assertThat(this.eiProducers.size()).isZero();
- assertThat(this.eiTypes.size()).isEqualTo(1);
+ deleteEiProducer("infoProducerId2");
+ assertThat(this.infoProducers.size()).isZero();
+ assertThat(this.infoTypes.size()).isEqualTo(1);
verifyJobStatus("jobId", "DISABLED");
}
ConsumerSimulatorController.TestResults consumerCalls = this.consumerSimulator.getTestResults();
ProducerSimulatorController.TestResults producerCalls = this.producerSimulator.getTestResults();
- putEiProducerWithOneType("eiProducerId", TYPE_ID);
+ putInfoProducerWithOneType("infoProducerId", TYPE_ID);
putEiJob(TYPE_ID, "jobId");
- putEiProducerWithOneType("eiProducerId2", TYPE_ID);
+ putInfoProducerWithOneType("infoProducerId2", TYPE_ID);
await().untilAsserted(() -> assertThat(producerCalls.jobsStarted.size()).isEqualTo(2));
- deleteEiProducer("eiProducerId2");
- assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains, one producer left
- deleteEiProducer("eiProducerId");
- assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains
- assertThat(this.eiJobs.size()).isEqualTo(1); // The job remains
+ deleteEiProducer("infoProducerId2");
+ assertThat(this.infoTypes.size()).isEqualTo(1); // The type remains, one producer left
+ deleteEiProducer("infoProducerId");
+ assertThat(this.infoTypes.size()).isEqualTo(1); // The type remains
+ assertThat(this.infoJobs.size()).isEqualTo(1); // The job remains
await().untilAsserted(() -> assertThat(consumerCalls.status.size()).isEqualTo(1));
assertThat(consumerCalls.status.get(0).state).isEqualTo(A1eEiJobStatus.EiJobStatusValues.DISABLED);
- putEiProducerWithOneType("eiProducerId", TYPE_ID);
+ putInfoProducerWithOneType("infoProducerId", TYPE_ID);
await().untilAsserted(() -> assertThat(consumerCalls.status.size()).isEqualTo(2));
assertThat(consumerCalls.status.get(1).state).isEqualTo(A1eEiJobStatus.EiJobStatusValues.ENABLED);
}
// Test replacing a producer with new and removed types
// Create a job
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, EI_JOB_ID);
// change the type for the producer, the job shall be disabled
- putEiProducerWithOneType(PRODUCER_ID, "junk");
+ putInfoProducerWithOneType(PRODUCER_ID, "junk");
verifyJobStatus(EI_JOB_ID, "DISABLED");
ConsumerSimulatorController.TestResults consumerCalls = this.consumerSimulator.getTestResults();
await().untilAsserted(() -> assertThat(consumerCalls.status.size()).isEqualTo(1));
assertThat(consumerCalls.status.get(0).state).isEqualTo(A1eEiJobStatus.EiJobStatusValues.DISABLED);
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
verifyJobStatus(EI_JOB_ID, "ENABLED");
await().untilAsserted(() -> assertThat(consumerCalls.status.size()).isEqualTo(2));
assertThat(consumerCalls.status.get(1).state).isEqualTo(A1eEiJobStatus.EiJobStatusValues.ENABLED);
@Test
void producerGetProducerEiType() throws JsonMappingException, JsonProcessingException, ServiceException {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eitypes/" + TYPE_ID;
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-types/" + TYPE_ID;
ResponseEntity<String> resp = restClient().getForEntity(url).block();
- ProducerEiTypeInfo info = gson.fromJson(resp.getBody(), ProducerEiTypeInfo.class);
+ ProducerInfoTypeInfo info = gson.fromJson(resp.getBody(), ProducerInfoTypeInfo.class);
assertThat(info.jobDataSchema).isNotNull();
}
@Test
void producerGetProducerIdentifiers() throws JsonMappingException, JsonProcessingException, ServiceException {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
- String url = ProducerConsts.API_ROOT + "/eiproducers";
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ String url = ProducerConsts.API_ROOT + "/info-producers";
ResponseEntity<String> resp = restClient().getForEntity(url).block();
assertThat(resp.getBody()).contains(PRODUCER_ID);
- url = ProducerConsts.API_ROOT + "/eiproducers?ei_type_id=" + TYPE_ID;
+ url = ProducerConsts.API_ROOT + "/info-producers?info_type_id=" + TYPE_ID;
resp = restClient().getForEntity(url).block();
assertThat(resp.getBody()).contains(PRODUCER_ID);
- url = ProducerConsts.API_ROOT + "/eiproducers?ei_type_id=junk";
+ url = ProducerConsts.API_ROOT + "/info-producers?info_type_id=junk";
resp = restClient().getForEntity(url).block();
assertThat(resp.getBody()).isEqualTo("[]");
}
{
// Create a job
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, EI_JOB_ID);
verifyJobStatus(EI_JOB_ID, "ENABLED");
deleteEiProducer(PRODUCER_ID);
verifyJobStatus(EI_JOB_ID, "DISABLED");
}
- assertThat(this.eiProducers.size()).isEqualTo(1);
- assertThat(this.eiTypes.size()).isEqualTo(1);
+ assertThat(this.infoProducers.size()).isEqualTo(1);
+ assertThat(this.infoTypes.size()).isEqualTo(1);
assertProducerOpState("simulateProducerError", ProducerStatusInfo.OperationalState.ENABLED);
this.producerSupervision.createTask().blockLast();
this.producerSupervision.createTask().blockLast();
// Now we have one producer that is disabled
- assertThat(this.eiProducers.size()).isEqualTo(1);
+ assertThat(this.infoProducers.size()).isEqualTo(1);
assertProducerOpState("simulateProducerError", ProducerStatusInfo.OperationalState.DISABLED);
// After 3 failed checks, the producer shall be deregisterred
this.producerSupervision.createTask().blockLast();
- assertThat(this.eiProducers.size()).isEqualTo(0); // The producer is removed
- assertThat(this.eiTypes.size()).isEqualTo(1); // The type remains
+ assertThat(this.infoProducers.size()).isEqualTo(0); // The producer is removed
+ assertThat(this.infoTypes.size()).isEqualTo(1); // The type remains
// Now we have one disabled job, and no producer.
// PUT a producer, then a Job ENABLED status notification shall be received
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
await().untilAsserted(() -> assertThat(consumerResults.status.size()).isEqualTo(2));
assertThat(consumerResults.status.get(1).state).isEqualTo(A1eEiJobStatus.EiJobStatusValues.ENABLED);
verifyJobStatus(EI_JOB_ID, "ENABLED");
// Test that supervision enables not enabled jobs and sends a notification when
// suceeded
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, EI_JOB_ID);
- EiProducer producer = this.eiProducers.getProducer(PRODUCER_ID);
- EiJob job = this.eiJobs.getJob(EI_JOB_ID);
+ InfoProducer producer = this.infoProducers.getProducer(PRODUCER_ID);
+ InfoJob job = this.infoJobs.getJob(EI_JOB_ID);
// Pretend that the producer did reject the job and the a DISABLED notification
// is sent for the job
producer.setJobDisabled(job);
@Test
void testEiJobDatabase() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
putEiJob(TYPE_ID, "jobId1");
putEiJob(TYPE_ID, "jobId2");
- assertThat(this.eiJobs.size()).isEqualTo(2);
+ assertThat(this.infoJobs.size()).isEqualTo(2);
{
- EiJob savedJob = this.eiJobs.getJob("jobId1");
+ InfoJob savedJob = this.infoJobs.getJob("jobId1");
// Restore the jobs
- EiJobs jobs = new EiJobs(this.applicationConfig, this.producerCallbacks);
+ InfoJobs jobs = new InfoJobs(this.applicationConfig, this.producerCallbacks);
jobs.restoreJobsFromDatabase();
assertThat(jobs.size()).isEqualTo(2);
- EiJob restoredJob = jobs.getJob("jobId1");
+ InfoJob restoredJob = jobs.getJob("jobId1");
assertThat(restoredJob.getId()).isEqualTo("jobId1");
assertThat(restoredJob.getLastUpdated()).isEqualTo(savedJob.getLastUpdated());
- jobs.remove("jobId1", this.eiProducers);
- jobs.remove("jobId2", this.eiProducers);
+ jobs.remove("jobId1", this.infoProducers);
+ jobs.remove("jobId2", this.infoProducers);
}
{
// Restore the jobs, no jobs in database
- EiJobs jobs = new EiJobs(this.applicationConfig, this.producerCallbacks);
+ InfoJobs jobs = new InfoJobs(this.applicationConfig, this.producerCallbacks);
jobs.restoreJobsFromDatabase();
assertThat(jobs.size()).isEqualTo(0);
}
logger.warn("Test removing a job when the db file is gone");
- this.eiJobs.remove("jobId1", this.eiProducers);
- assertThat(this.eiJobs.size()).isEqualTo(1);
+ this.infoJobs.remove("jobId1", this.infoProducers);
+ assertThat(this.infoJobs.size()).isEqualTo(1);
ProducerSimulatorController.TestResults simulatorResults = this.producerSimulator.getTestResults();
await().untilAsserted(() -> assertThat(simulatorResults.jobsStopped.size()).isEqualTo(3));
@Test
void testEiTypesDatabase() throws Exception {
- putEiProducerWithOneType(PRODUCER_ID, TYPE_ID);
+ putInfoProducerWithOneType(PRODUCER_ID, TYPE_ID);
- assertThat(this.eiTypes.size()).isEqualTo(1);
+ assertThat(this.infoTypes.size()).isEqualTo(1);
{
// Restore the types
- EiTypes types = new EiTypes(this.applicationConfig);
+ InfoTypes types = new InfoTypes(this.applicationConfig);
types.restoreTypesFromDatabase();
assertThat(types.size()).isEqualTo(1);
}
{
// Restore the jobs, no jobs in database
- EiTypes types = new EiTypes(this.applicationConfig);
+ InfoTypes types = new InfoTypes(this.applicationConfig);
types.clear();
types.restoreTypesFromDatabase();
assertThat(types.size()).isEqualTo(0);
}
logger.warn("Test removing a job when the db file is gone");
- this.eiTypes.remove(this.eiTypes.getType(TYPE_ID));
- assertThat(this.eiJobs.size()).isEqualTo(0);
+ this.infoTypes.remove(this.infoTypes.getType(TYPE_ID));
+ assertThat(this.infoJobs.size()).isEqualTo(0);
}
- private void deleteEiProducer(String eiProducerId) {
- String url = ProducerConsts.API_ROOT + "/eiproducers/" + eiProducerId;
+ private void deleteEiProducer(String infoProducerId) {
+ String url = ProducerConsts.API_ROOT + "/info-producers/" + infoProducerId;
restClient().deleteForEntity(url).block();
}
private void assertProducerOpState(String producerId,
ProducerStatusInfo.OperationalState expectedOperationalState) {
- String statusUrl = ProducerConsts.API_ROOT + "/eiproducers/" + producerId + "/status";
+ String statusUrl = ProducerConsts.API_ROOT + "/info-producers/" + producerId + "/status";
ResponseEntity<String> resp = restClient().getForEntity(statusUrl).block();
ProducerStatusInfo statusInfo = gson.fromJson(resp.getBody(), ProducerStatusInfo.class);
assertThat(statusInfo.opState).isEqualTo(expectedOperationalState);
}
- ProducerEiTypeInfo producerEiTypeRegistrationInfo(String typeId)
+ ProducerInfoTypeInfo producerEiTypeRegistrationInfo(String typeId)
throws JsonMappingException, JsonProcessingException {
- return new ProducerEiTypeInfo(jsonSchemaObject());
+ return new ProducerInfoTypeInfo(jsonSchemaObject());
}
ProducerRegistrationInfo producerEiRegistratioInfoRejecting(String typeId)
baseUrl() + ProducerSimulatorController.SUPERVISION_ERROR_URL);
}
- ProducerRegistrationInfo producerEiRegistratioInfo(String typeId)
+ ProducerRegistrationInfo producerInfoRegistratioInfo(String typeId)
throws JsonMappingException, JsonProcessingException {
return new ProducerRegistrationInfo(Arrays.asList(typeId), //
baseUrl() + ProducerSimulatorController.JOB_URL, baseUrl() + ProducerSimulatorController.SUPERVISION_URL);
return consumerJobInfo(TYPE_ID, EI_JOB_ID);
}
- ConsumerJobInfo consumerJobInfo(String typeId, String eiJobId)
+ ConsumerJobInfo consumerJobInfo(String typeId, String infoJobId)
throws JsonMappingException, JsonProcessingException {
- return new ConsumerJobInfo(typeId, jsonObject(), "owner", "targetUri",
- baseUrl() + ConsumerSimulatorController.getJobStatusUrl(eiJobId));
+ return new ConsumerJobInfo(typeId, jsonObject(), "owner", "https://junk.com",
+ baseUrl() + ConsumerSimulatorController.getJobStatusUrl(infoJobId));
}
- private A1eEiJobInfo eiJobInfo() throws JsonMappingException, JsonProcessingException {
- return eiJobInfo(TYPE_ID, EI_JOB_ID);
+ private A1eEiJobInfo infoJobInfo() throws JsonMappingException, JsonProcessingException {
+ return infoJobInfo(TYPE_ID, EI_JOB_ID);
}
- A1eEiJobInfo eiJobInfo(String typeId, String eiJobId) throws JsonMappingException, JsonProcessingException {
- return new A1eEiJobInfo(typeId, jsonObject(), "owner", "targetUri",
- baseUrl() + ConsumerSimulatorController.getJobStatusUrl(eiJobId));
+ A1eEiJobInfo infoJobInfo(String typeId, String infoJobId) throws JsonMappingException, JsonProcessingException {
+ return new A1eEiJobInfo(typeId, jsonObject(), "owner", "https://junk.com",
+ baseUrl() + ConsumerSimulatorController.getJobStatusUrl(infoJobId));
}
private Object jsonObject(String json) {
return jsonObject("{ " + EI_JOB_PROPERTY + " : \"value\" }");
}
- private EiJob putEiJob(String eiTypeId, String jobId)
+ private InfoJob putEiJob(String infoTypeId, String jobId)
throws JsonMappingException, JsonProcessingException, ServiceException {
String url = A1eConsts.API_ROOT + "/eijobs/" + jobId;
- String body = gson.toJson(eiJobInfo(eiTypeId, jobId));
+ String body = gson.toJson(infoJobInfo(infoTypeId, jobId));
restClient().putForEntity(url, body).block();
- return this.eiJobs.getJob(jobId);
+ return this.infoJobs.getJob(jobId);
}
- private HttpStatus putEiType(String eiTypeId)
+ private HttpStatus putInfoType(String infoTypeId)
throws JsonMappingException, JsonProcessingException, ServiceException {
- String url = ProducerConsts.API_ROOT + "/eitypes/" + eiTypeId;
- String body = gson.toJson(producerEiTypeRegistrationInfo(eiTypeId));
+ String url = ProducerConsts.API_ROOT + "/info-types/" + infoTypeId;
+ String body = gson.toJson(producerEiTypeRegistrationInfo(infoTypeId));
ResponseEntity<String> resp = restClient().putForEntity(url, body).block();
- this.eiTypes.getType(eiTypeId);
+ this.infoTypes.getType(infoTypeId);
return resp.getStatusCode();
}
- private EiType putEiProducerWithOneTypeRejecting(String producerId, String eiTypeId)
+ private InfoType putEiProducerWithOneTypeRejecting(String producerId, String infoTypeId)
throws JsonMappingException, JsonProcessingException, ServiceException {
- this.putEiType(eiTypeId);
- String url = ProducerConsts.API_ROOT + "/eiproducers/" + producerId;
- String body = gson.toJson(producerEiRegistratioInfoRejecting(eiTypeId));
+ this.putInfoType(infoTypeId);
+ String url = ProducerConsts.API_ROOT + "/info-producers/" + producerId;
+ String body = gson.toJson(producerEiRegistratioInfoRejecting(infoTypeId));
restClient().putForEntity(url, body).block();
- return this.eiTypes.getType(eiTypeId);
+ return this.infoTypes.getType(infoTypeId);
}
- private EiType putEiProducerWithOneType(String producerId, String eiTypeId)
+ private InfoType putInfoProducerWithOneType(String producerId, String infoTypeId)
throws JsonMappingException, JsonProcessingException, ServiceException {
- this.putEiType(eiTypeId);
+ this.putInfoType(infoTypeId);
- String url = ProducerConsts.API_ROOT + "/eiproducers/" + producerId;
- String body = gson.toJson(producerEiRegistratioInfo(eiTypeId));
+ String url = ProducerConsts.API_ROOT + "/info-producers/" + producerId;
+ String body = gson.toJson(producerInfoRegistratioInfo(infoTypeId));
restClient().putForEntity(url, body).block();
- return this.eiTypes.getType(eiTypeId);
+ return this.infoTypes.getType(infoTypeId);
}
private String baseUrl() {
@Getter
private TestResults testResults = new TestResults();
- public static String getJobStatusUrl(String eiJobId) {
- return "/example_dataconsumer/eijobs/" + eiJobId + "/status";
+ public static String getJobStatusUrl(String infoJobId) {
+ return "/example_dataconsumer/info_jobs/" + infoJobId + "/status";
}
- @PostMapping(path = "/example_dataconsumer/eijobs/{eiJobId}/status", produces = MediaType.APPLICATION_JSON_VALUE)
+ @PostMapping(
+ path = "/example_dataconsumer/info_jobs/{infoJobId}/status",
+ produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
- summary = "Callback for changed EI job status",
- description = "The primitive is implemented by the data consumer and is invoked when a EI job status has been changed.")
+ summary = "Callback for changed Information Job status",
+ description = "The primitive is implemented by the data consumer and is invoked when a Information Job status has been changed.")
@ApiResponses(
value = { //
@ApiResponse(
content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
})
public ResponseEntity<Object> jobStatusCallback( //
- @PathVariable("eiJobId") String eiJobId, //
+ @PathVariable("infoJobId") String infoJobId, //
@RequestBody A1eEiJobStatus status) {
- logger.info("Job status callback status: {} eiJobId: {}", status.state, eiJobId);
+ logger.info("Job status callback status: {} infoJobId: {}", status.state, infoJobId);
this.testResults.status.add(status);
return new ResponseEntity<>(HttpStatus.OK);
}
private final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public static final String JOB_URL = "/producer_simulator/ei_job";
- public static final String JOB_ERROR_URL = "/producer_simulator/ei_job_error";
+ public static final String JOB_URL = "/producer_simulator/info_job";
+ public static final String JOB_ERROR_URL = "/producer_simulator/info_job_error";
public static final String SUPERVISION_URL = "/producer_simulator/health_check";
public static final String SUPERVISION_ERROR_URL = "/producer_simulator/health_check_error";
@PostMapping(path = JOB_URL, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
- summary = "Callback for EI job creation/modification",
- description = "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the EI producer.")
+ summary = "Callback for Information Job creation/modification",
+ description = "The call is invoked to activate or to modify a data subscription. The endpoint is provided by the Information Producer.")
@ApiResponses(
value = { //
@ApiResponse(
}
}
- @DeleteMapping(path = "/producer_simulator/ei_job/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ @DeleteMapping(path = "/producer_simulator/info_job/{infoJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
- summary = "Callback for EI job deletion",
- description = "The call is invoked to terminate a data subscription. The endpoint is provided by the EI producer.")
+ summary = "Callback for Information Job deletion",
+ description = "The call is invoked to terminate a data subscription. The endpoint is provided by the Information Producer.")
@ApiResponses(
value = { //
@ApiResponse(
content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
})
public ResponseEntity<Object> jobDeletedCallback( //
- @PathVariable("eiJobId") String eiJobId) {
+ @PathVariable("infoJobId") String infoJobId) {
try {
- logger.info("Job deleted callback {}", eiJobId);
- this.testResults.jobsStopped.add(eiJobId);
+ logger.info("Job deleted callback {}", infoJobId);
+ this.testResults.jobsStopped.add(infoJobId);
return new ResponseEntity<>(HttpStatus.OK);
} catch (Exception e) {
return ErrorResponse.create(e, HttpStatus.NOT_FOUND);
}
@PostMapping(path = JOB_ERROR_URL, produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Callback for EI job creation, returns error", description = "", hidden = true)
+ @Operation(summary = "Callback for Information Job creation, returns error", description = "", hidden = true)
@ApiResponses(
value = { //
@ApiResponse(
return ErrorResponse.create("Producer returns error on create job", HttpStatus.NOT_FOUND);
}
- @DeleteMapping(path = JOB_ERROR_URL + "/{eiJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
- @Operation(summary = "Callback for EI job deletion, returns error", description = "", hidden = true)
+ @DeleteMapping(path = JOB_ERROR_URL + "/{infoJobId}", produces = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(summary = "Callback for Information Job deletion, returns error", description = "", hidden = true)
@ApiResponses(
value = { //
@ApiResponse(
content = @Content(schema = @Schema(implementation = VoidResponse.class))) //
})
public ResponseEntity<Object> jobDeletedCallbackReturnError( //
- @PathVariable("eiJobId") String eiJobId) {
- logger.info("Job created (returning error) callback {}", eiJobId);
+ @PathVariable("infoJobId") String infoJobId) {
+ logger.info("Job created (returning error) callback {}", infoJobId);
this.testResults.noOfRejectedDelete += 1;
return ErrorResponse.create("Producer returns error on delete job", HttpStatus.NOT_FOUND);
}
@GetMapping(path = SUPERVISION_URL, produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(
summary = "Producer supervision",
- description = "The endpoint is provided by the EI producer and is used for supervision of the producer.")
+ description = "The endpoint is provided by the Information Producer and is used for supervision of the producer.")
@ApiResponses(
value = { //
@ApiResponse(