1 23 package com.sun.enterprise.tools.verifier.tests.web; 24 25 import java.util.*; 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 30 31 35 public class ParamValue extends WebTest implements WebCheck { 36 37 38 45 public Result check(WebBundleDescriptor descriptor) { 46 47 Set contextParameters; 48 Iterator itr; 49 String epValue; 50 Result result = getInitializedResult(); 51 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 52 EnvironmentProperty ep; 53 boolean passed = true; 54 boolean oneFailed = false; 55 boolean notApp = false; 56 57 if (!descriptor.getContextParametersSet().isEmpty()) { 58 59 contextParameters = descriptor.getContextParametersSet(); 61 itr = contextParameters.iterator(); 62 while (itr.hasNext()) { 64 ep = (EnvironmentProperty)itr.next(); 65 epValue = ep.getValue(); 66 if ( epValue.length() != 0) { 67 result.addGoodDetails(smh.getLocalString 68 ("tests.componentNameConstructor", 69 "For [ {0} ]", 70 new Object [] {compName.toString()})); 71 result.addGoodDetails(smh.getLocalString 72 (getClass().getName() + ".passed", 73 "Param named/value exists for in the web archive [ {0} ].", 74 new Object [] {descriptor.getName()})); 75 } else { 76 oneFailed = true; 77 result.addErrorDetails(smh.getLocalString 78 ("tests.componentNameConstructor", 79 "For [ {0} ]", 80 new Object [] {compName.toString()})); 81 result.addErrorDetails(smh.getLocalString 82 (getClass().getName() + ".failed", 83 "Error: Param name/value should not be empty strings")); 84 85 } 86 } 87 88 } else { 89 notApp = true; 90 result.addNaDetails(smh.getLocalString 91 ("tests.componentNameConstructor", 92 "For [ {0} ]", 93 new Object [] {compName.toString()})); 94 result.notApplicable(smh.getLocalString 95 (getClass().getName() + ".notApplicable", 96 "There are no context parameters within the web archive [ {0} ]", 97 new Object [] {descriptor.getName()})); 98 } 99 if (oneFailed) { 100 result.setStatus(Result.FAILED); 101 } else if (notApp) { 102 result.setStatus(Result.NOT_APPLICABLE); 103 } else { 104 result.setStatus(Result.PASSED); 105 } 106 return result; 107 } 108 } 109 | Popular Tags |