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 0442C200CB5 for ; Wed, 28 Jun 2017 01:38:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02CB1160BF9; Tue, 27 Jun 2017 23:38:22 +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 50947160BDC for ; Wed, 28 Jun 2017 01:38:21 +0200 (CEST) Received: (qmail 93850 invoked by uid 500); 27 Jun 2017 23:38:20 -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 93840 invoked by uid 99); 27 Jun 2017 23:38:20 -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; Tue, 27 Jun 2017 23:38:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5E022E96B8; Tue, 27 Jun 2017 23:38:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jonathanhurley@apache.org To: commits@ambari.apache.org Date: Tue, 27 Jun 2017 23:38:18 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] ambari git commit: AMBARI-21358 - Upgrades Must Track To/From Repository Versions Instead of Strings (jonathanhurley) archived-at: Tue, 27 Jun 2017 23:38:22 -0000 Repository: ambari Updated Branches: refs/heads/branch-feature-AMBARI-21348 7b8f0eab5 -> 7ad307c2c http://git-wip-us.apache.org/repos/asf/ambari/blob/7ad307c2/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java index 0eef638..5cef95d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java @@ -19,7 +19,6 @@ package org.apache.ambari.server.state.stack.upgrade; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,7 +51,7 @@ public class StageWrapperBuilderTest extends EasyMockSupport { @Test public void testBuildOrder() throws Exception { Cluster cluster = createNiceMock(Cluster.class); - EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(HDP_21).atLeastOnce(); + EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(HDP_21).anyTimes(); EasyMock.expect(cluster.getDesiredStackVersion()).andReturn(HDP_21).anyTimes(); RepositoryVersionEntity repoVersionEntity = createNiceMock(RepositoryVersionEntity.class); @@ -62,10 +61,16 @@ public class StageWrapperBuilderTest extends EasyMockSupport { EasyMock.expect(repoVersionDAO.findByStackNameAndVersion(EasyMock.anyString(), EasyMock.anyString())).andReturn(repoVersionEntity).anyTimes(); - replayAll(); + UpgradeContext upgradeContext = EasyMock.createNiceMock(UpgradeContext.class); + EasyMock.expect(upgradeContext.getCluster()).andReturn(cluster).anyTimes(); + EasyMock.expect(upgradeContext.getType()).andReturn(UpgradeType.ROLLING).anyTimes(); + EasyMock.expect(upgradeContext.getDirection()).andReturn(Direction.UPGRADE).anyTimes(); + EasyMock.expect(upgradeContext.getSourceRepositoryVersion()).andReturn(repoVersionEntity).anyTimes(); + EasyMock.expect(upgradeContext.getTargetRepositoryVersion()).andReturn(repoVersionEntity).anyTimes(); + EasyMock.expect(upgradeContext.isComponentFailureAutoSkipped()).andReturn(false).anyTimes(); + EasyMock.expect(upgradeContext.isServiceCheckFailureAutoSkipped()).andReturn(false).anyTimes(); - UpgradeContext upgradeContext = new UpgradeContext(cluster, UpgradeType.ROLLING, - Direction.UPGRADE, HDP_21.toString(), new HashMap(), repoVersionDAO); + replayAll(); MockStageWrapperBuilder builder = new MockStageWrapperBuilder(null); List stageWrappers = builder.build(upgradeContext); @@ -90,7 +95,7 @@ public class StageWrapperBuilderTest extends EasyMockSupport { @Test public void testAutoSkipCheckInserted() throws Exception { Cluster cluster = createNiceMock(Cluster.class); - EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(HDP_21).atLeastOnce(); + EasyMock.expect(cluster.getCurrentStackVersion()).andReturn(HDP_21).anyTimes(); EasyMock.expect(cluster.getDesiredStackVersion()).andReturn(HDP_21).anyTimes(); RepositoryVersionEntity repoVersionEntity = createNiceMock(RepositoryVersionEntity.class); @@ -100,13 +105,16 @@ public class StageWrapperBuilderTest extends EasyMockSupport { EasyMock.expect(repoVersionDAO.findByStackNameAndVersion(EasyMock.anyString(), EasyMock.anyString())).andReturn(repoVersionEntity).anyTimes(); - replayAll(); + UpgradeContext upgradeContext = createNiceMock(UpgradeContext.class); + EasyMock.expect(upgradeContext.getCluster()).andReturn(cluster).anyTimes(); + EasyMock.expect(upgradeContext.getType()).andReturn(UpgradeType.ROLLING).anyTimes(); + EasyMock.expect(upgradeContext.getDirection()).andReturn(Direction.UPGRADE).anyTimes(); + EasyMock.expect(upgradeContext.getSourceRepositoryVersion()).andReturn(repoVersionEntity).anyTimes(); + EasyMock.expect(upgradeContext.getTargetRepositoryVersion()).andReturn(repoVersionEntity).anyTimes(); + EasyMock.expect(upgradeContext.isComponentFailureAutoSkipped()).andReturn(true).anyTimes(); + EasyMock.expect(upgradeContext.isServiceCheckFailureAutoSkipped()).andReturn(true).anyTimes(); - UpgradeContext upgradeContext = new UpgradeContext(cluster, UpgradeType.ROLLING, - Direction.UPGRADE, HDP_21.toString(), new HashMap(), repoVersionDAO); - - upgradeContext.setAutoSkipComponentFailures(true); - upgradeContext.setAutoSkipServiceCheckFailures(true); + replayAll(); Grouping grouping = new Grouping(); grouping.skippable = true;