Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-2454

Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0, 2.5.0, 2.4.1
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      The variable UNBOUNDED implement the abstract class Resources, and override the function compareTo. But there is something wrong in this function. We should not compare resources with zero as the same as the variable NONE. We should change 0 to Integer.MAX_VALUE.

      1. YARN-2454 -v2.patch
        3 kB
        Xu Yang
      2. YARN-2454-patch.diff
        0.9 kB
        Beckham007
      3. YARN-2454.patch
        3 kB
        Xu Yang

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Hadoop-Hdfs-trunk-Java8 #173 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/173/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/CHANGES.txt
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Hdfs-trunk-Java8 #173 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/173/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Hadoop-Mapreduce-trunk #2132 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2132/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/CHANGES.txt
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Mapreduce-trunk #2132 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2132/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Hadoop-Hdfs-trunk #2114 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2114/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        • hadoop-yarn-project/CHANGES.txt
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Hdfs-trunk #2114 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2114/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java hadoop-yarn-project/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #183 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/183/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/CHANGES.txt
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Mapreduce-trunk-Java8 #183 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/183/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/CHANGES.txt hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #182 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/182/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #182 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/182/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/CHANGES.txt
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-Yarn-trunk #916 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/916/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/CHANGES.txt
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #916 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/916/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/CHANGES.txt hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Hadoop-trunk-Commit #7717 (See https://builds.apache.org/job/Hadoop-trunk-Commit/7717/)
        YARN-2454. Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6)

        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java
        • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java
        • hadoop-yarn-project/CHANGES.txt
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Hadoop-trunk-Commit #7717 (See https://builds.apache.org/job/Hadoop-trunk-Commit/7717/ ) YARN-2454 . Fix compareTo of variable UNBOUNDED in o.a.h.y.util.resource.Resources. Contributed by Xu Yang. (junping_du: rev 57d9a972cbd62aae0ab010d38a0973619972edd6) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/Resources.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/util/resource/TestResources.java hadoop-yarn-project/CHANGES.txt
        Hide
        djp Junping Du added a comment -

        Also, Congratulation to Xu Yang for the first patch contribution to Apache Hadoop!

        Show
        djp Junping Du added a comment - Also, Congratulation to Xu Yang for the first patch contribution to Apache Hadoop!
        Hide
        djp Junping Du added a comment -

        I have commit this to trunk and branch-2. Thanks Xu Yang for contributing the patch and Tsuyoshi Ozawa for review!

        Show
        djp Junping Du added a comment - I have commit this to trunk and branch-2. Thanks Xu Yang for contributing the patch and Tsuyoshi Ozawa for review!
        Hide
        hadoopqa Hadoop QA added a comment -



        +1 overall



        Vote Subsystem Runtime Comment
        0 pre-patch 14m 37s Pre-patch trunk compilation is healthy.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 tests included 0m 0s The patch appears to include 1 new or modified test files.
        +1 javac 7m 36s There were no new javac warning messages.
        +1 javadoc 9m 39s There were no new javadoc warning messages.
        +1 release audit 0m 22s The applied patch does not increase the total number of release audit warnings.
        +1 checkstyle 0m 54s There were no new checkstyle issues.
        +1 whitespace 0m 0s The patch has no lines that end in whitespace.
        +1 install 1m 31s mvn install still works.
        +1 eclipse:eclipse 0m 35s The patch built with eclipse:eclipse.
        +1 findbugs 1m 24s The patch does not introduce any new Findbugs (version 2.0.3) warnings.
        +1 yarn tests 1m 55s Tests passed in hadoop-yarn-common.
            38m 37s  



        Subsystem Report/Notes
        Patch URL http://issues.apache.org/jira/secure/attachment/12664364/YARN-2454%20-v2.patch
        Optional Tests javadoc javac unit findbugs checkstyle
        git revision trunk / f1a152c
        hadoop-yarn-common test log https://builds.apache.org/job/PreCommit-YARN-Build/7592/artifact/patchprocess/testrun_hadoop-yarn-common.txt
        Test Results https://builds.apache.org/job/PreCommit-YARN-Build/7592/testReport/
        Java 1.7.0_55
        uname Linux asf907.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Console output https://builds.apache.org/job/PreCommit-YARN-Build/7592/console

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 pre-patch 14m 37s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 tests included 0m 0s The patch appears to include 1 new or modified test files. +1 javac 7m 36s There were no new javac warning messages. +1 javadoc 9m 39s There were no new javadoc warning messages. +1 release audit 0m 22s The applied patch does not increase the total number of release audit warnings. +1 checkstyle 0m 54s There were no new checkstyle issues. +1 whitespace 0m 0s The patch has no lines that end in whitespace. +1 install 1m 31s mvn install still works. +1 eclipse:eclipse 0m 35s The patch built with eclipse:eclipse. +1 findbugs 1m 24s The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 yarn tests 1m 55s Tests passed in hadoop-yarn-common.     38m 37s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12664364/YARN-2454%20-v2.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / f1a152c hadoop-yarn-common test log https://builds.apache.org/job/PreCommit-YARN-Build/7592/artifact/patchprocess/testrun_hadoop-yarn-common.txt Test Results https://builds.apache.org/job/PreCommit-YARN-Build/7592/testReport/ Java 1.7.0_55 uname Linux asf907.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-YARN-Build/7592/console This message was automatically generated.
        Hide
        djp Junping Du added a comment -

        Patch LGTM. Kick off Jenkins again, +1 based on Jenkins' results.

        Show
        djp Junping Du added a comment - Patch LGTM. Kick off Jenkins again, +1 based on Jenkins' results.
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        Thanks for your updating, Xu Yang. It sounds reasonable. Let's waiting for review by committers.

        Show
        ozawa Tsuyoshi Ozawa added a comment - Thanks for your updating, Xu Yang . It sounds reasonable. Let's waiting for review by committers.
        Hide
        hadoopqa Hadoop QA added a comment -

        +1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12664364/YARN-2454%20-v2.patch
        against trunk revision .

        +1 @author. The patch does not contain any @author tags.

        +1 tests included. The patch appears to include 1 new or modified test files.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-YARN-Build/4734//testReport/
        Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4734//console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12664364/YARN-2454%20-v2.patch against trunk revision . +1 @author . The patch does not contain any @author tags. +1 tests included . The patch appears to include 1 new or modified test files. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 core tests . The patch passed unit tests in hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common. +1 contrib tests . The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-YARN-Build/4734//testReport/ Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4734//console This message is automatically generated.
        Hide
        yxls123123 Xu Yang added a comment -

        Endo Tsuyoshi, Thank you for your suggest. I genetate a new patch at root directory.
        About moving these tests to org.apache.hadoop.yarn.server.resourcemanager.resource.Resources, I think it will be strange. Whereas moving the latter to the file that I created is a better way.

        Show
        yxls123123 Xu Yang added a comment - Endo Tsuyoshi , Thank you for your suggest. I genetate a new patch at root directory. About moving these tests to org.apache.hadoop.yarn.server.resourcemanager.resource.Resources, I think it will be strange. Whereas moving the latter to the file that I created is a better way.
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        Xu Yang, please generate your patch at root directory of the source code.

        Additional minor nits: how about moving the tests to org.apache.hadoop.yarn.server.resource.TestResorces instead of adding a new file?

        Show
        ozawa Tsuyoshi Ozawa added a comment - Xu Yang , please generate your patch at root directory of the source code. Additional minor nits: how about moving the tests to org.apache.hadoop.yarn.server.resource.TestResorces instead of adding a new file?
        Hide
        hadoopqa Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12664350/YARN-2454.patch
        against trunk revision .

        -1 patch. The patch command could not apply the patch.

        Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4733//console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12664350/YARN-2454.patch against trunk revision . -1 patch . The patch command could not apply the patch. Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4733//console This message is automatically generated.
        Hide
        yxls123123 Xu Yang added a comment -

        Thank you for your suggest, Beckham007, Tsuyoshi OZAWA and Wei Yan. I fixed it and added two Tests.

        Show
        yxls123123 Xu Yang added a comment - Thank you for your suggest, Beckham007, Tsuyoshi OZAWA and Wei Yan. I fixed it and added two Tests.
        Hide
        hadoopqa Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12664331/YARN-2454-patch.diff
        against trunk revision .

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common.

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-YARN-Build/4732//testReport/
        Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4732//console

        This message is automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12664331/YARN-2454-patch.diff against trunk revision . +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. +1 core tests . The patch passed unit tests in hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common. +1 contrib tests . The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-YARN-Build/4732//testReport/ Console output: https://builds.apache.org/job/PreCommit-YARN-Build/4732//console This message is automatically generated.
        Hide
        beckham007 Beckham007 added a comment -

        I have talked with Xu Yang, he will update this patch. Thanks~

        Show
        beckham007 Beckham007 added a comment - I have talked with Xu Yang , he will update this patch. Thanks~
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        Also, the first testCompareToWithNoneResource is correct. Please ignore latter one.

        Show
        ozawa Tsuyoshi Ozawa added a comment - Also, the first testCompareToWithNoneResource is correct. Please ignore latter one.
        Hide
        ywskycn Wei Yan added a comment -

        One more thing, the "NONE" also need to update to UNBOUNDED.

            @Override
            public void setMemory(int memory) {
              throw new RuntimeException("NONE cannot be modified!");
            }
            @Override
            public void setVirtualCores(int cores) {
              throw new RuntimeException("NONE cannot be modified!");
            }
        
        Show
        ywskycn Wei Yan added a comment - One more thing, the "NONE" also need to update to UNBOUNDED. @Override public void setMemory( int memory) { throw new RuntimeException( "NONE cannot be modified!" ); } @Override public void setVirtualCores( int cores) { throw new RuntimeException( "NONE cannot be modified!" ); }
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        Oops, you're right. Could you update it?

        Show
        ozawa Tsuyoshi Ozawa added a comment - Oops, you're right. Could you update it?
        Hide
        beckham007 Beckham007 added a comment -

        Hi, Tsuyoshi Ozawa. It could be "assertTrue(Resources.unbounded().compareTo(
        createResource(Integer.MAX_VALUE, 0)) > 0)" ?

        Show
        beckham007 Beckham007 added a comment - Hi, Tsuyoshi Ozawa . It could be "assertTrue(Resources.unbounded().compareTo( createResource(Integer.MAX_VALUE, 0)) > 0)" ?
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        sorry, testCompareToWithNoneResource is wrong. A fixed version is as follows:

          @Test(timeout=1000)
          public void testCompareToWithNoneResource() {
            assertTrue(Resources.none().compareTo(createResource(0, 0)) == 0);
            assertTrue(Resources.none().compareTo(
                createResource(1, 0)) > 0);
            assertTrue(Resources.none().compareTo(
                createResource(0, 1)) > 0);
          }
        
        Show
        ozawa Tsuyoshi Ozawa added a comment - sorry, testCompareToWithNoneResource is wrong. A fixed version is as follows: @Test(timeout=1000) public void testCompareToWithNoneResource() { assertTrue(Resources.none().compareTo(createResource(0, 0)) == 0); assertTrue(Resources.none().compareTo( createResource(1, 0)) > 0); assertTrue(Resources.none().compareTo( createResource(0, 1)) > 0); }
        Hide
        ozawa Tsuyoshi Ozawa added a comment -

        Thanks for your contribution, Beckham007. The fix itself looks good to me. How about adding tests to TestResources like this?

          @Test(timeout=1000)
          public void testCompareToWithUnboundedResource() {
            assertTrue(Resources.unbounded().compareTo(
                    createResource(Integer.MAX_VALUE, Integer.MAX_VALUE)) == 0);
            assertTrue(Resources.unbounded().compareTo(
                createResource(Integer.MAX_VALUE, 0)) < 0);
            assertTrue(Resources.unbounded().compareTo(
                createResource(0, Integer.MAX_VALUE)) < 0);
          }
        
          @Test(timeout=1000)
          public void testCompareToWithNoneResource() {
            assertTrue(Resources.none().compareTo(createResource(0, 0)) == 0);
            assertTrue(Resources.none().compareTo(
                createResource(1, 0)) < 0);
            assertTrue(Resources.none().compareTo(
                createResource(0, 1)) < 0);
          }
        
        Show
        ozawa Tsuyoshi Ozawa added a comment - Thanks for your contribution, Beckham007 . The fix itself looks good to me. How about adding tests to TestResources like this? @Test(timeout=1000) public void testCompareToWithUnboundedResource() { assertTrue(Resources.unbounded().compareTo( createResource( Integer .MAX_VALUE, Integer .MAX_VALUE)) == 0); assertTrue(Resources.unbounded().compareTo( createResource( Integer .MAX_VALUE, 0)) < 0); assertTrue(Resources.unbounded().compareTo( createResource(0, Integer .MAX_VALUE)) < 0); } @Test(timeout=1000) public void testCompareToWithNoneResource() { assertTrue(Resources.none().compareTo(createResource(0, 0)) == 0); assertTrue(Resources.none().compareTo( createResource(1, 0)) < 0); assertTrue(Resources.none().compareTo( createResource(0, 1)) < 0); }
        Hide
        beckham007 Beckham007 added a comment -

        The compareTo() of Resource UNBOUNDED is copied from Resource NONE.

        Show
        beckham007 Beckham007 added a comment - The compareTo() of Resource UNBOUNDED is copied from Resource NONE.

          People

          • Assignee:
            yxls123123 Xu Yang
            Reporter:
            yxls123123 Xu Yang
          • Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development