diff --git a/README.md b/README.md
index 5bbcec3..a840a33 100644
--- a/README.md
+++ b/README.md
@@ -129,12 +129,12 @@ To run the generated Java project in a Docker container, use the commands as bel
1. Build the image
```
docker build -t [PACKAGE_NAME]:[VERSION] .
- ```
+ ```
2. Run the image in detached mode
```
- docker run -d [PACKAGE_NAME]:[VERSION]
- ```
+ docker run -d [PACKAGE_NAME]:[VERSION]
+ ```
For further information including network setup, please see the [tutorial](template/TUTORIAL.md).
diff --git a/TUTORIAL.md b/TUTORIAL.md
index a55fdf5..65cbb52 100644
--- a/TUTORIAL.md
+++ b/TUTORIAL.md
@@ -29,7 +29,7 @@ cd ~/asyncapi-java-tutorial
```
## Running the Publisher/Subscriber Template
-These commands will allow you to run the Java Template publisher/subscriber model using IBM MQ.
+These commands will allow you to run the Java Template publisher/subscriber model using IBM MQ.
1. Run the AsyncAPI Generator. **Note:** You may need to change the username and password values if you have not followed the IBM MQ tutorial.
```
ag https://ibm.biz/mq-asyncapi-yml-sample https://ibm.biz/mq-asyncapi-java-template -o ./output -p server=production -p user=app -p password=passw0rd
@@ -44,7 +44,7 @@ These commands will allow you to run the Java Template publisher/subscriber mode
```
3. Install the dependencies required to run this template
```
- mvn compile
+ mvn compile
```
4. Create .jar package using maven
```
@@ -54,7 +54,7 @@ These commands will allow you to run the Java Template publisher/subscriber mode
```
java -cp target/asyncapi-java-generator-0.1.0.jar com.ibm.mq.samples.jms.DemoSubscriber
```
-6. In a seperate terminal, navigate to the `output` directory above and run your generated Publisher
+6. In a seperate terminal, navigate to the `output` directory above and run your generated Publisher
```
cd ~/asyncapi-java-tutorial/output
java -cp target/asyncapi-java-generator-0.1.0.jar com.ibm.mq.samples.jms.DemoProducer
@@ -79,27 +79,27 @@ To deploy a dockerised instance of this project;
1. Build the image
```
docker build -t [PACKAGE_NAME]:[VERSION] .
- ```
+ ```
2. Run the image in detached mode
```
docker run -d [PACKAGE_NAME]:[VERSION]
- ```
+ ```
-Please note; The default `Dockerfile` included in output will only run `DemoSubscriber.java`. This will need to be replaced with the entrypoint to your application.
+Please note; The default `Dockerfile` included in output will only run `DemoSubscriber.java`. This will need to be replaced with the entrypoint to your application.
### Networking
-Docker networking needs to be properly configured in order to allow your project to connect to an MQ instance.
+Docker networking needs to be properly configured in order to allow your project to connect to an MQ instance.
If MQ is also running in a docker container
1. Create a docker network
```
docker network create exampleMqNetwork
- ```
+ ```
2. Attach the docker network to your MQ container
```
docker network connect exampleMqNetwork
- ```
+ ```
3. Update your env.json server hostname to match the container name for MQ. To find the name run
```
docker ps
diff --git a/components/Common.js b/components/Common.js
index 12d9fca..698ce54 100644
--- a/components/Common.js
+++ b/components/Common.js
@@ -17,7 +17,7 @@
import { createJavaArgsFromProperties } from '../utils/Types.utils';
export function Class({ childrenContent, name, implementsClass, extendsClass }) {
- if (childrenContent === undefined) {
+ if (childrenContent === undefined) {
childrenContent = '';
}
@@ -73,17 +73,17 @@ export function getMqValues(url, val) {
}
const splitVals = regString.toString().split('/');
- if (splitVals.length === 2) {
+ if (splitVals.length === 2) {
if (val === 'qmgr')
return splitVals[0];
if (val === 'mqChannel')
return splitVals[1];
-
+
throw new Error('Invalid parameter passed into getMqValues function');
}
throw new Error('Invalid URL passed into getMqValues function');
}
-
+
export function URLtoHost(url) {
const u = new URL(url);
return u.host;
@@ -154,7 +154,7 @@ import ${params.package}.models.${messageName.charAt(0).toUpperCase() + messageN
/* Used to resolve a channel object to message name */
export function ChannelToMessage(channel, asyncapi) {
// Get payload from either publish or subscribe
- const targetPayloadProperties = Object.prototype.hasOwnProperty.call(channel, 'publish') ?
+ const targetPayloadProperties = Object.prototype.hasOwnProperty.call(channel, 'publish') ?
channel.publish().message().payload().properties() :
channel.subscribe().message().payload().properties();
diff --git a/components/Consumer/MQConsumer.js b/components/Consumer/MQConsumer.js
index 2a9442e..7d7d503 100644
--- a/components/Consumer/MQConsumer.js
+++ b/components/Consumer/MQConsumer.js
@@ -79,7 +79,7 @@ export function ReceiveMessage({ message }) {
* Implement your business logic to handle
* received messages here.
*/
-
+
} catch (JMSException jmsex) {
recordFailure(jmsex);
} catch (JsonProcessingException jsonproex) {
@@ -101,7 +101,7 @@ export function ReceiveMessage({ message }) {
}
`;
}
-
+
export function ConsumerConstructor({ name }) {
return `
super();
diff --git a/components/Files/Consumers.js b/components/Files/Consumers.js
index 0876252..b36f9f9 100644
--- a/components/Files/Consumers.js
+++ b/components/Files/Consumers.js
@@ -27,16 +27,16 @@ export function Consumers(asyncapi, channels, params) {
const packagePath = javaPackageToPath(params.package);
const message = ChannelToMessage(channel, asyncapi);
-
+
if (channel.subscribe()) {
return (
-
+
-
+
@@ -45,8 +45,8 @@ export function Consumers(asyncapi, channels, params) {
-
+
);
}
});
-}
+}
\ No newline at end of file
diff --git a/components/Files/Producers.js b/components/Files/Producers.js
index a444d7e..da9f0b1 100644
--- a/components/Files/Producers.js
+++ b/components/Files/Producers.js
@@ -29,14 +29,14 @@ export function Producers(asyncapi, channels, params) {
if (channel.publish()) {
return (
-
+
-
+
-
+
diff --git a/components/PomHelper.js b/components/PomHelper.js
index cc505f6..8e0b098 100644
--- a/components/PomHelper.js
+++ b/components/PomHelper.js
@@ -22,7 +22,7 @@ export function PomHelper({ server, params }) {
// Resolve additional dependencies depending on protocol supplied
const supportedProtocol = server.protocol();
const dependencies = resolveDependencies(supportedProtocol);
-
+
let protocolDependencies = '';
for (const dependency of dependencies) {
diff --git a/components/Producer/MQProducer.js b/components/Producer/MQProducer.js
index 53d65c9..062942a 100644
--- a/components/Producer/MQProducer.js
+++ b/components/Producer/MQProducer.js
@@ -22,24 +22,24 @@ export function ProducerDeclaration() {
export function SendMessage() {
return `
- public void send(ModelContract modelContract) {
+ public void send(ModelContract modelContract) {
Serializable modelInstance = (Serializable) modelContract;
try{
// JSON encode and transmit
ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
String json = ow.writeValueAsString(modelInstance);
-
+
logger.info("Sending Message: " + json);
-
+
this.producer.send(destination, json);
-
+
}catch (JsonProcessingException e){
logger.severe("An error occured whilst attempting to send a message: " + e);
}
}`;
}
-
+
export function ProducerConstructor({ name }) {
return `
super();
@@ -81,9 +81,9 @@ import ${params.package}.Connection;
import ${params.package}.PubSubBase;
import ${params.package}.models.ModelContract;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.annotation.JsonView;
`;
-}
+}
\ No newline at end of file
diff --git a/components/PubSubBase/MQPubSubBase.js b/components/PubSubBase/MQPubSubBase.js
index 0250541..7944861 100644
--- a/components/PubSubBase/MQPubSubBase.js
+++ b/components/PubSubBase/MQPubSubBase.js
@@ -25,22 +25,22 @@ function getPubSubContent(params) {
import java.util.Map;
import java.util.List;
import java.nio.file.Paths;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.fasterxml.jackson.databind.ObjectWriter;
+ import com.fasterxml.jackson.databind.ObjectMapper;
+ import com.fasterxml.jackson.databind.ObjectWriter;
import ${params.package}.ConnectionHelper;
import ${params.package}.LoggingHelper;
-
+
import javax.jms.Destination;
import javax.jms.JMSContext;
import javax.jms.JMSRuntimeException;
import javax.jms.JMSException;
-
-
+
+
public class PubSubBase {
-
+
protected static final Logger logger = Logger.getLogger("${params.package}");
-
+
protected ConnectionHelper ch = null;
protected JMSContext context = null;
protected Destination destination = null;
@@ -49,25 +49,25 @@ function getPubSubContent(params) {
public void Base(){
LoggingHelper.init(logger);
}
-
+
public void createConnection(String topicName, String id){
// Retrieve first MQ endpoint from env.json
List
);
-}
+}
\ No newline at end of file
diff --git a/test/mocks/many-messages.yml b/test/mocks/many-messages.yml
index 724281b..3b2788e 100644
--- a/test/mocks/many-messages.yml
+++ b/test/mocks/many-messages.yml
@@ -10,13 +10,13 @@ servers:
description: Production Instance 1
channels:
song/released:
- publish:
+ publish:
message:
$ref: '#/components/messages/song'
subscribe:
message:
$ref: '#/components/messages/song'
-
+
components:
messages:
song:
@@ -65,4 +65,4 @@ components:
description: Artist name
dob:
type: string
- description: Song date of birth
+ description: Song date of birth
\ No newline at end of file
diff --git a/test/mocks/single-channel.yml b/test/mocks/single-channel.yml
index 61cf126..b7e5eaa 100644
--- a/test/mocks/single-channel.yml
+++ b/test/mocks/single-channel.yml
@@ -10,13 +10,13 @@ servers:
description: Production Instance 1
channels:
song/released:
- publish:
+ publish:
message:
$ref: '#/components/messages/song'
subscribe:
message:
$ref: '#/components/messages/song'
-
+
components:
messages:
song:
diff --git a/utils/DependencyResolver.utils.js b/utils/DependencyResolver.utils.js
index 874dede..ded47aa 100644
--- a/utils/DependencyResolver.utils.js
+++ b/utils/DependencyResolver.utils.js
@@ -1,5 +1,5 @@
const dependencyMap = [
- {
+ {
protocols: ['ibmmq', 'ibmmq-secure'],
dependencies: [
{ groupId: 'com.ibm.mq', artifactId: 'com.ibm.mq.allclient', version: '9.2.3.0' }
@@ -22,4 +22,4 @@ export function resolveDependencies(protocol) {
}
return foundMapping.dependencies;
-}
+}
\ No newline at end of file
diff --git a/utils/Types.utils.js b/utils/Types.utils.js
index 7e3d45e..dc92dfb 100644
--- a/utils/Types.utils.js
+++ b/utils/Types.utils.js
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-/*
+/*
* Converts from async api defined types (https://www.asyncapi.com/docs/specifications/v2.0.0#dataTypeFormat)
* to native Java types
*/
@@ -34,7 +34,7 @@ export function asyncApiTypeToJavaType(asyncApiType) {
case 'string':
return 'String';
-
+
case 'byte':
return 'byte';
@@ -57,7 +57,7 @@ export function asyncApiTypeToJavaType(asyncApiType) {
}
}
-/*
+/*
* Helper class to easily assign local class properties
*/
export function setLocalVariables(properties) {
@@ -67,9 +67,9 @@ export function setLocalVariables(properties) {
`;
});
}
-
-/*
- * Helper class to define variables
+
+/*
+ * Helper class to define variables
*/
export function defineVariablesForProperties(properties) {
return Object.entries(properties).map(([name, property]) => {
@@ -77,8 +77,8 @@ export function defineVariablesForProperties(properties) {
});
}
-/*
- * Helper class to pass variables into a function defined by properties
+/*
+ * Helper class to pass variables into a function defined by properties
*/
export function passJavaArgs(properties) {
return Object.entries(properties).map(([name, property]) => {
@@ -104,7 +104,7 @@ export function createJavaConstructorArgs(properties) {
});
}
-/*
+/*
* Generates an example value from asyncAPI datatype in Java
*/
export function asyncApiTypeToDemoValue(asyncApiType) {