You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/08/01 17:35:46 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8205: Fixed a bug in HttpPostEmitter leading to ClassCastException

leventov commented on a change in pull request #8205: Fixed a bug in HttpPostEmitter leading to ClassCastException
URL: https://github.com/apache/incubator-druid/pull/8205#discussion_r309815207
 
 

 ##########
 File path: core/src/test/java/org/apache/druid/java/util/emitter/core/HttpPostEmitterTest.java
 ##########
 @@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.java.util.emitter.core;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.primitives.Ints;
+import org.asynchttpclient.ListenableFuture;
+import org.asynchttpclient.Request;
+import org.asynchttpclient.Response;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class HttpPostEmitterTest
+{
+
+  private static final ObjectMapper objectMapper = new ObjectMapper()
+  {
+    @Override
+    public byte[] writeValueAsBytes(Object value)
+    {
+      return Ints.toByteArray(((IntEvent) value).index);
+    }
+  };
+
+  private final MockHttpClient httpClient = new MockHttpClient();
+
+  @Before
+  public void setup()
+  {
+    httpClient.setGoHandler(new GoHandler()
+    {
+      @Override
+      protected ListenableFuture<Response> go(Request request)
+      {
+        return GoHandlers.immediateFuture(EmitterTest.okResponse());
+      }
+    });
+  }
+
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testRecoveryEmitAndReturnBatch()
+      throws InterruptedException, IOException, NoSuchFieldException, IllegalAccessException
 
 Review comment:
   Side note: in Druid, we usually just add `throws Exception` if there is more than one. I don't think there may be any hard in doing that.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org