http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/HDFS/package/dummy-script.py ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/HDFS/package/dummy-script.py b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/HDFS/package/dummy-script.py new file mode 100644 index 0000000..35de4bb --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/HDFS/package/dummy-script.py @@ -0,0 +1,20 @@ +""" +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. + +Ambari Agent + +"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/SQOOP2/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/SQOOP2/metainfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/SQOOP2/metainfo.xml new file mode 100644 index 0000000..55323d3 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/SQOOP2/metainfo.xml @@ -0,0 +1,30 @@ +<?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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>SQOOP2</name> + <displayName>Sqoop</displayName> + <comment>Extended SQOOP</comment> + <version>Extended Version</version> + <extends>HDP/2.1.1/SQOOP</extends> + </service> + </services> + +</metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/configuration/placeholder.txt ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/configuration/placeholder.txt b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/configuration/placeholder.txt new file mode 100644 index 0000000..e2479f3 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/configuration/placeholder.txt @@ -0,0 +1,17 @@ +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. + +Ambari Agent http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metainfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metainfo.xml new file mode 100644 index 0000000..86ec307 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metainfo.xml @@ -0,0 +1,29 @@ +<?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. +--> + +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>STORM</name> + <comment>Apache Hadoop Stream processing framework (Extended)</comment> + <version>New version</version> + <extends>HDP/2.1.1/STORM</extends> + </service> + </services> +</metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metrics.json ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metrics.json b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metrics.json new file mode 100644 index 0000000..bd82446 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/metrics.json @@ -0,0 +1,103 @@ +{ + "STORM_REST_API": { + "Component": [ + { + "type": "jmx", + "metrics": { + "default": { + "metrics/api/cluster/summary/tasks.total": { + "metric": "tasks.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.total": { + "metric": "slots.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.free": { + "metric": "slots.free", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/supervisors": { + "metric": "supervisors", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/executors.total": { + "metric": "executors.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.used": { + "metric": "slots.used", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/topologies": { + "metric": "topologies", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/nimbus.uptime": { + "metric": "nimbus.uptime", + "pointInTime": true, + "temporal": false + } + } + } + } + ], + "HostComponent": [ + { + "type": "jmx", + "metrics": { + "default": { + "metrics/api/cluster/summary/tasks.total": { + "metric": "tasks.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.total": { + "metric": "slots.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.free": { + "metric": "slots.free", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/supervisors": { + "metric": "supervisors", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/executors.total": { + "metric": "executors.total", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/slots.used": { + "metric": "slots.used", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/topologies": { + "metric": "topologies", + "pointInTime": true, + "temporal": false + }, + "metrics/api/cluster/summary/nimbus.uptime": { + "metric": "nimbus.uptime", + "pointInTime": true, + "temporal": false + } + } + } + } + + ] + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/package/placeholder.txt ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/package/placeholder.txt b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/package/placeholder.txt new file mode 100644 index 0000000..e2479f3 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/1.0/services/STORM/package/placeholder.txt @@ -0,0 +1,17 @@ +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. + +Ambari Agent http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/metainfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/metainfo.xml new file mode 100644 index 0000000..716972f --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/metainfo.xml @@ -0,0 +1,24 @@ +<?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. +--> +<metainfo> + <versions> + <active>true</active> + </versions> + <extends>1.0</extends> +</metainfo> + http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/hdp.json ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/hdp.json b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/hdp.json new file mode 100644 index 0000000..fc51627 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/hdp.json @@ -0,0 +1,10 @@ +{ + "HDP-2.1.1": { + "latest": { + "centos6": "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.1.1.0-118", + "redhat6": "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.1.1.0-118", + "oraclelinux6": "http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/BUILDS/2.1.1.0-118", + "suse11": "http://s3.amazonaws.com/dev.hortonworks.com/HDP/suse11/2.x/BUILDS/2.1.1.0-118/hdp.repo" + } + } +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/repoinfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/repoinfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/repoinfo.xml new file mode 100644 index 0000000..9d8a232 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/repos/repoinfo.xml @@ -0,0 +1,62 @@ +<?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. +--> +<reposinfo> + <latest>./hdp.json</latest> + <os family="centos6"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> + <os family="centos5"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> + <os family="redhat6"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> + <os family="redhat5"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/centos5/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> + <os family="suse11"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> + <os family="sles11"> + <repo> + <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11/2.x/updates/2.0.6.0</baseurl> + <repoid>HDP-2.1.1</repoid> + <reponame>HDP</reponame> + </repo> + </os> +</reposinfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/metainfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/metainfo.xml new file mode 100644 index 0000000..b20aa6a --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/metainfo.xml @@ -0,0 +1,32 @@ +<?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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>HBASE</name> + <displayName>HBASE</displayName> + <comment>Inherited from HDP stack</comment> + <version>other-2.0-version</version> + <extends>HDP/2.0.8/HBASE</extends> + <excluded-config-types> + <config-type>hbase-policy</config-type> + </excluded-config-types> + </service> + </services> +</metainfo> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json new file mode 100644 index 0000000..70a7fa0 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/HBASE/widgets.json @@ -0,0 +1,190 @@ +{ + "layouts": [ + { + "layout_name": "default_hbase_layout", + "section_name": "HBASE_SUMMARY", + "widgetLayoutInfo": [ + { + "widget_name": "RS_READS_WRITES", + "description": "This widget shows all the read requests and write requests on all regions for a RegionServer", + "widget_type": "GRAPH", + "is_visible": true, + "metrics": [ + { + "name": "regionserver.Server.Get_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Get_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER", + "host_component_criteria": "isActive=true" + }, + { + "name": "regionserver.Server.Scan_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Scan_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + }, + { + "name": "regionserver.Server.Append_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Append_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + }, + { + "name": "regionserver.Server.Delete_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Delete_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + }, + { + "name": "regionserver.Server.Increment_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Increment_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + }, + { + "name": "regionserver.Server.Mutate_num_ops", + "ambari_id": "metrics/hbase/regionserver/Server/Mutate_num_ops", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + } + ], + "values": [ + { + "name": "Read Requests", + "value": "`${regionserver.Server.Get_num_ops + regionserver.Server.Scan_num_ops}`" + }, + { + "name": "Write Requests", + "value": "`${metrics.hbase.regionserver.Server.Append_num_ops + metrics.hbase.regionserver.Server.Delete_num_ops + metrics.hbase.regionserver.Server.Increment_num_ops + metrics.hbase.regionserver.Server.Mutate_num_ops}`" + } + ], + "properties": { + "display_unit": "Requests", + "graph_type": "LINE", + "time_ranger": "1 week" + } + }, + { + "widget_name": "OPEN_CONNECTIONS", + "description": "This widget shows number of current open connections", + "widget_type": "GRAPH", + "is_visible": true, + "metrics": [ + { + "name": "ipc.IPC.numOpenConnections", + "ambari_id": "metrics/hbase/ipc/IPC/numOpenConnections", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + } + ], + "values": [ + { + "name": "Open Connections", + "value": "`${ipc.IPC.numOpenConnections}`" + } + ], + "properties": { + "display_unit": "Connections", + "graph_type": "STACK", + "time_ranger": "1 hour" + } + }, + { + "widget_name": "ACTIVE_HANDLER", + "default_section_name": "HBASE_SUMMARY", + "widget_type": "GRAPH", + "is_visible": false, + "metrics": [ + { + "name": "ipc.IPC.numOpenConnections", + "ambari_id": "metrics/hbase/ipc/IPC/numOpenConnections", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + }, + { + "name": "ipc.IPC.numCallsInGeneralQueue", + "ambari_id": "metrics/hbase/ipc/IPC/numOpenConnections", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + } + ], + "values": [ + { + "name": "Active Handlers", + "value": "`${ipc.IPC.numActiveHandler}`" + }, + { + "name": "Calls in General Queue", + "value": "`${ipc.IPC.numCallsInGeneralQueue}`" + } + ], + "properties": { + "graph_type": "LINE", + "time_ranger": "1 hour" + } + }, + { + "widget_name": "FILES_LOCAL", + "default_section_name": "HBASE_SUMMARY", + "description": "This widget shows percentage of files local.", + "widget_type": "NUMBER", + "is_visible": true, + "metrics": [ + { + "name": "regionserver.Server.percentFilesLocal", + "ambari_id": "metrics/hbase/regionserver/percentFilesLocal", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + } + ], + "values": [ + { + "name": "Files Local", + "value": "`${regionserver.Server.percentFilesLocal}`" + } + ], + "properties": { + "display_unit": "%" + } + }, + { + "widget_name": "UPDATED_BLOCKED_TIME", + "default_section_name": "HBASE_SUMMARY", + "description": "", + "widget_type": "GRAPH", + "is_visible": true, + "metrics": [ + { + "name": "regionserver.Server.updatesBlockedTime", + "ambari_id": "metrics/hbase/regionserver/Server/updatesBlockedTime", + "category": "", + "service_name": "HBASE", + "component_name": "HBASE_REGIONSERVER" + } + ], + "values": [ + { + "name": "Updated Blocked Time", + "value": "`${regionserver.Server.updatesBlockedTime}`" + } + ], + "properties": { + "display_unit": "seconds", + "graph_type": "LINE", + "time_ranger": "1 day" + } + } + ] + } + ] +} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/SQOOP2/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/SQOOP2/metainfo.xml b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/SQOOP2/metainfo.xml new file mode 100644 index 0000000..b90f143 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/OTHER/2.0/services/SQOOP2/metainfo.xml @@ -0,0 +1,28 @@ +<?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. +--> +<metainfo> + <schemaVersion>2.0</schemaVersion> + <services> + <service> + <name>SQOOP2</name> + <displayName>Sqoop</displayName> + <comment>Inherited from parent</comment> + <version>Extended from parent version</version> + </service> + </services> +</metainfo> http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/XYZ/1.0.0/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/XYZ/1.0.0/services/stack_advisor.py b/ambari-funtest/src/test/resources/stacks/XYZ/1.0.0/services/stack_advisor.py new file mode 100644 index 0000000..ba140bb --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/XYZ/1.0.0/services/stack_advisor.py @@ -0,0 +1,67 @@ +#!/usr/bin/env ambari-python-wrap +""" +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. +""" + +from stack_advisor import StackAdvisor + +class XYZ100StackAdvisor(StackAdvisor): + + def recommendConfigurations(self, services, hosts): + stackName = services["Versions"]["stack_name"] + stackVersion = services["Versions"]["stack_version"] + hostsList = [host["Hosts"]["host_name"] for host in hosts["items"]] + servicesList = [service["StackServices"]["service_name"] for service in services["services"]] + + recommendations = { + "Versions": {"stack_name": stackName, "stack_version": stackVersion}, + "hosts": hostsList, + "services": servicesList, + "recommendations": { + "blueprint": { + "configurations": {}, + "host_groups": [] + }, + "blueprint_cluster_binding": { + "host_groups": [] + } + } + } + + configurations = recommendations["recommendations"]["blueprint"]["configurations"] + for service in servicesList: + calculation = self.recommendServiceConfigurations(service) + if calculation is not None: + calculation(configurations) + + return recommendations + + def recommendServiceConfigurations(self, service): + return { + "YARN": self.recommendYARNConfigurations, + }.get(service, None) + + def putProperty(self, config, configType): + config[configType] = {"properties": {}} + def appendProperty(key, value): + config[configType]["properties"][key] = str(value) + return appendProperty + + def recommendYARNConfigurations(self, configurations): + putYarnProperty = self.putProperty(configurations, "yarn-site") + putYarnProperty('yarn.nodemanager.resource.memory-mb', "-Xmx100m") + http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/stacks/XYZ/1.0.1/services/stack_advisor.py ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/stacks/XYZ/1.0.1/services/stack_advisor.py b/ambari-funtest/src/test/resources/stacks/XYZ/1.0.1/services/stack_advisor.py new file mode 100644 index 0000000..74a4b31 --- /dev/null +++ b/ambari-funtest/src/test/resources/stacks/XYZ/1.0.1/services/stack_advisor.py @@ -0,0 +1,30 @@ +#!/usr/bin/env ambari-python-wrap +""" +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. +""" + +import re +import socket +import sys + +from stack_advisor import StackAdvisor + +class XYZ101StackAdvisor(XYZ100StackAdvisor): + + def recommendYARNConfigurations(self, configurations): + putYarnProperty = self.putProperty(configurations, "yarn-site") + putYarnProperty('yarn.nodemanager.resource.memory-mb', "-Xmx101m") http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-funtest/src/test/resources/version ---------------------------------------------------------------------- diff --git a/ambari-funtest/src/test/resources/version b/ambari-funtest/src/test/resources/version new file mode 100644 index 0000000..359a5b9 --- /dev/null +++ b/ambari-funtest/src/test/resources/version @@ -0,0 +1 @@ +2.0.0 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/AmbariHttpWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/AmbariHttpWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/AmbariHttpWebRequest.java deleted file mode 100644 index d8075b2..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/AmbariHttpWebRequest.java +++ /dev/null @@ -1,393 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api; - -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-server/src/test/java/org/apache/ambari/server/functionaltests/api/ClusterConfigParams.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ClusterConfigParams.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ClusterConfigParams.java deleted file mode 100644 index 7efe3f5..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ClusterConfigParams.java +++ /dev/null @@ -1,84 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api; - -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-server/src/test/java/org/apache/ambari/server/functionaltests/api/ConnectionParams.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ConnectionParams.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ConnectionParams.java deleted file mode 100644 index 3d0ef7c..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/ConnectionParams.java +++ /dev/null @@ -1,89 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api; - -/** - * 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-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebRequest.java deleted file mode 100644 index 46dc634..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebRequest.java +++ /dev/null @@ -1,192 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api; - -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-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebResponse.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebResponse.java deleted file mode 100644 index b3deae6..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/WebResponse.java +++ /dev/null @@ -1,57 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api; - -/** - * 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-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/AddDesiredConfigurationWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/AddDesiredConfigurationWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/AddDesiredConfigurationWebRequest.java deleted file mode 100644 index 7cb893a..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/AddDesiredConfigurationWebRequest.java +++ /dev/null @@ -1,108 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; -import org.apache.ambari.server.functionaltests.api.ClusterConfigParams; -import org.apache.ambari.server.functionaltests.api.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-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateClusterWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateClusterWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateClusterWebRequest.java deleted file mode 100644 index 6c8c31e..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateClusterWebRequest.java +++ /dev/null @@ -1,88 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; -import org.apache.ambari.server.functionaltests.api.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); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateConfigurationWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateConfigurationWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateConfigurationWebRequest.java deleted file mode 100644 index 8e6f972..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/CreateConfigurationWebRequest.java +++ /dev/null @@ -1,87 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; -import org.apache.ambari.server.functionaltests.api.ClusterConfigParams; -import org.apache.ambari.server.functionaltests.api.ConnectionParams; - -import java.util.HashMap; -import java.util.Map; - -public class CreateConfigurationWebRequest extends AmbariHttpWebRequest { - private String clusterName; - private String configType; - private String configTag; - private Map<String, String> properties; - private static String pathFormat = "/api/v1/clusters/%s/configurations"; - - public CreateConfigurationWebRequest(ConnectionParams serverParams, ClusterConfigParams configParams) { - super(serverParams); - this.clusterName = configParams.getClusterName(); - this.configType = configParams.getConfigType(); - this.configTag = configParams.getConfigTag(); - this.properties = new HashMap<>(configParams.getProperties()); - } - - public String getClusterName() { return this.clusterName; } - - public String getConfigType() { return this.configType; } - - public String getConfigTag() { return this.configTag; } - - @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() { - /** - * {"type": "core-site", "tag": "version1363902625", "properties" : { "fs.default.name" : "localhost:8020"}} - */ - JsonObject jsonPropertiesObj = new JsonObject(); - for (Map.Entry<String, String> property : properties.entrySet()) { - jsonPropertiesObj.addProperty(property.getKey(), property.getValue()); - } - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("type", configType); - jsonObject.addProperty("tag", configTag); - jsonObject.add("properties", jsonPropertiesObj); - Gson gson = new Gson(); - return gson.toJson(jsonObject); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetAllClustersWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetAllClustersWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetAllClustersWebRequest.java deleted file mode 100644 index 3a0aaf5..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetAllClustersWebRequest.java +++ /dev/null @@ -1,53 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -/** - * Gets all the clusters. - */ -public class GetAllClustersWebRequest extends AmbariHttpWebRequest { - private static String pathFormat = "/api/v1/clusters"; - - public GetAllClustersWebRequest(ConnectionParams params) { - super(params); - } - - /** - * Gets the REST API method. - * - * @return - GET. - */ - @Override - public String getHttpMethod() { - return "GET"; - } - - /** - * Get REST API path fragment for construction full URI. - * - * @return - REST API path - */ - @Override - protected String getApiPath() { - return pathFormat; - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetClusterWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetClusterWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetClusterWebRequest.java deleted file mode 100644 index 39b933c..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetClusterWebRequest.java +++ /dev/null @@ -1,49 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -public class GetClusterWebRequest extends AmbariHttpWebRequest { - private String clusterName; - private static String pathFormat = "/api/v1/clusters/%s"; - - public GetClusterWebRequest(ConnectionParams params, String clusterName) { - super(params); - this.clusterName = clusterName; - } - - public String getClusterName() { return this.clusterName; } - - @Override - public String getHttpMethod() { - return "GET"; - } - - /** - * Get REST API path fragment for construction full URI. - * - * @return - REST API path - */ - @Override - protected String getApiPath() { - return String.format(pathFormat, clusterName); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetRequestStatusWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetRequestStatusWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetRequestStatusWebRequest.java deleted file mode 100644 index 7ac1898..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/cluster/GetRequestStatusWebRequest.java +++ /dev/null @@ -1,78 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.cluster; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -/** - * Gets the status of a request by request id. For example: - * curl --user admin:admin -i -X GET http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/requests/9 - * curl --user admin:admin -i -X GET http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/requests/9/tasks/101 - * - * Response: - * { - * "href" : "http://AMBARI_SERVER_HOST:8080/api/v1/clusters/CLUSTER_NAME/requests/9/tasks/101", - * "Tasks" : { - * ... - * "status" : "COMPLETED", - * ... - * } - * } - */ -public class GetRequestStatusWebRequest extends AmbariHttpWebRequest { - private String clusterName; - private int requestId; - private int taskId; - private static String pathFormat = "/api/v1/clusters/%s/requests/%d"; - private static String pathFormatWithTask = "/api/v1/clusters/%s/requests/%d/tasks/%d"; - - public GetRequestStatusWebRequest(ConnectionParams params, String clusterName, int requestId) { - this(params, clusterName, requestId, -1); - } - - public GetRequestStatusWebRequest(ConnectionParams params, String clusterName, int requestId, int taskId) { - super(params); - this.clusterName = clusterName; - this.requestId = requestId; - this.taskId = taskId; - } - - public String getClusterName() { return this.clusterName; } - - public int getRequestId() { return this.requestId; } - - @Override - public String getHttpMethod() { - return "GET"; - } - - /** - * Get REST API path fragment for construction full URI. - * - * @return - REST API path - */ - @Override - protected String getApiPath() { - if (taskId != -1) - return String.format(pathFormatWithTask, clusterName, requestId, taskId); - - return String.format(pathFormat, clusterName, requestId); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/AddHostWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/AddHostWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/AddHostWebRequest.java deleted file mode 100644 index 429e03c..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/AddHostWebRequest.java +++ /dev/null @@ -1,63 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.host; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -/** - * Adds a host to an existing cluster. - */ -public class AddHostWebRequest extends AmbariHttpWebRequest { - private String clusterName = null; - private String hostName = null; - private static String pathFormat = "/api/v1/clusters/%s/hosts/%s"; - - /** - * Adds the specified host to an existing cluster. - * - * @param params - Ambari connection information. - * @param clusterName - Existing cluster name. - * @param hostName - New host name. Host must have been registered previously using RegisterHostWebRequest. - */ - public AddHostWebRequest(ConnectionParams params, String clusterName, String hostName) { - super(params); - this.clusterName = clusterName; - this.hostName = hostName; - } - - public String getClusterName() { return this.clusterName; } - - public String getHostName() { return this.hostName; } - - @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, hostName); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetHostWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetHostWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetHostWebRequest.java deleted file mode 100644 index 6760640..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetHostWebRequest.java +++ /dev/null @@ -1,56 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.host; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -/** - * Gets the host identitied by the cluster name and host name. - */ -public class GetHostWebRequest extends AmbariHttpWebRequest { - private String clusterName = null; - private String hostName = null; - private static String pathFormat = "/api/v1/clusters/%s/hosts/%s"; - - public GetHostWebRequest(ConnectionParams params, String clusterName, String hostName) { - super(params); - this.clusterName = clusterName; - this.hostName = hostName; - } - - public String getClusterName() { return this.clusterName; } - - public String getHostName() { return this.hostName; } - - @Override - public String getHttpMethod() { - return "GET"; - } - - /** - * Get REST API path fragment for construction full URI. - * - * @return - REST API path - */ - @Override - protected String getApiPath() { - return String.format(pathFormat, clusterName, hostName); - } -} http://git-wip-us.apache.org/repos/asf/ambari/blob/ffb4d3b8/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetRegisteredHostWebRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetRegisteredHostWebRequest.java b/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetRegisteredHostWebRequest.java deleted file mode 100644 index f4776d9..0000000 --- a/ambari-server/src/test/java/org/apache/ambari/server/functionaltests/api/host/GetRegisteredHostWebRequest.java +++ /dev/null @@ -1,59 +0,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. - */ - -package org.apache.ambari.server.functionaltests.api.host; - -import org.apache.ambari.server.functionaltests.api.ConnectionParams; -import org.apache.ambari.server.functionaltests.api.AmbariHttpWebRequest; - -/** - * Gets a host that was previously registered with Ambari. Use this - * method to verify if a host was registered. - */ -public class GetRegisteredHostWebRequest extends AmbariHttpWebRequest { - private String hostName = null; - private static String pathFormat = "/api/v1/hosts/%s"; - - /** - * Gets the host information for a registered host. - * - * @param params - Ambari server connection information. - * @param hostName - Name of the registered host. - */ - public GetRegisteredHostWebRequest(ConnectionParams params, String hostName) { - super(params); - this.hostName = hostName; - } - - public String getHostName() { return this.hostName; } - - @Override - public String getHttpMethod() { - return "GET"; - } - - /** - * Get REST API path fragment for construction full URI. - * - * @return - REST API path - */ - @Override - protected String getApiPath() { - return String.format(pathFormat, hostName); - } -}
