Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B10AA200BB4 for ; Tue, 1 Nov 2016 12:04:56 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AF9DB160AF7; Tue, 1 Nov 2016 11:04:56 +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 03F42160AE5 for ; Tue, 1 Nov 2016 12:04:55 +0100 (CET) Received: (qmail 26433 invoked by uid 500); 1 Nov 2016 11:04:55 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 26422 invoked by uid 99); 1 Nov 2016 11:04:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Nov 2016 11:04:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id CC185E0FC4; Tue, 1 Nov 2016 11:04:54 +0000 (UTC) From: aledsage To: dev@brooklyn.apache.org Reply-To: dev@brooklyn.apache.org References: In-Reply-To: Subject: [GitHub] brooklyn-server pull request #390: BROOKLYN-356: fix race in transformer by ... Content-Type: text/plain Message-Id: <20161101110454.CC185E0FC4@git1-us-west.apache.org> Date: Tue, 1 Nov 2016 11:04:54 +0000 (UTC) archived-at: Tue, 01 Nov 2016 11:04:56 -0000 Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/390#discussion_r85909430 --- Diff: core/src/test/java/org/apache/brooklyn/util/core/task/ValueResolverTest.java --- @@ -41,6 +49,125 @@ public void setUp() throws Exception { super.setUp(); } + public void testTimeoutZero() { + Maybe result = Tasks.resolving(newSleepTask(Duration.TEN_SECONDS, "foo")).as(String.class).context(app).timeout(Duration.ZERO).getMaybe(); + Assert.assertFalse(result.isPresent()); + } + + public void testTimeoutBig() { + Maybe result = Tasks.resolving(newSleepTask(Duration.ZERO, "foo")).as(String.class).context(app).timeout(Duration.TEN_SECONDS).getMaybe(); + Assert.assertEquals(result.get(), "foo"); + } + + public void testNoExecutionContextOnCompleted() { --- End diff -- I'll add a comment for what I think it means (I just moved this test, rather than adding it): ``` public void testCompletedTaskReturnsResultImmediately() { // Call ValueResolver.getMaybe() from this thread, which has no execution context. // However, the task has already been submitted and we have waited for it to complete. // Therefore the ValueResolver can simply check for task.isDone() and return its result immediately. ``` I'll also add some more tests for this area of the code. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---