ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: AMBARI-6790 Error encountered when deploying cluster (dsen)
Date Fri, 08 Aug 2014 13:28:36 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b6c0e4b78 -> d156c0ee9


AMBARI-6790 Error encountered when deploying cluster (dsen)


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

Branch: refs/heads/trunk
Commit: d156c0ee9d676bd128b3793b872c2253663cba5c
Parents: b6c0e4b
Author: Dmytro Sen <dsen@hortonworks.com>
Authored: Fri Aug 8 16:27:39 2014 +0300
Committer: Dmytro Sen <dsen@hortonworks.com>
Committed: Fri Aug 8 16:27:39 2014 +0300

----------------------------------------------------------------------
 .../api/services/persistence/PersistenceManagerImpl.java  | 10 ++++++----
 .../server/api/services/PersistenceManagerImplTest.java   |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d156c0ee/ambari-server/src/main/java/org/apache/ambari/server/api/services/persistence/PersistenceManagerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/persistence/PersistenceManagerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/persistence/PersistenceManagerImpl.java
index 1c488a8..2013fe4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/persistence/PersistenceManagerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/persistence/PersistenceManagerImpl.java
@@ -87,10 +87,12 @@ public class PersistenceManagerImpl implements PersistenceManager {
 
     for (NamedPropertySet propertySet : setProperties) {
       for (Map.Entry<Resource.Type, String> entry : mapResourceIds.entrySet()) {
-        Map<String, Object> mapProperties = propertySet.getProperties();
-        String property = schema.getKeyPropertyId(entry.getKey());
-        if (!mapProperties.containsKey(property)) {
-          mapProperties.put(property, entry.getValue());
+        if (entry.getValue() != null) {
+          Map<String, Object> mapProperties = propertySet.getProperties();
+          String property = schema.getKeyPropertyId(entry.getKey());
+          if (!mapProperties.containsKey(property)) {
+            mapProperties.put(property, entry.getValue());
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d156c0ee/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java
index 82bd6ec..9ff1506 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java
@@ -197,8 +197,11 @@ public class PersistenceManagerImplTest {
     Predicate predicate = createMock(Predicate.class);
     RequestBody body = new RequestBody();
 
+    // expect getKeyPropertyId calling for resource type cluster
     String clusterId = "clusterId";
-    String serviceId = "serviceId";
+    // do not expect getKeyPropertyId  calling for resource type service
+    // because the value is not set in the request
+    String serviceId = null;
 
     Map<Resource.Type, String> mapResourceIds = new HashMap<Resource.Type, String>();
     mapResourceIds.put(Resource.Type.Cluster, clusterId);
@@ -220,7 +223,6 @@ public class PersistenceManagerImplTest {
     expect(resource.getQuery()).andReturn(query);
     expect(query.getPredicate()).andReturn(predicate);
     expect(schema.getKeyPropertyId(Resource.Type.Cluster)).andReturn(clusterId);
-    expect(schema.getKeyPropertyId(Resource.Type.Service)).andReturn(serviceId);
 
     expect(controller.updateResources(Resource.Type.Component, serverRequest, predicate)).andReturn(new
RequestStatusImpl(null));
 


Mime
View raw message