summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java')
-rw-r--r--sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java b/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java
index b6bd00e345..de8e0ccacf 100644
--- a/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java
+++ b/sca-java-2.x/trunk/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/policy/security/jsr250/PolicyProcessorTestCase.java
@@ -177,26 +177,30 @@ public class PolicyProcessorTestCase extends TestCase {
}
public void testSingleInterfaceWithRolesAllowedAtMethodLevel() throws Exception {
- runProcessors(Service4.class, Service4.class.getMethods()[1], type);
- Operation op = getOperationModel(Service4.class.getMethods()[1], type);
+ Method aMethod = Service4.class.getDeclaredMethod("method2");
+ runProcessors(Service4.class, aMethod, type);
+ Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithPermitAllAtMethodLevel() throws Exception {
- runProcessors(Service4.class, Service4.class.getMethods()[2], type);
- Operation op = getOperationModel(Service4.class.getMethods()[2], type);
+ Method aMethod = Service4.class.getDeclaredMethod("method3");
+ runProcessors(Service4.class, aMethod, type);
+ Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithDenyAllAtMethodLevel() throws Exception {
- runProcessors(Service4.class, Service4.class.getMethods()[3], type);
- Operation op = getOperationModel(Service4.class.getMethods()[3], type);
+ Method aMethod = Service4.class.getDeclaredMethod("method4");
+ runProcessors(Service4.class, aMethod, type);
+ Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(1, op.getPolicySets().size());
}
public void testSingleInterfaceWithNothingAtMethodLevel() throws Exception {
- runProcessors(Service4.class, Service4.class.getMethods()[0], type);
- Operation op = getOperationModel(Service4.class.getMethods()[0], type);
+ Method aMethod = Service4.class.getDeclaredMethod("method1");
+ runProcessors(Service4.class, aMethod, type);
+ Operation op = getOperationModel(aMethod, type);
Assert.assertEquals(0, op.getPolicySets().size());
}
@@ -210,13 +214,11 @@ public class PolicyProcessorTestCase extends TestCase {
}
private Operation getOperationModel(Method method, JavaImplementation type){
-
for(Operation op : type.getOperations()){
if (((JavaOperation)op).getJavaMethod().equals(method)){
return op;
}
}
-
return null;
}
}