1 23 24 package com.sun.enterprise.tools.verifier.tests.connector.ias; 25 26 import com.sun.enterprise.deployment.ConnectorDescriptor; 27 import com.sun.enterprise.tools.common.dd.connector.ResourceAdapter; 28 import com.sun.enterprise.tools.common.dd.connector.SunConnector; 29 import com.sun.enterprise.tools.verifier.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 import com.sun.enterprise.tools.verifier.tests.connector.*; 32 33 34 public class ASConnectorIdleTimeout extends ConnectorTest implements ConnectorCheck { 35 public Result check(ConnectorDescriptor descriptor) 36 { 37 Result result = getInitializedResult(); 38 ComponentNameConstructor compName = new ComponentNameConstructor(descriptor); 39 boolean oneFailed = false; 40 SunConnector sc = descriptor.getSunDescriptor(); 41 if(sc == null) 42 { 43 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1", 44 "NOT APPLICABLE [ASCONNECTOR]: sun-ra.xml descriptor object could not be obtained")); 45 46 } 47 else{ 48 ResourceAdapter ra = sc.getResourceAdapter(); 49 String idleTimeout = ra.getAttributeValue("idle-timeout-in-seconds"); 50 if(idleTimeout.length()==0) 51 { 52 result.failed(smh.getLocalString(getClass().getName()+".failed1", 53 "FAILED [AS-CONNECTOR resource-adapter] : idle-timeout-in-seconds cannot be empty")); 54 } 55 else 56 { 57 try 58 { 59 long value = Long.valueOf(idleTimeout).longValue(); 60 if(value < 0 || value > Long.MAX_VALUE) 61 { 62 result.failed(smh.getLocalString(getClass().getName()+".failed2", 63 "FAILED [AS-CONNECTOR resource-adapter] : idle-timeout-in-seconds cannot be {0}. It should be between 0 and {1}", 64 new Object []{new Long (value),new Long (Long.MAX_VALUE)})); 65 } 66 else 67 { 68 result.passed(smh.getLocalString(getClass().getName()+".passed", 69 "PASSED [AS-CONNECTOR resource-adapter] : idle-timeout-in-seconds is {0}", 70 new Object []{new Long (value)})); 71 } 72 } 73 catch(NumberFormatException nfex) 74 { 75 Verifier.debug(nfex); 76 result.failed(smh.getLocalString(getClass().getName()+".failed3", 77 "FAILED [AS-CONNECTOR resource-adapter] : The value {0} for idle-timeout-in-seconds is not a valid Long number",new Object []{idleTimeout})); 78 } 79 } 80 } 81 return result; 82 } 83 } 84 | Popular Tags |