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 ASSessionManager 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 try{ 51 SessionConfig sessionConfig = (descriptor.getSunDescriptor()).getSessionConfig(); 52 SessionManager sessionMgr=null; 53 54 StoreProperties stroeProp=null; 55 ManagerProperties mgrProps=null; 56 57 WebProperty[] SPwebProps=null; 58 WebProperty[] MPwebProps=null; 59 if(sessionConfig !=null){ 60 sessionMgr = sessionConfig.getSessionManager(); 61 } 62 if (sessionConfig!=null && sessionMgr !=null){ 63 mgrProps=sessionMgr.getManagerProperties(); 64 stroeProp =sessionMgr.getStoreProperties(); 65 66 if(stroeProp !=null ) 67 SPwebProps=stroeProp.getWebProperty(); 68 69 if(mgrProps !=null) 70 MPwebProps=mgrProps.getWebProperty(); 71 72 if((SPwebProps ==null|| SPwebProps.length==0) && (MPwebProps ==null || MPwebProps.length==0)){ 73 notApp = true; 74 } else { 75 if (SPwebProps !=null|| SPwebProps.length>0) 76 if(ASWebProperty.checkWebProperties(SPwebProps,result ,descriptor, this )){ 77 oneFailed=true; 78 addErrorDetails(result, compName); 79 result.failed(smh.getLocalString 80 (getClass().getName() + ".failed", 81 "FAILED [AS-WEB session-manager] store-properties - Atleast one name/value pair is not valid in [ {0} ].", 82 new Object [] {descriptor.getName()})); 83 } 84 85 if (MPwebProps !=null || MPwebProps.length>0) 86 if(ASWebProperty.checkWebProperties(MPwebProps,result ,descriptor, this )){ 87 oneFailed=true; 88 addErrorDetails(result, compName); 89 result.failed(smh.getLocalString 90 (getClass().getName() + ".failed1", 91 "FAILED [AS-WEB session-manager] manager-properties - Atleast one name/value pair is not valid in [ {0} ].", 92 new Object [] {descriptor.getName()})); 93 } 94 } 95 96 97 } else { 98 notApp = true; 99 } 100 if(notApp) { 101 addNaDetails(result, compName); 102 result.notApplicable(smh.getLocalString 103 (getClass().getName() + ".notApplicable", 104 "NOT APPLICABLE [AS-WEB session-config] session-manager element not defined in the web archive [ {0} ].", 105 new Object [] {descriptor.getName()})); 106 107 } 108 109 if (oneFailed) { 110 result.setStatus(Result.FAILED); 111 } else if(notApp) { 112 result.setStatus(Result.NOT_APPLICABLE); 113 }else { 114 result.setStatus(Result.PASSED); 115 addGoodDetails(result, compName); 116 result.passed 117 (smh.getLocalString 118 (getClass().getName() + ".passed", 119 "PASSED [AS-WEB session-config] session manager element(s) and their manager-properties and/or store-properties are valid within the web archive [ {0} ].", 120 new Object [] {descriptor.getName()} )); 121 } 122 }catch(Exception ex){ 123 oneFailed = true; 124 addErrorDetails(result, compName); 125 result.failed(smh.getLocalString 126 (getClass().getName() + ".failed2", 127 "FAILED [AS-WEB session-config] could not create the session-config object")); 128 129 } 130 return result; 131 } 132 } 133 134 | Popular Tags |