incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-3671. Unit test failures in trunk. (swagle)
Date Fri, 01 Nov 2013 21:07:40 GMT
Updated Branches:
  refs/heads/trunk 506adf751 -> 6b9ca4b41


AMBARI-3671. Unit test failures in trunk. (swagle)


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

Branch: refs/heads/trunk
Commit: 6b9ca4b41812576e39dcae3c2e71c66a1d80c978
Parents: 506adf7
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Fri Nov 1 14:07:25 2013 -0700
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Fri Nov 1 14:07:25 2013 -0700

----------------------------------------------------------------------
 .../internal/ConfigGroupResourceProvider.java   | 19 +++++++---
 .../controller/internal/ResourceImpl.java       |  3 --
 .../org/apache/ambari/server/state/Cluster.java |  2 +-
 .../apache/ambari/server/state/Clusters.java    |  4 +-
 .../server/state/cluster/ClusterImpl.java       | 34 ++++++++++-------
 .../server/state/cluster/ClustersImpl.java      | 39 ++++++++------------
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  4 +-
 .../ambari/server/agent/AgentResourceTest.java  |  5 +++
 .../ConfigGroupResourceProviderTest.java        |  1 +
 9 files changed, 60 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index 982a163..a63f382 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -36,8 +36,6 @@ import org.apache.ambari.server.controller.spi.ResourcePredicateEvaluator;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.orm.entities.ConfigGroupEntity;
-import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
@@ -57,6 +55,11 @@ import java.util.Set;
 
 public class ConfigGroupResourceProvider extends
   AbstractControllerResourceProvider implements ResourcePredicateEvaluator {
+
+  private static final Logger configLogger = LoggerFactory.getLogger("configchange");
+  private static final Logger LOG = LoggerFactory.getLogger
+    (ConfigGroupResourceProvider.class);
+
   protected static final String CONFIGGROUP_CLUSTER_NAME_PROPERTY_ID =
     PropertyHelper.getPropertyId("ConfigGroup", "cluster_name");
   protected static final String CONFIGGROUP_ID_PROPERTY_ID = PropertyHelper
@@ -343,6 +346,11 @@ public class ConfigGroupResourceProvider extends
         "Attempted to add a service to a cluster which doesn't exist", e);
     }
 
+    configLogger.info("Deleting Config group, "
+      + ", clusterName = " + cluster.getClusterName()
+      + ", id = " + request.getId()
+      + ", user = " + getManagementController().getAuthName());
+
     cluster.deleteConfigGroup(request.getId());
   }
 
@@ -423,8 +431,8 @@ public class ConfigGroupResourceProvider extends
         request.getConfigs(), hosts);
 
       // Persist before add, since id is auto-generated
