1 23 package com.sun.enterprise.tools.verifier.tests.app; 24 25 import com.sun.enterprise.tools.verifier.tests.app.ApplicationTest; 26 import java.util.*; 27 import com.sun.enterprise.deployment.*; 28 import com.sun.enterprise.tools.verifier.*; 29 30 33 34 public class AppWebContext extends ApplicationTest implements AppCheck { 35 36 37 44 public Result check(Application descriptor) { 45 46 Result result = getInitializedResult(); 47 48 49 if (descriptor.getWebBundleDescriptors().size() > 0) { 50 boolean oneWarning = false; 51 for (Iterator itr = descriptor.getWebBundleDescriptors().iterator(); itr.hasNext();) { 52 WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next(); 53 if (wbd.getContextRoot().equals("")) { 54 if (!oneWarning) { 56 oneWarning =true; 57 } 58 result.addWarningDetails 59 (smh.getLocalString 60 (getClass().getName() + ".warning", 61 "Warning: [ {0} ] has blank context root defined within application [ {1} ]", 62 new Object [] {wbd.getName(), descriptor.getName()})); 63 } else { 64 result.addGoodDetails 65 (smh.getLocalString 66 (getClass().getName() + ".passed", 67 "[ {0} ] has context root defined as [ {1} ] within application[ {2} ].", 68 new Object [] {wbd.getName(), wbd.getContextRoot(), descriptor.getName()})); 69 } 70 } 71 72 if (oneWarning) { 73 result.setStatus(Result.WARNING); 74 } else { 75 result.setStatus(Result.PASSED); 76 } 77 } else { 78 result.notApplicable(smh.getLocalString 79 (getClass().getName() + ".notApplicable", 80 "There are no web components in application [ {0} ]", 81 new Object [] {descriptor.getName()})); 82 } 83 84 return result; 85 } 86 } 87 | Popular Tags |