[embjopr-commits] EMBJOPR SVN: r615 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Wed Jul 29 13:49:31 EDT 2009


Author: ozizka at redhat.com
Date: 2009-07-29 13:49:31 -0400 (Wed, 29 Jul 2009)
New Revision: 615

Removed:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/ProfileServiceTestUtils.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/RepeatedDeploymentViaPSTest.java
Log:
 * ProfileServiceTest removed from run.

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/ProfileServiceTestUtils.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/ProfileServiceTestUtils.java	2009-07-29 17:47:55 UTC (rev 614)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/ProfileServiceTestUtils.java	2009-07-29 17:49:31 UTC (rev 615)
@@ -1,294 +0,0 @@
-/*
- * 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.app.ear;
-
-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();
-	 }
-
-}

Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/RepeatedDeploymentViaPSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/RepeatedDeploymentViaPSTest.java	2009-07-29 17:47:55 UTC (rev 614)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/RepeatedDeploymentViaPSTest.java	2009-07-29 17:49:31 UTC (rev 615)
@@ -1,148 +0,0 @@
-package org.jboss.jopr.jsfunit.as5.app.ear;
-
-
-
-
-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;
-	}
-
-}



More information about the embjopr-commits mailing list