<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>El espacio de Jaime...</title>
	<atom:link href="http://elespaciodejaime.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://elespaciodejaime.wordpress.com</link>
	<description>Java, Linux, PHP...</description>
	<lastBuildDate>Mon, 16 Jan 2012 00:40:26 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='elespaciodejaime.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>El espacio de Jaime...</title>
		<link>http://elespaciodejaime.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://elespaciodejaime.wordpress.com/osd.xml" title="El espacio de Jaime..." />
	<atom:link rel='hub' href='http://elespaciodejaime.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WSF/Spring, Axis2 + Spring Security with WS-Signature</title>
		<link>http://elespaciodejaime.wordpress.com/2011/12/29/wsfspring-axis2-spring-security-with-ws-signature/</link>
		<comments>http://elespaciodejaime.wordpress.com/2011/12/29/wsfspring-axis2-spring-security-with-ws-signature/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 17:15:16 +0000</pubDate>
		<dc:creator>elespaciodejaime</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://elespaciodejaime.wordpress.com/?p=460</guid>
		<description><![CDATA[Spring Security and WSF/Spring Axis2 integration with WS-Signature<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=460&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hi, I want to comment my experience on setting up a web service using WSF/Spring to expose and axis2 web service and integrating this with Spring Security so the authentication gets done by spring.</p>
<p>I will asume you have already set up a web service with WSF/Spring (just WSF for brevity) + WS-Signature (using rampart) and that you know about spring security, I will only show how to add an axis2 handler to WSF to intercept incoming web services operations and authenticate them using spring security and WS-Signature.</p>
<p>Axis2 Handler for Spring Security Integration</p>
<p><pre class="brush: java;">


import util.ServiceContext;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.engine.Handler;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.ws.security.WSSecurityEngineResult;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.handler.WSHandlerResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

import javax.security.auth.Subject;
import java.security.cert.X509Certificate;
import java.util.Iterator;
import java.util.List;

/**
* Executed in a custom phase after the security phase has been proccesed
*
* Creado por: jaime
* 28/12/11
*/
public class SpringSecurityHandler extends AbstractHandler {

@Override
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {


//  get xmldsig and authenticate
List&lt;Object&gt; results = (List&lt;Object&gt;) msgContext.getProperty(WSHandlerConstants.RECV_RESULTS);
if (results == null) {
return InvocationResponse.ABORT;
}


for (Iterator iter = results.iterator(); iter.hasNext(); ) {
WSHandlerResult hr = (WSHandlerResult) iter.next();
if (hr == null || hr.getResults() == null) {
return InvocationResponse.ABORT;
}
for (Iterator it = hr.getResults().iterator(); it.hasNext(); ) {
WSSecurityEngineResult er = (WSSecurityEngineResult) it.next();
if (er != null &amp;&amp; er.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE) instanceof X509Certificate) {
X509Certificate x509Cert= (X509Certificate) er.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);

// TODO check against database

SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(x509Cert, null));


return InvocationResponse.CONTINUE;
}
}
}
return InvocationResponse.ABORT;
}

}

</pre></p>
<p>&nbsp;</p>
<p>axis2Config.xml (Displaying only modified parts)</p>
<p><pre class="brush: xml;">

&lt;bean id=&quot;axis2InFaultPhaseOrder&quot;&gt;
&lt;property name=&quot;phaseOrderType&quot; value=&quot;InFaultFlow&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;phases&quot;&gt;
&lt;list&gt;
&lt;ref bean=&quot;axis2AddressingPhase&quot;/&gt;
&lt;ref bean=&quot;security&quot;/&gt;
&lt;ref bean=&quot;springSecurityCheckPhase&quot;/&gt;
&lt;ref bean=&quot;preDispatchPhase&quot;/&gt;
&lt;bean id=&quot;InFaultDispatchPhase&quot;&gt;
&lt;property name=&quot;name&quot; value=&quot;Dispatch&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;clazz&quot; value=&quot;org.apache.axis2.engine.DispatchPhase&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;handlers&quot;&gt;
&lt;list&gt;
&lt;ref bean=&quot;RequestURI&quot;/&gt;
&lt;ref bean=&quot;SOAPAction&quot;/&gt;
&lt;ref bean=&quot;RequestURIOperation&quot;/&gt;
&lt;ref bean=&quot;SOAPMessageBody&quot;/&gt;
&lt;ref bean=&quot;HTTPLocationBased&quot;/&gt;
&lt;/list&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;/list&gt;
&lt;/property&gt;
&lt;/bean&gt;

