1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/*******************************************************************************
* Copyright (c) 2018 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 - initial API and implementation
*******************************************************************************/
package org.aspectj.systemtest.ajc192;
import java.io.File;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.classfile.NestHost;
import org.aspectj.apache.bcel.classfile.NestMembers;
import org.aspectj.testing.XMLBasedAjcTestCase;
import junit.framework.Test;
/**
* @author Andy Clement
*/
public class Ajc192Tests extends XMLBasedAjcTestCase {
public void testNestmates() throws Exception {
runTest("nestmates");
JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer");
JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer$Inner");
NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers");
assertEquals(1,nestMembers.getClasses().length);
assertEquals("Outer$Inner",nestMembers.getClassesNames()[0]);
NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost");
assertEquals("Outer",nestHost.getHostClassName());
}
// Verifying not destroyed on weaving
public void testNestmates2() throws Exception {
runTest("nestmates 2");
JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer2");
JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer2$Inner2");
NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers");
assertEquals(1,nestMembers.getClasses().length);
assertEquals("Outer2$Inner2",nestMembers.getClassesNames()[0]);
NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost");
assertEquals("Outer2",nestHost.getHostClassName());
}
public void testCflowFinal() {
runTest("no final on cflow elements");
}
// TODO Still to be fixed, the workaround to not mix style is good enough for now...
public void xtestAroundAdvice_AnnoStyle() {
runTest("around advice");
}
public void testAroundAdvice_CodeStyle() {
runTest("around advice - 2");
}
public void testPTW_nonPrivileged() {
runTest("ptw");
}
public void testPTW_nonPrivilegedSamePackage() {
runTest("ptw - same package");
}
public void testPTW_privileged() {
runTest("ptw - privileged");
}
public void testPTWW_privilegedSamePackage() {
runTest("ptw - privileged same package");
}
// ---
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc192Tests.class);
}
@Override
protected File getSpecFile() {
return getClassResource("ajc192.xml");
}
}
|