1 23 24 25 package com.sun.enterprise.tools.verifier.tests.web.ias; 26 27 import java.util.*; 28 import com.sun.enterprise.deployment.*; 29 import com.sun.enterprise.tools.verifier.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 import com.sun.enterprise.deployment.ResourceReferenceDescriptor; 32 import com.sun.enterprise.deployment.WebBundleDescriptor; 33 import com.sun.enterprise.tools.verifier.tests.web.*; 34 import com.sun.enterprise.tools.common.dd.webapp.*; 35 36 39 41 public class ASSessionProperty extends WebTest implements WebCheck{ 42 43 44 public Result check(WebBundleDescriptor descriptor) { 45 46 47 Result result = getInitializedResult(); 48 WebComponentNameConstructor compName = new WebComponentNameConstructor(descriptor); 49 50 boolean oneFailed = false; 51 boolean notApp = false; 52 SessionConfig sessionConfig = getSessionConfig(descriptor); 53 SessionProperties sessionProp=null; 54 55 WebProperty[] SPwebProps=null; 56 57 if(sessionConfig !=null){ 58 sessionProp = sessionConfig.getSessionProperties(); 59 if (sessionProp!=null) 60 SPwebProps=sessionProp.getWebProperty(); 61 } 62 63 if (sessionConfig!=null && sessionProp !=null && SPwebProps!=null && SPwebProps.length !=0 ) { 65 66 if(ASWebProperty.checkWebProperties(SPwebProps,result ,descriptor, this )){ 67 oneFailed=true; 68 result.failed(smh.getLocalString 69 (getClass().getName() + ".failed", 70 "FAILED [AS-WEB session-config] session-properties - Atleast one name/value pair is not valid in [ {0} ].", 71 new Object [] {descriptor.getName()})); 72 } 73 74 } else { 75 notApp = true; 76 } 77 if(notApp) { 79 result.notApplicable(smh.getLocalString 80 (getClass().getName() + ".notApplicable", 81 "NOT APPLICABLE [AS-WEB session-config] session-properties element(s) not defined in the web archive [ {0} ].", 82 new Object [] {descriptor.getName()})); 83 } 84 85 if (oneFailed) { 86 result.setStatus(Result.FAILED); 87 } else if(notApp) { 88 result.setStatus(Result.NOT_APPLICABLE); 89 }else { 90 result.setStatus(Result.PASSED); 91 result.passed 92 (smh.getLocalString 93 (getClass().getName() + ".passed", 94 "PASSED [AS-WEB session-config] session-properties element(s) are valid within the web archive [ {0} ].", 95 new Object [] {descriptor.getName()} )); 96 } 97 return result; 98 } 99 100 public SessionConfig getSessionConfig(WebBundleDescriptor descriptor) { 101 return descriptor.getIasWebApp().getSessionConfig(); 102 103 104 } 105 } 106 107 | Popular Tags |