-      Logger logger = LoggerFactory.getLogger("configchange");
-      logger.info("Persisting new Config group, "
+
+      configLogger.info("Persisting new Config group, "
         + ", clusterName = " + configGroup.getClusterName()
         + ", id = " + configGroup.getId()
         + ", tag = " + configGroup.getTag()
@@ -501,8 +509,7 @@ public class ConfigGroupResourceProvider extends
       configGroup.setDescription(request.getDescription());
       configGroup.setTag(request.getTag());
 
-      Logger logger = LoggerFactory.getLogger("configchange");
-      logger.info("Persisting updated Config group, "
+      configLogger.info("Persisting updated Config group, "
         + ", clusterName = " + configGroup.getClusterName()
         + ", id = " + configGroup.getId()
         + ", tag = " + configGroup.getTag()

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
index d7c1e78..7dbab0c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ResourceImpl.java
@@ -40,9 +40,6 @@ public class ResourceImpl implements Resource {
    */
   private final Map<String, Map<String, Object>> propertiesMap = new TreeMap<String,
Map<String, Object>>();
 
-
-  private volatile boolean skipPredicateCheck = false;
-
   // ----- Constructors ------------------------------------------------------
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 93e4500..186ac97 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -243,7 +243,7 @@ public interface Cluster {
   public Map<Long, ConfigGroup> getConfigGroups() throws AmbariException;
 
   /**
-   * Delete ths config group identified by the config group id
+   * Delete this config group identified by the config group id
    * @param id
    * @throws AmbariException
    */

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java
index 8cabaeb..eb00a97 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Clusters.java
@@ -18,13 +18,11 @@
 
 package org.apache.ambari.server.state;
 
+import org.apache.ambari.server.AmbariException;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.state.configgroup.ConfigGroup;
-
 /**
  * Single entity that tracks all clusters and hosts that are managed
  * by the Ambari server

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 6f69d5e..5d97691 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -18,14 +18,11 @@
 
 package org.apache.ambari.server.state.cluster;
 
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.persistence.RollbackException;
-
+import com.google.gson.Gson;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ServiceComponentHostNotFoundException;
 import org.apache.ambari.server.ServiceNotFoundException;
@@ -56,12 +53,21 @@ import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.google.gson.Gson;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.assistedinject.Assisted;
-import com.google.inject.persist.Transactional;
+import javax.persistence.RollbackException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 public class ClusterImpl implements Cluster {
 

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
index 4916d0b..4d92a6a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
@@ -18,20 +18,10 @@
 
 package org.apache.ambari.server.state.cluster;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.persistence.RollbackException;
-
+import com.google.gson.Gson;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ClusterNotFoundException;
 import org.apache.ambari.server.DuplicateResourceException;
@@ -39,12 +29,9 @@ import org.apache.ambari.server.HostNotFoundException;
 import org.apache.ambari.server.agent.DiskInfo;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
-import org.apache.ambari.server.orm.dao.ConfigGroupDAO;
-import org.apache.ambari.server.orm.dao.ConfigGroupHostMappingDAO;
 import org.apache.ambari.server.orm.dao.HostConfigMappingDAO;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
-import org.apache.ambari.server.orm.entities.ConfigGroupHostMappingEntity;
 import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.state.AgentVersion;
 import org.apache.ambari.server.state.Cluster;
@@ -55,15 +42,21 @@ import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
 import org.apache.ambari.server.state.HostState;
 import org.apache.ambari.server.state.RepositoryInfo;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.host.HostFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
-import com.google.gson.Gson;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
+import javax.persistence.RollbackException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 @Singleton
 public class ClustersImpl implements Clusters {

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index c0dc843..43954b3 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -164,7 +164,9 @@ BEGIN;
   UNION ALL
   SELECT 'user_id_seq', 2
   UNION ALL
-  SELECT 'host_role_command_id_seq', 1;
+  SELECT 'host_role_command_id_seq', 1
+  union all
+  select 'configgroup_id_seq', 1;
 
   INSERT INTO ambari.Roles (role_name)
   SELECT 'admin'

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
index dbc59a4..7ecba51 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java
@@ -40,6 +40,9 @@ import org.apache.ambari.server.state.*;
 import org.apache.ambari.server.state.cluster.ClusterFactory;
 import org.apache.ambari.server.state.cluster.ClusterImpl;
 import org.apache.ambari.server.state.cluster.ClustersImpl;
+import org.apache.ambari.server.state.configgroup.ConfigGroup;
+import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
+import org.apache.ambari.server.state.configgroup.ConfigGroupImpl;
 import org.apache.ambari.server.state.host.HostFactory;
 import org.apache.ambari.server.state.host.HostImpl;
 import org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl;
@@ -270,6 +273,8 @@ public class AgentResourceTest extends JerseyTest {
           ServiceComponentHostFactory.class));
       install(new FactoryModuleBuilder().implement(
           Config.class, ConfigImpl.class).build(ConfigFactory.class));
+      install(new FactoryModuleBuilder().implement(
+        ConfigGroup.class, ConfigGroupImpl.class).build(ConfigGroupFactory.class));
       install(new FactoryModuleBuilder().build(StageFactory.class));
       install(new FactoryModuleBuilder().build(HostRoleCommandFactory.class));
     }

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/6b9ca4b4/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
index 6163b47..84a3ed9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
@@ -414,6 +414,7 @@ public class ConfigGroupResourceProviderTest {
     Clusters clusters = createNiceMock(Clusters.class);
     Cluster cluster = createNiceMock(Cluster.class);
 
+    expect(managementController.getAuthName()).andReturn("admin").anyTimes();
     expect(managementController.getClusters()).andReturn(clusters).anyTimes();
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     cluster.deleteConfigGroup(1L);


Mime
View raw message