1 23 24 29 30 package com.sun.enterprise.tools.verifier.tests.app; 31 32 import com.sun.enterprise.deployment.Application; 33 import com.sun.enterprise.tools.verifier.Result; 34 import com.sun.enterprise.tools.verifier.apiscan.packaging.ExtensionRef; 35 import java.io.File ; 36 import java.io.IOException ; 37 import java.util.ArrayList ; 38 import java.util.Iterator ; 39 40 46 public class OptPkgDependencySatisfied extends ApplicationTest implements AppCheck { 47 public Result check(Application descriptor){ 48 Result result = getInitializedResult(); 49 try{ 50 String earURI=getAbstractArchiveUri(descriptor); 51 com.sun.enterprise.tools.verifier.apiscan.packaging.Archive jar=new com.sun.enterprise.tools.verifier.apiscan.packaging.Archive(new File (earURI)); 52 com.sun.enterprise.tools.verifier.apiscan.packaging.ExtensionRef[] extRefs=jar.getExtensionRefs(); 55 com.sun.enterprise.tools.verifier.apiscan.packaging.Archive[] allOptPkgs=com.sun.enterprise.tools.verifier.apiscan.packaging.Archive.getAllOptPkgsInstalledInJRE(); 56 ArrayList <ExtensionRef> notFounds=new ArrayList <ExtensionRef>(); 57 for(int i=0;i<extRefs.length;++i){ 58 ExtensionRef ref=extRefs[i]; 59 boolean found=false; 60 for(int j=0;j<allOptPkgs.length;++j){ 61 if(ref.isSatisfiedBy(allOptPkgs[j])) { 62 found=true; 63 break; 64 } 65 } 66 if(!found) notFounds.add(ref); 67 } 69 if(notFounds.isEmpty()){ 70 result.passed(smh.getLocalString(getClass().getName() + ".passed", 71 "All opt package dependency satisfied for this ear file.")); 72 result.passed(""); 73 }else{ 74 result.failed(smh.getLocalString(getClass().getName() + ".failed","Some dependencies could not be satisfied for this ear file. See info below...")); 75 for(Iterator i=notFounds.iterator();i.hasNext();){ 76 result.addErrorDetails(i.next().toString()); 77 } 78 } 79 }catch(IOException e){ 80 result.failed(e.toString()); 81 } 82 return result; 83 } 84 } 85 | Popular Tags |