diff options
author | aclement <aclement> | 2010-06-16 18:13:43 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-06-16 18:13:43 +0000 |
commit | 4663836a13bcd71211a227c69a43b332c11d18a4 (patch) | |
tree | 238591ba90c8eb2dfe088207a4f512e26e46e955 /testing | |
parent | 1e617a5a4a1e0eded7b7d924a4a4b9f0c033b9cf (diff) | |
download | aspectj-4663836a13bcd71211a227c69a43b332c11d18a4.tar.gz aspectj-4663836a13bcd71211a227c69a43b332c11d18a4.zip |
310506: optional aspects
Diffstat (limited to 'testing')
-rw-r--r-- | testing/newsrc/org/aspectj/testing/FileSpec.java | 55 | ||||
-rw-r--r-- | testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java | 3 |
2 files changed, 58 insertions, 0 deletions
diff --git a/testing/newsrc/org/aspectj/testing/FileSpec.java b/testing/newsrc/org/aspectj/testing/FileSpec.java new file mode 100644 index 000000000..448e5e34e --- /dev/null +++ b/testing/newsrc/org/aspectj/testing/FileSpec.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2010 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Andy Clement - SpringSource + *******************************************************************************/ +package org.aspectj.testing; + +import java.io.File; + +import org.aspectj.tools.ajc.AjcTestCase; + +/** + * Support simple file system operations in a test spec. Example:<br> + * <file deletefile="foo.jar"/> will delete the file foo.jar from the sandbox. + * + * @author Andy Clement + */ +public class FileSpec implements ITestStep { + + private String toDelete; + + // private String dir; + // private AjcTest test; + + public FileSpec() { + } + + public void setDeletefile(String file) { + this.toDelete = file; + } + + public void addExpectedMessage(ExpectedMessageSpec message) { + } + + public void execute(AjcTestCase inTestCase) { + File sandbox = inTestCase.getSandboxDirectory(); + if (toDelete != null) { + new File(sandbox, toDelete).delete(); + } + } + + public void setBaseDir(String dir) { + // this.dir = dir; + } + + public void setTest(AjcTest test) { + // this.test = test; + } + +} diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java index 627944236..9ebf1935a 100644 --- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -183,6 +183,9 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { digester.addObjectCreate("suite/ajc-test/compile", CompileSpec.class); digester.addSetProperties("suite/ajc-test/compile"); digester.addSetNext("suite/ajc-test/compile", "addTestStep", "org.aspectj.testing.ITestStep"); + digester.addObjectCreate("suite/ajc-test/file", FileSpec.class); + digester.addSetProperties("suite/ajc-test/file"); + digester.addSetNext("suite/ajc-test/file", "addTestStep", "org.aspectj.testing.ITestStep"); digester.addObjectCreate("suite/ajc-test/run", RunSpec.class); digester.addSetProperties("suite/ajc-test/run", "class", "classToRun"); digester.addSetProperties("suite/ajc-test/run", "ltw", "ltwFile"); |