&lt;bean id=&quot;axis2InPhaseOrder&quot;&gt;
&lt;property name=&quot;phaseOrderType&quot; value=&quot;InFlow&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;phases&quot;&gt;
&lt;list&gt;
&lt;ref bean=&quot;axis2TransportPhase&quot;/&gt;
&lt;ref bean=&quot;axis2AddressingPhase&quot;/&gt;
&lt;ref bean=&quot;security&quot;/&gt;
&lt;ref bean=&quot;springSecurityCheckPhase&quot;/&gt;
&lt;ref bean=&quot;preDispatchPhase&quot;/&gt;
&lt;bean id=&quot;InDispatchPhase&quot;&gt;
&lt;property name=&quot;name&quot; value=&quot;Dispatch&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;clazz&quot; value=&quot;org.apache.axis2.engine.DispatchPhase&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;handlers&quot;&gt;
&lt;list&gt;
&lt;ref bean=&quot;RequestURI&quot;/&gt;
&lt;ref bean=&quot;SOAPAction&quot;/&gt;
&lt;ref bean=&quot;RequestURIOperation&quot;/&gt;
&lt;ref bean=&quot;SOAPMessageBody&quot;/&gt;
&lt;ref bean=&quot;HTTPLocationBased&quot;/&gt;
&lt;/list&gt;
&lt;/property&gt;
&lt;/bean&gt;

&lt;/list&gt;
&lt;/property&gt;
&lt;/bean&gt;



....

&lt;!-- add a handler in the Security phase after SecurityInHandler--&gt;

&lt;bean id=&quot;springSecurityHandlerBean&quot;&gt;
&lt;property name=&quot;name&quot; value=&quot;SpringSecurityHandler&quot;&gt;&lt;/property&gt;
&lt;property name=&quot;clazz&quot; value=&quot;com.kprtech.service.ws.security.SpringSecurityHandler&quot;&gt;&lt;/property&gt;
&lt;/bean&gt;

&lt;bean id=&quot;springSecurityCheckPhase&quot;&gt;
&lt;property name=&quot;name&quot; value=&quot;SpringSecurityCheckPhase&quot; /&gt;
&lt;property name=&quot;handlers&quot;&gt;
&lt;list&gt;
&lt;ref bean=&quot;springSecurityHandlerBean&quot;/&gt;
&lt;/list&gt;
&lt;/property&gt;
&lt;/bean&gt;


