import java.io.File; | import java.io.File; | ||||
import java.util.List; | import java.util.List; | ||||
import org.aspectj.util.FileUtil; | |||||
import org.aspectj.util.LangUtil; | import org.aspectj.util.LangUtil; | ||||
import com.sun.org.apache.xml.internal.serializer.utils.Utils; | |||||
/** | /** | ||||
* A long way to go until full coverage, but this is the place to add more. | * A long way to go until full coverage, but this is the place to add more. |
Path path = new Path(project); | Path path = new Path(project); | ||||
boolean hasSourceDirectories = false; | boolean hasSourceDirectories = false; | ||||
boolean isJava5Compile = false; | boolean isJava5Compile = false; | ||||
boolean isJava8Compile = false; | |||||
for (File file: result.getSrcDirs()) { | for (File file: result.getSrcDirs()) { | ||||
// for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { | // for (Iterator iter = result.getSrcDirs().iterator(); iter.hasNext();) { | ||||
// File file = (File) iter.next(); | // File file = (File) iter.next(); | ||||
path.createPathElement().setLocation(file); | path.createPathElement().setLocation(file); | ||||
if (!isJava5Compile | if (!isJava5Compile | ||||
&& (Util.Constants.JAVA5_SRC.equals(file.getName()) || Util.Constants.JAVA5_TESTSRC.equals(file.getName()) || new File( | |||||
file.getParent(), ".isJava5").exists())) { | |||||
&& (Util.Constants.JAVA5_SRC.equals(file.getName()) || | |||||
Util.Constants.JAVA5_TESTSRC.equals(file.getName()) || | |||||
new File(file.getParent(), ".isJava5").exists())) { | |||||
isJava5Compile = true; | isJava5Compile = true; | ||||
} | } | ||||
if (new File(file.getParent(),".isJava8").exists()) { | |||||
isJava8Compile = true; | |||||
} | |||||
if (!hasSourceDirectories) { | if (!hasSourceDirectories) { | ||||
hasSourceDirectories = true; | hasSourceDirectories = true; | ||||
} | } | ||||
javac.setTarget("1.1"); // 1.1 class files - Javac in 1.4 uses 1.4 | javac.setTarget("1.1"); // 1.1 class files - Javac in 1.4 uses 1.4 | ||||
javac.setSource("1.3"); | javac.setSource("1.3"); | ||||
} else { | } else { | ||||
javac.setSource("1.7"); | |||||
javac.setTarget("1.7"); | |||||
if (isJava8Compile) { | |||||
javac.setSource("1.8"); | |||||
javac.setTarget("1.8"); | |||||
} else { | |||||
javac.setSource("1.7"); | |||||
javac.setTarget("1.7"); | |||||
} | |||||
} | } | ||||
// compile | // compile | ||||
boolean passed = false; | boolean passed = false; |
testsetToArgcombo.put(testset, argcombo); | testsetToArgcombo.put(testset, argcombo); | ||||
} | } | ||||
while (!testsetToArgcombo.isEmpty()) { | while (!testsetToArgcombo.isEmpty()) { | ||||
int _ = 1; | |||||
for (Iterator<Testset> iter = testsets.iterator(); iter.hasNext(); _++) { | |||||
int testsetCounter = 1; | |||||
for (Iterator<Testset> iter = testsets.iterator(); iter.hasNext(); testsetCounter++) { | |||||
Testset testset = iter.next(); | Testset testset = iter.next(); | ||||
List<List<Arg>> argcombo = testsetToArgcombo.get(testset); | List<List<Arg>> argcombo = testsetToArgcombo.get(testset); | ||||
if (argcombo.size() == 0) { | if (argcombo.size() == 0) { | ||||
continue; | continue; | ||||
} | } | ||||
List<Arg> args = argcombo.remove(0); | List<Arg> args = argcombo.remove(0); | ||||
final String startStr = "Testset " + _ + " of " + testsets.size(); | |||||
String str = startStr + " / Combo " + _ + " of " + argcombos.size(); | |||||
final String startStr = "Testset " + testsetCounter + " of " + testsets.size(); | |||||
String str = startStr + " / Combo " + testsetCounter + " of " + argcombos.size(); | |||||
log("---------- " + str + " ----------"); | log("---------- " + str + " ----------"); | ||||
execute(testset, args); | execute(testset, args); | ||||
} | } |
PointcutExpression pexpr = null; | PointcutExpression pexpr = null; | ||||
ShadowMatch match = null; | ShadowMatch match = null; | ||||
Method n = test.AnnoValues.class.getMethod("none",null); | |||||
Method r = test.AnnoValues.class.getMethod("redMethod",null); | |||||
Method g = test.AnnoValues.class.getMethod("greenMethod",null); | |||||
Method b = test.AnnoValues.class.getMethod("blueMethod",null); | |||||
Method d = test.AnnoValues.class.getMethod("defaultMethod",null); | |||||
Method n = test.AnnoValues.class.getMethod("none"); | |||||
Method r = test.AnnoValues.class.getMethod("redMethod"); | |||||
Method g = test.AnnoValues.class.getMethod("greenMethod"); | |||||
Method b = test.AnnoValues.class.getMethod("blueMethod"); | |||||
Method d = test.AnnoValues.class.getMethod("defaultMethod"); | |||||
pexpr = p.parsePointcutExpression("execution(@test.A3(test.Color.RED) public void *(..))"); | pexpr = p.parsePointcutExpression("execution(@test.A3(test.Color.RED) public void *(..))"); | ||||
assertTrue("Should match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED | assertTrue("Should match", pexpr.matchesMethodExecution(n).neverMatches()); // default value RED |