/** Tests VSSHistory commandline generation with from label. */ public void testHistoryCommandLine1() { String[] sTestCmdLine = { MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_LABEL + LONG_LABEL + MSVSS.VALUE_FROMLABEL + SRC_LABEL, MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD, MSVSS.FLAG_OUTPUT + project.getBaseDir().getAbsolutePath() + File.separator + OUTPUT }; // Set up a VSSHistory task MSVSSHISTORY vssHistory = new MSVSSHISTORY(); vssHistory.setProject(project); vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD); vssHistory.setFromLabel(SRC_LABEL); vssHistory.setToLabel(LONG_LABEL + "blahblah"); vssHistory.setVsspath(VSS_PROJECT_PATH); vssHistory.setRecursive(false); vssHistory.setOutput(new File(project.getBaseDir().getAbsolutePath(), OUTPUT)); commandline = vssHistory.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); }
/** Tests VSSHistory commandline generation with date calculation. */ public void testHistoryCommandLine3() { // Set up a Timestamp Tstamp tstamp = new Tstamp(); Location location = new Location("src/etc/testcases/taskdefs/optional/vss/vss.xml"); tstamp.setLocation(location); tstamp.setProject(project); Tstamp.CustomFormat format = tstamp.createFormat(); format.setProperty("today"); format.setPattern("HH:mm:ss z"); format.setTimezone("GMT"); Date date = Calendar.getInstance().getTime(); format.execute(project, date, location); String today = project.getProperty("today"); // Get today's date SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); String expected = sdf.format(date); // Set up a VSSHistory task MSVSSHISTORY vssHistory = new MSVSSHISTORY(); vssHistory.setProject(project); vssHistory.setLogin(VSS_USERNAME); vssHistory.setToDate(today); vssHistory.setVsspath(VSS_PROJECT_PATH); String[] sTestCmdLine = { MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + expected, MSVSS.FLAG_LOGIN + VSS_USERNAME }; commandline = vssHistory.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); }
/** Tests VSSHistory commandline generation with from date. */ public void testHistoryCommandLine2() { String[] sTestCmdLine = { MSVSS.SS_EXE, MSVSS.COMMAND_HISTORY, DS_VSS_PROJECT_PATH, MSVSS.FLAG_AUTORESPONSE_DEF, MSVSS.FLAG_VERSION_DATE + DATE + MSVSS.VALUE_FROMDATE + DATE2, MSVSS.FLAG_RECURSION, MSVSS.FLAG_LOGIN + VSS_USERNAME + "," + VSS_PASSWORD }; // Set up a VSSHistory task MSVSSHISTORY vssHistory = new MSVSSHISTORY(); vssHistory.setProject(project); vssHistory.setLogin(VSS_USERNAME + "," + VSS_PASSWORD); vssHistory.setFromDate(DATE2); vssHistory.setToDate(DATE); vssHistory.setVsspath(VSS_PROJECT_PATH); vssHistory.setRecursive(true); commandline = vssHistory.buildCmdLine(); checkCommandLines(sTestCmdLine, commandline.getCommandline()); }