[jboss-cvs] system2/src/tests/org/jboss/test/server/profileservice ...
Scott Stark
scott.stark at jboss.com
Sat Jul 15 01:37:17 EDT 2006
User: starksm
Date: 06/07/15 01:37:17
Added: src/tests/org/jboss/test/server/profileservice
MainWithSimpleHotDeployTestCase.java
Log:
Wait for scanner to make one pass
Revision Changes Path
1.1 date: 2006/07/15 05:37:17; author: starksm; state: Exp;system2/src/tests/org/jboss/test/server/profileservice/MainWithSimpleHotDeployTestCase.java
Index: MainWithSimpleHotDeployTestCase.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.test.server.profileservice;
import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployment.scanner.VFSDeploymentScanner;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.registry.KernelRegistry;
import org.jboss.kernel.spi.registry.KernelRegistryEntry;
import org.jboss.system.server.Server;
import org.jboss.system.server.profileservice.ServerImpl;
import org.jboss.test.BaseTestCase;
import org.jboss.Main;
/**
* Test of the jboss main loading a bootstrap configuration via the ProfileService
* and additional service via a simple
*
* @see
*
* @author Scott.Stark at jboss.org
* @version $Revision$
*/
public class MainWithSimpleHotDeployTestCase extends BaseTestCase
{
public MainWithSimpleHotDeployTestCase(String name)
{
super(name);
}
// Public --------------------------------------------------------
/* (non-Javadoc)
* @see org.jboss.test.AbstractTestCase#configureLogging()
*/
@Override
protected void configureLogging()
{
//enableTrace("org.jboss.kernel");
}
/**
* Test the startup of the org.jboss.Main entry point using the "default"
* profile.
* @throws Exception
*/
public void testDefaultStartup() throws Exception
{
// If jbosstest.deploy.dir is not defined fail
String deployDirEnv = System.getenv("jbosstest.deploy.dir");
String deployDirProp = System.getProperty("jbosstest.deploy.dir");
if( deployDirProp == null && deployDirEnv != null )
{
System.setProperty("jbosstest.deploy.dir", deployDirEnv);
deployDirProp = deployDirEnv;
}
assertNotNull("jbosstest.deploy.dir != null", deployDirProp);
String[] args = {"-c", "defaulthotdeploy"};
Main main = new Main();
main.boot(args);
Server server = main.getServer();
assertTrue("Server", server instanceof ServerImpl);
ServerImpl serverImpl = (ServerImpl) server;
// Validate that the expected deployment beans exist
Kernel kernel = serverImpl.getKernel();
assertInstalled(kernel, "ProfileService");
assertInstalled(kernel, "MainDeployer");
assertInstalled(kernel, "VFSFactory");
assertInstalled(kernel, "ClassLoadingDeployer");
assertInstalled(kernel, "BeanDeployer");
assertInstalled(kernel, "VFSDeploymentScanner");
KernelRegistry registry = kernel.getRegistry();
KernelRegistryEntry entry = registry.getEntry("VFSDeploymentScanner");
VFSDeploymentScanner scanner = (VFSDeploymentScanner) entry.getTarget();
// Wait for a deployment scan
synchronized( scanner )
{
while( scanner.getScanCount() <= 0 )
scanner.wait(10000);
}
log.info("Notified of scan: "+scanner.getScanCount());
// Expected hot deployments
assertInstalled(kernel, "VFSClassLoader");
assertInstalled(kernel, "TestBean");
// Shutdown
main.shutdown();
}
private void assertInstalled(Kernel kernel, String name)
{
KernelRegistry registry = kernel.getRegistry();
KernelRegistryEntry entry = registry.getEntry(name);
assertEquals(name+" Installed", ControllerState.INSTALLED, entry.getState());
}
}
More information about the jboss-cvs-commits
mailing list