[embjopr-commits] EMBJOPR SVN: r625 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit and 3 other directories.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Wed Jul 29 15:03:23 EDT 2009


Author: ozizka at redhat.com
Date: 2009-07-29 15:03:17 -0400 (Wed, 29 Jul 2009)
New Revision: 625

Added:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTestUtils.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/RepeatedDeploymentViaPSTest.java
Modified:
   trunk/jsfunit/pom.xml
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
 * Added jboss.isSecured system property to tell the testsuite whether AS is secured.

Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml	2009-07-29 18:38:10 UTC (rev 624)
+++ trunk/jsfunit/pom.xml	2009-07-29 19:03:17 UTC (rev 625)
@@ -8,6 +8,7 @@
       <cargo.plugin.version>1.0.1-SNAPSHOT</cargo.plugin.version><!-- Was: 1.0-SNAPSHOT -->
       <jvm.args.debug></jvm.args.debug>
       <htmlunit.browser>ff3</htmlunit.browser><!-- ff2 | ff3 | ie6 | ie7 -->
+      <jboss.isSecured>true</jboss.isSecured><!-- true | false ;  True if JBoss AS/EAP is secured. -->
    </properties>
    
    <parent>
@@ -351,6 +352,7 @@
                            <!-- Home dir for Cargo's JBoss instance. -->
                            <jsfunit.jboss.home.dir>${basedir}/target/jboss5x</jsfunit.jboss.home.dir>
                            <htmlunit.browser>${htmlunit.browser}</htmlunit.browser>
+                           <jsfunit.jboss.isSecured>${jboss.isSecured}</jsfunit.jboss.isSecured>
                         </systemProperties>
                      </container>
 

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java	2009-07-29 18:38:10 UTC (rev 624)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java	2009-07-29 19:03:17 UTC (rev 625)
@@ -16,6 +16,7 @@
 	public static final String SYSPROP_TESTDATA_DIR = "jsfunit.testdata";
 	public static final String SYSPROP_TEMP_DIR = "jsfunit.tempdir";
 	public static String SYSPROP_JBOSS_CONFIG = "jboss.configuration";
