You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by pt...@apache.org on 2009/02/03 22:46:34 UTC
svn commit: r740466 - in /jakarta/cactus/trunk/integration/ant/src:
main/java/org/apache/cactus/integration/ant/
test/java/org/apache/cactus/integration/ant/
test/java/org/apache/cactus/integration/ant/deployment/
test/java/org/apache/cactus/integratio...
Author: ptahchiev
Date: Tue Feb 3 21:46:33 2009
New Revision: 740466
URL: http://svn.apache.org/viewvc?rev=740466&view=rev
Log:
Checkstyle improved.
Modified:
jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java
jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactusWar.java
jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CargoElement.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyWarTask.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestRunServerTestsTask.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestEarParser.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestJarArchive.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXml.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXmlVersion.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWarArchive.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java
jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXmlVersion.java
Modified: jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java Tue Feb 3 21:46:33 2009
@@ -186,7 +186,8 @@
}
catch (JDOMException e)
{
- throw new BuildException("Unable to get the original exception", e);
+ throw new BuildException("Unable to get the original exception",
+ e);
}
}
if (this.srcFile == null || webXml == null)
@@ -224,7 +225,7 @@
}
setWebxml(tmpWebXml);
- if(includeCactusJars)
+ if (includeCactusJars)
{
addCactusJars();
}
@@ -332,12 +333,12 @@
* Sets whether the cactus jars should be included or not.
* If not set, the jars are included by default.
*
- * @param includeCactusJars <code>true</code> if cactus jars should be included,
- * <code>false</code> otherwise.
+ * @param hasIncludeCactusJars <code>true</code> if cactus jars
+ * should be included, <code>false</code> otherwise.
*/
- public final void setIncludeCactusJars(boolean includeCactusJars)
+ public final void setIncludeCactusJars(boolean hasIncludeCactusJars)
{
- this.includeCactusJars = includeCactusJars;
+ this.includeCactusJars = hasIncludeCactusJars;
}
@@ -645,17 +646,19 @@
*
* @return <code>java.lang.String</code>
*/
- public String getContext() {
+ public String getContext()
+ {
return context;
}
/**
* Sets the context.
*
- * @param context
+ * @param theContext to set
*/
- public void setContext(String context) {
- this.context = context;
+ public void setContext(String theContext)
+ {
+ this.context = theContext;
}
Modified: jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactusWar.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactusWar.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactusWar.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactusWar.java Tue Feb 3 21:46:33 2009
@@ -110,10 +110,10 @@
/**
* Setter method for the destination file.
- * @param destFile
+ * @param theDestFile to set
*/
- public void setDestFile(File destFile)
+ public void setDestFile(File theDestFile)
{
- this.destFile = destFile;
+ this.destFile = theDestFile;
}
}
Modified: jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CargoElement.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CargoElement.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CargoElement.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CargoElement.java Tue Feb 3 21:46:33 2009
@@ -127,6 +127,6 @@
*/
public Container getContainer()
{
- return this.container;
+ return this.container;
}
}
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyWarTask.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyWarTask.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyWarTask.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyWarTask.java Tue Feb 3 21:46:33 2009
@@ -236,7 +236,6 @@
*/
public void testDefaultRedirectors23Doctype() throws Exception
{
-
executeTestTarget();
File destFile = getProject().resolveFile("target/work/destfile.war");
@@ -289,7 +288,6 @@
*/
public void testDefaultRedirectorsNewWar23() throws Exception
{
-
executeTestTarget();
File destFile = getProject().resolveFile("target/work/destfile.war");
@@ -468,30 +466,30 @@
assertTrue(WebXmlUtils.hasSecurityRole(webXml, "test"));
assertTrue(WebXmlUtils.hasSecurityRole(webXml, "cactus"));
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml,
- "/ServletRedirectorSecure"));
+ "/ServletRedirectorSecure"));
org.jdom.Element securityConstraintElement =
- (org.jdom.Element)WebXmlUtils.getSecurityConstraint(webXml,
+ (org.jdom.Element) WebXmlUtils.getSecurityConstraint (webXml,
"/ServletRedirectorSecure");
assertNotNull(securityConstraintElement);
Element authConstraintElement = (Element)
- ((SecurityConstraint)securityConstraintElement).getChildren(
+ ((SecurityConstraint) securityConstraintElement).getChildren(
"auth-constraint").get(0);
assertNotNull(authConstraintElement);
List roleNameElements =
authConstraintElement.getChildren("role-name");
assertEquals(2, roleNameElements.size());
assertEquals("test",
- ((Element) roleNameElements.get(0)).getValue());
+ ((Element) roleNameElements.get(0)).getValue());
assertEquals("cactus",
- ((Element) roleNameElements.get(1)).getValue());
+ ((Element) roleNameElements.get(1)).getValue());
Iterator loginConfigElements =
webXml.getElements(WebXmlType.LOGIN_CONFIG);
assertTrue(loginConfigElements.hasNext());
Element loginConfigElement = (Element) loginConfigElements.next();
- Element authMethodElement = (Element)loginConfigElement.getChildren(
- "auth-method").get(0);
+ Element authMethodElement = (Element) loginConfigElement.getChildren(
+ "auth-method").get(0);
assertEquals("BASIC",
- ((Element)authMethodElement).getValue());
+ ((Element) authMethodElement).getValue());
}
/**
@@ -552,33 +550,34 @@
List nl = e.getChildren("ejb-ref-name");
Element f = (Element) nl.get(0);
- assertEquals("MyEjb", ((Element)f).getValue());
+ assertEquals("MyEjb", ((Element) f).getValue());
nl = e.getChildren("ejb-ref-type");
f = (Element) nl.get(0);
- assertEquals("Session", ((Element)f).getValue());
+ assertEquals("Session", ((Element) f).getValue());
nl = e.getChildren("local-home");
f = (Element) nl.get(0);
- assertEquals("com.wombat.MyEjbHome", ((Element)f).getValue());
+ assertEquals("com.wombat.MyEjbHome", ((Element) f).getValue());
nl = e.getChildren("local");
f = (Element) nl.get(0);
- assertEquals("com.wombat.MyEjb", ((Element)f).getValue());
+ assertEquals("com.wombat.MyEjb", ((Element) f).getValue());
// test weblogic.xml
Iterator iter = webXml.getVendorDescriptors();
WeblogicXml weblogicXml = null;
- while(iter.hasNext()) {
- weblogicXml = (WeblogicXml) iter.next();
+ while (iter.hasNext())
+ {
+ weblogicXml = (WeblogicXml) iter.next();
}
i = weblogicXml.getElements(WeblogicXmlTag.EJB_REFERENCE_DESCRIPTION);
e = (Element) i.next();
nl = e.getChildren("ejb-ref-name");
f = (Element) nl.get(0);
- assertEquals("MyEjb", ((Element)f).getValue());
+ assertEquals("MyEjb", ((Element) f).getValue());
nl = e.getChildren("jndi-name");
f = (Element) nl.get(0);
- assertEquals("/wombat/MyEjb", ((Element)f).getValue());
+ assertEquals("/wombat/MyEjb", ((Element) f).getValue());
}
// Private Methods ---------------------------------------------------------
@@ -597,7 +596,7 @@
String theFilterName, String theMapping)
{
Iterator names = WebXmlUtils.getFilterNamesForClass(theWebXml,
- theFilterClass);
+ theFilterClass);
// Look for the definition that matches the JSP servlet name
boolean found = false;
@@ -638,7 +637,7 @@
String theJspName, String theMapping)
{
Iterator names = WebXmlUtils.getServletNamesForJspFile(theWebXml,
- theJspFile);
+ theJspFile);
// Look for the definition that matches the JSP servlet name
boolean found = false;
@@ -679,7 +678,7 @@
String theServletName, String theMapping)
{
Iterator names = WebXmlUtils.getServletNamesForClass(theWebXml,
- theServletClass);
+ theServletClass);
// Look for the definition that matches the servlet name
boolean found = false;
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestRunServerTestsTask.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestRunServerTestsTask.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestRunServerTestsTask.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestRunServerTestsTask.java Tue Feb 3 21:46:33 2009
@@ -93,7 +93,7 @@
}
catch (BuildException expected)
{
- //The server failed to start for 0 ms.
+ //The server failed to start for 0 ms.
//assertEquals("Failed to start the container after more than [0] "
// + "ms.", expected.getMessage());
}
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestEarParser.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestEarParser.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestEarParser.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestEarParser.java Tue Feb 3 21:46:33 2009
@@ -27,8 +27,6 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import junit.framework.TestCase;
-
import org.apache.cactus.integration.api.deployable.EarParser;
import org.apache.tools.ant.BuildException;
import org.codehaus.cargo.module.application.ApplicationXml;
@@ -48,24 +46,24 @@
public final class TestEarParser extends MockObjectTestCase
{
/**
- * This is the actual content of the application.xml
+ * This is the actual content of the application.xml.
*/
private String webXml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<!DOCTYPE application PUBLIC \"-//Sun Microsystems, Inc.//DTD"
- + " J2EE Application 1.2//EN\" "
- + "\"http://java.sun.com/j2ee/dtds/application_1_2.dtd\">"
- + "<application>"
- + " <display-name>EJB ear</display-name>"
- + " <module>"
- + " <web>"
- + " <web-uri>test.war</web-uri>"
- + " <context-root>/testcontext</context-root>"
- + " </web>"
- + " </module>"
- + "</application>";
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<!DOCTYPE application PUBLIC \"-//Sun Microsystems, Inc.//DTD"
+ + " J2EE Application 1.2//EN\" "
+ + "\"http://java.sun.com/j2ee/dtds/application_1_2.dtd\">"
+ + "<application>"
+ + " <display-name>EJB ear</display-name>"
+ + " <module>"
+ + " <web>"
+ + " <web-uri>test.war</web-uri>"
+ + " <context-root>/testcontext</context-root>"
+ + " </web>"
+ + " </module>"
+ + "</application>";
/**
- * This is the document we use to store the application.xml
+ * This is the document we use to store the application.xml.
*/
private Document document = null;
@@ -102,35 +100,47 @@
factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setNamespaceAware(false);
- try {
- builder = factory.newDocumentBuilder();
- document = builder.parse(new ByteArrayInputStream(
- webXml.getBytes()));
- } catch (SAXException e) {
- // This should never happen;
- } catch (IOException e) {
- // This should never happen;
- } catch (ParserConfigurationException e) {
- //This shouldn't happen;
- e.printStackTrace();
- }
-
- try {
- applicationXml = ApplicationXmlIo.parseApplicationXml(
- new ByteArrayInputStream(webXml.getBytes()),null);
- } catch (IOException e) {
- // Catch the IO exception.
- e.printStackTrace();
- } catch (JDOMException e) {
- // Catch the DOM exception.
- e.printStackTrace();
- }
+ try
+ {
+ builder = factory.newDocumentBuilder();
+ document = builder.parse(new ByteArrayInputStream(
+ webXml.getBytes()));
+ }
+ catch (SAXException e)
+ {
+ // This should never happen;
+ }
+ catch (IOException e)
+ {
+ // This should never happen;
+ }
+ catch (ParserConfigurationException e)
+ {
+ //This shouldn't happen;
+ e.printStackTrace();
+ }
+
+ try
+ {
+ applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(webXml.getBytes()), null);
+ }
+ catch (IOException e)
+ {
+ // Catch the IO exception.
+ e.printStackTrace();
+ }
+ catch (JDOMException e)
+ {
+ // Catch the DOM exception.
+ e.printStackTrace();
+ }
mockArchive = new Mock(EarArchive.class);
archive = (EarArchive) mockArchive.proxy();
- mockArchive.expects( atLeastOnce() ).method( "getApplicationXml" )
- .will( returnValue(applicationXml) );
+ mockArchive.expects(atLeastOnce()).method("getApplicationXml")
+ .will(returnValue(applicationXml));
//mockArchive.expectAndReturn("getApplicationXml", applicationXml);
}
@@ -158,18 +168,18 @@
throws Exception
{
webXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<!DOCTYPE application PUBLIC \"-//Sun Microsystems, Inc.//DTD "
- + "J2EE Application 1.2//EN\" "
- + "\"http://java.sun.com/j2ee/dtds/application_1_2.dtd\">"
- + "<application>"
- + " <display-name>EJB ear</display-name>"
- + " <module>"
- + " <web>"
- + " <web-uri>test.war</web-uri>"
- + " <context-root></context-root>"
- + " </web>"
- + " </module>"
- + "</application>";
+ + "<!DOCTYPE application PUBLIC \"-//Sun Microsystems, Inc.//DTD "
+ + "J2EE Application 1.2//EN\" "
+ + "\"http://java.sun.com/j2ee/dtds/application_1_2.dtd\">"
+ + "<application>"
+ + " <display-name>EJB ear</display-name>"
+ + " <module>"
+ + " <web>"
+ + " <web-uri>test.war</web-uri>"
+ + " <context-root></context-root>"
+ + " </web>"
+ + " </module>"
+ + "</application>";
setUp();
try
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestJarArchive.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestJarArchive.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestJarArchive.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/TestJarArchive.java Tue Feb 3 21:46:33 2009
@@ -52,7 +52,7 @@
{
try
{
- new DefaultJarArchive((String)null);
+ new DefaultJarArchive((String) null);
fail("NullPointerException expected");
}
catch (NullPointerException expected)
@@ -88,7 +88,8 @@
public void testRandomAccess() throws Exception
{
JarArchive jar = new DefaultJarArchive(getTestInput(
- "org/apache/cactus/integration/ant/deployment/randomaccess.jar").getAbsolutePath());
+ "org/apache/cactus/integration/ant/deployment/randomaccess.jar")
+ .getAbsolutePath());
assertContains(jar.getResource("firstEntry.txt"), "firstEntry");
assertContains(jar.getResource("secondEntry.txt"), "secondEntry");
assertContains(jar.getResource("secondEntry.txt"), "secondEntry");
@@ -104,7 +105,8 @@
public void testContainsClass() throws Exception
{
JarArchive jar = new DefaultJarArchive(getTestInput(
- "org/apache/cactus/integration/ant/deployment/containsclass.jar").getAbsolutePath());
+ "org/apache/cactus/integration/ant/deployment/containsclass.jar")
+ .getAbsolutePath());
assertTrue(jar.containsClass("test.Test"));
}
@@ -117,7 +119,8 @@
public void testContainsClassEmpty() throws Exception
{
JarArchive jar = new DefaultJarArchive(getTestInput(
- "org/apache/cactus/integration/ant/deployment/empty.jar").getAbsolutePath());
+ "org/apache/cactus/integration/ant/deployment/empty.jar")
+ .getAbsolutePath());
assertTrue(!jar.containsClass("test.Test"));
}
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXml.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXml.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXml.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXml.java Tue Feb 3 21:46:33 2009
@@ -32,7 +32,6 @@
import org.codehaus.cargo.module.application.ApplicationXml;
import org.codehaus.cargo.module.application.ApplicationXmlIo;
-import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -109,7 +108,8 @@
+ " <java>javaclient.jar</java>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
Iterator webUris = applicationXml.getWebModuleUris();
assertTrue("No web modules defined", !webUris.hasNext());
}
@@ -131,7 +131,8 @@
+ " </web>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
Iterator webUris = applicationXml.getWebModuleUris();
assertEquals("webmodule.jar", webUris.next());
assertTrue(!webUris.hasNext());
@@ -166,7 +167,8 @@
+ " </web>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
Iterator webUris = applicationXml.getWebModuleUris();
assertEquals("webmodule1.jar", webUris.next());
assertEquals("webmodule2.jar", webUris.next());
@@ -188,7 +190,8 @@
+ " <java>javaclient.jar</java>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
try
{
applicationXml.getWebModuleContextRoot("webmodule.jar");
@@ -216,7 +219,8 @@
+ " </web>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
assertEquals("/webmodule",
applicationXml.getWebModuleContextRoot("webmodule.jar"));
}
@@ -249,7 +253,8 @@
+ " </web>"
+ " </module>"
+ "</application>";
- ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(new ByteArrayInputStream(xml.getBytes()),null);
+ ApplicationXml applicationXml = ApplicationXmlIo.parseApplicationXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
assertEquals("/webmodule1",
applicationXml.getWebModuleContextRoot("webmodule1.jar"));
assertEquals("/webmodule2",
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXmlVersion.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXmlVersion.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXmlVersion.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/application/TestApplicationXmlVersion.java Tue Feb 3 21:46:33 2009
@@ -20,7 +20,6 @@
*/
package org.apache.cactus.integration.ant.deployment.application;
-
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -29,7 +28,6 @@
import org.codehaus.cargo.module.application.ApplicationXmlVersion;
import org.jdom.DocType;
import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DocumentType;
/**
* Unit tests for {@link ApplicationXmlVersion}.
@@ -143,7 +141,7 @@
public void testValueOfDocType12() throws Exception
{
DocType docType = new DocType("application",
- ApplicationXmlVersion.V1_2.getPublicId(),
+ ApplicationXmlVersion.V1_2.getPublicId(),
ApplicationXmlVersion.V1_2.getSystemId());
assertEquals(ApplicationXmlVersion.V1_2,
ApplicationXmlVersion.valueOf(docType));
@@ -158,7 +156,7 @@
public void testValueOfDocType13() throws Exception
{
DocType docType = new DocType("application",
- ApplicationXmlVersion.V1_3.getPublicId(),
+ ApplicationXmlVersion.V1_3.getPublicId(),
ApplicationXmlVersion.V1_3.getSystemId());
assertEquals(ApplicationXmlVersion.V1_3,
ApplicationXmlVersion.valueOf(docType));
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWarArchive.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWarArchive.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWarArchive.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWarArchive.java Tue Feb 3 21:46:33 2009
@@ -47,7 +47,8 @@
public void testContainsClassInWebinfClasses() throws Exception
{
WarArchive war = new DefaultWarArchive(getTestInput(
- "org/apache/cactus/integration/ant/deployment/containsclass.war").getAbsolutePath());
+ "org/apache/cactus/integration/ant/deployment/containsclass.war")
+ .getAbsolutePath());
assertTrue(war.containsClass("test.Test"));
}
@@ -75,7 +76,8 @@
public void testContainsClassEmpty() throws Exception
{
WarArchive war = new DefaultWarArchive(getTestInput(
- "org/apache/cactus/integration/ant/deployment/empty.war").getAbsolutePath());
+ "org/apache/cactus/integration/ant/deployment/empty.war")
+ .getAbsolutePath());
assertTrue(!war.containsClass("test.Test"));
}
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXml.java Tue Feb 3 21:46:33 2009
@@ -113,7 +113,8 @@
+ "PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' "
+ "'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>"
+ "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
assertEquals(WebXmlVersion.V2_2, webXml.getVersion());
}
@@ -128,7 +129,8 @@
+ "PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' "
+ "'http://java.sun.com/dtd/web-app_2_3.dtd'>"
+ "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertEquals(WebXmlVersion.V2_3, webXml.getVersion());
}
@@ -147,11 +149,13 @@
WebXml webXml = null;
try
{
- webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- fail("Problem in parsing");
- } catch(CargoException fex)
+ webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ fail("Problem in parsing");
+ }
+ catch (CargoException fex)
{
- //expected
+ //expected
}
//assertNull(webXml.getVersion());
@@ -166,7 +170,8 @@
public void testGetVersionWithoutDoctype() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertNull(webXml.getVersion());
}
@@ -180,10 +185,11 @@
public void testHasFilterWithNullName() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
try
{
- WebXmlUtils.hasFilter(webXml,null);
+ WebXmlUtils.hasFilter(webXml, null);
fail("Expected NullPointerException");
}
catch (NullPointerException npe)
@@ -207,9 +213,10 @@
+ " <filter-class>fclass1</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- assertTrue(WebXmlUtils.hasFilter(webXml,"f1"));
- assertTrue(!WebXmlUtils.hasFilter(webXml,"f2"));
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ assertTrue(WebXmlUtils.hasFilter(webXml, "f1"));
+ assertTrue(!WebXmlUtils.hasFilter(webXml, "f2"));
}
/**
@@ -234,11 +241,12 @@
+ " <filter-class>fclass3</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- assertTrue(WebXmlUtils.hasFilter(webXml,"f1"));
- assertTrue(WebXmlUtils.hasFilter(webXml,"f2"));
- assertTrue(WebXmlUtils.hasFilter(webXml,"f3"));
- assertTrue(!WebXmlUtils.hasFilter(webXml,"f4"));
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ assertTrue(WebXmlUtils.hasFilter(webXml, "f1"));
+ assertTrue(WebXmlUtils.hasFilter(webXml, "f2"));
+ assertTrue(WebXmlUtils.hasFilter(webXml, "f3"));
+ assertTrue(!WebXmlUtils.hasFilter(webXml, "f4"));
}
/**
@@ -255,7 +263,8 @@
// + " <filter-class>fclass1</filter-class>".trim()
// + " </filter>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
// org.jdom.Element jServletElement = WebXmlUtils.getFilter(webXml, "f1");
// org.w3c.dom.Element servletElement = convertToDOM(jServletElement);
//
@@ -292,7 +301,8 @@
+ " <filter-class>fclass3</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
Iterator filterNames = WebXmlUtils.getFilterNames(webXml);
assertEquals("f1", filterNames.next());
assertEquals("f2", filterNames.next());
@@ -315,8 +325,10 @@
+ " <filter-class>f1class</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator filterNames = WebXmlUtils.getFilterNamesForClass(webXml, "f1class");
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ Iterator filterNames = WebXmlUtils.getFilterNamesForClass(
+ webXml, "f1class");
assertEquals("f1", filterNames.next());
assertTrue(!filterNames.hasNext());
}
@@ -344,8 +356,10 @@
+ " <filter-class>f1class</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator filterNames = WebXmlUtils.getFilterNamesForClass(webXml, "f1class");
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ Iterator filterNames = WebXmlUtils.getFilterNamesForClass(webXml,
+ "f1class");
assertEquals("f1", filterNames.next());
assertEquals("f3", filterNames.next());
assertTrue(!filterNames.hasNext());
@@ -364,8 +378,9 @@
+ " <url-pattern>/f1mapping</url-pattern>"
+ " </filter-mapping>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator filterMappings = WebXmlUtils.getFilterMappings(webXml,"f1");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator filterMappings = WebXmlUtils.getFilterMappings(webXml, "f1");
assertEquals("/f1mapping", filterMappings.next());
assertTrue(!filterMappings.hasNext());
}
@@ -392,11 +407,16 @@
+ " <url-pattern>/f1mapping3</url-pattern>"
+ " </filter-mapping>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator filterMappings = WebXmlUtils.getFilterMappingElements(webXml,"f1");
- assertEquals("/f1mapping1", ((FilterMapping)filterMappings.next()).getUrlPattern());
- assertEquals("/f1mapping2", ((FilterMapping)filterMappings.next()).getUrlPattern());
- assertEquals("/f1mapping3", ((FilterMapping)filterMappings.next()).getUrlPattern());
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ Iterator filterMappings = WebXmlUtils.getFilterMappingElements(webXml,
+ "f1");
+ assertEquals("/f1mapping1", ((FilterMapping)
+ filterMappings.next()).getUrlPattern());
+ assertEquals("/f1mapping2", ((FilterMapping)
+ filterMappings.next()).getUrlPattern());
+ assertEquals("/f1mapping3", ((FilterMapping)
+ filterMappings.next()).getUrlPattern());
assertTrue(!filterMappings.hasNext());
}
@@ -417,8 +437,9 @@
+ " <url-pattern>/f1mapping</url-pattern>"
+ " </filter-mapping>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator filterMappings = WebXmlUtils.getFilterMappings(webXml,"f1");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator filterMappings = WebXmlUtils.getFilterMappings(webXml, "f1");
assertEquals("/f1mapping", filterMappings.next());
assertTrue(!filterMappings.hasNext());
}
@@ -432,9 +453,10 @@
public void testAddContextParamToEmptyDocument() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addContextParam(webXml, "param", "value");
- assertTrue(WebXmlUtils.hasContextParam(webXml,"param"));
+ assertTrue(WebXmlUtils.hasContextParam(webXml, "param"));
}
/**
@@ -446,7 +468,8 @@
public void testAddFilterToEmptyDocument() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
WebXmlUtils.addFilter(webXml, "f1", "f1class");
assertTrue(WebXmlUtils.hasFilter(webXml, "f1"));
}
@@ -466,7 +489,8 @@
+ " <param-value>value1</param-value>"
+ " </context-param>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
WebXmlUtils.addContextParam(webXml, "param2", "value2");
assertTrue(WebXmlUtils.hasContextParam(webXml, "param1"));
assertTrue(WebXmlUtils.hasContextParam(webXml, "param2"));
@@ -486,7 +510,8 @@
+ " <filter-class>fclass1</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
WebXmlUtils.addFilter(webXml, "f2", "f2class");
assertTrue(WebXmlUtils.hasFilter(webXml, "f1"));
assertTrue(WebXmlUtils.hasFilter(webXml, "f2"));
@@ -508,10 +533,11 @@
+ " <param-value>value</param-value>"
+ " </context-param>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
try
{
- WebXmlUtils.addContextParam(webXml, "param", "value");
+ WebXmlUtils.addContextParam(webXml, "param", "value");
fail("Expected IllegalStateException");
}
catch (IllegalStateException ise)
@@ -534,7 +560,8 @@
+ " <filter-class>fclass1</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
try
{
WebXmlUtils.addFilter(webXml, "f1", "f1class");
@@ -560,8 +587,10 @@
+ " <filter-class>fclass1</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param1", "f1param1value");
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param1",
+ "f1param1value");
Iterator initParams = WebXmlUtils.getFilterInitParamNames(webXml, "f1");
assertEquals("f1param1", initParams.next());
@@ -582,11 +611,15 @@
+ " <filter-class>fclass1</filter-class>"
+ " </filter>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param1", "f1param1value");
- WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param2", "f1param2value");
- WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param3", "f1param3value");
- Iterator initParams = WebXmlUtils.getFilterInitParamNames(webXml,"f1");
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param1",
+ "f1param1value");
+ WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param2",
+ "f1param2value");
+ WebXmlUtils.addFilterInitParam(webXml, "f1", "f1param3",
+ "f1param3value");
+ Iterator initParams = WebXmlUtils.getFilterInitParamNames(webXml, "f1");
assertEquals("f1param1", initParams.next());
assertEquals("f1param2", initParams.next());
assertEquals("f1param3", initParams.next());
@@ -603,7 +636,8 @@
{
String xml = "<web-app>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addServlet(webXml, "f1", "f1class");
assertTrue(WebXmlUtils.hasServlet(webXml, "f1"));
}
@@ -617,7 +651,8 @@
public void testHasServletWithNullName() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
try
{
WebXmlUtils.hasServlet(webXml, null);
@@ -644,9 +679,10 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
- assertTrue(!WebXmlUtils.hasServlet(webXml,"s2"));
+ assertTrue(!WebXmlUtils.hasServlet(webXml, "s2"));
}
/**
@@ -671,11 +707,12 @@
+ " <servlet-class>sclass3</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- assertTrue(WebXmlUtils.hasServlet(webXml,"s1"));
- assertTrue(WebXmlUtils.hasServlet(webXml,"s2"));
- assertTrue(WebXmlUtils.hasServlet(webXml,"s3"));
- assertTrue(!WebXmlUtils.hasServlet(webXml,"s4"));
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
+ assertTrue(WebXmlUtils.hasServlet(webXml, "s2"));
+ assertTrue(WebXmlUtils.hasServlet(webXml, "s3"));
+ assertTrue(!WebXmlUtils.hasServlet(webXml, "s4"));
}
/**
@@ -692,8 +729,10 @@
// + " <servlet-class>sclass1</servlet-class>".trim()
// + " </servlet>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
-// org.jdom.Element jServletElement = (Element)WebXmlUtils.getServlet(webXml, "s1");
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
+// org.jdom.Element jServletElement = (Element)WebXmlUtils.getServlet(
+// webXml, "s1");
// org.w3c.dom.Element servletElement = convertToDOM(jServletElement);
//
// assertNotNull(servletElement);
@@ -730,7 +769,8 @@
+ " <servlet-class>sclass3</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
Iterator servletNames = WebXmlUtils.getServletNames(webXml);
assertEquals("s1", servletNames.next());
assertEquals("s2", servletNames.next());
@@ -753,8 +793,10 @@
+ " <servlet-class>s1class</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator servletNames = WebXmlUtils.getServletNamesForClass(webXml, "s1class");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator servletNames = WebXmlUtils.getServletNamesForClass(webXml,
+ "s1class");
assertEquals("s1", servletNames.next());
assertTrue(!servletNames.hasNext());
}
@@ -783,8 +825,10 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator servletNames = WebXmlUtils.getServletNamesForClass(webXml, "sclass1");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator servletNames = WebXmlUtils.getServletNamesForClass(webXml,
+ "sclass1");
assertEquals("s1", servletNames.next());
assertEquals("s3", servletNames.next());
assertTrue(!servletNames.hasNext());
@@ -806,8 +850,10 @@
+ " <jsp-file>/s1.jsp</jsp-file>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator servletNames = WebXmlUtils.getServletNamesForJspFile(webXml, "/s1.jsp");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator servletNames = WebXmlUtils.getServletNamesForJspFile(webXml,
+ "/s1.jsp");
assertEquals("s1", servletNames.next());
assertTrue(!servletNames.hasNext());
}
@@ -836,8 +882,10 @@
+ " <jsp-file>/s3.jsp</jsp-file>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- Iterator servletNames = WebXmlUtils.getServletNamesForJspFile(webXml, "/s3.jsp");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ Iterator servletNames = WebXmlUtils.getServletNamesForJspFile(webXml,
+ "/s3.jsp");
assertEquals("s3", servletNames.next());
assertTrue(!servletNames.hasNext());
}
@@ -856,7 +904,8 @@
+ " <url-pattern>/s1mapping</url-pattern>"
+ " </servlet-mapping>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
Iterator servletMappings = WebXmlUtils.getServletMappings(webXml, "s1");
assertEquals("/s1mapping", servletMappings.next());
assertTrue(!servletMappings.hasNext());
@@ -884,7 +933,8 @@
+ " <url-pattern>/s1mapping3</url-pattern>"
+ " </servlet-mapping>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
Iterator servletMappings = WebXmlUtils.getServletMappings(webXml, "s1");
assertEquals("/s1mapping1", servletMappings.next());
assertEquals("/s1mapping2", servletMappings.next());
@@ -900,7 +950,8 @@
public void testAddServletToEmptyDocument() throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addServlet(webXml, "s1", "s1class");
assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
}
@@ -919,10 +970,11 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addServlet(webXml, "s2", "s2class");
- assertTrue(WebXmlUtils.hasServlet(webXml,"s1"));
- assertTrue(WebXmlUtils.hasServlet(webXml,"s2"));
+ assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
+ assertTrue(WebXmlUtils.hasServlet(webXml, "s2"));
}
/**
@@ -939,7 +991,8 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
try
{
WebXmlUtils.addServlet(webXml, "s1", "s1class");
@@ -965,9 +1018,12 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- WebXmlUtils.addServletInitParam(webXml, "s1", "s1param1", "s1param1value");
- Iterator initParams = WebXmlUtils.getServletInitParamNames(webXml, "s1");
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ WebXmlUtils.addServletInitParam(webXml, "s1", "s1param1",
+ "s1param1value");
+ Iterator initParams = WebXmlUtils.getServletInitParamNames(webXml,
+ "s1");
assertEquals("s1param1", initParams.next());
assertTrue(!initParams.hasNext());
}
@@ -986,11 +1042,16 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- WebXmlUtils.addServletInitParam(webXml, "s1", "s1param1", "s1param1value");
- WebXmlUtils.addServletInitParam(webXml, "s1", "s1param2", "s1param2value");
- WebXmlUtils.addServletInitParam(webXml, "s1", "s1param3", "s1param3value");
- Iterator initParams = WebXmlUtils.getServletInitParamNames(webXml, "s1");
+ WebXml webXml = WebXmlIo.parseWebXml(
+ new ByteArrayInputStream(xml.getBytes()), null);
+ WebXmlUtils.addServletInitParam(webXml, "s1", "s1param1",
+ "s1param1value");
+ WebXmlUtils.addServletInitParam(webXml, "s1", "s1param2",
+ "s1param2value");
+ WebXmlUtils.addServletInitParam(webXml, "s1", "s1param3",
+ "s1param3value");
+ Iterator initParams = WebXmlUtils.getServletInitParamNames(webXml,
+ "s1");
assertEquals("s1param1", initParams.next());
assertEquals("s1param2", initParams.next());
assertEquals("s1param3", initParams.next());
@@ -1007,7 +1068,8 @@
{
String xml = "<web-app>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addServlet(webXml, "s1", "s1class");
assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
}
@@ -1022,7 +1084,8 @@
{
String xml = "<web-app>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addJspFile(webXml, "s1", "s1.jsp");
assertTrue(WebXmlUtils.hasServlet(webXml, "s1"));
}
@@ -1037,8 +1100,10 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
- WebXmlUtils.addSecurityConstraint(webXml, "wrn", "/url", Collections.EMPTY_LIST);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
+ WebXmlUtils.addSecurityConstraint(webXml, "wrn", "/url",
+ Collections.EMPTY_LIST);
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml, "/url"));
}
@@ -1087,7 +1152,8 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(!WebXmlUtils.hasLoginConfig(webXml));
}
@@ -1105,7 +1171,8 @@
+ " <auth-method>BASIC</auth-method>"
+ " </login-config>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(WebXmlUtils.hasLoginConfig(webXml));
}
@@ -1122,7 +1189,8 @@
+ " <auth-method>BASIC</auth-method>"
+ " </login-config>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertEquals("BASIC", WebXmlUtils.getLoginConfigAuthMethod(webXml));
}
@@ -1135,7 +1203,8 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.setLoginConfig(webXml, "BASIC", "Test Realm");
assertTrue(WebXmlUtils.hasLoginConfig(webXml));
assertEquals("BASIC", WebXmlUtils.getLoginConfigAuthMethod(webXml));
@@ -1154,7 +1223,8 @@
+ " <auth-method>DIGEST</auth-method>"
+ " </login-config>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.setLoginConfig(webXml, "BASIC", "Test Realm");
assertTrue(WebXmlUtils.hasLoginConfig(webXml));
assertEquals("BASIC", WebXmlUtils.getLoginConfigAuthMethod(webXml));
@@ -1170,7 +1240,8 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(!WebXmlUtils.hasSecurityConstraint(webXml, "/TestUrl"));
}
@@ -1191,10 +1262,11 @@
+ " </web-resource-collection>"
+ " </security-constraint>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml, "/url1"));
Element securityConstraintElement =
- (Element)WebXmlUtils.getSecurityConstraint(webXml, "/url1");
+ (Element) WebXmlUtils.getSecurityConstraint(webXml, "/url1");
assertNotNull(securityConstraintElement);
}
@@ -1227,7 +1299,8 @@
+ " </web-resource-collection>"
+ " </security-constraint>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml, "/url1"));
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml, "/url2"));
assertTrue(WebXmlUtils.hasSecurityConstraint(webXml, "/url3"));
@@ -1249,7 +1322,8 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(!webXml.getElements(WebXmlType.LOGIN_CONFIG).hasNext());
}
@@ -1262,7 +1336,8 @@
throws Exception
{
String xml = "<web-app><login-config/></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(webXml.getElements(WebXmlType.LOGIN_CONFIG).hasNext());
}
@@ -1276,7 +1351,8 @@
throws Exception
{
String xml = "<web-app></web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
assertTrue(!WebXmlUtils.hasSecurityRole(webXml, "someRole"));
assertTrue(!WebXmlUtils.getSecurityRoleNames(webXml).hasNext());
}
@@ -1388,9 +1464,11 @@
// + " <servlet-class>s1class</servlet-class>".trim()
// + " </servlet>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
// WebXmlUtils.addFilter(webXml, "f1", "f1class");
-// org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+// org.w3c.dom.Document doc = builder.parse(
+// new ByteArrayInputStream(xml.getBytes()));
// System.out.println("!@!@!@!@!@!@!@!@@!"+doc.getTextContent());
// NodeList order = doc.getDocumentElement().getChildNodes();
// assertEquals("filter", order.item(0).getNodeName());
@@ -1413,9 +1491,11 @@
// + " <servlet-class>s1class</servlet-class>".trim()
// + " </servlet>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
// WebXmlUtils.addFilter(webXml, "f1", "f1class");
-// org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+// org.w3c.dom.Document doc = builder.parse(
+// new ByteArrayInputStream(xml.getBytes()));
// NodeList order = doc.getDocumentElement().getChildNodes();
// assertEquals("filter", order.item(0).getNodeName());
// assertEquals("#comment", order.item(1).getNodeName());
@@ -1435,9 +1515,11 @@
// + " <filter-class>f1class</filter-class>".trim()
// + " </filter>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
// WebXmlUtils.addServlet(webXml, "s1", "s1class");
-// org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+// org.w3c.dom.Document doc = builder.parse(
+// new ByteArrayInputStream(xml.getBytes()));
// NodeList order = doc.getDocumentElement().getChildNodes();
// assertEquals("filter", order.item(0).getNodeName());
// assertEquals("servlet", order.item(1).getNodeName());
@@ -1459,9 +1541,11 @@
// + " <filter-class>f1class</filter-class>".trim()
// + " </filter>".trim()
// + "</web-app>";
-// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+// WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+// xml.getBytes()), null);
// WebXmlUtils.addServlet(webXml, "s1", "s1class");
-// org.w3c.dom.Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
+// org.w3c.dom.Document doc = builder.parse(
+// new ByteArrayInputStream(xml.getBytes()));
// NodeList order = doc.getDocumentElement().getChildNodes();
// assertEquals("#comment", order.item(0).getNodeName());
// assertEquals("filter", order.item(1).getNodeName());
@@ -1484,7 +1568,8 @@
+ " </run-as>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
String roleName = WebXmlUtils.getServletRunAsRoleName(webXml, "s1");
assertEquals("r1", roleName);
}
@@ -1502,7 +1587,8 @@
+ " <servlet-class>sclass1</servlet-class>"
+ " </servlet>"
+ "</web-app>";
- WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(xml.getBytes()), null);
+ WebXml webXml = WebXmlIo.parseWebXml(new ByteArrayInputStream(
+ xml.getBytes()), null);
WebXmlUtils.addServletRunAsRoleName(webXml, "s1", "r1");
String roleName = WebXmlUtils.getServletRunAsRoleName(webXml, "s1");
assertEquals("r1", roleName);
@@ -1525,7 +1611,8 @@
// Element contextParamElement =
// theDocument.createElement("context-param");
// Element paramNameElement = theDocument.createElement("param-name");
-// paramNameElement.appendChild(theDocument.createTextNode(theParamName));
+// paramNameElement.appendChild(theDocument
+// .createTextNode(theParamName));
// contextParamElement.appendChild(paramNameElement);
// Element paramValueElement = theDocument.createElement("param-value");
// paramValueElement.appendChild(
@@ -1551,7 +1638,8 @@
// filterNameElement.appendChild(
// theDocument.createTextNode(theFilterName));
// filterElement.appendChild(filterNameElement);
-// Element filterClassElement = theDocument.createElement("filter-class");
+// Element filterClassElement = theDocument.createElement(
+// "filter-class");
// filterClassElement.appendChild(
// theDocument.createTextNode(theFilterClass));
// filterElement.appendChild(filterClassElement);
@@ -1575,25 +1663,28 @@
// filterNameElement.appendChild(
// theDocument.createTextNode(theServletName));
// filterElement.appendChild(filterNameElement);
-// Element filterClassElement = theDocument.createElement("servlet-class");
+// Element filterClassElement = theDocument
+// .createElement("servlet-class");
// filterClassElement.appendChild(
// theDocument.createTextNode(theServletClass));
// filterElement.appendChild(filterClassElement);
// return filterElement;
// }
-// public org.w3c.dom.Document convertToDOM(org.jdom.Document jdomDocument) throws JDOMException
+// public org.w3c.dom.Document convertToDOM(org.jdom.Document jdomDocument)
+// throws JDOMException
// {
-// DOMOutputter outputter = new DOMOutputter();
-// return outputter.output(jdomDocument);
-//
+// DOMOutputter outputter = new DOMOutputter();
+// return outputter.output(jdomDocument);
+//
// }
//
-// public org.w3c.dom.Element convertToDOM(org.jdom.Element jdomElement) throws JDOMException
+// public org.w3c.dom.Element convertToDOM(org.jdom.Element jdomElement)
+// throws JDOMException
// {
-// org.w3c.dom.Document document = convertToDOM(jdomElement.getDocument());
-// return document.getElementById(jdomElement.getName());
-//
+// org.w3c.dom.Document document = convertToDOM(
+// jdomElement.getDocument());
+// return document.getElementById(jdomElement.getName());
// }
}
Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXmlVersion.java
URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXmlVersion.java?rev=740466&r1=740465&r2=740466&view=diff
==============================================================================
--- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXmlVersion.java (original)
+++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/deployment/webapp/TestWebXmlVersion.java Tue Feb 3 21:46:33 2009
@@ -117,7 +117,7 @@
public void testValueOfUnknownDocType() throws Exception
{
DocType docType = new DocType("web-app",
- "foo", "bar");
+ "foo", "bar");
assertNull(WebXmlVersion.valueOf(docType));
}
@@ -130,7 +130,7 @@
public void testValueOfDocType22() throws Exception
{
DocType docType = new DocType("web-app",
- WebXmlVersion.V2_2.getPublicId(), WebXmlVersion.V2_2.getSystemId());
+ WebXmlVersion.V2_2.getPublicId(), WebXmlVersion.V2_2.getSystemId());
assertEquals(WebXmlVersion.V2_2, WebXmlVersion.valueOf(docType));
}
@@ -143,7 +143,7 @@
public void testValueOfDocType23() throws Exception
{
DocType docType = new DocType("web-app",
- WebXmlVersion.V2_3.getPublicId(), WebXmlVersion.V2_3.getSystemId());
+ WebXmlVersion.V2_3.getPublicId(), WebXmlVersion.V2_3.getSystemId());
assertEquals(WebXmlVersion.V2_3, WebXmlVersion.valueOf(docType));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org