</pre></p>
<p>The last part of xml is creating a new phase with a handler (SpringSecurityHandler) and attaching it to axis2InPhaseOrder and axis2InFaultPhaseOrder after the Security proccesing of rampart.</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/elespaciodejaime.wordpress.com/460/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/elespaciodejaime.wordpress.com/460/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/elespaciodejaime.wordpress.com/460/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=460&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://elespaciodejaime.wordpress.com/2011/12/29/wsfspring-axis2-spring-security-with-ws-signature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a910737958b20c55ae15e93529d11a09?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">elespaciodejaime</media:title>
		</media:content>
	</item>
		<item>
		<title>Beware of using your own ThreadPoolTaskExecutor and @Autowired dependencies</title>
		<link>http://elespaciodejaime.wordpress.com/2011/12/16/beware-of-using-your-own-threadpooltaskexecutor-and-autowired-dependencies/</link>
		<comments>http://elespaciodejaime.wordpress.com/2011/12/16/beware-of-using-your-own-threadpooltaskexecutor-and-autowired-dependencies/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 19:32:32 +0000</pubDate>
		<dc:creator>elespaciodejaime</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[autowired]]></category>
		<category><![CDATA[InitializingBean]]></category>

		<guid isPermaLink="false">http://elespaciodejaime.wordpress.com/?p=452</guid>
		<description><![CDATA[Problems between org.springframework.beans.factory.InitializingBean and @Autowired dependencies<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=452&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I just want to share my experience after debugging a bug caused because my own implementation of ThreadPoolTaskExecutor was using @Autowired dependencies and so initializing to early the autowired beans, which caused that @Transactional, @PreAuthorize annotations wasn&#8217;t applying its proxies.</p>
<p>I had something like this:</p>
<p><pre class="brush: java;">

public class MyThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {

@Autowired
SecurityService securityService; // this initializes SecurityService bean too early

@Override
public &lt;T&gt; Future&lt;T&gt; submit(final Callable&lt;T&gt; task) {
securityService.doSomething();
...
...
}
}

</pre></p>
<p>&nbsp;</p>
<p>But it should be something like:</p>
<p><pre class="brush: java;">
public class MyThreadPoolTaskExecutor extends ThreadPoolTaskExecutor {

@Override
public &lt;T&gt; Future&lt;T&gt; submit(final Callable&lt;T&gt; task) {

// get access through a statically exposed spring context.

ServiceContext.getBean(&quot;securityService&quot;).doSomething();
...
...
}
}


</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: java;">

public class ServiceContext implements ApplicationContextAware {

private static ApplicationContext applicationContext;


@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}

/**
* Get the bean from the Spring application context.
*
* @param beanName
* @return
*/
public static Object getBean(String beanName) {
if (applicationContext == null) {
throw new IllegalStateException(
&quot;No Spring web application context found&quot;);
}
if (!applicationContext.containsBean(beanName)) {
{
throw new IllegalArgumentException(&quot;Spring bean not found: &quot;
+ beanName);
}
}
return applicationContext.getBean(beanName);
}


}
</pre></p>
<p>&nbsp;</p>
<p>It seems to be related to the fact that autowired dependencies (other beans) of beans of type org.springframework.beans.factory.InitializingBean don&#8217;t get proxied correctly</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/elespaciodejaime.wordpress.com/452/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/elespaciodejaime.wordpress.com/452/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/elespaciodejaime.wordpress.com/452/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=452&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://elespaciodejaime.wordpress.com/2011/12/16/beware-of-using-your-own-threadpooltaskexecutor-and-autowired-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a910737958b20c55ae15e93529d11a09?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">elespaciodejaime</media:title>
		</media:content>
	</item>
		<item>
		<title>Share SmartGWT /sc folder over several modules</title>
		<link>http://elespaciodejaime.wordpress.com/2011/09/07/share-smartgwt-sc-folder-over-several-modules/</link>
		<comments>http://elespaciodejaime.wordpress.com/2011/09/07/share-smartgwt-sc-folder-over-several-modules/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 18:10:30 +0000</pubDate>
		<dc:creator>elespaciodejaime</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[smartgwt]]></category>

		<guid isPermaLink="false">http://elespaciodejaime.wordpress.com/?p=444</guid>
		<description><![CDATA[Share SmartGWT /sc folder over several modules to increase performance and compile in less time<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=444&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I would like to point to http://jajatips.blogspot.com/2010/11/share-smartgwt-js-over-several-gwt.html where there is a method that works, but isn´t really optimal because it copies theme styles and other resources several times to all the modules. This is just an improvement to that approach.</p>
<p>Create a base GWT Module:</p>
<p>BaseGWTModule.gwt.xml</p>
<p><pre class="brush: plain;">

&lt;module rename-to=&quot;basegwt&quot;&gt;

&lt;inherits name='com.google.gwt.user.User'/&gt;
&lt;inherits name='com.smartgwt.SmartGwtNoSmartClient'/&gt;

&lt;/module&gt;

</pre></p>
<p>Create a module for only serving smartgwt /sc folder:</p>
<p>SmartGWTResourcesModule.gwt.xml</p>
<p><pre class="brush: plain;">

&lt;module rename-to='smartgwt'&gt;
&lt;inherits name='com.smartgwt.SmartGwt'/&gt;
&lt;/module&gt;

</pre></p>
<p>Create several modules like this one:</p>
<p>SmartGWTSampleModule.gwt.xml</p>
<p><pre class="brush: plain;">

&lt;module rename-to=&quot;gwtmodule&quot;&gt;

&lt;inherits name='com.kprtech.gwt.BaseGWTModule'/&gt;

&lt;entry-point class='com.example.EntryPoint'/&gt;

&lt;/module&gt;

</pre></p>
<p>Then in the html use something like:</p>
<p>index.jsp</p>
<p><pre class="brush: plain;">

&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;gwtmodule/gwtmodule.nocache.js&quot;&gt;&lt;/script&gt;
&lt;script&gt; var isomorphicDir = &quot;smartgwt/sc/&quot;; &lt;/script&gt;

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/elespaciodejaime.wordpress.com/444/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/elespaciodejaime.wordpress.com/444/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/elespaciodejaime.wordpress.com/444/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=444&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://elespaciodejaime.wordpress.com/2011/09/07/share-smartgwt-sc-folder-over-several-modules/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a910737958b20c55ae15e93529d11a09?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">elespaciodejaime</media:title>
		</media:content>
	</item>
		<item>
		<title>Depurando una aplicación en Java desde línea de comandos</title>
		<link>http://elespaciodejaime.wordpress.com/2011/07/24/depurando-una-aplicacion-en-java-desde-linea-de-comandos/</link>
		<comments>http://elespaciodejaime.wordpress.com/2011/07/24/depurando-una-aplicacion-en-java-desde-linea-de-comandos/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 20:28:17 +0000</pubDate>
		<dc:creator>elespaciodejaime</dc:creator>
				<category><![CDATA[Informatica]]></category>

		<guid isPermaLink="false">http://elespaciodejaime.wordpress.com/2011/07/24/depurando-una-aplicacion-en-java-desde-linea-de-comandos/</guid>
		<description><![CDATA[En el siguiente vínculo se muestra un tutorial practiquísimo sobre como depurar una aplicación en java utilizando la herramienta jdb desde la línea de comandos. http://www.wikilearning.com/tutorial/tutorial_de_java-el_depurador_de_java_jdb/3938-52 Definitivamente puede servir si eres de esos a los que de vez en cuando les gusta hacer las cosas desde una línea de comandos. Sin embargo, no lo recomiendo [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=449&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>En el siguiente vínculo se muestra un tutorial practiquísimo sobre como depurar una aplicación en java utilizando la herramienta jdb desde la línea de comandos.</p>
<p>http://www.wikilearning.com/tutorial/tutorial_de_java-el_depurador_de_java_jdb/3938-52</p>
<p>Definitivamente puede servir si eres de esos a los que de vez en cuando les gusta hacer las cosas desde una línea de comandos. Sin embargo, no lo recomiendo para producción.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/elespaciodejaime.wordpress.com/449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/elespaciodejaime.wordpress.com/449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/elespaciodejaime.wordpress.com/449/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=449&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://elespaciodejaime.wordpress.com/2011/07/24/depurando-una-aplicacion-en-java-desde-linea-de-comandos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a910737958b20c55ae15e93529d11a09?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">elespaciodejaime</media:title>
		</media:content>
	</item>
		<item>
		<title>Probando la interfaz o la implementación</title>
		<link>http://elespaciodejaime.wordpress.com/2011/07/23/probando-la-interfaz-o-la-implementacion/</link>
		<comments>http://elespaciodejaime.wordpress.com/2011/07/23/probando-la-interfaz-o-la-implementacion/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 16:57:16 +0000</pubDate>
		<dc:creator>elespaciodejaime</dc:creator>
				<category><![CDATA[Informatica]]></category>
		<category><![CDATA[bdd]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[pruebas]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unittesting]]></category>

		<guid isPermaLink="false">http://elespaciodejaime.wordpress.com/?p=437</guid>
		<description><![CDATA[Estrategia de nombrado para clases de prueba cuando existe más de una implementación para una interfaz y se desea probar solo la realización de la interfaz.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=437&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hoy mientras escribía unas pruebas unitarias para los métodos de una interfaz me preguntaba que es lo que se debe probar, la realización de una interfaz o una implementación de esa interfaz.</p>
<p>Esto es:</p>
<p>Prueba de la realización de una interfaz:</p>
<p><pre class="brush: java;">

public class Data {
}

public interface DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
Data extractData(String encodedData);

}

</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: java;">

public class DataProviderTest {
/**
* @verifies extract data in a platform specific way
* @see DataProvider#extractData(String)
*/
@org.junit.Test
public void extractData_shouldExtractDataInAPlatformSpecificWay() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}
}

</pre></p>
<p>Prueba de la implementación</p>
<p><pre class="brush: java;">

public interface DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
Data extractData(String encodedData);

}

</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: java;">

public class DataProvideImpl1 implements DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
@Override
public Data extractData(String encodedData) {
return null;

}

/**
* @should do something impl specific
*/
void implementationSpeficMethod() {

}
}
</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: java;">

public class DataProvideImpl1Test {

/**
* @verifies extract data in a platform specific way
* @see DataProvideImpl1#extractData(String)
*/
@org.junit.Test
public void extractData_shouldExtractDataInAPlatformSpecificWay() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}
/**
* @verifies do something impl specific
* @see DataProvideImpl1#implementationSpeficMethod()
*/
@org.junit.Test
public void implementationSpeficMethod_shouldDoSomethingImplSpecific() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}

}

