Search in sources :

Example 6 with Location

use of org.apache.tools.ant.Location in project ant by apache.

the class MSVSSTest method testHistoryCommandLine3.

/**
 *  Tests VSSHistory commandline generation with date calculation.
 */
@Test
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());
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Tstamp(org.apache.tools.ant.taskdefs.Tstamp) Date(java.util.Date) Location(org.apache.tools.ant.Location) Test(org.junit.Test)

Example 7 with Location

use of org.apache.tools.ant.Location in project ant by apache.

the class TStampTest method setUp.

@Before
public void setUp() {
    location = new Location("test.xml");
    project = new Project();
    tstamp = new Tstamp();
    tstamp.setLocation(location);
    tstamp.setProject(project);
}
Also used : Project(org.apache.tools.ant.Project) Location(org.apache.tools.ant.Location) Before(org.junit.Before)

Aggregations

Location (org.apache.tools.ant.Location)7 BuildException (org.apache.tools.ant.BuildException)4 File (java.io.File)3 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 URL (java.net.URL)2 Project (org.apache.tools.ant.Project)2 InputSource (org.xml.sax.InputSource)2 SAXException (org.xml.sax.SAXException)2 SAXParseException (org.xml.sax.SAXParseException)2 MalformedURLException (java.net.MalformedURLException)1 URLConnection (java.net.URLConnection)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Options (org.apache.felix.scrplugin.Options)1 SCRDescriptorException (org.apache.felix.scrplugin.SCRDescriptorException)1 SCRDescriptorFailureException (org.apache.felix.scrplugin.SCRDescriptorFailureException)1 SCRDescriptorGenerator (org.apache.felix.scrplugin.SCRDescriptorGenerator)1