Author: ptahchiev Date: Sat May 3 14:26:59 2008 New Revision: 653143 URL: http://svn.apache.org/viewvc?rev=653143&view=rev Log: Continue with the Cargo-1.0-SNAPSHOT integration and also applied Kazuhito's patch towards FormAuthentication.
Modified: jakarta/cactus/trunk/.classpath jakarta/cactus/trunk/framework/framework-12-13-14/src/main/java/org/apache/cactus/client/authentication/FormAuthentication.java jakarta/cactus/trunk/integration/ant/src/main/java/org/apache/cactus/integration/ant/CactifyWarTask.java jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyEarTask.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/webapp/TestWebXml.java jakarta/cactus/trunk/integration/shared-api/src/main/java/org/apache/cactus/integration/api/deployable/EarParser.java Modified: jakarta/cactus/trunk/.classpath URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/.classpath?rev=653143&r1=653142&r2=653143&view=diff ============================================================================== --- jakarta/cactus/trunk/.classpath (original) +++ jakarta/cactus/trunk/.classpath Sat May 3 14:26:59 2008 @@ -3,8 +3,6 @@ <classpathentry path="org.eclipse.jdt.launching.JRE_CONTAINER" kind="con"/> <classpathentry path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" kind="var"/> <classpathentry path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar" kind="var"/> - <classpathentry path="M2_REPO/org/codehaus/cargo/cargo-core-api-container/0.9/cargo-core-api-container-0.9.jar" kind="var"/> - <classpathentry path="M2_REPO/org/codehaus/cargo/cargo-core-uberjar/0.9/cargo-core-uberjar-0.9.jar" kind="var"/> <classpathentry path="M2_REPO/ant/ant-junit/1.6.5/ant-junit-1.6.5.jar" kind="var"/> <classpathentry path="M2_REPO/org/codehaus/cargo/cargo-ant/0.9/cargo-ant-0.9.jar" kind="var"/> <classpathentry path="framework/framework-12-13-14/src/main/java" kind="src"/> @@ -31,5 +29,10 @@ <classpathentry path="integration/ant/src/main/java" kind="src"/> <classpathentry path="integration/eclipse/org.apache.cactus.eclipse.runner/src/main/java" kind="src"/> <classpathentry path="samples/jetty/src/main/cactus" kind="src"/> + <classpathentry path="M2_REPO/org/codehaus/cargo/cargo-core-uberjar/1.0-SNAPSHOT/cargo-core-uberjar-1.0-SNAPSHOT.jar" kind="var"/> + <classpathentry path="integration/ant/src/test/java" kind="src"/> + <classpathentry path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar" kind="var"/> + <classpathentry path="M2_REPO/jmock/jmock/1.0.0/jmock-1.0.0.jar" kind="var"/> + <classpathentry path="M2_REPO/org/apache/cactus/cactus.integration.shared.api/1.8.1-SNAPSHOT/cactus.integration.shared.api-1.8.1-SNAPSHOT.jar" kind="var"/> <classpathentry path="bin" kind="output"/> </classpath> Modified: jakarta/cactus/trunk/framework/framework-12-13-14/src/main/java/org/apache/cactus/client/authentication/FormAuthentication.java URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/framework/framework-12-13-14/src/main/java/org/apache/cactus/client/authentication/FormAuthentication.java?rev=653143&r1=653142&r2=653143&view=diff ============================================================================== --- jakarta/cactus/trunk/framework/framework-12-13-14/src/main/java/org/apache/cactus/client/authentication/FormAuthentication.java (original) +++ jakarta/cactus/trunk/framework/framework-12-13-14/src/main/java/org/apache/cactus/client/authentication/FormAuthentication.java Sat May 3 14:26:59 2008 @@ -26,6 +26,8 @@ import org.apache.cactus.Cookie; import org.apache.cactus.WebRequest; +import org.apache.cactus.internal.HttpServiceDefinition; +import org.apache.cactus.internal.ServiceEnumeration; import org.apache.cactus.internal.WebRequestImpl; import org.apache.cactus.internal.client.connector.http.HttpClientConnectionHelper; import org.apache.cactus.internal.configuration.Configuration; @@ -274,6 +276,64 @@ + "] and was expecting less than 400"); } } + + /** + * @param theRequest a <code>WebRequest</code> value + * @param theConfiguration a <code>Configuration</code> value + * @exception Exception if the post-auth request results response + * other than 200 (OK). + */ + protected void checkPostAuthRequest(WebRequest theRequest, + Configuration theConfiguration) + throws Exception + { + HttpURLConnection connection; + String resource = null; + + try + { + // Create a helper that will connect to a restricted resource. + WebConfiguration webConfig = (WebConfiguration) theConfiguration; + resource = webConfig.getRedirectorURL(theRequest); + + HttpClientConnectionHelper helper = + new HttpClientConnectionHelper(resource); + + WebRequest request = getDummyRequest(webConfig); + request.addCookie(this.jsessionCookie); + + // Make the connection using a default web request. + connection = helper.connect(request, theConfiguration); + } + catch (Throwable e) + { + throw new ChainedRuntimeException( + "Failed to connect to the secured redirector: " + resource, e); + } + + if (connection.getResponseCode() != 200) + { + throw new Exception("Received a status code [" + + connection.getResponseCode() + + "] and was expecting 200"); + + } + } + + /** + * @param theWebConfiguration the <code>WebConfiguration</code> value + * @return WebReuest instance + */ + private WebRequest getDummyRequest(WebConfiguration theWebConfiguration) + { + WebRequest request = new WebRequestImpl(theWebConfiguration); + request.addParameter(HttpServiceDefinition.SERVICE_NAME_PARAM, + ServiceEnumeration.RUN_TEST_SERVICE.toString()); + return request; + } + + + /** @@ -304,8 +364,7 @@ HttpClientConnectionHelper helper = new HttpClientConnectionHelper(resource); - WebRequest request = - new WebRequestImpl((WebConfiguration) theConfiguration); + WebRequest request = getDummyRequest(webConfig); // Make the connection using a default web request. connection = helper.connect(request, theConfiguration); @@ -378,6 +437,7 @@ theConfiguration); checkAuthResponse(connection); + checkPostAuthRequest(theRequest, theConfiguration); } catch (Throwable e) { 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=653143&r1=653142&r2=653143&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 Sat May 3 14:26:59 2008 @@ -196,7 +196,7 @@ webXml = WebXmlIo.newWebXml(webXmlVersion); } - + File tmpWebXml = null; try { Modified: jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyEarTask.java URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyEarTask.java?rev=653143&r1=653142&r2=653143&view=diff ============================================================================== --- jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyEarTask.java (original) +++ jakarta/cactus/trunk/integration/ant/src/test/java/org/apache/cactus/integration/ant/TestCactifyEarTask.java Sat May 3 14:26:59 2008 @@ -22,19 +22,16 @@ import java.io.File; import java.util.Iterator; +import java.util.List; import org.codehaus.cargo.module.application.ApplicationXml; import org.codehaus.cargo.module.application.DefaultEarArchive; import org.codehaus.cargo.module.application.EarArchive; import org.codehaus.cargo.module.webapp.WarArchive; import org.codehaus.cargo.module.webapp.WebXml; -import org.codehaus.cargo.module.webapp.WebXmlTag; import org.codehaus.cargo.module.webapp.WebXmlType; import org.codehaus.cargo.module.webapp.WebXmlUtils; -import org.codehaus.cargo.module.webapp.weblogic.WeblogicXml; -import org.codehaus.cargo.module.webapp.weblogic.WeblogicXmlTag; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; +import org.jdom.Element; /** * Test class for the CactifyEar task. @@ -134,18 +131,18 @@ String theType, String theLocal, String theLocalHome) { - NodeList nl = theElement.getElementsByTagName("ejb-ref-name"); - Element f = (Element) nl.item(0); - assertEquals(theName, f.getFirstChild().getNodeValue()); - nl = theElement.getElementsByTagName("ejb-ref-type"); - f = (Element) nl.item(0); - assertEquals(theType, f.getFirstChild().getNodeValue()); - nl = theElement.getElementsByTagName("local-home"); - f = (Element) nl.item(0); - assertEquals(theLocalHome, f.getFirstChild().getNodeValue()); - nl = theElement.getElementsByTagName("local"); - f = (Element) nl.item(0); - assertEquals(theLocal, f.getFirstChild().getNodeValue()); + List nl = theElement.getChildren("ejb-ref-name"); + Element f = (Element) nl.get(0); + assertEquals(theName, f.getValue()); + nl = theElement.getChildren("ejb-ref-type"); + f = (Element) nl.get(0); + assertEquals(theType, f.getValue()); + nl = theElement.getChildren("local-home"); + f = (Element) nl.get(0); + assertEquals(theLocalHome, f.getValue()); + nl = theElement.getChildren("local"); + f = (Element) nl.get(0); + assertEquals(theLocal, f.getValue()); } /** @@ -158,11 +155,11 @@ private void assertWeblogicEjbRef(Element theElement, String theName, String theJndiName) { - NodeList nl = theElement.getElementsByTagName("ejb-ref-name"); - Element f = (Element) nl.item(0); - assertEquals(theName, f.getFirstChild().getNodeValue()); - nl = theElement.getElementsByTagName("jndi-name"); - f = (Element) nl.item(0); - assertEquals(theJndiName, f.getFirstChild().getNodeValue()); + List nl = theElement.getChildren("ejb-ref-name"); + Element f = (Element) nl.get(0); + assertEquals(theName, f.getValue()); + nl = theElement.getChildren("jndi-name"); + f = (Element) nl.get(0); + assertEquals(theJndiName, f.getValue()); } } 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=653143&r1=653142&r2=653143&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 Sat May 3 14:26:59 2008 @@ -144,8 +144,8 @@ */ public void testParseTestContextWhenWebUriDefined() throws Exception { - //String context = EarParser.parseTestContext(archive, "test.war"); - // assertEquals("testcontext", context); + String context = EarParser.parseTestContext(archive, "test.war"); + assertEquals("testcontext", context); } /** @@ -174,7 +174,7 @@ setUp(); try { - //EarParser.parse(archive, "test.war"); + EarParser.parseTestContext(archive, "test.war"); } catch (BuildException expected) { 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=653143&r1=653142&r2=653143&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 Sat May 3 14:26:59 2008 @@ -21,12 +21,9 @@ package org.apache.cactus.integration.ant.deployment.webapp; import java.io.ByteArrayInputStream; -import java.io.FileNotFoundException; import java.io.StringReader; -import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; -import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -41,12 +38,7 @@ import org.codehaus.cargo.module.webapp.WebXmlVersion; import org.codehaus.cargo.module.webapp.elements.FilterMapping; import org.codehaus.cargo.util.CargoException; -import org.jdom.Document; import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.DOMBuilder; -import org.jdom.output.DOMOutputter; -import org.w3c.dom.NodeList; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; Modified: jakarta/cactus/trunk/integration/shared-api/src/main/java/org/apache/cactus/integration/api/deployable/EarParser.java URL: http://svn.apache.org/viewvc/jakarta/cactus/trunk/integration/shared-api/src/main/java/org/apache/cactus/integration/api/deployable/EarParser.java?rev=653143&r1=653142&r2=653143&view=diff ============================================================================== --- jakarta/cactus/trunk/integration/shared-api/src/main/java/org/apache/cactus/integration/api/deployable/EarParser.java (original) +++ jakarta/cactus/trunk/integration/shared-api/src/main/java/org/apache/cactus/integration/api/deployable/EarParser.java Sat May 3 14:26:59 2008 @@ -125,7 +125,7 @@ * configration problem * @throws JDOMException */ - protected static final String parseTestContext(EarArchive theEar, + public static final String parseTestContext(EarArchive theEar, String theWebUri) throws ParserConfigurationException, IOException, SAXException, JDOMException { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]