Explorar el Código

AMBARI-11031. Widgets with same widgetName in different layout are not created.

Siddharth Wagle hace 10 años
padre
commit
5c4e25e2b1
Se han modificado 20 ficheros con 69 adiciones y 53 borrados
  1. 8 3
      ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
  2. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/controller/WidgetResponse.java
  3. 0 6
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
  4. 2 1
      ambari-server/src/main/java/org/apache/ambari/server/orm/dao/WidgetDAO.java
  5. 12 7
      ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java
  6. 7 7
      ambari-server/src/main/java/org/apache/ambari/server/state/stack/WidgetLayoutInfo.java
  7. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
  8. 1 1
      ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
  9. 1 1
      ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
  10. 1 1
      ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
  11. 1 1
      ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
  12. 1 1
      ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
  13. 10 0
      ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
  14. 2 2
      ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json
  15. 6 3
      ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_widgets.json
  16. 1 0
      ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
  17. 3 10
      ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
  18. 7 1
      ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java
  19. 1 1
      ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java
  20. 3 5
      ambari-server/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json

+ 8 - 3
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java

@@ -4014,7 +4014,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   private WidgetEntity addIfNotExistsWidgetEntity(WidgetLayoutInfo layoutInfo, ClusterEntity clusterEntity,
                                           String user, long createTime) {
     List<WidgetEntity> createdEntities =
-      widgetDAO.findByName(clusterEntity.getClusterId(), layoutInfo.getWidgetName(), user);
+      widgetDAO.findByName(clusterEntity.getClusterId(), layoutInfo.getWidgetName(),
+              user, layoutInfo.getDefaultSectionName());
 
     if (createdEntities == null || createdEntities.isEmpty()) {
       WidgetEntity widgetEntity = new WidgetEntity();
@@ -4022,7 +4023,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
       widgetEntity.setClusterEntity(clusterEntity);
       widgetEntity.setScope(WidgetResourceProvider.SCOPE.CLUSTER.name());
       widgetEntity.setWidgetName(layoutInfo.getWidgetName());
-      widgetEntity.setDisplayName(layoutInfo.getDisplayName());
+      widgetEntity.setDefaultSectionName(layoutInfo.getDefaultSectionName());
       widgetEntity.setAuthor(user);
       widgetEntity.setDescription(layoutInfo.getDescription());
       widgetEntity.setTimeCreated(createTime);
@@ -4035,7 +4036,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         "cluster = " + clusterEntity.getClusterName());
       widgetDAO.create(widgetEntity);
 
-      createdEntities = widgetDAO.findByName(clusterEntity.getClusterId(), layoutInfo.getWidgetName(), user);
+      createdEntities = widgetDAO.findByName(clusterEntity.getClusterId(), layoutInfo.getWidgetName(),
+              user, layoutInfo.getDefaultSectionName());
       if (createdEntities != null && !createdEntities.isEmpty()) {
         return createdEntities.iterator().next();
       }
@@ -4076,6 +4078,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
           List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<WidgetLayoutUserWidgetEntity>();
           int order = 0;
           for (WidgetLayoutInfo layoutInfo : widgetLayout.getWidgetLayoutInfoList()) {
+            if (layoutInfo.getDefaultSectionName() == null) {
+              layoutInfo.setDefaultSectionName(layoutEntity.getSectionName());
+            }
             WidgetEntity widgetEntity = addIfNotExistsWidgetEntity(layoutInfo, clusterEntity, user, now);
             // Add to layout if visibility is true and widget was newly added
             if (widgetEntity != null && layoutInfo.isVisible()) {

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/controller/WidgetResponse.java

@@ -169,7 +169,7 @@ public class WidgetResponse {
     response.setMetrics(entity.getMetrics());
     response.setTimeCreated(entity.getTimeCreated());
     response.setAuthor(entity.getAuthor());
-    response.setDisplayName(entity.getDisplayName());
+    response.setDisplayName(entity.getDefaultSectionName());
     response.setScope(entity.getScope());
     response.setWidgetValues(entity.getWidgetValues());
     response.setProperties(entity.getProperties());

+ 0 - 6
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java

@@ -62,7 +62,6 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
   public static final String WIDGET_ID_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "id");
   public static final String WIDGET_CLUSTER_NAME_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "cluster_name");
   public static final String WIDGET_WIDGET_NAME_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "widget_name");
-  public static final String WIDGET_DISPLAY_NAME_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "display_name");
   public static final String WIDGET_WIDGET_TYPE_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "widget_type");
   public static final String WIDGET_TIME_CREATED_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "time_created");
   public static final String WIDGET_AUTHOR_PROPERTY_ID                 = PropertyHelper.getPropertyId("WidgetInfo", "author");
