Skip to content

Commit

Permalink
SYMMETRICDS-602 - Export of configuration is not work because all dat…
Browse files Browse the repository at this point in the history
…a is filtered out. The config router thinks it doesn't need to route the extracted configuration because the passed in node is itself
  • Loading branch information
chenson42 committed Apr 5, 2012
1 parent cd5504f commit 82a9b3c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
Expand Up @@ -92,7 +92,7 @@ public Set<String> routeToNodes(SimpleRouterContext routingContext, DataMetaData
// if this is sym_node or sym_node_security determine which nodes it
// goes to.
if (tableMatches(dataMetaData, TableConstants.SYM_NODE)
|| tableMatches(dataMetaData, TableConstants.SYM_NODE_SECURITY)
|| tableMatches(dataMetaData, TableConstants.SYM_NODE_SECURITY)
|| tableMatches(dataMetaData, TableConstants.SYM_NODE_HOST)) {

String nodeIdInQuestion = columnValues.get("NODE_ID");
Expand All @@ -101,22 +101,26 @@ public Set<String> routeToNodes(SimpleRouterContext routingContext, DataMetaData
if (isLinked(nodeIdInQuestion, nodeThatMayBeRoutedTo, rootNetworkedNode, me,
nodeGroupLinks)
&& !isSameNumberOfLinksAwayFromRoot(nodeThatMayBeRoutedTo,
rootNetworkedNode, me)) {
rootNetworkedNode, me)
|| (nodeThatMayBeRoutedTo.getNodeId().equals(me.getNodeId()) && initialLoad)) {
if (nodeIds == null) {
nodeIds = new HashSet<String>();
}
nodeIds.add(nodeThatMayBeRoutedTo.getNodeId());
}
}

// don't route node security to it's own node. that node will get node security

// don't route node security to it's own node. that node will get
// node security
// via registration and it will be updated by initial load
if (!initialLoad && nodeIds != null && tableMatches(dataMetaData, TableConstants.SYM_NODE_SECURITY)) {
if (!initialLoad && nodeIds != null
&& tableMatches(dataMetaData, TableConstants.SYM_NODE_SECURITY)) {
nodeIds.remove(nodeIdInQuestion);
}
} else {
for (Node nodeThatMayBeRoutedTo : possibleTargetNodes) {
if (!isSameNumberOfLinksAwayFromRoot(nodeThatMayBeRoutedTo, rootNetworkedNode, me)) {
if (!isSameNumberOfLinksAwayFromRoot(nodeThatMayBeRoutedTo, rootNetworkedNode, me)
|| (nodeThatMayBeRoutedTo.getNodeId().equals(me.getNodeId()) && initialLoad)) {
if (nodeIds == null) {
nodeIds = new HashSet<String>();
}
Expand All @@ -128,7 +132,7 @@ public Set<String> routeToNodes(SimpleRouterContext routingContext, DataMetaData
&& (tableMatches(dataMetaData, TableConstants.SYM_TRIGGER)
|| tableMatches(dataMetaData, TableConstants.SYM_TRIGGER_ROUTER)
|| tableMatches(dataMetaData, TableConstants.SYM_ROUTER) || tableMatches(
dataMetaData, TableConstants.SYM_NODE_GROUP_LINK))) {
dataMetaData, TableConstants.SYM_NODE_GROUP_LINK))) {
routingContext.getContextCache().put(CTX_KEY_RESYNC_NEEDED, Boolean.TRUE);
}

Expand Down
Expand Up @@ -125,7 +125,22 @@ public void testRouteRgn2FromCorp() {
Assert.assertNotNull(nodeIds);
Assert.assertEquals(1, nodeIds.size());
Assert.assertEquals("rgn2", nodeIds.iterator().next());
}
}

@Test
public void testConfigurationExtract() {
IDataRouter router = buildTestableRouter(
THREE_TIER_NETWORKED_ROOT.findNetworkedNode("corp").getNode(), THREE_TIER_LINKS,
THREE_TIER_NETWORKED_ROOT);

Set<Node> nodes = new HashSet<Node>();
nodes.add(THREE_TIER_NETWORKED_ROOT.findNetworkedNode("corp").getNode());

Collection<String> nodeIds = router.routeToNodes(new SimpleRouterContext(), buildDataMetaData("SYM_NODE", "corp"), nodes, true);
Assert.assertNotNull(nodeIds);
Assert.assertEquals(1, nodeIds.size());
Assert.assertEquals("corp", nodeIds.iterator().next());
}

@Test
public void testRouteRgn1FromCorp() {
Expand Down

0 comments on commit 82a9b3c

Please sign in to comment.