You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jb...@apache.org on 2004/01/22 05:44:44 UTC
cvs commit: incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment DeployerTestCase.java WebAppDConfigTest.java WARConfigurationFactoryTest.java
jboynes 2004/01/21 20:44:44
Modified: modules/deployment/src/java/org/apache/geronimo/deployment/plugin
DConfigBeanSupport.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application
EARConfigBean.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client
ClientConfigBean.java
modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee
EJBRefConfigBean.java
modules/jetty/src/java/org/apache/geronimo/jetty/deployment
WARConfiguration.java
modules/jetty/src/test-resources/deployables/war1/WEB-INF
web.xml
modules/jetty/src/test/org/apache/geronimo/jetty/deployment
WARConfigurationFactoryTest.java
Added: modules/deployment/src/java/org/apache/geronimo/deployment/plugin
DConfigBeanRootSupport.java
modules/jetty/src/java/org/apache/geronimo/jetty/deployment
WebAppDConfigBean.java WebAppDConfigRoot.java
modules/jetty/src/test/org/apache/geronimo/jetty/deployment
DeployerTestCase.java WebAppDConfigTest.java
Log:
DConfig beans for webapp
Revision Changes Path
1.2 +16 -3 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java
Index: DConfigBeanSupport.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DConfigBeanSupport.java 21 Jan 2004 20:37:29 -0000 1.1
+++ DConfigBeanSupport.java 22 Jan 2004 04:44:43 -0000 1.2
@@ -59,12 +59,13 @@
import java.beans.PropertyChangeSupport;
import javax.enterprise.deploy.spi.DConfigBean;
import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
import javax.enterprise.deploy.model.DDBean;
import javax.enterprise.deploy.model.XpathEvent;
/**
- *
- *
+ *
+ *
* @version $Revision$ $Date$
*/
public abstract class DConfigBeanSupport implements DConfigBean {
@@ -77,6 +78,18 @@
public DDBean getDDBean() {
return ddBean;
+ }
+
+ public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+ return null;
+ }
+
+ public String[] getXpaths() {
+ return null;
+ }
+
+ public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException {
+ throw new BeanNotFoundException("No children");
}
public void notifyDDChange(XpathEvent event) {
1.1 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanRootSupport.java
Index: DConfigBeanRootSupport.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.deployment.plugin;
import javax.enterprise.deploy.model.DDBeanRoot;
import javax.enterprise.deploy.spi.DConfigBeanRoot;
import javax.enterprise.deploy.spi.DConfigBean;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 04:44:43 $
*/
public abstract class DConfigBeanRootSupport extends DConfigBeanSupport implements DConfigBeanRoot {
public DConfigBeanRootSupport(DDBeanRoot ddBean) {
super(ddBean);
}
public DConfigBean getDConfigBean(DDBeanRoot ddBeanRoot) {
return null;
}
}
1.2 +1 -16 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigBean.java
Index: EARConfigBean.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/application/EARConfigBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EARConfigBean.java 21 Jan 2004 20:37:29 -0000 1.1
+++ EARConfigBean.java 22 Jan 2004 04:44:43 -0000 1.2
@@ -56,9 +56,6 @@
package org.apache.geronimo.deployment.plugin.application;
import javax.enterprise.deploy.model.DDBean;
-import javax.enterprise.deploy.spi.DConfigBean;
-import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
-import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
@@ -70,17 +67,5 @@
public class EARConfigBean extends DConfigBeanSupport {
public EARConfigBean(DDBean ddBean) {
super(ddBean);
- }
-
- public String[] getXpaths() {
- return null;
- }
-
- public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
- throw new ConfigurationException();
- }
-
- public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException {
- throw new BeanNotFoundException("No children");
}
}
1.2 +3 -13 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigBean.java
Index: ClientConfigBean.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/client/ClientConfigBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClientConfigBean.java 21 Jan 2004 20:37:28 -0000 1.1
+++ ClientConfigBean.java 22 Jan 2004 04:44:43 -0000 1.2
@@ -56,15 +56,12 @@
package org.apache.geronimo.deployment.plugin.client;
import javax.enterprise.deploy.model.DDBean;
-import javax.enterprise.deploy.spi.DConfigBean;
-import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
-import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
/**
- *
- *
+ *
+ *
* @version $Revision$ $Date$
*/
public class ClientConfigBean extends DConfigBeanSupport {
@@ -79,12 +76,5 @@
public String[] getXpaths() {
return XPATHS;
- }
-
- public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
- return null;
- }
-
- public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException {
}
}
1.2 +1 -11 incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee/EJBRefConfigBean.java
Index: EJBRefConfigBean.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee/EJBRefConfigBean.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EJBRefConfigBean.java 21 Jan 2004 20:37:29 -0000 1.1
+++ EJBRefConfigBean.java 22 Jan 2004 04:44:43 -0000 1.2
@@ -56,9 +56,6 @@
package org.apache.geronimo.deployment.plugin.j2ee;
import javax.enterprise.deploy.model.DDBean;
-import javax.enterprise.deploy.spi.DConfigBean;
-import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
-import javax.enterprise.deploy.spi.exceptions.BeanNotFoundException;
import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
@@ -78,12 +75,5 @@
public String[] getXpaths() {
return XPATHS;
- }
-
- public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
- return null;
- }
-
- public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException {
}
}
1.2 +16 -3 incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfiguration.java
Index: WARConfiguration.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WARConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WARConfiguration.java 22 Jan 2004 00:51:09 -0000 1.1
+++ WARConfiguration.java 22 Jan 2004 04:44:43 -0000 1.2
@@ -56,16 +56,29 @@
package org.apache.geronimo.jetty.deployment;
import javax.enterprise.deploy.model.DeployableObject;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.spi.DConfigBeanRoot;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
import org.apache.geronimo.deployment.plugin.DeploymentConfigurationSupport;
/**
- *
- *
+ *
+ *
* @version $Revision$ $Date$
*/
public class WARConfiguration extends DeploymentConfigurationSupport {
+ private final WebAppDConfigRoot root;
+
public WARConfiguration(DeployableObject deployable) {
super(deployable);
+ root = new WebAppDConfigRoot(deployable.getDDBeanRoot());
+ }
+
+ public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot bean) throws ConfigurationException {
+ if (getDeployableObject().getDDBeanRoot().equals(bean)) {
+ return root;
+ }
+ return null;
}
}
1.1 incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WebAppDConfigBean.java
Index: WebAppDConfigBean.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.jetty.deployment;
import javax.enterprise.deploy.model.DDBean;
import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 04:44:43 $
*/
public class WebAppDConfigBean extends DConfigBeanSupport {
private String contextPath;
WebAppDConfigBean(DDBean ddBean) {
super(ddBean);
}
public String getContextPath() {
return contextPath;
}
public void setContextPath(String contextPath) {
this.contextPath = contextPath;
}
}
1.1 incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WebAppDConfigRoot.java
Index: WebAppDConfigRoot.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.jetty.deployment;
import javax.enterprise.deploy.model.DDBeanRoot;
import javax.enterprise.deploy.model.DDBean;
import javax.enterprise.deploy.spi.DConfigBean;
import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
import org.apache.geronimo.deployment.plugin.DConfigBeanRootSupport;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 04:44:43 $
*/
public class WebAppDConfigRoot extends DConfigBeanRootSupport {
private static String[] XPATHS = {
"web-app"
};
private final WebAppDConfigBean webAppBean;
public WebAppDConfigRoot(DDBeanRoot ddBean) {
super(ddBean);
webAppBean = new WebAppDConfigBean(ddBean.getChildBean("web-app")[0]);
}
public String[] getXpaths() {
return XPATHS;
}
public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
if ("/web-app".equals(bean.getXpath())) {
return webAppBean;
}
return null;
}
}
1.2 +1 -0 incubator-geronimo/modules/jetty/src/test-resources/deployables/war1/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test-resources/deployables/war1/WEB-INF/web.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- web.xml 21 Jan 2004 20:01:52 -0000 1.1
+++ web.xml 22 Jan 2004 04:44:44 -0000 1.2
@@ -2,4 +2,5 @@
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
+ <description>Test Web Deployment</description>
</web-app>
1.2 +5 -45 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WARConfigurationFactoryTest.java
Index: WARConfigurationFactoryTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WARConfigurationFactoryTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WARConfigurationFactoryTest.java 22 Jan 2004 00:51:09 -0000 1.1
+++ WARConfigurationFactoryTest.java 22 Jan 2004 04:44:44 -0000 1.2
@@ -55,59 +55,19 @@
*/
package org.apache.geronimo.jetty.deployment;
-import java.util.Collections;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
-import javax.enterprise.deploy.spi.DeploymentManager;
-import javax.management.ObjectName;
-import org.apache.geronimo.deployment.plugin.DeploymentManagerImpl;
import org.apache.geronimo.deployment.tools.loader.WebDeployable;
-import org.apache.geronimo.gbean.jmx.GBeanMBean;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.management.State;
-import junit.framework.TestCase;
/**
- *
- *
+ *
+ *
* @version $Revision$ $Date$
*/
-public class WARConfigurationFactoryTest extends TestCase {
- private Kernel kernel;
- private ObjectName managerName;
- private ObjectName warName;
- private GBeanMBean managerGBean;
-
+public class WARConfigurationFactoryTest extends DeployerTestCase {
public void testFactory() throws Exception {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- assertEquals(new Integer(State.RUNNING_INDEX), kernel.getMBeanServer().getAttribute(managerName, "state"));
- DeploymentManager manager = (DeploymentManager) managerGBean.getTarget();
- WebDeployable deployable = new WebDeployable(cl.getResource("deployables/war1/"));
+ WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
DeploymentConfiguration config = manager.createConfiguration(deployable);
assertEquals(deployable, config.getDeployableObject());
- }
-
- protected void setUp() throws Exception {
- kernel = new Kernel("test");
- kernel.boot();
-
- warName = new ObjectName("geronimo.deployment:role=WARFactory");
- GBeanMBean warFactory = new GBeanMBean(WARConfigurationFactory.GBEAN_INFO);
- kernel.loadGBean(warName, warFactory);
- kernel.startGBean(warName);
-
- managerName = new ObjectName("geronimo.deployment:role=DeploymentManager");
- managerGBean = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
- managerGBean.setEndpointPatterns("WARFactory", Collections.singleton(warName));
- kernel.loadGBean(managerName, managerGBean);
- kernel.startGBean(managerName);
- }
-
- protected void tearDown() throws Exception {
- kernel.stopGBean(managerName);
- kernel.unloadGBean(managerName);
- kernel.stopGBean(warName);
- kernel.unloadGBean(warName);
- kernel.shutdown();
}
}
1.1 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeployerTestCase.java
Index: DeployerTestCase.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.jetty.deployment;
import java.util.Collections;
import javax.management.ObjectName;
import javax.enterprise.deploy.spi.DeploymentManager;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.gbean.jmx.GBeanMBean;
import org.apache.geronimo.deployment.plugin.DeploymentManagerImpl;
import junit.framework.TestCase;
/**
* Base class for web deployer test.
* Handles setting up the deployment environment.
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 04:44:44 $
*/
public class DeployerTestCase extends TestCase {
protected Kernel kernel;
protected ObjectName managerName;
private ObjectName warName;
protected GBeanMBean managerGBean;
protected DeploymentManager manager;
protected ClassLoader classLoader;
protected void setUp() throws Exception {
classLoader = Thread.currentThread().getContextClassLoader();
kernel = new Kernel("test");
kernel.boot();
warName = new ObjectName("geronimo.deployment:role=WARFactory");
GBeanMBean warFactory = new GBeanMBean(WARConfigurationFactory.GBEAN_INFO);
kernel.loadGBean(warName, warFactory);
kernel.startGBean(warName);
managerName = new ObjectName("geronimo.deployment:role=DeploymentManager");
managerGBean = new GBeanMBean(DeploymentManagerImpl.GBEAN_INFO);
managerGBean.setEndpointPatterns("WARFactory", Collections.singleton(warName));
kernel.loadGBean(managerName, managerGBean);
kernel.startGBean(managerName);
manager = (DeploymentManager) managerGBean.getTarget();
}
protected void tearDown() throws Exception {
kernel.stopGBean(managerName);
kernel.unloadGBean(managerName);
kernel.stopGBean(warName);
kernel.unloadGBean(warName);
kernel.shutdown();
}
}
1.1 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java
Index: WebAppDConfigTest.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.jetty.deployment;
import java.util.Arrays;
import javax.enterprise.deploy.model.DDBeanRoot;
import javax.enterprise.deploy.spi.DeploymentConfiguration;
import org.apache.geronimo.deployment.tools.loader.WebDeployable;
/**
*
*
* @version $Revision: 1.1 $ $Date: 2004/01/22 04:44:44 $
*/
public class WebAppDConfigTest extends DeployerTestCase {
private DeploymentConfiguration config;
private WebDeployable deployable;
public void testWebAppRoot() throws Exception {
DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
WebAppDConfigRoot configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
assertNotNull(configRoot);
assertTrue(Arrays.equals(new String[]{"web-app"}, configRoot.getXpaths()));
assertNotNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0]));
assertNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app/description")[0]));
}
public void testWebApp() throws Exception {
DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot();
WebAppDConfigRoot configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0]);
assertNotNull(webApp);
}
protected void setUp() throws Exception {
super.setUp();
deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
config = manager.createConfiguration(deployable);
}
protected void tearDown() throws Exception {
super.tearDown();
}
}