+	public static String SYSPROP_JBOSS_IS_SECURED = "jsfunit.jboss.isSecured";
 	public static String SYSPROP_CARGO_JBOSS_HOME_DIR = "jsfunit.jboss.home.dir";
 
 

Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTest.java	2009-07-29 19:03:17 UTC (rev 625)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit.as5.ps;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.jopr.jsfunit.*;
+import java.io.*;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.lang.StringUtils;
+import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.profileservice.spi.*;
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise Application archives with JBoss AS 5.
+ * 
+ * @author Ondrej Zizka
+ *
+ */
+public class ProfileServiceTest extends ApplicationTestBaseAS5 {
+
+	/**
+	  * @return the suite of tests being tested
+	*/
+
+	public static Test suite(){
+		return new TestSuite(ProfileServiceTest.class);
+	}
+
+
+
+
+
+	/*
+	 * Disabled:  ProfileService is JAAS-secured.
+	 * Candidate for deletion.
+	 */
+	public void DISABLEDtestManagedView() throws IOException, Exception
+	{
+
+		log.info(" ------ LISTING PROFILES -------- ");
+
+		ProfileService ps = this.getProfileService();
+		Collection<ProfileKey> profileKeys = ps.getProfileKeys();
+		printProfiles( profileKeys, ps, 0);
+
+
+		log.info(" ------ DUMPING VIEWMANAGER -------- ");
+
+		ManagementView viewManager = ps.getViewManager();
+
+		for( String name : viewManager.getTemplateNames() ){
+			DeploymentTemplateInfo template = viewManager.getTemplate(name);
+			log.debug("  * Template: "+name+";  Desc: "+template.getDescription());
+		}
+
+		viewManager.getComponentsForType( new ComponentType() );
+
+		for( String name : viewManager.getDeploymentNames() ){
+
+			ManagedDeployment deployment = viewManager.getDeployment(name);
+			log.info( "   * Deployment name: "+ deployment.getName() );
+			log.info( "     Deployment properties: "+ deployment.getProperties() );
+
+		}
+
+	}// testManagedView()
+
+
+
+
+	/*
+	 * Lists everything that is in ProfileService.
+	 */
+	public void testManagedView() throws IOException, Exception
+	{
+
+		log.info(" ------ LISTING PROFILES -------- ");
+
+		ProfileService ps = ejtt.profileService.getProfileService();
+		Collection<ProfileKey> profileKeys = ps.getProfileKeys();
+		printProfiles( profileKeys, ps, 0);
+
+
+		log.info(" ------ DUMPING VIEWMANAGER -------- ");
+
+		ManagementView viewManager = ejtt.profileService.getManagementView();
+
+		for( String name : viewManager.getTemplateNames() ){
+			DeploymentTemplateInfo template = viewManager.getTemplate(name);
+			log.debug("  * Template: "+name+";  Desc: "+template.getDescription());
+		}
+
+		for( ComponentType type : viewManager.getComponentTypes() ){
+			log.info(" * Type: "+type.toString());
+			for( ManagedComponent component : viewManager.getComponentsForType(type) ){
+				log.info("   * Component: "+component.toString());
+			}
+		}
+
+		for( String name : viewManager.getDeploymentNames() ){
+
+			ManagedDeployment deployment = viewManager.getDeployment(name);
+			log.info( "   * Deployment name: "+ deployment.getName() );
+			log.info( "     Deployment properties: "+ deployment.getProperties() );
+
+		}
+
+	}// testManagedView()
+
+
+
+
+
+
+
+	public void printProfiles( Collection<ProfileKey> profileKeys, ProfileService ps, int level ) throws NoSuchProfileException{
+
+		String spaces = StringUtils.repeat("        ", level);
+		
+		for (ProfileKey profileKey : profileKeys) {
+
+			Profile profile = ps.getProfile(profileKey);
+			log.info( spaces + " * Profile: "+ profile.getKey().toString() );
+
+			Collection<ProfileDeployment> deployments = profile.getDeployments();
+			for (ProfileDeployment deployment : deployments) {
+
+				log.info( spaces + "   * Deployment name: "+ deployment.getName() );
+				log.info( spaces + "     Deployment root: "+ deployment.getRoot() );
+
+				Map<String, Object> attachments = deployment.getAttachments();
+				for ( String key : attachments.keySet() ) {
+
+					log.info( spaces + "     * Attachment: "+ key + " = " + attachments.get(key) );
+
+				}// attachments
+
+			}// deployments
+
+			// deployments
+
+
+
+			log.info( spaces + "   * Subprofiles:");
+			Collection<ProfileKey> subProfiles = profile.getSubProfiles();
+			printProfiles(subProfiles, ps, level+1);
+
+		}// profileKeys
+
+	}
+
+
+
+
+
+}// class ProfileServiceTest

