1 23 package com.sun.enterprise.tools.verifier.tests.web; 24 25 import com.sun.enterprise.tools.verifier.tests.web.WebTest; 26 import java.util.*; 27 import com.sun.enterprise.deployment.*; 28 import com.sun.enterprise.tools.verifier.*; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 31 35 public class JspLoadOnStartup extends WebTest implements WebCheck { 36 37 38 46 public Result check(WebBundleDescriptor descriptor) { 47 48 Result result = getInitializedResult(); 49 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 50 51 52 boolean oneFailed = false; 53 if (!descriptor.getJspDescriptors().isEmpty()) { 54 for (Iterator itr = descriptor.getJspDescriptors().iterator(); 55 itr.hasNext();) { 56 57 WebComponentDescriptor nextJspDescriptor = (WebComponentDescriptor) itr.next(); 58 Integer loadOnStartUp = new Integer (nextJspDescriptor.getLoadOnStartUp()); 59 if (loadOnStartUp.intValue() >= 0) { 61 result.addGoodDetails(smh.getLocalString 63 ("tests.componentNameConstructor", 64 "For [ {0} ]", 65 new Object [] {compName.toString()})); 66 67 result.addGoodDetails 68 (smh.getLocalString 69 (getClass().getName() + ".passed", 70 "load-on-startup [ {0} ] value found in [ {1} ]", 71 new Object [] {loadOnStartUp.toString(),nextJspDescriptor.getName()})); 72 } else { 73 if (loadOnStartUp.intValue() == -1) { 74 result.addGoodDetails(smh.getLocalString 75 ("tests.componentNameConstructor", 76 "For [ {0} ]", 77 new Object [] {compName.toString()})); 78 result.addGoodDetails(smh.getLocalString( 79 getClass().getName() + ".passed2", 80 "load-on-startup is not specified for [ {0} ]", 81 new Object [] {nextJspDescriptor.getName()})); 82 } else { 83 if (!oneFailed) { 84 oneFailed = true; 85 } 86 result.addErrorDetails(smh.getLocalString 87 ("tests.componentNameConstructor", 88 "For [ {0} ]", 89 new Object [] {compName.toString()})); 90 result.addErrorDetails 91 (smh.getLocalString 92 (getClass().getName() + ".failed", 93 "Error: load-on-startup [ {0} ] invalid value found in [ {1} ]", 94 new Object [] {loadOnStartUp.toString(),nextJspDescriptor.getName()})); 95 } 96 } 97 } 98 if (oneFailed) { 99 result.setStatus(Result.FAILED); 100 } else { 101 result.setStatus(Result.PASSED); 102 } 103 } else { 104 result.addNaDetails(smh.getLocalString 105 ("tests.componentNameConstructor", 106 "For [ {0} ]", 107 new Object [] {compName.toString()})); 108 result.notApplicable(smh.getLocalString 109 (getClass().getName() + ".notApplicable", 110 "There are no JSP's within this web archive [ {0} ]", 111 new Object [] {descriptor.getName()})); 112 } 113 114 return result; 115 } 116 } 117 | Popular Tags |