</pre></p>
<p>Y pues dado que la aplicación debería girar en torno a los servicios (métodos) provistos por las interfaces, y como recomienda la metodología TDD al sugerir que debemos programar concentrados en el cumplimiento de las interfaces (realizaciones) , pues parece bastante claro que nuestro principal y derepente único interés debería ser hacer que se cumpla el contrato de cada uno de los métodos de las interfaces,por lo cual es exactamente eso lo que deberían probar nuestros método y no tendrían por qué hacer algo como (ahora mismo no se me ocurre una excepción a esta regla):</p>
<p><pre class="brush: java;">&lt;/pre&gt;
/**
* @verifies do something impl specific
* @see DataProvideImpl1#implementationSpeficMethod()
*/
@org.junit.Test
public void implementationSpeficMethod_shouldDoSomethingImplSpecific() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}
&lt;pre&gt;</pre></p>
<p>Pero si es así surge un problema, qué sucede cuando tenemos más de una implementación, de qué manera nombramos a la clase de pruebas, está claro que no podría ser InterfazBajoPruebaTest, debido a que hay más de una implementación y el código en la clase InterfazBajoPruebaTest solo debería probar código para una implementación.</p>
<p><pre class="brush: java;">

public interface DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
Data extractData(String encodedData);

}

public class DataProvideImpl1 implements DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
@Override
public Data extractData(String encodedData) {
return null;

}

