Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0F275200B26 for ; Mon, 27 Jun 2016 11:56:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0D9F8160A5B; Mon, 27 Jun 2016 09:56:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D5257160A3C for ; Mon, 27 Jun 2016 11:56:36 +0200 (CEST) Received: (qmail 50453 invoked by uid 500); 27 Jun 2016 09:56:36 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 50443 invoked by uid 99); 27 Jun 2016 09:56:36 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2016 09:56:36 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B29EBDFDC3; Mon, 27 Jun 2016 09:56:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: magyari_sandor@apache.org To: commits@ambari.apache.org Message-Id: <7acf8cbbed664623992f359b0ec861f6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-17343. Blueprint attribute provision_action=INSTALL_ONLY loses its value after server restart (magyari_sandor) Date: Mon, 27 Jun 2016 09:56:35 +0000 (UTC) archived-at: Mon, 27 Jun 2016 09:56:38 -0000 Repository: ambari Updated Branches: refs/heads/trunk 0288d9094 -> ea72aee93 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/ea72aee9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea72aee9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea72aee9 Branch: refs/heads/trunk Commit: ea72aee930731ac7255641de0446fb7bd909c6f6 Parents: 0288d90 Author: Sandor Magyari Authored: Wed Jun 22 17:30:23 2016 +0200 Committer: Sandor Magyari Committed: Mon Jun 27 11:51:19 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-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 +++++++++++-- 13 files changed, 77 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ea72aee9/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 hostGroupInfoMap = new HashMap(); + 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/ea72aee9/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 parseCredentials(Map 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/ea72aee9/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..8e3fb25 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", 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/ea72aee9/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/ea72aee9/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()); } 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 hostGroupEntities = new ArrayList(); for (HostGroupInfo groupInfo : request.getHostGroupInfo().values()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ea72aee9/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 e029aea..01a7c0e 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 { @@ -1343,6 +1346,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, 100, true)); + } + /** * Updates the {@value #ALERT_DEFINITION_TABLE} in the following ways: *
    http://git-wip-us.apache.org/repos/asf/ambari/blob/ea72aee9/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..78cf5a4 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(100), 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/ea72aee9/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..a2074e7 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(100), 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/ea72aee9/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..e10955b 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(100), 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/ea72aee9/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..f7b6630 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(100), 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/ea72aee9/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> requestProperties = createBlueprintRequestProperties(CLUSTER_NAME, BLUEPRINT_NAME); Map properties = requestProperties.iterator().next(); - properties.put(ProvisionClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY"); + properties.put(BaseClusterRequest.PROVISION_ACTION_PROPERTY, "INSTALL_ONLY"); Map requestInfoProperties = new HashMap(); requestInfoProperties.put(Request.REQUEST_INFO_BODY_PROPERTY, "{}"); http://git-wip-us.apache.org/repos/asf/ambari/blob/ea72aee9/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 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/ea72aee9/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 0e4b4eb..bf681f2 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 capturedClusterHandleColumn = EasyMock.newCapture(); - dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString() , capture(capturedClusterHandleColumn)); + dbAccessor.renameColumn(eq(UpgradeCatalog240.VIEWINSTANCE_TABLE), anyString(), capture(capturedClusterHandleColumn)); Capture requestScheduleUserIdInfo = newCapture(); dbAccessor.addColumn(eq(UpgradeCatalog240.REQUESTSCHEDULE_TABLE), capture(requestScheduleUserIdInfo)); + Capture 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); }