alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.tomcat5;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.InputStream;
import java.io.OutputStream;
import javax.enterprise.deploy.model.DDBean;
import javax.enterprise.deploy.model.DDBeanRoot;
import javax.enterprise.deploy.model.DeployableObject;
import javax.enterprise.deploy.model.XpathEvent;
import javax.enterprise.deploy.spi.DConfigBean;
import javax.enterprise.deploy.spi.DConfigBeanRoot;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
import junit.framework.*;
import org.netbeans.modules.schema2beans.BaseBean;
import org.netbeans.modules.tomcat5.config.Context;

/**
 *
 * @author Radim Kubacki
 */
public class WebappConfigurationTest extends TestCase {
    
    public WebappConfigurationTest (java.lang.String testName) {
        super (testName);
    }
    
    public static Test suite () {
        TestSuite suite = new TestSuite (WebappConfigurationTest.class);
        return suite;
    }
    
//    /** Test of getDConfigBeanRoot method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testGetDConfigBeanRoot () {
//        System.out.println ("testGetDConfigBeanRoot");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
//    /** Test of getDeployableObject method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testGetDeployableObject () {
//        System.out.println ("testGetDeployableObject");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
//    /** Test of removeDConfigBean method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testRemoveDConfigBean () {
//        System.out.println ("testRemoveDConfigBean");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
//    /** Test of restore method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testRestore () {
//        System.out.println ("testRestore");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
//    /** Test of restoreDConfigBean method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testRestoreDConfigBean () {
//        System.out.println ("testRestoreDConfigBean");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
//    /** Test of save method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
//    public void testSave () {
//        System.out.println ("testSave");
//        
//        // Add your test code below by replacing the default call to fail.
//        fail ("The test case is empty.");
//    }
//    
    /** Test of saveDConfigBean method, of class org.netbeans.modules.tomcat5.WebappConfiguration. */
    public void testSaveDConfigBean () {
        System.out.println ("testSaveDConfigBean");
        
        // Add your test code below by replacing the default call to fail.
        fail ("The test case is empty.");
    }
    
    private boolean fired = false;
    public void testSettingContextRoot() {
        System.out.println ("testSettingContextRoot");
        try {
            fired = false;
            DeploymentConfiguration dc = new WebappConfiguration(null);
            DConfigBeanRoot dcr = dc.getDConfigBeanRoot (null);
            dcr.addPropertyChangeListener (new PropertyChangeListener () {
                public void propertyChange (PropertyChangeEvent evt) {
                    if ("contextRoot".equals (evt.getPropertyName ())) {
                        fired = true;
                    }
                }
            });
            ((WebappConfiguration.DConfigRootWrapper)dcr).setContextRoot ("/myapplication");
            assertTrue ("Event for context root not fired", fired);
        }
        catch (Exception e) {
            e.printStackTrace ();
            fail ("Exception thrown: "+e);
        }
        finally {
            fired = false;
        }
    }
    
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.