ambari git commit: AMBARI-22515. Fix validators tests in feature branch.(vbrodetskyi)

2017-11-24 Thread vbrodetskyi
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 99259e500 -> 586ab647e


AMBARI-22515. Fix validators tests in feature branch.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/586ab647
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/586ab647
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/586ab647

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 586ab647e232b30dc8dc7791b9ab8e6390eff4ae
Parents: 99259e5
Author: Vitaly Brodetskyi 
Authored: Fri Nov 24 22:40:35 2017 +0200
Committer: Vitaly Brodetskyi 
Committed: Fri Nov 24 22:40:35 2017 +0200

--
 .../server/upgrade/AbstractUpgradeCatalog.java  |  4 ++
 .../ClusterConfigTypeValidatorTest.java | 29 +++---
 .../validators/HiveServiceValidatorTest.java| 58 +++-
 .../RequiredConfigPropertiesValidatorTest.java  | 46 +---
 .../StackConfigTypeValidatorTest.java   | 45 +--
 .../topology/validators/UnitValidatorTest.java  | 29 ++
 .../upgrade/AbstractUpgradeCatalogTest.java | 22 +---
 .../server/upgrade/UpgradeCatalog300Test.java   | 24 +++-
 8 files changed, 163 insertions(+), 94 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index ebb0362..0941535 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -1156,4 +1156,8 @@ public abstract class AbstractUpgradeCatalog implements 
