You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WeaverTestCase.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * ******************************************************************/
  12. package org.aspectj.weaver;
  13. import java.io.File;
  14. import org.aspectj.util.FileUtil;
  15. import junit.framework.TestCase;
  16. public abstract class WeaverTestCase extends TestCase {
  17. public static final String TESTDATA_PATH = "../weaver/testdata";
  18. public static final String OUTDIR_PATH = "../weaver/out";
  19. /** @return File outDir (writable) or null if unable to write */
  20. public static File getOutdir() {
  21. File result = new File(OUTDIR_PATH);
  22. if (result.mkdirs() || (result.canWrite() && result.isDirectory())) {
  23. return result;
  24. }
  25. return null;
  26. }
  27. /** best efforts to delete the output directory and any contents */
  28. public static void removeOutDir() {
  29. File outDir = getOutdir();
  30. if (null != outDir) {
  31. FileUtil.deleteContents(outDir);
  32. outDir.delete();
  33. }
  34. }
  35. public WeaverTestCase(String name) {
  36. super(name);
  37. }
  38. }