AMBARI-14370. Move functional tests from ambari-server project to a separate project ambari-funtest (Nahappan Somasundaram via smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ffb4d3b8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ffb4d3b8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ffb4d3b8 Branch: refs/heads/trunk Commit: ffb4d3b8ce043d3cb3e9b8a69619dc82797c68ce Parents: c0b1f40 Author: Sumit Mohanty <[email protected]> Authored: Mon Dec 14 22:01:32 2015 -0800 Committer: Sumit Mohanty <[email protected]> Committed: Mon Dec 14 22:01:32 2015 -0800 ---------------------------------------------------------------------- ambari-funtest/pom.xml | 557 ++ ambari-funtest/src/main/assemblies/funtest.xml | 79 + .../java/org/apache/ambari/funtest/AppTest.java | 55 + .../funtest/server/AmbariHttpWebRequest.java | 393 + .../funtest/server/ClusterConfigParams.java | 84 + .../ambari/funtest/server/ConnectionParams.java | 89 + .../funtest/server/LocalAmbariServer.java | 99 + .../ambari/funtest/server/WebRequest.java | 192 + .../ambari/funtest/server/WebResponse.java | 57 + .../AddDesiredConfigurationWebRequest.java | 108 + .../api/cluster/CreateClusterWebRequest.java | 88 + .../cluster/CreateConfigurationWebRequest.java | 87 + .../api/cluster/GetAllClustersWebRequest.java | 53 + .../api/cluster/GetClusterWebRequest.java | 49 + .../api/cluster/GetRequestStatusWebRequest.java | 78 + .../server/api/host/AddHostWebRequest.java | 63 + .../server/api/host/GetHostWebRequest.java | 56 + .../api/host/GetRegisteredHostWebRequest.java | 59 + .../server/api/host/RegisterHostWebRequest.java | 59 + .../api/service/AddServiceWebRequest.java | 98 + .../api/service/DeleteServiceWebRequest.java | 67 + .../api/service/GetServiceWebRequest.java | 67 + .../api/service/InstallServiceWebRequest.java | 39 + .../api/service/SetServiceStateWebRequest.java | 97 + .../api/service/StartServiceWebRequest.java | 38 + .../api/service/StopServiceWebRequest.java | 38 + .../AddServiceComponentWebRequest.java | 69 + .../GetServiceComponentWebRequest.java | 69 + .../SetServiceComponentStateWebRequest.java | 87 + .../AddServiceComponentHostWebRequest.java | 69 + .../BulkAddServiceComponentHostsWebRequest.java | 127 + ...kSetServiceComponentHostStateWebRequest.java | 91 + .../GetServiceComponentHostWebRequest.java | 69 + .../SetServiceComponentHostStateWebRequest.java | 89 + .../server/orm/InMemoryDefaultTestModule.java | 88 + .../funtest/server/tests/DeleteServiceTest.java | 197 + .../funtest/server/tests/LocalAmbariServer.java | 99 + .../funtest/server/tests/ServerTestBase.java | 166 + .../server/tests/StartStopServerTest.java | 104 + .../funtest/server/utils/ClusterUtils.java | 182 + .../server/utils/RequestStatusPoller.java | 93 + .../funtest/server/utils/RestApiUtils.java | 52 + .../src/test/resources/log4j.properties | 21 + .../src/test/resources/os_family.json | 45 + .../test/resources/stacks/HDP/0.1/metainfo.xml | 22 + .../resources/stacks/HDP/0.1/repos/repoinfo.xml | 57 + .../services/HDFS/configuration/hbase-site.xml | 137 + .../services/HDFS/configuration/hdfs-site.xml | 396 + .../stacks/HDP/0.1/services/HDFS/metainfo.xml | 155 + .../MAPREDUCE/configuration/hbase-site.xml | 137 + .../MAPREDUCE/configuration/hdfs-site.xml | 396 + .../MAPREDUCE/configuration/mapred-site.xml | 400 + .../HDP/0.1/services/MAPREDUCE/metainfo.xml | 89 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/0.1/services/PIG/metainfo.xml | 61 + .../test/resources/stacks/HDP/0.2/metainfo.xml | 22 + .../resources/stacks/HDP/0.2/repos/repoinfo.xml | 57 + .../services/HBASE/configuration/hbase-site.xml | 137 + .../stacks/HDP/0.2/services/HBASE/metainfo.xml | 121 + .../0.2/services/HDFS/configuration/global.xml | 145 + .../services/HDFS/configuration/hadoop-env.xml | 230 + .../services/HDFS/configuration/hbase-site.xml | 137 + .../services/HDFS/configuration/hdfs-log4j.xml | 202 + .../services/HDFS/configuration/hdfs-site.xml | 396 + .../stacks/HDP/0.2/services/HDFS/metainfo.xml | 134 + .../stacks/HDP/0.2/services/HIVE/metainfo.xml | 127 + .../services/MAPREDUCE/configuration/global.xml | 160 + .../MAPREDUCE/configuration/hbase-site.xml | 137 + .../MAPREDUCE/configuration/hdfs-site.xml | 396 + .../MAPREDUCE/configuration/mapred-site.xml | 400 + .../HDP/0.2/services/MAPREDUCE/metainfo.xml | 97 + .../HDP/0.2/services/ZOOKEEPER/metainfo.xml | 72 + .../resources/stacks/HDP/1.2.0/metainfo.xml | 22 + .../stacks/HDP/1.2.0/repos/repoinfo.xml | 123 + .../HDP/1.2.0/services/GANGLIA/metainfo.xml | 97 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 344 + .../HDP/1.2.0/services/HBASE/metainfo.xml | 120 + .../HDP/1.2.0/services/HCATALOG/metainfo.xml | 57 + .../services/HDFS/configuration/core-site.xml | 251 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 408 + .../stacks/HDP/1.2.0/services/HDFS/metainfo.xml | 137 + .../services/HIVE/configuration/hive-site.xml | 132 + .../stacks/HDP/1.2.0/services/HIVE/metainfo.xml | 143 + .../configuration/capacity-scheduler.xml | 195 + .../MAPREDUCE/configuration/core-site.xml | 20 + .../configuration/mapred-queue-acls.xml | 39 + .../MAPREDUCE/configuration/mapred-site.xml | 537 ++ .../HDP/1.2.0/services/MAPREDUCE/metainfo.xml | 86 + .../services/OOZIE/configuration/oozie-site.xml | 245 + .../HDP/1.2.0/services/OOZIE/metainfo.xml | 110 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/1.2.0/services/PIG/metainfo.xml | 60 + .../HDP/1.2.0/services/SQOOP/metainfo.xml | 73 + .../WEBHCAT/configuration/webhcat-site.xml | 126 + .../HDP/1.2.0/services/WEBHCAT/metainfo.xml | 95 + .../HDP/1.2.0/services/ZOOKEEPER/metainfo.xml | 72 + .../resources/stacks/HDP/1.3.0/metainfo.xml | 23 + .../stacks/HDP/1.3.0/repos/repoinfo.xml | 111 + .../services/GANGLIA/configuration/global.xml | 55 + .../HDP/1.3.0/services/GANGLIA/metainfo.xml | 97 + .../services/HBASE/configuration/global.xml | 179 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 365 + .../HDP/1.3.0/services/HBASE/metainfo.xml | 120 + .../services/HCATALOG/configuration/global.xml | 45 + .../HDP/1.3.0/services/HCATALOG/metainfo.xml | 57 + .../services/HDFS/configuration/core-site.xml | 253 + .../services/HDFS/configuration/global.xml | 202 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 418 + .../stacks/HDP/1.3.0/services/HDFS/metainfo.xml | 136 + .../services/HIVE/configuration/global.xml | 120 + .../services/HIVE/configuration/hive-site.xml | 237 + .../stacks/HDP/1.3.0/services/HIVE/metainfo.xml | 143 + .../1.3.0/services/HUE/configuration/global.xml | 35 + .../services/HUE/configuration/hue-site.xml | 290 + .../stacks/HDP/1.3.0/services/HUE/metainfo.xml | 35 + .../configuration/capacity-scheduler.xml | 195 + .../MAPREDUCE/configuration/core-site.xml | 20 + .../services/MAPREDUCE/configuration/global.xml | 160 + .../configuration/mapred-queue-acls.xml | 39 + .../MAPREDUCE/configuration/mapred-site.xml | 537 ++ .../HDP/1.3.0/services/MAPREDUCE/metainfo.xml | 86 + .../services/OOZIE/configuration/global.xml | 105 + .../services/OOZIE/configuration/oozie-site.xml | 245 + .../HDP/1.3.0/services/OOZIE/metainfo.xml | 110 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/1.3.0/services/PIG/metainfo.xml | 60 + .../HDP/1.3.0/services/SQOOP/metainfo.xml | 73 + .../WEBHCAT/configuration/webhcat-site.xml | 126 + .../HDP/1.3.0/services/WEBHCAT/metainfo.xml | 34 + .../services/ZOOKEEPER/configuration/global.xml | 75 + .../HDP/1.3.0/services/ZOOKEEPER/metainfo.xml | 71 + .../resources/stacks/HDP/1.3.1/metainfo.xml | 23 + .../stacks/HDP/1.3.1/repos/repoinfo.xml | 97 + .../HDP/1.3.1/services/GANGLIA/metainfo.xml | 97 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 345 + .../HDP/1.3.1/services/HBASE/metainfo.xml | 121 + .../HDP/1.3.1/services/HCATALOG/metainfo.xml | 57 + .../services/HCFS/configuration/core-site.xml | 251 + .../HCFS/configuration/hadoop-policy.xml | 134 + .../services/HCFS/configuration/hdfs-site.xml | 408 + .../stacks/HDP/1.3.1/services/HCFS/metainfo.xml | 33 + .../services/HDFS/configuration/core-site.xml | 251 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 408 + .../stacks/HDP/1.3.1/services/HDFS/metainfo.xml | 136 + .../services/HIVE/configuration/hive-site.xml | 132 + .../stacks/HDP/1.3.1/services/HIVE/metainfo.xml | 143 + .../configuration/capacity-scheduler.xml | 195 + .../MAPREDUCE/configuration/core-site.xml | 20 + .../configuration/mapred-queue-acls.xml | 39 + .../MAPREDUCE/configuration/mapred-site.xml | 531 ++ .../HDP/1.3.1/services/MAPREDUCE/metainfo.xml | 86 + .../HDP/1.3.1/services/NONAME/metainfo.xml | 33 + .../services/OOZIE/configuration/oozie-site.xml | 245 + .../HDP/1.3.1/services/OOZIE/metainfo.xml | 110 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/1.3.1/services/PIG/metainfo.xml | 60 + .../HDP/1.3.1/services/SQOOP/metainfo.xml | 73 + .../WEBHCAT/configuration/webhcat-site.xml | 126 + .../HDP/1.3.1/services/WEBHCAT/metainfo.xml | 95 + .../HDP/1.3.1/services/ZOOKEEPER/metainfo.xml | 72 + .../resources/stacks/HDP/1.3.4/metainfo.xml | 22 + .../HDP/1.3.4/services/GANGLIA/metainfo.xml | 96 + .../HDP/1.3.4/services/HBASE/metainfo.xml | 122 + .../services/HDFS/configuration/hdfs-log4j.xml | 198 + .../stacks/HDP/1.3.4/services/HDFS/metainfo.xml | 136 + .../stacks/HDP/1.3.4/services/HIVE/metainfo.xml | 179 + .../stacks/HDP/1.3.4/services/HUE/metainfo.xml | 36 + .../HDP/1.3.4/services/MAPREDUCE/metainfo.xml | 102 + .../HDP/1.3.4/services/OOZIE/metainfo.xml | 110 + .../stacks/HDP/1.3.4/services/PIG/metainfo.xml | 60 + .../HDP/1.3.4/services/SQOOP/metainfo.xml | 75 + .../HDP/1.3.4/services/WEBHCAT/metainfo.xml | 94 + .../HDP/1.3.4/services/ZOOKEEPER/metainfo.xml | 71 + .../resources/stacks/HDP/2.0.1/metainfo.xml | 22 + .../stacks/HDP/2.0.1/repos/repoinfo.xml | 75 + .../HDP/2.0.1/services/GANGLIA/metainfo.xml | 129 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 350 + .../HDP/2.0.1/services/HBASE/metainfo.xml | 112 + .../HDP/2.0.1/services/HCATALOG/metainfo.xml | 56 + .../services/HDFS/configuration/core-site.xml | 257 + .../services/HDFS/configuration/global.xml | 202 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 431 + .../stacks/HDP/2.0.1/services/HDFS/metainfo.xml | 158 + .../services/HIVE/configuration/hive-site.xml | 136 + .../stacks/HDP/2.0.1/services/HIVE/metainfo.xml | 156 + .../configuration/container-executor.cfg | 20 + .../MAPREDUCE2/configuration/core-site.xml | 20 + .../MAPREDUCE2/configuration/global.xml | 44 + .../configuration/mapred-queue-acls.xml | 39 + .../MAPREDUCE2/configuration/mapred-site.xml | 300 + .../HDP/2.0.1/services/MAPREDUCE2/metainfo.xml | 87 + .../services/OOZIE/configuration/oozie-site.xml | 245 + .../HDP/2.0.1/services/OOZIE/metainfo.xml | 140 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/2.0.1/services/PIG/metainfo.xml | 62 + .../stacks/HDP/2.0.1/services/TEZ/metainfo.xml | 34 + .../WEBHCAT/configuration/webhcat-site.xml | 126 + .../HDP/2.0.1/services/WEBHCAT/metainfo.xml | 102 + .../YARN/configuration/capacity-scheduler.xml | 112 + .../YARN/configuration/container-executor.cfg | 20 + .../services/YARN/configuration/core-site.xml | 20 + .../services/YARN/configuration/global.xml | 49 + .../services/YARN/configuration/yarn-site.xml | 172 + .../stacks/HDP/2.0.1/services/YARN/metainfo.xml | 110 + .../HDP/2.0.1/services/ZOOKEEPER/metainfo.xml | 75 + .../resources/stacks/HDP/2.0.5/metainfo.xml | 22 + .../stacks/HDP/2.0.5/repos/repoinfo.xml | 61 + .../HDP/2.0.5/services/GANGLIA/metainfo.xml | 130 + .../services/HBASE/configuration/global.xml | 179 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 363 + .../HDP/2.0.5/services/HBASE/metainfo.xml | 112 + .../HDP/2.0.5/services/HBASE/metrics.json | 3206 +++++++ .../HDP/2.0.5/services/HCATALOG/metainfo.xml | 56 + .../stacks/HDP/2.0.5/services/HDFS/alerts.json | 144 + .../services/HDFS/configuration/core-site.xml | 195 + .../services/HDFS/configuration/global.xml | 197 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 454 + .../stacks/HDP/2.0.5/services/HDFS/metainfo.xml | 196 + .../stacks/HDP/2.0.5/services/HDFS/metrics.json | 2961 +++++++ .../services/HIVE/configuration/hive-site.xml | 255 + .../stacks/HDP/2.0.5/services/HIVE/metainfo.xml | 260 + .../configuration/container-executor.cfg | 20 + .../MAPREDUCE2/configuration/core-site.xml | 20 + .../MAPREDUCE2/configuration/global.xml | 44 + .../configuration/mapred-queue-acls.xml | 39 + .../MAPREDUCE2/configuration/mapred-site.xml | 382 + .../HDP/2.0.5/services/MAPREDUCE2/metainfo.xml | 87 + .../services/OOZIE/configuration/oozie-site.xml | 245 + .../HDP/2.0.5/services/OOZIE/metainfo.xml | 140 + .../services/PIG/configuration/pig.properties | 52 + .../stacks/HDP/2.0.5/services/PIG/metainfo.xml | 62 + .../HDP/2.0.5/services/SQOOP/metainfo.xml | 73 + .../YARN/configuration/capacity-scheduler.xml | 112 + .../YARN/configuration/container-executor.cfg | 20 + .../services/YARN/configuration/core-site.xml | 20 + .../services/YARN/configuration/global.xml | 64 + .../services/YARN/configuration/yarn-site.xml | 311 + .../stacks/HDP/2.0.5/services/YARN/metainfo.xml | 115 + .../stacks/HDP/2.0.5/services/YARN/metrics.json | 1661 ++++ .../services/ZOOKEEPER/configuration/global.xml | 75 + .../ZOOKEEPER/configuration/zoo.cfg.xml | 62 + .../HDP/2.0.5/services/ZOOKEEPER/metainfo.xml | 89 + .../stacks/HDP/2.0.6.1/hooks/dummy-script.py | 20 + .../resources/stacks/HDP/2.0.6.1/metainfo.xml | 24 + .../stacks/HDP/2.0.6.1/repos/repoinfo.xml | 61 + .../stacks/HDP/2.0.6.1/role_command_order.json | 92 + .../services/FLUME/configuration/flume-conf.xml | 34 + .../services/FLUME/configuration/flume-env.xml | 44 + .../FLUME/configuration/flume-log4j.xml | 31 + .../HDP/2.0.6.1/services/FLUME/metainfo.xml | 69 + .../HDP/2.0.6.1/services/HBASE/metainfo.xml | 27 + .../HDP/2.0.6.1/services/SQOOP/metainfo.xml | 34 + .../HDP/2.0.6.1/services/YARN/metainfo.xml | 27 + .../stacks/HDP/2.0.6/hooks/dummy-script.py | 20 + .../resources/stacks/HDP/2.0.6/metainfo.xml | 24 + .../stacks/HDP/2.0.6/repos/repoinfo.xml | 61 + .../stacks/HDP/2.0.6/role_command_order.json | 92 + .../services/FLUME/configuration/flume-conf.xml | 34 + .../services/FLUME/configuration/flume-env.xml | 44 + .../FLUME/configuration/flume-log4j.xml | 34 + .../HDP/2.0.6/services/FLUME/metainfo.xml | 69 + .../HDP/2.0.6/services/HBASE/metainfo.xml | 113 + .../HDP/2.0.6/services/SQOOP/metainfo.xml | 34 + .../services/YARN/configuration/yarn-site.xml | 117 + .../stacks/HDP/2.0.6/services/YARN/metainfo.xml | 122 + .../resources/stacks/HDP/2.0.7/metainfo.xml | 24 + .../stacks/HDP/2.0.7/repos/repoinfo.xml | 61 + .../stacks/HDP/2.0.7/role_command_order.json | 92 + .../services/HBASE/configuration/global.xml | 174 + .../HBASE/configuration/hbase-policy.xml | 53 + .../services/HBASE/configuration/hbase-site.xml | 356 + .../HDP/2.0.7/services/HBASE/metainfo.xml | 130 + .../services/HBASE/package/dummy-script.py | 20 + .../services/HDFS/configuration/core-site.xml | 167 + .../services/HDFS/configuration/global.xml | 202 + .../HDFS/configuration/hadoop-policy.xml | 134 + .../services/HDFS/configuration/hdfs-site.xml | 514 ++ .../stacks/HDP/2.0.7/services/HDFS/metainfo.xml | 158 + .../2.0.7/services/HDFS/package/dummy-script.py | 20 + .../services/HIVE/configuration/hive-site.xml | 261 + .../stacks/HDP/2.0.7/services/HIVE/metainfo.xml | 174 + .../services/HIVE/package/files/addMysqlUser.sh | 41 + .../services/HIVE/package/files/hcatSmoke.sh | 35 + .../services/HIVE/package/files/hiveSmoke.sh | 23 + .../services/HIVE/package/files/hiveserver2.sql | 23 + .../HIVE/package/files/hiveserver2Smoke.sh | 31 + .../services/HIVE/package/files/pigSmoke.sh | 18 + .../HIVE/package/files/startHiveserver2.sh | 22 + .../HIVE/package/files/startMetastore.sh | 22 + .../services/HIVE/package/scripts/__init__.py | 19 + .../2.0.7/services/HIVE/package/scripts/hcat.py | 47 + .../HIVE/package/scripts/hcat_client.py | 43 + .../HIVE/package/scripts/hcat_service_check.py | 63 + .../2.0.7/services/HIVE/package/scripts/hive.py | 123 + .../HIVE/package/scripts/hive_client.py | 41 + .../HIVE/package/scripts/hive_metastore.py | 63 + .../HIVE/package/scripts/hive_server.py | 63 + .../HIVE/package/scripts/hive_service.py | 56 + .../HIVE/package/scripts/mysql_server.py | 77 + .../HIVE/package/scripts/mysql_service.py | 44 + .../services/HIVE/package/scripts/params.py | 123 + .../HIVE/package/scripts/service_check.py | 56 + .../HIVE/package/scripts/status_params.py | 30 + .../HIVE/package/templates/hcat-env.sh.j2 | 25 + .../HIVE/package/templates/hive-env.sh.j2 | 55 + .../HDP/2.0.7/services/SQOOP/metainfo.xml | 39 + .../services/YARN/config-mr2/mapred-site.xml | 28 + .../services/YARN/configuration/yarn-site.xml | 60 + .../stacks/HDP/2.0.7/services/YARN/metainfo.xml | 171 + .../HDP/2.0.7/services/ZOOKEEPER/metainfo.xml | 89 + .../stacks/HDP/2.0.8/hooks/dummy-script.py | 20 + .../resources/stacks/HDP/2.0.8/kerberos.json | 42 + .../resources/stacks/HDP/2.0.8/metainfo.xml | 24 + .../stacks/HDP/2.0.8/repos/repoinfo.xml | 61 + .../stacks/HDP/2.0.8/role_command_order.json | 79 + .../HDP/2.0.8/services/FAKENAGIOS/metainfo.xml | 51 + .../services/HBASE/configuration/hbase-site.xml | 356 + .../HDP/2.0.8/services/HBASE/metainfo.xml | 84 + .../services/HDFS/configuration/hdfs-site.xml | 45 + .../HDP/2.0.8/services/HDFS/kerberos.json | 141 + .../stacks/HDP/2.0.8/services/HDFS/metainfo.xml | 146 + .../stacks/HDP/2.0.8/services/HDFS/metrics.json | 7860 +++++++++++++++++ .../2.0.8/services/HDFS/package/dummy-script.py | 20 + .../HDP/2.0.8/services/SQOOP/metainfo.xml | 40 + .../resources/stacks/HDP/2.1.1/metainfo.xml | 24 + .../resources/stacks/HDP/2.1.1/repos/hdp.json | 10 + .../stacks/HDP/2.1.1/repos/repoinfo.xml | 62 + .../stacks/HDP/2.1.1/role_command_order.json | 81 + .../2.1.1/services/AMBARI_METRICS/metainfo.xml | 133 + .../stacks/HDP/2.1.1/services/HDFS/metainfo.xml | 146 + .../PIG/configuration/pig-properties.xml | 94 + .../stacks/HDP/2.1.1/services/PIG/metainfo.xml | 34 + .../2.1.1/services/PIG/role_command_order.json | 12 + .../STORM/configuration/placeholder.txt | 17 + .../HDP/2.1.1/services/STORM/metainfo.xml | 106 + .../HDP/2.1.1/services/STORM/metrics.json | 114 + .../services/STORM/package/placeholder.txt | 17 + .../stacks/HDP/2.1.1/services/TEZ/metainfo.xml | 34 + .../HDP/2.1.1/upgrades/config-upgrade.xml | 133 + .../HDP/2.1.1/upgrades/upgrade_bucket_test.xml | 88 + .../HDP/2.1.1/upgrades/upgrade_direction.xml | 101 + .../upgrades/upgrade_nonrolling_new_stack.xml | 974 +++ .../upgrades/upgrade_server_action_test.xml | 65 + .../stacks/HDP/2.1.1/upgrades/upgrade_test.xml | 211 + .../HDP/2.1.1/upgrades/upgrade_test_checks.xml | 203 + .../2.1.1/upgrades/upgrade_test_nonrolling.xml | 190 + .../HDP/2.1.1/upgrades/upgrade_to_new_stack.xml | 213 + .../resources/stacks/HDP/2.2.0.ECS/metainfo.xml | 24 + .../stacks/HDP/2.2.0.ECS/repos/hdp.json | 10 + .../stacks/HDP/2.2.0.ECS/repos/repoinfo.xml | 62 + .../HDP/2.2.0.ECS/services/ECS/metainfo.xml | 35 + .../HDP/2.2.0.ECS/services/HDFS/metainfo.xml | 28 + .../resources/stacks/HDP/2.2.0/metainfo.xml | 24 + .../resources/stacks/HDP/2.2.0/repos/hdp.json | 10 + .../stacks/HDP/2.2.0/repos/repoinfo.xml | 62 + .../stacks/HDP/2.2.0/role_command_order.json | 81 + .../HDP/2.2.0/services/GANGLIA/metainfo.xml | 39 + .../stacks/HDP/2.2.0/services/HDFS/metainfo.xml | 59 + .../HDP/2.2.0/services/ZOOKEEPER/metainfo.xml | 40 + .../HDP/2.2.0/upgrades/config-upgrade.xml | 101 + .../stacks/HDP/2.2.0/upgrades/upgrade_test.xml | 221 + .../HDP/2.2.0/upgrades/upgrade_test_checks.xml | 208 + .../upgrades/upgrade_test_skip_failures.xml | 74 + .../resources/stacks/OTHER/1.0/metainfo.xml | 23 + .../resources/stacks/OTHER/1.0/repos/hdp.json | 10 + .../stacks/OTHER/1.0/repos/repoinfo.xml | 62 + .../stacks/OTHER/1.0/role_command_order.json | 92 + .../services/HDFS/configuration/hdfs-site.xml | 45 + .../stacks/OTHER/1.0/services/HDFS/metainfo.xml | 146 + .../stacks/OTHER/1.0/services/HDFS/metrics.json | 7861 ++++++++++++++++++ .../1.0/services/HDFS/package/dummy-script.py | 20 + .../OTHER/1.0/services/SQOOP2/metainfo.xml | 30 + .../STORM/configuration/placeholder.txt | 17 + .../OTHER/1.0/services/STORM/metainfo.xml | 29 + .../OTHER/1.0/services/STORM/metrics.json | 103 + .../1.0/services/STORM/package/placeholder.txt | 17 + .../resources/stacks/OTHER/2.0/metainfo.xml | 24 + .../resources/stacks/OTHER/2.0/repos/hdp.json | 10 + .../stacks/OTHER/2.0/repos/repoinfo.xml | 62 + .../OTHER/2.0/services/HBASE/metainfo.xml | 32 + .../OTHER/2.0/services/HBASE/widgets.json | 190 + .../OTHER/2.0/services/SQOOP2/metainfo.xml | 28 + .../stacks/XYZ/1.0.0/services/stack_advisor.py | 67 + .../stacks/XYZ/1.0.1/services/stack_advisor.py | 30 + ambari-funtest/src/test/resources/version | 1 + .../api/AmbariHttpWebRequest.java | 393 - .../api/ClusterConfigParams.java | 84 - .../functionaltests/api/ConnectionParams.java | 89 - .../server/functionaltests/api/WebRequest.java | 192 - .../server/functionaltests/api/WebResponse.java | 57 - .../AddDesiredConfigurationWebRequest.java | 108 - .../api/cluster/CreateClusterWebRequest.java | 88 - .../cluster/CreateConfigurationWebRequest.java | 87 - .../api/cluster/GetAllClustersWebRequest.java | 53 - .../api/cluster/GetClusterWebRequest.java | 49 - .../api/cluster/GetRequestStatusWebRequest.java | 78 - .../api/host/AddHostWebRequest.java | 63 - .../api/host/GetHostWebRequest.java | 56 - .../api/host/GetRegisteredHostWebRequest.java | 59 - .../api/host/RegisterHostWebRequest.java | 59 - .../api/service/AddServiceWebRequest.java | 98 - .../api/service/DeleteServiceWebRequest.java | 67 - .../api/service/GetServiceWebRequest.java | 67 - .../api/service/InstallServiceWebRequest.java | 39 - .../api/service/SetServiceStateWebRequest.java | 97 - .../api/service/StartServiceWebRequest.java | 38 - .../api/service/StopServiceWebRequest.java | 38 - .../AddServiceComponentWebRequest.java | 69 - .../GetServiceComponentWebRequest.java | 69 - .../SetServiceComponentStateWebRequest.java | 87 - .../AddServiceComponentHostWebRequest.java | 69 - .../BulkAddServiceComponentHostsWebRequest.java | 127 - ...kSetServiceComponentHostStateWebRequest.java | 91 - .../GetServiceComponentHostWebRequest.java | 69 - .../SetServiceComponentHostStateWebRequest.java | 89 - .../server/DeleteServiceTest.java | 197 - .../server/LocalAmbariServer.java | 99 - .../functionaltests/server/ServerTestBase.java | 146 - .../server/StartStopServerTest.java | 102 - .../functionaltests/utils/ClusterUtils.java | 247 - .../functionaltests/utils/RestApiUtils.java | 52 - pom.xml | 4 + 432 files changed, 68106 insertions(+), 3472 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/pom.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/pom.xml b/ambari-funtest/pom.xml new file mode 100644 index 0000000..7e47c69 --- /dev/null +++ b/ambari-funtest/pom.xml @@ -0,0 +1,557 @@ +<?xml version="1.0"?> +<!-- Licensed under the Apache License, Version 2.0 (the "License"); you + may not use this file except in compliance with the License. You may obtain + a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless + required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + OR CONDITIONS OF ANY KIND, either express or implied. See the License for + the specific language governing permissions and limitations under the License. + See accompanying LICENSE file. --> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-project</artifactId> + <version>2.0.0.0-SNAPSHOT</version> + <relativePath>../ambari-project</relativePath> + </parent> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-funtest</artifactId> + <version>2.0.0.0-SNAPSHOT</version> + <packaging>${packagingFormat}</packaging> + <name>Ambari Functional Tests</name> + <description>Ambari Functional Tests</description> + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <descriptors> + <descriptor>${assemblydescriptor}</descriptor> + </descriptors> + <tarLongFileMode>gnu</tarLongFileMode> + </configuration> + <executions> + <execution> + <id>build-tarball</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <configuration> + <includes> + <include>**/*.java</include> + </includes> + <forkMode>once</forkMode> + </configuration> + <executions> + <!-- Will display BUILD SUCCESSFUL if build is successful. + Does not matter if the tests fail --> + <execution> + <id>run-integration-tests</id> + <phase>test</phase> + <goals> + <goal>integration-test</goal> + </goals> + </execution> + <!-- Will display BUILD FAILURE if build fails or any test fails --> + <execution> + <id>run-verify</id> + <phase>verify</phase> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes> + <exclude>src/test/resources/version</exclude> + <exclude>src/test/resources/os_family.json</exclude> + <exclude>src/test/resources/stacks/**</exclude> + <exclude>derby.log</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + <excludes> + <exclude>stacks/**</exclude> + <exclude>common-services/**</exclude> + </excludes> + </resource> + <resource> + <directory>src/main/resources</directory> + <filtering>false</filtering> + <includes> + <include>stacks/**</include> + <include>common-services/**</include> + </includes> + </resource> + </resources> + </build> + <profiles> + <profile> + <id>linux</id> + <activation> + <os> + <family>unix</family> + </os> + </activation> + <properties> + <envClassifier>linux</envClassifier> + <dirsep>/</dirsep> + <pathsep>:</pathsep> + <executable.shell>sh</executable.shell> + <fileextension.shell>sh</fileextension.shell> + <fileextension.dot.shell-default></fileextension.dot.shell-default> + <assemblydescriptor>src/main/assemblies/funtest.xml</assemblydescriptor> + <packagingFormat>jar</packagingFormat> + </properties> + </profile> + </profiles> + <dependencies> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>1.4</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-csv</artifactId> + </dependency> + <dependency> + <groupId>uk.com.robust-it</groupId> + <artifactId>cloning</artifactId> + <version>1.9.2</version> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-assistedinject</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-persist</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-servlet</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-multibindings</artifactId> + <version>3.0</version> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-core</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-mock</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-ldap</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.ldap</groupId> + <artifactId>spring-ldap-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-server-annotations</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core-integ</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-server-integ</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-jdbm</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-kerberos-codec</artifactId> + <exclusions> + <exclusion> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-core</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>apacheds-protocol-ldap</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.directory.server</groupId> + <artifactId>kerberos-client</artifactId> + </dependency> + <dependency> + <groupId>org.apache.directory.shared</groupId> + <artifactId>shared-ldap</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.persistence</groupId> + <artifactId>eclipselink</artifactId> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-security</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlets</artifactId> + </dependency> + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-webapp</artifactId> + </dependency> + <!--jsp support for jetty --> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jsp-api-2.1-glassfish</artifactId> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jsp-2.1-glassfish</artifactId> + </dependency> + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant</artifactId> + </dependency> + <dependency> + <groupId>org.apache.ant</groupId> + <artifactId>ant-launcher</artifactId> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + </dependency> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + </dependency> + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + </dependency> + <dependency> + <groupId>commons-net</groupId> + <artifactId>commons-net</artifactId> + <version>1.4.1</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-json</artifactId> + <exclusions> + <exclusion> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-xc</artifactId> + </exclusion> + <exclusion> + <groupId>org.codehaus.jettison</groupId> + <artifactId>jettison</artifactId> + </exclusion> + <exclusion> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-server</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey.contribs</groupId> + <artifactId>jersey-multipart</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey.contribs</groupId> + <artifactId>jersey-guice</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + <version>1.9.2</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-core-asl</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-jaxrs</artifactId> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-xc</artifactId> + </dependency> + <dependency> + <groupId>com.sun.jersey.jersey-test-framework</groupId> + <artifactId>jersey-test-framework-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.sun.jersey.jersey-test-framework</groupId> + <artifactId>jersey-test-framework-grizzly2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.codehaus.jettison</groupId> + <artifactId>jettison</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.easymock</groupId> + <artifactId>easymock</artifactId> + <version>3.4</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-junit4</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-easymock</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-reflect</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>nl.jqno.equalsverifier</groupId> + <artifactId>equalsverifier</artifactId> + <version>1.7.4</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.objenesis</groupId> + <artifactId>objenesis-tck</artifactId> + <version>1.2</version> + </dependency> + <dependency> + <groupId>cglib</groupId> + <artifactId>cglib</artifactId> + <version>2.2.2</version> + </dependency> + <dependency> + <groupId>asm</groupId> + <artifactId>asm</artifactId> + <version>3.3.1</version> + </dependency> + <dependency> + <groupId>com.google.inject</groupId> + <artifactId>guice</artifactId> + <version>3.0</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.2.2</version> + </dependency> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>9.3-1101-jdbc4</version> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.2.5</version> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>14.0.1</version> + </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>jsr305</artifactId> + <version>1.3.9</version> + </dependency> + <dependency> + <groupId>org.quartz-scheduler</groupId> + <artifactId>quartz</artifactId> + <version>2.2.1</version> + </dependency> + <dependency> + <groupId>org.quartz-scheduler</groupId> + <artifactId>quartz-jobs</artifactId> + <version>2.2.1</version> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + <dependency> + <groupId>com.sun.mail</groupId> + <artifactId>mailapi</artifactId> + <version>1.5.2</version> + </dependency> + <dependency> + <groupId>com.sun.mail</groupId> + <artifactId>smtp</artifactId> + <version>1.5.2</version> + </dependency> + <dependency> + <groupId>org.snmp4j</groupId> + <artifactId>snmp4j</artifactId> + <version>1.10.1</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-metrics-common</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.ambari</groupId> + <artifactId>ambari-server</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.1.4</version> + </dependency> + <dependency> + <groupId>net.sf.ehcache</groupId> + <artifactId>ehcache</artifactId> + <version>2.10.0</version> + </dependency> + <dependency> + <groupId>com.nimbusds</groupId> + <artifactId>nimbus-jose-jwt</artifactId> + <version>3.9</version> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.bouncycastle</groupId> + <artifactId>bcprov-jdk15on</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/main/assemblies/funtest.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/main/assemblies/funtest.xml b/ambari-funtest/src/main/assemblies/funtest.xml new file mode 100644 index 0000000..93d2e17 --- /dev/null +++ b/ambari-funtest/src/main/assemblies/funtest.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<!-- + 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 + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<assembly> + <id>dist</id> + <formats> + <format>dir</format> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <files> + <file> + <source>${project.build.directory}/${artifact.artifactId}-${artifact.version}.jar</source> + <outputDirectory>ambari-funtest-${project.version}/lib/ambari-funtest</outputDirectory> + </file> + </files> + <fileSets> + <!-- Distro files, readme, licenses, etc --> + <fileSet> + <directory>${basedir}/../</directory> + <outputDirectory>ambari-funtest-${project.version}/</outputDirectory> + <includes> + <include>*.txt</include> + </includes> + </fileSet> + <!-- + <fileSet> + <directory>${basedir}/src/main/bin</directory> + <outputDirectory>ambari-funtest-${project.version}/bin</outputDirectory> + <includes> + <include>*</include> + </includes> + <fileMode>0755</fileMode> + </fileSet> + --> + <fileSet> + <directory>${basedir}/src/main/resources/</directory> + <outputDirectory>/ambari-funtest-${project.version}/keystore</outputDirectory> + <includes> + <include>db/*</include> + <include>ca.config</include> + <include>pass.txt</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/../ambari-web/public</directory> + <outputDirectory>ambari-funtest-${project.version}/web</outputDirectory> + <includes> + <include>**</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/conf</directory> + <outputDirectory>/ambari-funtest-${project.version}/etc/ambari-funtest/conf</outputDirectory> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>ambari-funtest-${project.version}/lib/ambari-funtest</outputDirectory> + <unpack>false</unpack> + <scope>compile</scope> + </dependencySet> + </dependencySets> +</assembly> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/AppTest.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/AppTest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/AppTest.java new file mode 100644 index 0000000..e7fd76f --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/AppTest.java @@ -0,0 +1,55 @@ +/** + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ambari.funtest; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/AmbariHttpWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/AmbariHttpWebRequest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/AmbariHttpWebRequest.java new file mode 100644 index 0000000..4a91176 --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/AmbariHttpWebRequest.java @@ -0,0 +1,393 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.stream.JsonReader; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +import org.apache.commons.codec.binary.Base64; + +import java.io.IOException; +import java.io.StringReader; +import java.util.Map; + + +/** + * REST API Client that performs various operations on the Ambari Server + * using Http. + */ +public class AmbariHttpWebRequest extends WebRequest { + private static final Log LOG = LogFactory.getLog(AmbariHttpWebRequest.class); + private static String SERVER_URL_FORMAT = "http://%s:%d"; + private static String SERVER_SSL_URL_FORMAT = "https://%s:%d"; + + private String content; + + private String serverName; + private int serverApiPort; + private int serverAgentPort; + private WebResponse response; + private String curlApi; + + /** + * Constructor to set the REST API URL, Server API port, Server Agent API port, user id and password. + * + * @param params + */ + public AmbariHttpWebRequest(ConnectionParams params) { + setServerName(params.getServerName()); + setServerApiPort(params.getServerApiPort()); + setServerAgentPort(params.getServerAgentPort()); + setUserName(params.getUserName()); + setPassword(params.getPassword()); + addHeader("X-Requested-By", "ambari"); + if (getUserName() != null) { + addHeader("Authorization", getBasicAuthentication()); + } + } + + /** + * Sends the request to the Ambari server and returns the response. + * + * @return - Response from the Ambari server. + * @throws IOException + */ + @Override + public WebResponse getResponse() throws IOException { + if (response == null) { + LOG.info(getCurlApi()); + response = executeRequest(); + } + + return response; + } + + /** + * Gets the full URI + * + * @return - Full path to the URI + */ + @Override + public String getUrl() { + return getServerApiUrl() + getApiPath(); + } + + /** + * Gets the JSON content (request data). + * + * @return - JSON content. + */ + @Override + public String getContent() { + if (content == null) { + content = getRequestData(); + } + + return content; + } + + /** + * Gets the content encoding. + * + * @return - Content encoding. + */ + @Override + public String getContentEncoding() { return "UTF-8"; } + + /** + * Gets the content type, like application/json, application/text, etc. + * + * @return - Content type. + */ + @Override + public String getContentType() { return "application/json"; } + + /** + * Gets the curl command line call for this request. Useful for + * debugging. + * + * @return - Curl command line call. + */ + public String getCurlApi() { + if (curlApi == null) { + StringBuilder sb = new StringBuilder(); + sb.append("curl"); + if (getUserName() != null) { + sb.append(String.format(" -u %s", getUserName())); + if (getPassword() != null) { + sb.append(String.format(":%s", getPassword())); + } + } + sb.append(String.format(" -H \"%s\"", "X-Requested-By: ambari")); + sb.append(String.format(" -X %s", getHttpMethod())); + if (getHttpMethod().equals("PUT") || getHttpMethod().equals("POST")) { + if (getContent() != null) { + sb.append(String.format(" -d '%s'", getContent())); + } + } + sb.append(String.format(" %s", getUrl())); + curlApi = sb.toString(); + } + + return curlApi; + } + + /** + * Sets the REST API URL for the Ambari Server + * + * @param serverName - REST API URL + */ + public void setServerName(String serverName) { this.serverName = serverName; } + + /** + * Gets the REST API URL for the Ambari Server + * + * @return - REST API URL + */ + public String getServerName() { return this.serverName; } + + /** + * Gets the port number for the REST API used by the web clients. + * + * @return - Server API port number. + */ + public int getServerApiPort() { return this.serverApiPort; } + + /** + * Sets the port number for the REST API used by the web clients. + * + * @param serverApiPort - Server API port. + */ + public void setServerApiPort(int serverApiPort) { this.serverApiPort = serverApiPort; } + + /** + * Gets the port number for the REST API used by the agent. + * + * @return - Agent API port number. + */ + public int getServerAgentPort() { return this.serverAgentPort; } + + /** + * Sets the port number for the REST API used by the agent. + * + * @param serverAgentPort - Agent API port number. + */ + public void setServerAgentPort(int serverAgentPort) { this.serverAgentPort = serverAgentPort; } + + /** + * Gets the REST API path fragment. + * + * @return - REST API path. + */ + protected String getApiPath() { return ""; } + + /** + * Gets the request data used in POST and PUT requests. + * + * @return - Request data. + */ + protected String getRequestData() { return ""; } + + /** + * Gets the basic authentication string to be used for the Authorization header. + * + * @return - Base-64 encoded authentication string. + */ + protected String getBasicAuthentication() { + String authString = getUserName() + ":" + getPassword(); + byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); + String authStringEnc = new String(authEncBytes); + + return "Basic " + authStringEnc; + } + + /** + * Gets URL for the Ambari Server (without the API path) + * + * @return - Ambari server URL. + */ + protected String getServerApiUrl() { + return String.format(SERVER_URL_FORMAT, getServerName(), getServerApiPort()); + } + + /** + * Gets URL for the Agent Server (without the API path) + * + * @return - Agent server URL. + */ + protected String getServerAgentUrl() { + return String.format(SERVER_URL_FORMAT, getServerName(), getServerAgentPort()); + } + + /** + * Helper method to create simple Json objects. + * + * @param name - Name + * @param value - Value + * @return - A JsonObject {name: value} + */ + protected static JsonObject createJsonObject(String name, String value) { + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(name, value); + return jsonObject; + } + + /** + * Helper method to create simple Json objects. + * + * @param name - Name + * @param jsonElement - Json object. + * @return - A JsonObject {name: jsonElement } + */ + protected static JsonObject createJsonObject(String name, JsonElement jsonElement) { + JsonObject jsonObject = new JsonObject(); + jsonObject.add(name, jsonElement); + return jsonObject; + } + + /** + * Executes the current request by using HttpClient methods and returns the response. + * + * @return - Response from the Ambari server/Agent server. + * @throws IOException + */ + private WebResponse executeRequest() throws IOException { + HttpMethodBase methodBase = null; + String httpMethod; + + httpMethod = getHttpMethod(); + + if (httpMethod.equals("GET")) { + methodBase = getGetMethod(); + } else if (httpMethod.equals("POST")) { + methodBase = getPostMethod(); + } else if (httpMethod.equals("PUT")) { + methodBase = getPutMethod(); + } else if (httpMethod.equals("DELETE")) { + methodBase = getDeleteMethod(); + } else { + new RuntimeException(String.format("Unsupported HTTP method: %s", httpMethod)); + } + + WebResponse response = new WebResponse(); + HttpClient httpClient = new HttpClient(); + Map<String, String> headers = getHeaders(); + + for (Map.Entry<String, String> header : headers.entrySet()) { + methodBase.addRequestHeader(header.getKey(), header.getValue()); + } + + methodBase.setQueryString(getQueryString()); + + try { + int statusCode = httpClient.executeMethod(methodBase); + response.setStatusCode(statusCode); + response.setContent(methodBase.getResponseBodyAsString()); + } finally { + methodBase.releaseConnection(); + } + + return response; + } + + /** + * Constructs a GetMethod instance. + * + * @return - GetMethod. + */ + private GetMethod getGetMethod() { + return new GetMethod(getUrl()); + } + + /** + * Constructs a PutMethod instance and sets the request data on it. + * + * @return - PutMethod. + */ + @SuppressWarnings("deprecation") + private PutMethod getPutMethod() { + PutMethod putMethod = new PutMethod(getUrl()); + + putMethod.setRequestBody(getContent()); + + return putMethod; + } + + /** + * Constructs a PostMethod and sets the request data on it. + * + * @return - PostMethod. + */ + @SuppressWarnings("deprecation") + private PostMethod getPostMethod() { + PostMethod postMethod = new PostMethod(getUrl()); + + /* + RequestEntity requestEntity = new StringRequestEntity( + request.getContent(), + request.getContentType(), + request.getContentEncoding()); + + postMethod.setRequestEntity(requestEntity); + */ + + postMethod.setRequestBody(getContent()); + + return postMethod; + } + + /** + * Constructs a DeleteMethod. + * + * @return - DeleteMethod. + */ + private DeleteMethod getDeleteMethod() { + return new DeleteMethod(getUrl()); + } + + @SuppressWarnings("deprecation") + private RuntimeException createRuntimeException(HttpException httpException) { + String message = httpException.getMessage(); + try { + JsonElement jsonElement = new JsonParser().parse(new JsonReader(new StringReader(httpException.getMessage()))); + if (jsonElement != null && jsonElement.getAsJsonObject().has("message")) { + message = jsonElement.getAsJsonObject().get("message").getAsString(); + } + } catch (Throwable t) { + } + if (httpException.getReasonCode() != HttpStatus.SC_OK) { + message = httpException.getReasonCode() + " " + httpException.getReason() + ": " + message; + } + return new RuntimeException(message, httpException); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ClusterConfigParams.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ClusterConfigParams.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ClusterConfigParams.java new file mode 100644 index 0000000..712432f --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ClusterConfigParams.java @@ -0,0 +1,84 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +import java.util.Map; + +/** + * Configurations in Ambari are distinguished using type and tag. + * Once a configuration is created, it can be applied to a service, + * specifying the type and tag for the configuration. + * + * Example: + * curl -i -X POST -d '{"type": "core-site", "tag": "version1363902625", "properties" : { "fs.default.name" : "localhost:8020"}}' + * http://<cluster-name>:8080/api/v1/clusters/c1/configurations + */ +public class ClusterConfigParams { + /** + * Name of the cluster + */ + private String clusterName; + + /** + * Configuration tag + */ + private String configTag; + + /** + * Configuration type + */ + private String configType; + + /** + * Configuration properties + */ + private Map<String, String> properties; + + public Map<String, String> getProperties() { + return properties; + } + + public void setProperties(Map<String, String> properties) { + this.properties = properties; + } + + public String getConfigType() { + return configType; + } + + public void setConfigType(String configType) { + this.configType = configType; + } + + public String getConfigTag() { + return configTag; + } + + public void setConfigTag(String configTag) { + this.configTag = configTag; + } + + public String getClusterName() { + return clusterName; + } + + public void setClusterName(String clusterName) { + this.clusterName = clusterName; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ConnectionParams.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ConnectionParams.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ConnectionParams.java new file mode 100644 index 0000000..8352393 --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/ConnectionParams.java @@ -0,0 +1,89 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +/** + * Ambari server connection parameters + */ +public class ConnectionParams { + /** + * Server name + */ + private String serverName; + + /** + * Server port + */ + private int serverApiPort; + + /** + * Agent server port + */ + private int serverAgentPort; + + /** + * User name + */ + private String userName; + + /** + * Password + */ + private String password; + + public String getServerName() { + return serverName; + } + + public void setServerName(String serverName) { + this.serverName = serverName; + } + + public int getServerApiPort() { + return serverApiPort; + } + + public void setServerApiPort(int serverApiPort) { + this.serverApiPort = serverApiPort; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public int getServerAgentPort() { + return serverAgentPort; + } + + public void setServerAgentPort(int serverAgentPort) { + this.serverAgentPort = serverAgentPort; + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/LocalAmbariServer.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/LocalAmbariServer.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/LocalAmbariServer.java new file mode 100644 index 0000000..3698027 --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/LocalAmbariServer.java @@ -0,0 +1,99 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +import com.google.inject.Inject; +import com.google.inject.persist.PersistService; +import org.apache.ambari.server.controller.AmbariServer; +import org.apache.ambari.server.orm.GuiceJpaInitializer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import com.google.inject.Injector; + +/** +* Wrap AmbariServer as a testable unit. +*/ +public class LocalAmbariServer implements Runnable { + + private static Log LOG = LogFactory.getLog(AmbariServer.class); + + /** + * Actual ambari server instance. + */ + private AmbariServer ambariServer = null; + + @Inject + private Injector injector; + + public LocalAmbariServer() {} + + /** + * Thread entry point. + */ + @Override + public void run(){ + try { + startServer(); + } + catch (Exception ex) { + LOG.info("Exception received ", ex); + throw new RuntimeException(ex); + } + } + + /** + * Configures the Guice injector to use the in-memory test DB + * and attempts to start an instance of AmbariServer. + * + * @throws Exception + */ + private void startServer() throws Exception { + try { + LOG.info("Attempting to start ambari server..."); + + AmbariServer.setupProxyAuth(); + injector.getInstance(GuiceJpaInitializer.class); + ambariServer = injector.getInstance(AmbariServer.class); + ambariServer.initViewRegistry(); + ambariServer.run(); + } catch (InterruptedException ex) { + LOG.info(ex); + } catch (Throwable t) { + LOG.error("Failed to run the Ambari Server", t); + stopServer(); + throw t; + } + } + + /** + * Attempts to stop the test AmbariServer instance. + * @throws Exception + */ + public void stopServer() throws Exception { + LOG.info("Stopping ambari server..."); + + if (ambariServer != null) { + ambariServer.stop(); + } + + if (injector != null) { + injector.getInstance(PersistService.class).stop(); + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebRequest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebRequest.java new file mode 100644 index 0000000..766c84b --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebRequest.java @@ -0,0 +1,192 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +import java.util.Collections; +import java.util.Map; +import java.util.HashMap; + +/** + * Makes a request to a URL. + */ +public class WebRequest { + private String httpMethod; + private String url; + private String queryString; + private String content; + private String contentType; + private String contentEncoding; + private String userName; + private String password; + + private Map<String, String> headers = new HashMap<>(); + + public WebRequest() {} + + public WebResponse getResponse() throws Exception { + return null; + } + + /** + * Gets the HTTP Method (POST, GET, PUT, DELETE) + * + * @return - HTTP Method + */ + public String getHttpMethod() { return this.httpMethod; } + + /** + * Sets the HTTP Method to use. + * + * @param httpMethod + */ + public void setHttpMethod(String httpMethod) { this.httpMethod = httpMethod; } + + /** + * Gets the full URL to the request. + * + * @return + */ + public String getUrl() { return this.url; } + + /** + * Sets the full URL to the request. + * + * @param url + */ + public void setUrl(String url) { this.url = url; } + + /** + * Gets the query string (name1=value1?name2=value2) + * + * @return + */ + public String getQueryString() { return this.queryString; } + + /** + * Sets the query string + * + * @param queryString + */ + public void setQueryString(String queryString) { this.queryString = queryString; } + + /** + * Gets the request data. + * + * @return + */ + public String getContent() { return this.content; } + + /** + * Sets the request data. + * + * @param content + */ + public void setContent(String content) { this.content = content; } + + /** + * Gets the content type (application/json, application/text) + * + * @return + */ + public String getContentType() { return this.contentType; } + + /** + * Sets the content type. + * + * @param contentType + */ + public void setContentType(String contentType) { this.contentType = contentType; } + + /** + * Gets the content encoding (UTF-8) + * + * @return + */ + public String getContentEncoding() { return this.contentEncoding; } + + /** + * Sets the content encoding + * + * @param contentEncoding + */ + public void setContentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; } + + /** + * Gets the request headers. + * + * @return - A read-only collection of headers. + */ + public Map<String, String> getHeaders() { + return Collections.unmodifiableMap(this.headers); + } + + /** + * Clear the request headers. + */ + public void clearHeaders() { this.headers.clear(); } + + /** + * Add a collection of request headers. + * + * @param headers + */ + public void addHeaders(Map<String, String> headers) { + for (Map.Entry<String, String> entry : headers.entrySet()) { + addHeader(entry.getKey(), entry.getValue()); + } + } + + /** + * Add a name-value pair to the request headers. + * + * @param name + * @param value + */ + public void addHeader(String name, String value) { + this.headers.put(name, value); + } + + /** + * Sets the user id for the REST API URL + * + * @param userName + */ + public void setUserName(String userName) { this.userName = userName; } + + /** + * Gets the user name + * + * @return - User name + */ + public String getUserName() { return this.userName; } + + /** + * Sets the password + * + * @param password - Password + */ + public void setPassword(String password) { this.password = password; } + + /** + * Gets the password + * + * @return - Password + */ + public String getPassword() { return this.password; } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebResponse.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebResponse.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebResponse.java new file mode 100644 index 0000000..6bf737a --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/WebResponse.java @@ -0,0 +1,57 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server; + +/** + * Gets a response from a URL. + */ +public class WebResponse { + private String content; + private int statusCode; + + public WebResponse() {} + + /** + * Gets the response content. + * + * @return - Response content. + */ + public String getContent() { return this.content; } + + /** + * Sets the response content. + * + * @param content - Response content. + */ + public void setContent(String content) { this.content = content; } + + /** + * Gets the response status code. + * + * @return - Response status code. + */ + public int getStatusCode() { return this.statusCode; } + + /** + * Sets the response status code. + * + * @param statusCode - Response status code. + */ + public void setStatusCode(int statusCode) { this.statusCode = statusCode;} +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/AddDesiredConfigurationWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/AddDesiredConfigurationWebRequest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/AddDesiredConfigurationWebRequest.java new file mode 100644 index 0000000..847451e --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/AddDesiredConfigurationWebRequest.java @@ -0,0 +1,108 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server.api.cluster; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import org.apache.ambari.funtest.server.AmbariHttpWebRequest; +import org.apache.ambari.funtest.server.ClusterConfigParams; +import org.apache.ambari.funtest.server.ConnectionParams; + +/** + * Adds an existing configuration, identified by it's type and tag, to a cluster. + */ +public class AddDesiredConfigurationWebRequest extends AmbariHttpWebRequest { + private String clusterName; + private String configType; + private String configTag; + private static String pathFormat = "/api/v1/clusters/%s"; + + /** + * + * @param serverParams - Ambari server connection information + * @param configParams - Cluster configuration parameters + */ + public AddDesiredConfigurationWebRequest(ConnectionParams serverParams, ClusterConfigParams configParams) { + super(serverParams); + this.clusterName = configParams.getClusterName(); + this.configType = configParams.getConfigType(); + this.configTag = configParams.getConfigTag(); + } + + /** + * Gets the cluster name. + * + * @return - Cluster name. + */ + public String getClusterName() { return this.clusterName; } + + /** + * Gets the configuration type. + * + * @return - Configuration type. + */ + public String getConfigType() { return this.configType; } + + /** + * Gets the configuration tag. + * + * @return - Configuration tag. + */ + public String getConfigTag() { return this.configTag; } + + /** + * Gets the REST API method. + * + * @return - PUT. + */ + @Override + public String getHttpMethod() { + return "PUT"; + } + + /** + * Get REST API path fragment for construction full URI. + * + * @return - REST API path + */ + @Override + protected String getApiPath() { + return String.format(pathFormat, clusterName); + } + + /** + * Gets the request data. + * + * @return - Request data. + */ + @Override + protected String getRequestData() { + /** + * { "Clusters" : {"desired_configs": {"type": "test-site", "tag" : "version1" }}} + */ + JsonObject jsonObject; + JsonObject jsonDesiredConfigs = new JsonObject(); + + jsonDesiredConfigs.addProperty("type", configType); + jsonDesiredConfigs.addProperty("tag", configTag); + jsonObject = createJsonObject("Clusters", createJsonObject("desired_configs", jsonDesiredConfigs)); + Gson gson = new Gson(); + return gson.toJson(jsonObject); + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/CreateClusterWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/CreateClusterWebRequest.java b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/CreateClusterWebRequest.java new file mode 100644 index 0000000..5219206 --- /dev/null +++ b/ambari-funtest/src/test/java/org/apache/ambari/funtest/server/api/cluster/CreateClusterWebRequest.java @@ -0,0 +1,88 @@ +/* + * 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 + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ambari.funtest.server.api.cluster; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; +import org.apache.ambari.funtest.server.AmbariHttpWebRequest; +import org.apache.ambari.funtest.server.ConnectionParams; + +/** + * Creates a new cluster. + */ +public class CreateClusterWebRequest extends AmbariHttpWebRequest { + private String clusterName; + private String clusterVersion; + private static String pathFormat = "/api/v1/clusters/%s"; + + /** + * Creates a new cluster with the specified name and version. + * + * @param params - Ambari server connection information. + * @param clusterName - Cluster name, like "test-cluster" + * @param clusterVersion - Cluster version, like "HDP-2.2.0" + */ + public CreateClusterWebRequest(ConnectionParams params, String clusterName, String clusterVersion) { + super(params); + this.clusterName = clusterName; + this.clusterVersion = clusterVersion; + } + + /** + * Gets the cluster name. + * + * @return - Cluster name. + */ + public String getClusterName() { return this.clusterName; } + + /** + * Gets the cluster version. + * + * @return - Cluster version. + */ + public String getClusterVersion() { return this.clusterVersion; } + + @Override + public String getHttpMethod() { + return "POST"; + } + + /** + * Get REST API path fragment for construction full URI. + * + * @return - REST API path + */ + @Override + protected String getApiPath() { + return String.format(pathFormat, clusterName); + } + + /** + * Gets the request data. + * + * @return - Request data. + */ + @Override + protected String getRequestData() { + JsonObject jsonClustersObj = new JsonObject(); + jsonClustersObj.add("Clusters", createJsonObject("version", getClusterVersion())); + Gson gson = new Gson(); + return gson.toJson(jsonClustersObj); + } +}
