From abec01393bd0323203a43cdae2f533dab6c524fb Mon Sep 17 00:00:00 2001 From: erilong Date: Wed, 24 Oct 2007 15:25:06 +0000 Subject: [PATCH] use "node" instead of "client" --- .../jumpmind/symmetric/SymmetricEngine.java | 2 +- .../org/jumpmind/symmetric/db/IDbDialect.java | 2 +- .../symmetric/load/DataLoaderContext.java | 10 +- .../symmetric/load/IDataLoaderContext.java | 2 +- .../symmetric/load/csv/CsvLoader.java | 2 +- .../symmetric/model/IncomingBatch.java | 16 +- .../symmetric/model/IncomingBatchHistory.java | 16 +- .../org/jumpmind/symmetric/model/Node.java | 8 +- .../symmetric/model/NodeSecurity.java | 4 +- .../symmetric/model/OutgoingBatch.java | 4 +- .../service/IDataExtractorService.java | 2 +- .../service/IIncomingBatchService.java | 4 +- .../symmetric/service/INodeService.java | 6 +- .../service/IRegistrationService.java | 2 +- .../service/impl/BootstrapService.java | 4 +- .../service/impl/DataExtractorService.java | 6 +- .../service/impl/DataLoaderService.java | 6 +- .../service/impl/IncomingBatchService.java | 22 +-- .../symmetric/service/impl/NodeService.java | 20 +- .../symmetric/service/impl/PullService.java | 4 +- .../symmetric/service/impl/PushService.java | 16 +- .../service/impl/RegistrationService.java | 82 ++++---- .../transport/ITransportManager.java | 2 +- .../TransportManagerFactoryBean.java | 6 +- .../transport/http/HttpTransportManager.java | 16 +- .../symmetric/util/RandomTimeSlot.java | 2 +- .../src/main/resources/symmetric-services.xml | 10 +- .../service/impl/DataLoaderServiceTest.java | 4 +- .../service/impl/RegistrationServiceTest.java | 182 +++++++++--------- .../transport/mock/MockTransportManager.java | 4 +- 30 files changed, 232 insertions(+), 234 deletions(-) diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/SymmetricEngine.java b/symmetric/src/main/java/org/jumpmind/symmetric/SymmetricEngine.java index 9371901369..121da0a856 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/SymmetricEngine.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/SymmetricEngine.java @@ -257,7 +257,7 @@ public void heartbeat() { } /** - * Open up registration for client to attach. + * Open up registration for node to attach. * @see IRegistrationService#openRegistration(String, String) */ public void openRegistration(String groupId, String externalId) { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/db/IDbDialect.java b/symmetric/src/main/java/org/jumpmind/symmetric/db/IDbDialect.java index cfc62ba974..436431a142 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/db/IDbDialect.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/db/IDbDialect.java @@ -50,7 +50,7 @@ public void initTrigger(DataEventType dml, Trigger config, public String getTransactionTriggerExpression(); - public String createInitalLoadSqlFor(Node client, Trigger config); + public String createInitalLoadSqlFor(Node node, Trigger config); public String createPurgeSqlFor(Node node, Trigger trig); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/load/DataLoaderContext.java b/symmetric/src/main/java/org/jumpmind/symmetric/load/DataLoaderContext.java index 6a0d2daa6d..d97143a10d 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/load/DataLoaderContext.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/load/DataLoaderContext.java @@ -29,7 +29,7 @@ public class DataLoaderContext implements IDataLoaderContext { private String version; - private String clientId; + private String nodeId; private String tableName; @@ -63,12 +63,12 @@ public void setBatchId(String batchId) { isSkipping = false; } - public String getClientId() { - return clientId; + public String getNodeId() { + return nodeId; } - public void setClientId(String locationId) { - this.clientId = locationId; + public void setNodeId(String nodeId) { + this.nodeId = nodeId; } public String getTableName() { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/load/IDataLoaderContext.java b/symmetric/src/main/java/org/jumpmind/symmetric/load/IDataLoaderContext.java index b72663270a..1223f196d0 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/load/IDataLoaderContext.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/load/IDataLoaderContext.java @@ -25,7 +25,7 @@ public interface IDataLoaderContext { public String getBatchId(); - public String getClientId(); + public String getNodeId(); public String getTableName(); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/load/csv/CsvLoader.java b/symmetric/src/main/java/org/jumpmind/symmetric/load/csv/CsvLoader.java index b3fa787ed8..2136531834 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/load/csv/CsvLoader.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/load/csv/CsvLoader.java @@ -90,7 +90,7 @@ public boolean hasNext() throws IOException { stats = new DataLoaderStatistics(); return true; } else if (tokens[0].equals(CsvConstants.NODEID)) { - context.setClientId(tokens[1]); + context.setNodeId(tokens[1]); } else if (tokens[0].equals(CsvConstants.VERSION)) { context.setVersion(tokens[1] + "." + tokens[2] + "." + tokens[3]); } else if (isMetaTokenParsed(tokens)) { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatch.java b/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatch.java index 128d20ddcb..a07a649374 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatch.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatch.java @@ -35,7 +35,7 @@ public enum Status { private String batchId; - private String clientId; + private String nodeId; private Status status; @@ -46,12 +46,12 @@ public IncomingBatch() { public IncomingBatch(IDataLoaderContext context) { batchId = context.getBatchId(); - clientId = context.getClientId(); + nodeId = context.getNodeId(); status = Status.OK; } - public String getClientBatchId() { - return clientId + "-" + batchId; + public String getNodeBatchId() { + return nodeId + "-" + batchId; } public String getBatchId() { @@ -70,12 +70,12 @@ public void setStatus(Status status) { this.status = status; } - public String getClientId() { - return clientId; + public String getNodeId() { + return nodeId; } - public void setClientId(String clientId) { - this.clientId = clientId; + public void setNodeId(String nodeId) { + this.nodeId = nodeId; } public boolean isRetry() { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatchHistory.java b/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatchHistory.java index fd470ebe17..9838d4f9d4 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatchHistory.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/model/IncomingBatchHistory.java @@ -39,7 +39,7 @@ public enum Status { private String batchId; - private String clientId; + private String nodeId; private Status status; @@ -74,7 +74,7 @@ public IncomingBatchHistory() { public IncomingBatchHistory(IDataLoaderContext context) { batchId = context.getBatchId(); - clientId = context.getClientId(); + nodeId = context.getNodeId(); status = Status.OK; startTime = new Date(); } @@ -91,8 +91,8 @@ public void setValues(IDataLoaderStatistics statistics, boolean isSuccess) { } } - public String getClientBatchId() { - return clientId + "-" + batchId; + public String getNodeBatchId() { + return nodeId + "-" + batchId; } public String getBatchId() { @@ -147,12 +147,12 @@ public String getHostName() { return hostName; } - public String getClientId() { - return clientId; + public String getNodeId() { + return nodeId; } - public void setClientId(String clientId) { - this.clientId = clientId; + public void setNodeId(String nodeId) { + this.nodeId = nodeId; } public Date getStartTime() { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/model/Node.java b/symmetric/src/main/java/org/jumpmind/symmetric/model/Node.java index 197cbd966f..224c60879b 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/model/Node.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/model/Node.java @@ -74,8 +74,8 @@ public Node(IRuntimeConfig runtimeConfig, IDbDialect dbDialect) { setSchemaVersion(runtimeConfig.getSchemaVersion()); } - public Node(String clientId, String syncURL, String version) { - this.nodeId = clientId; + public Node(String nodeId, String syncURL, String version) { + this.nodeId = nodeId; this.syncURL = syncURL; this.schemaVersion = version; } @@ -84,8 +84,8 @@ public String getNodeId() { return nodeId; } - public void setNodeId(String clientId) { - this.nodeId = clientId; + public void setNodeId(String nodeId) { + this.nodeId = nodeId; } public String getSyncURL() { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/model/NodeSecurity.java b/symmetric/src/main/java/org/jumpmind/symmetric/model/NodeSecurity.java index 5feb203a25..20e72c9450 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/model/NodeSecurity.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/model/NodeSecurity.java @@ -39,8 +39,8 @@ public String getNodeId() { return nodeId; } - public void setNodeId(String clientId) { - this.nodeId = clientId; + public void setNodeId(String nodeId) { + this.nodeId = nodeId; } public String getPassword() { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/model/OutgoingBatch.java b/symmetric/src/main/java/org/jumpmind/symmetric/model/OutgoingBatch.java index 259af26ed6..ab49c443fe 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/model/OutgoingBatch.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/model/OutgoingBatch.java @@ -45,8 +45,8 @@ public enum Status { public OutgoingBatch() { } - public OutgoingBatch(Node client, String channelId, BatchType batchType) { - this.nodeId = client.getNodeId(); + public OutgoingBatch(Node node, String channelId, BatchType batchType) { + this.nodeId = node.getNodeId(); this.channelId = channelId; this.status = Status.NE; this.batchType = batchType; diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/IDataExtractorService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/IDataExtractorService.java index 1e69e9acd8..d5665ea37b 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/IDataExtractorService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/IDataExtractorService.java @@ -28,7 +28,7 @@ public interface IDataExtractorService { - public void extractClientIdentityFor(Node client, IOutgoingTransport transport); + public void extractNodeIdentityFor(Node node, IOutgoingTransport transport); public OutgoingBatch extractInitialLoadFor(Node node, Trigger config, IOutgoingTransport transport); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/IIncomingBatchService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/IIncomingBatchService.java index 948b449ebf..737da586e9 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/IIncomingBatchService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/IIncomingBatchService.java @@ -29,9 +29,9 @@ public interface IIncomingBatchService { - public IncomingBatch findIncomingBatch(String batchId, String clientId); + public IncomingBatch findIncomingBatch(String batchId, String nodeId); - public List findIncomingBatchHistory(String batchId, String clientId); + public List findIncomingBatchHistory(String batchId, String nodeId); @Transactional public boolean acquireIncomingBatch(IncomingBatch status); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/INodeService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/INodeService.java index 210ae46149..e99e7720f9 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/INodeService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/INodeService.java @@ -30,15 +30,15 @@ public interface INodeService { - public Node findNode(String clientId); + public Node findNode(String nodeId); public Node findNodeByExternalId(String externalId); - public NodeSecurity findNodeSecurity(String clientId); + public NodeSecurity findNodeSecurity(String nodeId); public void ignoreNodeChannelForExternalId(boolean ignore, String channelId, String externalId); - public boolean isNodeAuthorized(String clientId, String password); + public boolean isNodeAuthorized(String nodeId, String password); public boolean isRegistrationEnabled(String nodeId); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/IRegistrationService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/IRegistrationService.java index 38153db4fd..4fe4b1cac2 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/IRegistrationService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/IRegistrationService.java @@ -28,7 +28,7 @@ public interface IRegistrationService { - public boolean registerNode(Node client, OutputStream out) throws IOException; + public boolean registerNode(Node node, OutputStream out) throws IOException; public void openRegistration(String nodeGroupId, String externalId); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/BootstrapService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/BootstrapService.java index d02c2cea7e..4bed8fabaa 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/BootstrapService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/BootstrapService.java @@ -302,8 +302,8 @@ public void setAutoConfigureDatabase(boolean autoConfigureDatabase) { this.autoConfigureDatabase = autoConfigureDatabase; } - public void setNodeService(INodeService clientService) { - this.nodeService = clientService; + public void setNodeService(INodeService nodeService) { + this.nodeService = nodeService; } public void setTransportManager(ITransportManager transportManager) { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java index e8d84a5b39..8e271cef27 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java @@ -69,7 +69,7 @@ public class DataExtractorService implements IDataExtractorService { private String selectEventDataToExtractSql; - public void extractClientIdentityFor(Node node, IOutgoingTransport transport) { + public void extractNodeIdentityFor(Node node, IOutgoingTransport transport) { String tableName = tablePrefix + "_node_identity"; OutgoingBatch batch = new OutgoingBatch(node, Constants.CHANNEL_CONFIG, BatchType.INITIAL_LOAD); @@ -168,9 +168,9 @@ public boolean extract(Node node, final IExtractListener handler) selectEventDataToExtract(handler, batch); handler.endBatch(batch); - // At this point, we've already sent the data to the client, so if + // At this point, we've already sent the data to the node, so if // updating the batch to 'sent' fails, all this means is that the batch - // will be sent to the client again. This is expected to happen so + // will be sent to the node again. This is expected to happen so // infrequently, that the inefficiencies associated with re-sending a batch // are negligible. outgoingBatchService.markOutgoingBatchSent(batch); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataLoaderService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataLoaderService.java index c284f83772..2692d67c33 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataLoaderService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/DataLoaderService.java @@ -117,7 +117,7 @@ protected List loadDataAndReturnBatches( } catch (Exception e) { if (status != null) { logger.error("Failed to load batch " - + status.getClientBatchId(), e); + + status.getNodeBatchId(), e); history.setValues(dataLoader.getStatistics(), false); handleBatchError(status, history); } else { @@ -179,14 +179,14 @@ protected void handleBatchError(final IncomingBatch status, } } catch (Exception e) { logger.error("Failed to record status of batch " - + status.getClientBatchId()); + + status.getNodeBatchId()); } try { history.setStatus(IncomingBatchHistory.Status.ER); incomingBatchService.insertIncomingBatchHistory(history); } catch (Exception e) { logger.error("Failed to record history of batch " - + status.getClientBatchId()); + + status.getNodeBatchId()); } } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/IncomingBatchService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/IncomingBatchService.java index b19045ebcb..ad1189c9e4 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/IncomingBatchService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/IncomingBatchService.java @@ -50,19 +50,19 @@ public class IncomingBatchService extends AbstractService implements IIncomingBa private boolean skipDuplicateBatches = true; - public IncomingBatch findIncomingBatch(String batchId, String clientId) { + public IncomingBatch findIncomingBatch(String batchId, String nodeId) { try { return (IncomingBatch) jdbcTemplate.queryForObject(findIncomingBatchSql, - new Object[] { batchId, clientId }, new IncomingBatchMapper()); + new Object[] { batchId, nodeId }, new IncomingBatchMapper()); } catch (EmptyResultDataAccessException e) { return null; } } @SuppressWarnings("unchecked") - public List findIncomingBatchHistory(String batchId, String clientId) { + public List findIncomingBatchHistory(String batchId, String nodeId) { return (List) jdbcTemplate.query(findIncomingBatchHistorySql, new Object[] { batchId, - clientId }, new IncomingBatchHistoryMapper()); + nodeId }, new IncomingBatchHistoryMapper()); } public boolean acquireIncomingBatch(IncomingBatch status) { @@ -73,26 +73,26 @@ public boolean acquireIncomingBatch(IncomingBatch status) { status.setRetry(true); okayToProcess = updateIncomingBatch(status) > 0 || (! skipDuplicateBatches); if (okayToProcess) { - logger.warn("Retrying batch " + status.getClientBatchId()); + logger.warn("Retrying batch " + status.getNodeBatchId()); } else { - logger.warn("Skipping batch " + status.getClientBatchId()); + logger.warn("Skipping batch " + status.getNodeBatchId()); } } return okayToProcess; } public void insertIncomingBatch(IncomingBatch status) { - jdbcTemplate.update(insertIncomingBatchSql, new Object[] { status.getBatchId(), status.getClientId(), + jdbcTemplate.update(insertIncomingBatchSql, new Object[] { status.getBatchId(), status.getNodeId(), status.getStatus().toString() }); } public int updateIncomingBatch(IncomingBatch status) { return jdbcTemplate.update(updateIncomingBatchSql, new Object[] { status.getStatus().toString(), - status.getBatchId(), status.getClientId(), IncomingBatch.Status.ER.toString() }); + status.getBatchId(), status.getNodeId(), IncomingBatch.Status.ER.toString() }); } public void insertIncomingBatchHistory(IncomingBatchHistory history) { - jdbcTemplate.update(insertIncomingBatchHistorySql, new Object[] { history.getBatchId(), history.getClientId(), + jdbcTemplate.update(insertIncomingBatchHistorySql, new Object[] { history.getBatchId(), history.getNodeId(), history.getStatus().toString(), history.getHostName(), history.getStatementCount(), history.getFallbackInsertCount(), history.getFallbackUpdateCount(), history.getMissingDeleteCount(), history.getFailedRowNumber(), history.getStartTime(), history.getEndTime() }); @@ -102,7 +102,7 @@ class IncomingBatchMapper implements RowMapper { public Object mapRow(ResultSet rs, int num) throws SQLException { IncomingBatch batch = new IncomingBatch(); batch.setBatchId(rs.getString(1)); - batch.setClientId(rs.getString(2)); + batch.setNodeId(rs.getString(2)); batch.setStatus(IncomingBatch.Status.valueOf(rs.getString(3))); return batch; } @@ -112,7 +112,7 @@ class IncomingBatchHistoryMapper implements RowMapper { public Object mapRow(ResultSet rs, int num) throws SQLException { IncomingBatchHistory history = new IncomingBatchHistory(); history.setBatchId(rs.getString(1)); - history.setClientId(rs.getString(2)); + history.setNodeId(rs.getString(2)); history.setStatus(IncomingBatchHistory.Status.valueOf(rs.getString(3))); history.setStartTime(rs.getTime(4)); history.setEndTime(rs.getTime(5)); diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/NodeService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/NodeService.java index 1b3026a6d0..e08139f398 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/NodeService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/NodeService.java @@ -60,7 +60,7 @@ public class NodeService extends AbstractService implements INodeService { private String findNodeByExternalIdSql; /** - * Lookup a client in the database, which contains information for synching + * Lookup a node in the database, which contains information for synching * with it. */ @SuppressWarnings("unchecked") @@ -93,7 +93,7 @@ public boolean isRegistrationEnabled(String nodeId) { } /** - * Lookup a client_security in the database, which contains private + * Lookup a node_security in the database, which contains private * information used to authenticate. */ @SuppressWarnings("unchecked") @@ -120,8 +120,8 @@ protected T getFirstEntry(List list) { } /** - * Check that the given client and password match in the client_security - * table. A client must authenticate before it's allowed to sync data. + * Check that the given node and password match in the node_security + * table. A node must authenticate before it's allowed to sync data. */ public boolean isNodeAuthorized(String id, String password) { NodeSecurity nodeSecurity = findNodeSecurity(id); @@ -182,12 +182,12 @@ public Object mapRow(ResultSet rs, int num) throws SQLException { class NodeSecurityRowMapper implements RowMapper { public Object mapRow(ResultSet rs, int num) throws SQLException { - NodeSecurity clientSecurity = new NodeSecurity(); - clientSecurity.setNodeId(rs.getString(1)); - clientSecurity.setPassword(rs.getString(2)); - clientSecurity.setRegistrationEnabled(rs.getBoolean(3)); - clientSecurity.setRegistrationTime(rs.getTimestamp(4)); - return clientSecurity; + NodeSecurity nodeSecurity = new NodeSecurity(); + nodeSecurity.setNodeId(rs.getString(1)); + nodeSecurity.setPassword(rs.getString(2)); + nodeSecurity.setRegistrationEnabled(rs.getBoolean(3)); + nodeSecurity.setRegistrationTime(rs.getTimestamp(4)); + return nodeSecurity; } } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PullService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PullService.java index 216b9984e7..930723310b 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PullService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PullService.java @@ -55,8 +55,8 @@ public void pullData() { logger.info("Pull completed"); } - public void setNodeService(INodeService clientService) { - this.nodeService = clientService; + public void setNodeService(INodeService nodeService) { + this.nodeService = nodeService; } public void setDataLoaderService(IDataLoaderService dataLoaderService) { diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PushService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PushService.java index f763922d4b..53bff6ef7a 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PushService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/PushService.java @@ -55,10 +55,10 @@ public void setExtractor(IDataExtractorService extractor) { public void pushData() { info("Push requested"); - List clients = nodeService.findNodesToPushTo(); - if (clients != null) { - for (Node client : clients) { - pushToClient(client); + List nodes = nodeService.findNodesToPushTo(); + if (nodes != null) { + for (Node node : nodes) { + pushToNode(node); } } info("Push request completed"); @@ -102,15 +102,15 @@ public void setTransportManager(ITransportManager tm) { this.transportManager = tm; } - public void setNodeService(INodeService clientService) { - this.nodeService = clientService; + public void setNodeService(INodeService nodeService) { + this.nodeService = nodeService; } public void setAckService(IAcknowledgeService ackService) { this.ackService = ackService; } - private void pushToClient(Node remote) { + private void pushToNode(Node remote) { try { IOutgoingWithResponseTransport transport = transportManager .getPushTransport(remote, nodeService.findIdentity()); @@ -146,7 +146,7 @@ private void pushToClient(Node remote) { logger.warn("Server is not available at this url: " + remote.getSyncURL()); } catch (Exception e) { - // just report the error because we want to push to other clients + // just report the error because we want to push to other nodes // in our list logger.error(e, e); } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/RegistrationService.java b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/RegistrationService.java index fa457bf6f2..b03ee83f8f 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/RegistrationService.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/service/impl/RegistrationService.java @@ -54,33 +54,33 @@ public class RegistrationService extends AbstractService implements private IConfigurationService configurationService; - private String findClientToRegisterSql; + private String findNodeToRegisterSql; - private String registerClientSql; + private String registerNodeSql; - private String registerClientSecuritySql; + private String registerNodeSecuritySql; private String reopenRegistrationSql; - private String openRegistrationClientSql; + private String openRegistrationNodeSql; - private String openRegistrationClientSecuritySql; + private String openRegistrationNodeSecuritySql; /** - * Register a client for the given domain name and domain ID if the + * Register a node for the given domain name and domain ID if the * registration is open. */ public boolean registerNode(Node node, OutputStream out) throws IOException { - String clientId = (String) jdbcTemplate.queryForObject( - findClientToRegisterSql, new Object[] { node.getNodeGroupId(), + String nodeId = (String) jdbcTemplate.queryForObject( + findNodeToRegisterSql, new Object[] { node.getNodeGroupId(), node.getExternalId() }, String.class); - if (clientId == null) { + if (nodeId == null) { return false; } - node.setNodeId(clientId); - jdbcTemplate.update(registerClientSecuritySql, new Object[] { node + node.setNodeId(nodeId); + jdbcTemplate.update(registerNodeSecuritySql, new Object[] { node .getNodeId() }); - jdbcTemplate.update(registerClientSql, new Object[] { + jdbcTemplate.update(registerNodeSql, new Object[] { node.getSyncURL().toString(), node.getSchemaVersion(), node.getDatabaseType(), node.getDatabaseVersion(), node.getSymmetricVersion(), node.getNodeId() }); @@ -88,7 +88,7 @@ public boolean registerNode(Node node, OutputStream out) throws IOException { } /** - * Synchronize client configuration. + * Synchronize node configuration. */ protected boolean writeConfiguration(Node node, OutputStream out) throws IOException { @@ -110,11 +110,11 @@ protected boolean writeConfiguration(Node node, OutputStream out) acknowledgeService.ack(batch.getBatchInfoList()); } } - dataExtractorService.extractClientIdentityFor(node, transport); + dataExtractorService.extractNodeIdentityFor(node, transport); written = true; } else { logger - .error("There were no configuration tables to return to the client. There is a good chance that the system is configured incorrectly."); + .error("There were no configuration tables to return to the node. There is a good chance that the system is configured incorrectly."); } transport.close(); return written; @@ -140,37 +140,37 @@ public void reOpenRegistration(String nodeId) { * for this node group and external ID will be given this information. */ public void openRegistration(String nodeGroup, String externalId) { - String clientId = generateClientId(nodeGroup, externalId); + String nodeId = generateNodeId(nodeGroup, externalId); String password = generatePassword(); - jdbcTemplate.update(openRegistrationClientSql, new Object[] { clientId, + jdbcTemplate.update(openRegistrationNodeSql, new Object[] { nodeId, nodeGroup, externalId }); - jdbcTemplate.update(openRegistrationClientSecuritySql, new Object[] { - clientId, password }); + jdbcTemplate.update(openRegistrationNodeSecuritySql, new Object[] { + nodeId, password }); } /** - * Generate a secure random password for a client. + * Generate a secure random password for a node. */ - // TODO: clientGenerator.generatePassword(); + // TODO: nodeGenerator.generatePassword(); protected String generatePassword() { return new RandomDataImpl().nextSecureHexString(30); } /** - * Generate the next client ID that is available. Try to use the domain ID - * as the client ID. + * Generate the next node ID that is available. Try to use the domain ID + * as the node ID. */ - // TODO: clientGenerator.generateClientId(); - protected String generateClientId(String nodeGroupId, String externalId) { - String clientId = externalId; + // TODO: nodeGenerator.generateNodeId(); + protected String generateNodeId(String nodeGroupId, String externalId) { + String nodeId = externalId; int maxTries = 100; for (int sequence = 0; sequence < maxTries; sequence++) { - if (nodeService.findNode(clientId) == null) { - return clientId; + if (nodeService.findNode(nodeId) == null) { + return nodeId; } - clientId = externalId + "-" + sequence; + nodeId = externalId + "-" + sequence; } - throw new RuntimeException("Could not find clientId for domainId of " + throw new RuntimeException("Could not find nodeId for externalId of " + externalId + " after " + maxTries + " tries."); } @@ -178,29 +178,29 @@ public void setNodeService(INodeService nodeService) { this.nodeService = nodeService; } - public void setOpenRegistrationClientSecuritySql( - String openRegistrationClientSecuritySql) { - this.openRegistrationClientSecuritySql = openRegistrationClientSecuritySql; + public void setOpenRegistrationNodeSecuritySql( + String openRegistrationNodeSecuritySql) { + this.openRegistrationNodeSecuritySql = openRegistrationNodeSecuritySql; } - public void setOpenRegistrationClientSql(String openRegistrationClientSql) { - this.openRegistrationClientSql = openRegistrationClientSql; + public void setOpenRegistrationNodeSql(String openRegistrationNodeSql) { + this.openRegistrationNodeSql = openRegistrationNodeSql; } - public void setRegisterClientSecuritySql(String registerClientSecuritySql) { - this.registerClientSecuritySql = registerClientSecuritySql; + public void setRegisterNodeSecuritySql(String registerNodeSecuritySql) { + this.registerNodeSecuritySql = registerNodeSecuritySql; } - public void setRegisterClientSql(String registerClientSql) { - this.registerClientSql = registerClientSql; + public void setRegisterNodeSql(String registerNodeSql) { + this.registerNodeSql = registerNodeSql; } public void setReopenRegistrationSql(String reopenRegistrationSql) { this.reopenRegistrationSql = reopenRegistrationSql; } - public void setFindClientToRegisterSql(String findClientToRegisterSql) { - this.findClientToRegisterSql = findClientToRegisterSql; + public void setFindNodeToRegisterSql(String findNodeToRegisterSql) { + this.findNodeToRegisterSql = findNodeToRegisterSql; } public void setDataExtractorService( diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/transport/ITransportManager.java b/symmetric/src/main/java/org/jumpmind/symmetric/transport/ITransportManager.java index 435e4da3cd..d9eba91c18 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/transport/ITransportManager.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/transport/ITransportManager.java @@ -37,6 +37,6 @@ public interface ITransportManager { public IOutgoingWithResponseTransport getPushTransport(Node remote, Node local) throws IOException; - public IIncomingTransport getRegisterTransport(Node client) throws IOException; + public IIncomingTransport getRegisterTransport(Node node) throws IOException; } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/transport/TransportManagerFactoryBean.java b/symmetric/src/main/java/org/jumpmind/symmetric/transport/TransportManagerFactoryBean.java index 7d81c2bafa..fc2e8daf69 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/transport/TransportManagerFactoryBean.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/transport/TransportManagerFactoryBean.java @@ -65,11 +65,9 @@ public void setTransport(String transport) { this.transport = transport; } - public void setNodeService(INodeService clientService) + public void setNodeService(INodeService nodeService) { - this.nodeService = clientService; + this.nodeService = nodeService; } - - } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/transport/http/HttpTransportManager.java b/symmetric/src/main/java/org/jumpmind/symmetric/transport/http/HttpTransportManager.java index 01ca5fb336..adaf6d8dab 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/transport/http/HttpTransportManager.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/transport/http/HttpTransportManager.java @@ -54,12 +54,12 @@ public class HttpTransportManager extends AbstractTransportManager implements private IRuntimeConfig runtimeConfiguration; - private INodeService clientService; + private INodeService nodeService; public HttpTransportManager(IRuntimeConfig config, - INodeService clientService) { + INodeService nodeService) { this.runtimeConfiguration = config; - this.clientService = clientService; + this.nodeService = nodeService; } public boolean sendAcknowledgement(Node remote, @@ -161,24 +161,24 @@ private String chooseURL(Node remote) { } private String addSecurityToken(String base, String connector) { - String clientId = clientService.findIdentity().getNodeId(); - StringBuilder sb = new StringBuilder(addNodeId(base, clientId, + String nodeId = nodeService.findIdentity().getNodeId(); + StringBuilder sb = new StringBuilder(addNodeId(base, nodeId, "?")); sb.append(connector); sb.append(WebConstants.SECURITY_TOKEN); sb.append("="); - String securityToken = clientService.findNodeSecurity(clientId) + String securityToken = nodeService.findNodeSecurity(nodeId) .getPassword(); sb.append(securityToken); return sb.toString(); } - private String addNodeId(String base, String clientId, String connector) { + private String addNodeId(String base, String nodeId, String connector) { StringBuilder sb = new StringBuilder(base); sb.append(connector); sb.append(WebConstants.NODE_ID); sb.append("="); - sb.append(clientId); + sb.append(nodeId); return sb.toString(); } diff --git a/symmetric/src/main/java/org/jumpmind/symmetric/util/RandomTimeSlot.java b/symmetric/src/main/java/org/jumpmind/symmetric/util/RandomTimeSlot.java index 395059a44c..de9dc2ef89 100644 --- a/symmetric/src/main/java/org/jumpmind/symmetric/util/RandomTimeSlot.java +++ b/symmetric/src/main/java/org/jumpmind/symmetric/util/RandomTimeSlot.java @@ -26,7 +26,7 @@ /** * Use runtime configuration specific seeding to get a random number for use in time - * slotting clients to help stagger load. + * slotting nodes to help stagger load. */ public class RandomTimeSlot { diff --git a/symmetric/src/main/resources/symmetric-services.xml b/symmetric/src/main/resources/symmetric-services.xml index bde688bc99..e53d9ed63e 100644 --- a/symmetric/src/main/resources/symmetric-services.xml +++ b/symmetric/src/main/resources/symmetric-services.xml @@ -427,21 +427,21 @@ - + select min(c.node_id) from ${sync.table.prefix}_node c inner join ${sync.table.prefix}_node_security s on c.node_id = s.node_id where s.registration_enabled = '1' and c.node_group_id = ? and c.external_id = ? - + update ${sync.table.prefix}_node c set sync_enabled = '1', sync_url = ?, schema_version = ?, database_type = ?, database_version = ?, symmetric_version = ? where node_id = ? - + update ${sync.table.prefix}_node_security set registration_enabled = '0', registration_time = current_timestamp where node_id = ? @@ -453,13 +453,13 @@ '1', registration_time = null where node_id = ? - + insert into ${sync.table.prefix}_node (node_id, node_group_id, external_id) values (?, ?, ?) - + insert into ${sync.table.prefix}_node_security (node_id, password, registration_enabled) values (?, ?, '1') diff --git a/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/DataLoaderServiceTest.java b/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/DataLoaderServiceTest.java index 3729997490..59a4c5130b 100644 --- a/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/DataLoaderServiceTest.java +++ b/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/DataLoaderServiceTest.java @@ -289,8 +289,8 @@ protected void load(ByteArrayOutputStream out) throws Exception { dataLoaderService.loadData(client, null); } - protected IncomingBatch.Status findIncomingBatchStatus(int batchId, String clientId) { - IncomingBatch batch = incomingBatchService.findIncomingBatch(batchId + "", clientId); + protected IncomingBatch.Status findIncomingBatchStatus(int batchId, String nodeId) { + IncomingBatch batch = incomingBatchService.findIncomingBatch(batchId + "", nodeId); IncomingBatch.Status status = null; if (batch != null) { status = batch.getStatus(); diff --git a/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/RegistrationServiceTest.java b/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/RegistrationServiceTest.java index 159f17caea..aa9178e742 100644 --- a/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/RegistrationServiceTest.java +++ b/symmetric/src/test/java/org/jumpmind/symmetric/service/impl/RegistrationServiceTest.java @@ -46,72 +46,72 @@ protected void setUp() { } @Test(groups = "continuous") - public void testRegisterClientFail() throws Exception { - Node client = new Node(); + public void testRegisterNodeFail() throws Exception { + Node node = new Node(); ByteArrayOutputStream out = new ByteArrayOutputStream(); // Existing domain name and ID that is not open to register - client.setNodeGroupId("STORE"); - client.setExternalId("00001"); - Assert.assertFalse(registrationService.registerNode(client, out), - "Client should NOT be allowed to register"); + node.setNodeGroupId("STORE"); + node.setExternalId("00001"); + Assert.assertFalse(registrationService.registerNode(node, out), + "Node should NOT be allowed to register"); // Existing domain name but wrong ID - client.setNodeGroupId("STORE"); - client.setExternalId("wrongId"); - Assert.assertFalse(registrationService.registerNode(client, out), - "Client should NOT be allowed to register"); + node.setNodeGroupId("STORE"); + node.setExternalId("wrongId"); + Assert.assertFalse(registrationService.registerNode(node, out), + "Node should NOT be allowed to register"); // Wrong domain name and wrong ID - client.setNodeGroupId("wrongDomain"); - client.setExternalId("wrongId"); - Assert.assertFalse(registrationService.registerNode(client, out), - "Client should NOT be allowed to register"); + node.setNodeGroupId("wrongDomain"); + node.setExternalId("wrongId"); + Assert.assertFalse(registrationService.registerNode(node, out), + "Node should NOT be allowed to register"); } @Test(groups = "continuous") - public void testRegisterClient() throws Exception { - Node client = new Node(); - client.setNodeGroupId("STORE"); - client.setExternalId("00002"); - client.setSyncURL("http://localhost:8080/sync"); - client.setSchemaVersion("1"); - client.setDatabaseType("MySQL"); - client.setDatabaseVersion("5"); + public void testRegisterNode() throws Exception { + Node node = new Node(); + node.setNodeGroupId("STORE"); + node.setExternalId("00002"); + node.setSyncURL("http://localhost:8080/sync"); + node.setSchemaVersion("1"); + node.setDatabaseType("MySQL"); + node.setDatabaseVersion("5"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be allowed to register"); - - client = nodeService.findNode("00002"); - Assert.assertEquals(client.getNodeId(), "00002", "Wrong clientId"); - Assert.assertEquals(client.getNodeGroupId(), "STORE", "Wrong domainName"); - Assert.assertEquals(client.getExternalId(), "00002", "Wrong domainId"); - Assert.assertEquals(client.getSyncURL().toString(), "http://localhost:8080/sync", "Wrong syncUrl"); - Assert.assertEquals(client.getSchemaVersion(), "1", "Wrong schemaVersion"); - Assert.assertEquals(client.getDatabaseType(), "MySQL", "Wrong databaseType"); - Assert.assertEquals(client.getDatabaseVersion(), "5", "Wrong databaseVersion"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be allowed to register"); + + node = nodeService.findNode("00002"); + Assert.assertEquals(node.getNodeId(), "00002", "Wrong nodeId"); + Assert.assertEquals(node.getNodeGroupId(), "STORE", "Wrong domainName"); + Assert.assertEquals(node.getExternalId(), "00002", "Wrong domainId"); + Assert.assertEquals(node.getSyncURL().toString(), "http://localhost:8080/sync", "Wrong syncUrl"); + Assert.assertEquals(node.getSchemaVersion(), "1", "Wrong schemaVersion"); + Assert.assertEquals(node.getDatabaseType(), "MySQL", "Wrong databaseType"); + Assert.assertEquals(node.getDatabaseVersion(), "5", "Wrong databaseVersion"); NodeSecurity security = nodeService.findNodeSecurity("00002"); - Assert.assertEquals(security.getNodeId(), "00002", "Wrong clientId"); + Assert.assertEquals(security.getNodeId(), "00002", "Wrong nodeId"); Assert.assertNotSame(security.getPassword(), null, "Wrong password"); Assert.assertEquals(security.isRegistrationEnabled(), false, "Wrong isRegistrationEnabled"); Assert.assertNotSame(security.getRegistrationTime(), null, "Wrong registrationTime"); } @Test(groups = "continuous") - public void testRegisterClientWithResponse() throws Exception { + public void testRegisterNodeWithResponse() throws Exception { registrationService.openRegistration("test-root-group", "09999"); - Node client = new Node(); - client.setNodeGroupId("test-root-group"); - client.setExternalId("09999"); - client.setSyncURL("http://localhost:8080/sync"); - client.setSchemaVersion("1"); - client.setDatabaseType("MySQL"); - client.setDatabaseVersion("5"); + Node node = new Node(); + node.setNodeGroupId("test-root-group"); + node.setExternalId("09999"); + node.setSyncURL("http://localhost:8080/sync"); + node.setSchemaVersion("1"); + node.setDatabaseType("MySQL"); + node.setDatabaseVersion("5"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be allowed to register"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be allowed to register"); out.close(); String response = out.toString(); Assert.assertTrue(response.indexOf("batch,") != -1, "Expected batch"); @@ -126,33 +126,33 @@ public void testRegisterClientWithResponse() throws Exception { public void testReOpenRegistration() throws Exception { registrationService.reOpenRegistration("00003"); NodeSecurity security = nodeService.findNodeSecurity("00003"); - Assert.assertEquals(security.getNodeId(), "00003", "Wrong clientId"); + Assert.assertEquals(security.getNodeId(), "00003", "Wrong nodeId"); Assert.assertNotSame(security.getPassword(), "notsecret", "Wrong password"); Assert.assertEquals(security.isRegistrationEnabled(), true, "Wrong isRegistrationEnabled"); Assert.assertEquals(security.getRegistrationTime(), null, "Wrong registrationTime"); - Node client = new Node(); - client.setNodeGroupId("STORE"); - client.setExternalId("00003"); - client.setSyncURL("http://0:8080/sync"); - client.setSchemaVersion("1"); - client.setDatabaseType("hqsql"); - client.setDatabaseVersion("1"); + Node node = new Node(); + node.setNodeGroupId("STORE"); + node.setExternalId("00003"); + node.setSyncURL("http://0:8080/sync"); + node.setSchemaVersion("1"); + node.setDatabaseType("hqsql"); + node.setDatabaseVersion("1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be allowed to register"); - - client = nodeService.findNode("00003"); - Assert.assertEquals(client.getNodeId(), "00003", "Wrong clientId"); - Assert.assertEquals(client.getNodeGroupId(), "STORE", "Wrong domainName"); - Assert.assertEquals(client.getExternalId(), "00003", "Wrong domainId"); - Assert.assertEquals(client.getSyncURL().toString(), "http://0:8080/sync", "Wrong syncUrl"); - Assert.assertEquals(client.getSchemaVersion(), "1", "Wrong schemaVersion"); - Assert.assertEquals(client.getDatabaseType(), "hqsql", "Wrong databaseType"); - Assert.assertEquals(client.getDatabaseVersion(), "1", "Wrong databaseVersion"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be allowed to register"); + + node = nodeService.findNode("00003"); + Assert.assertEquals(node.getNodeId(), "00003", "Wrong nodeId"); + Assert.assertEquals(node.getNodeGroupId(), "STORE", "Wrong domainName"); + Assert.assertEquals(node.getExternalId(), "00003", "Wrong domainId"); + Assert.assertEquals(node.getSyncURL().toString(), "http://0:8080/sync", "Wrong syncUrl"); + Assert.assertEquals(node.getSchemaVersion(), "1", "Wrong schemaVersion"); + Assert.assertEquals(node.getDatabaseType(), "hqsql", "Wrong databaseType"); + Assert.assertEquals(node.getDatabaseVersion(), "1", "Wrong databaseVersion"); security = nodeService.findNodeSecurity("00003"); - Assert.assertEquals(security.getNodeId(), "00003", "Wrong clientId"); + Assert.assertEquals(security.getNodeId(), "00003", "Wrong nodeId"); Assert.assertNotSame(security.getPassword(), "notsecret", "Wrong password"); Assert.assertEquals(security.isRegistrationEnabled(), false, "Wrong isRegistrationEnabled"); Assert.assertNotSame(security.getRegistrationTime(), null, "Wrong registrationTime"); @@ -169,17 +169,17 @@ public void testReOpenRegistrationFail() throws Exception { public void testOpenRegistration() throws Exception { registrationService.openRegistration("STORE", "00005"); - Node client = nodeService.findNode("00005"); - Assert.assertEquals(client.getNodeId(), "00005", "Wrong clientId"); - Assert.assertEquals(client.getNodeGroupId(), "STORE", "Wrong domainName"); - Assert.assertEquals(client.getExternalId(), "00005", "Wrong domainId"); - Assert.assertEquals(client.getSyncURL(), null, "Wrong syncUrl"); - Assert.assertEquals(client.getSchemaVersion(), null, "Wrong schemaVersion"); - Assert.assertEquals(client.getDatabaseType(), null, "Wrong databaseType"); - Assert.assertEquals(client.getDatabaseVersion(), null, "Wrong databaseVersion"); + Node node = nodeService.findNode("00005"); + Assert.assertEquals(node.getNodeId(), "00005", "Wrong nodeId"); + Assert.assertEquals(node.getNodeGroupId(), "STORE", "Wrong domainName"); + Assert.assertEquals(node.getExternalId(), "00005", "Wrong domainId"); + Assert.assertEquals(node.getSyncURL(), null, "Wrong syncUrl"); + Assert.assertEquals(node.getSchemaVersion(), null, "Wrong schemaVersion"); + Assert.assertEquals(node.getDatabaseType(), null, "Wrong databaseType"); + Assert.assertEquals(node.getDatabaseVersion(), null, "Wrong databaseVersion"); NodeSecurity security = nodeService.findNodeSecurity("00005"); - Assert.assertEquals(security.getNodeId(), "00005", "Wrong clientId"); + Assert.assertEquals(security.getNodeId(), "00005", "Wrong nodeId"); Assert.assertNotSame(security.getPassword(), null, "Wrong password"); Assert.assertEquals(security.isRegistrationEnabled(), true, "Wrong isRegistrationEnabled"); Assert.assertEquals(security.getRegistrationTime(), null, "Wrong registrationTime"); @@ -188,32 +188,32 @@ public void testOpenRegistration() throws Exception { @Test(groups = "continuous") public void testOpenRegistrationOnceAndRegisterTwice() throws Exception { registrationService.openRegistration("STORE", "00006"); - Node client = new Node(); - client.setNodeGroupId("STORE"); - client.setExternalId("00006"); - client.setSyncURL("http://127.0.0.1"); + Node node = new Node(); + node.setNodeGroupId("STORE"); + node.setExternalId("00006"); + node.setSyncURL("http://127.0.0.1"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be able to register"); - Assert.assertFalse(registrationService.registerNode(client, out), - "Client should NOT be able to register"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be able to register"); + Assert.assertFalse(registrationService.registerNode(node, out), + "Node should NOT be able to register"); } @Test(groups = "continuous") public void testOpenRegistrationTwiceAndRegisterThrice() throws Exception { registrationService.openRegistration("STORE", "00007"); registrationService.openRegistration("STORE", "00007"); - Node client = new Node(); - client.setNodeGroupId("STORE"); - client.setExternalId("00007"); - client.setSyncURL("http://0"); + Node node = new Node(); + node.setNodeGroupId("STORE"); + node.setExternalId("00007"); + node.setSyncURL("http://0"); ByteArrayOutputStream out = new ByteArrayOutputStream(); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be able to register"); - Assert.assertTrue(registrationService.registerNode(client, out), - "Client should be able to register"); - Assert.assertFalse(registrationService.registerNode(client, out), - "Client should NOT be able to register"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be able to register"); + Assert.assertTrue(registrationService.registerNode(node, out), + "Node should be able to register"); + Assert.assertFalse(registrationService.registerNode(node, out), + "Node should NOT be able to register"); } } diff --git a/symmetric/src/test/java/org/jumpmind/symmetric/transport/mock/MockTransportManager.java b/symmetric/src/test/java/org/jumpmind/symmetric/transport/mock/MockTransportManager.java index 5f42a39a32..27508bd783 100644 --- a/symmetric/src/test/java/org/jumpmind/symmetric/transport/mock/MockTransportManager.java +++ b/symmetric/src/test/java/org/jumpmind/symmetric/transport/mock/MockTransportManager.java @@ -48,7 +48,7 @@ public boolean sendAcknowledgement(Node remote, List list, return true; } - public boolean sendMessage(Node client, String data) throws IOException { + public boolean sendMessage(Node node, String data) throws IOException { return true; } @@ -74,7 +74,7 @@ public void setOutgoingTransport(IOutgoingWithResponseTransport outgoingTranspor this.outgoingTransport = outgoingTransport; } - public IIncomingTransport getRegisterTransport(Node client) throws IOException { + public IIncomingTransport getRegisterTransport(Node node) throws IOException { return incomingTransport; }