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 35 36 public class WebURI extends ApplicationTest implements AppCheck { 37 38 39 47 public Result check(Application descriptor) { 48 49 Result result = getInitializedResult(); 50 51 52 if (descriptor.getWebBundleDescriptors().size() > 0) { 55 boolean oneFailed = false; 56 for (Iterator itr = descriptor.getWebBundleDescriptors().iterator(); itr.hasNext();) { 57 WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next(); 58 59 60 if (wbd.getModuleDescriptor().getArchiveUri().endsWith(".war")) { 62 result.addGoodDetails 63 (smh.getLocalString 64 (getClass().getName() + ".passed", 65 "[ {0} ] specifies the URI [ {1} ] of web application file, relative to the top level of the application package [ {2} ].", 66 new Object [] {wbd.getName(), wbd.getModuleDescriptor().getArchiveUri(), descriptor.getName()})); 67 } else { 68 if (!oneFailed) { 69 oneFailed =true; 70 } 71 result.addErrorDetails 72 (smh.getLocalString 73 (getClass().getName() + ".failed", 74 "Error: [ {0} ] does not specify the URI [ {1} ] of web application file, relative to the top level of the application package [ {2} ]or does not end with \".war\"", 75 new Object [] {wbd.getName(), wbd.getModuleDescriptor().getArchiveUri(), descriptor.getName()})); 76 } 77 } 78 if (oneFailed) { 79 result.setStatus(Result.FAILED); 80 } else { 81 result.setStatus(Result.PASSED); 82 } 83 } else { 84 result.notApplicable(smh.getLocalString 85 (getClass().getName() + ".notApplicable", 86 "There are no web components in application [ {0} ]", 87 new Object [] {descriptor.getName()})); 88 } 89 return result; 90 91 } 92 } 93 | Popular Tags |