Skip to content

Commit

Permalink
test(definitions): JMS bindings new tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Jul 26, 2024
1 parent 3a06a07 commit d89bd57
Show file tree
Hide file tree
Showing 20 changed files with 195 additions and 224 deletions.
4 changes: 0 additions & 4 deletions test/bindings/jms/0.0.1/channel/example.json

This file was deleted.

7 changes: 0 additions & 7 deletions test/bindings/jms/0.0.1/channel/extended.json

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions test/bindings/jms/0.0.1/channel/wrongly extended.json

This file was deleted.

43 changes: 0 additions & 43 deletions test/bindings/jms/0.0.1/message/example.json

This file was deleted.

7 changes: 0 additions & 7 deletions test/bindings/jms/0.0.1/message/extended.json

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions test/bindings/jms/0.0.1/message/wrongly extended.json

This file was deleted.

1 change: 0 additions & 1 deletion test/bindings/jms/0.0.1/server/empty.json

This file was deleted.

10 changes: 0 additions & 10 deletions test/bindings/jms/0.0.1/server/example.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/bindings/jms/0.0.1/server/extended.json

This file was deleted.

3 changes: 0 additions & 3 deletions test/bindings/jms/0.0.1/server/only required properties.json

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions test/bindings/jms/0.0.1/server/wrongly extended.json

This file was deleted.

48 changes: 48 additions & 0 deletions test/bindings/jms/jms channel binding.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const config = new JsonSchemaTestSuiteConfig(
false,
[],
true,
[]
);

let data = {
"0.0.1": new JsonSchemaTestSuiteData(
require(`@bindings/jms/0.0.1/channel.json`),
[
{
"destination": "user-signed-up",
"destinationType": "fifo-queue"
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
),
}

describe.each([
'0.0.1',
])('JMS channel binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
87 changes: 87 additions & 0 deletions test/bindings/jms/jms message binding.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const config = new JsonSchemaTestSuiteConfig(
false,
[],
true,
[]
);

let data = {
"0.0.1": new JsonSchemaTestSuiteData(
require(`@bindings/jms/0.0.1/message.json`),
[
{
"headers": {
"type": "object",
"required": ["JMSMessageID"],
"properties": {
"JMSMessageID": {
"type": ["string", "null"],
"description": "A unique message identifier. This may be set by your JMS Provider on your behalf."
},
"JMSTimestamp": {
"type": "integer",
"description": "The time the message was sent. This may be set by your JMS Provider on your behalf. The time the message was sent. The value of the timestamp is the amount of time, measured in milliseconds, that has elapsed since midnight, January 1, 1970, UTC."
},
"JMSDeliveryMode": {
"type": "string",
"enum": ["PERSISTENT", "NON_PERSISTENT"],
"default": "PERSISTENT",
"description": "Denotes the delivery mode for the message. This may be set by your JMS Provider on your behalf."
},
"JMSPriority": {
"type": "integer",
"default": 4,
"description": "The priority of the message. This may be set by your JMS Provider on your behalf."
},
"JMSExpires": {
"type": "integer",
"description": "The time at which the message expires. This may be set by your JMS Provider on your behalf. A value of zero means that the message does not expire. Any non-zero value is the amount of time, measured in milliseconds, that has elapsed since midnight, January 1, 1970, UTC, at which the message will expire."
},
"JMSType": {
"type": ["string", "null"],
"description": "The type of message. Some JMS providers use a message repository that contains the definitions of messages sent by applications. The 'JMSType' header field may reference a message's definition in the provider's repository. The JMS API does not define a standard message definition repository, nor does it define a naming policy for the definitions it contains. Some messaging systems require that a message type definition for each application message be created and that each message specify its type. In order to work with such JMS providers, JMS clients should assign a value to 'JMSType', whether the application makes use of it or not. This ensures that the field is properly set for those providers that require it."
},
"JMSCorrelationID": {
"type": ["string", "null"],
"description": "The correlation identifier of the message. A client can use the 'JMSCorrelationID' header field to link one message with another. A typical use is to link a response message with its request message. Since each message sent by a JMS provider is assigned a message ID value, it is convenient to link messages via message ID, such message ID values must start with the 'ID:' prefix. Conversely, application-specified values must not start with the 'ID:' prefix; this is reserved for provider-generated message ID values."
},
"JMSReplyTo": {
"type": "string",
"description": "The queue or topic that the message sender expects replies to."
}
}
}
}
],
{},
{},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
),
}

describe.each([
'0.0.1',
])('JMS message binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
60 changes: 60 additions & 0 deletions test/bindings/jms/jms server binding.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {
JsonSchemaTestSuite,
JsonSchemaTestSuiteConfig,
JsonSchemaTestSuiteData
} from '@test/definitions/base-schema-test.mjs';
import {describe} from 'vitest';

const config = new JsonSchemaTestSuiteConfig(
true,
[
'must have required property \'jmsConnectionFactory\'',
],
true,
[]
);

let data = {
"0.0.1": new JsonSchemaTestSuiteData(
require(`@bindings/jms/0.0.1/server.json`),
[
{
"jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory",
"properties": [
{
"name": "disableTimeStampsByDefault",
"value": false
}
],
"clientID": "my-application-1"
}
],
{
"jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory"
},
{},
{
"jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory",
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
}
},
{
"jmsConnectionFactory": "org.apache.activemq.ActiveMQConnectionFactory",
"x-number": 0,
"x-string": "",
"x-object": {
"property": {}
},
"ext-number": 1
}
),
}

describe.each([
'0.0.1',
])('JMS server binding v%s', (bindingVersion) => {
new JsonSchemaTestSuite(data[bindingVersion], config).testSuite()
})
Loading

0 comments on commit d89bd57

Please sign in to comment.