@@ -88,7 +87,6 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
     {
       add(WIDGET_ID_PROPERTY_ID);
       add(WIDGET_WIDGET_NAME_PROPERTY_ID);
-      add(WIDGET_DISPLAY_NAME_PROPERTY_ID);
       add(WIDGET_WIDGET_TYPE_PROPERTY_ID);
       add(WIDGET_TIME_CREATED_PROPERTY_ID);
       add(WIDGET_CLUSTER_NAME_PROPERTY_ID);
@@ -141,7 +139,6 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
           final String[] requiredProperties = {
               WIDGET_CLUSTER_NAME_PROPERTY_ID,
               WIDGET_WIDGET_NAME_PROPERTY_ID,
-              WIDGET_DISPLAY_NAME_PROPERTY_ID,
               WIDGET_WIDGET_TYPE_PROPERTY_ID,
               WIDGET_SCOPE_PROPERTY_ID
           };
@@ -158,11 +155,9 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
             throw new AmbariException("Only cluster operator can create widgets with cluster scope");
           }
 
-          entity.setDisplayName(properties.get(WIDGET_DISPLAY_NAME_PROPERTY_ID).toString());
           entity.setWidgetName(properties.get(WIDGET_WIDGET_NAME_PROPERTY_ID).toString());
           entity.setWidgetType(properties.get(WIDGET_WIDGET_TYPE_PROPERTY_ID).toString());
           entity.setClusterId(getManagementController().getClusters().getCluster(clusterName).getClusterId());
-          entity.setDisplayName(properties.get(WIDGET_DISPLAY_NAME_PROPERTY_ID).toString());
           entity.setScope(scope);
 
           String metrics = (properties.containsKey(WIDGET_METRICS_PROPERTY_ID)) ?
