### Question:
OozieConfigCalculation extends AbstractUpgradeServerAction { @Override public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException { String clusterName = getExecutionCommand().getClusterName(); Cluster cluster = getClusters().getCluster(clusterName); StringBuilder stdOutBuilder = new StringBuilder(); try { changeOozieEnv(cluster, stdOutBuilder); } catch (Exception e) { return createCommandReport(0, HostRoleStatus.FAILED,"{}", String.format("Source type %s not found", OOZIE_ENV_TARGET_CONFIG_TYPE), ""); } UpgradeContext upgradeContext = getUpgradeContext(cluster); StackId targetStackId = upgradeContext.getTargetStack(); if (!serviceComponentSupport.isServiceSupported(FALCON_SERVICE_NAME, targetStackId.getStackName(), targetStackId.getStackVersion())) { try { removeFalconPropertiesFromOozieSize(cluster, stdOutBuilder); } catch (AmbariException e) { return createCommandReport(0, HostRoleStatus.FAILED, "{}", String.format("Source type %s not found", OOZIE_SITE_TARGET_CONFIG_TYPE), ""); } } if (oozie_env_updated || oozie_site_updated) { agentConfigsHolder.updateData(cluster.getClusterId(), cluster.getHosts().stream().map(Host::getHostId).collect(Collectors.toList())); } return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", stdOutBuilder.toString(), ""); }  @Override CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext); static String processPropertyValue(String oldContent);  }### Answer:
@Test public void testAction() throws Exception { Map<String, String> commandParams = new HashMap<>(); commandParams.put("clusterName", "c1"); ExecutionCommand executionCommand = new ExecutionCommand(); executionCommand.setCommandParams(commandParams); executionCommand.setClusterName("c1"); HostRoleCommand hrc = EasyMock.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); m_clusterField.set(m_action, m_clusters); m_componentSupportField.set(m_action, componentSupport); agentConfigsHolderField.set(m_action, agentConfigsHolder); m_action.setExecutionCommand(executionCommand); m_action.setHostRoleCommand(hrc); CommandReport report = m_action.execute(null); assertNotNull(report); Cluster c = m_clusters.getCluster("c1"); Config oozieSiteConfig = c.getDesiredConfigByType("oozie-site"); Map<String, String> map = oozieSiteConfig.getProperties(); assertTrue(map.size()==1); assertTrue(map.containsKey("oozie.systemmode")); assertTrue(map.get("oozie.systemmode").equals("NORMAL")); assertTrue(report.getStdOut().contains("Removed following properties")); Config oozieEnvConfig = c.getDesiredConfigByType("oozie-env"); map = oozieEnvConfig.getProperties(); Assert.assertTrue(map.containsKey("content")); String content = map.get("content"); assertTrue(content.endsWith("export HADOOP_OPTS=\"-Dhdp.version=$HDP_VERSION $HADOOP_OPTS\" ")); }