ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adorosz...@apache.org
Subject [09/46] ambari git commit: AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)
Date Fri, 08 Dec 2017 19:26:09 GMT
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/7960a868
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7960a868
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7960a868

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7960a86874bdffde40c6a790f3b89f0beef634df
Parents: bcbacf0
Author: Balazs Bence Sari <benyoka@apache.org>
Authored: Mon Nov 6 11:18:55 2017 +0100
Committer: Doroszlai, Attila <adoroszlai@hortonworks.com>
Committed: Fri Dec 8 20:24:24 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/7960a868/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 c88b23c..41dc5a6 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
@@ -935,6 +935,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/7960a868/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<RepositoryVersion> repositoryVersions;
+  private Collection<RepositoryVersion> repositoryVersions = new ArrayList<>(0);
   private Map<String, ServiceGroup> serviceGroups;
   private Setting setting;
   private Configuration configuration;
@@ -98,6 +99,11 @@ public class BlueprintImplV2 implements BlueprintV2 {
     this.repositoryVersions = repositoryVersions;
   }
 
+  @JsonProperty("repository_versions")
+  public Collection<RepositoryVersion> getRepositoryVersions() {
+    return this.repositoryVersions;
+  }
+
   @JsonProperty("service_groups")
   public void setServiceGroups(Collection<ServiceGroup> 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<String, ? extends HostGroupV2> getHostGroups() {
     return hostGroupMap;
   }
 
+  @JsonProperty("host_groups")
+  public Collection<? extends HostGroupV2> getHostGroupsForSerialization() {
+    return hostGroupMap.values();
+  }
+
   @Override
+  @JsonIgnore
   public Collection<StackV2> getStacks() {
     return stacks.values();
   }
 
   @Override
+  @JsonIgnore
   public Collection<String> getStackIds() {
     return repositoryVersions.stream().map(rv -> rv.getStackId()).collect(toList());
   }
@@ -258,11 +271,16 @@ public class BlueprintImplV2 implements BlueprintV2 {
   }
 
   @Override
-  @JsonProperty("cluster_settings")
+  @JsonIgnore
   public Setting getSetting() {
     return this.setting;
   }
 
+  @JsonProperty("cluster_settings")
+  public Map<String, Set<HashMap<String, String>>> getSettingForSerialization()
{
+    return this.setting.getProperties();
+  }
+
   @Nonnull
   @Override
   @JsonIgnore

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 7b228e5..7ad5365 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
@@ -32,7 +32,6 @@ import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.StackV2Factory;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.BlueprintV2DAO;
-import org.apache.ambari.server.orm.dao.StackDAO;
 import org.apache.ambari.server.orm.entities.BlueprintV2Entity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.stack.NoSuchStackException;
@@ -42,6 +41,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 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.inject.Inject;
@@ -72,8 +72,8 @@ public class BlueprintV2Factory {
 
   protected static final String SETTINGS_PROPERTY_ID = "settings";
 
+  private boolean prettyPrintJson = false;
   private static BlueprintV2DAO blueprintDAO;
-  private static StackDAO stackDao;
   private ConfigurationFactory configFactory = new ConfigurationFactory();
 
   private StackV2Factory stackFactory;
@@ -89,6 +89,10 @@ public class BlueprintV2Factory {
     return new BlueprintV2Factory(new StackV2Factory(controller));
   }
 
+  public static BlueprintV2Factory create(StackV2Factory factory) {
+    return new BlueprintV2Factory(factory);
+  }
+
   public BlueprintV2 getBlueprint(String blueprintName) throws NoSuchStackException, NoSuchBlueprintException,
IOException {
     BlueprintV2Entity entity =
       Optional.ofNullable(blueprintDAO.findByName(blueprintName)).orElseThrow(() -> new
NoSuchBlueprintException(blueprintName));
@@ -107,6 +111,7 @@ public class BlueprintV2Factory {
     return blueprintV2;
   }
 
+
   public BlueprintV2 convertFromEntity(BlueprintV2Entity blueprintEntity) throws IOException
{
     return convertFromJson(blueprintEntity.getContent());
   }
@@ -131,7 +136,7 @@ public class BlueprintV2Factory {
 
   public BlueprintV2Entity convertToEntity(BlueprintV2 blueprint) throws JsonProcessingException
{
     BlueprintV2Entity entity = new BlueprintV2Entity();
-    String content = createObjectMapper().writeValueAsString(blueprint);
+    String content = convertToJson(blueprint);
     entity.setContent(content);
     entity.setBlueprintName(blueprint.getName());
     entity.setSecurityType(blueprint.getSecurity().getType());
@@ -139,6 +144,11 @@ public class BlueprintV2Factory {
     return entity;
   }
 
+  public String convertToJson(BlueprintV2 blueprint) throws JsonProcessingException {
+    return createObjectMapper().writeValueAsString(blueprint);
+
+  }
+
   /**
    * Convert a map of properties to a blueprint entity.
    *
@@ -180,7 +190,15 @@ public class BlueprintV2Factory {
     }
   }
 
-  static ObjectMapper createObjectMapper() {
+  public boolean isPrettyPrintJson() {
+    return prettyPrintJson;
+  }
+
+  public void setPrettyPrintJson(boolean prettyPrintJson) {
+    this.prettyPrintJson = prettyPrintJson;
+  }
+
+  ObjectMapper createObjectMapper() {
     ObjectMapper mapper = new ObjectMapper();
     SimpleModule module = new SimpleModule("CustomModel", Version.unknownVersion());
     SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();
@@ -188,6 +206,9 @@ public class BlueprintV2Factory {
     module.setAbstractTypes(resolver);
     mapper.registerModule(module);
     mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+    if (prettyPrintJson) {
+      mapper.enable(SerializationFeature.INDENT_OUTPUT);
+    }
     return mapper;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 68744d4..0d26ef6 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
@@ -68,6 +68,7 @@ public class ComponentV2 implements Configurable {
     return this.provisionAction;
   }
 
+  @JsonIgnore
   public ServiceId getServiceId() {
     return serviceId;
   }
@@ -77,10 +78,12 @@ public class ComponentV2 implements Configurable {
   }
 
   //TODO
+  @JsonIgnore
   public ServiceGroup getServiceGroup() {
     return null;
   }
 
+  @JsonIgnore
   public Configuration getConfiguration() {
     return configuration;
   }
@@ -100,6 +103,7 @@ public class ComponentV2 implements Configurable {
     this.name = name;
   }
 
+  @JsonProperty("service_group")
   public String getServiceGroupName() {
     return serviceId.getServiceGroup();
   }
@@ -123,6 +127,7 @@ public class ComponentV2 implements Configurable {
     this.provisionAction = provisionAction;
   }
 
+  @JsonIgnore
   public void setConfiguration(Configuration configuration) {
     this.configuration = configuration;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 74308ab..0f3cf17 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
@@ -24,17 +24,32 @@ 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);
+  Configuration getConfiguration();
 
   @JsonProperty("configurations")
   default void setConfigs(Collection<Map<String, Map<String, Map<String, String>>>>
configs) {
-    Map<String, Map<String, String>> allProps = configs.stream().collect(Collectors.toMap(
-      config -> config.keySet().iterator().next(),
-      config -> config.values().iterator().next().get("properties")
-    ));
-    setConfiguration(new Configuration(allProps, new HashMap<>()));
+    if (null != configs) {
+      Map<String, Map<String, String>> allProps = configs.stream().
+        filter( map -> map != null && !map.isEmpty() && map.values().iterator().next().get("properties
") != null).
+        collect(Collectors.toMap(
+          config -> config.keySet().iterator().next(),
+          config -> config.values().iterator().next().get("properties")
+        ));
+      setConfiguration(new Configuration(allProps, new HashMap<>()));
+    }
+  }
+
+  @JsonProperty("configurations")
+  default Collection<Map<String, Map<String, Map<String, String>>>>
getConfigs() {
+    Map<String, Map<String, Map<String, String>>> configAsMap = new HashMap<>();
+    if (null != getConfiguration()) {
+      configAsMap.put("properties", getConfiguration().getProperties());
+    }
+    return Lists.newArrayList(configAsMap);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 01f34da..8834a37 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
@@ -60,6 +60,7 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
   }
 
   @Override
+  @JsonIgnore
   public String getFullyQualifiedName() {
     return blueprintName + ":" + name;
   }
@@ -70,6 +71,7 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
   }
 
   @Override
+  @JsonIgnore
   public Collection<String> getComponentNames() {
     return getComponentNames(components);
   }
@@ -82,6 +84,7 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
   }
 
   @Override
+  @JsonIgnore
   public Collection<String> getComponentNames(ProvisionAction provisionAction) {
     List<ComponentV2> filtered =
       ImmutableList.copyOf(Collections2.filter(components, Predicates.equalTo(provisionAction)));
@@ -99,11 +102,13 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
   }
 
   @Override
+  @JsonIgnore
   public boolean containsMasterComponent() {
     return containsMasterComponent;
   }
 
   @Override
+  @JsonIgnore
   public Collection<ServiceId> getServiceIds() {
     return serviceIds;
   }
@@ -134,6 +139,7 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
   }
 
   @Override
+  @JsonIgnore
   public Configuration getConfiguration() {
     return configuration;
   }
@@ -157,6 +163,7 @@ public class HostGroupV2Impl implements HostGroupV2, Configurable {
     this.serviceIds = components.stream().map(c -> c.getServiceId()).collect(Collectors.toSet());
   }
 
+  @JsonIgnore
   public void setConfiguration(Configuration configuration) {
     this.configuration = configuration;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 317e29f..7c5ee42 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
@@ -21,6 +21,7 @@ package org.apache.ambari.server.topology;
 
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.ambari.server.controller.StackV2;
 
@@ -39,6 +40,7 @@ public class Service implements Configurable {
 
   private String stackId;
 
+  @JsonIgnore
   private Configuration configuration;
 
   private Set<ServiceId> dependencies = ImmutableSet.of();
@@ -61,10 +63,12 @@ public class Service implements Configurable {
     return this.id.getName();
   }
 
+  @JsonIgnore
   public String getServiceGroupId() {
     return this.id.getServiceGroup();
   }
 
+  @JsonIgnore
   public ServiceGroup getServiceGroup() {
     return serviceGroup;
   }
@@ -77,18 +81,28 @@ public class Service implements Configurable {
     return stackId;
   }
 
+  @JsonIgnore
   public StackV2 getStack() {
     return stack;
   }
 
+  @JsonIgnore
   public Set<ServiceId> getDependentServiceIds() {
     return dependencies;
   }
 
+  @JsonProperty("dependencies")
+  public Set<Map<String, String>> getDependenciesForSerialization() {
+    return dependencies.stream().map(
+      serviceId -> ImmutableMap.of("service_name", serviceId.getName(), "service_group",
serviceId.getServiceGroup())).
+      collect(Collectors.toSet());
+  }
+
   public Set<Service> getDependencies() {
     return ImmutableSet.copyOf(dependencyMap.values());
   }
 
+  @JsonIgnore
   public Configuration getConfiguration() {
     return configuration;
   }
@@ -137,6 +151,7 @@ public class Service implements Configurable {
     this.dependencyMap = dependencyMap;
   }
 
+  @JsonIgnore
   public ServiceId getId() {
     return id;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/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 ad2cdbd..99acfb7 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,12 +17,18 @@
  */
 package org.apache.ambari.server.topology.validators;
 
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import java.util.HashMap;
 import java.util.Map;
 
 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.BlueprintV2Factory;
 import org.apache.ambari.server.topology.HostGroupV2;
 import org.apache.ambari.server.topology.HostGroupV2Impl;
 import org.junit.BeforeClass;
@@ -39,11 +45,14 @@ import com.google.common.io.Resources;
 
 public class BlueprintImplV2Test {
 
-  static String BLUEPRINT_V2_JSON;
+  static String BLUEPRINTV2_JSON;
+  static String BLUEPRINTV2_2_JSON;
+
 
   @BeforeClass
   public static void setUpClass() throws Exception {
-    BLUEPRINT_V2_JSON = Resources.toString(Resources.getResource("blueprintv2/blueprintv2.json"),
Charsets.UTF_8);
+    BLUEPRINTV2_JSON = Resources.toString(Resources.getResource("blueprintv2/blueprintv2.json"),
Charsets.UTF_8);
+    BLUEPRINTV2_2_JSON = Resources.toString(Resources.getResource("blueprintv2/blueprintv2_2.json"),
Charsets.UTF_8);
   }
 
   @Test
@@ -55,7 +64,7 @@ public class BlueprintImplV2Test {
     module.setAbstractTypes(resolver);
     mapper.registerModule(module);
     mapper.enable(SerializationFeature.INDENT_OUTPUT);
-    BlueprintImplV2 bp = mapper.readValue(BLUEPRINT_V2_JSON, BlueprintImplV2.class);
+    BlueprintImplV2 bp = mapper.readValue(BLUEPRINTV2_JSON, BlueprintImplV2.class);
     bp.postDeserialization();
     // -- add stack --
     StackV2 hdpCore = new StackV2("HDPCORE", "3.0.0", "3.0.0.0-1", new HashMap<>(),
new HashMap<>(), new HashMap<>(),
@@ -67,7 +76,7 @@ public class BlueprintImplV2Test {
     String bpJson = mapper.writeValueAsString(bp);
     System.out.println(bpJson);
     System.out.println("\n\n====================================================================================\n\n");
-    Map<String, Object> map = mapper.readValue(BLUEPRINT_V2_JSON, HashMap.class);
+    Map<String, Object> map = mapper.readValue(BLUEPRINTV2_JSON, HashMap.class);
     System.out.println(map);
     System.out.println("\n\n====================================================================================\n\n");
     String bpJson2 = mapper.writeValueAsString(map);
@@ -76,4 +85,19 @@ public class BlueprintImplV2Test {
     BlueprintImplV2 bp2 = mapper.readValue(bpJson2, BlueprintImplV2.class);
     System.out.println(bp2);
   }
+
+  @Test
+  public void testSerialization2() throws Exception {
+    StackV2 hdpCore = new StackV2("HDPCORE", "3.0.0", "3.0.0.0-1", new HashMap<>(),
new HashMap<>(), new HashMap<>(),
+      new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
new HashMap<>(), new HashMap<>());    StackV2Factory stackFactory = mock(StackV2Factory.class);
+    when(stackFactory.create(anyString(), anyString())).thenReturn(hdpCore);
+    BlueprintV2Factory bpFactory = BlueprintV2Factory.create(stackFactory);
+    bpFactory.setPrettyPrintJson(true);
+    BlueprintImplV2 bp = (BlueprintImplV2)bpFactory.convertFromJson(BLUEPRINTV2_2_JSON);
+    String bpSerialized = bpFactory.convertToJson(bp);
+    System.out.println(bpSerialized);
+    bp = (BlueprintImplV2)bpFactory.convertFromJson(bpSerialized);
+  }
+
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7960a868/ambari-server/src/test/resources/blueprintv2/blueprintv2_2.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/blueprintv2/blueprintv2_2.json b/ambari-server/src/test/resources/blueprintv2/blueprintv2_2.json
new file mode 100644
index 0000000..494e125
--- /dev/null
+++ b/ambari-server/src/test/resources/blueprintv2/blueprintv2_2.json
@@ -0,0 +1,139 @@
+{
+  "Blueprints": {
+    "blueprint_name": "blueprint-def",
+    "security": {
+      "type": "NONE"
+    }
+  },
+  "cluster_settings": {
+    "deployment_settings": [
+      {"skip_failure":"true"}
+    ],
+    "recovery_settings":[
+      {"recovery_enabled":"true"}
+    ]
+  },
+  "repository_versions": [
+    {
+      "stack_id": "HDP-3.0.0",
+      "repository_version": "3.0.0.0-359"
+    }
+  ],
+  "service_groups": [
+    {
+      "name": "CoreSG",
+      "dependencies": [],
+      "services": [
+        {
+          "type": "ZOOKEEPER",
+          "name": "ZK1",
+          "stack_id": "HDP-3.0.0",
+          "configurations": [
+            {
+              "zoo.cfg" : {
+                "properties" : {
+                  "dataDir" : "/zookeeper1"
+                }
+              }
+            }
+          ]
+        },
+        {
+          "type": "HDFS",
+          "stack_id": "HDP-3.0.0"
+        },
+        {
+          "type": "YARN",
+          "stack_id": "HDP-3.0.0"
+        },
+        {
+          "type": "HBASE",
+          "stack_id": "HDP-3.0.0"
+        }
+      ]
+    }
+  ],
+  "host_groups": [
+    {
+      "cardinality": "1",
+      "name": "host_group_1",
+      "configurations": [],
+      "components": [
+        {
+          "type": "NAMENODE",
+          "service_name": "HDFS",
+          "service_group": "CoreSG",
+          "configurations": [],
+          "provision_action": "INSTALL_AND_START"
+        },
+        {
+          "type": "SECONDARY_NAMENODE",
+          "service_name": "HDFS",
+          "service_group": "CoreSG",
+          "configurations": [],
+          "provision_action": "INSTALL_AND_START"
+        },
+        {
+          "type": "DATANODE",
+          "service_name": "HDFS",
+          "service_group": "CoreSG",
+          "configurations": [],
+          "provision_action": "INSTALL_AND_START"
+        },
+        {
+          "type": "ZOOKEEPER_SERVER",
+          "service_name": "ZK1",
+          "service_group": "CoreSG",
+          "configurations": []
+        },
+        {
+          "type": "RESOURCEMANAGER",
+          "service_name": "YARN",
+          "service_group": "CoreSG",
+          "configurations": []
+        },
+        {
+          "type" : "HDFS_CLIENT",
+          "service_name": "HDFS",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "HISTORYSERVER",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "APP_TIMELINE_SERVER",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "MAPREDUCE2_CLIENT",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "RESOURCEMANAGER",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "NODEMANAGER",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "name" : "YARN_CLIENT",
+          "service_name": "YARN",
+          "service_group": "CoreSG"
+        },
+        {
+          "type": "HBASE_MASTER",
+          "service_name": "HBASE",
+          "service_group": "CoreSG",
+          "configurations": []
+        }
+      ]
+    }
+  ]
+}


Mime
View raw message