From issues-return-147110-archive-asf-public=cust-asf.ponee.io@flink.apache.org Wed Jan 10 07:36:04 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 6830C18062E for ; Wed, 10 Jan 2018 07:36:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 573B6160C2E; Wed, 10 Jan 2018 06:36:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A5A8A160C23 for ; Wed, 10 Jan 2018 07:36:03 +0100 (CET) Received: (qmail 17051 invoked by uid 500); 10 Jan 2018 06:36:02 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 17042 invoked by uid 99); 10 Jan 2018 06:36:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jan 2018 06:36:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 5D3281A067C for ; Wed, 10 Jan 2018 06:36:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.911 X-Spam-Level: X-Spam-Status: No, score=-99.911 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id K6ezq6IC5JJU for ; Wed, 10 Jan 2018 06:36:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E73955F22E for ; Wed, 10 Jan 2018 06:36:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5AAA6E023C for ; Wed, 10 Jan 2018 06:36:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 15816212F8 for ; Wed, 10 Jan 2018 06:36:00 +0000 (UTC) Date: Wed, 10 Jan 2018 06:36:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-8306) FlinkKafkaConsumerBaseTest has invalid mocks on final methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FLINK-8306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16319763#comment-16319763 ] ASF GitHub Bot commented on FLINK-8306: --------------------------------------- Github user tzulitai commented on a diff in the pull request: https://github.com/apache/flink/pull/5200#discussion_r160598939 --- Diff: flink-connectors/flink-connector-kafka-base/src/test/java/org/apache/flink/streaming/connectors/kafka/FlinkKafkaConsumerBaseTest.java --- @@ -89,30 +90,44 @@ @SuppressWarnings("unchecked") public void testEitherWatermarkExtractor() { try { - new DummyFlinkKafkaConsumer(mock(AbstractFetcher.class), mock(AbstractPartitionDiscoverer.class), false) + new DummyFlinkKafkaConsumer( + mock(AbstractFetcher.class), + mock(AbstractPartitionDiscoverer.class), + mock(KafkaOffsetCommitter.class), + false) .assignTimestampsAndWatermarks((AssignerWithPeriodicWatermarks) null); fail(); } catch (NullPointerException ignored) {} try { - new DummyFlinkKafkaConsumer(mock(AbstractFetcher.class), mock(AbstractPartitionDiscoverer.class), false) + new DummyFlinkKafkaConsumer( + mock(AbstractFetcher.class), + mock(AbstractPartitionDiscoverer.class), + mock(KafkaOffsetCommitter.class), + false) .assignTimestampsAndWatermarks((AssignerWithPunctuatedWatermarks) null); fail(); } catch (NullPointerException ignored) {} final AssignerWithPeriodicWatermarks periodicAssigner = mock(AssignerWithPeriodicWatermarks.class); final AssignerWithPunctuatedWatermarks punctuatedAssigner = mock(AssignerWithPunctuatedWatermarks.class); - DummyFlinkKafkaConsumer c1 = - new DummyFlinkKafkaConsumer<>(mock(AbstractFetcher.class), mock(AbstractPartitionDiscoverer.class), false); + DummyFlinkKafkaConsumer c1 = new DummyFlinkKafkaConsumer<>( + mock(AbstractFetcher.class), + mock(AbstractPartitionDiscoverer.class), + mock(KafkaOffsetCommitter.class), --- End diff -- Will do. > FlinkKafkaConsumerBaseTest has invalid mocks on final methods > ------------------------------------------------------------- > > Key: FLINK-8306 > URL: https://issues.apache.org/jira/browse/FLINK-8306 > Project: Flink > Issue Type: Bug > Components: Kafka Connector, Tests > Reporter: Tzu-Li (Gordon) Tai > Assignee: Tzu-Li (Gordon) Tai > Priority: Critical > Fix For: 1.5.0, 1.4.1 > > > The {{FlinkKafkaConsumerBaseTest}} has invalid mocks on a final {{AbstractFetcher::commitInternalOffsetsToKafka(...)}} method. While an easy fix would be to simply make that method non-final, that is not ideal since it would be best that the method is left final to prevent overrides in subclasses. > This suggests that offset committing functionality is too tightly coupled with the {{AbstractFetcher}}, making it hard to perform concise tests to verify offset committing. > I suggest that we decouple record fetching and offset committing as separate services behind different interfaces. We should introduce a new interface, say {{KafkaOffsetCommitter}}, and test against that instead. Initially, we can simply let {{AbstractFetcher}} implement {{KafkaOffsetCommitter}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)