UpgradeCatalog {
   private StackId getStackId(Cluster cluster) throws AmbariException {
 return 
cluster.getServices().values().iterator().next().getDesiredStackId();
   }
+
+  protected void setConfiguration(Configuration configuration) {
+this.configuration = configuration;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/586ab647/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index 424ed63..e469576 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -19,11 +19,12 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.topology.Blueprint;
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.Service;
 import org.easymock.EasyMock;
 import org.easymock.EasyMockRule;
 import org.easymock.EasyMockSupport;
@@ -45,10 +46,16 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
   private Configuration clusterConfigurationMock;
 
   @Mock
-  private Blueprint blueprintMock;
+  private BlueprintV2 blueprintMock;
 
   @Mock
-  private Stack stackMock;
+  private StackV2 stackMock;
+
+  @Mock
+  private Service yarnMock;
+
+  @Mock
+  private Service hdfsMock;
 
   @Mock
   private ClusterTopology clusterTopologyMock;
@@ -62,8 +69,12 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
   public void before() {
 
EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(clusterConfigurationMock).anyTimes();
 
-
EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(null).anyTimes();
-EasyMock.expect(blueprintMock.getStack()).andReturn(stackMock).anyTimes();
+
EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes();
+
EasyMock.expect(blueprintMock.getStackById("1")).andReturn(stackMock).anyTimes();
+EasyMock.expect(yarnMock.getStackId()).andReturn("1").anyTimes();
+

ambari git commit: AMBARI-22220 - Should be able to switch the extension version to which a stack version is linked

2017-11-24 Thread tthorpe
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 d7b25eec2 -> 5fab8ff3d


AMBARI-0 - Should be able to switch the extension version to which a stack 
version is linked

Conflicts:

ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5fab8ff3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5fab8ff3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5fab8ff3

Branch: refs/heads/branch-2.6
Commit: 5fab8ff3d768c2edf8408361feba87bc09b02bf2
Parents: d7b25ee
Author: Tim Thorpe 
Authored: Mon Oct 16 06:16:35 2017 -0700
Committer: Tim Thorpe 
Committed: Fri Nov 24 12:20:38 2017 -0800

--
 .../controller/AmbariManagementController.java  |   6 +-
 .../AmbariManagementControllerImpl.java |  44 ---
 .../controller/AmbariManagementHelper.java  |  26 
 .../internal/ExtensionLinkResourceProvider.java |  15 +++
 .../ambari/server/stack/ExtensionHelper.java|  31 -
 .../server/stack/StackManagerExtensionTest.java |  22 +++-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   4 +-
 .../resources/extensions/EXT/0.4/metainfo.xml   |  32 +
 .../EXT/0.4/services/OOZIE2/metainfo.xml| 118 +++
 .../services/OOZIE2/themes/broken_theme.json|   3 +
 10 files changed, 271 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5fab8ff3/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index 54c0848..9ac48a4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -369,18 +369,18 @@ public interface AmbariManagementController {
   public void createExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
*
* @throws AmbariException if we fail to link the extension to the stack
*/
   public void updateExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
*
* @throws AmbariException if we fail to link the extension to the stack
*/
-  public void updateExtensionLink(ExtensionLinkEntity linkEntity) throws 
AmbariException;
+  void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, 
ExtensionLinkRequest newLinkRequest) throws AmbariException;
 
   /**
* Delete a link between an extension and a stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/5fab8ff3/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 585ee46..e294aeb 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -5656,12 +5656,9 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   }
 
   /**
-   * This method will update a link between an extension version and a stack 
version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension 
directories.
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
*
-   * An extension version is like a stack version but it contains custom 
services.  Linking an extension
-   * version to the current stack version allows the cluster to install the 
custom services contained in
-   * the extension version.
+   * @throws AmbariException if we fail to link the extension to the stack
*/
   @Override
   public void updateExtensionLink(ExtensionLinkRequest request) throws 
AmbariException {
@@ -5675,32 +5672,43 @@ public class 

ambari git commit: AMBARI-22137 - Different stack versions should be able to link to different extension versions

2017-11-24 Thread tthorpe
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 7c56924a9 -> d7b25eec2


AMBARI-22137 - Different stack versions should be able to link to different 
extension versions


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d7b25eec
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d7b25eec
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d7b25eec

Branch: refs/heads/branch-2.6
Commit: d7b25eec2629822f90cac6de510f806b1004a8f7
Parents: 7c56924
Author: Tim Thorpe 
Authored: Tue Oct 10 13:54:01 2017 -0700
Committer: Tim Thorpe 
Committed: Fri Nov 24 12:13:01 2017 -0800

--
 .../controller/AmbariManagementHelper.java  |   2 +-
 .../ambari/server/stack/ExtensionHelper.java|  57 ++-
 .../apache/ambari/server/stack/StackModule.java |   4 +
 .../server/stack/StackManagerExtensionTest.java |  31 +-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   2 +-
 .../resources/extensions/EXT/0.3/metainfo.xml   |   2 +-
 .../stacks_with_extensions/HDP/0.4/metainfo.xml |  22 ++
 .../HDP/0.4/repos/repoinfo.xml  |  63 +++
 .../HDP/0.4/services/HBASE/metainfo.xml |  26 ++
 .../0.4/services/HDFS/configuration/global.xml  | 145 +++
 .../services/HDFS/configuration/hadoop-env.xml  | 223 +++
 .../services/HDFS/configuration/hbase-site.xml  | 137 +++
 .../services/HDFS/configuration/hdfs-log4j.xml  | 199 ++
 .../services/HDFS/configuration/hdfs-site.xml   | 396 +++
 .../HDP/0.4/services/HDFS/metainfo.xml  |  30 ++
 .../0.4/services/HDFS/package/dummy-script.py   |  20 +
 .../HDP/0.4/services/HIVE/metainfo.xml  |  26 ++
 .../HDP/0.4/services/MAPREDUCE/metainfo.xml |  23 ++
 .../HDP/0.4/services/ZOOKEEPER/metainfo.xml |  26 ++
 19 files changed, 1425 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d7b25eec/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
index 2dd6f12..0c8edfe 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementHelper.java
@@ -70,7 +70,7 @@ public class AmbariManagementHelper {
*/
   public void createExtensionLink(StackManager stackManager, StackInfo 
stackInfo, ExtensionInfo extensionInfo) throws AmbariException {
 validateCreateExtensionLinkRequest(stackInfo, extensionInfo);
-ExtensionHelper.validateCreateLink(stackInfo, extensionInfo);
+ExtensionHelper.validateCreateLink(stackManager, stackInfo, extensionInfo);
 ExtensionLinkEntity linkEntity = createExtensionLinkEntity(stackInfo, 
extensionInfo);
 stackManager.linkStackToExtension(stackInfo, extensionInfo);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d7b25eec/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
index cd4d9f3..8e1d989 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/ExtensionHelper.java
@@ -27,6 +27,8 @@ import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.stack.ExtensionMetainfoXml;
 import org.apache.ambari.server.utils.VersionUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * An extension version is like a stack version but it contains custom 
services.  Linking an extension
@@ -35,6 +37,8 @@ import org.apache.ambari.server.utils.VersionUtils;
  */
 public class ExtensionHelper {
 
+  private final static Logger LOG = 
LoggerFactory.getLogger(ExtensionHelper.class);
+
   public static void validateDeleteLink(Clusters clusters, StackInfo stack, 
ExtensionInfo extension) throws AmbariException {
 validateNotRequiredExtension(stack, extension);
 validateServicesNotInstalled(clusters, stack, extension);
@@ -62,9 +66,9 @@ public class ExtensionHelper {
 }
   }
 
-  public static void validateCreateLink(StackInfo stack, ExtensionInfo 
extension) throws AmbariException {
+  public static void validateCreateLink(StackManager stackManager, StackInfo 
stack, 

[1/2] ambari git commit: AMBARI-20891 - Allow extensions to auto-link with supported stack versions

2017-11-24 Thread tthorpe
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 0e2e711e0 -> 7c56924a9


http://git-wip-us.apache.org/repos/asf/ambari/blob/7c56924a/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hbase-site.xml
--
diff --git 
a/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hbase-site.xml
 
b/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hbase-site.xml
new file mode 100644
index 000..5024e85
--- /dev/null
+++ 
b/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hbase-site.xml
@@ -0,0 +1,137 @@
+
+
+
+
+  
+hbase.regionserver.msginterval
+1000
+Interval between messages from the RegionServer to HMaster
+in milliseconds.  Default is 15. Set this value low if you want unit
+tests to be responsive.
+
+  
+  
+hbase.client.pause
+5000
+General client pause value.  Used mostly as value to wait
+before running a retry of a failed get, region lookup, etc.
+  
+  
+hbase.master.meta.thread.rescanfrequency
+1
+How long the HMaster sleeps (in milliseconds) between scans of
+the root and meta tables.
+
+  
+  
+hbase.server.thread.wakefrequency
+1000
+Time to sleep in between searches for work (in milliseconds).
+Used as sleep interval by service threads such as META scanner and log 
roller.
+
+  
+  
+hbase.regionserver.handler.count
+5
+Count of RPC Server instances spun up on RegionServers
+Same property is used by the HMaster for count of master handlers.
+Default is 10.
+
+  
+  
+hbase.master.lease.period
+6000
+Length of time the master will wait before timing out a region
+server lease. Since region servers report in every second (see above), this
+value has been reduced so that the master will notice a dead region server
+sooner. The default is 30 seconds.
+
+  
+  
+hbase.master.info.port
+-1
+The port for the hbase master web UI
+Set to -1 if you do not want the info server to run.
+
+  
+  
+hbase.regionserver.info.port
+-1
+The port for the hbase regionserver web UI
+Set to -1 if you do not want the info server to run.
+
+  
+  
+hbase.regionserver.info.port.auto
+true
+Info server auto port bind. Enables automatic port
+search if hbase.regionserver.info.port is already in use.
+Enabled for testing to run multiple tests on one machine.
+
+  
+  
+hbase.master.lease.thread.wakefrequency
+3000
+The interval between checks for expired region server leases.
+This value has been reduced due to the other reduced values above so that
+the master will notice a dead region server sooner. The default is 15 
seconds.
+
+  
+  
+hbase.regionserver.optionalcacheflushinterval
+1
+
+Amount of time to wait since the last time a region was flushed before
+invoking an optional cache flush. Default 60,000.
+
+  
+  
+hbase.regionserver.safemode
+false
+
+Turn on/off safe mode in region server. Always on for production, always 
off
+for tests.
+
+  
+  
+hbase.hregion.max.filesize
+67108864
+
+Maximum desired file size for an HRegion.  If filesize exceeds
+value + (value / 2), the HRegion is split in two.  Default: 256M.
+
+Keep the maximum filesize small so we split more often in tests.
+
+  
+  
+hadoop.log.dir
+${user.dir}/../logs
+  
+  
+hbase.zookeeper.property.clientPort
+21818
+Property from ZooKeeper's config zoo.cfg.
+The port at which the clients will connect.
+
+  
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/7c56924a/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hdfs-log4j.xml
--
diff --git 
a/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hdfs-log4j.xml
 
b/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hdfs-log4j.xml
new file mode 100644
index 000..649472d
--- /dev/null
+++ 
b/ambari-server/src/test/resources/stacks_with_extensions/HDP/0.3/services/HDFS/configuration/hdfs-log4j.xml
@@ -0,0 +1,199 @@
+
+
+
+
+
+
+  
+content
+
+#
+# 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 

[2/2] ambari git commit: AMBARI-20891 - Allow extensions to auto-link with supported stack versions

2017-11-24 Thread tthorpe
AMBARI-20891 - Allow extensions to auto-link with supported stack versions

Conflicts:

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

ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ExtensionLinkDAO.java

ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java

ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7c56924a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7c56924a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7c56924a

Branch: refs/heads/branch-2.6
Commit: 7c56924a952358127dd80eef7e8c9dfeac0aa8b0
Parents: 0e2e711
Author: Tim Thorpe 
Authored: Tue May 9 07:53:39 2017 -0700
Committer: Tim Thorpe 
Committed: Fri Nov 24 12:00:57 2017 -0800

--
 .../AmbariManagementControllerImpl.java |  68 +---
 .../controller/AmbariManagementHelper.java  | 175 
 .../ambari/server/orm/dao/ExtensionLinkDAO.java |  36 +-
 .../orm/entities/ExtensionLinkEntity.java   |   1 +
 .../ambari/server/stack/ExtensionModule.java|   2 +
 .../ambari/server/stack/StackManager.java   |  81 +++-
 .../apache/ambari/server/stack/StackModule.java |   4 +-
 .../ambari/server/state/ExtensionInfo.java  |  26 +-
 .../apache/ambari/server/state/StackInfo.java   |  27 +-
 .../state/stack/ExtensionMetainfoXml.java   |  11 +
 .../stack/StackManagerCommonServicesTest.java   |   4 +-
 .../server/stack/StackManagerExtensionTest.java |  79 ++--
 .../server/stack/StackManagerMiscTest.java  |  13 +-
 .../ambari/server/stack/StackManagerMock.java   |   5 +-
 .../ambari/server/stack/StackManagerTest.java   |  13 +-
 .../resources/extensions/EXT/0.1/metainfo.xml   |   2 +-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   3 +-
 .../resources/extensions/EXT/0.3/metainfo.xml   |  32 ++
 .../EXT/0.3/services/OOZIE2/metainfo.xml| 118 ++
 .../services/OOZIE2/themes/broken_theme.json|   3 +
 .../stacks_with_extensions/HDP/0.3/metainfo.xml |  22 ++
 .../HDP/0.3/repos/repoinfo.xml  |  63 +++
 .../HDP/0.3/services/HBASE/metainfo.xml |  26 ++
 .../0.3/services/HDFS/configuration/global.xml  | 145 +++
 .../services/HDFS/configuration/hadoop-env.xml  | 223 +++
 .../services/HDFS/configuration/hbase-site.xml  | 137 +++
 .../services/HDFS/configuration/hdfs-log4j.xml  | 199 ++
 .../services/HDFS/configuration/hdfs-site.xml   | 396 +++
 .../HDP/0.3/services/HDFS/metainfo.xml  |  30 ++
 .../0.3/services/HDFS/package/dummy-script.py   |  20 +
 .../HDP/0.3/services/HIVE/metainfo.xml  |  26 ++
 .../HDP/0.3/services/MAPREDUCE/metainfo.xml |  23 ++
 .../HDP/0.3/services/ZOOKEEPER/metainfo.xml |  26 ++
 33 files changed, 1921 insertions(+), 118 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7c56924a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index a6315f8..585ee46 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -122,14 +122,12 @@ import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.dao.WidgetDAO;
 import org.apache.ambari.server.orm.dao.WidgetLayoutDAO;
 import org.apache.ambari.server.orm.entities.ClusterEntity;
-import org.apache.ambari.server.orm.entities.ExtensionEntity;
 import org.apache.ambari.server.orm.entities.ExtensionLinkEntity;
 import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.orm.entities.OperatingSystemEntity;
 import org.apache.ambari.server.orm.entities.RepositoryEntity;
 import org.apache.ambari.server.orm.entities.RepositoryVersionEntity;
 import org.apache.ambari.server.orm.entities.SettingEntity;
-import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.orm.entities.WidgetEntity;
 import org.apache.ambari.server.orm.entities.WidgetLayoutEntity;
 import org.apache.ambari.server.orm.entities.WidgetLayoutUserWidgetEntity;
@@ -313,11 +311,13 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
   private MaintenanceStateHelper maintenanceStateHelper;
 
-  @Inject
- 

ambari git commit: AMBARI-22510. Handle new error type from Stack Advisor (akovalenko)

2017-11-24 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/trunk 024907346 -> c5fe6cb96


AMBARI-22510. Handle new error type from Stack Advisor (akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c5fe6cb9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c5fe6cb9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c5fe6cb9

Branch: refs/heads/trunk
Commit: c5fe6cb96a6530d0fc44c4ffced2ec46db97233b
Parents: 0249073
Author: Aleksandr Kovalenko 
Authored: Fri Nov 24 11:37:07 2017 +0200
Committer: Aleksandr Kovalenko 
Committed: Fri Nov 24 17:59:19 2017 +0200

--
 ambari-web/app/messages.js  |   5 +-
 ambari-web/app/mixins/common/serverValidator.js |  41 +---
 ambari-web/app/styles/application.less  |   3 +-
 .../config_recommendation_popup.hbs | 102 +--
 .../config_validation_popup.js  |   7 +-
 .../test/mixins/common/serverValidator_test.js  |  15 +--
 6 files changed, 112 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c5fe6cb9/ambari-web/app/messages.js
--
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 390f803..b294877 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -359,6 +359,7 @@ Em.I18n.translations = {
   'common.rolling.downgrade': 'Rolling Downgrade',
   'common.express.downgrade': 'Express Downgrade',
   'common.views': 'Views',
+  'common.critical.error': 'Critical',
 
   'models.alert_instance.tiggered.verbose': "Occurred on {0}  Checked on 
{1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
@@ -951,8 +952,8 @@ Em.I18n.translations = {
   'installer.step7.popup.validation.failed.body': 'Some services are not 
properly configured. You have to change the highlighted configs according to 
the recommended values.',
   'installer.step7.popup.validation.request.failed.body': 'The configuration 
changes could not be validated for consistency due to an unknown error.  Your 
changes have not been saved yet.  Would you like to proceed and save the 
changes?',
   'installer.step7.popup.validation.warning.header': 'Configurations',
-  'installer.step7.popup.validation.warning.body': 'Some service 
configurations are not configured properly. We recommend you review and change 
the highlighted configuration values. Are you sure you want to proceed without 
correcting configurations?',
-  'installer.step7.popup.validation.error.body': 'Service configurations 
resulted in validation errors. Please address them before proceeding.',
+  'installer.step7.popup.validation.issues.body': 'The following configuration 
changes are highly recommended, but can be skipped.',
+  'installer.step7.popup.validation.criticalIssues.body': 'You must correct 
the following critical issues before proceeding:',
   'installer.step7.popup.oozie.derby.warning': 'Derby is not recommended for 
production use. With Derby, Oozie Server HA and concurrent connection support 
will not be available.',
   'installer.step7.oozie.database.new': 'New Derby Database',
   'installer.step7.hive.database.new.mysql': 'New MySQL Database',

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5fe6cb9/ambari-web/app/mixins/common/serverValidator.js
--
diff --git a/ambari-web/app/mixins/common/serverValidator.js 
b/ambari-web/app/mixins/common/serverValidator.js
index 319c281..65f43b7 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -57,7 +57,10 @@ App.ServerValidatorMixin = Em.Mixin.create({
*
* @type {Object[]}
*/
-  configErrorList: [],
+  configErrorList: Em.Object.create({
+issues: [],
+criticalIssues: []
+  }),
 
   /**
* Map with allowed error types
@@ -65,6 +68,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
* @type {Object}
*/
   errorTypes: {
+CRITICAL_ERROR: 'NOT_APPLICABLE',
 ERROR: 'ERROR',
 WARN: 'WARN',
 GENERAL: 'GENERAL'
@@ -113,10 +117,13 @@ App.ServerValidatorMixin = Em.Mixin.create({
   self = this,
   primary = function() { deferred.resolve(); },
   secondary = function() { deferred.reject('invalid_configs'); };
-this.set('configErrorList', []);
+this.set('configErrorList', Em.Object.create({
+  issues: [],
+  criticalIssues: []
+}));
 
 this.runServerSideValidation().done(function() {
-  if (self.get('configErrorList.length')) {
+  if (self.get('configErrorList.issues.length') || 
self.get('configErrorList.criticalIssues.length')) {
 

ambari git commit: AMBARI-22510. Handle new error type from Stack Advisor (akovalenko)

2017-11-24 Thread akovalenko
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 54bc2a2e3 -> 0e2e711e0


AMBARI-22510. Handle new error type from Stack Advisor (akovalenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0e2e711e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0e2e711e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0e2e711e

Branch: refs/heads/branch-2.6
Commit: 0e2e711e0616ea00e8d7bac1f375977e019e6e77
Parents: 54bc2a2
Author: Aleksandr Kovalenko 
Authored: Thu Nov 23 19:52:26 2017 +0200
Committer: Aleksandr Kovalenko 
Committed: Fri Nov 24 17:58:31 2017 +0200

--
 ambari-web/app/messages.js  |   5 +-
 ambari-web/app/mixins/common/serverValidator.js |  41 +---
 ambari-web/app/styles/application.less  |   3 +-
 .../config_recommendation_popup.hbs | 102 +--
 .../config_validation_popup.js  |   7 +-
 .../test/mixins/common/serverValidator_test.js  |  15 +--
 6 files changed, 112 insertions(+), 61 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/0e2e711e/ambari-web/app/messages.js
--
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 9b22208..783baf1 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -352,6 +352,7 @@ Em.I18n.translations = {
   'common.repositoryType': 'Repository Type',
   'common.rolling.downgrade': 'Rolling Downgrade',
   'common.express.downgrade': 'Express Downgrade',
+  'common.critical.error': 'Critical',
 
   'models.alert_instance.tiggered.verbose': "Occurred on {0}  Checked on 
{1}",
   'models.alert_definition.triggered.verbose': "Occurred on {0}",
@@ -932,8 +933,8 @@ Em.I18n.translations = {
   'installer.step7.popup.validation.failed.body': 'Some services are not 
properly configured. You have to change the highlighted configs according to 
the recommended values.',
   'installer.step7.popup.validation.request.failed.body': 'The configuration 
changes could not be validated for consistency due to an unknown error.  Your 
changes have not been saved yet.  Would you like to proceed and save the 
changes?',
   'installer.step7.popup.validation.warning.header': 'Configurations',
-  'installer.step7.popup.validation.warning.body': 'Some service 
configurations are not configured properly. We recommend you review and change 
the highlighted configuration values. Are you sure you want to proceed without 
correcting configurations?',
-  'installer.step7.popup.validation.error.body': 'Service configurations 
resulted in validation errors. Please address them before proceeding.',
+  'installer.step7.popup.validation.issues.body': 'The following configuration 
changes are highly recommended, but can be skipped.',
+  'installer.step7.popup.validation.criticalIssues.body': 'You must correct 
the following critical issues before proceeding:',
   'installer.step7.popup.oozie.derby.warning': 'Derby is not recommended for 
production use. With Derby, Oozie Server HA and concurrent connection support 
will not be available.',
   'installer.step7.oozie.database.new': 'New Derby Database',
   'installer.step7.hive.database.new.mysql': 'New MySQL Database',

http://git-wip-us.apache.org/repos/asf/ambari/blob/0e2e711e/ambari-web/app/mixins/common/serverValidator.js
--
diff --git a/ambari-web/app/mixins/common/serverValidator.js 
b/ambari-web/app/mixins/common/serverValidator.js
index 955549f..ff5319d 100644
--- a/ambari-web/app/mixins/common/serverValidator.js
+++ b/ambari-web/app/mixins/common/serverValidator.js
@@ -42,7 +42,10 @@ App.ServerValidatorMixin = Em.Mixin.create({
*
* @type {Object[]}
*/
-  configErrorList: [],
+  configErrorList: Em.Object.create({
+issues: [],
+criticalIssues: []
+  }),
 
   /**
* Map with allowed error types
@@ -50,6 +53,7 @@ App.ServerValidatorMixin = Em.Mixin.create({
* @type {Object}
*/
   errorTypes: {
+CRITICAL_ERROR: 'NOT_APPLICABLE',
 ERROR: 'ERROR',
 WARN: 'WARN',
 GENERAL: 'GENERAL'
@@ -98,10 +102,13 @@ App.ServerValidatorMixin = Em.Mixin.create({
   self = this,
   primary = function() { deferred.resolve(); },
   secondary = function() { deferred.reject('invalid_configs'); };
-this.set('configErrorList', []);
+this.set('configErrorList', Em.Object.create({
+  issues: [],
+  criticalIssues: []
+}));
 
 this.runServerSideValidation().done(function() {
-  if (self.get('configErrorList.length')) {
+  if (self.get('configErrorList.issues.length') || 
self.get('configErrorList.criticalIssues.length')) {
 

[1/2] ambari git commit: AMBARI-22513 Make yumrpm.py functions to use global defined commands (dgrinenko)

2017-11-24 Thread hapylestat
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 c57e243d2 -> 54bc2a2e3
  refs/heads/trunk 99b19e580 -> 024907346


AMBARI-22513 Make yumrpm.py functions to use global defined commands (dgrinenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54bc2a2e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54bc2a2e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54bc2a2e

Branch: refs/heads/branch-2.6
Commit: 54bc2a2e38a022356f1c405f755ac1b000450b3a
Parents: c57e243
Author: Dmytro Grinenko 
Authored: Fri Nov 24 15:55:20 2017 +0200
Committer: Dmytro Grinenko 
Committed: Fri Nov 24 15:55:20 2017 +0200

--
 .../core/providers/package/yumrpm.py|  4 ++--
 .../HIVE/0.12.0.2.0/package/scripts/hive.py | 12 ++--
 .../test/python/stacks/2.0.6/HIVE/test_hive_server.py   |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/54bc2a2e/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index 24f03f7..fdf1743 100644
--- 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -138,7 +138,7 @@ class YumProvider(RPMBasedPackageProvider):
 :rtype list[list,]
 """
 
-cmd = [AMBARI_SUDO_BINARY, "yum", "list", "available"]
+cmd = list(ALL_AVAILABLE_PACKAGES_CMD)
 
 if repo_filter:
   cmd.extend(["--disablerepo=*", "--enablerepo=" + repo_filter])
@@ -154,7 +154,7 @@ class YumProvider(RPMBasedPackageProvider):
 :rtype list[list,]
 """
 
-packages = self._lookup_packages([AMBARI_SUDO_BINARY, "yum", "list", 
"installed"], "Installed Packages")
+packages = self._lookup_packages(list(ALL_INSTALLED_PACKAGES_CMD), 
"Installed Packages")
 if repo_filter:
   packages = [item for item in packages if item[2].lower() == 
repo_filter.lower()]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/54bc2a2e/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index abbe59e..a02f951 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -24,7 +24,7 @@ from urlparse import urlparse
 
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
-from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
+from resource_management.libraries.functions import copy_tarball
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.stack_features import 
check_stack_feature
 from resource_management.core.resources.service import ServiceConfig
@@ -138,19 +138,19 @@ def hive(name=None):
 # *
 #  if copy tarball to HDFS feature  supported copy mapreduce.tar.gz and 
tez.tar.gz to HDFS
 if params.stack_version_formatted_major and 
check_stack_feature(StackFeature.COPY_TARBALL_TO_HDFS, 
params.stack_version_formatted_major):
-  copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
-  copy_to_hdfs("tez", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
+  copy_tarball.copy_to_hdfs("mapreduce", params.user_group, 
params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs)
+  copy_tarball.copy_to_hdfs("tez", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
 
 # Always copy pig.tar.gz and hive.tar.gz using the appropriate mode.
 # This can use a different source and dest location to account
-copy_to_hdfs("pig",
+copy_tarball.copy_to_hdfs("pig",
  params.user_group,
  params.hdfs_user,
  file_mode=params.tarballs_mode,
  custom_source_file=params.pig_tar_source,
  custom_dest_file=params.pig_tar_dest_file,
  skip=params.sysprep_skip_copy_tarballs_hdfs)
-  

[2/2] ambari git commit: AMBARI-22513 Make yumrpm.py functions to use global defined commands (dgrinenko)

2017-11-24 Thread hapylestat
AMBARI-22513 Make yumrpm.py functions to use global defined commands (dgrinenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/02490734
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/02490734
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/02490734

Branch: refs/heads/trunk
Commit: 0249073469de5cd11f032705d609f8cb19ff28c0
Parents: 99b19e5
Author: Dmytro Grinenko 
Authored: Fri Nov 24 16:41:12 2017 +0200
Committer: Dmytro Grinenko 
Committed: Fri Nov 24 16:41:12 2017 +0200

--
 .../core/providers/package/yumrpm.py|  4 ++--
 .../HIVE/0.12.0.2.0/package/scripts/hive.py | 12 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/02490734/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
--
diff --git 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
index 8426479..367e2af 100644
--- 
a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ 
b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py
@@ -138,7 +138,7 @@ class YumProvider(RPMBasedPackageProvider):
 :rtype list[list,]
 """
 
-cmd = [AMBARI_SUDO_BINARY, "yum", "list", "available"]
+cmd = list(ALL_AVAILABLE_PACKAGES_CMD)
 
 if repo_filter:
   cmd.extend(["--disablerepo=*", "--enablerepo=" + repo_filter])
@@ -154,7 +154,7 @@ class YumProvider(RPMBasedPackageProvider):
 :rtype list[list,]
 """
 
-packages = self._lookup_packages([AMBARI_SUDO_BINARY, "yum", "list", 
"installed"], "Installed Packages")
+packages = self._lookup_packages(list(ALL_INSTALLED_PACKAGES_CMD), 
"Installed Packages")
 if repo_filter:
   packages = [item for item in packages if item[2].lower() == 
repo_filter.lower()]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/02490734/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 716a37c..d9cc55f 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -24,7 +24,7 @@ from urlparse import urlparse
 
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
-from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
+from resource_management.libraries.functions import copy_tarball
 from resource_management.libraries.functions.get_config import get_config
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.stack_features import 
check_stack_feature
@@ -177,19 +177,19 @@ def setup_hiveserver2():
   # *
   #  if copy tarball to HDFS feature  supported copy mapreduce.tar.gz and 
tez.tar.gz to HDFS
   if params.stack_version_formatted_major and 
check_stack_feature(StackFeature.COPY_TARBALL_TO_HDFS, 
params.stack_version_formatted_major):
-copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
-copy_to_hdfs("tez", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
+copy_tarball.copy_to_hdfs("mapreduce", params.user_group, 
params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs)
+copy_tarball.copy_to_hdfs("tez", params.user_group, params.hdfs_user, 
skip=params.sysprep_skip_copy_tarballs_hdfs)
 
   # Always copy pig.tar.gz and hive.tar.gz using the appropriate mode.
   # This can use a different source and dest location to account
-  copy_to_hdfs("pig",
+  copy_tarball.copy_to_hdfs("pig",
params.user_group,
params.hdfs_user,
file_mode=params.tarballs_mode,
custom_source_file=params.pig_tar_source,
custom_dest_file=params.pig_tar_dest_file,
skip=params.sysprep_skip_copy_tarballs_hdfs)
-  copy_to_hdfs("hive",
+  copy_tarball.copy_to_hdfs("hive",
params.user_group,
params.hdfs_user,
file_mode=params.tarballs_mode,
@@ -210,7 +210,7 @@ def setup_hiveserver2():
   

[17/39] ambari git commit: AMBARI-22244. Use service type instead of service name - addendum (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22244. Use service type instead of service name - addendum (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2b4c3427
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2b4c3427
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2b4c3427

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 2b4c342719980a3fb52b61a3d8ba4bc2747aaa78
Parents: 3d0619a
Author: Attila Doroszlai 
Authored: Thu Nov 16 19:00:42 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../checks/ServiceCheckValidityCheck.java   |  7 ---
 .../internal/ServiceResourceProvider.java   |  9 
 .../serveraction/upgrades/ConfigureAction.java  |  5 +++--
 .../ambari/server/state/ConfigHelper.java   | 14 ++---
 .../ambari/server/state/ConfigMergeHelper.java  |  4 ++--
 .../ambari/server/state/UpgradeHelper.java  | 22 ++--
 6 files changed, 31 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2b4c3427/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
index 2582c71..1126424 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServiceCheckValidityCheck.java
@@ -101,11 +101,12 @@ public class ServiceCheckValidityCheck extends 
AbstractCheckDescriptor {
 continue;
   }
   StackId stackId = service.getDesiredStackId();
-  boolean isServiceWitNoConfigs = 
ambariMetaInfo.get().isServiceWithNoConfigs(stackId.getStackName(), 
stackId.getStackVersion(), service.getName());
+  String serviceType = service.getServiceType();
+  boolean isServiceWitNoConfigs = 
ambariMetaInfo.get().isServiceWithNoConfigs(stackId.getStackName(), 
stackId.getStackVersion(), serviceType);
   if (isServiceWitNoConfigs){
-LOG.info(String.format("%s in %s version %s does not have customizable 
configurations. Skip checking service configuration history.", 
service.getName(), stackId.getStackName(), stackId.getStackVersion()));
+LOG.info("{} in {} version {} does not have customizable 
configurations. Skip checking service configuration history.", serviceType, 
stackId.getStackName(), stackId.getStackVersion());
   } else {
-LOG.info(String.format("%s in %s version %s has customizable 
configurations. Check service configuration history.", service.getName(), 
stackId.getStackName(), stackId.getStackVersion()));
+LOG.info("{} in {} version {} has customizable configurations. Check 
service configuration history.", serviceType, stackId.getStackName(), 
stackId.getStackVersion());
 ServiceConfigEntity lastServiceConfig = 
serviceConfigDAO.getLastServiceConfig(clusterId, service.getServiceId());
 lastServiceConfigUpdates.put(service.getName(), 
lastServiceConfig.getCreateTimestamp());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2b4c3427/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index 931035d..e353b3c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -276,8 +276,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
   setResourceProperty(resource, SERVICE_SERVICE_TYPE_PROPERTY_ID,
 response.getServiceType(), requestedIds);
   setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
-  calculateServiceState(response.getClusterName(), 
response.getServiceName()),
-  requestedIds);
+  calculateServiceState(response.getClusterName(), 
response.getServiceType(), response.getServiceName()), requestedIds);
   setResourceProperty(resource, SERVICE_MAINTENANCE_STATE_PROPERTY_ID,
   response.getMaintenanceState(), requestedIds);
   setResourceProperty(resource, 
SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID,
@@ -1004,9 +1003,9 @@ 

[14/39] ambari git commit: AMBARI-22325. Set stacks in blueprint (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Set stacks in blueprint (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8afa31e9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8afa31e9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8afa31e9

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 8afa31e9600c13903c70cd250b73095e9e24a9dd
Parents: acfb6b4
Author: Attila Doroszlai 
Authored: Mon Nov 13 11:24:47 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../server/controller/StackV2Factory.java   |  3 +--
 .../server/topology/BlueprintV2Factory.java | 23 ++--
 2 files changed, 12 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8afa31e9/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 0735171..c7113ae 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -52,8 +52,7 @@ public class StackV2Factory {
 return create(stack.getStackName(), stack.getStackVersion());
   }
 
-  public StackV2 create(String stackId) throws AmbariException {
-StackId id = new StackId(stackId);
+  public StackV2 create(StackId id) throws AmbariException {
 return create(id.getStackName(), id.getStackVersion());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8afa31e9/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 4f22aea..9870dcb 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import org.apache.ambari.server.AmbariException;
@@ -102,27 +103,29 @@ public class BlueprintV2Factory {
   public BlueprintV2 convertFromJson(String json) throws IOException {
 BlueprintImplV2 blueprintV2 = createObjectMapper().readValue(json, 
BlueprintImplV2.class);
 blueprintV2.postDeserialization();
-blueprintV2.setStacks(
-  blueprintV2.getStackIds().stream().collect(Collectors.toMap(
-StackId::new,
-stackId -> parseStack(new StackId(stackId))
-  ))
-);
+updateStacks(blueprintV2);
 return blueprintV2;
   }
 
+  private void updateStacks(BlueprintImplV2 blueprintV2) {
+Map stacks = blueprintV2.getStackIds().stream()
+  .map(StackId::new)
+  .collect(Collectors.toMap(Function.identity(), this::parseStack));
+blueprintV2.setStacks(stacks);
+  }
 
   public BlueprintV2 convertFromEntity(BlueprintV2Entity blueprintEntity) 
throws IOException {
 return convertFromJson(blueprintEntity.getContent());
   }
 
+  @SuppressWarnings("unchecked")
   public Map convertToMap(BlueprintV2Entity entity) throws 
IOException {
 return createObjectMapper().readValue(entity.getContent(), HashMap.class);
   }
 
   private StackV2 parseStack(StackId stackId) {
 try {
-  return stackFactory.create(stackId.getStackName(), 
stackId.getStackVersion());
+  return stackFactory.create(stackId);
 } catch (AmbariException e) {
   throw new IllegalArgumentException(
 String.format("Unable to parse stack. name=%s, version=%s", 
stackId.getStackName(), stackId.getStackVersion()),
@@ -156,7 +159,6 @@ public class BlueprintV2Factory {
* @param securityConfiguration security related properties
* @return new blueprint entity
*/
-  @SuppressWarnings("unchecked")
   public BlueprintV2 createBlueprint(Map properties, 
SecurityConfiguration securityConfiguration) throws NoSuchStackException, 
IOException {
 String name = String.valueOf(properties.get(BLUEPRINT_NAME_PROPERTY_ID));
 // String.valueOf() will return "null" if value is null
@@ -168,10 +170,7 @@ public class BlueprintV2Factory {
 String json = om.writeValueAsString(properties);
 BlueprintImplV2 

[08/39] ambari git commit: AMBARI-22509 Fix DatabaseConsistencyCheckHelper (dsen)

2017-11-24 Thread adoroszlai
AMBARI-22509 Fix DatabaseConsistencyCheckHelper (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99259e50
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99259e50
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99259e50

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 99259e5001fc8a055cc0285e5d5945661000c654
Parents: 1f17684
Author: Dmytro Sen 
Authored: Fri Nov 24 12:17:12 2017 +0200
Committer: Dmytro Sen 
Committed: Fri Nov 24 12:17:12 2017 +0200

--
 .../checks/DatabaseConsistencyCheckHelper.java  | 132 --
 .../DatabaseConsistencyCheckHelperTest.java | 178 +++
 2 files changed, 213 insertions(+), 97 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/99259e50/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 80f88de..1f57996 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -901,28 +901,28 @@ public class DatabaseConsistencyCheckHelper {
   static void checkServiceConfigs()  {
 LOG.info("Checking services and their configs");
 
-String GET_SERVICES_WITHOUT_CONFIGS_QUERY = "select c.cluster_name, 
service_name from clusterservices cs " +
+String GET_SERVICES_WITHOUT_CONFIGS_QUERY = "select c.cluster_name, id 
from clusterservices cs " +
 "join clusters c on cs.cluster_id=c.cluster_id " +
-"where service_name not in (select service_name from serviceconfig 
sc where sc.cluster_id=cs.cluster_id and sc.service_name=cs.service_name and 
sc.group_id is null)";
-String GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY = "select c.cluster_name, 
sc.service_name, sc.version from serviceconfig sc " +
+"where id not in (select service_id from serviceconfig sc where 
sc.cluster_id=cs.cluster_id and sc.service_id=cs.id and sc.group_id is null)";
+String GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY = "select c.cluster_name, 
sc.service_group_id, sc.service_id, sc.version from serviceconfig sc " +
 "join clusters c on sc.cluster_id=c.cluster_id " +
 "where service_config_id not in (select service_config_id from 
serviceconfigmapping) and group_id is null";
 String GET_STACK_NAME_VERSION_QUERY = "select c.cluster_name, 
s.stack_name, s.stack_version from clusters c " +
 "join stack s on c.desired_stack_id = s.stack_id";
-String GET_SERVICES_WITH_CONFIGS_QUERY = "select c.cluster_name, 
cs.service_name, cc.type_name, sc.version from clusterservices cs " +
-"join serviceconfig sc on cs.service_name=sc.service_name and 
cs.cluster_id=sc.cluster_id " +
+String GET_SERVICES_WITH_CONFIGS_QUERY = "select c.cluster_name, cs.id, 
cs.service_type, cc.type_name, sc.version from clusterservices cs " +
+"join serviceconfig sc on cs.id=sc.service_id and 
cs.cluster_id=sc.cluster_id " +
 "join serviceconfigmapping scm on 
sc.service_config_id=scm.service_config_id " +
 "join clusterconfig cc on scm.config_id=cc.config_id and 
sc.cluster_id=cc.cluster_id " +
 "join clusters c on cc.cluster_id=c.cluster_id and 
sc.stack_id=c.desired_stack_id " +
-"where sc.group_id is null and sc.service_config_id=(select 
max(service_config_id) from serviceconfig sc2 where 
sc2.service_name=sc.service_name and sc2.cluster_id=sc.cluster_id) " +
-"group by c.cluster_name, cs.service_name, cc.type_name, 
sc.version";
-String GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY = "select c.cluster_name, 
cs.service_name, cc.type_name from clusterservices cs " +
-"join serviceconfig sc on cs.service_name=sc.service_name and 
cs.cluster_id=sc.cluster_id " +
+"where sc.group_id is null and sc.service_config_id=(select 
max(service_config_id) from serviceconfig sc2 where 
sc2.service_id=sc.service_id and sc2.cluster_id=sc.cluster_id) " +
+"group by c.cluster_name, cs.id, cs.service_type, cc.type_name, 
sc.version";
+String GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY = "select c.cluster_name, 
cs.id, cc.type_name from clusterservices cs " +
+"join serviceconfig sc on cs.id=sc.service_id and 
cs.cluster_id=sc.cluster_id " +
 "join serviceconfigmapping scm on 
sc.service_config_id=scm.service_config_id " +
 

[03/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index 110e359..efa351a 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -244,13 +244,13 @@ public class ComponentResourceProviderTest {
 
expect(service.getServiceComponents()).andReturn(serviceComponentMap).anyTimes();
 
 expect(serviceComponent1.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component100", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component100", stackId, "", serviceComponentStateCountMap,
   true /* recovery enabled */, "Component100 Client", null, null));
 expect(serviceComponent2.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component101", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component101", stackId, "", serviceComponentStateCountMap,
   false /* recovery not enabled */, "Component101 Client", null, 
null));
 expect(serviceComponent3.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component102", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component102", stackId, "", serviceComponentStateCountMap,
   true /* recovery enabled */, "Component102 Client", "1.1", 
RepositoryVersionState.CURRENT));
 
 expect(ambariMetaInfo.getComponent("FOO", "1.0", null, 
"Component100")).andReturn(
@@ -423,13 +423,13 @@ public class ComponentResourceProviderTest {
 expect(component3Info.getCategory()).andReturn(null);
 
 expect(serviceComponent1.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component101", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component101", stackId, "", serviceComponentStateCountMap,
   false /* recovery not enabled */, "Component101 Client", null, 
null));
 expect(serviceComponent2.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component102", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component102", stackId, "", serviceComponentStateCountMap,
   false /* recovery not enabled */, "Component102 Client", null, 
null));
 expect(serviceComponent3.convertToResponse()).andReturn(
-  new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component103", stackId, "", serviceComponentStateCountMap,
+  new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component103", stackId, "", serviceComponentStateCountMap,
   false /* recovery not enabled */, "Component103 Client", null, 
null));
 
expect(serviceComponent1.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
 
expect(serviceComponent2.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
@@ -731,7 +731,7 @@ public class ComponentResourceProviderTest {
 expect(component1Info.getCategory()).andReturn(null);
 
 expect(serviceComponent1.convertToResponse()).andReturn(
-new ServiceComponentResponse(100L, "Cluster100", "Service100", 
"Component101", stackId, "", serviceComponentStateCountMap,
+new ServiceComponentResponse(100L, "Cluster100", 1L, "", 1L, 
"Service100", "", "Component101", stackId, "", serviceComponentStateCountMap,
 false /* recovery not enabled */, "Component101 Client", null, 
null));
 
expect(serviceComponent1.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
 
@@ -897,8 +897,8 @@ public class ComponentResourceProviderTest {
 expect(component4Info.getCategory()).andReturn(null);
 
 expect(service.getName()).andReturn("service1").anyTimes();
-expect(service.getServiceComponent("component1")).andThrow(new 
ServiceComponentNotFoundException("cluster1", "service1", "component1"));
-expect(service.getServiceComponent("component2")).andThrow(new 
ServiceComponentNotFoundException("cluster1", "service1", "component2"));
+

[09/39] ambari git commit: AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c9115909
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c9115909
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c9115909

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c9115909f5ece57ea39bce3669915df685041893
Parents: 8afa31e
Author: Balazs Bence Sari 
Authored: Mon Nov 13 14:55:16 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../org/apache/ambari/server/controller/AmbariServer.java   | 2 +-
 .../server/controller/internal/BaseClusterRequest.java  | 9 +++--
 .../apache/ambari/server/topology/BlueprintV2Factory.java   | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9115909/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index b28cb11..970fb56 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -934,7 +934,7 @@ public class AmbariServer {
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
 BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
-BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
+
BaseClusterRequest.init(injector.getInstance(AmbariManagementController.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 
 PermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9115909/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index a38f478..eefb31b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.QueryLexer;
 import org.apache.ambari.server.api.predicate.Token;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
 import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
@@ -92,12 +93,8 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   private static ResourceProvider hostResourceProvider;
 
 
-  /**
-   * inject blueprint factory
-   * @param factory  blueprint factory
-   */
-  public static void init(BlueprintV2Factory factory) {
-blueprintFactory = factory;
+  public static void init(AmbariManagementController controller) {
+blueprintFactory = BlueprintV2Factory.create(controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9115909/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 9870dcb..47aed80 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -82,6 +82,7 @@ public class BlueprintV2Factory {
   protected BlueprintV2Factory() {
 
   }
+
   protected BlueprintV2Factory(StackV2Factory stackFactory) {
 this.stackFactory = stackFactory;
   }



[31/39] ambari git commit: AMBARI-22253. Cluster creation via V2 blueprint (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22253. Cluster creation via V2 blueprint (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c5c3c7ef
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c5c3c7ef
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c5c3c7ef

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c5c3c7efada017f0ef41ff6c138c39a087dae693
Parents: 7d94bcf
Author: Attila Doroszlai 
Authored: Wed Nov 15 12:29:22 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../controller/internal/BaseClusterRequest.java |   2 +-
 .../internal/ProvisionClusterRequest.java   | 130 +--
 .../server/state/cluster/ClusterImpl.java   |  12 +-
 .../ambari/server/topology/AmbariContext.java   |  53 +++-
 .../server/topology/BlueprintFactory.java   |   6 +-
 .../ambari/server/topology/BlueprintImplV2.java |   9 +-
 .../ambari/server/topology/BlueprintV2.java |   1 -
 .../server/topology/BlueprintV2Factory.java |   2 -
 .../topology/ClusterConfigurationRequest.java   |  51 +++-
 .../ambari/server/topology/ClusterTopology.java |   4 +-
 .../server/topology/ClusterTopologyImpl.java|  79 +--
 .../ambari/server/topology/Configuration.java   |   4 +
 .../server/topology/ConfigurationFactory.java   |  14 +-
 .../ambari/server/topology/HostGroupInfo.java   |  70 +-
 .../ambari/server/topology/HostGroupV2.java |   3 +-
 .../apache/ambari/server/topology/Service.java  |   1 +
 .../validators/ClusterConfigTypeValidator.java  |   2 +-
 .../topology/ConfigurationFactoryTest.java  |   6 +-
 18 files changed, 201 insertions(+), 248 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c5c3c7ef/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index eefb31b..4a32529 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -52,7 +52,7 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   /**
* host group info map
*/
-  protected final Map hostGroupInfoMap = new 
HashMap<>();
+  private final Map hostGroupInfoMap = new HashMap<>();
 
   protected ProvisionAction provisionAction;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5c3c7ef/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index 48d5016..a38b314 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -17,13 +17,16 @@
  */
 package org.apache.ambari.server.controller.internal;
 
+import static 
org.apache.ambari.server.topology.ConfigurationFactory.toBranchMapList;
+import static 
org.apache.ambari.server.topology.ConfigurationFactory.toLeafMapList;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.security.encryption.CredentialStoreType;
@@ -45,13 +48,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Enums;
-import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 
 /**
  * Request for provisioning a cluster.
  */
-@SuppressWarnings("unchecked")
 public class ProvisionClusterRequest extends BaseClusterRequest {
   /**
* host groups property name
@@ -131,12 +132,6 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
   public static final String SERVICE_GROUP_NAME_PROPERETY = "service_group";
   public static final String SERVICE_NAME_PROPERTY = "name";
 
-
-  /**
-   * configuration factory
-   */
-  private static ConfigurationFactory configurationFactory = 

[28/39] ambari git commit: AMBARI-22297. Fix configurations import/export issues (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Fix configurations import/export issues (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f89b952
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f89b952
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f89b952

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 5f89b952c46407bdc0b4403002801d54fd0c38cb
Parents: 5c51dc1
Author: Attila Doroszlai 
Authored: Mon Nov 20 08:43:46 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../ambari/server/topology/Configurable.java| 24 +++-
 .../ambari/server/topology/Configuration.java   |  4 ++
 .../server/topology/BlueprintV2FactoryTest.java | 40 
 .../test/resources/blueprintv2/blueprintv2.json | 24 
 4 files changed, 58 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f89b952/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
index bab7da6..af91e40 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
@@ -18,13 +18,16 @@
 
 package org.apache.ambari.server.topology;
 
+import static java.util.Collections.singletonMap;
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toMap;
+
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.Lists;
 
 public interface Configurable {
   void setConfiguration(Configuration configuration);
@@ -34,10 +37,10 @@ public interface Configurable {
   default void setConfigs(Collection> allProps = configs.stream().
-filter( map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get("properties ") != null).
-collect(Collectors.toMap(
+filter(map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get(Configuration.PROPERTIES_KEY) != null).
+collect(toMap(
   config -> config.keySet().iterator().next(),
-  config -> config.values().iterator().next().get("properties")
+  config -> 
config.values().iterator().next().get(Configuration.PROPERTIES_KEY)
 ));
   setConfiguration(new Configuration(allProps, new HashMap<>()));
 }
@@ -45,11 +48,12 @@ public interface Configurable {
 
   @JsonProperty("configurations")
   default Collection>> configAsMap = new 
HashMap<>();
-if (null != getConfiguration()) {
-  configAsMap.put("properties", getConfiguration().getProperties());
-}
-return Lists.newArrayList(configAsMap); // TODO replace with 
Collections.singletonList?
+Configuration config = getConfiguration();
+return config != null
+  ? config.getProperties().entrySet().stream()
+.map(e -> singletonMap(e.getKey(), 
singletonMap(Configuration.PROPERTIES_KEY, e.getValue(
+.collect(toList())
+  : Collections.emptyList();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f89b952/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
index 6adcf18..123237f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
@@ -30,6 +30,10 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
  * Configuration for a topology entity such as a blueprint, hostgroup or 
cluster.
  */
 public class Configuration {
+
+  public static final String PROPERTIES_KEY = "properties";
+  public static final String ATTRIBUTES_KEY = "properties_attributes";
+
   /**
* properties for this configuration instance
*/


[29/39] ambari git commit: AMBARI-22325 Cluster template object initial version (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Cluster template object initial version (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/94712bc4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/94712bc4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/94712bc4

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 94712bc41056bca596899333c3d65f494473012f
Parents: c5c3c7e
Author: Balazs Bence Sari 
Authored: Fri Nov 17 22:20:20 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |  53 ++---
 .../ambari/server/topology/Credential.java  |   8 +-
 .../topology/ProvisionClusterTemplate.java  | 198 +++
 .../ProvisionClusterTemplateFactory.java|  48 +
 .../server/topology/BlueprintImplV2Test.java| 173 
 .../topology/ProvisionClusterTemplateTest.java  |  30 +++
 .../validators/BlueprintImplV2Test.java | 175 
 .../blueprintv2/cluster_template_v2.json|  66 +++
 8 files changed, 552 insertions(+), 199 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/94712bc4/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index e16ba86..3262c54 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -56,33 +56,35 @@ public class BlueprintV2Factory {
 
   // Host Groups
   protected static final String HOST_GROUP_PROPERTY_ID = "host_groups";
-  protected static final String HOST_GROUP_NAME_PROPERTY_ID = "name";
-  protected static final String HOST_GROUP_CARDINALITY_PROPERTY_ID = 
"cardinality";
+//  protected static final String HOST_GROUP_NAME_PROPERTY_ID = "name";
+//  protected static final String HOST_GROUP_CARDINALITY_PROPERTY_ID = 
"cardinality";
 
   // Host Group Components
-  protected static final String COMPONENT_PROPERTY_ID ="components";
+//  protected static final String COMPONENT_PROPERTY_ID ="components";
   protected static final String COMPONENT_NAME_PROPERTY_ID ="name";
-  protected static final String COMPONENT_PROVISION_ACTION_PROPERTY_ID = 
"provision_action";
+//  protected static final String COMPONENT_PROVISION_ACTION_PROPERTY_ID = 
"provision_action";
 
   // Configurations
-  protected static final String CONFIGURATION_PROPERTY_ID = "configurations";
+//  protected static final String CONFIGURATION_PROPERTY_ID = "configurations";
   protected static final String PROPERTIES_PROPERTY_ID = "properties";
-  protected static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID = 
"properties_attributes";
+//  protected static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID = 
"properties_attributes";
 
-  protected static final String SETTINGS_PROPERTY_ID = "settings";
+//  protected static final String SETTINGS_PROPERTY_ID = "settings";
 
-  private boolean prettyPrintJson = false;
   private static BlueprintV2DAO blueprintDAO;
   private static RepositoryVersionDAO repositoryVersionDAO;
 
   private StackV2Factory stackFactory;
 
-  protected BlueprintV2Factory() {
+  private ObjectMapper objectMapper;
 
+  protected BlueprintV2Factory() {
+createObjectMapper();
   }
 
   protected BlueprintV2Factory(StackV2Factory stackFactory) {
 this.stackFactory = stackFactory;
+createObjectMapper();
   }
 
   public static BlueprintV2Factory create(AmbariManagementController 
controller) {
@@ -100,7 +102,7 @@ public class BlueprintV2Factory {
   }
 
   public BlueprintV2 convertFromJson(String json) throws IOException {
-BlueprintImplV2 blueprintV2 = createObjectMapper().readValue(json, 
BlueprintImplV2.class);
+BlueprintImplV2 blueprintV2 = getObjectMapper().readValue(json, 
BlueprintImplV2.class);
 blueprintV2.postDeserialization();
 updateStacks(blueprintV2);
 return blueprintV2;
@@ -119,7 +121,7 @@ public class BlueprintV2Factory {
   }
 
   public Map convertToMap(BlueprintV2Entity entity) throws 
IOException {
-return createObjectMapper().readValue(entity.getContent(), new 
TypeReference>(){});
+return getObjectMapper().readValue(entity.getContent(), new 
TypeReference>(){});
   }
 
   private StackV2 parseStack(StackId stackId, String repositoryVersion) {
@@ -143,7 +145,7 @@ public class BlueprintV2Factory {
   }
 
   public String 

[30/39] ambari git commit: AMBARI-22325 SecurityConfigurationTest, small refactors (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 SecurityConfigurationTest, small refactors (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bf24efa4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bf24efa4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bf24efa4

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: bf24efa4a6a4a960f82cb18e42079213067667dc
Parents: dd741d7
Author: Balazs Bence Sari 
Authored: Thu Nov 23 18:08:38 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../server/topology/SecurityConfiguration.java  | 24 +++
 .../server/topology/ConfigurableTest.java   | 17 +
 .../topology/SecurityConfigurationTest.java | 71 
 .../server/topology/TopologyManagerTest.java|  1 -
 .../topology/TopologyTemplateFactoryTest.java   | 20 +++---
 .../ambari/server/utils/ResourceUtils.java  | 34 ++
 .../blueprintv2/cluster_template_v2.json| 58 +++-
 .../resources/blueprintv2/security_config.json  | 58 
 8 files changed, 270 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bf24efa4/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 7a8b8a9..864e802 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -19,10 +19,15 @@
 
 package org.apache.ambari.server.topology;
 
+import java.io.IOException;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.ambari.server.state.SecurityType;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import org.codehaus.jackson.map.ObjectMapper;
 
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS
@@ -36,16 +41,19 @@ public class SecurityConfiguration {
   /**
* Security Type
*/
+  @JsonProperty("type")
   private SecurityType type;
 
   /**
* Holds a reference to a kerberos_descriptor resource.
*/
+  @JsonProperty("kerberos_descriptor_reference")
   private String descriptorReference;
 
   /**
* Content of a kerberos_descriptor as String.
*/
+  @JsonProperty("kerberos_descriptor")
   private String descriptor;
 
 
@@ -64,6 +72,7 @@ public class SecurityConfiguration {
 return type;
   }
 
+  @JsonIgnore
   public String getDescriptor() {
 return descriptor;
   }
@@ -71,4 +80,19 @@ public class SecurityConfiguration {
   public String getDescriptorReference() {
 return descriptorReference;
   }
+
+  public void setDescriptorReference(String descriptorReference) {
+this.descriptorReference = descriptorReference;
+  }
+
+  @JsonIgnore
+  public void setDescriptor(String descriptor) {
+this.descriptor = descriptor;
+  }
+
+  @JsonProperty("kerberos_descriptor")
+  public void setKerberosDescriptorFromJson(Map kerberosDescriptor) 
throws IOException {
+setDescriptor(new ObjectMapper().writeValueAsString(kerberosDescriptor));
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bf24efa4/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
index 2c74dc5..080438d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
@@ -1,3 +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 

[05/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java
index 3d8d161..0b07fb7 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java
@@ -217,8 +217,8 @@ public class BackgroundCustomCommandExecutionTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceRequest r1 = new ServiceRequest(clusterName, serviceName,
-m_repositoryVersion.getId(), dStateStr);
+ServiceRequest r1 = new ServiceRequest(clusterName, "", serviceName,
+m_repositoryVersion.getId(), dStateStr, null);
 
 Set requests = new HashSet<>();
 requests.add(r1);
@@ -234,7 +234,7 @@ public class BackgroundCustomCommandExecutionTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceComponentRequest r = new ServiceComponentRequest(clusterName,
+ServiceComponentRequest r = new ServiceComponentRequest(clusterName, "",
 serviceName, componentName, dStateStr);
 Set requests =
   new HashSet<>();
@@ -248,7 +248,7 @@ public class BackgroundCustomCommandExecutionTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName,
+ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName, "",
 serviceName, componentName, hostname, dStateStr);
 Set requests =
   new HashSet<>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/ClusterResponseTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/ClusterResponseTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/ClusterResponseTest.java
index c9e91e3..40d12de 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/ClusterResponseTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/ClusterResponseTest.java
@@ -40,7 +40,7 @@ public class ClusterResponseTest {
 new ClusterResponse(clusterId, clusterName, provisioningState, 
securityType,
   hostNames, hostNames.size(), "bar", null);
 
-Assert.assertEquals(clusterId, r1.getClusterId());
+Assert.assertTrue(clusterId == r1.getClusterId().longValue());
 Assert.assertEquals(clusterName, r1.getClusterName());
 Assert.assertEquals(provisioningState, r1.getProvisioningState());
 Assert.assertEquals(securityType, r1.getSecurityType());

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/RefreshYarnCapacitySchedulerReleaseConfigTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/RefreshYarnCapacitySchedulerReleaseConfigTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/RefreshYarnCapacitySchedulerReleaseConfigTest.java
index ef186f1..3ce6686 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/RefreshYarnCapacitySchedulerReleaseConfigTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/RefreshYarnCapacitySchedulerReleaseConfigTest.java
@@ -102,12 +102,12 @@ public class 
RefreshYarnCapacitySchedulerReleaseConfigTest {
 // Start
 ClusterRequest cr = new ClusterRequest(cluster.getClusterId(), "c1", 
cluster.getDesiredStackVersion().getStackVersion(), null);
 
-cr.setDesiredConfig(Collections.singletonList(new 
ConfigurationRequest("c1","capacity-scheduler","version2", new HashMap<>(), 
null)));
+cr.setDesiredConfig(Collections.singletonList(new 
ConfigurationRequest("c1","capacity-scheduler","version2", new HashMap<>(), 
null, 1L, 1L)));
 
 controller.updateClusters(Collections.singleton(cr) , null);
 
 
-ServiceComponentHostRequest r = new ServiceComponentHostRequest("c1", 
null, null, null, null);
+ServiceComponentHostRequest r = new ServiceComponentHostRequest("c1", 
null, null, null, null, null);
 r.setStaleConfig("true");
 Set resps = 
controller.getHostComponents(Collections.singleton(r));
 Assert.assertEquals(1, resps.size());
@@ -123,12 +123,12 @@ public class 
RefreshYarnCapacitySchedulerReleaseConfigTest {
 // Start

[22/39] ambari git commit: AMBARI-22253. Fix order of arguments in ServiceRequest call (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22253. Fix order of arguments in ServiceRequest call (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9d30bede
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9d30bede
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9d30bede

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 9d30bede16b19df06f83d8019cb5a4e616b58a25
Parents: 2b4c342
Author: Attila Doroszlai 
Authored: Thu Nov 16 20:33:38 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../main/java/org/apache/ambari/server/topology/AmbariContext.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9d30bede/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
index 8a32265..4c23e2f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/AmbariContext.java
@@ -265,7 +265,7 @@ public class AmbariContext {
 repoVersion));
 }
 
-serviceRequests.add(new ServiceRequest(clusterName, 
serviceGroup.getName(), service.getType(), service.getName(),
+serviceRequests.add(new ServiceRequest(clusterName, 
serviceGroup.getName(), service.getName(), service.getType(),
   repoVersion.getId(), null, credentialStoreEnabled, null));
 
 for (ComponentV2 component : 
topology.getBlueprint().getComponents(service)) {



[36/39] ambari git commit: AMBARI-22297. Code cleanup (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Code cleanup (adoroszlai)

 * ServiceId.equals/hashCode
 * ServiceId.NULL
 * some lambdas
 * ? extends Object
 * useless ?:


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/dd741d79
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/dd741d79
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/dd741d79

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: dd741d796ddb5dc4bd83df35d5d4e044ea361b61
Parents: a4c9e6b
Author: Attila Doroszlai 
Authored: Wed Nov 22 09:48:16 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../controller/AmbariManagementControllerImpl.java  |  2 +-
 .../server/controller/ConfigurationRequest.java |  4 ++--
 .../ambari/server/topology/BlueprintV2Impl.java | 11 +--
 .../apache/ambari/server/topology/ComponentV2.java  |  9 ++---
 .../apache/ambari/server/topology/Configurable.java |  6 +++---
 .../org/apache/ambari/server/topology/Service.java  |  2 +-
 .../apache/ambari/server/topology/ServiceGroup.java |  7 ++-
 .../apache/ambari/server/topology/ServiceId.java| 16 +---
 .../ambari/server/topology/TopologyTemplate.java| 11 +++
 9 files changed, 24 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/dd741d79/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 37eb613..6896a9b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1014,7 +1014,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 }
 
 Config config = createConfig(cluster, stackId, request.getType(), 
requestProperties,
-  request.getVersionTag(), propertiesAttributes, request.getServiceId() == 
null? null : request.getServiceId());
+  request.getVersionTag(), propertiesAttributes, request.getServiceId());
 
 LOG.info(MessageFormat.format("Creating configuration with tag ''{0}'' to 
cluster ''{1}''  for configuration type {2}",
 request.getVersionTag(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd741d79/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
index d26cf16..3c83fed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
@@ -57,8 +57,8 @@ public class ConfigurationRequest {
 this.configs = configs;
 this.configsAttributes = configsAttributes;
 this.includeProperties = (type != null && tag != null);
-this.serviceId = serviceId == null ? null : serviceId;
-this.serviceGroupId = serviceGroupId == null ? null : serviceGroupId;
+this.serviceId = serviceId;
+this.serviceGroupId = serviceGroupId;
 
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd741d79/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
index b27ab79..77fe5d8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
@@ -263,12 +263,6 @@ public class BlueprintV2Impl implements BlueprintV2 {
 return configuration;
   }
 
-  private void addChildConfiguration(Configuration parent, Configuration 
child) {
-child.setParentConfiguration(parent);
-parent.getProperties().putAll(child.getProperties());
-parent.getAttributes().putAll(child.getAttributes());
-  }
-
   @Override
   @JsonIgnore
   public Setting getSetting() {
@@ -354,10 +348,7 @@ public class BlueprintV2Impl implements BlueprintV2 {
 final Set serviceNames =
   

[18/39] ambari git commit: AMBARI-22325. Get rid of unchecked warning in BlueprintV2Factory (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Get rid of unchecked warning in BlueprintV2Factory (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/734f1785
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/734f1785
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/734f1785

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 734f17851cf80a9465f92defbc4ea83906838ac3
Parents: 23e985f
Author: Attila Doroszlai 
Authored: Tue Nov 14 19:30:58 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../org/apache/ambari/server/topology/BlueprintV2Factory.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/734f1785/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index fa12173..2c5bc8b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -20,7 +20,6 @@
 package org.apache.ambari.server.topology;
 
 import java.io.IOException;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
@@ -41,6 +40,7 @@ import org.apache.ambari.server.state.StackId;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
@@ -119,9 +119,8 @@ public class BlueprintV2Factory {
 return convertFromJson(blueprintEntity.getContent());
   }
 
-  @SuppressWarnings("unchecked")
   public Map convertToMap(BlueprintV2Entity entity) throws 
IOException {
-return createObjectMapper().readValue(entity.getContent(), HashMap.class);
+return createObjectMapper().readValue(entity.getContent(), new 
TypeReference>(){});
   }
 
   private StackV2 parseStack(StackId stackId) {



[12/39] ambari git commit: AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78290231
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78290231
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78290231

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 782902317fa9d540dca890a35d72f0d55ea5c614
Parents: 99259e5
Author: Balazs Bence Sari 
Authored: Mon Nov 6 11:18:55 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  |   1 +
 .../ambari/server/topology/BlueprintImplV2.java |  24 +++-
 .../server/topology/BlueprintV2Factory.java |  29 +++-
 .../ambari/server/topology/ComponentV2.java |   5 +
 .../ambari/server/topology/Configurable.java|  25 +++-
 .../ambari/server/topology/HostGroupV2Impl.java |   7 +
 .../apache/ambari/server/topology/Service.java  |  15 ++
 .../validators/BlueprintImplV2Test.java |  32 -
 .../resources/blueprintv2/blueprintv2_2.json| 139 +++
 9 files changed, 261 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/78290231/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 9bd8dd3..b28cb11 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -933,6 +933,7 @@ public class AmbariServer {
 .class), injector.getInstance(Gson.class));
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
+BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
 BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/78290231/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index d31e9d4..d889fc2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -23,6 +23,7 @@ import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -47,7 +48,7 @@ public class BlueprintImplV2 implements BlueprintV2 {
 
   private String name;
   private SecurityConfiguration securityConfiguration;
-  private Collection repositoryVersions;
+  private Collection repositoryVersions = new 
ArrayList<>(0);
   private Map serviceGroups;
   private Setting setting;
   private Configuration configuration;
@@ -98,6 +99,11 @@ public class BlueprintImplV2 implements BlueprintV2 {
 this.repositoryVersions = repositoryVersions;
   }
 
+  @JsonProperty("repository_versions")
+  public Collection getRepositoryVersions() {
+return this.repositoryVersions;
+  }
+
   @JsonProperty("service_groups")
   public void setServiceGroups(Collection serviceGroups) {
 this.serviceGroups = serviceGroups.stream().collect(toMap( sg -> 
sg.getName(), sg -> sg ));
@@ -128,17 +134,24 @@ public class BlueprintImplV2 implements BlueprintV2 {
   }
 
   @Override
-  @JsonProperty("host_groups")
+  @JsonIgnore
   public Map getHostGroups() {
 return hostGroupMap;
   }
 
+  @JsonProperty("host_groups")
+  public Collection getHostGroupsForSerialization() {
+return hostGroupMap.values();
+  }
+
   @Override
+  @JsonIgnore
   public Collection getStacks() {
 return stacks.values();
   }
 
   @Override
+  @JsonIgnore
   public Collection getStackIds() {
 return repositoryVersions.stream().map(rv -> 
rv.getStackId()).collect(toList());
   }
@@ -258,11 +271,16 @@ public class BlueprintImplV2 implements BlueprintV2 {
   }
 
   @Override
-  @JsonProperty("cluster_settings")
+  @JsonIgnore
 

[35/39] ambari git commit: AMBARI-22325 Cluster template object improvements (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Cluster template object improvements (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3a016f83
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3a016f83
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3a016f83

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 3a016f8380627c916726edb5137e4df1336b527f
Parents: c50ce3d
Author: Balazs Bence Sari 
Authored: Tue Nov 21 10:32:23 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../ambari/server/topology/ComponentV2.java |  6 +-
 .../topology/ProvisionClusterTemplate.java  | 72 
 .../ProvisionClusterTemplateFactory.java|  9 +--
 .../apache/ambari/server/topology/Service.java  |  6 +-
 .../ambari/server/topology/ServiceId.java   | 27 +++-
 .../server/topology/BlueprintV2FactoryTest.java | 16 ++---
 .../topology/ProvisionClusterTemplateTest.java  | 49 -
 .../blueprintv2/cluster_template_v2.json| 15 +++-
 .../cluster_template_v2_invalid_hostgroup.json  | 70 +++
 9 files changed, 215 insertions(+), 55 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3a016f83/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
index 0d26ef6..42158f4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
@@ -30,7 +30,7 @@ public class ComponentV2 implements Configurable {
 
   private String name;
 
-  private ServiceId serviceId = new ServiceId();
+  private ServiceId serviceId = new ServiceId(null, null);
 
   private ProvisionAction provisionAction = ProvisionAction.INSTALL_AND_START;
 
@@ -110,12 +110,12 @@ public class ComponentV2 implements Configurable {
 
   @JsonProperty("service_group")
   public void setServiceGroup(String serviceGroup) {
-serviceId.setServiceGroup(serviceGroup);
+this.serviceId = new ServiceId(this.serviceId.getName(), serviceGroup);
   }
 
   @JsonProperty("service_name")
   public void setServiceName(String serviceName) {
-serviceId.setName(serviceName);
+this.serviceId = new ServiceId(serviceName, 
this.serviceId.getServiceGroup());
   }
 
   public String getServiceName() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/3a016f83/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
index 5ef6517..90da776 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
@@ -18,26 +18,39 @@
  */
 package org.apache.ambari.server.topology;
 
+import static java.util.stream.Collectors.toMap;
+
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.annotation.Nullable;
 
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
 
 public class ProvisionClusterTemplate {
 
-  private String blueprint;
+  private String blueprint = null;
+
   @JsonProperty("default_password")
-  private String defaultPassword;
+  private String defaultPassword = null;
+
   @JsonProperty("config_recommendation_strategy")
   private ConfigRecommendationStrategy configRecommendationStrategy;
+
   @JsonProperty("provision_action")
   private ProvisionAction provisionAction;
-  private Collection services;
-  @JsonProperty("host_groups")
-  private Collection hostGroups;
+
+  private Map servicesById = 
Collections.emptyMap();
+
+  private Map hostGroups = 
Collections.emptyMap();
+
   private Collection credentials;
+
   @JsonProperty("security")
   private SecurityConfiguration securityConfiguration;
 
@@ -57,12 +70,21 @@ public class ProvisionClusterTemplate {
 this.defaultPassword = defaultPassword;
   }
 
+  public @Nullable Service getServiceById(ServiceId serviceId) {
+

[25/39] ambari git commit: AMBARI-22196. yum repo file contains parsing errors due to initial whitespace (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22196. yum repo file contains parsing errors due to initial whitespace 
(adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7d94bcf4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7d94bcf4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7d94bcf4

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7d94bcf4229978a0f06ba8e2f016f44603b6df4f
Parents: 38c1fbf
Author: Attila Doroszlai 
Authored: Fri Nov 17 18:16:48 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 ambari-server/src/main/resources/cluster-settings.xml | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7d94bcf4/ambari-server/src/main/resources/cluster-settings.xml
--
diff --git a/ambari-server/src/main/resources/cluster-settings.xml 
b/ambari-server/src/main/resources/cluster-settings.xml
index 70b100a..3b0cc1a 100644
--- a/ambari-server/src/main/resources/cluster-settings.xml
+++ b/ambari-server/src/main/resources/cluster-settings.xml
@@ -181,12 +181,12 @@
 
 repo_suse_rhel_template
 [{{repo_id}}]
-name={{repo_id}}
-{% if mirror_list %}mirrorlist={{mirror_list}}{% else 
%}baseurl={{base_url}}{% endif %}
+name={{repo_id}}
+{% if mirror_list %}mirrorlist={{mirror_list}}{% else %}baseurl={{base_url}}{% 
endif %}
 
-path=/
-enabled=1
-gpgcheck=0
+path=/
+enabled=1
+gpgcheck=0
 
 Template of repositories for rhel and suse.
 



[34/39] ambari git commit: AMBARI-22297. Initialize blueprint with default values to avoid NPE (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Initialize blueprint with default values to avoid NPE (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c50ce3d5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c50ce3d5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c50ce3d5

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c50ce3d5d6eaa2a50fcfd6648b51445cd41145b8
Parents: 5f89b95
Author: Attila Doroszlai 
Authored: Mon Nov 20 08:55:08 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../ambari/server/topology/BlueprintV2Impl.java   | 14 +++---
 .../apache/ambari/server/topology/Configuration.java  |  4 
 .../ambari/server/topology/SecurityConfiguration.java |  2 ++
 .../org/apache/ambari/server/topology/Service.java|  2 +-
 4 files changed, 14 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c50ce3d5/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
index 26bdfe2..66ca85d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
@@ -23,8 +23,8 @@ import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
 
-import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -48,11 +48,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 public class BlueprintV2Impl implements BlueprintV2 {
 
   private String name;
-  private SecurityConfiguration securityConfiguration;
-  private Collection repositoryVersions = new 
ArrayList<>(0);
-  private Map serviceGroups;
-  private Setting setting;
-  private final Configuration configuration = new Configuration(new 
HashMap<>(), new HashMap<>());
+  private SecurityConfiguration securityConfiguration = 
SecurityConfiguration.NONE;
+  private Collection repositoryVersions = 
Collections.emptyList();
+  private Map serviceGroups = Collections.emptyMap();
+  private Setting setting = new Setting(Collections.emptyMap());
+  private final Configuration configuration = Configuration.createEmpty();
 
   // Transient fields
   @JsonIgnore
@@ -410,7 +410,7 @@ public class BlueprintV2Impl implements BlueprintV2 {
 @JsonProperty("blueprint_name")
 public String name;
 @JsonProperty("security")
-public SecurityConfiguration securityConfiguration;
+public SecurityConfiguration securityConfiguration = 
SecurityConfiguration.NONE;
 
 public Blueprints() { }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c50ce3d5/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
index 123237f..27b9247 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configuration.java
@@ -49,6 +49,10 @@ public class Configuration {
*/
   private Configuration parentConfiguration;
 
+  public static Configuration createEmpty() {
+return new Configuration(new HashMap<>(0), new HashMap<>(0));
+  }
+
   public Configuration(Configuration config, Configuration parent) {
 this(config.getProperties(), config.getAttributes(), parent);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c50ce3d5/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 7955169..7a8b8a9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -31,6 +31,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
  */
 public class 

[38/39] ambari git commit: AMBARI-22325. Fix RAT/checkstyle errors (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Fix RAT/checkstyle errors (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5c51dc13
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5c51dc13
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5c51dc13

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 5c51dc13e841e38c18f38c7a836d433fccc75970
Parents: b212ee9
Author: Attila Doroszlai 
Authored: Sat Nov 18 09:23:07 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |  2 +-
 .../ambari/server/topology/BlueprintV2Impl.java |  8 +++-
 .../ambari/server/topology/Credential.java  |  3 ++-
 .../topology/ProvisionClusterTemplate.java  | 21 +++-
 .../ProvisionClusterTemplateFactory.java| 20 ++-
 .../topology/ProvisionClusterTemplateTest.java  | 21 +++-
 6 files changed, 65 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5c51dc13/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 8971399..6ce27ef 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -173,7 +173,7 @@ public class BlueprintV2Factory {
   }
 
   public boolean isPrettyPrintJson() {
-return objectMapper.isEnabled(SerializationFeature.INDENT_OUTPUT);;
+return objectMapper.isEnabled(SerializationFeature.INDENT_OUTPUT);
   }
 
   public void setPrettyPrintJson(boolean prettyPrintJson) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5c51dc13/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
index edab552..26bdfe2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
@@ -52,7 +52,7 @@ public class BlueprintV2Impl implements BlueprintV2 {
   private Collection repositoryVersions = new 
ArrayList<>(0);
   private Map serviceGroups;
   private Setting setting;
-  private final Configuration configuration = new Configuration(new 
HashMap<>(), new HashMap<>());;
+  private final Configuration configuration = new Configuration(new 
HashMap<>(), new HashMap<>());
 
   // Transient fields
   @JsonIgnore
@@ -320,10 +320,8 @@ public class BlueprintV2Impl implements BlueprintV2 {
 
   @Override
   public boolean shouldSkipFailure() {
-Optional shouldSkipFailure = setting.getSettingValue(
-  Setting.SETTING_NAME_DEPLOYMENT_SETTINGS,
-  Setting.SETTING_NAME_SKIP_FAILURE);
-return shouldSkipFailure.isPresent() ? 
shouldSkipFailure.get().equalsIgnoreCase("true") : false;
+return setting.getSettingValue(Setting.SETTING_NAME_DEPLOYMENT_SETTINGS, 
Setting.SETTING_NAME_SKIP_FAILURE)
+  .map(Boolean::parseBoolean).orElse(false);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/5c51dc13/ambari-server/src/main/java/org/apache/ambari/server/topology/Credential.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Credential.java 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Credential.java
index 25b9521..637cfe8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Credential.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Credential.java
@@ -19,9 +19,10 @@
 
 package org.apache.ambari.server.topology;
 
+import org.apache.ambari.server.security.encryption.CredentialStoreType;
+
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.ambari.server.security.encryption.CredentialStoreType;
 
 /**
  * Holds credential info submitted in a cluster create template.

http://git-wip-us.apache.org/repos/asf/ambari/blob/5c51dc13/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java

[07/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1f176845
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f176845
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f176845

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 1f176845ec636adbc1dc710c03f8062f979f5405
Parents: 35d704c
Author: Vitaly Brodetskyi 
Authored: Thu Nov 23 12:22:11 2017 +0200
Committer: Vitaly Brodetskyi 
Committed: Thu Nov 23 12:22:11 2017 +0200

--
 ambari-server/pom.xml   |   2 +-
 .../ExecutionCommandWrapperTest.java|   2 +-
 .../TestActionSchedulerThreading.java   |   8 +-
 .../server/agent/HeartbeatProcessorTest.java|   2 +-
 .../server/agent/TestHeartbeatHandler.java  |   2 +-
 .../server/agent/TestHeartbeatMonitor.java  |  10 +-
 .../render/ClusterBlueprintRendererTest.java|   8 +-
 .../api/services/ComponentServiceTest.java  |   4 +-
 .../api/services/ConfigurationServiceTest.java  |   2 +-
 .../server/api/services/ServiceServiceTest.java |   8 +-
 .../StackAdvisorBlueprintProcessorTest.java |  12 +-
 .../checks/ComponentsInstallationCheckTest.java |  12 +-
 .../server/checks/ServicesUpCheckTest.java  |  16 +-
 .../configuration/RecoveryConfigHelperTest.java |  12 +-
 .../AmbariCustomCommandExecutionHelperTest.java |  13 +-
 .../AmbariManagementControllerImplTest.java |  58 +-
 .../AmbariManagementControllerTest.java | 892 +--
 .../BackgroundCustomCommandExecutionTest.java   |   8 +-
 .../server/controller/ClusterResponseTest.java  |   2 +-
 ...hYarnCapacitySchedulerReleaseConfigTest.java |  16 +-
 .../internal/AbstractResourceProviderTest.java  |   4 +-
 .../BlueprintConfigurationProcessorTest.java| 306 +++
 .../ClientConfigResourceProviderTest.java   |   4 +-
 .../internal/ClusterResourceProviderTest.java   |   4 +-
 .../internal/ComponentResourceProviderTest.java |  20 +-
 .../ConfigGroupResourceProviderTest.java|  10 +-
 .../internal/ExportBlueprintRequestTest.java|   2 +-
 .../HostComponentResourceProviderTest.java  |  14 +-
 .../internal/HostResourceProviderTest.java  |  26 +-
 .../internal/JMXHostProviderTest.java   |  24 +-
 .../internal/ProvisionClusterRequestTest.java   |   2 +-
 .../internal/RequestResourceProviderTest.java   |   2 +-
 .../internal/ScaleClusterRequestTest.java   |   2 +-
 .../internal/ServiceResourceProviderTest.java   |   6 +-
 .../StackConfigurationResourceProviderTest.java |  14 +-
 .../StackDefinedPropertyProviderTest.java   |   8 +-
 ...kLevelConfigurationResourceProviderTest.java |  14 +-
 .../server/controller/internal/StackTest.java   |  17 +-
 .../StackUpgradeConfigurationMergeTest.java |   6 +-
 .../controller/internal/UnitUpdaterTest.java|   8 +-
 .../internal/UpgradeResourceProviderTest.java   |  20 +-
 .../UpgradeSummaryResourceProviderTest.java |   2 +-
 .../VersionDefinitionResourceProviderTest.java  |   2 +-
 .../LoggingSearchPropertyProviderTest.java  |   6 +-
 .../utilities/KerberosIdentityCleanerTest.java  |   4 +-
 .../GeneralServiceCalculatedStateTest.java  |   2 +-
 .../apache/ambari/server/events/EventsTest.java |   4 +-
 .../HostVersionOutOfSyncListenerTest.java   |   8 +-
 .../apache/ambari/server/orm/OrmTestHelper.java |   5 +-
 .../apache/ambari/server/orm/TestOrmImpl.java   |  14 +-
 .../server/orm/dao/ServiceConfigDAOTest.java|  30 +-
 .../orm/dao/TopologyLogicalRequestDAOTest.java  |   4 +-
 .../server/orm/dao/TopologyRequestDAOTest.java  |   8 +-
 .../orm/entities/ServiceConfigEntityTest.java   |   2 +-
 .../ComponentVersionCheckActionTest.java|   4 +-
 .../upgrades/ConfigureActionTest.java   |   5 +-
 .../PreconfigureKerberosActionTest.java |   2 +-
 .../upgrades/UpgradeActionTest.java |   4 +-
 .../ambari/server/state/ConfigGroupTest.java|   3 +-
 .../ambari/server/state/ConfigHelperTest.java   |  11 +-
 .../ambari/server/state/DesiredConfigTest.java  |   4 +-
 .../server/state/ServiceComponentTest.java  |  58 +-
 .../apache/ambari/server/state/ServiceTest.java |  16 +-
 .../ambari/server/state/UpgradeHelperTest.java  |  33 +-
 .../state/alerts/AlertEventPublisherTest.java   |   4 +-
 .../state/alerts/InitialAlertEventTest.java |   4 +-
 .../state/cluster/ClusterDeadlockTest.java  |   3 +-
 .../server/state/cluster/ClusterImplTest.java   |   4 +-
 .../server/state/cluster/ClusterTest.java   | 137 +--
 .../state/cluster/ClustersDeadlockTest.java |   3 +-
 .../server/state/cluster/ClustersTest.java  |  20 +-
 .../ConcurrentServiceConfigVersionTest.java |   9 +-
 ...omponentHostConcurrentWriteDeadlockTest.java |   3 +-
 

[37/39] ambari git commit: AMBARI-22325 Fix build errors (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Fix build errors (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7b9e3779
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7b9e3779
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7b9e3779

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7b9e377952ef2cf39becc83d05f5dda2ef6b099e
Parents: bf24efa
Author: Balazs Bence Sari 
Authored: Fri Nov 24 12:23:46 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../apache/ambari/server/topology/SecurityConfiguration.java| 4 ++--
 .../ambari/server/topology/SecurityConfigurationTest.java   | 5 +++--
 .../ambari/server/topology/TopologyTemplateFactoryTest.java | 3 ---
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7b9e3779/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 864e802..00ad10b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -22,12 +22,12 @@ package org.apache.ambari.server.topology;
 import java.io.IOException;
 import java.util.Map;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.ambari.server.state.SecurityType;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS

http://git-wip-us.apache.org/repos/asf/ambari/blob/7b9e3779/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
index 4af0806..1e49a97 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
@@ -21,11 +21,12 @@ import static org.junit.Assert.assertEquals;
 
 import java.util.Map;
 
+import org.apache.ambari.server.utils.ResourceUtils;
+import org.junit.Test;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import org.apache.ambari.server.utils.ResourceUtils;
-import org.junit.Test;
 
 public class SecurityConfigurationTest {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7b9e3779/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
index 7efbbd6..67c6590 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
@@ -23,17 +23,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import java.io.IOException;
 import java.util.Map;
 
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.utils.ResourceUtils;
 import org.junit.Test;
 
-import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.io.Resources;
 
 public class TopologyTemplateFactoryTest {
 



[06/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 44b46f4..92eced2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -77,6 +77,7 @@ import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.agent.HeartBeatHandler;
 import org.apache.ambari.server.agent.rest.AgentResource;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.api.services.ServiceKey;
 import org.apache.ambari.server.audit.AuditLogger;
 import org.apache.ambari.server.configuration.Configuration;
 import 
org.apache.ambari.server.controller.internal.ClusterStackVersionResourceProviderTest;
@@ -377,7 +378,7 @@ public class AmbariManagementControllerTest {
   dStateStr = desiredState.toString();
 }
 
-ServiceRequest r1 = new ServiceRequest(clusterName, serviceName,
+ServiceRequest r1 = new ServiceRequest(clusterName, "", serviceName,
 repositoryVersion.getId(), dStateStr,
 null);
 
@@ -394,7 +395,7 @@ public class AmbariManagementControllerTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceComponentRequest r = new ServiceComponentRequest(clusterName,
+ServiceComponentRequest r = new ServiceComponentRequest(clusterName, "",
 serviceName, componentName, dStateStr);
 Set requests =
   new HashSet<>();
@@ -409,7 +410,7 @@ public class AmbariManagementControllerTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName,
+ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName, "",
 serviceName, componentName, hostname, dStateStr);
 Set requests =
   new HashSet<>();
@@ -424,7 +425,7 @@ public class AmbariManagementControllerTest {
 if (desiredState != null) {
   dStateStr = desiredState.toString();
 }
-ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName,
+ServiceComponentHostRequest r = new 
ServiceComponentHostRequest(clusterName, "",
 serviceName, componentName, hostname, dStateStr);
 Set requests =
   new HashSet<>();
@@ -449,10 +450,9 @@ public class AmbariManagementControllerTest {
   configMap.put(config.getType(), config);
 }
 
-ConfigGroup configGroup = configGroupFactory.createNew(cluster, 
serviceName, name,
-  tag, "", configMap, hostMap);
+ConfigGroup configGroup = configGroupFactory.createNew(cluster, 1L, 1L, 
serviceName, tag, "", configMap, hostMap);
 
-configGroup.setServiceName(serviceName);
+//configGroup.setServiceName(serviceName);
 
 cluster.addConfigGroup(configGroup);
 
@@ -462,7 +462,7 @@ public class AmbariManagementControllerTest {
   private long stopService(String clusterName, String serviceName,
   boolean runSmokeTests, boolean reconfigureClients) throws
   AmbariException, AuthorizationException {
-ServiceRequest r = new ServiceRequest(clusterName, serviceName, null, 
State.INSTALLED.toString(), null);
+ServiceRequest r = new ServiceRequest(clusterName, "", serviceName, null, 
State.INSTALLED.toString(), null);
 Set requests = new HashSet<>();
 requests.add(r);
 Map mapRequestProps = new HashMap<>();
@@ -495,7 +495,7 @@ public class AmbariManagementControllerTest {
 for (ServiceComponent sc : s.getServiceComponents().values()) {
   for (ServiceComponentHost sch : sc.getServiceComponentHosts().values()) {
 ServiceComponentHostRequest schr = new ServiceComponentHostRequest
-  (clusterName, serviceName, sc.getName(),
+  (clusterName, "", serviceName, sc.getName(),
 sch.getHostName(), State.INSTALLED.name());
 requests.add(schr);
   }
@@ -527,7 +527,7 @@ public class AmbariManagementControllerTest {
 boolean runSmokeTests, boolean reconfigureClients,
 MaintenanceStateHelper maintenanceStateHelper) 
throws
   AmbariException, AuthorizationException {
-ServiceRequest r = new ServiceRequest(clusterName, serviceName, 
repositoryVersion02.getId(),
+ServiceRequest r = new ServiceRequest(clusterName, "", serviceName, 
repositoryVersion02.getId(),
 State.STARTED.toString(), null);
 Set requests = new HashSet<>();
 requests.add(r);
@@ -582,7 +582,7 @@ public class 

[26/39] ambari git commit: AMBARI-22325 Rename ProvisionClusterTemplate to TopologyTemplate (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Rename ProvisionClusterTemplate to TopologyTemplate (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b49f78ab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b49f78ab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b49f78ab

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: b49f78ab3a68993c4925b94511dc32b5915c5d75
Parents: 3a016f8
Author: Balazs Bence Sari 
Authored: Tue Nov 21 11:27:42 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../topology/ProvisionClusterTemplate.java  | 263 ---
 .../ProvisionClusterTemplateFactory.java|  63 -
 .../server/topology/TopologyTemplate.java   | 263 +++
 .../topology/TopologyTemplateFactory.java   |  63 +
 .../topology/ProvisionClusterTemplateTest.java  |  94 ---
 .../topology/TopologyTemplateFactoryTest.java   |  94 +++
 6 files changed, 420 insertions(+), 420 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b49f78ab/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
deleted file mode 100644
index 90da776..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
+++ /dev/null
@@ -1,263 +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 distribut
- * ed 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.topology;
-
-import static java.util.stream.Collectors.toMap;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.ambari.server.controller.internal.ProvisionAction;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Preconditions;
-
-public class ProvisionClusterTemplate {
-
-  private String blueprint = null;
-
-  @JsonProperty("default_password")
-  private String defaultPassword = null;
-
-  @JsonProperty("config_recommendation_strategy")
-  private ConfigRecommendationStrategy configRecommendationStrategy;
-
-  @JsonProperty("provision_action")
-  private ProvisionAction provisionAction;
-
-  private Map servicesById = 
Collections.emptyMap();
-
-  private Map hostGroups = 
Collections.emptyMap();
-
-  private Collection credentials;
-
-  @JsonProperty("security")
-  private SecurityConfiguration securityConfiguration;
-
-  public String getBlueprint() {
-return blueprint;
-  }
-
-  public void setBlueprint(String blueprint) {
-this.blueprint = blueprint;
-  }
-
-  public String getDefaultPassword() {
-return defaultPassword;
-  }
-
-  public void setDefaultPassword(String defaultPassword) {
-this.defaultPassword = defaultPassword;
-  }
-
-  public @Nullable Service getServiceById(ServiceId serviceId) {
-return servicesById.get(serviceId);
-  }
-
-  @JsonProperty("services")
-  public Collection getServices() {
-return servicesById.values();
-  }
-
-  @JsonProperty("services")
-  public void setServices(Collection services) {
-this.servicesById = services.stream().collect(toMap(
-  s -> s.getId(),
-  s -> s
-));
-  }
-
-  public Collection getCredentials() {
-return credentials;
-  }
-
-  public void setCredentials(Collection credentials) {
-this.credentials = credentials;
-  }
-
-  public SecurityConfiguration getSecurityConfiguration() {
-return securityConfiguration;
-  }
-
-  public void setSecurityConfiguration(SecurityConfiguration 
securityConfiguration) {
-this.securityConfiguration = securityConfiguration;
-  

[33/39] ambari git commit: AMBARI-22325 Support for attributes in configuration (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Support for attributes in configuration (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a4c9e6b3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4c9e6b3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4c9e6b3

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: a4c9e6b3e3075745744f43bbecb581c3b30125d4
Parents: d9a4cab
Author: Balazs Bence Sari 
Authored: Tue Nov 21 23:05:57 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../ambari/server/topology/Configurable.java|  40 +--
 .../server/topology/ConfigurableTest.java   | 120 +++
 2 files changed, 150 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a4c9e6b3/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
index af91e40..dca16e0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.topology;
 
-import static java.util.Collections.singletonMap;
 import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 
@@ -26,34 +25,55 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 
 public interface Configurable {
   void setConfiguration(Configuration configuration);
   Configuration getConfiguration();
 
   @JsonProperty("configurations")
-  default void setConfigs(Collection> allProps = configs.stream().
 filter(map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get(Configuration.PROPERTIES_KEY) != null).
 collect(toMap(
   config -> config.keySet().iterator().next(),
-  config -> 
config.values().iterator().next().get(Configuration.PROPERTIES_KEY)
+  config -> (Map)config.values().iterator().next().get(Configuration.PROPERTIES_KEY)
 ));
-  setConfiguration(new Configuration(allProps, new HashMap<>()));
+  Map>> allAttributes = 
configs.stream().
+filter(map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get(Configuration.ATTRIBUTES_KEY) != null).
+collect(toMap(
+  config -> config.keySet().iterator().next(),
+  config -> (Map>)
+config.values().iterator().next().get(Configuration.ATTRIBUTES_KEY)
+));
+  setConfiguration(new Configuration(allProps, allAttributes));
 }
   }
 
   @JsonProperty("configurations")
-  default Collection singletonMap(e.getKey(), 
singletonMap(Configuration.PROPERTIES_KEY, e.getValue(
-.collect(toList())
-  : Collections.emptyList();
+if (config != null) {
+  Set keys = Sets.union(config.getProperties().keySet(), 
config.getAttributes().keySet());
+  return keys.stream().map(key -> {
+Map> map = new HashMap<>(2);
+if (config.getProperties().containsKey(key)) {
+  map.put(Configuration.PROPERTIES_KEY, 
config.getProperties().get(key));
+}
+if (config.getAttributes().containsKey(key)) {
+  map.put(Configuration.ATTRIBUTES_KEY, 
config.getAttributes().get(key));
+}
+return ImmutableMap.of(key, map);
+  }).collect(toList());
+}
+else {
+  return Collections.emptyList();
+}
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a4c9e6b3/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
--

[32/39] ambari git commit: AMBARI-22297. Rename BlueprintImplV2 to BlueprintV2Impl (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Rename BlueprintImplV2 to BlueprintV2Impl (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b212ee91
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b212ee91
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b212ee91

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: b212ee91c34d5d8d681febb131a73cf46fe272ae
Parents: 94712bc
Author: Attila Doroszlai 
Authored: Sat Nov 18 08:35:57 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../internal/ExportBlueprintRequest.java|   2 +-
 .../ambari/server/topology/BlueprintImplV2.java | 420 ---
 .../server/topology/BlueprintV2Factory.java |   6 +-
 .../ambari/server/topology/BlueprintV2Impl.java | 420 +++
 .../server/topology/BlueprintImplV2Test.java| 173 
 .../server/topology/BlueprintV2FactoryTest.java | 173 
 6 files changed, 597 insertions(+), 597 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b212ee91/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
index 565369b..6a7a121 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
@@ -144,7 +144,7 @@ public class ExportBlueprintRequest implements 
TopologyRequest {
   hostGroups.add(new HostGroupImpl(exportedHostGroup.getName(), bpName, 
stack, componentList,
   exportedHostGroup.getConfiguration(), 
String.valueOf(exportedHostGroup.getCardinality(;
 }
-//blueprint = new BlueprintImplV2(bpName, hostGroups, stack, 
configuration, null);
+//blueprint = new BlueprintV2Impl(bpName, hostGroups, stack, 
configuration, null);
   }
 
   private void createHostGroupInfo(Collection 
exportedHostGroups) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b212ee91/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
deleted file mode 100644
index 0dd55e8..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ /dev/null
@@ -1,420 +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 distribut
- * ed 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.topology;
-
-import static java.util.stream.Collectors.toList;
-import static java.util.stream.Collectors.toMap;
-import static java.util.stream.Collectors.toSet;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-
-import javax.annotation.Nonnull;
-
-import org.apache.ambari.server.controller.StackV2;
-import org.apache.ambari.server.orm.entities.BlueprintEntity;
-import org.apache.ambari.server.state.ConfigHelper;
-import org.apache.ambari.server.state.StackId;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Blueprint implementation.
- */
-public class BlueprintImplV2 implements BlueprintV2 {
-
-  private String name;
-  private SecurityConfiguration securityConfiguration;
-  private Collection repositoryVersions = new 
ArrayList<>(0);
-  private Map serviceGroups;
-  private Setting 

[02/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index 82d5481..e9da564 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.Field;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -40,6 +41,7 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.api.services.ServiceKey;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.ServiceConfigVersionResponse;
@@ -602,7 +604,7 @@ public class UpgradeActionTest {
 try {
   service = cluster.getService(serviceName);
 } catch (ServiceNotFoundException e) {
-  service = serviceFactory.createNew(cluster, serviceName, 
repositoryVersionEntity);
+  service = serviceFactory.createNew(cluster, null, new 
ArrayList(), serviceName, "", repositoryVersionEntity);
   cluster.addService(service);
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
index cc23e9b..1296be9 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
@@ -105,8 +105,7 @@ public class ConfigGroupTest {
 configs.put(config.getType(), config);
 hosts.put(host.getHostId(), host);
 
-ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", 
"cg-test",
-  "HDFS", "New HDFS configs for h1", configs, hosts);
+ConfigGroup configGroup = configGroupFactory.createNew(cluster, 1L, 1L, 
"HDFS", "", "New HDFS configs for h1", configs, hosts);
 
 cluster.addConfigGroup(configGroup);
 return configGroup;

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index 7e1e2da..ff28eb7 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -156,9 +156,9 @@ public class ConfigHelperTest {
   cr2.setType("flume-conf");
   cr2.setVersionTag("version1");
 
-  cluster.addService("FLUME", repositoryVersion);
-  cluster.addService("OOZIE", repositoryVersion);
-  cluster.addService("HDFS", repositoryVersion);
+  cluster.addService(null, "", "FLUME", repositoryVersion);
+  cluster.addService(null, "", "OOZIE", repositoryVersion);
+  cluster.addService(null, "", "HDFS", repositoryVersion);
 
   final ClusterRequest clusterRequest2 =
   new ClusterRequest(cluster.getClusterId(), clusterName,
@@ -298,7 +298,10 @@ public class ConfigHelperTest {
 configMap.put(config.getType(), config);
   }
 
-  ConfigGroup configGroup = configGroupFactory.createNew(cluster, null, 
name,
+  long serviceGroupId = 1;
+  long serviceId = 1;
+
+  ConfigGroup configGroup = configGroupFactory.createNew(cluster, 
serviceGroupId, serviceId, name,
   tag, "", configMap, hostMap);
   LOG.info("Config group created with tag " + tag);
   configGroup.setTag(tag);

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/state/DesiredConfigTest.java
 

[21/39] ambari git commit: AMBARI-22297. Fix possible ClassCastException (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Fix possible ClassCastException (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/38c1fbf5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/38c1fbf5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/38c1fbf5

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 38c1fbf5d7067d8b44e6fa8ea5a272a01d3cdea4
Parents: 7150862
Author: Attila Doroszlai 
Authored: Fri Nov 17 16:32:18 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../apache/ambari/server/topology/BlueprintImplV2.java   |  4 ++--
 .../org/apache/ambari/server/topology/BlueprintV2.java   |  6 +++---
 .../server/topology/ClusterConfigurationRequest.java | 11 ---
 3 files changed, 9 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/38c1fbf5/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index ad98adc..93dba0c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -291,8 +291,8 @@ public class BlueprintImplV2 implements BlueprintV2 {
 
   @Nonnull
   @Override
-  public Collection getComponentNames(ServiceId serviceId) {
-return 
getComponents(serviceId).stream().map(ComponentV2::getName).collect(toList());
+  public Set getComponentNames(ServiceId serviceId) {
+return 
getComponents(serviceId).stream().map(ComponentV2::getName).collect(toSet());
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/38c1fbf5/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
index f6314be..eed0b68 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
@@ -21,6 +21,7 @@ package org.apache.ambari.server.topology;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.annotation.Nonnull;
 
@@ -124,11 +125,10 @@ public interface BlueprintV2 {
* Get the components that are included in the blueprint for the specified 
service.
*
* @param serviceId  serviceId
-   *
-   * @return collection of component names for the service.  Will not return 
null.
+   * @return set of component names for the service.  Will not return null.
*/
   @Nonnull
-  Collection getComponentNames(ServiceId serviceId);
+  Set getComponentNames(ServiceId serviceId);
 
   /**
* Get the component names s that are included in the blueprint for the 
specified service.

http://git-wip-us.apache.org/repos/asf/ambari/blob/38c1fbf5/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
index 379a69c..96550d5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterConfigurationRequest.java
@@ -179,7 +179,7 @@ public class ClusterConfigurationRequest {
   // generate principals & keytabs for headless identities
   AmbariContext.getController().getKerberosHelper()
 .ensureHeadlessIdentities(cluster, existingConfigurations,
-  new HashSet(blueprint.getAllServices()));
+  new HashSet<>(blueprint.getAllServiceNames()));
 
   // apply Kerberos specific configurations
   Map> updatedConfigs = 
AmbariContext.getController().getKerberosHelper()
@@ -238,13 +238,10 @@ public class ClusterConfigurationRequest {
 Map serviceComponents = new HashMap<>();
 Collection services = blueprint.getAllServices();
 
-if(services != null) {
+if (services != null) {
   for (Service service : services) {
-Collection components = blueprint.getComponents(service);
-

[19/39] ambari git commit: AMBARI-22325 Polish blueprint v2 unit tests (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Polish blueprint v2 unit tests (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/23e985ff
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/23e985ff
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/23e985ff

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 23e985ff6fe13a77f8e5cb083030943396b5bf9b
Parents: c911590
Author: Balazs Bence Sari 
Authored: Mon Nov 13 18:34:02 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |   2 +-
 .../validators/BlueprintImplV2Test.java | 167 +--
 2 files changed, 120 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/23e985ff/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 47aed80..fa12173 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -198,7 +198,7 @@ public class BlueprintV2Factory {
 this.prettyPrintJson = prettyPrintJson;
   }
 
-  ObjectMapper createObjectMapper() {
+  public ObjectMapper createObjectMapper() {
 ObjectMapper mapper = new ObjectMapper();
 SimpleModule module = new SimpleModule("CustomModel", 
Version.unknownVersion());
 SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();

http://git-wip-us.apache.org/repos/asf/ambari/blob/23e985ff/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 611ada1..41d1ca8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -17,30 +17,28 @@
  */
 package org.apache.ambari.server.topology.validators;
 
-import static org.mockito.Mockito.anyString;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.StackV2Factory;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.topology.BlueprintImplV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.BlueprintV2Factory;
-import org.apache.ambari.server.topology.HostGroupV2;
-import org.apache.ambari.server.topology.HostGroupV2Impl;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.fasterxml.jackson.core.Version;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
-import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Resources;
 
 public class BlueprintImplV2Test {
@@ -48,6 +46,7 @@ public class BlueprintImplV2Test {
   static String BLUEPRINTV2_JSON;
   static String BLUEPRINTV2_2_JSON;
 
+  BlueprintV2Factory blueprintFactory;
 
   @BeforeClass
   public static void setUpClass() throws Exception {
@@ -55,50 +54,122 @@ public class BlueprintImplV2Test {
 BLUEPRINTV2_2_JSON = 
Resources.toString(Resources.getResource("blueprintv2/blueprintv2_2.json"), 
Charsets.UTF_8);
   }
 
+  @Before
+  public void setUp() throws Exception {
+StackV2Factory stackFactory = mock(StackV2Factory.class);
+when(stackFactory.create(any(StackId.class))).thenAnswer(invocation -> {
+  StackId stackId = invocation.getArgumentAt(0, StackId.class);
+  StackV2 stack = new StackV2(stackId.getStackName(), 
stackId.getStackVersion(), stackId.getStackVersion() + ".0-1",
+new HashMap<>(), new HashMap<>(), new 

[27/39] ambari git commit: AMBARI-22297. getComponents returns components of all services (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. getComponents returns components of all services (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d9a4cabc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d9a4cabc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d9a4cabc

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: d9a4cabc2afce4ef94d58f9c66c78acb25e3dbcf
Parents: b49f78a
Author: Attila Doroszlai 
Authored: Tue Nov 21 12:33:40 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:46 2017 +0100

--
 .../ambari/server/topology/BlueprintV2Impl.java |  20 ++--
 .../ambari/server/topology/ComponentV2.java |   9 ++
 .../ambari/server/topology/HostGroupV2Impl.java |   5 +-
 .../ambari/server/topology/ServiceGroup.java|   1 -
 .../server/topology/BlueprintV2ImplTest.java| 108 +++
 5 files changed, 131 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d9a4cabc/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
index 66ca85d..b27ab79 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Impl.java
@@ -222,22 +222,27 @@ public class BlueprintV2Impl implements BlueprintV2 {
   @Override
   @JsonIgnore
   public Collection getComponents(Service service) {
-return getHostGroupsForService(service.getId()).stream().flatMap(
-  hg -> hg.getComponents().stream()).
-  collect(toList());
+return getHostGroupsForService(service.getId()).stream()
+  .flatMap(hg -> hg.getComponents().stream())
+  .filter(c -> c.getServiceId().equals(service.getId()))
+  .collect(toList());
   }
 
   @Override
   @JsonIgnore
   public Collection getComponentsByType(Service service, String 
componentType) {
-return getComponents(service).stream().filter(
-compnoent -> 
compnoent.getType().equalsIgnoreCase(componentType)).collect(toList());
+return getComponents(service).stream()
+  .filter(c -> c.getType().equalsIgnoreCase(componentType))
+  .collect(toList());
   }
 
   @Override
   @JsonIgnore
   public Collection getComponents(ServiceId serviceId) {
-return getHostGroupsForService(serviceId).stream().flatMap(hg -> 
hg.getComponents().stream()).collect(toSet());
+return getHostGroupsForService(serviceId).stream()
+  .flatMap(hg -> hg.getComponents().stream())
+  .filter(c -> c.getServiceId().equals(serviceId))
+  .collect(toSet());
   }
 
   @Override
@@ -361,8 +366,7 @@ public class BlueprintV2Impl implements BlueprintV2 {
 this.services = getAllServiceIds().stream().collect(toMap(
   Function.identity(),
   serviceId -> {
-ServiceGroup sg = getServiceGroup(serviceId.getServiceGroup());
-Service service = null != sg ? 
sg.getServiceByName(serviceId.getName()) : null;
+Service service = 
getServiceGroup(serviceId.getServiceGroup()).getServiceByName(serviceId.getName());
 if (null == service) {
   throw new IllegalStateException("Cannot find service for service id: 
" + serviceId);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9a4cabc/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
index 42158f4..8a488b6a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
@@ -140,4 +140,13 @@ public class ComponentV2 implements Configurable {
   public void setService(Service service) {
 this.service = service;
   }
+
+  @Override
+  public String toString() {
+return "Component{" +
+  "serviceGroup=" + serviceId.getServiceGroup() + " " +
+  "service=" + serviceId.getName() + " " +
+  "component=" + type +
+"}";
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9a4cabc/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
 

[15/39] ambari git commit: AMBARI-22325. Code cleanup: delete useless javadoc (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Code cleanup: delete useless javadoc (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/acfb6b4b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/acfb6b4b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/acfb6b4b

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: acfb6b4b97166c8cffdbc1a2bb257154bb31fea9
Parents: 3e46e44
Author: Attila Doroszlai 
Authored: Mon Nov 13 10:49:08 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../ambari/server/topology/BlueprintV2.java | 21 +---
 1 file changed, 1 insertion(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/acfb6b4b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
index 9ca0248..f6314be 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
@@ -27,7 +27,6 @@ import javax.annotation.Nonnull;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
 
-
 /**
  * Blueprint representation.
  */
@@ -65,7 +64,7 @@ public interface BlueprintV2 {
   /**
   * @return associated stack ids
   **/
-  public Collection getStackIds();
+  Collection getStackIds();
 
   StackV2 getStackById(String stackId);
 
@@ -82,8 +81,6 @@ public interface BlueprintV2 {
 
   /**
* Get service by Id
-   * @param serviceId
-   * @return
*/
   Service getServiceById(ServiceId serviceId);
 
@@ -102,8 +99,6 @@ public interface BlueprintV2 {
   @Nonnull
   Collection getAllServiceNames();
 
-
-
   /**
* Get all of the service types represented in the blueprint.
*
@@ -122,9 +117,6 @@ public interface BlueprintV2 {
 
   /**
* Get services by type from a service group.
-   * @param serviceGroup
-   * @param serviceType
-   * @return
*/
   Collection getServicesFromServiceGroup(ServiceGroup serviceGroup, 
String serviceType);
 
@@ -149,16 +141,11 @@ public interface BlueprintV2 {
 
   Collection getComponents(Service service);
 
-
   /**
* Get components by type from a service.
-   * @param service
-   * @param componentType
-   * @return
*/
   Collection getComponentsByType(Service service, String 
componentType);
 
-
   /**
* Get the host groups which contain components for the specified service.
*
@@ -178,7 +165,6 @@ public interface BlueprintV2 {
*/
   Collection getHostGroupsForComponent(ComponentV2 component);
 
-
   /**
* Get the Blueprint cluster scoped configuration.
* The blueprint cluster scoped configuration has the stack
@@ -190,7 +176,6 @@ public interface BlueprintV2 {
   @Deprecated
   Configuration getConfiguration();
 
-
   /**
* Get the Blueprint cluster scoped setting.
* The blueprint cluster scoped setting has the setting properties
@@ -200,7 +185,6 @@ public interface BlueprintV2 {
*/
   Setting getSetting();
 
-
   /**
* Get whether a component is enabled for auto start.
*
@@ -233,10 +217,7 @@ public interface BlueprintV2 {
   void validateTopology() throws InvalidTopologyException;
 
   /**
-   *
* A config type is valid if there are services related to except 
cluster-env and global.
-   * @param configType
-   * @return
*/
   boolean isValidConfigType(String configType);
 



[01/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi) [Forced Update!]

2017-11-24 Thread adoroszlai
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 ad69a3478 -> 60169350a 
(forced update)


http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
index d89c8ca..8d58107 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java
@@ -286,7 +286,7 @@ public class ClusterInstallWithoutStartTest extends 
EasyMockSupport {
 
expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.emptySet()).anyTimes();
 
expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.emptySet()).anyTimes();
 
-expect(request.getBlueprint()).andReturn(blueprint).anyTimes();
+expect(request.getBlueprint()).andReturn(null).anyTimes();
 expect(request.getClusterId()).andReturn(CLUSTER_ID).anyTimes();
 expect(request.getClusterName()).andReturn(CLUSTER_NAME).anyTimes();
 expect(request.getDescription()).andReturn("Provision Cluster 
Test").anyTimes();
@@ -340,7 +340,7 @@ public class ClusterInstallWithoutStartTest extends 
EasyMockSupport {
 
 
expect(ambariContext.getPersistedTopologyState()).andReturn(persistedState).anyTimes();
 //todo: don't ignore param
-ambariContext.createAmbariResources(isA(ClusterTopology.class), 
eq(CLUSTER_NAME), (SecurityType) isNull(), eq("1"), anyLong());
+ambariContext.createAmbariResources(isA(ClusterTopology.class), 
eq(CLUSTER_NAME), (SecurityType) isNull());
 expectLastCall().once();
 expect(ambariContext.getNextRequestId()).andReturn(1L).once();
 
expect(ambariContext.isClusterKerberosEnabled(CLUSTER_ID)).andReturn(false).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
index a8674b3..d8c266d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java
@@ -104,21 +104,21 @@ public class ClusterTopologyImplTest {
 hostGroupMap.put("group4", group4);
 
 Set group1Components = new HashSet<>();
-group1Components.add(new ComponentV2("component1", new Service("service1", 
stack)));
-group1Components.add(new ComponentV2("component2", new Service("service1", 
stack)));
+group1Components.add(null);
+group1Components.add(null);
 
 Set group1ComponentNames = new HashSet<>();
 group1ComponentNames.add("component1");
 group1ComponentNames.add("component2");
 
 Set group2Components = new HashSet<>();
-group2Components.add(new ComponentV2("component3", new Service("service1", 
stack)));
+group2Components.add(null);
 Set group3Components = new HashSet<>();
-group3Components.add(new ComponentV2("component4", new Service("service2", 
stack)));
+group3Components.add(null);
 Set group4Components = new HashSet<>();
-group4Components.add(new ComponentV2("component5", new Service("service2", 
stack)));
+group4Components.add(null);
 
-expect(blueprint.getHostGroups()).andReturn(hostGroupMap).anyTimes();
+expect(blueprint.getHostGroups()).andReturn(null).anyTimes();
 expect(blueprint.getHostGroup("group1")).andReturn(group1).anyTimes();
 expect(blueprint.getHostGroup("group2")).andReturn(group2).anyTimes();
 expect(blueprint.getHostGroup("group3")).andReturn(group3).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java
index a5265f6..02e4e75 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java
@@ -112,7 +112,7 @@ public class LogicalRequestTest extends EasyMockSupport {
 

[23/39] ambari git commit: AMBARI-22297. Simplify getWithEmptyDefault using computeIfAbsent (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. Simplify getWithEmptyDefault using computeIfAbsent (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/71508624
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/71508624
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/71508624

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 71508624f9d0f83d2443a6e6cd8cbfb6b366f415
Parents: e6b0f51
Author: Attila Doroszlai 
Authored: Fri Nov 17 10:26:55 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../java/org/apache/ambari/server/controller/StackV2.java | 7 +--
 .../java/org/apache/ambari/server/topology/Configurable.java  | 2 +-
 2 files changed, 2 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/71508624/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
index 0b0329c..9bdd6a6 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
@@ -516,12 +516,7 @@ public class StackV2 {
   }
 
   static  Map getWithEmptyDefault(Map> 
outerMap, OK outerKey) {
-Map innerMap = outerMap.get(outerKey);
-if (null == innerMap) {
-  innerMap = new HashMap<>();
-  outerMap.put(outerKey, innerMap);
-}
-return innerMap;
+return outerMap.computeIfAbsent(outerKey, __ -> new HashMap<>());
   }
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/71508624/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
index 0f3cf17..bab7da6 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
@@ -49,7 +49,7 @@ public interface Configurable {
 if (null != getConfiguration()) {
   configAsMap.put("properties", getConfiguration().getProperties());
 }
-return Lists.newArrayList(configAsMap);
+return Lists.newArrayList(configAsMap); // TODO replace with 
Collections.singletonList?
   }
 
 }



[24/39] ambari git commit: AMBARI-22297. componentInfos should be keyed by component name, not service name (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22297. componentInfos should be keyed by component name, not service 
name (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e6b0f513
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e6b0f513
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e6b0f513

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: e6b0f513198481efc5c9a12b238184aa0ed2b6fa
Parents: 9d30bed
Author: Attila Doroszlai 
Authored: Thu Nov 16 20:36:28 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../server/controller/StackV2Factory.java   | 21 
 1 file changed, 8 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e6b0f513/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 5d3bcfd..201fcb1 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -18,16 +18,12 @@
 
 package org.apache.ambari.server.controller;
 
-import static java.util.AbstractMap.SimpleImmutableEntry;
-
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
@@ -97,19 +93,18 @@ public class StackV2Factory {
   }
 
   private void getComponentInfos(StackData stackData) {
-List> componentServices = 
stackData.serviceComponents.entrySet().stream().
-  flatMap(e -> e.getValue().stream().map( v -> new 
SimpleImmutableEntry<>(e.getKey(), v))).
-  collect(Collectors.toList());
-componentServices.forEach( componentService -> {
+stackData.componentService.forEach( (componentName, serviceName) -> {
   try {
-ComponentInfo componentInfo = 
controller.getAmbariMetaInfo().getComponent(stackData.stackName,
-  stackData.stackVersion, componentService.getKey(), 
componentService.getValue());
+ComponentInfo componentInfo = 
controller.getAmbariMetaInfo().getComponent(stackData.stackName, 
stackData.stackVersion, serviceName, componentName);
 if (null != componentInfo) {
-  stackData.componentInfos.put(componentService.getKey(), 
componentInfo);
+  stackData.componentInfos.put(componentName, componentInfo);
+} else {
+  LOG.debug("No component info for service: {}, component: {}, stack 
name: {}, stack version: {}",
+serviceName, componentName, stackData.stackName, 
stackData.stackVersion);
 }
   } catch (AmbariException e) {
-LOG.debug("No component info for service: {}, component: {}, stack 
name: {}, stack version: {}, Exception: {}",
-  componentService.getKey(), componentService.getValue(), 
stackData.stackName, stackData.stackVersion, e);
+LOG.debug("No component info for service: {}, component: {}, stack 
name: {}, stack version: {}",
+  serviceName, componentName, stackData.stackName, 
stackData.stackVersion, e);
   }
 });
   }



[39/39] ambari git commit: AMBARI-22253. Fix compile error after rebase (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22253. Fix compile error after rebase (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/60169350
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/60169350
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/60169350

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 60169350ae683cbbb703203de421974edbe3ab68
Parents: 7b9e377
Author: Doroszlai, Attila 
Authored: Fri Nov 24 13:39:17 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:39:17 2017 +0100

--
 .../org/apache/ambari/server/topology/AmbariContextTest.java| 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/60169350/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
index 16de535..b438d86 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java
@@ -81,7 +81,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 
@@ -129,7 +128,7 @@ public class AmbariContextTest {
   private static final Map configGroups = new HashMap<>();
   private Configuration bpConfiguration = null;
   private Configuration group1Configuration = null;
-  private static final Collection group1Hosts = Arrays.asList(HOST1, 
HOST2);
+  private static final Set group1Hosts = ImmutableSet.of(HOST1, HOST2);
 
   private Capture configGroupRequestCapture = 
EasyMock.newCapture();
 
@@ -485,7 +484,7 @@ public class AmbariContextTest {
 
 reset(group1Info);
 
expect(group1Info.getConfiguration()).andReturn(group1Configuration).anyTimes();
-Collection groupHosts = ImmutableList.of(HOST1, HOST2, 
"pending_host"); // pending_host is not registered with the cluster
+Set groupHosts = ImmutableSet.of(HOST1, HOST2, "pending_host"); // 
pending_host is not registered with the cluster
 expect(group1Info.getHostNames()).andReturn(groupHosts).anyTimes(); // 
there are 3 hosts for the host group
 // replay all mocks
 replayAll();



[13/39] ambari git commit: AMBARI-22325. Simplify lambdas (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Simplify lambdas (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99c7cb64
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99c7cb64
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99c7cb64

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 99c7cb6477110833015b8d0d0ff46b3e7cb82690
Parents: 7767f61
Author: Attila Doroszlai 
Authored: Mon Nov 13 09:41:16 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../controller/DeleteIdentityHandler.java   |  2 +-
 .../server/controller/StackV2Factory.java   |  2 +-
 .../utilities/RemovableIdentities.java  |  4 +--
 .../controller/utilities/UsedIdentities.java|  2 +-
 .../ambari/server/topology/BlueprintImplV2.java | 35 ++--
 .../server/topology/BlueprintV2Factory.java |  2 +-
 .../ambari/server/topology/HostGroupV2Impl.java |  6 ++--
 .../ambari/server/topology/ServiceGroup.java|  3 +-
 .../apache/ambari/server/topology/Setting.java  |  2 +-
 9 files changed, 30 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/99c7cb64/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
index f5d51c3..91035f8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
@@ -234,7 +234,7 @@ class DeleteIdentityHandler {
 }
 
 private Set serviceNames() {
-  return componentFilter().stream().map(component -> 
component.getServiceName()).collect(toSet());
+  return 
componentFilter().stream().map(Component::getServiceName).collect(toSet());
 }
 
 private List componentFilter() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/99c7cb64/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 784b368..0735171 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -85,7 +85,7 @@ public class StackV2Factory {
 List> componentServices = 
stackData.serviceComponents.entrySet().stream().
   flatMap(e -> e.getValue().stream().map( v -> new 
SimpleImmutableEntry<>(e.getKey(), v))).
   collect(Collectors.toList());
-componentServices.stream().forEach( componentService -> {
+componentServices.forEach( componentService -> {
   try {
 ComponentInfo componentInfo = 
controller.getAmbariMetaInfo().getComponent(stackData.stackName,
   stackData.stackVersion, componentService.getKey(), 
componentService.getValue());

http://git-wip-us.apache.org/repos/asf/ambari/blob/99c7cb64/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
index cd23e83..ef9518d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
@@ -101,7 +101,7 @@ public class RemovableIdentities {
   }
 
   private static ServiceExclude excludeService(String excludedServiceName) {
-return serviceName -> excludedServiceName.equals(serviceName);
+return excludedServiceName::equals;
   }
 
   private static ComponentExclude excludeComponent(String excludedServiceName, 
String excludedComponentName, String excludedHostName) {
@@ -116,7 +116,7 @@ public class RemovableIdentities {
 
   private static List 
componentIdentities(List componentNames, KerberosServiceDescriptor 
serviceDescriptor) throws AmbariException {
 return componentNames.stream()
-  .map(componentName -> serviceDescriptor.getComponent(componentName))
+  

[10/39] ambari git commit: AMBARI-22325. Fix impossible equality: ComponentV2 vs ProvisionAction (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Fix impossible equality: ComponentV2 vs ProvisionAction 
(adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ff846463
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ff846463
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ff846463

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: ff846463428b553877419da1a94cd0f082e1f606
Parents: 99c7cb6
Author: Attila Doroszlai 
Authored: Mon Nov 13 10:32:43 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../ambari/server/topology/HostGroupV2Impl.java | 33 +++-
 1 file changed, 12 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ff846463/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
index dd7a316..ff82ecf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
@@ -17,23 +17,18 @@
  */
 package org.apache.ambari.server.topology;
 
+import static java.util.stream.Collectors.toList;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import javax.annotation.Nullable;
-
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 
 public class HostGroupV2Impl implements HostGroupV2, Configurable {
 
@@ -73,22 +68,18 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   @Override
   @JsonIgnore
   public Collection getComponentNames() {
-return getComponentNames(components);
-  }
-
-  private Collection getComponentNames(List components) {
-return Lists.transform(components,
-  new Function() {
-@Override public String apply(@Nullable ComponentV2 input) { return 
input.getName(); }
-  });
+return components.stream()
+  .map(ComponentV2::getName)
+  .collect(toList());
   }
 
   @Override
   @JsonIgnore
   public Collection getComponentNames(ProvisionAction provisionAction) 
{
-List filtered =
-  ImmutableList.copyOf(Collections2.filter(components, 
Predicates.equalTo(provisionAction)));
-return getComponentNames(filtered);
+return components.stream()
+  .filter(c -> c.getProvisionAction().equals(provisionAction))
+  .map(ComponentV2::getName)
+  .collect(toList());
   }
 
   @Override
@@ -98,7 +89,7 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
 
   @Override
   public Collection getComponentsByServiceId(ServiceId serviceId) 
{
-return components.stream().filter(c -> 
c.getServiceId().equals(serviceId)).collect(Collectors.toList());
+return components.stream().filter(c -> 
c.getServiceId().equals(serviceId)).collect(toList());
   }
 
   @Override
@@ -128,13 +119,13 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   @Override
   @JsonIgnore
   public Collection getServiceNames() {
-return 
serviceMap.values().stream().map(Service::getName).collect(Collectors.toList());
+return 
serviceMap.values().stream().map(Service::getName).collect(toList());
   }
 
   @JsonIgnore
   public void setServiceMap(Map serviceMap) {
 Preconditions.checkArgument(serviceMap.keySet().equals(this.serviceIds),
-  "Maitained list of service ids doesn't match with received service map: 
%s vs %s", serviceIds, serviceMap.keySet());
+  "Maintained list of service ids doesn't match with received service map: 
%s vs %s", serviceIds, serviceMap.keySet());
 this.serviceMap = serviceMap;
   }
 



[11/39] ambari git commit: AMBARI-22325. Log blueprint JSON parse error when loading from DB (adoroszlai)

2017-11-24 Thread adoroszlai
AMBARI-22325. Log blueprint JSON parse error when loading from DB (adoroszlai)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7767f611
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7767f611
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7767f611

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7767f611a477bc778fb7ea63f0bed3bce73c6840
Parents: 7829023
Author: Attila Doroszlai 
Authored: Mon Nov 13 09:16:44 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../ambari/server/controller/internal/ProvisionClusterRequest.java  | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7767f611/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index f773fc8..48d5016 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -325,6 +325,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 try {
   setBlueprint(getBlueprintFactory().getBlueprint(blueprintName));
 } catch (IOException e) {
+  LOG.error("Could not parse JSON stored in DB for blueprint {}", 
blueprintName, e);
   throw new NoSuchBlueprintException(blueprintName);
 }
 



[16/39] ambari git commit: AMBARI-22325 Yet another fix for v2 blueprint json serialization/deserialization (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Yet another fix for v2 blueprint json 
serialization/deserialization (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3e46e44d
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3e46e44d
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3e46e44d

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 3e46e44d68a090f931cd37590ef381317d8ebd88
Parents: ff84646
Author: Balazs Bence Sari 
Authored: Mon Nov 13 11:20:21 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../src/main/java/org/apache/ambari/server/topology/Service.java| 1 +
 .../ambari/server/topology/validators/BlueprintImplV2Test.java  | 1 +
 2 files changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3e46e44d/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 7c5ee42..90b4764 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -165,6 +165,7 @@ public class Service implements Configurable {
   '}';
   }
 
+  @JsonIgnore
   public String getServiceGroupName() {
 if (serviceGroup != null) {
   return serviceGroup.getName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/3e46e44d/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 99acfb7..611ada1 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -97,6 +97,7 @@ public class BlueprintImplV2Test {
 String bpSerialized = bpFactory.convertToJson(bp);
 System.out.println(bpSerialized);
 bp = (BlueprintImplV2)bpFactory.convertFromJson(bpSerialized);
+System.out.println(bp);
   }
 
 



[04/39] ambari git commit: AMBARI-22493. Fix build for test classes in feature branch.(vbrodetskyi)

2017-11-24 Thread adoroszlai
http://git-wip-us.apache.org/repos/asf/ambari/blob/1f176845/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index 22b0e6b..f9765f2 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -43,7 +43,7 @@ import java.util.Set;
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.KerberosHelper;
-import org.apache.ambari.server.controller.StackConfigurationResponse;
+import org.apache.ambari.server.controller.StackLevelConfigurationResponse;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ConfigHelper;
@@ -290,7 +290,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 configProcessor.doUpdateForBlueprintExport();
 
 String updatedVal = 
properties.get("yarn-site").get("yarn.resourcemanager.hostname");
@@ -338,7 +338,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 configProcessor.doUpdateForBlueprintExport();
 
 assertEquals(properties.size(), 3);
@@ -372,7 +372,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 
 // When
 configProcessor.doUpdateForBlueprintExport();
@@ -416,7 +416,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 configProcessor.doUpdateForBlueprintExport();
 
 assertEquals("%HOSTGROUP::group1%", 
clusterConfig.getPropertyValue("yarn-site", "yarn.resourcemanager.hostname"));
@@ -464,7 +464,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 configProcessor.doUpdateForBlueprintExport();
 
 assertEquals("%HOSTGROUP::group1%", 
properties.get("yarn-site").get("yarn.resourcemanager.hostname"));
@@ -499,7 +499,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology, null);
 configProcessor.doUpdateForBlueprintExport();
 
 String updatedVal = properties.get("core-site").get("fs.defaultFS");
@@ -532,7 +532,7 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
 hostGroups.add(group2);
 
 ClusterTopology topology = createClusterTopology(bp, clusterConfig, 
hostGroups);
-BlueprintConfigurationProcessor configProcessor = new 
BlueprintConfigurationProcessor(topology);
+BlueprintConfigurationProcessor configProcessor = new 

[20/39] ambari git commit: AMBARI-22325 Fix repository versions (benyoka)

2017-11-24 Thread adoroszlai
AMBARI-22325 Fix repository versions (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3d0619a3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3d0619a3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3d0619a3

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 3d0619a34b6d877db551332f46f749917f682907
Parents: 734f178
Author: Balazs Bence Sari 
Authored: Thu Nov 16 12:09:19 2017 +0100
Committer: Doroszlai, Attila 
Committed: Fri Nov 24 13:30:45 2017 +0100

--
 .../AmbariManagementControllerImpl.java |  8 ++--
 .../ambari/server/controller/AmbariServer.java  |  8 ++--
 .../server/controller/RepositoryResponse.java   | 10 +
 .../server/controller/StackV2Factory.java   | 30 +
 .../internal/BlueprintV2ResourceProvider.java   | 10 ++---
 .../ambari/server/orm/entities/StackEntity.java | 11 -
 .../server/topology/BlueprintV2Factory.java | 44 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  1 -
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  1 -
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  1 -
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  1 -
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  1 -
 .../validators/BlueprintImplV2Test.java |  4 +-
 13 files changed, 60 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3d0619a3/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 875d9b6..37eb613 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -4634,11 +4634,8 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
 // !!! when asking for Repository responses for a versionDefinition, it is 
either for
 // an established repo version (a Long) OR from the in-memory generated 
ones (a String)
-if (null == repositoryVersionId && null != versionDefinitionId) {
-
-  if (NumberUtils.isDigits(versionDefinitionId)) {
-repositoryVersionId = Long.valueOf(versionDefinitionId);
-  }
+if (null == repositoryVersionId && 
NumberUtils.isDigits(versionDefinitionId)) {
+  repositoryVersionId = Long.valueOf(versionDefinitionId);
 }
 
 Set responses = new HashSet<>();
@@ -4658,6 +4655,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   }
   response.setStackName(repositoryVersion.getStackName());
   response.setStackVersion(repositoryVersion.getStackVersion());
+  response.setRepoVersion(repositoryVersion.getVersion());
   responses.add(response);
 }
 break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3d0619a3/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 970fb56..4377f04 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -91,6 +91,7 @@ import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.PrincipalDAO;
 import org.apache.ambari.server.orm.dao.PrivilegeDAO;
+import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.ResourceDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
@@ -924,16 +925,15 @@ public class AmbariServer {
 
BlueprintResourceProvider.init(injector.getInstance(BlueprintFactory.class),
 injector.getInstance(BlueprintDAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
 injector.getInstance(Gson.class), ambariMetaInfo);
-
BlueprintV2ResourceProvider.init(injector.getInstance(BlueprintV2Factory.class),
-  injector.getInstance(BlueprintV2DAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
-  ambariMetaInfo);
+  

ambari git commit: AMBARI-22325 Fix build errors (benyoka)

2017-11-24 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 c0eaadd60 -> ad69a3478


AMBARI-22325 Fix build errors (benyoka)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ad69a347
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ad69a347
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ad69a347

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: ad69a3478091f7b8afbeadaee89743a21699714d
Parents: c0eaadd
Author: Balazs Bence Sari 
Authored: Fri Nov 24 12:23:46 2017 +0100
Committer: Balazs Bence Sari 
Committed: Fri Nov 24 12:24:08 2017 +0100

--
 .../apache/ambari/server/topology/SecurityConfiguration.java| 4 ++--
 .../ambari/server/topology/SecurityConfigurationTest.java   | 5 +++--
 .../ambari/server/topology/TopologyTemplateFactoryTest.java | 3 ---
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 864e802..00ad10b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -22,12 +22,12 @@ package org.apache.ambari.server.topology;
 import java.io.IOException;
 import java.util.Map;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.ambari.server.state.SecurityType;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
index 4af0806..1e49a97 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
@@ -21,11 +21,12 @@ import static org.junit.Assert.assertEquals;
 
 import java.util.Map;
 
+import org.apache.ambari.server.utils.ResourceUtils;
+import org.junit.Test;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import org.apache.ambari.server.utils.ResourceUtils;
-import org.junit.Test;
 
 public class SecurityConfigurationTest {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
index 7efbbd6..67c6590 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
@@ -23,17 +23,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import java.io.IOException;
 import java.util.Map;
 
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.utils.ResourceUtils;
 import org.junit.Test;
 
-import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.io.Resources;
 
 public class TopologyTemplateFactoryTest {
 



ambari git commit: AMBARI-22509 Fix DatabaseConsistencyCheckHelper (dsen)

2017-11-24 Thread dsen
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 1f176845e -> 99259e500


AMBARI-22509 Fix DatabaseConsistencyCheckHelper (dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/99259e50
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99259e50
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99259e50

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 99259e5001fc8a055cc0285e5d5945661000c654
Parents: 1f17684
Author: Dmytro Sen 
Authored: Fri Nov 24 12:17:12 2017 +0200
Committer: Dmytro Sen 
Committed: Fri Nov 24 12:17:12 2017 +0200

--
 .../checks/DatabaseConsistencyCheckHelper.java  | 132 --
 .../DatabaseConsistencyCheckHelperTest.java | 178 +++
 2 files changed, 213 insertions(+), 97 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/99259e50/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 80f88de..1f57996 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -901,28 +901,28 @@ public class DatabaseConsistencyCheckHelper {
   static void checkServiceConfigs()  {
 LOG.info("Checking services and their configs");
 
-String GET_SERVICES_WITHOUT_CONFIGS_QUERY = "select c.cluster_name, 
service_name from clusterservices cs " +
+String GET_SERVICES_WITHOUT_CONFIGS_QUERY = "select c.cluster_name, id 
from clusterservices cs " +
 "join clusters c on cs.cluster_id=c.cluster_id " +
-"where service_name not in (select service_name from serviceconfig 
sc where sc.cluster_id=cs.cluster_id and sc.service_name=cs.service_name and 
sc.group_id is null)";
-String GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY = "select c.cluster_name, 
sc.service_name, sc.version from serviceconfig sc " +
+"where id not in (select service_id from serviceconfig sc where 
sc.cluster_id=cs.cluster_id and sc.service_id=cs.id and sc.group_id is null)";
+String GET_SERVICE_CONFIG_WITHOUT_MAPPING_QUERY = "select c.cluster_name, 
sc.service_group_id, sc.service_id, sc.version from serviceconfig sc " +
 "join clusters c on sc.cluster_id=c.cluster_id " +
 "where service_config_id not in (select service_config_id from 
serviceconfigmapping) and group_id is null";
 String GET_STACK_NAME_VERSION_QUERY = "select c.cluster_name, 
s.stack_name, s.stack_version from clusters c " +
 "join stack s on c.desired_stack_id = s.stack_id";
-String GET_SERVICES_WITH_CONFIGS_QUERY = "select c.cluster_name, 
cs.service_name, cc.type_name, sc.version from clusterservices cs " +
-"join serviceconfig sc on cs.service_name=sc.service_name and 
cs.cluster_id=sc.cluster_id " +
+String GET_SERVICES_WITH_CONFIGS_QUERY = "select c.cluster_name, cs.id, 
cs.service_type, cc.type_name, sc.version from clusterservices cs " +
+"join serviceconfig sc on cs.id=sc.service_id and 
cs.cluster_id=sc.cluster_id " +
 "join serviceconfigmapping scm on 
sc.service_config_id=scm.service_config_id " +
 "join clusterconfig cc on scm.config_id=cc.config_id and 
sc.cluster_id=cc.cluster_id " +
 "join clusters c on cc.cluster_id=c.cluster_id and 
sc.stack_id=c.desired_stack_id " +
-"where sc.group_id is null and sc.service_config_id=(select 
max(service_config_id) from serviceconfig sc2 where 
sc2.service_name=sc.service_name and sc2.cluster_id=sc.cluster_id) " +
-"group by c.cluster_name, cs.service_name, cc.type_name, 
sc.version";
-String GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY = "select c.cluster_name, 
cs.service_name, cc.type_name from clusterservices cs " +
-"join serviceconfig sc on cs.service_name=sc.service_name and 
cs.cluster_id=sc.cluster_id " +
+"where sc.group_id is null and sc.service_config_id=(select 
max(service_config_id) from serviceconfig sc2 where 
sc2.service_id=sc.service_id and sc2.cluster_id=sc.cluster_id) " +
+"group by c.cluster_name, cs.id, cs.service_type, cc.type_name, 
sc.version";
+String GET_NOT_SELECTED_SERVICE_CONFIGS_QUERY = "select c.cluster_name, 
cs.id, cc.type_name from clusterservices cs " +
+"join serviceconfig sc on cs.id=sc.service_id and 
cs.cluster_id=sc.cluster_id " +
 "join