Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 041A618C3A for ; Sun, 14 Feb 2016 19:03:59 +0000 (UTC) Received: (qmail 52888 invoked by uid 500); 14 Feb 2016 19:03:58 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 52807 invoked by uid 500); 14 Feb 2016 19:03:58 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 52796 invoked by uid 99); 14 Feb 2016 19:03:58 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Feb 2016 19:03:58 +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 3CA8E1A0660 for ; Sun, 14 Feb 2016 19:03:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.471 X-Spam-Level: * X-Spam-Status: No, score=1.471 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.329] autolearn=disabled Received: from mx2-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 HmWS2Yv20dVD for ; Sun, 14 Feb 2016 19:03:57 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 90D2D5FAD8 for ; Sun, 14 Feb 2016 19:03:56 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 0AEDFE019D for ; Sun, 14 Feb 2016 19:03:56 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 0B50B3A0256 for ; Sun, 14 Feb 2016 19:03:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1730382 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java Date: Sun, 14 Feb 2016 19:03:56 -0000 To: commits@commons.apache.org From: oheger@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160214190356.0B50B3A0256@svn01-us-west.apache.org> Author: oheger Date: Sun Feb 14 19:03:55 2016 New Revision: 1730382 URL: http://svn.apache.org/viewvc?rev=1730382&view=rev Log: [CONFIGURATION-619] Implemented inheritFrom() in PropertiesBuilderParametersImpl. Here some more properties are taken into account. Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java?rev=1730382&r1=1730381&r2=1730382&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java (original) +++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java Sun Feb 14 19:03:55 2016 @@ -16,6 +16,8 @@ */ package org.apache.commons.configuration2.builder; +import java.util.Map; + import org.apache.commons.configuration2.PropertiesConfiguration.IOFactory; import org.apache.commons.configuration2.PropertiesConfigurationLayout; @@ -59,6 +61,17 @@ public class PropertiesBuilderParameters return this; } + /** + * {@inheritDoc} This implementation takes some more properties into account + * that are defined in this class. + */ + @Override + public void inheritFrom(Map source) + { + super.inheritFrom(source); + copyPropertiesFrom(source, PROP_INCLUDES_ALLOWED, PROP_IO_FACTORY); + } + @Override public PropertiesBuilderParametersImpl setLayout( PropertiesConfigurationLayout layout) Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java?rev=1730382&r1=1730381&r2=1730382&view=diff ============================================================================== --- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java (original) +++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java Sun Feb 14 19:03:55 2016 @@ -17,6 +17,7 @@ package org.apache.commons.configuration2.builder; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import java.util.Map; @@ -103,4 +104,28 @@ public class TestPropertiesBuilderParame assertSame("Factory not set", factory, params.getParameters().get("iOFactory")); } + + /** + * Tests whether properties can be inherited. + */ + @Test + public void testInheritFrom() + { + PropertiesConfiguration.IOFactory factory = + EasyMock.createMock(PropertiesConfiguration.IOFactory.class); + params.setIOFactory(factory).setIncludesAllowed(false) + .setLayout(new PropertiesConfigurationLayout()); + params.setThrowExceptionOnMissing(true); + PropertiesBuilderParametersImpl params2 = + new PropertiesBuilderParametersImpl(); + + params2.inheritFrom(params.getParameters()); + Map parameters = params2.getParameters(); + assertEquals("Exception flag not set", Boolean.TRUE, + parameters.get("throwExceptionOnMissing")); + assertEquals("IOFactory not set", factory, parameters.get("iOFactory")); + assertEquals("Include flag not set", Boolean.FALSE, + parameters.get("includesAllowed")); + assertNull("Layout was copied", parameters.get("layout")); + } }