r1150 - in trunk/coser-business/src: main/java/fr/ifremer/coser/bean test/java/fr/ifremer/coser/bean
Author: tchemit Date: 2014-03-17 16:22:52 +0100 (Mon, 17 Mar 2014) New Revision: 1150 Url: http://forge.codelutin.com/projects/coser/repository/revisions/1150 Log: add source property in echobase project Added: trunk/coser-business/src/test/java/fr/ifremer/coser/bean/EchoBaseProjectTest.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java =================================================================== --- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java 2014-03-17 09:57:34 UTC (rev 1149) +++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java 2014-03-17 15:22:52 UTC (rev 1150) @@ -26,9 +26,7 @@ import com.google.common.base.Function; import com.google.common.io.Files; import org.apache.commons.io.IOUtils; -import org.apache.commons.io.filefilter.OrFileFilter; -import org.apache.commons.io.filefilter.PrefixFileFilter; -import org.apache.commons.io.filefilter.SuffixFileFilter; +import org.apache.commons.io.filefilter.RegexFileFilter; import org.apache.commons.lang3.StringUtils; import java.io.File; @@ -158,6 +156,10 @@ return new File(basedir, "maps"); } + public File getRawDataDirectory() { + return new File(basedir, "source"); + } + /** * Load a project from his basedir. * @@ -209,7 +211,7 @@ if (zoneName != null) { props.setProperty("project.zoneName", zoneName); } - if (surveyName!= null) { + if (surveyName != null) { props.setProperty("project.surveyName", surveyName); } if (comment != null) { @@ -250,9 +252,7 @@ } public static FilenameFilter newMapSpeciesFilenameFilter(String surveyName) { - OrFileFilter result = new OrFileFilter(); - result.addFileFilter(new PrefixFileFilter(surveyName + "_")); - result.addFileFilter(new SuffixFileFilter(".png")); + RegexFileFilter result = new RegexFileFilter("^" + surveyName + "_[^_]+?\\.png"); return result; } Added: trunk/coser-business/src/test/java/fr/ifremer/coser/bean/EchoBaseProjectTest.java =================================================================== --- trunk/coser-business/src/test/java/fr/ifremer/coser/bean/EchoBaseProjectTest.java (rev 0) +++ trunk/coser-business/src/test/java/fr/ifremer/coser/bean/EchoBaseProjectTest.java 2014-03-17 15:22:52 UTC (rev 1150) @@ -0,0 +1,48 @@ +package fr.ifremer.coser.bean; + +/* + * #%L + * Coser :: Business + * %% + * Copyright (C) 2010 - 2014 Ifremer, Codelutin + * %% + * This program 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 3 of the + * License, or (at your option) any later version. + * + * This program 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ + +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.FilenameFilter; + +/** + * Created on 3/17/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 1.5 + */ +public class EchoBaseProjectTest { + + @Test + public void newMapSpeciesFilenameFilter() { + + FilenameFilter filter = EchoBaseProject.newMapSpeciesFilenameFilter("survey"); + Assert.assertFalse(filter.accept(new File(""), "survey")); + Assert.assertFalse(filter.accept(new File(""), "survey.png")); + Assert.assertFalse(filter.accept(new File(""), "survey_SPECIES_BAD.png")); + Assert.assertTrue(filter.accept(new File(""), "survey_SPECIES.png")); + } +} Property changes on: trunk/coser-business/src/test/java/fr/ifremer/coser/bean/EchoBaseProjectTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
participants (1)
-
tchemit@users.forge.codelutin.com