From dev-return-44759-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Thu Feb 14 15:27:08 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7E7211807BC for ; Thu, 14 Feb 2019 16:27:07 +0100 (CET) Received: (qmail 706 invoked by uid 500); 14 Feb 2019 15:27:06 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 633 invoked by uid 99); 14 Feb 2019 15:27:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2019 15:27:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2061CC224E for ; Thu, 14 Feb 2019 15:27:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id XNnZRwHLjneL for ; Thu, 14 Feb 2019 15:27:04 +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 62CBB6220C for ; Thu, 14 Feb 2019 15:27:03 +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 208B3E2792 for ; Thu, 14 Feb 2019 15:27:03 +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 EABFB244CD for ; Thu, 14 Feb 2019 15:27:00 +0000 (UTC) Date: Thu, 14 Feb 2019 15:27:00 +0000 (UTC) From: "Ivan Bessonov (JIRA)" To: dev@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IGNITE-11323) Reduce boilerplate "System.setProperty" code in tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Ivan Bessonov created IGNITE-11323: -------------------------------------- Summary: Reduce boilerplate "System.setProperty" code in tests Key: IGNITE-11323 URL: https://issues.apache.org/jira/browse/IGNITE-11323 Project: Ignite Issue Type: Test Reporter: Ivan Bessonov Assignee: Ivan Bessonov There are many examples in tests where some property gets new value in "bef= oreTestsStarted"/"beforeTest"/"beginning of test method" and then gets its = previous value in "afterTestsStopped"/"afterTest"/"finally block of test me= thod". This approach leads to excessive code that can be avoided. I suggest implementing annotation "WithSystemProperty" (name is the subject= to discussion) that will allow us to write this: {code:java} @Test @WithSystemProperty(key =3D IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK, va= lue =3D "true") public void testSkipCheckConsistencyFlagEnabled() throws Exception { ... } {code} instead of this: {code:java} @Test public void testSkipCheckConsistencyFlagEnabled() throws Exception { String backup =3D System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTE= NCY_CHECK, "true"); try { ... } finally { if (backup !=3D null) System.setProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK,= backup); else System.clearProperty(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHEC= K); } } {code} =C2=A0 There's also has to be ability to use this annotation on test class so new = value of system properties will be used in all of its test methods. -- This message was sent by Atlassian JIRA (v7.6.3#76005)