Copied: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTestUtils.java (from rev 614, trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/ProfileServiceTestUtils.java)
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTestUtils.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/ProfileServiceTestUtils.java	2009-07-29 19:03:17 UTC (rev 625)
@@ -0,0 +1,294 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit.as5.ps;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+
+import javax.naming.NamingException;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.jopr.jsfunit.EmbjoprTestCase;
+import org.jboss.jopr.jsfunit.util.jaas.SecuredProfileServiceAccess;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.profileservice.spi.ProfileKey;
+
+
+
+/**
+ * @author Ondrej Zizka, original class by Alexey Loubyansky
+ */
+public class ProfileServiceTestUtils
+   extends EmbjoprTestCase
+{
+   
+   /** We use the default profile, defined by DeploymentManager to deploy apps. */
+   public static final ProfileKey defaultProfile = new ProfileKey(ProfileKey.DEFAULT);
+   
+   protected ManagementView activeView;
+   protected DeploymentManager deployMgr;
+   private MetaValueFactory metaValueFactory;
+
+
+	 public ProfileServiceTestUtils(String name){
+      super();
+   }
+   public ProfileServiceTestUtils(){
+      super();
+   }
+
+
+	public static Test suite(){
+		return new TestSuite(ProfileServiceTestUtils.class);
+	}
+
+
+
+
+
+		/**
+		* List the contents of ProfileService.
+		*/
+		public void testProfileServiceListContent() throws NamingException, Exception{
+			ManagementView managementView = SecuredProfileServiceAccess.getInstance().getManagementView();
+
+			log.info("List of ProfileService contents (default profile):");
+
+			StringBuilder sb = new StringBuilder(4*1024);
+			for( ComponentType type : managementView.getComponentTypes() ){
+				sb.append(" * Type: ").append(type.toString()).append("\n");
+				for( ManagedComponent component : managementView.getComponentsForType(type) ){
+					sb.append("   * Component: ").append(component.toString()).append("\n");
+				}
+			}
+
+			log.info(sb.toString());
+		}
+
+
+
+
+   
+   /**
+    * @return the ProfileKey.name to use when loading the profile
+    */
+   protected String getProfileName(){ return null; }
+   
+   protected ProfileKey getProfileKey()
+   {
+      if(getProfileName() == null)
+         return defaultProfile;
+      
+      return new ProfileKey(getProfileName());
+   }
+
+   protected void removeDeployment(String deployment)
+      throws Exception
+   {
+      String names[] = new String[] {deployment};
+      DeploymentManager deployMgr_ = getDeploymentManager();
+      try
+      {
+         DeploymentProgress progress = deployMgr_.stop(names);
+         progress.run();
+         assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
+      }
+      finally
+      {
+         DeploymentProgress progress = deployMgr_.remove(names);
+         progress.run();
+         assertFalse("failed: " + progress.getDeploymentStatus().getFailure(), progress.getDeploymentStatus().isFailed());
+      }
+   }
+
+   protected void createComponentTest(String templateName,
+         Map<String, MetaValue> propValues,
+         String deploymentName,
+         ComponentType componentType, String componentName)
+         throws Exception
+   {
+      createComponentTest(templateName, propValues, deploymentName, componentType, componentName, true);
+   }
+
+   protected void createComponentTest(String templateName,
+         Map<String, MetaValue> propValues,
+         String deploymentName,
+         ComponentType componentType, String componentName,
+         boolean processChanges)
+   throws Exception
+   {
+      Set<String> removedPropNames = Collections.emptySet();
+      createComponentTest(templateName, propValues, removedPropNames,
+            deploymentName, componentType, componentName, processChanges);
+   }
+   protected void createComponentTest(String templateName,
+                                      Map<String, MetaValue> propValues,
+                                      Set<String> removedPropNames,
+                                      String deploymentName,
+                                      ComponentType componentType, String componentName,
+                                      boolean processChanges)
+      throws Exception
+   {
+      ManagementView mgtView = getManagementView();
+      DeploymentTemplateInfo info = mgtView.getTemplate(templateName);
+      assertNotNull("template " + templateName + " found", info);
+      Map<String, ManagedProperty> props = info.getProperties();
+      for(String propName : propValues.keySet())
+      {
+         ManagedProperty prop = props.get(propName);
+         log.debug("createComponentTest("+propName+") before: "+prop.getValue());
+         assertNotNull("property " + propName + " found in template " + templateName, prop);
+         prop.setValue(propValues.get(propName));
+         log.debug("createComponentTest("+propName+") after: "+prop.getValue());
+      }
+      for(String propName : removedPropNames)
+      {
+         ManagedProperty prop = props.get(propName);
+         prop.setRemoved(true);
+         log.debug("removed property: "+propName);
+      }
+
+      mgtView.applyTemplate(deploymentName, info);
+      if(processChanges)
+      {
+         mgtView.process();
+   
+         // reload the view
+         activeView = null;
+         mgtView = getManagementView();
+         ManagedComponent dsMC = getManagedComponent(mgtView, componentType, componentName);
+         assertNotNull(dsMC);
+   
+         Set<String> mcPropNames = new HashSet<String>(dsMC.getPropertyNames());
+         for(String propName : propValues.keySet())
+         {
+            ManagedProperty prop = dsMC.getProperty(propName);
+            assertNotNull(prop);
+            Object propValue = prop.getValue();
+            Object expectedValue = propValues.get(propName);
+            assertEquals(prop.getName(), expectedValue, propValue);
+   
+            mcPropNames.remove(propName);
+         }
+   
+         if(!mcPropNames.isEmpty())
+         {
+            log.warn(getName() + "> untested properties: " + mcPropNames);
+         }
+      }
+   }
+
+   /**
+    * Obtain the ProfileService.ManagementView
+    * @return
+    * @throws Exception
+    */
+   protected ManagementView getManagementView()
+      throws Exception
+   {
+		 /*
+      if( activeView == null )
+      {
+         InitialContext ctx = getInitialContext();
+         ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+         activeView = ps.getViewManager();
+         // Init the VFS to setup the vfs* protocol handlers
+         VFS.init();
+      }
+      // Reload
+      activeView.load();
+      return activeView;
+			/**/
+
+		 return SecuredProfileServiceAccess.getInstance().getManagementView();
+   }
+   /**
+    * Obtain the ProfileService.ManagementView
+    * @return
+    * @throws Exception
+    */
+   protected DeploymentManager getDeploymentManager()
+      throws Exception
+   {
+		 /*
+      if( deployMgr == null )
+      {
+         InitialContext ctx = getInitialContext();
+         ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+         deployMgr = ps.getDeploymentManager();
+         deployMgr.loadProfile(getProfileKey());
+         // Init the VFS to setup the vfs* protocol handlers
+         VFS.init();
+      }
+      return deployMgr;
+			/**/
+		 return SecuredProfileServiceAccess.getInstance().getDeploymentManager();
+   }
+
+   /**
+    * Locate the given ComponentType with the given component name.
+    *
+    * @param mgtView -
+    * @return the matching ManagedComponent if found, null otherwise
+    * @throws Exception
+    */
+   protected ManagedComponent getManagedComponent(ManagementView mgtView, ComponentType type, String name)
+      throws Exception
+   {
+      Set<ManagedComponent> comps = mgtView.getComponentsForType(type);
+      ManagedComponent mc = null;
+      for (ManagedComponent comp : comps)
+      {
+        String cname = comp.getName();
+        if( cname.endsWith(name) )
+        {
+           mc = comp;
+           break;
+        }
+      }
+      return mc;
+   }
+
+   protected MetaValueFactory getMetaValueFactory()
+   {
+      if(metaValueFactory == null)
+         metaValueFactory = MetaValueFactory.getInstance();
+      return metaValueFactory;
+   }
+
+	 InitialContext getInitialContext() throws NamingException{
+		 return new InitialContext();
+	 }
+
+}

