ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-12709. Deleting of one instance deletes all instances of view (DIPAYAN BHOWMICK via srimanth)
Date Tue, 11 Aug 2015 18:08:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 1ae80b4a6 -> 16ea3752e


AMBARI-12709. Deleting of one instance deletes all instances of view (DIPAYAN BHOWMICK via
srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/16ea3752
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/16ea3752
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/16ea3752

Branch: refs/heads/branch-2.1
Commit: 16ea3752e57268159d9c1c77a4dfeefcf43bf7d4
Parents: 1ae80b4
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Tue Aug 11 10:57:07 2015 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Tue Aug 11 11:07:48 2015 -0700

----------------------------------------------------------------------
 .../controller/predicate/ComparisonPredicate.java    |  2 +-
 .../controller/predicate/EqualsPredicateTest.java    | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/16ea3752/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
index c1cd16c..cc8cfdb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/predicate/ComparisonPredicate.java
@@ -101,7 +101,7 @@ public abstract class ComparisonPredicate<T> extends PropertyPredicate
implement
     }
     ParsePosition parsePosition = new ParsePosition(0);
     NumberFormat  numberFormat  = NumberFormat.getInstance();
-    Number        parsedNumber  = numberFormat.parse((String) value, parsePosition);
+    Number        parsedNumber  = numberFormat.parse(stringValue, parsePosition);
 
     return parsePosition.getIndex() == stringValue.length() ? parsedNumber.doubleValue()
: null;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/16ea3752/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/EqualsPredicateTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/EqualsPredicateTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/EqualsPredicateTest.java
index 5299c93..8e116be 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/EqualsPredicateTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/predicate/EqualsPredicateTest.java
@@ -73,4 +73,19 @@ public class EqualsPredicateTest {
     Assert.assertEquals(1, ids.size());
     Assert.assertTrue(ids.contains(propertyId));
   }
+
+  @Test
+  public void testApplyNumberValues() throws Exception {
+    Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+    String propertyId = PropertyHelper.getPropertyId("propertyId1", "1");
+    Predicate predicate = new EqualsPredicate<String>(propertyId, "1");
+    resource.setProperty(propertyId, "1");
+    Assert.assertTrue(predicate.evaluate(resource));
+
+    resource.setProperty(propertyId, "2");
+    Assert.assertFalse(predicate.evaluate(resource));
+
+    resource.setProperty(propertyId, "5");
+    Assert.assertFalse(predicate.evaluate(resource));
+  }
 }


Mime
View raw message