Skip to content

Commit

Permalink
AMBARI-26222: Fix ClientConfigResourceProviderTest & PreUpgradeCheckR…
Browse files Browse the repository at this point in the history
…esourceProviderTest& ExecutionSchedulerTest& AmbariProxiedUserDetailsServiceTest
  • Loading branch information
JiaLiangC authored and sandeep318kumar committed Nov 18, 2024
1 parent 39b6434 commit 7229bbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ambari-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,12 @@
<version>3.5.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>3.5.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.whenNew;

import java.io.ByteArrayInputStream;
import java.io.File;
Expand Down Expand Up @@ -81,6 +83,7 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockedStatic;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
Expand Down Expand Up @@ -599,6 +602,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
expect(managementController.getHostComponents(EasyMock.anyObject())).andReturn(responses).anyTimes();

PowerMock.mockStaticPartial(StageUtils.class, "getClusterHostInfo");
try (MockedStatic<StageUtils> mockedStageUtils = mockStatic(StageUtils.class)) {


Map<String, Set<String>> clusterHostInfo = new HashMap<>();
Expand All @@ -615,7 +619,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
}
}
clusterHostInfo.put("all_hosts", all_hosts);
expect(StageUtils.getClusterHostInfo(cluster)).andReturn(clusterHostInfo);
mockedStageUtils.when(() -> StageUtils.getClusterHostInfo(cluster)).thenReturn(clusterHostInfo);

expect(stackId.getStackName()).andReturn(stackName).anyTimes();
expect(stackId.getStackVersion()).andReturn(stackVersion).anyTimes();
Expand Down Expand Up @@ -680,6 +684,7 @@ private void testGetResourcesFromCommonServices(Authentication authentication) t
clusterConfig, host, service, serviceComponent, serviceComponentHost, serviceInfo, configHelper,
runtime, process);
PowerMock.verifyAll();
}
}


Expand Down

0 comments on commit 7229bbf

Please sign in to comment.