Copied: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/RepeatedDeploymentViaPSTest.java (from rev 614, trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/RepeatedDeploymentViaPSTest.java)
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/RepeatedDeploymentViaPSTest.java	                        (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ps/RepeatedDeploymentViaPSTest.java	2009-07-29 19:03:17 UTC (rev 625)
@@ -0,0 +1,148 @@
+package org.jboss.jopr.jsfunit.as5.ps;
+
+
+
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Set;
+
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.logging.Logger;
+import org.jboss.managed.api.ManagedDeployment;
+import org.jboss.deployers.spi.management.deploy.ProgressListener;
+import org.jboss.jopr.jsfunit.AppConstants;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+
+/**
+ *  Mostly copied from
+ *  jboss-as-5.x/testsuite/src/main/org/jboss/test/profileservice/test
+ */
+public class RepeatedDeploymentViaPSTest extends ProfileServiceTestUtils implements ProgressListener {
+
+
+
+	public void testRepeatedDeploymentViaProfileService() throws Exception {
+
+
+		final String DEPLOYABLE_NAME = AppConstants.BASIC_EAR;
+		int TURNS = 100;
+
+		String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+
+		for (int i = TURNS; i > 0; i--) {
+			log.info("Remaining EAR deploys: "+i);
+			// Deploy and undeploy the EAR.
+			doDeployment(earFilePath, "ear", null);
+		}
+
+	}
+
+
+
+
+
+
+
+	public void progressEvent(org.jboss.deployers.spi.management.deploy.ProgressEvent eventInfo) {
+		getLog().debug(eventInfo);
+	}
+
+	public URL getDeployURL( String file ) throws MalformedURLException{
+		return new URL("file:///"+ System.getProperty(AppConstants.SYSPROP_DEPLOY_DIR)+'/'+file );
+	}
+
+
+
+	protected final Logger log = Logger.getLogger(this.getClass().getName());
+	Logger getLog(){ return log; }
+
+	@SuppressWarnings("deprecation")
+	protected void doDeployment(String name, String type, ManagedDeploymentTester tester) throws Exception
+	{
+		DeploymentManager deployMgr = getDeploymentManager();
+		URL contentURL = getDeployURL(name);
+		assertNotNull(contentURL);
+		getLog().debug(contentURL);
+		// TODO - hack to get off JDK's url handling
+		String urlString = contentURL.toExternalForm();
+		int p = urlString.indexOf(":/");
+		contentURL = new URL("vfszip" + urlString.substring(p));
+		getLog().debug(contentURL);
+
+		DeploymentStatus status;
+		DeploymentProgress progress = deployMgr.distribute(name, contentURL, true);
+		progress.addProgressListener(this);
+		progress.run();
+		String[] uploadedNames = {};
+		try
+		{
+			 status = progress.getDeploymentStatus();
+			 assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
+			 // It should not be running yet
+			 assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
+			 assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
+
+			 // Get the unique deployment name
+			 uploadedNames = progress.getDeploymentID().getRepositoryNames();
+			 getLog().debug("Uploaded deployment names: "+Arrays.asList(uploadedNames));
+			 // Now start the deployment
+			 progress = deployMgr.start(uploadedNames);
+			 progress.addProgressListener(this);
+			 progress.run();
+			 try
+			 {
+					status = progress.getDeploymentStatus();
+					assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
+					assertFalse("DeploymentStatus.isRunning: " + status, status.isRunning());
+					assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
+					// Check for a
+					ManagementView mgtView = getManagementView();
+					ManagedDeployment deployment = mgtView.getDeployment(uploadedNames[0]);
+					assertNotNull(deployment);
+					getLog().info("Found " + type + " deployment: " + deployment);
+					Set<String> types = deployment.getTypes();
+					if (types != null && types.isEmpty() == false)
+						 assertTrue("Missing type: " + type + ", available: " + types, types.contains(type));
+					if (tester != null)
+					{
+						 tester.testManagedDeployment();
+					}
+			 }
+			 finally
+			 {
+					//Thread.sleep(15 * 1000); // 15 secs >> more than it takes for reaper to run :-)
+
+					// Stop/remove the deployment
+					progress = deployMgr.stop(uploadedNames);
+					progress.addProgressListener(this);
+					progress.run();
+					status = progress.getDeploymentStatus();
+					assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
+					assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
+			 }
+		}
+		finally
+		{
+			 progress = deployMgr.remove(uploadedNames);
+			 progress.addProgressListener(this);
+			 progress.run();
+			 status = progress.getDeploymentStatus();
+			 assertTrue("DeploymentStatus.isCompleted: " + status, status.isCompleted());
+			 assertFalse("DeploymentStatus.isFailed: " + status, status.isFailed());
+		}
+	}
+
+
+	private interface ManagedDeploymentTester
+	{
+		void testManagedDeployment() throws Exception;
+	}
+
+}

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-07-29 18:38:10 UTC (rev 624)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2009-07-29 19:03:17 UTC (rev 625)
@@ -146,6 +146,10 @@
 		return System.getProperty(AppConstants.SYSPROP_JBOSS_CONFIG);
 	}
 
+	public boolean isJBossSecured() {
+		return System.getProperty(AppConstants.SYSPROP_JBOSS_IS_SECURED,"false").equals("true");
+	}
+
 	/**
 	 * @returns  the directory in wich the AS instance for cargo is located.
 	 *           THIS IS NOT WHERE THE AS CONFIG DIR (with deploy/ etc.) ARE.



More information about the embjopr-commits mailing list