manager.start("su"); managerMock.setMatcher(MockControl.ALWAYS_MATCHER);
    public void testDeployStartAndRestart() throws Exception {    	// configure mocks    	reset();        bootstrap.init(null);        bootstrapMock.setMatcher(MockControl.ALWAYS_MATCHER);        bootstrap.onInstall();        bootstrap.cleanUp();        replay();        // test component installation        startContainer(true);        String installJarUrl = createInstallerArchive("component1").getAbsolutePath();        ObjectName installerName = getInstallationService().loadNewInstaller(installJarUrl);        InstallerMBean installer = (InstallerMBean) MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), installerName, InstallerMBean.class, false);        assertFalse(installer.isInstalled());        ObjectName lifecycleName = installer.install();        LifeCycleMBean lifecycleMBean = (LifeCycleMBean)  MBeanServerInvocationHandler.newProxyInstance(container.getMBeanServer(), lifecycleName, LifeCycleMBean.class, false);        assertEquals(LifeCycleMBean.SHUTDOWN, lifecycleMBean.getCurrentState());        // check mocks        verify();                // configure mocks        reset();        component.getLifeCycle();        componentMock.setReturnValue(lifecycle, MockControl.ONE_OR_MORE);        lifecycle.init(null);        lifecycleMock.setMatcher(MockControl.ALWAYS_MATCHER);        lifecycle.start();        replay();        // test component installation        lifecycleMBean.start();        assertEquals(LifeCycleMBean.RUNNING, lifecycleMBean.getCurrentState());        // check mocks        verify();                // configure mocks        reset();        component.getServiceUnitManager();        componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);        manager.deploy(null, null);        managerMock.setMatcher(MockControl.ALWAYS_MATCHER);        managerMock.setReturnValue(null);        manager.init(null, null);        managerMock.setMatcher(MockControl.ALWAYS_MATCHER);        replay();        // deploy sa        assertTrue(getDeploymentService().canDeployToComponent("component1"));        File installSaUrl = createServiceAssemblyArchive("sa", "su", "component1");        getDeploymentService().deploy(installSaUrl.getAbsolutePath());        String[] sas = getDeploymentService().getDeployedServiceAssemblies();        assertNotNull(sas);        assertEquals(1, sas.length);        assertEquals("sa", sas[0]);        sas = getDeploymentService().getDeployedServiceAssembliesForComponent("component1");        assertNotNull(sas);        assertEquals(1, sas.length);        assertEquals("sa", sas[0]);        assertEquals(DeploymentServiceMBean.SHUTDOWN, getDeploymentService().getState("sa"));        // check mocks        verify();                // configure mocks        reset();        component.getServiceUnitManager();        componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);        manager.start("su");        replay();        // start sa        getDeploymentService().start("sa");        assertEquals(DeploymentServiceMBean.STARTED, getDeploymentService().getState("sa"));        // check mocks        verify();                // configure mocks        reset();        lifecycle.stop();        lifecycle.shutDown();        component.getServiceUnitManager();        componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);        manager.shutDown("su");        replay();        // shutdown container        shutdownContainer();        // check mocks        verify();                // configure mocks        reset();        component.getLifeCycle();        componentMock.setReturnValue(lifecycle, MockControl.ONE_OR_MORE);        lifecycle.init(null);        lifecycleMock.setMatcher(MockControl.ALWAYS_MATCHER);        lifecycle.start();        component.getServiceUnitManager();        componentMock.setReturnValue(manager, MockControl.ONE_OR_MORE);        manager.init(null, null);        managerMock.setMatcher(MockControl.ALWAYS_MATCHER);        manager.start("su");        managerMock.setMatcher(MockControl.ALWAYS_MATCHER);        manager.start("su");        managerMock.setMatcher(MockControl.ALWAYS_MATCHER);        replay();        // start container        startContainer(false);        // check mocks        verify();    }