|                                                                                                              1
 23  package com.sun.enterprise.admin.wsmgmt.repository.impl.cache;
 24
 25  import java.util.List
  ; 26  import java.util.ArrayList
  ; 27  import java.util.Iterator
  ; 28  import java.util.Map
  ; 29  import java.util.Collection
  ; 30
 31
 37  class CacheMgrTest {
 38
 39      public static void testSave() {
 40          CacheMgr mgr = CacheMgr.getInstance();
 41          List
  ejbModules = new ArrayList  (); 42          List
  webModules = new ArrayList  (); 43
 44          ejbModules.add("ejb1.jar");
 45          webModules.add("web1.war");
 46          mgr.addJ2eeApplication("app1",  ejbModules, webModules);
 47
 48          List
  ejbModules2 = new ArrayList  (); 49          List
  webModules2 = new ArrayList  (); 50          ejbModules2.add("ejb2.jar");
 51          webModules2.add("web2.war");
 52          ejbModules2.add("ejb3.jar");
 53          webModules2.add("web3.war");
 54          mgr.addJ2eeApplication("app2",  ejbModules2, webModules2);
 55
 56          mgr.addEjbModule("ejb-module1");
 57          mgr.addWebModule("web-module1");
 58
 59          mgr.save();
 60      }
 61
 62      public static void testLoad() {
 63          CacheMgr mgr = CacheMgr.getInstance();
 64
 65          System.out.println("J2EE APPLICATION:");
 66          Map
  apps = mgr.getJ2eeApplications(); 67          Collection
  values = apps.values(); 68          for (Iterator
  iter=values.iterator(); iter.hasNext();) { 69              J2eeApplication app = (J2eeApplication) iter.next();
 70              System.out.println("\t"+app.getName()+"="+app.getPersistentValue());
 71          }
 72
 73          System.out.println("EJB MODULES:");
 74          Map
  ejbModules = mgr.getEjbModules(); 75          Collection
  ejbValues = ejbModules.values(); 76          for (Iterator
  iter=ejbValues.iterator(); iter.hasNext();) { 77              String
  ejbModule = (String  ) iter.next(); 78              System.out.println("\t"+ejbModule);
 79          }
 80
 81          System.out.println("WEB MODULES:");
 82          Map
  webModules = mgr.getWebModules(); 83          Collection
  webValues = webModules.values(); 84          for (Iterator
  iter=webValues.iterator(); iter.hasNext();) { 85              String
  webModule = (String  ) iter.next(); 86              System.out.println("\t"+webModule);
 87          }
 88      }
 89
 90      public static void main(String
  [] args) { 91          testSave();
 92          testLoad();
 93      }
 94  }
 95
                                                                                                                                                                                                             |                                                                       
 
 
 
 
 
                                                                                   Popular Tags                                                                                                                                                                                              |