Author: adamw Date: 2005-11-16 16:58:49 -0500 (Wed, 16 Nov 2005) New Revision: 1579 Added: trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/LastModificationTest.java Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java Log: Last mod fix and test Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-11-16 21:32:28 UTC (rev 1578) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-11-16 21:58:49 UTC (rev 1579) @@ -313,18 +313,22 @@ public long getLastModification(String path) throws SvnOperationFailed { + File file = new File(getFileSystemPath(path)); + try { - File file = new File(getFileSystemPath(path)); - if (ourClientManager.getStatusClient().doStatus( file, false).getContentsStatus() != SVNStatusType.STATUS_NORMAL) return file.lastModified(); - else - return ourClientManager.getWCClient().doInfo(file, + } catch (SVNException e) { + return file.lastModified(); + } + + try { + return ourClientManager.getWCClient().doInfo(file, SVNRevision.WORKING).getCommittedDate().getTime(); } catch (SVNException e) { - throw new SvnOperationFailed(e); + return file.lastModified(); } } } Added: trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/LastModificationTest.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/LastModificationTest.java 2005-11-16 21:32:28 UTC (rev 1578) +++ trunk/forge/portal-extensions/shotoku/shotoku-test/src/java/org/jboss/shotoku/test/LastModificationTest.java 2005-11-16 21:58:49 UTC (rev 1579) @@ -0,0 +1,56 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.shotoku.test; + +import org.jboss.shotoku.Directory; +import org.jboss.shotoku.Node; + +/** + * + * @author adamw + */ +public class LastModificationTest extends ShotokuTest { + private final static String TEST_DIR = "last-mod-test"; + @Override + protected void setUp() throws Exception { + Directory d = cm.getRootDirectory().newDirectory(TEST_DIR); + d.save(TEST_DIR); + } + + public void testLastModInNewDir() throws Exception { + // Creating a new directory. + Directory newDir = cm.getRootDirectory().getDirectory(TEST_DIR).newDirectory("test"); + newDir.save(""); + + // Creating a new node. + Node newNode = cm.getRootDirectory().getDirectory(TEST_DIR).getDirectory("test").newNode("testn"); + newNode.save(""); + + // Invoking getting of last modification. + cm.getRootDirectory().getDirectory(TEST_DIR).getDirectory("test").getNode("testn").getLastModification(); + } + + @Override + protected void tearDown() throws Exception { + cm.getDirectory(TEST_DIR).delete(); + } +} |