Skip to content

Commit

Permalink
[orchestra2md] Actor and Flow documentation content is added before t…
Browse files Browse the repository at this point in the history
…he Markdown heading #71
  • Loading branch information
donmendelson committed Oct 14, 2022
1 parent f4d1638 commit 2552ba3
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
package io.fixprotocol.md2interfaces;

import java.io.File;
import java.io.FileOutputStream;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class Md2InterfacesTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import io.fixprotocol._2020.orchestra.repository.SectionType;
import io.fixprotocol._2020.orchestra.repository.Sections;
import io.fixprotocol._2020.orchestra.repository.StateMachineType;
import io.fixprotocol.md.event.MarkdownUtil;
import io.fixprotocol.md2orchestra.util.MediaTypes;
import io.fixprotocol.orchestra.event.EventListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void codesetWithRef() throws Exception {
builder.write(xmlStream);
builder.closeEventLogger();
String xml = xmlStream.toString();
System.out.println(xml);
//System.out.println(xml);
builder.closeEventLogger();
String errors = jsonOutputStream.toString();
//System.out.println(errors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ private void generateActor(ActorType actor, Repository repository, DocumentWrite
throws IOException {
final MutableContext context = contextFactory.createContext(3);
context.addPair("Actor", actor.getName());

documentWriter.write(context);

final Annotation annotation = actor.getAnnotation();
generateDocumentationBlocks(annotation, documentWriter);
documentWriter.write(context);
Expand Down Expand Up @@ -1169,6 +1170,7 @@ private void generateFlow(FlowType flow, DocumentWriter documentWriter)
throws IOException {
final MutableContext context = contextFactory.createContext(3);
context.addPair("Flow", flow.getName());
documentWriter.write(context);
final Annotation annotation = flow.getAnnotation();
generateDocumentationBlocks(annotation, documentWriter);
documentWriter.write(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,42 @@ class MarkdownGeneratorTest {
private MarkdownGenerator generator;
private ByteArrayOutputStream jsonOutputStream;

@Test // #71
void actor() throws Exception {
String text ="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
+ "<fixr:repository xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:fixr=\"http://fixprotocol.io/2020/orchestra/repository\">\n"
+ " <fixr:metadata/>\n"
+ " <fixr:actors>\n"
+ " <fixr:actor name=\"TradingAdapter\">\n"
+ " <fixr:annotation>\n"
+ " <fixr:documentation contentType=\"text/markdown\">This actor connects the BLOXX Order Management to the Trading System of the customer.</fixr:documentation>\n"
+ " </fixr:annotation>\n"
+ " </fixr:actor>\n"
+ " <fixr:actor name=\"TradingSystem\">\n"
+ " <fixr:annotation>\n"
+ " <fixr:documentation contentType=\"text/markdown\">This is the customers Trading System receiving orders from the Trading Adapter and sending executions back.</fixr:documentation>\n"
+ " </fixr:annotation>\n"
+ " </fixr:actor>\n"
+ " </fixr:actors>\n"
+ " <fixr:datatypes/>\n"
+ " <fixr:codeSets/>\n"
+ " <fixr:fields/>\n"
+ " <fixr:components/>\n"
+ " <fixr:groups/>\n "
+ " <fixr:messages/>\n"
+ "</fixr:repository>\n";

InputStream inputStream = new ByteArrayInputStream(text.getBytes());
ByteArrayOutputStream mdStream = new ByteArrayOutputStream(8096);
OutputStreamWriter outputWriter = new OutputStreamWriter(mdStream, StandardCharsets.UTF_8);
generator.generate(inputStream, outputWriter, jsonOutputStream);
outputWriter.close();
String md = mdStream.toString();
//System.out.println(md);
String errors = jsonOutputStream.toString();
//System.out.println(errors);
}

@Test // #66
void appinfo() throws Exception {
String text ="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
Expand Down

0 comments on commit 2552ba3

Please sign in to comment.