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 ServletLoadOnStartup 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.getServletDescriptors().isEmpty()) { 54 for (Iterator itr = descriptor.getServletDescriptors().iterator(); 55 itr.hasNext();) { 56 57 WebComponentDescriptor nextServletDescriptor = (WebComponentDescriptor) itr.next(); 58 Integer loadOnStartUp = new Integer (nextServletDescriptor.getLoadOnStartUp()); 60 if (loadOnStartUp.intValue() >= 0) { 61 result.addGoodDetails 63 (smh.getLocalString 64 (getClass().getName() + ".passed", 65 "load-on-startup [ {0} ] value found in [ {1} ]", 66 new Object [] {loadOnStartUp,nextServletDescriptor.getName()})); 67 } else { 68 if (!oneFailed) { 69 oneFailed = true; 70 } 71 result.addErrorDetails 72 (smh.getLocalString 73 (getClass().getName() + ".failed", 74 "Error: load-on-startup [ {0} ] invalid value found in [ {1} ]", 75 new Object [] {loadOnStartUp,nextServletDescriptor.getName()})); 76 } 77 } 78 if (oneFailed) { 79 result.setStatus(Result.FAILED); 80 } else { 81 result.setStatus(Result.PASSED); 82 } 83 } else { 84 result.notApplicable(smh.getLocalString 85 (getClass().getName() + ".notApplicable", 86 "There are no servlets within this web archive [ {0} ]", 87 new Object [] {descriptor.getName()})); 88 } 89 90 return result; 91 } 92 } 93 | Popular Tags |