use of org.apache.maven.scm.ScmTag in project maven-plugins by apache.
the class ChangeLogHandler method startElement.
/**
* {@inheritDoc}
*/
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
bufData = "";
if ("file".equals(qName)) {
bufFile = new ChangeFile("");
} else if ("changelog-entry".equals(qName)) {
bufEntry = new ChangeSet();
} else if ("date".equals(qName)) {
currentPattern = attributes.getValue("pattern");
if (currentPattern == null) {
currentPattern = "yyyy-MM-dd";
}
} else if ("time".equals(qName)) {
currentPattern = attributes.getValue("pattern");
if (currentPattern == null) {
currentPattern = "HH:mm:ss";
}
} else if ("changeset".equals(qName)) {
bufEntries = new LinkedList<ChangeSet>();
currentPattern = attributes.getValue("datePattern");
if (currentPattern == null) {
currentPattern = "yyyy-MM-dd";
}
SimpleDateFormat formatter = new SimpleDateFormat(currentPattern);
String start = attributes.getValue("start");
String end = attributes.getValue("end");
Date startDate = null;
Date endDate = null;
if (start != null) {
try {
startDate = formatter.parse(start);
} catch (ParseException e) {
throw new SAXException("Can't parse start date '" + start + "'.", e);
}
}
if (end != null) {
try {
endDate = formatter.parse(end);
} catch (ParseException e) {
throw new SAXException("Can't parse end date '" + end + "'.", e);
}
}
bufSet = new ChangeLogSet(bufEntries, startDate, endDate);
String startVersion = attributes.getValue("startVersion");
if (startVersion != null) {
bufSet.setStartVersion(new ScmTag(startVersion));
}
String endVersion = attributes.getValue("endVersion");
if (endVersion != null) {
bufSet.setEndVersion(new ScmTag(endVersion));
}
}
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class AccuRevCheckOutCommandTest method testReCheckoutExistingWorkspaceDifferentBasis.
@Test
public void testReCheckoutExistingWorkspaceDifferentBasis() throws Exception {
// Set the info result to return a workspace that already exists
info.setWorkSpace("someOldStream_someUser");
info.setBasis("myStream");
info.setTop(basedir.getAbsolutePath());
when(accurev.chws(basedir, "someOldStream_someUser", "mySnapShot")).thenReturn(true);
List<File> emptyPop = Collections.emptyList();
when(accurev.popExternal(basedir, null, null, null)).thenReturn(emptyPop);
List<File> updatedFiles = Collections.singletonList(new File("updated/file"));
when(accurev.update(basedir, null)).thenReturn(updatedFiles);
AccuRevCheckOutCommand command = new AccuRevCheckOutCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot"));
CheckOutScmResult result = command.checkout(repo, new ScmFileSet(basedir), params);
verify(accurev).chws(basedir, "someOldStream_someUser", "mySnapShot");
assertThat(result.isSuccess(), is(true));
assertThat(result.getRelativePathProjectDirectory(), is("/project/dir"));
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class AccuRevExportCommandTest method testExportToVersionPre490.
@Test
public void testExportToVersionPre490() throws Exception {
// info defaults to no workspace...
info.setWorkSpace(null);
when(accurev.info(basedir)).thenReturn(info);
// A version that does not support pop -t
when(accurev.getClientVersion()).thenReturn("4.7.4b");
List<File> poppedFiles = Collections.singletonList(new File("exported/file"));
when(accurev.popExternal(eq(basedir), eq("mySnapShot"), eq("now"), (Collection<File>) argThat(hasItem(new File("/./project/dir"))))).thenReturn(poppedFiles);
AccuRevExportCommand command = new AccuRevExportCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot/676"));
ExportScmResult result = command.export(repo, new ScmFileSet(basedir), params);
assertTrue(result.isSuccess());
assertHasScmFile(result.getExportedFiles(), "exported/file", ScmFileStatus.CHECKED_OUT);
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class AccuRevExportCommandTest method testExportToVersion490.
@Test
public void testExportToVersion490() throws Exception {
// info defaults to no workspace...
info.setWorkSpace(null);
when(accurev.info(basedir)).thenReturn(info);
// A version that does not support pop -t
when(accurev.getClientVersion()).thenReturn("4.9.0");
List<File> poppedFiles = Collections.singletonList(new File("exported/file"));
when(accurev.popExternal(eq(basedir), eq("mySnapShot"), eq("676"), (Collection<File>) argThat(hasItem(new File("/./project/dir"))))).thenReturn(poppedFiles);
AccuRevExportCommand command = new AccuRevExportCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot/676"));
ExportScmResult result = command.export(repo, new ScmFileSet(basedir), params);
assertTrue(result.isSuccess());
assertHasScmFile(result.getExportedFiles(), "exported/file", ScmFileStatus.CHECKED_OUT);
verify(accurev).syncReplica();
}
use of org.apache.maven.scm.ScmTag in project maven-scm by apache.
the class AccuRevExportCommandTest method testExportVersionOutSideWorkspace.
@Test
public void testExportVersionOutSideWorkspace() throws Exception {
// info defaults to no workspace...
info.setWorkSpace(null);
when(accurev.info(basedir)).thenReturn(info);
List<File> poppedFiles = Collections.singletonList(new File("exported/file"));
when(accurev.popExternal(eq(basedir), eq("mySnapShot"), eq((String) null), (Collection<File>) argThat(hasItem(new File("/./project/dir"))))).thenReturn(poppedFiles);
AccuRevExportCommand command = new AccuRevExportCommand(getLogger());
CommandParameters params = new CommandParameters();
params.setScmVersion(CommandParameter.SCM_VERSION, new ScmTag("mySnapShot"));
ExportScmResult result = command.export(repo, new ScmFileSet(basedir), params);
assertTrue(result.isSuccess());
assertHasScmFile(result.getExportedFiles(), "exported/file", ScmFileStatus.CHECKED_OUT);
}
Aggregations