You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ol...@apache.org on 2005/01/30 22:02:42 UTC
svn commit: r149154 -
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Author: olegk
Date: Sun Jan 30 13:02:40 2005
New Revision: 149154
URL: http://svn.apache.org/viewcvs?view=rev&rev=149154
Log:
Maven workaround
Modified:
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java?view=diff&r1=149153&r2=149154
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java (original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java Sun Jan 30 13:02:40 2005
@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
* $Revision: 1.1 $
- * $Date: 2004/12/11 22:35:26 $
+ * $Date$
*
* ====================================================================
*
@@ -37,6 +37,8 @@
import javax.net.ServerSocketFactory;
import org.apache.commons.httpclient.server.SimpleSocketFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import com.sun.net.ssl.KeyManager;
import com.sun.net.ssl.KeyManagerFactory;
@@ -49,12 +51,17 @@
*/
public class SimpleSSLSocketFactory implements SimpleSocketFactory {
+ private static final Log LOG = LogFactory.getLog(SimpleSocketFactory.class);
+
private static SSLContext SSLCONTEXT = null;
private static SSLContext createSSLContext() {
try {
ClassLoader cl = SimpleSocketFactory.class.getClassLoader();
URL url = cl.getResource("org/apache/commons/httpclient/ssl/simpleserver.keystore");
+ if (url == null) {
+ url = new URL("file:src/test/org/apache/commons/httpclient/ssl/simpleserver.keystore");
+ }
KeyStore keystore = KeyStore.getInstance("jks");
keystore.load(url.openStream(), "nopassword".toCharArray());
KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(
@@ -67,6 +74,7 @@
} catch (Exception ex) {
// this is not the way a sane exception handling should be done
// but for our simple HTTP testing framework this will suffice
+ LOG.error(ex.getMessage(), ex);
throw new IllegalStateException(ex.getMessage());
}
Modified: jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java?view=diff&r1=149153&r2=149154
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java (original)
+++ jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java Sun Jan 30 13:02:40 2005
@@ -1,7 +1,7 @@
/*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java,v 1.1 2004/12/11 22:35:26 olegk Exp $
* $Revision: 1.1 $
- * $Date: 2004/12/11 22:35:26 $
+ * $Date$
*
* ====================================================================
*
@@ -41,6 +41,8 @@
import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
import org.apache.commons.httpclient.server.SimpleSocketFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import com.sun.net.ssl.SSLContext;
import com.sun.net.ssl.TrustManager;
@@ -48,12 +50,17 @@
public class SimpleSSLTestProtocolSocketFactory implements SecureProtocolSocketFactory {
+ private static final Log LOG = LogFactory.getLog(SimpleSSLTestProtocolSocketFactory.class);
+
private static SSLContext SSLCONTEXT = null;
private static SSLContext createSSLContext() {
try {
ClassLoader cl = SimpleSocketFactory.class.getClassLoader();
URL url = cl.getResource("org/apache/commons/httpclient/ssl/simpleserver.keystore");
+ if (url == null) {
+ url = new URL("file:src/test/org/apache/commons/httpclient/ssl/simpleserver.keystore");
+ }
KeyStore keystore = KeyStore.getInstance("jks");
keystore.load(url.openStream(), "nopassword".toCharArray());
TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(
@@ -66,6 +73,7 @@
} catch (Exception ex) {
// this is not the way a sane exception handling should be done
// but for our simple HTTP testing framework this will suffice
+ LOG.error(ex.getMessage(), ex);
throw new IllegalStateException(ex.getMessage());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r149154
- jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Posted by Oleg Kalnichevski <ol...@apache.org>.
> > Brett,
> >
> > Unfortunately this doesn't help. The trouble is that junit resource
> > files do not seem to be copied to <HOME>/target/test-classes/
>
> If you declare the resources inside your unit test element they should be:
>
> <unitTest>
> <includes>
> ...
> </includes>
> <resources>
> <resource>
> <directory>src/test</directory>
> <includes>
> <include>**/*.properties</include>
> </includes>
> </resource>
> </resources>
> </unitTest>
>
>
> Does that help?
>
It truly does. Many thanks, Brett
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r149154 - jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Posted by Brett Porter <br...@apache.org>.
Quoting Oleg Kalnichevski <ol...@apache.org>:
> On Mon, 2005-01-31 at 06:44 +0800, Brett Porter wrote:
> > Yuck :) Can we help fix this?
> >
> > IIRC, other people having problems have corrected them by using
> > "/org/apache/commons/..." (note leading /).
>
> Brett,
>
> Unfortunately this doesn't help. The trouble is that junit resource
> files do not seem to be copied to <HOME>/target/test-classes/
If you declare the resources inside your unit test element they should be:
<unitTest>
<includes>
...
</includes>
<resources>
<resource>
<directory>src/test</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</unitTest>
Does that help?
Cheers,
Brett
>
> If I manually copy the required resources to <HOME>/target/test-classes/
> test cases perform as expected
>
> Oleg
>
>
> > It's been a while since I read the
> > spec on this but it is because no / has a different classloader search
> criteria
> > which doesn't work inside Maven. I think another alternative is to fork the
> unit
> > tests.
> >
> > If these resolutions are correct, its probably time for a FAQ entry...
> >
> > - Brett
> >
> > Quoting "olegk@apache.org" <ol...@apache.org>:
> >
> > > Author: olegk
> > > Date: Sun Jan 30 13:02:40 2005
> > > New Revision: 149154
> > >
> > > URL: http://svn.apache.org/viewcvs?view=rev&rev=149154
> > > Log:
> > > Maven workaround
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r149154 -
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2005-01-31 at 06:44 +0800, Brett Porter wrote:
> Yuck :) Can we help fix this?
>
> IIRC, other people having problems have corrected them by using
> "/org/apache/commons/..." (note leading /).
Brett,
Unfortunately this doesn't help. The trouble is that junit resource
files do not seem to be copied to <HOME>/target/test-classes/
If I manually copy the required resources to <HOME>/target/test-classes/
test cases perform as expected
Oleg
> It's been a while since I read the
> spec on this but it is because no / has a different classloader search criteria
> which doesn't work inside Maven. I think another alternative is to fork the unit
> tests.
>
> If these resolutions are correct, its probably time for a FAQ entry...
>
> - Brett
>
> Quoting "olegk@apache.org" <ol...@apache.org>:
>
> > Author: olegk
> > Date: Sun Jan 30 13:02:40 2005
> > New Revision: 149154
> >
> > URL: http://svn.apache.org/viewcvs?view=rev&rev=149154
> > Log:
> > Maven workaround
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: svn commit: r149154 - jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLSocketFactory.java jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/ssl/SimpleSSLTestProtocolSocketFactory.java
Posted by Brett Porter <br...@apache.org>.
Yuck :) Can we help fix this?
IIRC, other people having problems have corrected them by using
"/org/apache/commons/..." (note leading /). It's been a while since I read the
spec on this but it is because no / has a different classloader search criteria
which doesn't work inside Maven. I think another alternative is to fork the unit
tests.
If these resolutions are correct, its probably time for a FAQ entry...
- Brett
Quoting "olegk@apache.org" <ol...@apache.org>:
> Author: olegk
> Date: Sun Jan 30 13:02:40 2005
> New Revision: 149154
>
> URL: http://svn.apache.org/viewcvs?view=rev&rev=149154
> Log:
> Maven workaround
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org