AMBARI-22131 Move resources/stacks/HDP/3.0/widgets.json to resources/widgets.json (dsen)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7172655f Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7172655f Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7172655f Branch: refs/heads/branch-feature-AMBARI-14714 Commit: 7172655ff269fbb7e0d29ba93197aa5a804749c0 Parents: 32bf39e Author: Dmytro Sen <[email protected]> Authored: Fri Oct 6 16:33:57 2017 +0300 Committer: Dmytro Sen <[email protected]> Committed: Fri Oct 6 16:33:57 2017 +0300 ---------------------------------------------------------------------- .../server/api/services/AmbariMetaInfo.java | 8 ++ .../AmbariManagementControllerImpl.java | 22 ++--- .../internal/ServiceResourceProvider.java | 8 -- .../internal/StackArtifactResourceProvider.java | 18 +--- .../server/orm/entities/WidgetLayoutEntity.java | 6 +- .../ambari/server/stack/StackDirectory.java | 18 ---- .../apache/ambari/server/stack/StackModule.java | 5 -- .../apache/ambari/server/state/StackInfo.java | 8 -- .../resources/stacks/HDP/2.0.6/widgets.json | 95 -------------------- .../main/resources/stacks/HDP/3.0/widgets.json | 95 -------------------- .../server/api/services/AmbariMetaInfoTest.java | 8 ++ .../AmbariManagementControllerImplTest.java | 6 +- .../AmbariManagementControllerTest.java | 6 ++ .../resources/stacks/OTHER/1.0/widgets.json | 95 -------------------- 14 files changed, 34 insertions(+), 364 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java index de84965..425d247 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java @@ -21,6 +21,7 @@ package org.apache.ambari.server.api.services; import static org.apache.ambari.server.controller.spi.Resource.InternalType.Component; import static org.apache.ambari.server.controller.spi.Resource.InternalType.HostComponent; import static org.apache.ambari.server.controller.utilities.PropertyHelper.AGGREGATE_FUNCTION_IDENTIFIERS; +import static org.apache.ambari.server.stack.StackDirectory.WIDGETS_DESCRIPTOR_FILE_NAME; import java.io.File; import java.io.FileReader; @@ -125,6 +126,7 @@ public class AmbariMetaInfo { private File commonServicesRoot; private File extensionsRoot; private File serverVersionFile; + private File commonWidgetsDescriptorFile; private File customActionRoot; private Map<String, VersionDefinitionXml> versionDefinitions = null; @@ -214,6 +216,8 @@ public class AmbariMetaInfo { serverVersionFile = new File(serverVersionFilePath); customActionRoot = new File(conf.getCustomActionDefinitionPath()); + + commonWidgetsDescriptorFile = new File(conf.getResourceDirPath(), WIDGETS_DESCRIPTOR_FILE_NAME); } /** @@ -1435,4 +1439,8 @@ public class AmbariMetaInfo { return null; } + + public File getCommonWidgetsDescriptorFile() { + return commonWidgetsDescriptorFile; + } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index b2993e3..5642575 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -5184,22 +5184,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle widgetDescriptorFiles.add(widgetDescriptorFile); } } else { - Set<StackId> stackIds = new HashSet<>(); - - for (Service svc : cluster.getServices().values()) { - stackIds.add(svc.getDesiredStackId()); - } - - for (StackId stackId : stackIds) { - StackInfo stackInfo = ambariMetaInfo.getStack(stackId); - - String widgetDescriptorFileLocation = stackInfo.getWidgetsDescriptorFileLocation(); - if (widgetDescriptorFileLocation != null) { - File widgetDescriptorFile = new File(widgetDescriptorFileLocation); - if (widgetDescriptorFile.exists()) { - widgetDescriptorFiles.add(widgetDescriptorFile); - } - } + // common cluster level widgets + File commonWidgetsFile = ambariMetaInfo.getCommonWidgetsDescriptorFile(); + if (commonWidgetsFile != null && commonWidgetsFile.exists()) { + widgetDescriptorFiles.add(commonWidgetsFile); + } else { + LOG.warn("Common widgets file with path {%s} doesn't exist. No cluster widgets will be created.", commonWidgetsFile); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java index 76a4547..e65693b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java @@ -423,8 +423,6 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider // do all validation checks validateCreateRequests(requests, clusters); - Set<Cluster> clustersSetFromRequests = new HashSet<>(); - for (ServiceRequest request : requests) { Cluster cluster = clusters.getCluster(request.getClusterName()); @@ -480,12 +478,6 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider // Initialize service widgets getManagementController().initializeWidgetsAndLayouts(cluster, s); - clustersSetFromRequests.add(cluster); - } - - // Create cluster widgets and layouts - for (Cluster cluster : clustersSetFromRequests) { - getManagementController().initializeWidgetsAndLayouts(cluster, null); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java index 2e8a32a..a7f7710 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProvider.java @@ -426,7 +426,7 @@ public class StackArtifactResourceProvider extends AbstractControllerResourcePro } if (StringUtils.isEmpty(serviceName)) { - return getWidgetsDescriptorForCluster(stackInfo); + return null; } else { return getWidgetsDescriptorForService(stackInfo, serviceName); } @@ -450,22 +450,6 @@ public class StackArtifactResourceProvider extends AbstractControllerResourcePro return widgetDescriptor; } - public Map<String, Object> getWidgetsDescriptorForCluster(StackInfo stackInfo) - throws NoSuchParentResourceException, IOException { - - Map<String, Object> widgetDescriptor = null; - - String widgetDescriptorFileLocation = stackInfo.getWidgetsDescriptorFileLocation(); - if (widgetDescriptorFileLocation != null) { - File widgetDescriptorFile = new File(widgetDescriptorFileLocation); - if (widgetDescriptorFile.exists()) { - widgetDescriptor = gson.fromJson(new FileReader(widgetDescriptorFile), widgetLayoutType); - } - } - - return widgetDescriptor; - } - /** * Get a kerberos descriptor. * http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetLayoutEntity.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetLayoutEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetLayoutEntity.java index 90d98fc..1fa45e9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetLayoutEntity.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/WidgetLayoutEntity.java @@ -33,6 +33,7 @@ import javax.persistence.OneToMany; import javax.persistence.OrderBy; import javax.persistence.Table; import javax.persistence.TableGenerator; +import javax.persistence.UniqueConstraint; @Entity @Table(name = "widget_layout") @@ -41,7 +42,8 @@ import javax.persistence.TableGenerator; pkColumnName = "sequence_name", valueColumnName = "sequence_value", pkColumnValue = "widget_layout_id_seq", - initialValue = 0 + initialValue = 0, + uniqueConstraints=@UniqueConstraint(columnNames={"layout_name", "cluster_id"}) ) @NamedQueries({ @NamedQuery(name = "WidgetLayoutEntity.findAll", query = "SELECT widgetLayout FROM WidgetLayoutEntity widgetLayout"), @@ -56,7 +58,7 @@ public class WidgetLayoutEntity { @Column(name = "id", nullable = false, updatable = false) private Long id; - @Column(name = "layout_name", nullable = false, unique = true, length = 255) + @Column(name = "layout_name", nullable = false, length = 255) private String layoutName; @Column(name = "section_name", nullable = false, length = 255) http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java index 9259466..e3c586b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackDirectory.java @@ -94,11 +94,6 @@ public class StackDirectory extends StackDefinitionDirectory { private String kerberosDescriptorPreconfigureFilePath; /** - * widgets descriptor file path - */ - private String widgetsDescriptorFilePath; - - /** * repository file */ private RepositoryXml repoFile; @@ -233,15 +228,6 @@ public class StackDirectory extends StackDefinitionDirectory { } /** - * Obtain the path to the (stack-level) widgets descriptor file - * - * @return the path to the (stack-level) widgets descriptor file - */ - public String getWidgetsDescriptorFilePath() { - return widgetsDescriptorFilePath; - } - - /** * Obtain the repository directory path. * * @return repository directory path @@ -324,10 +310,6 @@ public class StackDirectory extends StackDefinitionDirectory { kerberosDescriptorPreconfigureFilePath = getAbsolutePath() + File.separator + KERBEROS_DESCRIPTOR_PRECONFIGURE_FILE_NAME; } - if (subDirs.contains(WIDGETS_DESCRIPTOR_FILE_NAME)) { - widgetsDescriptorFilePath = getAbsolutePath() + File.separator + WIDGETS_DESCRIPTOR_FILE_NAME; - } - parseUpgradePacks(subDirs); parseServiceDirectories(subDirs); parseRepoFile(subDirs); http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java index 742706d..71235f3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java @@ -294,10 +294,6 @@ public class StackModule extends BaseModule<StackModule, StackInfo> implements V stackInfo.setKerberosDescriptorPreConfigurationFileLocation(parentStack.getModuleInfo().getKerberosDescriptorPreConfigurationFileLocation()); } - if (stackInfo.getWidgetsDescriptorFileLocation() == null) { - stackInfo.setWidgetsDescriptorFileLocation(parentStack.getModuleInfo().getWidgetsDescriptorFileLocation()); - } - mergeServicesWithParent(parentStack, allStacks, commonServices, extensions); } @@ -573,7 +569,6 @@ public class StackModule extends BaseModule<StackModule, StackInfo> implements V stackInfo.setRcoFileLocation(stackDirectory.getRcoFilePath()); stackInfo.setKerberosDescriptorFileLocation(stackDirectory.getKerberosDescriptorFilePath()); stackInfo.setKerberosDescriptorPreConfigurationFileLocation(stackDirectory.getKerberosDescriptorPreconfigureFilePath()); - stackInfo.setWidgetsDescriptorFileLocation(stackDirectory.getWidgetsDescriptorFilePath()); stackInfo.setUpgradesFolder(stackDirectory.getUpgradesDir()); stackInfo.setUpgradePacks(stackDirectory.getUpgradePacks()); stackInfo.setConfigUpgradePack(stackDirectory.getConfigUpgradePack()); http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java index dcf850f..3efc997 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/StackInfo.java @@ -429,14 +429,6 @@ public class StackInfo implements Comparable<StackInfo>, Validable { this.kerberosDescriptorPreConfigurationFileLocation = kerberosDescriptorPreConfigurationFileLocation; } - public String getWidgetsDescriptorFileLocation() { - return widgetsDescriptorFileLocation; - } - - public void setWidgetsDescriptorFileLocation(String widgetsDescriptorFileLocation) { - this.widgetsDescriptorFileLocation = widgetsDescriptorFileLocation; - } - /** * Set the path of the stack upgrade directory. * http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/resources/stacks/HDP/2.0.6/widgets.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/widgets.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/widgets.json deleted file mode 100644 index 3176354..0000000 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/widgets.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "layouts": [ - { - "layout_name": "default_system_heatmap", - "display_name": "Heatmaps", - "section_name": "SYSTEM_HEATMAPS", - "widgetLayoutInfo": [ - { - "widget_name": "Host Disk Space Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": true, - "metrics": [ - { - "name": "disk_free", - "metric_path": "metrics/disk/disk_free", - "service_name": "STACK" - }, - { - "name": "disk_total", - "metric_path": "metrics/disk/disk_total", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Disk Space Used %", - "value": "${((disk_total-disk_free)/disk_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host Memory Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "mem_total", - "metric_path": "metrics/memory/mem_total", - "service_name": "STACK" - }, - { - "name": "mem_free", - "metric_path": "metrics/memory/mem_free", - "service_name": "STACK" - }, - { - "name": "mem_cached", - "metric_path": "metrics/memory/mem_cached", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${((mem_total-mem_free-mem_cached)/mem_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host CPU Wait IO %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "cpu_wio", - "metric_path": "metrics/cpu/cpu_wio", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${cpu_wio*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - } - ] - } - ] -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/main/resources/stacks/HDP/3.0/widgets.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/3.0/widgets.json b/ambari-server/src/main/resources/stacks/HDP/3.0/widgets.json deleted file mode 100644 index 3176354..0000000 --- a/ambari-server/src/main/resources/stacks/HDP/3.0/widgets.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "layouts": [ - { - "layout_name": "default_system_heatmap", - "display_name": "Heatmaps", - "section_name": "SYSTEM_HEATMAPS", - "widgetLayoutInfo": [ - { - "widget_name": "Host Disk Space Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": true, - "metrics": [ - { - "name": "disk_free", - "metric_path": "metrics/disk/disk_free", - "service_name": "STACK" - }, - { - "name": "disk_total", - "metric_path": "metrics/disk/disk_total", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Disk Space Used %", - "value": "${((disk_total-disk_free)/disk_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host Memory Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "mem_total", - "metric_path": "metrics/memory/mem_total", - "service_name": "STACK" - }, - { - "name": "mem_free", - "metric_path": "metrics/memory/mem_free", - "service_name": "STACK" - }, - { - "name": "mem_cached", - "metric_path": "metrics/memory/mem_cached", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${((mem_total-mem_free-mem_cached)/mem_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host CPU Wait IO %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "cpu_wio", - "metric_path": "metrics/cpu/cpu_wio", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${cpu_wio*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - } - ] - } - ] -} http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java index 4baca5c..25e8d04 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java @@ -1894,6 +1894,14 @@ public class AmbariMetaInfoTest { Assert.assertTrue(descriptor.getService("NEW_SERVICE").shouldPreconfigure()); } + @Test + public void testGetCommonWidgetsFile() throws AmbariException { + File widgetsFile = metaInfo.getCommonWidgetsDescriptorFile(); + + Assert.assertNotNull(widgetsFile); + Assert.assertEquals("/var/lib/ambari-server/resources/widgets.json", widgetsFile.getPath()); + } + private File getStackRootTmp(String buildDir) { return new File(buildDir + "/ambari-metaInfo"); } http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java index a02690f..9547271 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java @@ -2367,18 +2367,14 @@ public class AmbariManagementControllerImplTest { Cluster cluster = createNiceMock(Cluster.class); Service service = createNiceMock(Service.class); expect(service.getDesiredStackId()).andReturn(stackId).atLeastOnce(); - expect(cluster.getServices()).andReturn(ImmutableMap.<String, Service>builder() - .put("HDFS", service) - .build()); expect(clusters.getCluster("c1")).andReturn(cluster).atLeastOnce(); StackInfo stackInfo = createNiceMock(StackInfo.class); - expect(stackInfo.getWidgetsDescriptorFileLocation()).andReturn(null).once(); expect(ambariMetaInfo.getStack("HDP", "2.1")).andReturn(stackInfo).atLeastOnce(); - expect(ambariMetaInfo.getStack(stackId)).andReturn(stackInfo).atLeastOnce(); + expect(ambariMetaInfo.getCommonWidgetsDescriptorFile()).andReturn(null).once(); replay(injector, clusters, ambariMetaInfo, stackInfo, cluster, service, repoVersionDAO, repoVersion); http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java index b370829..7094caa 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java @@ -34,6 +34,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.File; import java.io.StringReader; import java.lang.reflect.Type; import java.text.MessageFormat; @@ -10424,6 +10425,11 @@ public class AmbariManagementControllerTest { Assert.assertEquals("UPDATED_BLOCKED_TIME", layoutUserWidgetEntities.get(3).getWidget().getWidgetName()); Assert.assertEquals("HBASE_SUMMARY", layoutUserWidgetEntities.get(0).getWidget().getDefaultSectionName()); + File widgetsFile = ambariMetaInfo.getCommonWidgetsDescriptorFile(); + assertNotNull(widgetsFile); + assertEquals("src/test/resources/widgets.json", widgetsFile.getPath()); + assertTrue(widgetsFile.exists()); + candidateLayoutEntity = null; for (WidgetLayoutEntity entity : layoutEntities) { if (entity.getLayoutName().equals("default_system_heatmap")) { http://git-wip-us.apache.org/repos/asf/ambari/blob/7172655f/ambari-server/src/test/resources/stacks/OTHER/1.0/widgets.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/resources/stacks/OTHER/1.0/widgets.json b/ambari-server/src/test/resources/stacks/OTHER/1.0/widgets.json deleted file mode 100644 index 3176354..0000000 --- a/ambari-server/src/test/resources/stacks/OTHER/1.0/widgets.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "layouts": [ - { - "layout_name": "default_system_heatmap", - "display_name": "Heatmaps", - "section_name": "SYSTEM_HEATMAPS", - "widgetLayoutInfo": [ - { - "widget_name": "Host Disk Space Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": true, - "metrics": [ - { - "name": "disk_free", - "metric_path": "metrics/disk/disk_free", - "service_name": "STACK" - }, - { - "name": "disk_total", - "metric_path": "metrics/disk/disk_total", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Disk Space Used %", - "value": "${((disk_total-disk_free)/disk_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host Memory Used %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "mem_total", - "metric_path": "metrics/memory/mem_total", - "service_name": "STACK" - }, - { - "name": "mem_free", - "metric_path": "metrics/memory/mem_free", - "service_name": "STACK" - }, - { - "name": "mem_cached", - "metric_path": "metrics/memory/mem_cached", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${((mem_total-mem_free-mem_cached)/mem_total)*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - }, - { - "widget_name": "Host CPU Wait IO %", - "description": "", - "widget_type": "HEATMAP", - "is_visible": false, - "metrics": [ - { - "name": "cpu_wio", - "metric_path": "metrics/cpu/cpu_wio", - "service_name": "STACK" - } - ], - "values": [ - { - "name": "Host Memory Used %", - "value": "${cpu_wio*100}" - } - ], - "properties": { - "display_unit": "%", - "max_limit": "100" - } - } - ] - } - ] -}
