Repository: ambari Updated Branches: refs/heads/trunk 3a5ae334b -> 0b77adc2f
http://git-wip-us.apache.org/repos/asf/ambari/blob/0b77adc2/ambari-web/test/mappers/stack_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/stack_mapper_test.js b/ambari-web/test/mappers/stack_mapper_test.js index 0bc0f3c..63f7516 100644 --- a/ambari-web/test/mappers/stack_mapper_test.js +++ b/ambari-web/test/mappers/stack_mapper_test.js @@ -22,256 +22,583 @@ require('mappers/stack_mapper'); require('models/stack'); require('models/operating_system'); require('models/repository'); +require('models/stack_version/service_simple'); describe('App.stackMapper', function () { describe("#map", function() { - var testData = { - items: [{ - "Versions" : { - "active" : true, - "min_upgrade_version" : null, - "parent_stack_version" : "1.3.3", - "stack_name" : "HDP", - "stack_version" : "1.3" + "items" : [ + { + "VersionDefinition" : { + "id" : 1, + "show_available": true, + "stack_name" : "HDP", + "stack_version" : "2.3", + "repository_version" : "2.3.4.0-3396", + "type" : "STANDARD", + "version_url" : "file:/Users/ncole/src/hwx/ambari/contrib/version-builder/version_234-3396.xml", + "release" : { + "build" : "3396", + "compatible_with" : "2.3.[0-3].0", + "notes" : "http://example.com", + "version" : "2.3.4.0" }, - "operating_systems" : [ + "stack_services" : [ + { + "name" : "HDFS", + "display_name" : "HDFS", + "comment" : "Data warehouse system for ad-hoc queries & analysis of large datasets and table & storage management service", + "versions" : [ + "2.7.1.2.3396" + ] + }, + { + "name" : "YARN", + "display_name" : "YARN", + "comment" : "", + "versions" : [ + "1.7.3.3396" + ] + }, { - "OperatingSystems" : { - "os_type" : "redhat5", - "stack_name" : "HDP", - "stack_version" : "1.3" + "name" : "ZOOKEEPER", + "display_name" : "ZooKeeper", + "comment" : "", + "versions" : [ + "1.7.3.3396" + ] + } + ] + }, + "operating_systems" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7", + "OperatingSystems" : { + "os_type" : "debian7", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + }, + "repositories" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-2.3", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3396", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3396", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3396", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-2.3", + "repo_name" : "HDP", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + } }, - "repositories" : [ - { - "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.7.0", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.7.0", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/1.x/updates/1.3.8.0", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-1.3", - "repo_name" : "HDP", - "stack_name" : "HDP", - "stack_version" : "1.3" - } - },{ - "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos5", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos5", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos5", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-UTILS-1.1.0.16", - "repo_name" : "HDP-UTILS", - "stack_name" : "HDP", - "stack_version" : "1.3" - } - }] - },{ - "OperatingSystems" : { - "os_type" : "redhat6", - "stack_name" : "HDP", - "stack_version" : "1.3" - }, "repositories" : [ - { - "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.7.0", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.7.0", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/1.x/updates/1.3.8.0", - "mirrors_list" : null, - "os_type" : "redhat6", - "repo_id" : "HDP-1.3", - "repo_name" : "HDP", - "stack_name" : "HDP", - "stack_version" : "1.3" - } - }, - { - "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos6", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos6", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.16/repos/centos6", - "mirrors_list" : null, - "os_type" : "redhat6", - "repo_id" : "HDP-UTILS-1.1.0.16", - "repo_name" : "HDP-UTILS", - "stack_name" : "HDP", - "stack_version" : "1.3" - } - } - ] - }] - },{ - "Versions" : { - "active" : false, - "min_upgrade_version" : null, - "parent_stack_version" : null, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-UTILS-1.1.0.20", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-UTILS-1.1.0.20", + "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + } + } + ] + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6", + "OperatingSystems" : { + "os_type" : "redhat6", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + }, + "repositories" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-2.3", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3396", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3396", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3396", + "mirrors_list" : "", + "os_type" : "redhat6", + "repo_id" : "HDP-2.3", + "repo_name" : "HDP", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + } + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.20", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "mirrors_list" : "", + "os_type" : "redhat6", + "repo_id" : "HDP-UTILS-1.1.0.20", + "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.3" + } + } + ] + } + ] + }, + + { + "VersionDefinition" : { + "id" : 2, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3", + "show_available": true, + "repository_version" : "2.3.4.0-3397", + "type" : "STANDARD", + "version_url" : "file:/Users/ncole/src/hwx/ambari/contrib/version-builder/version_234-3397.xml", + "release" : { + "build" : "3397", + "compatible_with" : "2.3.[0-3].0", + "notes" : "http://example.com", + "version" : "2.3.4.0" + }, + "stack_services" : [ + { + "name" : "HDFS", + "display_name" : "HDFS", + "comment" : "Data warehouse system for ad-hoc queries & analysis of large datasets and table & storage management service", + "versions" : [ + "2.7.1.2-3397" + ] + }, + { + "name" : "YARN", + "display_name" : "YARN", + "comment" : "", + "versions" : [ + "1.7.3-3397" + ] + }, + { + "name" : "HBase", + "display_name" : "HBase", + "comment" : "", + "versions" : [ + "1.7.3-3397" + ] + }, + { + "name" : "ZOOKEEPER", + "display_name" : "ZooKeeper", + "comment" : "", + "versions" : [ + "1.7.3-3397" + ] + }, + { + "name" : "Hive", + "display_name" : "Hive", + "comment" : "", + "versions" : [ + "1.1.0-3397" + ] + } + ] }, "operating_systems" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7", "OperatingSystems" : { - "os_type" : "redhat5", + "os_type" : "debian7", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" }, "repositories" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-2.3", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-2.0.6", + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3397", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3397", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.4.0-3397", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-2.3", "repo_name" : "HDP", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" } }, { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-UTILS-1.1.0.20", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-UTILS-1.1.0.17", + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-UTILS-1.1.0.20", "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" } - }] - }, { + } + ] + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6", "OperatingSystems" : { "os_type" : "redhat6", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" }, "repositories" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-2.3", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "mirrors_list" : null, + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3397", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3397", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.4.0-3397", + "mirrors_list" : "", "os_type" : "redhat6", - "repo_id" : "HDP-2.0.6", + "repo_id" : "HDP-2.3", "repo_name" : "HDP", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" } - }, { + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.20", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "mirrors_list" : null, + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "mirrors_list" : "", "os_type" : "redhat6", - "repo_id" : "HDP-UTILS-1.1.0.17", + "repo_id" : "HDP-UTILS-1.1.0.20", "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.0.6" + "stack_version" : "2.3" } - }] - }] - },{ - "Versions" : { - "active" : true, - "min_upgrade_version" : null, - "parent_stack_version" : null, + } + ] + } + ] + }, + + { + "VersionDefinition" : { + "id" : 5, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3", + "show_available": true, + "repository_version" : "2.3.6.0-3646", + "type" : "STANDARD", + "version_url" : "file:/Users/ncole/src/hwx/ambari/contrib/version-builder/version_234-3646.xml", + "release" : { + "build" : "3646", + "compatible_with" : "2.3.[0-6].0", + "notes" : "http://example.com", + "version" : "2.3.6.0" + }, + "stack_services" : [ + { + "name" : "HDFS", + "display_name" : "HDFS", + "comment" : "Data warehouse system for ad-hoc queries & analysis of large datasets and table & storage management service", + "versions" : [ + "2.7.1.2-3646" + ] + }, + { + "name" : "YARN", + "display_name" : "YARN", + "comment" : "", + "versions" : [ + "1.7.3-3646" + ] + }, + { + "name" : "HBase", + "display_name" : "HBase", + "comment" : "", + "versions" : [ + "1.7.3-3646" + ] + }, + { + "name" : "ZOOKEEPER", + "display_name" : "ZooKeeper", + "comment" : "", + "versions" : [ + "1.7.3-3646" + ] + }, + { + "name" : "Hive", + "display_name" : "Hive", + "comment" : "", + "versions" : [ + "1.1.0-3646" + ] + } + ] }, "operating_systems" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7", "OperatingSystems" : { - "os_type" : "redhat5", + "os_type" : "debian7", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" }, "repositories" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-2.3", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.1", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-2.1", + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.6.0-3646", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.6.0-3646", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.3.6.0-3646", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-2.3", "repo_name" : "HDP", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" } }, { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-UTILS-1.1.0.20", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos5", - "mirrors_list" : null, - "os_type" : "redhat5", - "repo_id" : "HDP-UTILS-1.1.0.17", + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-UTILS-1.1.0.20", "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" } - }] - }, { + } + ] + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6", "OperatingSystems" : { "os_type" : "redhat6", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" }, "repositories" : [ { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-2.3", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.1", - "mirrors_list" : null, + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3646", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3646", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.3.6.0-3646", + "mirrors_list" : "", "os_type" : "redhat6", - "repo_id" : "HDP-2.1", + "repo_id" : "HDP-2.3", "repo_name" : "HDP", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" } - }, { + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/redhat6/repositories/HDP-UTILS-1.1.0.20", "Repositories" : { - "base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "default_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "latest_base_url" : "http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.17/repos/centos6", - "mirrors_list" : null, + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6", + "mirrors_list" : "", "os_type" : "redhat6", - "repo_id" : "HDP-UTILS-1.1.0.17", + "repo_id" : "HDP-UTILS-1.1.0.20", "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, "stack_name" : "HDP", - "stack_version" : "2.1" + "stack_version" : "2.3" } - }] - }] - }] - }; + } + ] + } + ] + }, + + { + "VersionDefinition" : { + "id" : 3, + "stack_name" : "HDP", + "stack_version" : "2.4", + "show_available": true, + "repository_version" : "2.4.0.0-169", + "type" : "STANDARD", + "version_url" : "file:/Users/ncole/src/hwx/ambari/contrib/version-builder/version_169.xml", + "release" : { + "build" : "169", + "compatible_with" : "2.4.[0-3].0", + "notes" : "http://example.com", + "version" : "2.4.0.0" + }, + "stack_services" : [ + { + "name" : "HDFS", + "display_name" : "HDFS", + "comment" : "Data warehouse system for ad-hoc queries & analysis of large datasets and table & storage management service", + "versions" : [ + "2.7.1.2-169" + ] + }, + { + "name" : "YARN", + "display_name" : "YARN", + "comment" : "", + "versions" : [ + "1.7.3-169" + ] + }, + { + "name" : "HBase", + "display_name" : "HBase", + "comment" : "", + "versions" : [ + "1.7.3-169" + ] + }, + { + "name" : "ZOOKEEPER", + "display_name" : "ZooKeeper", + "comment" : "", + "versions" : [ + "1.7.3-169" + ] + }, + { + "name" : "Hive", + "display_name" : "Hive", + "comment" : "", + "versions" : [ + "1.1.0-169" + ] + }, + { + "name" : "MAPREDUCE2", + "display_name" : "MapReduce2", + "comment" : "service", + "versions" : [ + "2.7.1.2-169" + ] + }, + { + "name" : "Slider", + "display_name" : "Slider", + "comment" : "service", + "versions" : [ + "2.7.1.2-169" + ] + }, + { + "name" : "Pig", + "display_name" : "Pig", + "comment" : "service", + "versions" : [ + "2.7.1.2-169" + ] + }, + { + "name" : "Sqoop", + "display_name" : "Sqoop", + "comment" : "service", + "versions" : [ + "2.7.1.2-169" + ] + } + ] + }, + "operating_systems" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7", + "OperatingSystems" : { + "os_type" : "debian7", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.4" + }, + "repositories" : [ + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-2.3", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.4.0.0-169", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.4.0.0-169", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP/debian7/2.x/BUILDS/2.4.0.0-169", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-2.4", + "repo_name" : "HDP", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.4" + } + }, + { + "href" : "http://c6401.ambari.apache.org:8080/api/v1/stacks/HDP/versions/2.3/repository_versions/1/operating_systems/debian7/repositories/HDP-UTILS-1.1.0.20", + "Repositories" : { + "base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "default_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "latest_base_url" : "http://s3.amazonaws.com/dev.hortonworks.com/HDP-UTILS-1.1.0.20/repos/debian7", + "mirrors_list" : "", + "os_type" : "debian7", + "repo_id" : "HDP-UTILS-1.1.0.20", + "repo_name" : "HDP-UTILS", + "repository_version_id" : 1, + "stack_name" : "HDP", + "stack_version" : "2.4" + } + } + ] + } + ] + } + ] + }; beforeEach(function () { App.resetDsStoreTypeMap(App.Repository); App.resetDsStoreTypeMap(App.OperatingSystem); App.resetDsStoreTypeMap(App.Stack); + App.resetDsStoreTypeMap(App.ServiceSimple); sinon.stub(App.store, 'commit', Em.K); - App.stackMapper.map(testData); + App.stackMapper.map(testData.items, "VersionDefinition"); }); afterEach(function(){ App.store.commit.restore(); }); - it ('should map active Stack data', function() { - expect(App.Stack.find().get('length')).to.equal(2); + it ('should map all Stack data', function() { + expect(App.Stack.find().get('length')).to.equal(4); }); - it ('all stacks are active', function() { - expect(App.Stack.find().everyProperty('active')).to.equal(true); + it ('all stacks are showAvailable', function() { + expect(App.Stack.find().everyProperty('showAvailable')).to.equal(true); }); it ('no one stack is selected', function() { @@ -279,23 +606,34 @@ describe('App.stackMapper', function () { }); it ('stack ids are valid', function() { - expect(App.Stack.find().mapProperty('id')).to.eql(['HDP-2.1','HDP-1.3']); + expect(App.Stack.find().mapProperty('id')).to.eql( + ['HDP-2.4-2.4.0.0-169','HDP-2.3-2.3.6.0-3646', 'HDP-2.3-2.3.4.0-3397', 'HDP-2.3-2.3.4.0-3396']); }); - it ('4 OSes are mapped', function() { - expect(App.OperatingSystem.find().get('length')).to.equal(4); + it ('7 OSes are mapped', function() { + expect(App.OperatingSystem.find().get('length')).to.equal(7); }); it ('OSes have valid ids', function() { - expect(App.OperatingSystem.find().mapProperty('id')).to.eql(['HDP-2.1-redhat5', 'HDP-2.1-redhat6', 'HDP-1.3-redhat5', 'HDP-1.3-redhat6']); + expect(App.OperatingSystem.find().mapProperty('id')).to.eql( + ['HDP-2.4-2.4.0.0-169-debian7', 'HDP-2.3-2.3.6.0-3646-debian7', 'HDP-2.3-2.3.6.0-3646-redhat6', 'HDP-2.3-2.3.4.0-3397-debian7', + 'HDP-2.3-2.3.4.0-3397-redhat6', 'HDP-2.3-2.3.4.0-3396-debian7', 'HDP-2.3-2.3.4.0-3396-redhat6']); }); - - it ('8 repositories are mapped', function() { - expect(App.Repository.find().get('length')).to.equal(8); + + it ('14 repositories are mapped', function() { + expect(App.Repository.find().get('length')).to.equal(14); }); it ('Repositories ids are valid', function() { - expect(App.Repository.find().mapProperty('id')).to.eql(["HDP-2.1-redhat5-HDP-2.1", "HDP-2.1-redhat5-HDP-UTILS-1.1.0.17", "HDP-2.1-redhat6-HDP-2.1", "HDP-2.1-redhat6-HDP-UTILS-1.1.0.17", "HDP-1.3-redhat5-HDP-1.3", "HDP-1.3-redhat5-HDP-UTILS-1.1.0.16", "HDP-1.3-redhat6-HDP-1.3", "HDP-1.3-redhat6-HDP-UTILS-1.1.0.16"]); + expect(App.Repository.find().mapProperty('id')).to.eql( + ['HDP-2.4-2.4.0.0-169-debian7-HDP-2.4', 'HDP-2.4-2.4.0.0-169-debian7-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.6.0-3646-debian7-HDP-2.3', 'HDP-2.3-2.3.6.0-3646-debian7-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.6.0-3646-redhat6-HDP-2.3','HDP-2.3-2.3.6.0-3646-redhat6-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.4.0-3397-debian7-HDP-2.3','HDP-2.3-2.3.4.0-3397-debian7-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.4.0-3397-redhat6-HDP-2.3', 'HDP-2.3-2.3.4.0-3397-redhat6-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.4.0-3396-debian7-HDP-2.3', 'HDP-2.3-2.3.4.0-3396-debian7-HDP-UTILS-1.1.0.20', + 'HDP-2.3-2.3.4.0-3396-redhat6-HDP-2.3', 'HDP-2.3-2.3.4.0-3396-redhat6-HDP-UTILS-1.1.0.20' + ]); }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0b77adc2/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js index 9a42c42..70d182c 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js @@ -1,4 +1,4 @@ -/** + /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -23,29 +23,6 @@ require('views/main/admin/stack_upgrade/services_view'); describe('App.MainAdminStackServicesView', function () { var view = App.MainAdminStackServicesView.create(); - describe("#services", function () { - before(function () { - sinon.stub(App.StackService, 'find').returns([ - Em.Object.create({serviceName: 'S1', isInstalled: false}), - Em.Object.create({serviceName: 'S2', isInstalled: false}) - ]); - sinon.stub(App.Service, 'find').returns([ - Em.Object.create({serviceName: 'S1'}) - ]); - }); - after(function () { - App.StackService.find.restore(); - App.Service.find.restore(); - }); - it("`isInstalled`-flag depends on App.Service", function () { - view.propertyDidChange('services'); - expect(view.get('services')).to.eql([ - Em.Object.create({serviceName: 'S1', isInstalled: true}), - Em.Object.create({serviceName: 'S2', isInstalled: false}) - ]); - }); - }); - describe("#goToAddService()" , function() { var mock = Em.Object.create({ checkAndStartKerberosWizard: Em.K, http://git-wip-us.apache.org/repos/asf/ambari/blob/0b77adc2/ambari-web/test/views/wizard/step1_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js index 0dacad8..070cb59 100644 --- a/ambari-web/test/views/wizard/step1_view_test.js +++ b/ambari-web/test/views/wizard/step1_view_test.js @@ -28,20 +28,18 @@ function getView() { describe('App.WizardStep1View', function () { - App.TestAliases.testAsComputedAnd(getView(), 'showErrorsWarningCount', ['isSubmitDisabled', 'totalErrorCnt']); - describe('#operatingSystems', function () { beforeEach(function () { sinon.stub(App.Stack, 'find', function () { return [ Ember.Object.create({ - id: 'HDP-1.3', + id: 'HDP-1.3-1234', stackName: 'HDP', stackVersion: '1.3', active: true, operatingSystems: [ Ember.Object.create({ - id: 'HDP-1.3-redhat5', + id: 'HDP-1.3-1234-redhat5', osType: 'redhat5', isSelected: false, repositories: [ @@ -56,7 +54,7 @@ describe('App.WizardStep1View', function () { ] }), Ember.Object.create({ - id: 'HDP-1.3-redhat6', + id: 'HDP-1.3-1234-redhat6', osType: 'redhat6', isSelected: false, repositories: [ @@ -154,25 +152,9 @@ describe('App.WizardStep1View', function () { App.Stack.find.restore(); }); - it('should create empty array if there is no stacks', function () { - controller = App.WizardStep1Controller.create({ - content: { - stacks: [] - }, - selectedStack: [] - }); - view = App.WizardStep1View.create(); - view.reopen({ - controller: controller - }); - expect(view.get('allRepositories.length')).to.equal(0); - expect(view.get('operatingSystems.length')).to.equal(0); - }); - describe('should create repo groups from repo list', function () { var repositories; - beforeEach(function () { controller = App.WizardStep1Controller.create({ content: { @@ -184,7 +166,6 @@ describe('App.WizardStep1View', function () { view.set('$', function () { return Em.Object.create({hide: Em.K, toggle: Em.K}); }); - repositories = view.get('allRepositories'); }); @@ -242,296 +223,12 @@ describe('App.WizardStep1View', function () { App.TestAliases.testAsComputedEveryBy(getView(), 'isNoOsChecked', 'operatingSystems', 'isSelected', false); - App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['invalidFormatUrlExist', 'isNoOsChecked', 'invalidUrlExist', 'controller.content.isCheckInProgress']); - - describe('#stacks', function () { - - var tests = Em.A([ - { - m: 'Stack with 2 HDP', - stacks: [ - Em.Object.create({isSelected: true, id: 'HDP-2.0.1'}), - Em.Object.create({isSelected: false, id: 'HDP-1.3.3'}) - ], - e: { - names: ['HDP 2.0.1', 'HDP 1.3.3'], - selected: [true, false] - } - }, - { - m: 'No HDP', - stacks: [], - e: { - names: [], - selected: [] - } - } - ]); - - tests.forEach(function (test) { - it(test.m, function () { - view.set('controller.content.stacks', test.stacks); - var stacks = view.get('stacks'); - expect(stacks.mapProperty('name')).to.eql(test.e.names); - expect(stacks.mapProperty('isSelected')).to.eql(test.e.selected); - }); - }); - - }); + App.TestAliases.testAsComputedOr(getView(), 'isSubmitDisabled', ['controller.content.isCheckInProgress']); App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', App.Repository.validation.INVALID); App.TestAliases.testAsComputedSomeBy(getView(), 'invalidFormatUrlExist', 'allRepositories', 'invalidFormatError', true); - describe('#totalErrorCnt', function () { - var tests = Em.A([ - { - allRepositories: [ - {} - ], - m: 'isNoOsChecked', - isNoOsChecked: true, - e: 1 - }, - { - allRepositories: [ - {'invalidFormatError': true}, - {'invalidFormatError': true} - ], - isNoOsChecked: false, - m: 'two with empty-error', - e: 2 - }, - { - allRepositories: [ - {'validation': 'icon-exclamation-sign'}, - {'validation': 'icon-exclamation-sign'} - ], - isNoOsChecked: false, - m: 'two with validation="icon-exclamation-sign"', - e: 2 - }, - { - allRepositories: [ - {'invalidFormatError': true, 'validation': 'icon-exclamation-sign'}, - {'invalidFormatError': true, 'validation': 'icon-exclamation-sign'} - ], - isNoOsChecked: false, - m: 'two with empty-error, two with validation="icon-exclamation-sign"', - e: 4 - }, - { - allRepositories: [ - {} - ], - isNoOsChecked: false, - m: 'no errors/warnings etc', - e: 0 - } - ]); - tests.forEach(function (test) { - it(test.m, function () { - view = App.WizardStep1View.create(); - view.reopen({ - isNoOsChecked: test.isNoOsChecked, - allRepositories: test.allRepositories - }); - expect(view.get('totalErrorCnt')).to.equal(test.e); - }); - }); - }); - - describe('#didInsertElement', function () { - - beforeEach(function () { - sinon.stub($.fn, 'tooltip', Em.K); - }); - - afterEach(function () { - $.fn.tooltip.restore(); - }); - - it('should create tooltip', function () { - view.set('isRLCollapsed', false); - view.didInsertElement(); - expect($.fn.tooltip.calledOnce).to.equal(true); - }); - }); - - describe('#stackRadioButton', function () { - - var v; - beforeEach(function () { - v = view.get('stackRadioButton').create({ - content: Em.Object.create({ - name: '' - }), - controller: Em.Object.create({ - content: Em.Object.create({ - stacks: [] - }) - }) - }); - }); - - describe('#isSelected', function () { - it('should be equal content.isSelected', function () { - v.set('content.isSelected', true); - expect(v.get('checked')).to.equal(true); - v.set('content.isSelected', false); - expect(v.get('checked')).to.equal(false); - }); - }); - - describe('#click', function () { - it('should select proper stack', function () { - v.set('controller.content.stacks', Em.A([Em.Object.create({id: 'n-1'}), Em.Object.create({id: 'n-2'}), Em.Object.create({id: 'n-3'})])); - v.set('content.name', 'n 2'); - v.click(); - expect(v.get('controller.content.stacks').getEach('isSelected')).to.eql([false, true, false]); - }); - }); - - }); - - describe('#popoverView', function () { - - var v; - beforeEach(function () { - v = view.get('popoverView').create(); - sinon.stub(App, 'popover', Em.K); - view = App.WizardStep1View.create({'controller': controller}); - view.set('$', function () { - return Em.Object.create({hide: Em.K, toggle: Em.K}); - }); - }); - - afterEach(function () { - App.popover.restore(); - }); - - describe('#didInsertElement', function () { - it('should create popover', function () { - v.didInsertElement(); - expect(App.popover.calledOnce).to.equal(true); - }); - }); - - }); - - describe('#onToggleBlock', function () { - - it('should toggle isRLCollapsed', function () { - view.set('isRLCollapsed', true); - view.onToggleBlock(); - expect(view.get('isRLCollapsed')).to.equal(false); - view.onToggleBlock(); - expect(view.get('isRLCollapsed')).to.equal(true); - }); - }); - - describe('#updateByCheckbox', function () { - - var operatingSystems = [ - Em.Object.create({ - name: 'redhat5', - isSelected: false, - repositories: [Em.Object.create({ - id: 'id', - osType: 'redhat5', - baseUrl: 'baseUrl', - latestBaseUrl: 'latestBaseUrl', - validation: '', - isSelected: false - }) - ] - }) - ]; - - var ctrl = { - content: { - stacks: [ - Em.Object.create({ - isSelected: true, - operatingSystems: [ - Em.Object.create({ - id: 'id', - osType: 'redhat5', - baseUrl: 'baseUrl', - latestBaseUrl: 'latestBaseUrl', - validation: '', - isSelected: false - }) - ] - }) - ] - }, - selectedStack: Em.Object.create({ - isSelected: true, - operatingSystems: [ - Em.Object.create({ - id: 'id', - osType: 'redhat5', - baseUrl: 'baseUrl', - latestBaseUrl: 'latestBaseUrl', - validation: '', - isSelected: true - }) - ] - }), - skipValidationChecked: true - }; - - it('target group isn\'t isSelected', function () { - view.reopen({ - operatingSystems: operatingSystems, - controller: ctrl - }); - view.updateByCheckbox(); - var targetGroup = view.get('operatingSystems.firstObject.repositories.firstObject'); - expect(targetGroup.get('baseUrl')).to.equal('latestBaseUrl'); - expect(targetGroup.get('latestBaseUrl')).to.equal('latestBaseUrl'); - expect(targetGroup.get('validation')).to.be.empty; - - }); - - it('target group is isSelected, skipValidationisSelected = true', function () { - ctrl.content.stacks[0].operatingSystems[0].selected = true; - operatingSystems[0].set('isSelected', true); - view.reopen({ - operatingSystems: operatingSystems, - controller: ctrl - }); - view.updateByCheckbox(); - var targetGroup = view.get('operatingSystems.firstObject.repositories.firstObject'); - expect(targetGroup.get('validation')).to.be.empty; - }); - }); - - describe('#clearGroupLocalRepository', function () { - var context = {'group-number': 0, id: 'HDP-redhat5', repoId: 'HDP-redhat5', baseUrl: 'baseUrl', validation: 'validation'}; - it('should empty base url and validation', function () { - var event = {context: Em.Object.create(context, {isSelected: true})}; - view.clearGroupLocalRepository(event); - expect(event.context.get('baseUrl')).to.be.empty; - expect(event.context.get('validation')).to.be.empty; - }); - it('should do nothing if corresponding OS is not selected', function () { - var event = {context: Em.Object.create(context, {isSelected: false})}; - view.clearGroupLocalRepository(event); - expect(event.context.get('baseUrl')).to.equal('baseUrl'); - expect(event.context.get('validation')).to.equal('validation'); - }); - }); - - describe('#undoGroupLocalRepository', function () { - it('should reset base url and validation', function () { - var event = {context: Em.Object.create({'group-number': 0, id: 'HDP-redhat5', repoId: 'HDP-redhat5', latestBaseUrl: 'latestBaseUrl', validation: 'validation'})}; - view.undoGroupLocalRepository(event); - expect(event.context.get('baseUrl')).to.equal(event.context.get('latestBaseUrl')); - expect(event.context.get('validation')).to.be.empty; - }); - }); describe('#editLocalRepository', function () {
