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 34 public class WebEnvEntryName extends WebTest implements WebCheck { 35 36 37 44 public Result check(WebBundleDescriptor descriptor) { 45 46 Result result = getInitializedResult(); 47 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 48 boolean oneFailed = false; 49 EnvironmentProperty nextEnvironmentProperty; 50 String envName; 51 if (!descriptor.getEnvironmentProperties().isEmpty()) { 52 53 for (Iterator itr = descriptor.getEnvironmentProperties().iterator(); 54 itr.hasNext();) { 55 nextEnvironmentProperty = (EnvironmentProperty) itr.next(); 56 envName = nextEnvironmentProperty.getName(); 57 if (envName.length() > 0) { 58 result.addGoodDetails(smh.getLocalString 59 ("tests.componentNameConstructor", 60 "For [ {0} ]", 61 new Object [] {compName.toString()})); 62 result.addGoodDetails 63 (smh.getLocalString 64 (getClass().getName() + ".passed", 65 "Environment entry value [ {0} ] has valid name within web archive [ {1} ]", 66 new Object [] {nextEnvironmentProperty.getName(),descriptor.getName()})); 67 } else { 68 oneFailed = true; 69 result.addErrorDetails(smh.getLocalString 70 ("tests.componentNameConstructor", 71 "For [ {0} ]", 72 new Object [] {compName.toString()})); 73 result.addErrorDetails 74 (smh.getLocalString 75 (getClass().getName() + ".failed", 76 "Error: Environment entry name must be of finite length")); 77 } 78 } 79 if (!oneFailed){ 80 result.setStatus(Result.PASSED); 81 } else { 82 result.setStatus(Result.FAILED); 83 } 84 } else { 85 result.setStatus(Result.NOT_APPLICABLE); 86 result.addNaDetails(smh.getLocalString 87 ("tests.componentNameConstructor", 88 "For [ {0} ]", 89 new Object [] {compName.toString()})); 90 result.notApplicable(smh.getLocalString 91 (getClass().getName() + ".notApplicable", 92 "There are no environment entry elements defined within this web archive [ {0} ]", 93 new Object [] {descriptor.getName()})); 94 } 95 96 return result; 97 } 98 } 99 | Popular Tags |