[jboss-cvs] JBossAS SVN: r74456 - in trunk: profileservice/src/main/org/jboss/profileservice/management/upload/remoting and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 11 23:46:37 EDT 2008
Author: scott.stark at jboss.org
Date: 2008-06-11 23:46:37 -0400 (Wed, 11 Jun 2008)
New Revision: 74456
Added:
trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/
trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java
trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java
trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java
trunk/testsuite/src/main/org/jboss/test/profileservice/ejb3x/
trunk/testsuite/src/main/org/jboss/test/profileservice/sar/
trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java
trunk/testsuite/src/resources/profileservice/testEjb2xDeployment-jar.xml
trunk/testsuite/src/resources/profileservice/testSarDeployment-service.xml
Modified:
trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
trunk/testsuite/imports/sections/profileservice.xml
trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
Log:
JBAS-5370, further implementation for deploying content
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/DeploymentProgressImpl.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -88,6 +88,12 @@
case START:
start();
break;
+ case STOP:
+ stop();
+ break;
+ case UNDEPLOY:
+ undeploy();
+ break;
default:
throw new IllegalStateException(command+" is not currently handled");
}
@@ -119,6 +125,9 @@
*/
protected void notify(ProgressEvent event)
{
+ if(listeners == null)
+ return;
+
for(ProgressListener listener : listeners)
{
try
@@ -236,6 +245,95 @@
break;
}
}
-
}
+
+ protected void stop()
+ {
+ SerializableDeploymentStatus status = new SerializableDeploymentStatus(command, StateType.RUNNING);
+ status.setMessage("Running stop to: "+targets);
+ currentStatus = status;
+ ProgressEvent event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ for(DeploymentTarget target : targets)
+ {
+ if(isCancelled)
+ {
+ status = new SerializableDeploymentStatus(command, StateType.CANCELLED);
+ status.setMessage("Stop has been cancelled");
+ currentStatus = status;
+ event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ break;
+ }
+
+ try
+ {
+ target.stop(deployment);
+ status = new SerializableDeploymentStatus(command, StateType.COMPLETED);
+ status.setTarget(target);
+ status.setMessage("Completed stop for target: "+target);
+ status.setCompleted(true);
+ status.setRunning(true);
+ currentStatus = status;
+ event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ }
+ catch(Exception e)
+ {
+ status = new SerializableDeploymentStatus(command, StateType.FAILED);
+ status.setTarget(target);
+ status.setFailure(e);
+ status.setFailed(true);
+ currentStatus = status;
+ ProgressEvent error = new ProgressEvent(deployment, currentStatus);
+ notify(error);
+ break;
+ }
+ }
+ }
+
+ protected void undeploy()
+ {
+ SerializableDeploymentStatus status = new SerializableDeploymentStatus(command, StateType.RUNNING);
+ status.setMessage("Running undeploy to: "+targets);
+ currentStatus = status;
+ ProgressEvent event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ for(DeploymentTarget target : targets)
+ {
+ if(isCancelled)
+ {
+ status = new SerializableDeploymentStatus(command, StateType.CANCELLED);
+ status.setMessage("Undeploy has been cancelled");
+ currentStatus = status;
+ event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ break;
+ }
+
+ try
+ {
+ target.undeploy(deployment);
+ status = new SerializableDeploymentStatus(command, StateType.COMPLETED);
+ status.setTarget(target);
+ status.setMessage("Completed undeploy for target: "+target);
+ status.setCompleted(true);
+ status.setRunning(true);
+ currentStatus = status;
+ event = new ProgressEvent(deployment, currentStatus);
+ notify(event);
+ }
+ catch(Exception e)
+ {
+ status = new SerializableDeploymentStatus(command, StateType.FAILED);
+ status.setTarget(target);
+ status.setFailure(e);
+ status.setFailed(true);
+ currentStatus = status;
+ ProgressEvent error = new ProgressEvent(deployment, currentStatus);
+ notify(error);
+ break;
+ }
+ }
+ }
}
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/upload/remoting/DeployHandler.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -175,24 +175,29 @@
throws Exception
{
String[] names = dtID.getNames();
- log.info("start, "+Arrays.asList(names));
+ log.info("Begin start, "+Arrays.asList(names));
+ // Prevent hot deployment scans from seeing in transition deployments
+ deploymentRepository.acquireDeploymentContentLock();
for(String name : names)
{
VirtualFile vf = deploymentRepository.getDeploymentContent(name, dtID.getPhase());
VFSDeployment vfsd = createDeployment(vf);
- deploymentRepository.addDeployment(vf.getPathName(), vfsd, dtID.getPhase());
+ deploymentRepository.addDeployment(vf.getName(), vfsd, dtID.getPhase());
+ deploymentRepository.unlockDeploymentContent(vf.getPathName(), dtID.getPhase());
mainDeployer.addDeployment(vfsd);
log.info("Started: "+vfsd);
}
mainDeployer.process();
mainDeployer.checkComplete();
+ deploymentRepository.releaseDeploymentContentLock();
+ log.info("End start, "+Arrays.asList(names));
}
protected void stop(DeploymentID dtID)
throws Exception
{
String[] names = dtID.getNames();
- log.info("start, "+Arrays.asList(names));
+ log.info("stop, "+Arrays.asList(names));
for(String name : names)
{
VirtualFile vf = deploymentRepository.getDeploymentContent(name, dtID.getPhase());
@@ -208,11 +213,11 @@
throws Exception
{
String[] names = dtID.getNames();
- log.info("start, "+Arrays.asList(names));
+ log.info("undeploy, "+Arrays.asList(names));
for(String name : names)
{
VirtualFile vf = deploymentRepository.getDeploymentContent(name, dtID.getPhase());
- deploymentRepository.removeDeployment(name, dtID.getPhase());
+ deploymentRepository.removeDeployment(vf.getName(), dtID.getPhase());
log.info("Undeployed: "+name);
}
}
Modified: trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/system/src/main/org/jboss/profileservice/spi/DeploymentRepository.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -83,6 +83,17 @@
public void unlockDeploymentContent(String vfsPath, DeploymentPhase phase);
/**
+ * Acquire the repository write lock. This generally prevents content
+ * uploads and {@link #getModifiedDeployments()} calls while the lock is
+ * held.
+ */
+ public void acquireDeploymentContentLock();
+ /**
+ * Release the previously aquired repository write lock.
+ */
+ public void releaseDeploymentContentLock();
+
+ /**
* Add a deployment
*
* @param vfsPath the path
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/RepositoryAdminAdaptor.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -105,9 +105,18 @@
public void lockDeploymentContent(String vfsPath, DeploymentPhase phase)
{
// TODO Auto-generated method stub
-
}
+ public void acquireDeploymentContentLock()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void releaseDeploymentContentLock()
+ {
+ // TODO Auto-generated method stub
+ }
+
public void unlockDeploymentContent(String vfsPath, DeploymentPhase phase)
{
// TODO Auto-generated method stub
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepository.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -38,6 +38,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.zip.ZipInputStream;
@@ -296,6 +297,19 @@
lockedApps.remove(vfsPath);
}
+ public void acquireDeploymentContentLock()
+ {
+ contentLock.writeLock().lock();
+ if( log.isTraceEnabled() )
+ log.trace("acquireDeploymentContentLock, have write lock");
+ }
+ public void releaseDeploymentContentLock()
+ {
+ contentLock.writeLock().unlock();
+ if( log.isTraceEnabled() )
+ log.trace("releaseDeploymentContentLock, gave up write lock");
+ }
+
public void addDeployment(String vfsPath, VFSDeployment d, DeploymentPhase phase)
throws Exception
{
@@ -718,7 +732,22 @@
{
VFSDeployment ctx = applicationCtxs.get(vfsPath);
if( ctx == null )
- throw new NoSuchDeploymentException(vfsPath);
+ {
+ // Try to find the simple name
+ log.debug("Failed to find application for: "+vfsPath+", scanning for simple name");
+ for(VFSDeployment deployment : applicationCtxs.values())
+ {
+ log.info("Checking: "+deployment.getSimpleName());
+ if(deployment.getSimpleName().equals(vfsPath))
+ {
+ log.debug("Matched to simple name of deployment:"+deployment);
+ ctx = deployment;
+ break;
+ }
+ }
+ if(ctx == null)
+ throw new NoSuchDeploymentException(vfsPath);
+ }
return ctx;
}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/SerializableDeploymentRepositoryFactory.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -23,6 +23,7 @@
import java.io.File;
import java.net.URI;
+import java.util.HashMap;
import org.jboss.profileservice.spi.AttachmentsSerializer;
import org.jboss.profileservice.spi.DeploymentRepository;
@@ -44,6 +45,8 @@
private URI[] appURIs = {};
/** */
private AttachmentsSerializer serializer;
+ private HashMap<ProfileKey, DeploymentRepository> profileRepositories
+ = new HashMap<ProfileKey, DeploymentRepository>();
/**
* Get the server profile store root directory.
@@ -83,16 +86,21 @@
this.serializer = serializer;
}
- public DeploymentRepository getDeploymentRepository(ProfileKey key)
+ public synchronized DeploymentRepository getDeploymentRepository(ProfileKey key)
{
if (appURIs == null || appURIs.length == 0)
{
File deployDir = new File(root, key.getName()+"/deploy");
appURIs = new URI[]{deployDir.toURI()};
}
- SerializableDeploymentRepository repo = new SerializableDeploymentRepository(root, appURIs, key);
- repo.setSerializer(serializer);
- return repo;
+ DeploymentRepository dr = profileRepositories.get(key);
+ if(dr == null)
+ {
+ SerializableDeploymentRepository repo = new SerializableDeploymentRepository(root, appURIs, key);
+ repo.setSerializer(serializer);
+ profileRepositories.put(key, repo);
+ dr = repo;
+ }
+ return dr;
}
-
}
Modified: trunk/testsuite/imports/sections/profileservice.xml
===================================================================
--- trunk/testsuite/imports/sections/profileservice.xml 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/testsuite/imports/sections/profileservice.xml 2008-06-12 03:46:37 UTC (rev 74456)
@@ -11,6 +11,31 @@
<zipfileset dir="${build.resources}/profileservice/" prefix="META-INF">
<include name="testMCBeansDeployment-beans.xml"/>
</zipfileset>
- </jar>
+ </jar>
+ <!-- build testEjb3xDeployment.jar -->
+ <jar destfile="${build.lib}/testEjb3xDeployment.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/profileservice/ejb3x/**"/>
+ </fileset>
+ </jar>
+ <!-- build testEjb2xDeployment.jar -->
+ <jar destfile="${build.lib}/testEjb2xDeployment.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/profileservice/ejb2x/**"/>
+ </fileset>
+ <zipfileset dir="${build.resources}/profileservice/" fullpath="META-INF/ejb-jar.xml">
+ <include name="testEjb2xDeployment-jar.xml"/>
+ </zipfileset>
+ </jar>
+ <!-- build testSarDeployment.sar -->
+ <jar destfile="${build.lib}/testSarDeployment.sar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/profileservice/sar/**"/>
+ </fileset>
+ <zipfileset dir="${build.resources}/profileservice/" prefix="META-INF">
+ <include name="testSarDeployment-service.xml"/>
+ </zipfileset>
+ </jar>
+
</target>
</project>
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanHome.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.ejb2x;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface BeanHome extends EJBHome
+{
+ BeanRemote create() throws RemoteException, CreateException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanImpl.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.ejb2x;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class BeanImpl
+ implements SessionBean
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ public void ejbCreate() throws CreateException
+ {
+ }
+
+ public void ejbActivate()
+ {
+ }
+
+ public void ejbPassivate()
+ {
+ }
+
+ public void ejbRemove()
+ {
+ }
+
+ public void setSessionContext(SessionContext ctx)
+ {
+ }
+
+ public Object getEnvEntry(String name) throws RemoteException
+ {
+ try
+ {
+ return new InitialContext().lookup("java:/comp/env/" + name);
+ }
+ catch (NamingException e)
+ {
+ throw new EJBException(e);
+ }
+ }
+}
+
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/ejb2x/BeanRemote.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.ejb2x;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface BeanRemote extends EJBObject
+{
+ Object getEnvEntry(String name) throws RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBean.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.sar;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class BasicBean
+{
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/sar/BasicBeanMBean.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.profileservice.sar;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface BasicBeanMBean
+{
+ public String getAttr1();
+ public void setAttr1(String value);
+
+ public void op1();
+}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2008-06-12 03:44:14 UTC (rev 74455)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/DeployUnitTestCase.java 2008-06-12 03:46:37 UTC (rev 74456)
@@ -23,6 +23,8 @@
import java.net.URL;
+import javax.naming.InitialContext;
+
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
@@ -31,6 +33,8 @@
import org.jboss.deployers.spi.management.deploy.ProgressListener;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.test.profileservice.ejb2x.BeanHome;
+import org.jboss.test.profileservice.ejb2x.BeanRemote;
/**
* Profile service DeploymentManager tests
@@ -58,7 +62,7 @@
@Override
protected String getProfileName()
{
- return "default";
+ return "profileservice";
}
public void testWarDeployment()
@@ -66,8 +70,69 @@
{
DeploymentManager deployMgr = getDeploymentManager();
URL contentURL = super.getDeployURL("testWarDeployment.war");
+ assertNotNull(contentURL);
deployMgr.distribute("testWarDeployment.war", DeploymentPhase.APPLICATION, contentURL);
}
+ public void testEjb3xDeployment()
+ throws Exception
+ {
+ DeploymentManager deployMgr = getDeploymentManager();
+ URL contentURL = super.getDeployURL("testEjb3xDeployment.jar");
+ assertNotNull(contentURL);
+ deployMgr.distribute("testEjb3xDeployment.jar", DeploymentPhase.APPLICATION, contentURL);
+ }
+ public void testEjb2xDeployment()
+ throws Exception
+ {
+ DeploymentManager deployMgr = getDeploymentManager();
+ URL contentURL = super.getDeployURL("testEjb2xDeployment.jar");
+ assertNotNull(contentURL);
+ DeploymentProgress progress = deployMgr.distribute("testEjb2xDeployment.jar", DeploymentPhase.APPLICATION, contentURL);
+ progress.addProgressListener(this);
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ // It should not be running yet
+ assertFalse("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ // Now start the deployment
+ String[] names = {"testEjb2xDeployment.jar"};
+ progress = deployMgr.start(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertTrue("DeploymentStatus.isRunning", status.isRunning());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ // Check for a
+ ManagementView mgtView = super.getManagementView();
+ ManagedDeployment ejb2x = mgtView.getDeployment("testEjb2xDeployment.jar", DeploymentPhase.APPLICATION);
+ assertNotNull(ejb2x);
+ log.info("Found ejb deployment: "+ejb2x);
+ assertTrue(ejb2x.getTypes().contains("ejb2x"));
+ // Validate the ejb
+ InitialContext ic = new InitialContext();
+ BeanHome home = (BeanHome) ic.lookup("DeployUnitTestCase-testEjb2xDeployment");
+ BeanRemote bean = home.create();
+ String entry1 = (String) bean.getEnvEntry("entry1");
+ assertEquals("entry1Value", entry1);
+
+ // Remove the deployment
+ progress = deployMgr.stop(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+
+ progress = deployMgr.undeploy(DeploymentPhase.APPLICATION, names);
+ progress.addProgressListener(this);
+ progress.run();
+ status = progress.getDeploymentStatus();
+ assertTrue("DeploymentStatus.isCompleted", status.isCompleted());
+ assertFalse("DeploymentStatus.isFailed", status.isFailed());
+ }
public void testEarDeployment()
throws Exception
{
Added: trunk/testsuite/src/resources/profileservice/testEjb2xDeployment-jar.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/testEjb2xDeployment-jar.xml (rev 0)
+++ trunk/testsuite/src/resources/profileservice/testEjb2xDeployment-jar.xml 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ejb-jar version="2.1"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ >
+ <enterprise-beans>
+ <session>
+ <description>JUnit Session Bean Test Runner</description>
+ <ejb-name>DeployUnitTestCase-testEjb2xDeployment</ejb-name>
+ <home>org.jboss.test.profileservice.ejb2x.BeanHome</home>
+ <remote>org.jboss.test.profileservice.ejb2x.BeanRemote</remote>
+ <ejb-class>org.jboss.test.profileservice.ejb2x.BeanImpl</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ <env-entry>
+ <env-entry-name>entry1</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>entry1Value</env-entry-value>
+ </env-entry>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Added: trunk/testsuite/src/resources/profileservice/testSarDeployment-service.xml
===================================================================
--- trunk/testsuite/src/resources/profileservice/testSarDeployment-service.xml (rev 0)
+++ trunk/testsuite/src/resources/profileservice/testSarDeployment-service.xml 2008-06-12 03:46:37 UTC (rev 74456)
@@ -0,0 +1,6 @@
+<server>
+ <mbean code="org.jboss.test.profileservice.sar.BasicBean"
+ name="jboss.test:service=BasicBeanMBean">
+ <attribute name="Attr1">Attr1Value</attribute>
+ </mbean>
+</server>
More information about the jboss-cvs-commits
mailing list