1 23 package com.sun.enterprise.tools.verifier.tests.app; 24 25 import com.sun.enterprise.tools.verifier.tests.app.ApplicationTest; 26 import java.util.*; 27 import java.io.*; 28 import com.sun.enterprise.deployment.*; 29 import com.sun.enterprise.security.acl.*; 30 import com.sun.enterprise.tools.verifier.*; 31 import com.sun.enterprise.util.FileClassLoader; 32 33 34 37 public class AppSecurityRole extends ApplicationTest implements AppCheck { 38 39 40 41 48 public Result check(Application descriptor) { 49 50 Result result = getInitializedResult(); 51 52 53 if (!descriptor.getRoles().isEmpty()) { 54 boolean oneFailed = false; 55 boolean foundIt = false; 56 Set sc = descriptor.getRoles(); 58 Iterator itr = sc.iterator(); 59 while (itr.hasNext()) { 60 foundIt = false; 61 Role role = (Role) itr.next(); 62 String roleName = role.getName(); 63 if (roleName.length() > 0) { 64 foundIt = true; 65 } else { 66 foundIt = false; 67 } 68 69 70 if (foundIt) { 71 result.addGoodDetails(smh.getLocalString 72 (getClass().getName() + ".passed", 73 "The security role name [ {0} ] found within application [ {1} ]", 74 new Object [] {roleName, descriptor.getName()})); 75 } else { 76 if (!oneFailed) { 77 oneFailed = true; 78 } 79 result.addErrorDetails(smh.getLocalString 80 (getClass().getName() + ".failed", 81 "Error: The security role name [ {0} ] not found within application [ {1} ]", 82 new Object [] {roleName, descriptor.getName()})); 83 } 84 } 85 if (oneFailed) { 86 result.setStatus(Result.FAILED); 87 } else { 88 result.setStatus(Result.PASSED); 89 } 90 } else { 91 result.notApplicable(smh.getLocalString 92 (getClass().getName() + ".notApplicable", 93 "There are no role-name elements within the application [ {0} ]", 94 new Object [] {descriptor.getName()})); 95 } 96 97 return result; 98 } 99 } 100 | Popular Tags |