You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ad...@apache.org on 2004/02/04 06:54:08 UTC
cvs commit: incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment DeploymentTest.java WARConfigurationFactoryTest.java WebAppDConfigTest.java
adc 2004/02/03 21:54:08
Modified: modules/jetty/src/test/org/apache/geronimo/jetty
ApplicationTest.java
modules/jetty/src/test/org/apache/geronimo/jetty/deployment
DeploymentTest.java
WARConfigurationFactoryTest.java
WebAppDConfigTest.java
Log:
Some code that was temporarily commented out accidently got
checked in.
Revision Changes Path
1.5 +18 -18 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java
Index: ApplicationTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplicationTest.java 4 Feb 2004 05:45:11 -0000 1.4
+++ ApplicationTest.java 4 Feb 2004 05:54:08 -0000 1.5
@@ -89,23 +89,23 @@
private ObjectName appName;
public void testApplication() throws Exception {
-// URL url = Thread.currentThread().getContextClassLoader().getResource("deployables/war1");
-// GBeanMBean app = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO);
-// app.setAttribute("URI", URI.create(url.toString()));
-// app.setAttribute("ContextPath", "/test");
-// app.setAttribute("ComponentContext", null);
-// app.setAttribute("PolicyContextID", null);
-// app.setReferencePatterns("Configuration", Collections.EMPTY_SET);
-// app.setReferencePatterns("JettyContainer", containerPatterns);
-// app.setReferencePatterns("TransactionManager", Collections.EMPTY_SET);
-// app.setReferencePatterns("TrackedConnectionAssociator", Collections.EMPTY_SET);
-// start(appName, app);
-//
-// HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
-// BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-// assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
-// assertEquals("Hello World", reader.readLine());
-// connection.disconnect();
+ URL url = Thread.currentThread().getContextClassLoader().getResource("deployables/war1");
+ GBeanMBean app = new GBeanMBean(JettyWebApplicationContext.GBEAN_INFO);
+ app.setAttribute("URI", URI.create(url.toString()));
+ app.setAttribute("ContextPath", "/test");
+ app.setAttribute("ComponentContext", null);
+ app.setAttribute("PolicyContextID", null);
+ app.setReferencePatterns("Configuration", Collections.EMPTY_SET);
+ app.setReferencePatterns("JettyContainer", containerPatterns);
+ app.setReferencePatterns("TransactionManager", Collections.EMPTY_SET);
+ app.setReferencePatterns("TrackedConnectionAssociator", Collections.EMPTY_SET);
+ start(appName, app);
+
+ HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:5678/test/hello.txt").openConnection();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
+ assertEquals("Hello World", reader.readLine());
+ connection.disconnect();
}
private void start(ObjectName name, Object instance) throws Exception {
1.5 +32 -32 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeploymentTest.java
Index: DeploymentTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/DeploymentTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DeploymentTest.java 4 Feb 2004 05:45:11 -0000 1.4
+++ DeploymentTest.java 4 Feb 2004 05:54:08 -0000 1.5
@@ -90,40 +90,40 @@
private Target[] targets;
public void testUnpacked() throws Exception {
-// File war = new File(URI.create(classLoader.getResource("deployables/war1/").toString()));
-//
-// ProgressObject result = manager.distribute(targets, war, new File(war, "WEB-INF/geronimo-web.xml"));
-// waitFor(result);
-// TargetModuleID[] ids = result.getResultTargetModuleIDs();
-// assertEquals(1, ids.length);
-//
-// result = manager.start(ids);
-// waitFor(result);
-// checkHaveContent();
-//
-// result = manager.stop(ids);
-// waitFor(result);
-//
-// checkNoContent();
+ File war = new File(URI.create(classLoader.getResource("deployables/war1/").toString()));
+
+ ProgressObject result = manager.distribute(targets, war, new File(war, "WEB-INF/geronimo-web.xml"));
+ waitFor(result);
+ TargetModuleID[] ids = result.getResultTargetModuleIDs();
+ assertEquals(1, ids.length);
+
+ result = manager.start(ids);
+ waitFor(result);
+ checkHaveContent();
+
+ result = manager.stop(ids);
+ waitFor(result);
+
+ checkNoContent();
}
public void testPacked() throws Exception {
-// File war1 = new File(URI.create(classLoader.getResource("deployables/war1/").toString()));
-// File war2 = new File(URI.create(classLoader.getResource("deployables/war2.war").toString()));
-//
-// ProgressObject result = manager.distribute(targets, war2, new File(war1, "WEB-INF/geronimo-web.xml"));
-// waitFor(result);
-// TargetModuleID[] ids = result.getResultTargetModuleIDs();
-// assertEquals(1, ids.length);
-//
-// result = manager.start(ids);
-// waitFor(result);
-// checkHaveContent();
-//
-// result = manager.stop(ids);
-// waitFor(result);
-//
-// checkNoContent();
+ File war1 = new File(URI.create(classLoader.getResource("deployables/war1/").toString()));
+ File war2 = new File(URI.create(classLoader.getResource("deployables/war2.war").toString()));
+
+ ProgressObject result = manager.distribute(targets, war2, new File(war1, "WEB-INF/geronimo-web.xml"));
+ waitFor(result);
+ TargetModuleID[] ids = result.getResultTargetModuleIDs();
+ assertEquals(1, ids.length);
+
+ result = manager.start(ids);
+ waitFor(result);
+ checkHaveContent();
+
+ result = manager.stop(ids);
+ waitFor(result);
+
+ checkNoContent();
}
private void checkNoContent() throws IOException {
1.5 +42 -42 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WARConfigurationFactoryTest.java 4 Feb 2004 05:45:11 -0000 1.4
+++ WARConfigurationFactoryTest.java 4 Feb 2004 05:54:08 -0000 1.5
@@ -73,56 +73,56 @@
public class WARConfigurationFactoryTest extends DeployerTestCase {
public void testFactory() throws Exception {
-// WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
-// DeploymentConfiguration config = manager.createConfiguration(deployable);
-// assertEquals(deployable, config.getDeployableObject());
+ WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+ DeploymentConfiguration config = manager.createConfiguration(deployable);
+ assertEquals(deployable, config.getDeployableObject());
}
public void testConfig() throws Exception {
-// WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
-// WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
-// assertNotNull(config);
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-// config.save(baos);
-// Document doc = parser.parse(new ByteArrayInputStream(baos.toByteArray()));
-// Element root = doc.getDocumentElement();
-// assertEquals("web-app", root.getNodeName());
-// assertNull(XMLUtil.getChild(root, "context-root"));
+ WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+ WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
+ assertNotNull(config);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ config.save(baos);
+ Document doc = parser.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = doc.getDocumentElement();
+ assertEquals("web-app", root.getNodeName());
+ assertNull(XMLUtil.getChild(root, "context-root"));
}
public void testConfigSet() throws Exception {
-// WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
-// WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
-// DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
-// WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
-// contextBean.setContextRoot("/test");
-//
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-// config.save(baos);
-// Document doc = parser.parse(new ByteArrayInputStream(baos.toByteArray()));
-// Element root = doc.getDocumentElement();
-// assertEquals("web-app", root.getNodeName());
-// Element contextRoot = XMLUtil.getChild(root, "context-root");
-// assertEquals("/test", XMLUtil.getContent(contextRoot));
+ WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+ WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
+ DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
+ WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
+ contextBean.setContextRoot("/test");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ config.save(baos);
+ Document doc = parser.parse(new ByteArrayInputStream(baos.toByteArray()));
+ Element root = doc.getDocumentElement();
+ assertEquals("web-app", root.getNodeName());
+ Element contextRoot = XMLUtil.getChild(root, "context-root");
+ assertEquals("/test", XMLUtil.getContent(contextRoot));
}
public void testConfigSaveRestore() throws Exception {
-// WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
-// WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
-// DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
-// WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
-// contextBean.setContextRoot("/test");
-//
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-// config.save(baos);
-//
-// config = (WARConfiguration) warFactory.createConfiguration(deployable);
-// configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
-// contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
-//
-// assertNull(contextBean.getContextRoot());
-// config.restore(new ByteArrayInputStream(baos.toByteArray()));
-// assertEquals("/test", contextBean.getContextRoot());
+ WebDeployable deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+ WARConfiguration config = (WARConfiguration) warFactory.createConfiguration(deployable);
+ DConfigBeanRoot configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
+ WebAppDConfigBean contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
+ contextBean.setContextRoot("/test");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ config.save(baos);
+
+ config = (WARConfiguration) warFactory.createConfiguration(deployable);
+ configRoot = config.getDConfigBeanRoot(deployable.getDDBeanRoot());
+ contextBean = (WebAppDConfigBean) configRoot.getDConfigBean(deployable.getChildBean("/web-app")[0]);
+
+ assertNull(contextBean.getContextRoot());
+ config.restore(new ByteArrayInputStream(baos.toByteArray()));
+ assertEquals("/test", contextBean.getContextRoot());
}
protected void setUp() throws Exception {
1.6 +48 -48 incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java
Index: WebAppDConfigTest.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebAppDConfigTest.java 4 Feb 2004 05:45:11 -0000 1.5
+++ WebAppDConfigTest.java 4 Feb 2004 05:54:08 -0000 1.6
@@ -75,67 +75,67 @@
private WebAppDConfigRoot configRoot;
public void testWebAppRoot() throws Exception {
-// 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]));
+ 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 {
-// DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
-// WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
-// assertNotNull(webApp);
-// String[] xpaths = webApp.getXpaths();
-// assertTrue(Arrays.equals(
-// new String[]{"ejb-ref/ejb-ref-name", "ejb-local-ref/ejb-ref-name", "service-ref/service-ref-name", "resource-ref/res-ref-name", },
-// xpaths)
-// );
+ DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+ WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+ assertNotNull(webApp);
+ String[] xpaths = webApp.getXpaths();
+ assertTrue(Arrays.equals(
+ new String[]{"ejb-ref/ejb-ref-name", "ejb-local-ref/ejb-ref-name", "service-ref/service-ref-name", "resource-ref/res-ref-name", },
+ xpaths)
+ );
}
public void testEJBRef() throws Exception {
-// DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
-// WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
-// DDBean[] ddBeans = ddBean.getChildBean("ejb-ref/ejb-ref-name");
-// assertEquals(2, ddBeans.length);
-// assertEquals("fake-ejb-ref", ddBeans[0].getText());
-// assertEquals("another-ejb-ref", ddBeans[1].getText());
-//
-// URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
-// URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
-// assertNotNull(ejbRef0);
-// assertEquals(ddBeans[0], ejbRef0.getDDBean());
-// assertNotNull(ejbRef1);
-// assertEquals(ddBeans[1], ejbRef1.getDDBean());
-// assertTrue(ejbRef0 != ejbRef1);
+ DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+ WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+ DDBean[] ddBeans = ddBean.getChildBean("ejb-ref/ejb-ref-name");
+ assertEquals(2, ddBeans.length);
+ assertEquals("fake-ejb-ref", ddBeans[0].getText());
+ assertEquals("another-ejb-ref", ddBeans[1].getText());
+
+ URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
+ URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
+ assertNotNull(ejbRef0);
+ assertEquals(ddBeans[0], ejbRef0.getDDBean());
+ assertNotNull(ejbRef1);
+ assertEquals(ddBeans[1], ejbRef1.getDDBean());
+ assertTrue(ejbRef0 != ejbRef1);
}
public void testEJBLocalRef() throws Exception {
-// DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
-// WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
-// DDBean[] ddBeans = ddBean.getChildBean("ejb-local-ref/ejb-ref-name");
-// assertEquals(2, ddBeans.length);
-// assertEquals("fake-ejb-local-ref", ddBeans[0].getText());
-// assertEquals("another-ejb-local-ref", ddBeans[1].getText());
-//
-// URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
-// URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
-// assertNotNull(ejbRef0);
-// assertEquals(ddBeans[0], ejbRef0.getDDBean());
-// assertNotNull(ejbRef1);
-// assertEquals(ddBeans[1], ejbRef1.getDDBean());
-// assertTrue(ejbRef0 != ejbRef1);
+ DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
+ WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
+ DDBean[] ddBeans = ddBean.getChildBean("ejb-local-ref/ejb-ref-name");
+ assertEquals(2, ddBeans.length);
+ assertEquals("fake-ejb-local-ref", ddBeans[0].getText());
+ assertEquals("another-ejb-local-ref", ddBeans[1].getText());
+
+ URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
+ URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
+ assertNotNull(ejbRef0);
+ assertEquals(ddBeans[0], ejbRef0.getDDBean());
+ assertNotNull(ejbRef1);
+ assertEquals(ddBeans[1], ejbRef1.getDDBean());
+ assertTrue(ejbRef0 != ejbRef1);
}
protected void setUp() throws Exception {
-// super.setUp();
-// deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
-// config = manager.createConfiguration(deployable);
-//
-// ddBeanRoot = deployable.getDDBeanRoot();
-// configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
+ super.setUp();
+ deployable = new WebDeployable(classLoader.getResource("deployables/war1/"));
+ config = manager.createConfiguration(deployable);
+
+ ddBeanRoot = deployable.getDDBeanRoot();
+ configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot);
}
protected void tearDown() throws Exception {
-// super.tearDown();
+ super.tearDown();
}
}