Skip to content

Commit

Permalink
SYMMETRICDS-171: fix reopening registration when missing sym_node_sec…
Browse files Browse the repository at this point in the history
…urity row
  • Loading branch information
erilong committed Jan 12, 2010
1 parent b831348 commit 799f69e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Expand Up @@ -247,7 +247,8 @@ public synchronized void reOpenRegistration(String nodeId) {
// if the update count was 0, then we probably have a row in the
// node table, but not in node security.
// lets go ahead and try to insert into node security.
jdbcTemplate.update(getSql("openRegistrationNodeSecuritySql"), new Object[] { nodeId, password });
jdbcTemplate.update(getSql("openRegistrationNodeSecuritySql"), new Object[] { nodeId, password,
nodeService.findNode(nodeId).getNodeId()});
}
} else {
log.warn("NodeReregisteringFailed", nodeId);
Expand Down
Expand Up @@ -245,6 +245,25 @@ public void testReOpenRegistrationFail() throws Exception {
assertNull(security, "Should not be able to re-open registration");
}

@Test
public void testReOpenRegistrationMissing() throws Exception {
registrationService.reOpenRegistration("00003");
NodeSecurity security = nodeService.findNodeSecurity("00003");
assertEquals(security.getNodeId(), "00003", "Wrong nodeId");
assertNotSame(security.getNodePassword(), "notsecret", "Wrong password");
assertEquals(security.isRegistrationEnabled(), true, "Wrong isRegistrationEnabled");
assertEquals(security.getRegistrationTime(), null, "Wrong registrationTime");

getJdbcTemplate().update("delete from sym_node_security where node_id = '00003'");

registrationService.reOpenRegistration("00003");
security = nodeService.findNodeSecurity("00003");
assertEquals(security.getNodeId(), "00003", "Wrong nodeId");
assertNotSame(security.getNodePassword(), "notsecret", "Wrong password");
assertEquals(security.isRegistrationEnabled(), true, "Wrong isRegistrationEnabled");
assertEquals(security.getRegistrationTime(), null, "Wrong registrationTime");
}

@Test
public void testOpenRegistration() throws Exception {
registrationService.openRegistration(TestConstants.TEST_CLIENT_NODE_GROUP, "00005");
Expand Down

0 comments on commit 799f69e

Please sign in to comment.