1 23 package com.sun.enterprise.tools.verifier.tests.appclient; 24 25 import com.sun.enterprise.deployment.*; 26 import com.sun.enterprise.tools.verifier.*; 27 import com.sun.enterprise.tools.verifier.tests.*; 28 import java.lang.ClassLoader ; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 import com.sun.enterprise.tools.verifier.tests.*; 31 import com.sun.enterprise.tools.verifier.tests.*; 32 33 37 public class AppClientCallbackHandler extends AppClientTest implements AppClientCheck { 38 39 40 41 50 public Result check(ApplicationClientDescriptor descriptor) { 51 Result result = getInitializedResult(); 52 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 53 String callbackHandler = descriptor.getCallbackHandler(); 54 55 if(callbackHandler == null) { 56 result.addGoodDetails(smh.getLocalString 57 ("tests.componentNameConstructor", 58 "For [ {0} ]", 59 new Object [] {compName.toString()})); 60 result.passed(smh.getLocalString(getClass().getName() + ".passed", 61 "AppClient callback handler is not specified")); 62 } 63 else if (callbackHandler.length() > 0) 64 { 65 try { 66 Context context = getVerifierContext(); 67 ClassLoader jcl = context.getClassLoader(); 68 Class c = Class.forName(callbackHandler, false, getVerifierContext().getClassLoader()); 69 Object obj = c.newInstance(); 70 if( obj instanceof javax.security.auth.callback.CallbackHandler ) { 71 result.addGoodDetails(smh.getLocalString 72 ("tests.componentNameConstructor", 73 "For [ {0} ]", 74 new Object [] {compName.toString()})); 75 result.passed(smh.getLocalString(getClass().getName() + ".passed1", "AppClient callback handler is : [ {0} ] and is loadable", new Object [] {callbackHandler})); 76 } else { 77 result.addErrorDetails(smh.getLocalString 78 ("tests.componentNameConstructor", 79 "For [ {0} ]", 80 new Object [] {compName.toString()})); 81 result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: AppClient callback handler is not loadable.")); 82 } 83 } catch (Exception e) { 84 result.addErrorDetails(smh.getLocalString 85 ("tests.componentNameConstructor", 86 "For [ {0} ]", 87 new Object [] {compName.toString()})); 88 result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: AppClient callback handler is not loadable.")); 89 } 90 } else { 91 result.addErrorDetails(smh.getLocalString 93 ("tests.componentNameConstructor", 94 "For [ {0} ]", 95 new Object [] {compName.toString()})); 96 result.failed(smh.getLocalString(getClass().getName() + ".failed1", "Error: AppClient callback handler must not be blank.")); 97 } 98 return result; 99 } 100 } 101 | Popular Tags |