Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ val commonsCodec = "commons-codec" % "commons-codec" % "1.10"
val enumUtils = "com.thenewmotion" %% "enum-utils" % "0.2.1"
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4" % "test"
val specs2ScalaCheck = "org.specs2" %% "specs2-scalacheck" % specs2V % "test"
val json4sjackson = "org.json4s" %% "json4s-jackson" % json4sV % "test"
val jsonSchemaValidator = "com.github.java-json-tools" % "json-schema-validator" % "2.2.8" % "test"

def module(name: String) = Project(name, file(name))
.enablePlugins(OssLibPlugin)
Expand Down Expand Up @@ -59,7 +61,7 @@ val json = module("ocpp-json")
.dependsOn(messages)
.settings(
libraryDependencies ++= Seq(
json4sNative, slf4jApi, scalaCheck, specs2ScalaCheck
json4sNative, slf4jApi, scalaCheck, specs2ScalaCheck, jsonSchemaValidator, json4sjackson
)
)

Expand Down
15 changes: 15 additions & 0 deletions ocpp-json/src/test/resources/schemas/Authorize.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AuthorizeRequest",
"type": "object",
"properties": {
"idTag": {
"type": "string",
"maxLength": 20
}
},
"additionalProperties": false,
"required": [
"idTag"
]
}
37 changes: 37 additions & 0 deletions ocpp-json/src/test/resources/schemas/AuthorizeResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AuthorizeResponse",
"type": "object",
"properties": {
"idTagInfo": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Blocked",
"Expired",
"Invalid",
"ConcurrentTx"
]
},
"expiryDate": {
"type": "string",
"format": "date-time"
},
"parentIdTag": {
"type": "string",
"maxLength": 20
}
},
"required": [
"status"
]
}
},
"additionalProperties": false,
"required": [
"idTagInfo"
]
}
48 changes: 48 additions & 0 deletions ocpp-json/src/test/resources/schemas/BootNotification.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "BootNotificationRequest",
"type": "object",
"properties": {
"chargePointVendor": {
"type": "string",
"maxLength": 20
},
"chargePointModel": {
"type": "string",
"maxLength": 20
},
"chargePointSerialNumber": {
"type": "string",
"maxLength": 25
},
"chargeBoxSerialNumber": {
"type": "string",
"maxLength": 25
},
"firmwareVersion": {
"type": "string",
"maxLength": 50
},
"iccid": {
"type": "string",
"maxLength": 20
},
"imsi": {
"type": "string",
"maxLength": 20
},
"meterType": {
"type": "string",
"maxLength": 25
},
"meterSerialNumber": {
"type": "string",
"maxLength": 25
}
},
"additionalProperties": false,
"required": [
"chargePointVendor",
"chargePointModel"
]
}
28 changes: 28 additions & 0 deletions ocpp-json/src/test/resources/schemas/BootNotificationResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "BootNotificationResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Pending",
"Rejected"
]
},
"currentTime": {
"type": "string",
"format": "date-time"
},
"interval": {
"type": "number"
}
},
"additionalProperties": false,
"required": [
"status",
"currentTime",
"interval"
]
}
14 changes: 14 additions & 0 deletions ocpp-json/src/test/resources/schemas/CancelReservation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "CancelReservationRequest",
"type": "object",
"properties": {
"reservationId": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"reservationId"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "CancelReservationResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Rejected"
]
}
},
"additionalProperties": false,
"required": [
"status"
]
}
22 changes: 22 additions & 0 deletions ocpp-json/src/test/resources/schemas/ChangeAvailability.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ChangeAvailabilityRequest",
"type": "object",
"properties": {
"connectorId": {
"type": "integer"
},
"type": {
"type": "string",
"enum": [
"Inoperative",
"Operative"
]
}
},
"additionalProperties": false,
"required": [
"connectorId",
"type"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ChangeAvailabilityResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Rejected",
"Scheduled"
]
}
},
"additionalProperties": false,
"required": [
"status"
]
}
20 changes: 20 additions & 0 deletions ocpp-json/src/test/resources/schemas/ChangeConfiguration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ChangeConfigurationRequest",
"type": "object",
"properties": {
"key": {
"type": "string",
"maxLength": 50
},
"value": {
"type": "string",
"maxLength": 500
}
},
"additionalProperties": false,
"required": [
"key",
"value"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ChangeConfigurationResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Rejected",
"RebootRequired",
"NotSupported"
]
}
},
"additionalProperties": false,
"required": [
"status"
]
}
7 changes: 7 additions & 0 deletions ocpp-json/src/test/resources/schemas/ClearCache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ClearCacheRequest",
"type": "object",
"properties": {},
"additionalProperties": false
}
18 changes: 18 additions & 0 deletions ocpp-json/src/test/resources/schemas/ClearCacheResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ClearCacheResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Rejected"
]
}
},
"additionalProperties": false,
"required": [
"status"
]
}
25 changes: 25 additions & 0 deletions ocpp-json/src/test/resources/schemas/ClearChargingProfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ClearChargingProfileRequest",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"connectorId": {
"type": "integer"
},
"chargingProfilePurpose": {
"type": "string",
"enum": [
"ChargePointMaxProfile",
"TxDefaultProfile",
"TxProfile"
]
},
"stackLevel": {
"type": "integer"
}
},
"additionalProperties": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ClearChargingProfileResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Unknown"
]
}
},
"additionalProperties": false,
"required": [
"status"
]
}
22 changes: 22 additions & 0 deletions ocpp-json/src/test/resources/schemas/DataTransfer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "DataTransferRequest",
"type": "object",
"properties": {
"vendorId": {
"type": "string",
"maxLength": 255
},
"messageId": {
"type": "string",
"maxLength": 50
},
"data": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"vendorId"
]
}
23 changes: 23 additions & 0 deletions ocpp-json/src/test/resources/schemas/DataTransferResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "DataTransferResponse",
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"Accepted",
"Rejected",
"UnknownMessageId",
"UnknownVendorId"
]
},
"data": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"status"
]
}
Loading