Fix up comments to keep in line with recent changes to the main() method arguments

Some javadoc fixes where necessary


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2794 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley 2006-05-09 07:58:04 +00:00
parent 6130a51290
commit 1119bdd44e
2 changed files with 24 additions and 15 deletions

View File

@ -63,5 +63,15 @@ public interface FileImporter
*/
public int loadFile(NodeRef container, File file) throws FileImporterException;
/**
* Load a file into a given location, giving it a new name.
*
* @param container the target parent to load into
* @param file the source file to upload
* @param recurse true to recurse into subfolders
* @param name the new name of the file or folder when it gets uploaded
* @return Returns the number of files loaded
* @throws FileImporterException
*/
public int loadNamedFile(NodeRef container, File file, boolean recurse, String name) throws FileImporterException;
}

View File

@ -66,8 +66,6 @@ public class FileImporterTest extends TestCase
private ServiceRegistry serviceRegistry;
private NodeRef rootNodeRef;
private SearchService searcher;
public FileImporterTest()
{
super();
@ -82,7 +80,6 @@ public class FileImporterTest extends TestCase
{
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
searcher = serviceRegistry.getSearchService();
nodeService = serviceRegistry.getNodeService();
searchService = serviceRegistry.getSearchService();
dictionaryService = serviceRegistry.getDictionaryService();
@ -119,8 +116,8 @@ public class FileImporterTest extends TestCase
{
FileImporter fileImporter = createFileImporter();
URL url = this.getClass().getClassLoader().getResource("");
File root = new File(url.getFile());
int count = fileImporter.loadFile(rootNodeRef, new File(url.getFile()));
File rootFile = new File(url.getFile());
int count = fileImporter.loadFile(rootNodeRef, rootFile);
assertEquals("Expected to load a single file", 1, count);
}
@ -168,10 +165,11 @@ public class FileImporterTest extends TestCase
/**
* @param args
* <ol>
* <li>StoreRef
* <li>Store Path
* <li>Directory
* <li>Optional maximum time in seconds for node loading
* <li>StoreRef: The store to load the files into
* <li>String: The path within the store into which to load the files (e.g. /app:company_home)
* <li>String: Directory to use as source (e.g. c:/temp)
* <li>String: New name to give the source. It may have a suffix added (e.g. upload_xxx)
* <li>Integer: Number of times to repeat the load.
* </ol>
* @throws SystemException
* @throws NotSupportedException
@ -183,11 +181,10 @@ public class FileImporterTest extends TestCase
*/
public static final void main(String[] args) throws Exception
{
int exitCode = 0;
int grandTotal = 0;
int count = 0;
File sourceFile = new File(args[2]);
String baseName = args[3];
int target = Integer.parseInt(args[4]);
while (count < target)
{
@ -229,7 +226,11 @@ public class FileImporterTest extends TestCase
}
long start = System.nanoTime();
int importCount = test.createFileImporter().loadNamedFile(location.get(0), new File(args[2]), true, args[3]+count);
int importCount = test.createFileImporter().loadNamedFile(
location.get(0),
sourceFile,
true,
String.format("%s-%05d", baseName, count));
grandTotal += importCount;
long end = System.nanoTime();
long first = end-start;
@ -304,9 +305,7 @@ public class FileImporterTest extends TestCase
{
tx.rollback();
e.printStackTrace();
exitCode = 1;
}
//System.exit(exitCode);
}
System.exit(0);
}