### Question:
AtlasProxyUserConfigCalculation extends AbstractUpgradeServerAction { @Override public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException { String clusterName = getExecutionCommand().getClusterName(); Cluster cluster = getClusters().getCluster(clusterName); String outputMessage = ""; Config atlasApplicationProperties = cluster.getDesiredConfigByType(ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE); if (null == atlasApplicationProperties) { return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", MessageFormat.format("Config type {0} not found, skipping updating property in same.", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE), ""); } Config knoxEnvConfig = cluster.getDesiredConfigByType(KNOX_ENV_CONFIG_TYPE); String atlasProxyUsers = "knox"; if (null != knoxEnvConfig && knoxEnvConfig.getProperties().containsKey(KNOX_USER_CONFIG)) { atlasProxyUsers = knoxEnvConfig.getProperties().get(KNOX_USER_CONFIG); } Map<String, String> currentAtlasApplicationProperties = atlasApplicationProperties.getProperties(); currentAtlasApplicationProperties.put("atlas.proxyusers", atlasProxyUsers); atlasApplicationProperties.setProperties(currentAtlasApplicationProperties); atlasApplicationProperties.save(); agentConfigsHolder.updateData(cluster.getClusterId(), cluster.getHosts().stream().map(Host::getHostId).collect(Collectors.toList())); outputMessage = outputMessage + MessageFormat.format("Successfully updated {0} config type.\n", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE); return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", outputMessage, ""); }  @Override CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext);  }### Answer:
@Test public void testAction() throws Exception { Map<String, String> commandParams = new HashMap<String, String>(); commandParams.put("clusterName", "cl1"); ExecutionCommand executionCommand = new ExecutionCommand(); executionCommand.setCommandParams(commandParams); executionCommand.setClusterName("cl1"); HostRoleCommand hrc = createMock(HostRoleCommand.class); expect(hrc.getRequestId()).andReturn(1L).anyTimes(); expect(hrc.getStageId()).andReturn(2L).anyTimes(); expect(hrc.getExecutionCommandWrapper()).andReturn(new ExecutionCommandWrapper(executionCommand)).anyTimes(); replay(hrc); AtlasProxyUserConfigCalculation action = new AtlasProxyUserConfigCalculation(); m_clusterField.set(action, m_clusters); agentConfigsHolderField.set(action, agentConfigsHolder); action.setExecutionCommand(executionCommand); action.setHostRoleCommand(hrc); CommandReport report = action.execute(null); Assert.assertNotNull(report); Cluster cl = m_clusters.getCluster("cl1"); Config config = cl.getDesiredConfigByType("application-properties"); Map<String, String> map = config.getProperties(); Assert.assertTrue(map.containsKey("atlas.proxyusers")); Assert.assertEquals("knox_cstm", map.get("atlas.proxyusers")); report = action.execute(null); Assert.assertNotNull(report); }