ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magyari_san...@apache.org
Subject [1/2] ambari git commit: AMBARI-17343. Blueprint attribute provision_action=INSTALL_ONLY loses its value after server restart (magyari_sandor)
Date Wed, 29 Jun 2016 12:18:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 424afb471 -> 32326775f


AMBARI-17343. Blueprint attribute provision_action=INSTALL_ONLY loses its value after server
restart (magyari_sandor)


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

Branch: refs/heads/branch-2.4
Commit: c5919ddc963cd2fa3945617f6c8a7382acdfaf58
Parents: 424afb4
Author: Sandor Magyari <smagyari@hortonworks.com>
Authored: Wed Jun 29 14:02:40 2016 +0200
Committer: Sandor Magyari <smagyari@hortonworks.com>
Committed: Wed Jun 29 14:09:51 2016 +0200

----------------------------------------------------------------------
 .../controller/internal/BaseClusterRequest.java   | 18 ++++++++++++++++++
 .../internal/ProvisionClusterRequest.java         | 17 +----------------
 .../orm/entities/TopologyRequestEntity.java       | 16 ++++++++++++++++
 .../ambari/server/topology/PersistedState.java    |  4 +++-
 .../server/topology/PersistedStateImpl.java       | 13 +++++++++++--
 .../ambari/server/upgrade/UpgradeCatalog240.java  |  9 +++++++++
 .../main/resources/Ambari-DDL-Derby-CREATE.sql    |  1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql    |  1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql   |  1 +
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql |  1 +
 .../Ambari-DDL-Postgres-EMBEDDED-CREATE.sql       |  1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql   |  1 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql     |  1 +
 .../internal/ClusterResourceProviderTest.java     |  2 +-
 .../ambari/server/state/cluster/ClustersTest.java |  5 +++--
 .../server/upgrade/UpgradeCatalog240Test.java     | 13 +++++++++++--
 16 files changed, 80 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/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 a67317a..54389da 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
@@ -42,10 +42,17 @@ import java.util.Set;
  */
 public abstract class BaseClusterRequest implements TopologyRequest {
   /**
+   * Support for controlling whether Install and Start tasks are created on
+   * blueprint deploy by default.
+   */
+  public static final String PROVISION_ACTION_PROPERTY = "provision_action";
+  /**
    * host group info map
    */
   protected final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<String,
HostGroupInfo>();
 
+  protected ProvisionAction provisionAction;
+
   /**
    * cluster id
    */
@@ -185,4 +192,15 @@ public abstract class BaseClusterRequest implements TopologyRequest {
     }
     return hostResourceProvider;
   }
+
+  /**
+   * Get requested @ProvisionClusterRequest.ProvisionAction
+   */
+  public ProvisionAction getProvisionAction() {
+    return provisionAction;
+  }
+
+  public void setProvisionAction(ProvisionAction provisionAction) {
+    this.provisionAction = provisionAction;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/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 3feac55..a35da86 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
@@ -101,12 +101,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
   public static final String CONFIG_RECOMMENDATION_STRATEGY = "config_recommendation_strategy";
 
   /**
-   * Support for controlling whether Install and Start tasks are created on
-   * blueprint deploy by default.
-   */
-  public static final String PROVISION_ACTION_PROPERTY = "provision_action";
-
-  /**
    * The repo version to use
    */
   public static final String REPO_VERSION_PROPERTY = "repository_version";
@@ -134,8 +128,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
    */
   private final ConfigRecommendationStrategy configRecommendationStrategy;
 
-  private final ProvisionAction provisionAction;
-
   private String repoVersion;
 
   private final static Logger LOG = LoggerFactory.getLogger(ProvisionClusterRequest.class);
@@ -180,7 +172,7 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
 
     this.configRecommendationStrategy = parseConfigRecommendationStrategy(properties);
 
-    this.provisionAction = parseProvisionAction(properties);
+    setProvisionAction(parseProvisionAction(properties));
   }
 
   private Map<String, Credential> parseCredentials(Map<String, Object> properties)
