FileDocCategorySizeDatePackage
CacheMgrTest.javaAPI DocGlassfish v2 API4162Fri May 04 22:24:44 BST 2007com.sun.enterprise.admin.wsmgmt.repository.impl.cache

CacheMgrTest

public class CacheMgrTest extends Object
Test class for cache manager object.
author
Nazrul Islam
since
J2SE 5.0

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        testSave();
        testLoad();
    
public static voidtestLoad()

        CacheMgr mgr = CacheMgr.getInstance();

        System.out.println("J2EE APPLICATION:");
        Map apps = mgr.getJ2eeApplications();
        Collection values = apps.values();
        for (Iterator iter=values.iterator(); iter.hasNext();) {
            J2eeApplication app = (J2eeApplication) iter.next();
            System.out.println("\t"+app.getName()+"="+app.getPersistentValue());
        }

        System.out.println("EJB MODULES:");
        Map ejbModules = mgr.getEjbModules();
        Collection ejbValues = ejbModules.values();
        for (Iterator iter=ejbValues.iterator(); iter.hasNext();) {
            String ejbModule = (String) iter.next();
            System.out.println("\t"+ejbModule);
        }

        System.out.println("WEB MODULES:");
        Map webModules = mgr.getWebModules();
        Collection webValues = webModules.values();
        for (Iterator iter=webValues.iterator(); iter.hasNext();) {
            String webModule = (String) iter.next();
            System.out.println("\t"+webModule);
        }
    
public static voidtestSave()

        CacheMgr mgr = CacheMgr.getInstance();
        List ejbModules = new ArrayList();
        List webModules = new ArrayList();

        ejbModules.add("ejb1.jar");
        webModules.add("web1.war");
        mgr.addJ2eeApplication("app1",  ejbModules, webModules);

        List ejbModules2 = new ArrayList();
        List webModules2 = new ArrayList();
        ejbModules2.add("ejb2.jar");
        webModules2.add("web2.war");
        ejbModules2.add("ejb3.jar");
        webModules2.add("web3.war");
        mgr.addJ2eeApplication("app2",  ejbModules2, webModules2);

        mgr.addEjbModule("ejb-module1");
        mgr.addWebModule("web-module1");

        mgr.save();