flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arv...@apache.org
Subject svn commit: r1308164 - in /incubator/flume/trunk/flume-ng-sdk/src: main/java/org/apache/flume/api/RpcClientFactory.java test/java/org/apache/flume/api/TestRpcClientFactory.java
Date Sun, 01 Apr 2012 18:03:35 GMT
Author: arvind
Date: Sun Apr  1 18:03:34 2012
New Revision: 1308164

URL: http://svn.apache.org/viewvc?rev=1308164&view=rev
Log:
FLUME-1087. Restore Client API compatibility with v1.1.0.

(Mike Percy via Arvind Prabhakar)

Modified:
    incubator/flume/trunk/flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java
    incubator/flume/trunk/flume-ng-sdk/src/test/java/org/apache/flume/api/TestRpcClientFactory.java

Modified: incubator/flume/trunk/flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/flume/trunk/flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java?rev=1308164&r1=1308163&r2=1308164&view=diff
==============================================================================
--- incubator/flume/trunk/flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java
(original)
+++ incubator/flume/trunk/flume-ng-sdk/src/main/java/org/apache/flume/api/RpcClientFactory.java
Sun Apr  1 18:03:34 2012
@@ -86,6 +86,18 @@ public class RpcClientFactory {
   }
 
   /**
+   * Deprecated. Use
+   * {@link getDefaultInstance() getDefaultInstance(String, Integer)} instead.
+   * @throws FlumeException
+   * @deprecated
+   */
+  @Deprecated
+  public static RpcClient getInstance(String hostname, Integer port)
+      throws FlumeException {
+    return getDefaultInstance(hostname, port);
+  }
+
+  /**
    * Returns an instance of {@link RpcClient} connected to the specified
    * {@code hostname} and {@code port}.
    * @throws FlumeException
@@ -97,6 +109,19 @@ public class RpcClientFactory {
   }
 
   /**
+   * Deprecated. Use
+   * {@link getDefaultInstance() getDefaultInstance(String, Integer, Integer)}
+   * instead.
+   * @throws FlumeException
+   * @deprecated
+   */
+  @Deprecated
+  public static RpcClient getInstance(String hostname, Integer port,
+      Integer batchSize) throws FlumeException {
+    return getDefaultInstance(hostname, port, batchSize);
+  }
+
+  /**
    * Returns an instance of {@link RpcClient} connected to the specified
    * {@code hostname} and {@code port} with the specified {@code batchSize}.
    * @throws FlumeException

Modified: incubator/flume/trunk/flume-ng-sdk/src/test/java/org/apache/flume/api/TestRpcClientFactory.java
URL: http://svn.apache.org/viewvc/incubator/flume/trunk/flume-ng-sdk/src/test/java/org/apache/flume/api/TestRpcClientFactory.java?rev=1308164&r1=1308163&r2=1308164&view=diff
==============================================================================
--- incubator/flume/trunk/flume-ng-sdk/src/test/java/org/apache/flume/api/TestRpcClientFactory.java
(original)
+++ incubator/flume/trunk/flume-ng-sdk/src/test/java/org/apache/flume/api/TestRpcClientFactory.java
Sun Apr  1 18:03:34 2012
@@ -28,6 +28,7 @@ import org.apache.flume.api.RpcTestUtils
 import org.junit.Test;
 
 import org.apache.flume.event.EventBuilder;
+import org.junit.Assert;
 
 /**
  * Very light testing on the factory. The heavy testing is done on the test
@@ -51,6 +52,37 @@ public class TestRpcClientFactory {
     }
   }
 
+  // testing deprecated API
+  @Test
+  public void testTwoParamDeprecatedAppend() throws FlumeException,
+      EventDeliveryException {
+    RpcClient client = null;
+    Server server = RpcTestUtils.startServer(new OKAvroHandler());
+    try {
+      client = RpcClientFactory.getInstance(localhost, server.getPort());
+      client.append(EventBuilder.withBody("wheee!!!", Charset.forName("UTF8")));
+    } finally {
+      RpcTestUtils.stopServer(server);
+      if (client != null) client.close();
+    }
+  }
+
+  // testing deprecated API
+  @Test
+  public void testThreeParamDeprecatedAppend() throws FlumeException,
+      EventDeliveryException {
+    RpcClient client = null;
+    Server server = RpcTestUtils.startServer(new OKAvroHandler());
+    try {
+      client = RpcClientFactory.getInstance(localhost, server.getPort(), 3);
+      Assert.assertEquals("Batch size was specified", 3, client.getBatchSize());
+      client.append(EventBuilder.withBody("wheee!!!", Charset.forName("UTF8")));
+    } finally {
+      RpcTestUtils.stopServer(server);
+      if (client != null) client.close();
+    }
+  }
+
   @Test
   public void testThreeParamBatchAppend() throws FlumeException,
       EventDeliveryException {



Mime
View raw message