1 23 24 25 package com.sun.enterprise.tools.verifier.tests.web.runtime; 26 27 import com.sun.enterprise.deployment.*; 28 import com.sun.enterprise.tools.verifier.*; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 import com.sun.enterprise.deployment.WebBundleDescriptor; 31 import com.sun.enterprise.tools.verifier.tests.web.*; 32 import com.sun.enterprise.deployment.runtime.web.*; 33 34 37 39 public class ASCookieProperty extends WebTest implements WebCheck{ 40 41 42 public Result check(WebBundleDescriptor descriptor) { 43 44 45 Result result = getInitializedResult(); 46 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 47 48 boolean oneFailed = false; 49 boolean notApp = false; 50 51 try{ 52 SessionConfig sessionConfig = (descriptor.getSunDescriptor()).getSessionConfig(); 53 CookieProperties cookieProp=null; 54 WebProperty[] cookieWebProps=null; 55 if(sessionConfig !=null){ 56 cookieProp = sessionConfig.getCookieProperties(); 57 if (cookieProp!=null) 58 cookieWebProps=cookieProp.getWebProperty(); 59 } 60 if (sessionConfig!=null && cookieProp !=null && cookieWebProps!=null && cookieWebProps.length !=0 ){ 61 if(ASWebProperty.checkWebProperties(cookieWebProps,result ,descriptor, this )){ 62 oneFailed=true; 63 addErrorDetails(result, compName); 64 result.failed(smh.getLocalString 65 (getClass().getName() + ".failed", 66 "FAILED [AS-WEB session-config] cookie-properties : Atleast one name/value pair is not valid in [ {0} ].", 67 new Object [] {descriptor.getName()})); 68 } 69 70 }else{ 71 notApp = true; 72 } 73 if(notApp){ 74 addNaDetails(result, compName); 75 result.notApplicable(smh.getLocalString 76 (getClass().getName() + ".notApplicable", 77 "NOT APPLICABLE [AS-WEB session-config] cookie-properties element not defined for {0}.", 78 new Object [] {descriptor.getName()})); 79 } 80 if (oneFailed){ 81 result.setStatus(Result.FAILED); 82 }else if(notApp){ 83 result.setStatus(Result.NOT_APPLICABLE); 84 }else { 85 result.setStatus(Result.PASSED); 86 addGoodDetails(result, compName); 87 result.passed 88 (smh.getLocalString 89 (getClass().getName() + ".passed", 90 "PASSED [AS-WEB session-config] cookie-properties are valid within the web archive [ {0} ].", 91 new Object [] {descriptor.getName()} )); 92 } 93 }catch(Exception ex){ 94 oneFailed = true; 95 addErrorDetails(result, compName); 96 result.failed(smh.getLocalString 97 (getClass().getName() + ".failed1", 98 "FAILED [AS-WEB session-config] could not create the session-config object")); 99 100 } 101 return result; 102 } 103 104 } 105 106 | Popular Tags |