Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

FileSpec.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*******************************************************************************
  2. * Copyright (c) 2010 Contributors
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * Andy Clement - SpringSource
  10. *******************************************************************************/
  11. package org.aspectj.testing;
  12. import java.io.File;
  13. import org.aspectj.tools.ajc.AjcTestCase;
  14. /**
  15. * Support simple file system operations in a test spec. Example:<br>
  16. * &lt;file deletefile="foo.jar"/&gt; will delete the file foo.jar from the sandbox.
  17. *
  18. * @author Andy Clement
  19. */
  20. public class FileSpec implements ITestStep {
  21. private String toDelete;
  22. // private String dir;
  23. // private AjcTest test;
  24. public FileSpec() {
  25. }
  26. public void setDeletefile(String file) {
  27. this.toDelete = file;
  28. }
  29. public void addExpectedMessage(ExpectedMessageSpec message) {
  30. }
  31. public void execute(AjcTestCase inTestCase) {
  32. File sandbox = inTestCase.getSandboxDirectory();
  33. if (toDelete != null) {
  34. new File(sandbox, toDelete).delete();
  35. }
  36. }
  37. public void setBaseDir(String dir) {
  38. // this.dir = dir;
  39. }
  40. public void setTest(AjcTest test) {
  41. // this.test = test;
  42. }
  43. }