Repository: incubator-nifi Updated Branches: refs/heads/nifi-site-to-site-client 46eebc77a -> 7ab4392c1
NIFI-282: Allow Builder to be populated from SiteToSiteClientConfig object Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/7ab4392c Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/7ab4392c Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/7ab4392c Branch: refs/heads/nifi-site-to-site-client Commit: 7ab4392c1571fffaea1f07fd7a17279122fa3fed Parents: 46eebc7 Author: Mark Payne <[email protected]> Authored: Tue Feb 17 10:46:29 2015 -0500 Committer: Mark Payne <[email protected]> Committed: Tue Feb 17 10:46:29 2015 -0500 ---------------------------------------------------------------------- .../nifi/remote/client/SiteToSiteClient.java | 23 ++++++++++++++++++++ .../client/socket/TestSiteToSiteClient.java | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/7ab4392c/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/SiteToSiteClient.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/SiteToSiteClient.java b/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/SiteToSiteClient.java index 5f84382..629032a 100644 --- a/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/SiteToSiteClient.java +++ b/nifi/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/SiteToSiteClient.java @@ -141,6 +141,29 @@ public interface SiteToSiteClient extends Closeable { private long batchNanos; /** + * Populates the builder with values from the provided config + * @param config + * @return + */ + public Builder fromConfig(final SiteToSiteClientConfig config) { + this.url = config.getUrl(); + this.timeoutNanos = config.getTimeout(TimeUnit.NANOSECONDS); + this.penalizationNanos = config.getPenalizationPeriod(TimeUnit.NANOSECONDS); + this.idleExpirationNanos = config.getIdleConnectionExpiration(TimeUnit.NANOSECONDS); + this.sslContext = config.getSslContext(); + this.eventReporter = config.getEventReporter(); + this.peerPersistenceFile = config.getPeerPersistenceFile(); + this.useCompression = config.isUseCompression(); + this.portName = config.getPortName(); + this.portIdentifier = config.getPortIdentifier(); + this.batchCount = config.getPreferredBatchCount(); + this.batchSize = config.getPreferredBatchSize(); + this.batchNanos = config.getPreferredBatchDuration(TimeUnit.NANOSECONDS); + + return this; + } + + /** * Specifies the URL of the remote NiFi instance. If this URL points to the Cluster Manager of * a NiFi cluster, data transfer to and from nodes will be automatically load balanced across * the different nodes. http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/7ab4392c/nifi/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java ---------------------------------------------------------------------- diff --git a/nifi/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java b/nifi/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java index 0f48b03..b73e44d 100644 --- a/nifi/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java +++ b/nifi/nifi-commons/nifi-site-to-site-client/src/test/java/org/apache/nifi/remote/client/socket/TestSiteToSiteClient.java @@ -36,7 +36,7 @@ import org.junit.Test; public class TestSiteToSiteClient { @Test - //@Ignore("For local testing only; not really a unit test but a manual test") + @Ignore("For local testing only; not really a unit test but a manual test") public void testReceive() throws IOException { System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi.remote", "DEBUG");
