brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #390: BROOKLYN-356: fix race in transformer by ...
Date Tue, 01 Nov 2016 11:04:54 GMT
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<String> 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<String> 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.
---

Mime
View raw message