1
/********************************************************************
2
* Copyright (c) 2006 Contributors. All rights reserved.
3
* This program and the accompanying materials are made available
4
* under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution and is available at
6
* http://eclipse.org/legal/epl-v10.html
8
* Contributors: IBM Corporation - initial API and implementation
9
* Helen Hawkins - initial version
10
*******************************************************************/
11
package org.aspectj.systemtest.model;
15
import junit.framework.Test;
17
import org.aspectj.testing.XMLBasedAjcTestCase;
18
import org.aspectj.weaver.World;
21
* Tests the model when there is a requirement on Java5 features.
22
* @see org.aspectj.systemtest.model.ModelTestCase
24
public class Model5Tests extends ModelTestCase {
27
// Switch this to true for a single iteration if you want to reconstruct the
28
// 'expected model' files.
30
// Switch this to true if you want to debug the comparison
34
public void testDeclareAtTypeInStructureModel_pr115607() {runModelTest("declare at type appears correctly in structure model","pr115607");}
35
public void testStructureModelForGenericITD_pr131932() {runModelTest("structure model for generic itd","pr131932");}
36
public void testDeclareAnnotationAppearsInStructureModel_pr132130() {runModelTest("declare annotation appears in structure model when in same file","pr132130");}
37
public void testAtAspectDEOWInStructureModel_pr120356() {runModelTest("@AJ deow appear correctly when structure model is generated","pr120356");}
38
public void testDeclareAtMethodRelationship_pr143924() {runModelTest("declare @method relationship","pr143924");}
39
public void testNewIProgramElementMethodsForGenerics_pr141730() {runModelTest("new iprogramelement methods for generics","pr141730_2");}
41
// if not filling in the model for classes contained in jar files then
42
// want to ensure that the relationship map is correct and has nodes
43
// which can be used in AJDT - ensure no NPE occurs for the end of
44
// the relationship with inpath
45
public void testAspectPathRelWhenNotFillingInModel_pr141730() {
46
World.createInjarHierarchy = false;
48
// the aspect used for this test has advice, declare parents, deow,
49
// and declare @type, @constructor, @field and @method. We only expect
50
// there to be relationships in the map for declare parents and declare @type
51
// (provided the model isn't being filled in) because the logic in the other
52
// addXXXRelationship methods use AspectJElementHierarchy.findElementForType().
53
// This method which returns null because there is no such ipe. The relationship is
54
// therefore not added to the model. Adding declare @type and declare parents
55
// uses AspectJElementHierarchy.findElementForHandle() which returns the file
56
// node ipe if it can't find one for the given handle. Therefore the relationships
57
// are added against the file node. Before change to using ipe's to create handles
58
// we also had the deow relationship, however, now we don't because this also
59
// uses findElementForType to find the targetNode which in the inpath case is null.
60
runModelTest("ensure inpath injar relationships are correct when not filling in model","pr141730_4");
62
World.createInjarHierarchy = true;
66
// ///////////////////////////////////////
67
public static Test suite() {
68
return XMLBasedAjcTestCase.loadSuite(Model5Tests.class);
71
protected File getSpecFile() {
72
return new File("../tests/src/org/aspectj/systemtest/model/model.xml");