r104 - in trunk: diswork-daemon/src/main/java/org/nuiton/diswork/daemon diswork-daemon/src/test/java/org/nuiton/diswork/daemon diswork-fs/src/main/java/org/nuiton/diswork/fs diswork-fs/src/main/java/org/nuiton/diswork/fs/storage diswork-fs/src/test/java/org/nuiton/diswork/fs diswork-fs/src/test/java/org/nuiton/diswork/fs/storage src/license
Author: bleny Date: 2010-07-21 11:05:57 +0200 (Wed, 21 Jul 2010) New Revision: 104 Url: http://nuiton.org/repositories/revision/diswork/104 Log: m?\195?\160j en-tete des fichiers (tests), doc Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadConfigurationException.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadJobException.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkConfig.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkSystemException.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/HttpFrontEnd.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/LocalFileException.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/WorkersManager.java trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/package-info.java trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkConfigTest.java trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonConcurrencyTest.java trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonMultipleNodesTest.java trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonTest.java trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/JobDescriptionTest.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemInMemoryTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemKademliaTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemPastryTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/AbstractDisworkMapTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/EntryUtilTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/InMemoryDisworkMapTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/PastryDisworkMapTest.java trunk/src/license/project.xml Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadConfigurationException.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadConfigurationException.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadConfigurationException.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; /** Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadJobException.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadJobException.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/BadJobException.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; /** Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkConfig.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkConfig.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkConfig.java 2010-07-21 09:05:57 UTC (rev 104) @@ -294,7 +294,7 @@ // FIXME 20100607 bleny its not config data, it should be moved to a persistent file protected void save() { - // saveForUser(null); + saveForUser(); } protected String getOwnerId() { Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java 2010-07-21 09:05:57 UTC (rev 104) @@ -24,6 +24,20 @@ */ package org.nuiton.diswork.daemon; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.OperatingSystemMXBean; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; @@ -34,12 +48,6 @@ import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.nuiton.util.FileUtil; -import java.io.*; -import java.lang.management.ManagementFactory; -import java.lang.management.OperatingSystemMXBean; -import java.text.NumberFormat; -import java.util.*; - /** * The diswork daemon is the gateway to the global diswork system. Instantiate * this class creates a new node on the system. The new node can be used @@ -420,7 +428,10 @@ fileSystem.createDirectory(applicationDirectory); } - if (!fileSystem.exists(path)) { + if (fileSystem.exists(path)) { + log.info("application " + applicationName + " is already available" + + " in version " + applicationVersion + " submit ignored"); + } else { fileSystem.write(path, applicationData); } } catch (DisworkFileSystemException e) { @@ -630,6 +641,8 @@ } catch (DisworkFileSystemException e) { log.error("file system error ", e); throw new DisworkException("file system error ", e); + } catch (FileNotFoundException e) { + log.warn("expected output file was not found : " + fileName, e); } } return results; Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkSystemException.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkSystemException.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkSystemException.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; /** Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/HttpFrontEnd.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/HttpFrontEnd.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/HttpFrontEnd.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; import java.io.IOException; Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/LocalFileException.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/LocalFileException.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/LocalFileException.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; /** Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/WorkersManager.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/WorkersManager.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/WorkersManager.java 2010-07-21 09:05:57 UTC (rev 104) @@ -24,21 +24,37 @@ */ package org.nuiton.diswork.daemon; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.diswork.daemon.ActivityStrategy.ActivityStrategies; +import org.nuiton.diswork.daemon.WorkersManager.Worker; import org.nuiton.diswork.fs.DisworkFileSystem; import org.nuiton.diswork.fs.DisworkFileSystemException; import org.nuiton.util.FileUtil; import org.nuiton.util.StringUtil; import org.nuiton.util.ZipUtil; -import java.io.*; -import java.net.URL; -import java.util.*; - /** * The workers-manager aims to run and manage the different workers. A worker * is a thread that try to find a jobs and execute them. @@ -271,7 +287,7 @@ } /** - * this method add a line to a job-specific log + * add a line to a job-specific log * @param jobPath the path to the job concerned * @param messages the line(s) to add to the log * @throws DisworkSystemException if an error occurred while writing @@ -298,8 +314,14 @@ throw new DisworkSystemException("unable to read log file", e); } } - - protected void downloadApplication() throws DisworkSystemException, LocalFileException { + + /** + * Check if the current job need an application. If needed, + * download the application and unzip it in current job temp + * dir + * @throws DisworkException + */ + protected void downloadApplication() throws DisworkException { // download application if (currentJob.getApplicationName() != null) { log.info("dependency needed for " + currentJob + " (" + @@ -321,12 +343,24 @@ log.info("no dependency specified for " + currentJob); } } - - protected void stageInputFiles() throws DisworkSystemException, LocalFileException { + + /** + * For all the input files of the current job, download them + * to the current job temp dir. + * @throws DisworkException + */ + protected void stageInputFiles() throws DisworkException { // staging input files for (String fileName : currentJob.getInput()) { log.info("staging " + fileName); + + // source is a stream containing the data of the + // input file InputStream source = null; + + // set source according to job description, source + // may be obtained via an URL or via the Diswork + // File system if (currentJob.getInputUrls().containsKey(fileName)) { // download this file from URL URL url = currentJob.getInputUrls().get(fileName); @@ -344,9 +378,14 @@ } catch (DisworkFileSystemException e) { log.error("unable to read input file from diswork", e); throw new DisworkSystemException("unable to read input file from diswork", e); + } catch (FileNotFoundException e) { + log.warn("input file " + fileName + " is not provided", e); + throw new BadJobException("input file " + fileName + " is not provided", e); } } + // now, source is set, read those data and write it + // to a local copy in the current job temp dir try { File localCopy = new File(currentJobDir, fileName); localCopy.createNewFile(); @@ -357,7 +396,15 @@ } } } - + + /** + * Compute the command-line for the current job, prepare the process + * by pluggin files in standard input/output. Start a thread to + * constantly read standard output. Finally, start the process and + * set {@link #currentProcess}. + * + * @throws DisworkException + */ protected void prepareAndRunJob() throws DisworkException { log.info("preparing the job"); // prepare the job and run it @@ -457,23 +504,38 @@ } /** - * Download all the files needed for a job in a temp directory, run - * the job, wait for it to end, write all the results. Mark the job - * as running at the beginning and move it to DONE or FAILED at - * the end, depending of the results + * Read the JSDL file of the curernt job. create a temp directory for + * the current job and set {@link #currentJobDir}. Prepare the job + * (download application, stage input files and prepare the process). + * + * Then, if current worker is still allowed to work (if WorkersManager + * didn't ask to stop working recently), run the process until it returns + * + * Once the process is finished, check why and how the process returned + * (interrupted, successful run or failure) and act accordingly + * (update log and stage output files). + * + * Finally, remove temp directory created and the start of the method, + * unset all current variables, and update statistics about worked time. + * * @throws DisworkException */ protected void runJob() throws DisworkException { try { + // We want to have a stat about how many time is passed at + // working, start counting currentProcessStartDate = System.currentTimeMillis(); log.info("running job at " + currentJobPath); + // read the JSDL for the current job, create the corresponding + // JobDescription and set currentJob try { String jsdlPath = currentJobPath + "/" + DisworkDaemon.JSDL_PATH; String jsdl = IOUtils.toString(fileSystem.read(jsdlPath)); log.info("read jsdl " + jsdl); currentJob = JobDescription.parseJSDL(jsdl); + log.info("will run job " + currentJob); } catch (IOException e) { log.error("unable to read or parse JSDL", e); throw new DisworkSystemException("unable to read or parse JSDL", e); @@ -482,9 +544,7 @@ throw new DisworkSystemException("unable to read JSDL", e); } - log.info("will run job " + currentJob); - - // create temp dir + // create a unique temp directory for this job only try { currentJobDir = FileUtil.createTempDirectory("job", "", new File(config.getTempDirectory())); @@ -493,66 +553,69 @@ log.error("unable to create temp directory for job", e); throw new LocalFileException("unable to create temp directory for job", e); } - + + // put application data in the temp dir downloadApplication(); - + + // put input data in temp dir stageInputFiles(); // until there we didn't started the job, it's not too late to - // stop, last check of shouldStrop + // stop, last check of shouldStrop before running the process if (!shouldStop) { + // prepare the process and start currentProcess prepareAndRunJob(); + // mark this job as started jobIsStarted(currentJobPath); try { // wait for the process to return int returnValue = currentProcess.waitFor(); + + // process returned and was not interrupted, output files + // are interesting in both successful and failure case + // upload them stageOutputFiles(); + + // now check is the process ended as a success or a failure + // and act accordingly if (returnValue == 0) { // job is successful jobIsSuccessful(currentJobPath); } else { + // job is a failure jobIsFailed(currentJobPath); } } catch (InterruptedException e) { + // job was interrupted maybe by a call to WokersManager#stop() log.debug("process was interrupted", e); jobIsInterrupted(currentJobPath); } } } catch (BadJobException e) { + // if job is a bad one, consider it as a failure jobIsFailed(currentJobPath); } finally { + + // update stat about how many time was worked if (currentProcessStartDate != null) { Long currentTime = System.currentTimeMillis(); config.addWorkedTime(currentTime - currentProcessStartDate); currentProcessStartDate = null; } + + // clean up the job directory + FileUtil.deleteRecursively(currentJobDir); + + // unset all variables for this job currentJob = null; currentProcess = null; - // clean up the job directory - FileUtil.deleteRecursively(currentJobDir); currentJobDir = null; } } /** - * In a directory, list the content, sort the content, and returns - * the first element. - * @throws DisworkFileSystemException - */ - protected String getFistJobName(String path) - throws DisworkFileSystemException { - List<String> jobsNames = fileSystem.readDirectory(path); - if (jobsNames.size() == 0) { - return null; - } else { - Collections.sort(jobsNames); - return jobsNames.get(0); - } - } - - /** * browse all running directories. If a jobs is too old, it is considered * as interrupted and moved back. All obsolete jobs found are moved to * be available again. @@ -564,27 +627,46 @@ // may try to do concurrent move boolean result = false; synchronized (fileSystem) { + + // all those dirs will be browsed for unfinished obsolete jobs String[] runningJobsDirs = { DisworkDaemon.FAILED_2_RUNNING, DisworkDaemon.FAILED_1_RUNNING, DisworkDaemon.TODO_RUNNING }; + + for (String path : runningJobsDirs) { try { List<String> jobsNames = fileSystem.readDirectory(path); + + // link names are dates so if we sort the content of this + // directory by names, old jobs are first and recent are + // last, so we can try to read from the beginning and + // stop without reading all the list Collections.sort(jobsNames); + + + boolean obsoleteJobFound = true; Iterator<String> it = jobsNames.iterator(); - boolean obsoleteJobFound = true; + + // iterate until a non-obsolete job is found or until + // there is no more file in this directory while (obsoleteJobFound && it.hasNext()) { String jobName = it.next(); Long linkAge = System.currentTimeMillis() - Long.parseLong(jobName); + // check is oldest job is too old and should be // considered has to-be-rerun if (linkAge > MAX_JOB_RUNNING_TIME) { + + // this link is too old, move it back to proposed jobs String jobPath = path + "/" + jobName; String newJobPath = INTERRUPTED_MOVE.get(path) + "/" + jobName; try { fileSystem.move(jobPath, newJobPath); + + // an obsolete job was found, update the return value result = true; } catch (DisworkFileSystemException e) { log.debug("failed at moving" + jobPath); @@ -592,6 +674,8 @@ // FIXME 20100712 bleny catch the exact exception } } else { + // break the iteration, the last elements of the + // list are still valid obsoleteJobFound = false; } } @@ -604,6 +688,14 @@ return result; } + /** + * In a given directory, try to find a job. If a job is found, immediatly + * move it to running dir and return it. + * + * @param dirPath the directory to browse for a job + * @return the path to the job found or null if no job found + * @throws DisworkSystemException + */ protected String findAJobInDirectory(String dirPath) throws DisworkSystemException { // use a synchronized block because multiple workers // may try to take a same job @@ -637,32 +729,43 @@ } /** - * try to find a job, if found, take it and return the path - * @return the path to the job, null if no job found - * @throws DisworkSystemException + * Check one-by-one the job directories to find a job. If a job + * is found, + * + * @return the path to the + * @throws DisworkSystemException */ protected String findAJob() throws DisworkSystemException { + // create a list with all directories where a job can be found List<String> jobsDirs = new ArrayList<String>(); jobsDirs.add(DisworkDaemon.FAILED_2); jobsDirs.add(DisworkDaemon.FAILED_1); jobsDirs.add(DisworkDaemon.TODO); + // For all those directories, call findAJobInDirectory until a job + // is found Iterator<String> it = jobsDirs.iterator(); String result = null; while (result == null && it.hasNext()) { String jobDir = it.next(); result = findAJobInDirectory(jobDir); } - + + // if all directories have been read without finding any job, + // check for obsolete jobs, and if an obsolete job was found, + // retry to find a job if (result == null) { + // now, if no job was found boolean checkResult = checkInteruptedJobs(); + if (checkResult) { - // obsolete jobs are now available, retry + // jobs that were interrupted are now made available, retry return findAJob(); } else { - // try again later + // even with obsolete jobs, nothing found, waiting + // before try again later try { log.info("look for a job was unsuccessful, will wait " + config.getJobLooksWaitTime() + " seconds before next try"); Thread.sleep(config.getJobLooksWaitTime() * 1000); @@ -675,13 +778,15 @@ return result; } - /** update the log of the job - * permit the user to use - * {@link DisworkDaemon#isSuccessful(JobDescription)} + /** update the log of a given job + * mark it as done and finished (permit the user to use + * {@link DisworkDaemon#isSuccessful(JobDescription)}) + * and move the link */ protected void jobIsSuccessful(String jobPath) throws DisworkSystemException { String newJobPath = DisworkDaemon.DONE + "/" + DisworkDaemon.newJobLinkName(); try { + // FIXME 20100720 bleny really useful ? log.info("moving " + jobPath + " to " + newJobPath); fileSystem.move(jobPath, newJobPath); } catch (DisworkFileSystemException e) { @@ -705,6 +810,7 @@ try { log.info("moving " + jobPath + " to " + newJobPath); + // FIXME 20100720 bleny really useful to move to FAILED_3, a dir never read by anyone fileSystem.move(jobPath, newJobPath); } catch (DisworkFileSystemException e) { log.error("error while moving job link", e); @@ -746,7 +852,17 @@ } /** - * find + * Until shouldStop become true, check {@link WorkersManager#flag} value. + * The flag tells the worker if the {@link WorkersManager#activityStrategy} + * allows the worker to run a job. + * + * If flag is true : try to find a job. If a job is found, {@link #currentJobPath} + * is set and {@link #runJob()} is called. + * + * If flag is false : it means that Activity Strategy don't want the worker + * to work so the worker will sleep until the Activity Strategy update the + * flag. Sleep time will depend of the activity strategy, + * see {@link ActivityStrategy#timeBeforeNextUpdate()}. */ @Override public void run() { @@ -765,7 +881,7 @@ long waitTime = activityStrategy.timeBeforeNextUpdate(); try { if (waitTime == -1) { - // wait until notify + // wait until flag is updated sem.wait(); } else { sem.wait(waitTime); @@ -778,7 +894,8 @@ } } catch (DisworkException e) { log.warn("exception caught by worker", e); - // throw new RuntimeException("an error occured", e); + // no exception is thrown because we want the worker to continue + // whatever occurs } } } @@ -815,7 +932,7 @@ * @throws LocalFileException */ protected File getApplicationData(String applicationName, String applicationVersion) - throws DisworkSystemException, LocalFileException { + throws DisworkException { if (!applicationCache.exists()) { applicationCache.mkdirs(); } @@ -832,6 +949,9 @@ } catch (DisworkFileSystemException e) { log.error("unable to get application", e); throw new DisworkSystemException("unable to get application", e); + } catch (FileNotFoundException e) { + log.error("application data is not available", e); + throw new BadJobException("application data is not available", e); } finally { IOUtils.closeQuietly(applicationData); } @@ -857,44 +977,17 @@ return cachedApplicationData; } - public void stop() throws DisworkException { - // asking to all threads to stop + /** get a list of jobs that workers are doing. Only for monitoring purpose. + * + * returns list which size is the number of worker. Thus, the list may + * contains null elements for workers that are doing nothing. + */ + public List<JobDescription> getAllWorkersCurrentJobs() { + List<JobDescription> result = new ArrayList<JobDescription>(); for (Worker worker : workers) { - log.debug("asking " + worker + " to stop"); - worker.shouldStop = true; + result.add(worker.currentJob); } - - activeNoActivityStrategy(); - - for (Worker worker : workers) { - if (worker.currentProcess != null) { - log.debug("killing " + worker + " process"); - worker.currentProcess.destroy(); - } - } - - if (applicationCache.exists()) { - FileUtil.deleteRecursively(applicationCache); - } - - // waiting for them to actually have finished - for (Worker worker : workers) { - while (worker.isAlive()) { - try { - // worker may be sleeping - synchronized (sem) { - sem.notifyAll(); - } - log.debug("waiting for " + worker + " to return"); - Thread.sleep(1000); - } catch (InterruptedException e) { - log.warn("interrupted while waiting for a worker to " + - "stop", e); - } - } - } - - log.debug("all workers stopped"); + return result; } public ActivityStrategy getActivityStrategy() { @@ -936,12 +1029,43 @@ setActivityStrategy(ActivityStrategies.SCHEDULED); } - /** this is only for monitoring purpose */ - public List<JobDescription> getAllWorkersCurrentJobs() { - List<JobDescription> result = new ArrayList<JobDescription>(); + public void stop() throws DisworkException { + // asking to all threads to stop for (Worker worker : workers) { - result.add(worker.currentJob); + log.debug("asking " + worker + " to stop"); + worker.shouldStop = true; } - return result; + + activeNoActivityStrategy(); + + for (Worker worker : workers) { + if (worker.currentProcess != null) { + log.debug("killing " + worker + " process"); + worker.currentProcess.destroy(); + } + } + + if (applicationCache.exists()) { + FileUtil.deleteRecursively(applicationCache); + } + + // waiting for them to actually have finished + for (Worker worker : workers) { + while (worker.isAlive()) { + try { + // worker may be sleeping + synchronized (sem) { + sem.notifyAll(); + } + log.debug("waiting for " + worker + " to return"); + Thread.sleep(1000); + } catch (InterruptedException e) { + log.warn("interrupted while waiting for a worker to " + + "stop", e); + } + } + } + + log.debug("all workers stopped"); } } \ No newline at end of file Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/package-info.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/package-info.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/package-info.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ /** * * {@link org.nuiton.diswork.daemon.DisworkDaemon} is the class the that Modified: trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkConfigTest.java =================================================================== --- trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkConfigTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkConfigTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; import static org.junit.Assert.assertEquals; Modified: trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonConcurrencyTest.java =================================================================== --- trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonConcurrencyTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonConcurrencyTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; /** Modified: trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonMultipleNodesTest.java =================================================================== --- trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonMultipleNodesTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonMultipleNodesTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; import org.nuiton.diswork.fs.DisworkFileSystemConfig; Modified: trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonTest.java =================================================================== --- trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/DisworkDaemonTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; import org.apache.commons.io.IOUtils; Modified: trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/JobDescriptionTest.java =================================================================== --- trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/JobDescriptionTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-daemon/src/test/java/org/nuiton/diswork/daemon/JobDescriptionTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork daemon + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.daemon; import static org.junit.Assert.assertEquals; Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java 2010-07-21 09:05:57 UTC (rev 104) @@ -57,11 +57,27 @@ */ public class DisworkFileSystem { + public static class PathUtil { + public static final String separator = EntryUtil.PATH_SEPARATOR; + public static final String root = EntryUtil.ROOT_DIRECTORY; + + /** build an absolute path from its elements */ + static String path(String... elements) { + String path = ""; + if (elements.length == 0) { + path = root; + } else { + for(String element : elements) { + path += separator + element; + } + path.replaceFirst(separator, root); + } + return path; + } + } + private static final Log log = LogFactory.getLog(DisworkFileSystem.class); - /** the symbol to use to separate directories in a path */ - public static final String separator = EntryUtil.PATH_SEPARATOR; - /** storage will permit to save and read directories, files and links */ protected Storage storage; @@ -90,8 +106,8 @@ /** tests the existence of a file/dir/link at a given path * return true if something exists at path p, it will be true if a call - * to <code>mkdir(p)</code>, <code>write(p, ?)</code> or - * <code>ln(p, ?)</code> has been done before. + * to {@link #createDirectory(String)}, {@link #write(String, InputStream)} + * or {@link #createSymbolicLink(String, String)} has been done before. * @param path a path in the virtual FS * @return true is something (a link, a file, or a directory) exists at path * @throws IOException @@ -111,12 +127,13 @@ * @throws FileNotFoundException if no file exists at this path * @throws IOException if path exists but is a directory */ - public InputStream read(String path) throws DisworkFileSystemException { + public InputStream read(String path) throws DisworkFileSystemException, + FileNotFoundException { checkPathSyntax(path); String entry = walk(path); if (entry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_FILE, path); + throw new FileNotFoundException(path); } InputStream result = null; @@ -149,8 +166,7 @@ throws DisworkFileSystemException { checkPathSyntax(path); if (source == null) { - throw new DisworkFileSystemException(Type.READ_LOCAL_DATA_FAILURE, - "source stream is null"); + throw new NullPointerException("source stream is null"); } String parent = EntryUtil.getParentFromPath(path); String name = EntryUtil.getNameFromPath(path); @@ -875,15 +891,13 @@ * check a path is absolute and syntactically correct, throw exception if * that's not the case. */ - protected void checkPathSyntax(String path) - throws DisworkFileSystemException { + protected void checkPathSyntax(String path) { if (path == null) { - throw new DisworkFileSystemException(Type.INVALID_PATH, - new NullPointerException()); + throw new NullPointerException("path is null"); } if (!path.startsWith(EntryUtil.ROOT_DIRECTORY)) { - throw new DisworkFileSystemException(Type.INVALID_PATH, + throw new IllegalArgumentException( "\"" + path + "\" is not correct, all pathes " + "have to be absolute (thus, starts with)" + EntryUtil.ROOT_DIRECTORY); @@ -892,7 +906,7 @@ String doubleSeparator = EntryUtil.PATH_SEPARATOR + EntryUtil.PATH_SEPARATOR; if (path.contains(doubleSeparator)) { - throw new DisworkFileSystemException(Type.INVALID_PATH, + throw new IllegalArgumentException( "\"" + path + "\" is not correct, it contains " + doubleSeparator); } Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java 2010-07-21 09:05:57 UTC (rev 104) @@ -40,8 +40,6 @@ ALREADY_EXISTS, /** Error while writing because another node is writing at this place */ CONCURRENT_MODIFICATION, - /** String do not describe a valid path */ - INVALID_PATH, /** The directory has a content */ DIRECTORY_NOT_EMPTY, /** directory doesn't exists */ Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java 2010-07-21 09:05:57 UTC (rev 104) @@ -246,14 +246,14 @@ log.debug("getLink(\"" + id + "\") returns \"" + content + "\""); return content; } - + public void putDirectory(String id, String content) throws DisworkFileSystemException { log.debug("putDirectory(\"" + id + "\", \"" + content + "\")"); InputStream value = IOUtils.toInputStream(content); put(id, value); } - + public void putFile(String id, InputStream content) throws DisworkFileSystemException { try { @@ -264,29 +264,30 @@ throw new DisworkFileSystemException(Type.READ_LOCAL_DATA_FAILURE, e); } } - + public void putLink(String id, String content) { + // FIXME 20100715 bleny since put() is not used to skip split, there is no concurrency management log.debug("putLink(\"" + id + "\", \"" + content + "\")"); byte[] contentAsBytes = EntryUtil.stringToBytes(content); map.put(id, contentAsBytes); } - + public void removeDirectory(String id) throws DisworkFileSystemException { log.debug("removeDirectory(\"" + id + "\")"); remove(id); } - + public void removeFile(String id) throws DisworkFileSystemException { log.debug("removeFile(\"" + id + "\")"); remove(id); } - + public void removeLink(String id) { log.debug("removeLink(\"" + id + "\")"); removeKey(id); } - - + + /** * see {@link #get(String)} */ Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs; import static org.junit.Assert.assertArrayEquals; @@ -9,6 +33,7 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.InputStream; import java.util.ConcurrentModificationException; import java.util.List; @@ -116,8 +141,8 @@ try { fileSystem.read("/not_existing_file"); fail(); - } catch (DisworkFileSystemException e) { - assertEquals(Type.NO_SUCH_FILE, e.getType()); + } catch (FileNotFoundException e) { + assertTrue(true); } } Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemInMemoryTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemInMemoryTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemInMemoryTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs; import static org.junit.Assert.assertEquals; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemKademliaTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemKademliaTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemKademliaTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs; import static org.junit.Assert.assertEquals; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemPastryTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemPastryTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/DisworkFileSystemPastryTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs; import static org.junit.Assert.assertArrayEquals; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/AbstractDisworkMapTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/AbstractDisworkMapTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/AbstractDisworkMapTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs.storage; import static org.junit.Assert.assertArrayEquals; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/EntryUtilTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/EntryUtilTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/EntryUtilTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ /* *##% * Copyright (c) 2010 poussin. All rights reserved. * Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/InMemoryDisworkMapTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/InMemoryDisworkMapTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/InMemoryDisworkMapTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs.storage; import org.junit.Before; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs.storage; import static org.junit.Assert.assertEquals; Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/PastryDisworkMapTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/PastryDisworkMapTest.java 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/PastryDisworkMapTest.java 2010-07-21 09:05:57 UTC (rev 104) @@ -1,3 +1,27 @@ +/* + * #%L + * Diswork File-System + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2010 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% + */ package org.nuiton.diswork.fs.storage; //package org.nuiton.disworkfs.storage; // Modified: trunk/src/license/project.xml =================================================================== --- trunk/src/license/project.xml 2010-07-13 13:31:41 UTC (rev 103) +++ trunk/src/license/project.xml 2010-07-21 09:05:57 UTC (rev 104) @@ -9,9 +9,10 @@ <commentStyle>java</commentStyle> <fileSets> <fileSet> - <basedir>src/main/java</basedir> + <basedir>src</basedir> <includes> - <include>**/*.java</include> + <include>main/java/**/*.java</include> + <include>test/java/**/*.java</include> </includes> </fileSet> </fileSets>
participants (1)
-
bleny@users.nuiton.org