@@ -240,7 +235,6 @@ public class WidgetResourceProvider extends AbstractControllerResourceProvider {
       setResourceProperty(resource, WIDGET_TIME_CREATED_PROPERTY_ID, entity.getTimeCreated(), requestedIds);
       resource.setProperty(WIDGET_AUTHOR_PROPERTY_ID, entity.getAuthor());
       setResourceProperty(resource, WIDGET_DESCRIPTION_PROPERTY_ID, entity.getDescription(), requestedIds);
-      resource.setProperty(WIDGET_DISPLAY_NAME_PROPERTY_ID, entity.getDisplayName());
       resource.setProperty(WIDGET_SCOPE_PROPERTY_ID, entity.getScope());
       setResourceProperty(resource, WIDGET_VALUES_PROPERTY_ID, entity.getWidgetValues(), requestedIds);
       setResourceProperty(resource, WIDGET_PROPERTIES_PROPERTY_ID, entity.getProperties(), requestedIds);

+ 2 - 1
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/WidgetDAO.java

@@ -63,12 +63,13 @@ public class WidgetDAO {
   }
 
   @RequiresSession
-  public List<WidgetEntity> findByName(Long clusterId, String widgetName, String author) {
+  public List<WidgetEntity> findByName(Long clusterId, String widgetName, String author, String defaultSectionName) {
     TypedQuery<WidgetEntity> query = entityManagerProvider.get()
       .createNamedQuery("WidgetEntity.findByName", WidgetEntity.class);
     query.setParameter("clusterId", clusterId);
     query.setParameter("widgetName", widgetName);
     query.setParameter("author", author);
+    query.setParameter("defaultSectionName", defaultSectionName);
 
     return daoUtils.selectList(query);
   }

+ 12 - 7
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetEntity.java

@@ -47,7 +47,12 @@ import java.util.List;
 @NamedQueries({
     @NamedQuery(name = "WidgetEntity.findAll", query = "SELECT widget FROM WidgetEntity widget"),
     @NamedQuery(name = "WidgetEntity.findByCluster", query = "SELECT widget FROM WidgetEntity widget WHERE widget.clusterId = :clusterId"),
-    @NamedQuery(name = "WidgetEntity.findByName", query = "SELECT widget FROM WidgetEntity widget WHERE widget.clusterId = :clusterId AND widget.widgetName = :widgetName AND widget.author = :author"),
+    @NamedQuery(name = "WidgetEntity.findByName", query =
+            "SELECT widget FROM WidgetEntity widget " +
+                    "WHERE widget.clusterId = :clusterId " +
+                    "AND widget.widgetName = :widgetName " +
+                    "AND widget.author = :author " +
+                    "AND widget.defaultSectionName = :defaultSectionName"),
     @NamedQuery(name = "WidgetEntity.findBySectionName", query =
                 "SELECT widget FROM WidgetEntity widget " +
                 "INNER JOIN widget.listWidgetLayoutUserWidgetEntity widgetLayoutUserWidget " +
@@ -84,8 +89,8 @@ public class WidgetEntity {
   @Column(name = "description", length = 255)
   private String description;
 
-  @Column(name = "display_name",  length = 255)
-  private String displayName;
+  @Column(name = "default_section_name",  length = 255, nullable = true)
+  private String defaultSectionName;
 
   @Column(name = "scope", length = 255)
   private String scope;
@@ -166,12 +171,12 @@ public class WidgetEntity {
     this.description = description;
   }
 
-  public String getDisplayName() {
-    return displayName;
+  public String getDefaultSectionName() {
+    return defaultSectionName;
   }
 
-  public void setDisplayName(String displayName) {
-    this.displayName = displayName;
+  public void setDefaultSectionName(String displayName) {
+    this.defaultSectionName = displayName;
   }
 
   public String getScope() {

+ 7 - 7
ambari-server/src/main/java/org/apache/ambari/server/state/stack/WidgetLayoutInfo.java

@@ -26,8 +26,8 @@ import java.util.Map;
 public class WidgetLayoutInfo {
   @SerializedName("widget_name")
   private String widgetName;
-  @SerializedName("display_name")
-  private String displayName;
+  @SerializedName("default_section_name")
+  private String defaultSectionName = null;
   @SerializedName("description")
   private String description;
   @SerializedName("widget_type")
@@ -50,13 +50,13 @@ public class WidgetLayoutInfo {
     this.widgetName = widgetName;
   }
 
-  @JsonProperty("display_name")
-  public String getDisplayName() {
-    return displayName;
+  @JsonProperty("default_section_name")
+  public String getDefaultSectionName() {
+    return defaultSectionName;
   }
 
-  public void setDisplayName(String displayName) {
-    this.displayName = displayName;
+  public void setDefaultSectionName(String defaultSectionName) {
+    this.defaultSectionName = defaultSectionName;
   }
 
   @JsonProperty("description")

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java

@@ -501,7 +501,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
     columns.add(new DBColumnInfo("time_created", Long.class,  null,   null, false));
     columns.add(new DBColumnInfo("author", String.class,  255,   null, true));
     columns.add(new DBColumnInfo("description", String.class,  255,   null, true));
-    columns.add(new DBColumnInfo("display_name", String.class,  255,   null, true));
+    columns.add(new DBColumnInfo("default_section_name", String.class,  255,   null, true));
     columns.add(new DBColumnInfo("scope", String.class,  255,   null, true));
     columns.add(new DBColumnInfo("widget_values", byte[].class,  null,   null, true));
     columns.add(new DBColumnInfo("properties", byte[].class, null, null, true));

+ 1 - 1
ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql

@@ -549,7 +549,7 @@ CREATE TABLE widget (
   time_created BIGINT NOT NULL,
   author VARCHAR(255),
   description VARCHAR(255),
-  display_name VARCHAR(255),
+  default_section_name VARCHAR(255),
   scope VARCHAR(255),
   widget_values LONGTEXT,
   properties LONGTEXT,

+ 1 - 1
ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql

@@ -539,7 +539,7 @@ CREATE TABLE widget (
   time_created NUMBER(19) NOT NULL,
   author VARCHAR2(255),
   description VARCHAR2(255),
-  display_name VARCHAR2(255),
+  default_section_name VARCHAR2(255),
   scope VARCHAR2(255),
   widget_values CLOB,
   properties CLOB,

+ 1 - 1
ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql

@@ -548,7 +548,7 @@ CREATE TABLE widget (
   time_created BIGINT NOT NULL,
   author VARCHAR(255),
   description VARCHAR(255),
-  display_name VARCHAR(255),
+  default_section_name VARCHAR(255),
   scope VARCHAR(255),
   widget_values TEXT,
   properties TEXT,

+ 1 - 1
ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql

@@ -624,7 +624,7 @@ CREATE TABLE ambari.widget (
   time_created BIGINT NOT NULL,
   author VARCHAR(255),
   description VARCHAR(255),
-  display_name VARCHAR(255),
+  default_section_name VARCHAR(255),
   scope VARCHAR(255),
   widget_values TEXT,
   properties TEXT,

+ 1 - 1
ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql

@@ -667,7 +667,7 @@ CREATE TABLE widget (
   time_created BIGINT NOT NULL,
   author VARCHAR(255),
   description VARCHAR(255),
-  display_name VARCHAR(255),
+  default_section_name VARCHAR(255),
   scope VARCHAR(255),
   widget_values VARCHAR(4000),
   properties VARCHAR(4000),

+ 10 - 0
ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json

@@ -8,6 +8,7 @@
         {
           "widget_name": "Reads and Writes",
           "description": "This widget shows all the read requests and write requests on all regions for a RegionServer",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -61,6 +62,7 @@
         {
           "widget_name": "Read Latency",
           "description": "Widget shows 95% Read Latency",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -86,6 +88,7 @@
         {
           "widget_name": "Write Latency",
           "description": "This widget shows 95th percentile of the write latency.",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -141,6 +144,7 @@
         {
           "widget_name": "Open Connections",
           "description": "This widget shows number of current open connections",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -167,6 +171,7 @@
         {
           "widget_name": "Request Handlers",
           "widget_type": "GRAPH",
+          "default_section_name": "HBASE_SUMMARY",
           "is_visible": true,
           "metrics": [
             {
@@ -200,6 +205,7 @@
         {
           "widget_name": "Files Local",
           "description": "This widget shows weighted average for local files.",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "NUMBER",
           "is_visible": true,
           "metrics": [
@@ -225,6 +231,7 @@
         {
           "widget_name": "Blocked Updates",
           "description": "Number of milliseconds updates have been blocked so the memstore can be flushed",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -250,6 +257,7 @@
         {
           "widget_name": "Cluster CPU",
           "description": "ReqionServer widget for CPU utilization",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -299,6 +307,7 @@
         {
           "widget_name": "Cluster Network",
           "description": "ReqionServer widget for network utilization",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -333,6 +342,7 @@
         {
           "widget_name": "Cluster Disk",
           "description": "ReqionServer widget for Disk utilization",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [

+ 2 - 2
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/widgets.json

@@ -359,7 +359,7 @@
       "widgetLayoutInfo": [
         {
           "widget_name": "HDFS Bytes Read",
-          "display_name": "HDFS Bytes Read",
+          "default_section_name": "HDFS_HEATMAPS",
           "description": "",
           "widget_type": "HEATMAP",
           "is_visible": true,
@@ -480,7 +480,7 @@
         },
         {
           "widget_name": "DataNode Process Disk I/O Utilization",
-          "display_name": "DataNode Process Disk I/O Utilization",
+          "default_section_name": "HDFS_HEATMAPS",
           "description": "",
           "widget_type": "HEATMAP",
           "is_visible": false,

+ 6 - 3
ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/YARN_widgets.json

@@ -268,8 +268,9 @@
           }
         },
         {
-          "widget_name": "Cluster(NodeManager) Disk",
+          "widget_name": "Cluster Disk",
           "description": "NodeManager widget for disk utilization",
+          "default_section_name": "YARN_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -298,8 +299,9 @@
           }
         },
         {
-          "widget_name": "Cluster(NodeManager) Network",
+          "widget_name": "Cluster Network",
           "description": "NodeManager widget for network utilization",
+          "default_section_name": "YARN_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
@@ -332,8 +334,9 @@
           }
         },
         {
-          "widget_name": "Cluster(NodeManager) CPU",
+          "widget_name": "Cluster CPU",
           "description": "NodeManager widget for CPU utilization",
+          "default_section_name": "YARN_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [

+ 1 - 0
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java

@@ -10434,6 +10434,7 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals("OPEN_CONNECTIONS", layoutUserWidgetEntities.get(1).getWidget().getWidgetName());
     Assert.assertEquals("FILES_LOCAL", layoutUserWidgetEntities.get(2).getWidget().getWidgetName());
     Assert.assertEquals("UPDATED_BLOCKED_TIME", layoutUserWidgetEntities.get(3).getWidget().getWidgetName());
+    Assert.assertEquals("HBASE_SUMMARY", layoutUserWidgetEntities.get(0).getWidget().getDefaultSectionName());
   }
 
   // this is a temporary measure as a result of moving updateHostComponents from AmbariManagementController

+ 3 - 10
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java

@@ -107,7 +107,6 @@ public class WidgetResourceProviderTest {
     Request request = PropertyHelper.getReadRequest(
       WidgetResourceProvider.WIDGET_ID_PROPERTY_ID,
       WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID,
-      WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID,
       WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID,
       WidgetResourceProvider.WIDGET_TIME_CREATED_PROPERTY_ID,
       WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID,
@@ -143,7 +142,6 @@ public class WidgetResourceProviderTest {
     Assert.assertEquals("GAUGE", r.getPropertyValue(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID));
     Assert.assertEquals("USER", r.getPropertyValue(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID));
     Assert.assertEquals("username", r.getPropertyValue(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID));
-    Assert.assertEquals("displ_name", r.getPropertyValue(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID));
     Assert.assertEquals("widget name", r.getPropertyValue(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID));
     Object metrics = r.getPropertyValue(WidgetResourceProvider.WIDGET_METRICS_PROPERTY_ID);
     Assert.assertEquals("[{\"widget_id\":\"metrics/jvm/HeapMemoryUsed\"," +
@@ -187,7 +185,6 @@ public class WidgetResourceProviderTest {
     Map<String, Object> requestProps = new HashMap<String, Object>();
     requestProps.put(WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID, "c1");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID, "widget name");
-    requestProps.put(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID, "display_name");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
     requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
     requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
@@ -212,7 +209,7 @@ public class WidgetResourceProviderTest {
     Assert.assertEquals(Long.valueOf(1), entity.getClusterId());
     Assert.assertEquals("USER", entity.getScope());
     Assert.assertEquals("widget name", entity.getWidgetName());
-    Assert.assertEquals("display_name", entity.getDisplayName());
+    Assert.assertEquals(null, entity.getDefaultSectionName());
     Assert.assertEquals("GAUGE", entity.getWidgetType());
     Assert.assertEquals("admin", entity.getAuthor());
     Assert.assertEquals("[{\"name\":\"value\",\"name2\":\"value2\"}]", entity.getMetrics());
@@ -243,7 +240,6 @@ public class WidgetResourceProviderTest {
     Map<String, Object> requestProps = new HashMap<String, Object>();
     requestProps.put(WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID, "c1");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID, "widget name");
-    requestProps.put(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID, "display_name");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
     requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
     requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
@@ -289,7 +285,6 @@ public class WidgetResourceProviderTest {
     requestProps.put(WidgetResourceProvider.WIDGET_ID_PROPERTY_ID, "1");
     requestProps.put(WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID, "c1");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID, "widget name2");
-    requestProps.put(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID, "display_name");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
     requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
     requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
@@ -313,7 +308,7 @@ public class WidgetResourceProviderTest {
     Assert.assertEquals("[{\"name\":\"new_value\",\"new_name\":\"new_value2\"}]",entity.getMetrics());
     Assert.assertEquals("{\"new_property\":\"new_value2\",\"property1\":\"new_value1\"}",entity.getProperties());
     Assert.assertEquals("widget name2",entity.getWidgetName());
-    Assert.assertEquals("display_name",entity.getDisplayName());
+    Assert.assertEquals(null,entity.getDefaultSectionName());
 
     verify(amc, clusters, cluster, dao);
   }
@@ -341,7 +336,6 @@ public class WidgetResourceProviderTest {
     Map<String, Object> requestProps = new HashMap<String, Object>();
     requestProps.put(WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID, "c1");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID, "widget name");
-    requestProps.put(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID, "display_name");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
     requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
     requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
@@ -406,7 +400,6 @@ public class WidgetResourceProviderTest {
     Map<String, Object> requestProps = new HashMap<String, Object>();
     requestProps.put(WidgetResourceProvider.WIDGET_CLUSTER_NAME_PROPERTY_ID, "c1");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_NAME_PROPERTY_ID, "widget name");
-    requestProps.put(WidgetResourceProvider.WIDGET_DISPLAY_NAME_PROPERTY_ID, "display_name");
     requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
     requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
     requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "CLUSTER");
@@ -440,7 +433,7 @@ public class WidgetResourceProviderTest {
     widgetEntity.setWidgetType("GAUGE");
     widgetEntity.setAuthor("username");
     widgetEntity.setScope("USER");
-    widgetEntity.setDisplayName("displ_name");
+    widgetEntity.setDefaultSectionName("default_section_name");
     widgetEntity.setDescription("Description");
     widgetEntity.setMetrics("[{\"widget_id\":\"metrics/jvm/HeapMemoryUsed\"," +
             "\"host_component_criteria\":\"host_components/metrics/dfs/FSNamesystem/HAState\\u003dactive\"," +

+ 7 - 1
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java

@@ -61,8 +61,8 @@ public class WidgetDAOTest {
   private void createRecords() {
     for (int i=0; i<3; i++) {
       WidgetEntity widgetEntity = new WidgetEntity();
-      widgetEntity.setDisplayName("display name" + i);
       widgetEntity.setAuthor("author");
+      widgetEntity.setDefaultSectionName("section_name");
       widgetEntity.setClusterId(clusterId);
       widgetEntity.setMetrics("metrics");
       widgetEntity.setDescription("description");
@@ -113,6 +113,12 @@ public class WidgetDAOTest {
     Assert.assertEquals(3, widgetDAO.findAll().size());
   }
 
+  @Test
+  public void testFindByName() {
+    createRecords();
+    Assert.assertEquals(1, widgetDAO.findByName(clusterId, "widget0", "author", "section_name").size());
+  }
+
   @After
   public void after() {
     injector.getInstance(PersistService.class).stop();

+ 1 - 1
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java

@@ -79,7 +79,7 @@ public class WidgetLayoutDAOTest {
 
     for (int i=0; i<3; i++) {
       WidgetEntity widgetEntity = new WidgetEntity();
-      widgetEntity.setDisplayName("display name" + i);
+      widgetEntity.setDefaultSectionName("display name" + i);
       widgetEntity.setAuthor("author");
       widgetEntity.setClusterId(clusterId);
       widgetEntity.setMetrics("metrics");

+ 3 - 5
ambari-server/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json

@@ -6,7 +6,6 @@
       "widgetLayoutInfo": [
         {
           "widget_name": "RS_READS_WRITES",
-          "display_name": "RegionServer Reads and Writes",
           "description": "This widget shows all the read requests and write requests on all regions for a RegionServer",
           "widget_type": "GRAPH",
           "is_visible": true,
@@ -73,7 +72,6 @@
         },
         {
           "widget_name": "OPEN_CONNECTIONS",
-          "display_name": "Open Connections",
           "description": "This widget shows number of current open connections",
           "widget_type": "GRAPH",
           "is_visible": true,
@@ -100,7 +98,7 @@
         },
         {
           "widget_name": "ACTIVE_HANDLER",
-          "display_name": "Active Handlers vs Calls in General Queue",
+          "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": false,
           "metrics": [
@@ -136,7 +134,7 @@
         },
         {
           "widget_name": "FILES_LOCAL",
-          "display_name": "Files Local",
+          "default_section_name": "HBASE_SUMMARY",
           "description": "This widget shows percentage of files local.",
           "widget_type": "NUMBER",
           "is_visible": true,
@@ -161,7 +159,7 @@
         },
         {
           "widget_name": "UPDATED_BLOCKED_TIME",
-          "display_name": "Updated Blocked Time",
+          "default_section_name": "HBASE_SUMMARY",
           "description": "",
           "widget_type": "GRAPH",
           "is_visible": true,