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 ASCookieProperty 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 CookieProperties cookieProp=null; 54 55 56 WebProperty[] cookieWebProps=null; 57 58 if(sessionConfig !=null){ 59 cookieProp = sessionConfig.getCookieProperties(); 60 if (cookieProp!=null) 61 cookieWebProps=cookieProp.getWebProperty(); 62 } 63 64 if (sessionConfig!=null && cookieProp !=null && cookieWebProps!=null && cookieWebProps.length !=0 ) { 66 67 if(ASWebProperty.checkWebProperties(cookieWebProps,result ,descriptor, this )){ 68 oneFailed=true; 69 result.failed(smh.getLocalString 70 (getClass().getName() + ".failed", 71 "FAILED [AS-WEB session-config] cookie-properties : Atleast one name/value pair is not valid in [ {0} ].", 72 new Object [] {descriptor.getName()})); 73 } 74 75 } else { 76 notApp = true; 77 } 78 if(notApp) { 80 result.notApplicable(smh.getLocalString 81 (getClass().getName() + ".notApplicable", 82 "NOT APPLICABLE [AS-WEB session-config] cookie-properties element not defined for {0}.", 83 new Object [] {descriptor.getName()})); 84 } 85 86 if (oneFailed) { 87 result.setStatus(Result.FAILED); 88 } else if(notApp) { 89 result.setStatus(Result.NOT_APPLICABLE); 90 }else { 91 result.setStatus(Result.PASSED); 92 result.passed 93 (smh.getLocalString 94 (getClass().getName() + ".passed", 95 "PASSED [AS-WEB session-config] cookie-properties are valid within the web archive [ {0} ].", 96 new Object [] {descriptor.getName()} )); 97 } 98 return result; 99 } 100 101 public SessionConfig getSessionConfig(WebBundleDescriptor descriptor) { 102 return descriptor.getIasWebApp().getSessionConfig(); 103 104 105 } 106 } 107 108 | Popular Tags |