@Override public PossibleValues getValues(Map<String, Object> map) throws IOException, ParserConfigurationException, SAXException, ConfigurationException, PhrescoException { String rootModulePath = ""; String subModuleName = ""; PossibleValues possibleValues = new PossibleValues(); ApplicationInfo applicationInfo = (ApplicationInfo) map.get(KEY_APP_INFO); String rootModule = (String) map.get(KEY_ROOT_MODULE); if (StringUtils.isNotEmpty(rootModule)) { rootModulePath = Utility.getProjectHome() + rootModule; subModuleName = applicationInfo.getAppDirName(); } else { rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName(); } String buildInfoPath = getBuildInfoPath(rootModulePath, subModuleName).toString(); List<BuildInfo> buildInfos = Utility.getBuildInfos(new File(buildInfoPath)); if (buildInfos != null) { for (BuildInfo buildInfo : buildInfos) { Value value = new Value(); value.setValue(Integer.toString(buildInfo.getBuildNo())); String dependency = getDependency(buildInfo.getBuildNo(), rootModulePath, subModuleName); if (!StringUtils.isEmpty(dependency)) { value.setDependency(dependency); } possibleValues.getValue().add(value); } } return possibleValues; }
@Test public void getValuesTest() throws PhrescoException, IOException, ParserConfigurationException, SAXException, ConfigurationException { Map<String, Object> paramsMap = new HashMap<String, Object>(); paramsMap.put("applicationInfo", getApplicationInfo()); paramsMap.put("serviceManager", serviceManager); PossibleValues values = techVersion.getValues(paramsMap); List<Value> value = values.getValue(); Assert.assertEquals(5, value.size()); }