throws
@@ -441,13 +433,6 @@ public class ProvisionClusterRequest extends BaseClusterRequest {
   }
 
   /**
-   * Get requested @ProvisionClusterRequest.ProvisionAction
-   */
-  public ProvisionAction getProvisionAction() {
-    return provisionAction;
-  }
-
-  /**
    * @return the repository version, if any
    */
   public String getRepositoryVersion() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
index 923ff9c..9aa58dd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/TopologyRequestEntity.java
@@ -21,6 +21,8 @@ import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
 import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
@@ -34,6 +36,8 @@ import javax.persistence.Table;
 import javax.persistence.TableGenerator;
 import java.util.Collection;
 
+import org.apache.ambari.server.controller.internal.ProvisionAction;
+
 @Entity
 @Table(name = "topology_request")
 @TableGenerator(name = "topology_request_id_generator", table = "ambari_sequences",
@@ -76,6 +80,10 @@ public class TopologyRequestEntity {
   @OneToOne(mappedBy = "topologyRequestEntity", cascade = CascadeType.ALL)
   private TopologyLogicalRequestEntity topologyLogicalRequestEntity;
 
+  @Column(name = "provision_action", length = 255, nullable = true)
+  @Enumerated(EnumType.STRING)
+  private ProvisionAction provisionAction;
+
   public Long getId() {
     return id;
   }
@@ -148,6 +156,14 @@ public class TopologyRequestEntity {
     this.topologyLogicalRequestEntity = topologyLogicalRequestEntity;
   }
 
+  public ProvisionAction getProvisionAction() {
+    return provisionAction;
+  }
+
+  public void setProvisionAction(ProvisionAction provisionAction) {
+    this.provisionAction = provisionAction;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) return true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
index 41fa032..8003268 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedState.java
@@ -21,6 +21,8 @@ package org.apache.ambari.server.topology;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ambari.server.controller.internal.BaseClusterRequest;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.state.Host;
 
 /**
@@ -35,7 +37,7 @@ public interface PersistedState {
    * @return a persisted topology request which is a wrapper around a TopologyRequest which
    * adds an id that can be used to refer to the persisted entity
    */
-  PersistedTopologyRequest persistTopologyRequest(TopologyRequest topologyRequest);
+  PersistedTopologyRequest persistTopologyRequest(BaseClusterRequest topologyRequest);
 
   /**
    * Persist a logical request.

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
index ca81418..bd9a9f7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/PersistedStateImpl.java
@@ -23,6 +23,8 @@ import com.google.inject.Inject;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
+import org.apache.ambari.server.controller.internal.BaseClusterRequest;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.TopologyHostGroupDAO;
@@ -97,7 +99,7 @@ public class PersistedStateImpl implements PersistedState {
 
 
   @Override
-  public  PersistedTopologyRequest persistTopologyRequest(TopologyRequest request) {
+  public  PersistedTopologyRequest persistTopologyRequest(BaseClusterRequest request) {
     TopologyRequestEntity requestEntity = toEntity(request);
     topologyRequestDAO.create(requestEntity);
     return new PersistedTopologyRequest(requestEntity.getId(), request);
@@ -178,6 +180,9 @@ public class PersistedStateImpl implements PersistedState {
       if (clusterTopology == null) {
         try {
           clusterTopology = new ClusterTopologyImpl(ambariContext, replayedRequest);
+          if (entity.getProvisionAction() != null) {
+            clusterTopology.setProvisionAction(entity.getProvisionAction());
+          }
           topologyRequests.put(replayedRequest.getClusterId(), clusterTopology);
           allRequests.put(clusterTopology, new ArrayList<LogicalRequest>());
         } catch (InvalidTopologyException e) {
@@ -211,7 +216,7 @@ public class PersistedStateImpl implements PersistedState {
     return allRequests;
   }
 
-  private TopologyRequestEntity toEntity(TopologyRequest request) {
+  private TopologyRequestEntity toEntity(BaseClusterRequest request) {
     TopologyRequestEntity entity = new TopologyRequestEntity();
 
     //todo: this isn't set for a scaling operation because we had intended to allow multiple
@@ -227,6 +232,10 @@ public class PersistedStateImpl implements PersistedState {
     entity.setClusterProperties(propertiesAsString(request.getConfiguration().getProperties()));
     entity.setDescription(request.getDescription());
 
+    if (request.getProvisionAction() != null) {
+      entity.setProvisionAction(request.getProvisionAction());
+    }
+
     // host groups
     Collection<TopologyHostGroupEntity> hostGroupEntities = new ArrayList<TopologyHostGroupEntity>();
     for (HostGroupInfo groupInfo : request.getHostGroupInfo().values())  {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index ab35a48..9be1117 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -166,6 +166,8 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
   public static final String AUTHENTICATED_USER_ID_COLUMN = "authenticated_user_id";
   protected static final String CLUSTER_VERSION_TABLE = "cluster_version";
   protected static final String HOST_VERSION_TABLE = "host_version";
+  protected static final String TOPOLOGY_REQUEST_TABLE = "topology_request";
+  protected static final String PROVISION_ACTION_COL = "provision_action";
   protected static final String PHOENIX_QUERY_SERVER_PRINCIPAL_KEY = "phoenix.queryserver.kerberos.principal";
   protected static final String PHOENIX_QUERY_SERVER_KEYTAB_KEY = "phoenix.queryserver.keytab.file";
   protected static final String DEFAULT_CONFIG_VERSION = "version1";
@@ -308,6 +310,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
     createRemoteClusterTable();
     updateViewInstanceTable();
     updateRequestScheduleEntityTable();
+    updateTopologyRequestTable();
   }
 
   private void createRemoteClusterTable() throws SQLException {
@@ -1335,6 +1338,12 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
         new DBColumnInfo(PRINCIPAL_ID_COL, Long.class, null, null, true));
   }
 
+  protected void updateTopologyRequestTable() throws SQLException {
+    // Add the sort_order column to the adminpermission table
+    dbAccessor.addColumn(TOPOLOGY_REQUEST_TABLE,
+      new DBColumnInfo(PROVISION_ACTION_COL, String.class, null, 255, true));
+  }
+
   /**
    * Updates the {@value #ALERT_DEFINITION_TABLE} in the following ways:
    * <ul>

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index aa8a39e..0a456eb 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -729,6 +729,7 @@ CREATE TABLE topology_request (
   cluster_properties VARCHAR(3000),
   cluster_attributes VARCHAR(3000),
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 3be1299..3e2e144 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -736,6 +736,7 @@ CREATE TABLE topology_request (
   cluster_properties LONGTEXT,
   cluster_attributes LONGTEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 6bbb282..c0f2368 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -726,6 +726,7 @@ CREATE TABLE topology_request (
   cluster_properties CLOB,
   cluster_attributes CLOB,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index b13c121..c4f9dfc 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -729,6 +729,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
index fd14e80..d42445d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
@@ -851,6 +851,7 @@ CREATE TABLE ambari.topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES ambari.clusters(cluster_id)
 );

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index 0574c2b..cb6e8b6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -725,6 +725,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 02becf2..fda4af6 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -746,6 +746,7 @@ CREATE TABLE topology_request (
   cluster_properties TEXT,
   cluster_attributes TEXT,
   description VARCHAR(1024),
+  provision_action VARCHAR(255),
   CONSTRAINT PK_topology_request PRIMARY KEY CLUSTERED (id),
   CONSTRAINT FK_topology_request_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters(cluster_id));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
index 7f2ea7c..c7261ea 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ClusterResourceProviderTest.java
@@ -144,7 +144,7 @@ public class ClusterResourceProviderTest {
   public void testCreateResource_blueprint_With_ProvisionAction() throws Exception {
     Set<Map<String, Object>> requestProperties = createBlueprintRequestProperties(CLUSTER_NAME,
BLUEPRINT_NAME);
     Map<String, Object> properties = requestProperties.iterator().next();
-    properties.put(ProvisionClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY");
+    properties.put(BaseClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY");
     Map<String, String> requestInfoProperties = new HashMap<String, String>();
     requestInfoProperties.put(Request.REQUEST_INFO_BODY_PROPERTY, "{}");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
index 43645b4..bb3db03 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java
@@ -42,6 +42,7 @@ import org.apache.ambari.server.DuplicateResourceException;
 import org.apache.ambari.server.HostNotFoundException;
 import org.apache.ambari.server.agent.AgentEnv;
 import org.apache.ambari.server.agent.HostInfo;
+import org.apache.ambari.server.controller.internal.ProvisionClusterRequest;
 import org.apache.ambari.server.events.HostRegisteredEvent;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
@@ -499,7 +500,7 @@ public class ClustersTest {
 
     Map<String, HostGroupInfo> hostGroups = Maps.newHashMap();
 
-    TopologyRequest topologyRequest = createNiceMock(TopologyRequest.class);
+    ProvisionClusterRequest topologyRequest = createNiceMock(ProvisionClusterRequest.class);
     expect(topologyRequest.getType()).andReturn(TopologyRequest.Type.PROVISION).anyTimes();
     expect(topologyRequest.getBlueprint()).andReturn(bp).anyTimes();
     expect(topologyRequest.getClusterId()).andReturn(cluster.getClusterId()).anyTimes();
@@ -653,7 +654,7 @@ public class ClustersTest {
     hostGroupInfo.addHost(hostName + "3");
     hostGroups.put(groupName, hostGroupInfo);
 
-    TopologyRequest topologyRequest = createNiceMock(TopologyRequest.class);
+    ProvisionClusterRequest topologyRequest = createNiceMock(ProvisionClusterRequest.class);
     expect(topologyRequest.getType()).andReturn(TopologyRequest.Type.PROVISION).anyTimes();
     expect(topologyRequest.getBlueprint()).andReturn(bp).anyTimes();
     expect(topologyRequest.getClusterId()).andReturn(cluster.getClusterId()).anyTimes();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c5919ddc/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
index b753662..8ddbaca 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java
@@ -320,13 +320,16 @@ public class UpgradeCatalog240Test {
     expect(dbAccessor.getConnection()).andReturn(connection);
     expect(connection.createStatement()).andReturn(statement);
 
-    dbAccessor.dropColumn(UpgradeCatalog240.VIEWINSTANCE_TABLE,UpgradeCatalog240.CLUSTER_HANDLE_COLUMN);
+    dbAccessor.dropColumn(UpgradeCatalog240.VIEWINSTANCE_TABLE, UpgradeCatalog240.CLUSTER_HANDLE_COLUMN);
 
     Capture<DBAccessor.DBColumnInfo> capturedClusterHandleColumn = EasyMock.newCapture();
-    dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString() , capture(capturedClusterHandleColumn));
+    dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString(), capture(capturedClusterHandleColumn));
     Capture<DBAccessor.DBColumnInfo> requestScheduleUserIdInfo = newCapture();
     dbAccessor.addColumn(eq(UpgradeCatalog240.REQUESTSCHEDULE_TABLE), capture(requestScheduleUserIdInfo));
 
+    Capture<DBAccessor.DBColumnInfo> provisionActionColumnInfo = newCapture();
+    dbAccessor.addColumn(eq(UpgradeCatalog240.TOPOLOGY_REQUEST_TABLE), capture(provisionActionColumnInfo));
+
     replay(dbAccessor, configuration, connection, statement, resultSet);
 
     Module module = new Module() {
@@ -537,6 +540,12 @@ public class UpgradeCatalog240Test {
     Assert.assertEquals(Integer.class, requestScheduleUserIdInfoValue.getType());
     Assert.assertEquals(null, requestScheduleUserIdInfoValue.getDefaultValue());
 
+    DBAccessor.DBColumnInfo provisionActionColumnInfoValue = provisionActionColumnInfo.getValue();
+    Assert.assertNotNull(provisionActionColumnInfoValue);
+    Assert.assertEquals(UpgradeCatalog240.PROVISION_ACTION_COL, provisionActionColumnInfoValue.getName());
+    Assert.assertEquals(String.class, provisionActionColumnInfoValue.getType());
+    Assert.assertEquals(true, provisionActionColumnInfoValue.isNullable());
+
     verify(dbAccessor);
   }
 


Mime
View raw message