Skip to content

Commit 947a20a

Browse files
committed
fix(flow-translator): leave inbound-gateway reply-channel as a standalone node
1 parent b58ac82 commit 947a20a

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

flow-translator/flow-translator-lib/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.codice.keip</groupId>
88
<artifactId>flow-translator-lib</artifactId>
9-
<version>0.4.0</version>
9+
<version>0.4.1</version>
1010

1111
<packaging>jar</packaging>
1212

flow-translator/flow-translator-lib/src/main/java/org/codice/keip/flow/xml/spring/ChannelEdgeBuilder.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ class ChannelEdgeBuilder {
5353

5454
private final Map<String, EipNode> channelNodes;
5555

56+
private final Map<String, EipNode> nonChannelNodes;
57+
5658
private final GuavaGraph.Builder graphBuilder;
5759

5860
ChannelEdgeBuilder(Collection<EipNode> nodes) {
5961
this.nodes = nodes;
6062
this.channelConnections = new HashMap<>();
6163
this.channelNodes = new HashMap<>();
64+
this.nonChannelNodes = new HashMap<>();
6265
this.graphBuilder = GuavaGraph.newBuilder();
6366
}
6467

@@ -70,6 +73,7 @@ GuavaGraph buildGraph() {
7073
continue;
7174
}
7275

76+
nonChannelNodes.put(node.id(), node);
7377
Set<String> channelAttrNames = processChannelAttributes(node);
7478
processContentBasedRouters(node);
7579
Map<String, Object> filtered = filterChannelAttributes(node.attributes(), channelAttrNames);
@@ -213,9 +217,17 @@ private void disambiguateReplyConnection(
213217
* <li>The channel type is NOT a direct channel (e.g. pub-sub, queue, etc.)
214218
* <li>The channel has multiple incoming connections
215219
* <li>The channel has multiple outgoing connections
220+
* <li>The channel is a reply-channel for an 'inbound_request_reply' node.
216221
* </ul>
217222
*/
218223
private boolean isStandaloneChannelNode(EipNode node, ChannelConnections connections) {
224+
if (connections.outgoing().size() == 1) {
225+
EipNode target = nonChannelNodes.get(connections.outgoing().getFirst().node());
226+
if (target != null && target.connectionType().equals(ConnectionType.INBOUND_REQUEST_REPLY)) {
227+
return true;
228+
}
229+
}
230+
219231
boolean isDirectChannel = node.eipId().equals(DIRECT_CHANNEL) && node.children().isEmpty();
220232
return !isDirectChannel || connections.incoming.size() > 1 || connections.outgoing.size() > 1;
221233
}

flow-translator/flow-translator-lib/src/test/groovy/org/codice/keip/flow/xml/spring/ChannelEdgeBuilderTest.groovy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ class ChannelEdgeBuilderTest extends Specification {
208208
def graph = new ChannelEdgeBuilder(nodes).buildGraph()
209209
210210
then:
211-
graph.traverse().count() == 3
211+
graph.traverse().count() == 4
212212
213213
def ec = new EdgeChecker(graph)
214+
EipNode chan3 = nodes.getLast() as EipNode
214215
215-
ec.check(gateway, [t2], [t1])
216+
ec.check(gateway, [chan3], [t1])
216217
ec.check(t1, [gateway], [t2])
217-
ec.check(t2, [t1], [gateway])
218+
ec.check(t2, [t1], [chan3])
219+
ec.check(chan3, [t2], [gateway])
218220
}
219221
220222
def "test content-based routers with a 'mapping' child"() {

flow-translator/flow-translator-webapp/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>org.codice.keip</groupId>
1313
<artifactId>flow-translator-webapp</artifactId>
14-
<version>0.4.1</version>
14+
<version>0.4.2</version>
1515

1616
<packaging>jar</packaging>
1717

@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>org.codice.keip</groupId>
4545
<artifactId>flow-translator-lib</artifactId>
46-
<version>0.4.0</version>
46+
<version>0.4.1</version>
4747
</dependency>
4848
<dependency>
4949
<groupId>org.codice.keip.xsd</groupId>

0 commit comments

Comments
 (0)