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