/**
* @should do something impl specific
*/
void implementationSpeficMethod() {

}
}

public class DataProviderImpl2 implements DataProvider{

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
@Override
public Data extractData(String encodedData) {
return null;
}
}

public class DataProviderTest {
/**
* @verifies extract data in a platform specific way
* @see DataProvider#extractData(String)
*/
@org.junit.Test
public void extractData_shouldExtractDataInAPlatformSpecificWay() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}
}
</pre></p>
<p>Por lo tanto sugiero como solución a este problema. Utilizar el nombre de las implementaciones para las clases de prueba pero solo los métodos de la interfaz implementada para la creación de los métodos de pruebas, esto es, no se deberían probar los métodos que no sean parte del contrato establecido por la interfaz.</p>
<p><pre class="brush: java;">
public interface DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
Data extractData(String encodedData);

}

public class DataProvideImpl1 implements DataProvider {

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
@Override
public Data extractData(String encodedData) {
return null;

}

/**
* do something impl specific (not tested)
*/
void implementationSpeficMethod() {

}
}

public class DataProvideImpl1Test {

/**
* @verifies extract data in a platform specific way
* @see DataProvideImpl1#extractData(String)
*/
@org.junit.Test
public void extractData_shouldExtractDataInAPlatformSpecificWay() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}

}

public class DataProviderImpl2 implements DataProvider{

/**
* @param encodedData
* @return
* @should extract data in a platform specific way
*/
@Override
public Data extractData(String encodedData) {
return null;
}
}
public class DataProviderImpl2Test {
/**
* @verifies extract data in a platform specific way
* @see DataProviderImpl2#extractData(String)
*/
@org.junit.Test
public void extractData_shouldExtractDataInAPlatformSpecificWay() throws Exception {
//TODO auto-generated
Assert.fail(&quot;Not yet implemented&quot;);
}
}

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/elespaciodejaime.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/elespaciodejaime.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/elespaciodejaime.wordpress.com/437/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=elespaciodejaime.wordpress.com&amp;blog=2634502&amp;post=437&amp;subd=elespaciodejaime&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://elespaciodejaime.wordpress.com/2011/07/23/probando-la-interfaz-o-la-implementacion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a910737958b20c55ae15e93529d11a09?s=96&#38;d=monsterid" medium="image">
			<media:title type="html">elespaciodejaime</media:title>
		</media:content>
	</item>
	</channel>
</rss>
