<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3955979283461686947</id><updated>2011-10-06T18:22:50.795+01:00</updated><category term='java maven'/><category term='python programming'/><category term='java'/><category term='logicalpractice-collections java maven'/><category term='groovy wtf'/><category term='yql stackoverflow devday'/><title type='text'>That code thing</title><subtitle type='html'>on life the universe and code.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codething.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-233554906957871431</id><published>2010-03-29T19:23:00.004+01:00</published><updated>2010-03-29T19:40:47.408+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='groovy wtf'/><title type='text'>Principle of least surprise</title><content type='html'>&lt;p&gt;So it's a pretty easy principle generally things (API's and the like) should generally do the least surprising thing. Reactions like 'What the f***' are a pretty good example of this principle being broken. Imagine my suprise when I found what the following groovy does:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;  def map = ["key1":"value1"]&lt;br /&gt;  map.get("missingKey","defaultValue")&lt;br /&gt;&lt;br /&gt;  print map&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Output:&lt;pre&gt;[key1:value1, missingKey:defaultValue]&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The get with default method actually updates the map!&lt;br /&gt;Surely that can't be a good thing to have a 'get' method update the underlying map?&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;// the preferred groovy idiom is to use the elvis operator&lt;br /&gt;print map["missingKey"]?:"defaultValue"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-233554906957871431?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/233554906957871431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=233554906957871431' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/233554906957871431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/233554906957871431'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2010/03/principle-of-least-surprise.html' title='Principle of least surprise'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-5044178713664916163</id><published>2009-10-31T14:46:00.007Z</published><updated>2009-10-31T21:20:10.392Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='yql stackoverflow devday'/><title type='text'>screen scrapping using YQL</title><content type='html'>Just attended the Cambridge DevDay, which I really enjoyed. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://icant.co.uk/"&gt;Christian Heilmann&lt;/a&gt; talked about the Yahoo query language, a very powerful tool for querying not only Yahoo dataset but arbitrary third party ones as well as a bit of URL fetching. The YQL stuff that Christian demo'd was pretty slick, but the bit that really caught my eye was the following little snippit:&lt;/div&gt;&lt;code&gt;&lt;br /&gt;select * from html where url="http://finance.yahoo.com/q?s=yhoo" and&lt;br /&gt;xpath='//div[@id="yfi_headlines"]/div[2]/ul/li/a'&lt;/code&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Try it for your self over at the &lt;a href="http://developer.yahoo.com/yql/console/?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fq%3Fs%3Dyhoo%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Fdiv%5B%40id%3D%22yfi_headlines%22%5D%2Fdiv%5B2%5D%2Ful%2Fli%2Fa'"&gt;YQL console&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So I thought I'd have a bit of a bash at screen scraping my SO profile page to see it I can my answer list on my site.&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;c:import url="http://query.yahooapis.com/v1/public/yql" var="feed"&amp;gt;&lt;br /&gt; &amp;lt;c:param name="q"&amp;gt;select * from html where url="http://stackoverflow.com/users/31480/gid" and&lt;br /&gt;xpath='//div[@class="answer-summary"]'&amp;lt;/c:param&amp;gt;&lt;br /&gt; &amp;lt;c:param name="format" value="xml"/&amp;gt;&lt;br /&gt;&amp;lt;/c:import&amp;gt;&lt;br /&gt;&amp;lt;x:parse var="xml"&amp;gt;${feed}&amp;lt;/x:parse&amp;gt;&lt;br /&gt;&amp;lt;ul class="so-answers"&amp;gt;&lt;br /&gt;&amp;lt;x:forEach select="$xml/query/results/div[@class='answer-summary']" var="answer"&lt;br /&gt;                       end="10" &amp;gt;&lt;br /&gt; &amp;lt;li class="answer"&amp;gt;&lt;br /&gt;   &amp;lt;x:set var="votes" select="$answer/div[contains(@class,'answer-votes')]"/&amp;gt;&lt;br /&gt;   &amp;lt;div class="&amp;lt;x:out select="$votes/@class"/&amp;gt;"&lt;br /&gt;        title="&amp;lt;x:out select="$votes/@title"/&amp;gt;"&amp;gt;&lt;br /&gt;    &amp;lt;x:out select="$votes"/&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;x:set var="a" select="$answer//a[contains(@class,'answer-hyperlink')]"/&amp;gt;&lt;br /&gt;   &amp;lt;div class="answer-link"&amp;gt;&lt;br /&gt;     &amp;lt;a href="http://stackoverflow.com/&amp;lt;x:out select="$a/@href"/&amp;gt;"&amp;gt;&lt;br /&gt;       &amp;lt;x:out select="$a"/&amp;gt;&lt;br /&gt;     &amp;lt;/a&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;/li&amp;gt;&lt;br /&gt;&amp;lt;/x:forEach&amp;gt;&lt;br /&gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://www.logicalpractice.com/stackoverflow.jsp"&gt;Check it out running&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;In theory it I could actually point the above &lt;code&gt;&lt;c:import&gt;&lt;/code&gt; statement directly at stackoverflow, but the rather picky xerces parser (used under the covers of the &lt;code&gt;&lt;x:parse&gt;&lt;/code&gt;) complains bitterly about DTD's and all that jazz. The YQL fetch has the nice side effect of tidying up any html ugly ness and spits out easily parsable XML.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-5044178713664916163?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/5044178713664916163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=5044178713664916163' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5044178713664916163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5044178713664916163'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2009/10/screen-scrapping-using-yql.html' title='screen scrapping using YQL'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-7490581937748587426</id><published>2009-06-02T22:14:00.005+01:00</published><updated>2009-06-02T22:19:48.632+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='logicalpractice-collections java maven'/><title type='text'>0.10 of logicalpractice-collections released</title><content type='html'>No really major changes to note. Main reason for the release is a packaging change that makes the library available via it's own maven repo, see maven setup instructions.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/logicalpractice-collections/downloads/list"&gt;Project downloads&lt;/a&gt;&lt;a href="http://code.google.com/p/logicalpractice-collections/wiki/MavenSettings"&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.google.com/p/logicalpractice-collections/wiki/MavenSettings"&gt;Maven setup instructions&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-7490581937748587426?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/7490581937748587426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=7490581937748587426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/7490581937748587426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/7490581937748587426'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2009/06/010-of-logicalpractice-collections.html' title='0.10 of logicalpractice-collections released'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-5042994772042936041</id><published>2009-03-21T08:57:00.006Z</published><updated>2009-03-27T21:46:22.070Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='python programming'/><title type='text'>Python is just a lovely thing</title><content type='html'>&lt;p&gt;I've used quite a few dynamic scripting languages over the last couple of years including groovy, ruby and python, but I keep coming back to python. I think this time it's due to Peter Butler's (a guy I worked with a while ago) complete love of the language and I think I'm starting to see why.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Over the last week I've been bashing away working on improving the rather outdated &lt;a href="http://www.logicalpractice.com/"&gt;www.logicalpractice.com&lt;/a&gt; and it occurred to me that it would be a bad idea to generate a sitemap xml for google and the other search bots.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The following code is my solution, I'm sure it's not the best python in the world but I do just kinda like the look.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;from __future__ import with_statement&lt;br /&gt;import xmlbuilder&lt;br /&gt;import sys&lt;br /&gt;import os&lt;br /&gt;from datetime import datetime&lt;br /&gt;from xml.dom.minidom import parse as parseDom&lt;br /&gt;from xml.dom.minidom import Node&lt;br /&gt;&lt;br /&gt;def url_element(xml, loc,lastmod,changefreq="weekly", priority=0.5): &lt;br /&gt; with xml.url:&lt;br /&gt;  if loc.startswith("http:"):&lt;br /&gt;   xml.loc(loc)&lt;br /&gt;  else:&lt;br /&gt;   xml.loc("http://www.logicalpractice.com%s" % loc)&lt;br /&gt;   &lt;br /&gt;  xml.lastmod(lastmod.strftime("%Y-%m-%d"))&lt;br /&gt;  xml.changefreq(changefreq)&lt;br /&gt;  xml.priority(priority)&lt;br /&gt;&lt;br /&gt;def lastmod(file_name):&lt;br /&gt; global basedir&lt;br /&gt; last_mod = os.path.getmtime(os.path.join(basedir,file_name))&lt;br /&gt; return datetime.fromtimestamp(last_mod)&lt;br /&gt; &lt;br /&gt;basedir = os.path.join(os.path.dirname(sys.argv[0]), "..","..") &lt;br /&gt;xml = xmlbuilder.builder(version="1.0",encoding="utf-8")&lt;br /&gt;&lt;br /&gt;with xml.urlset(xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"):&lt;br /&gt; url_element(xml,"/",lastmod("index.jsp"),priority=1.0)&lt;br /&gt; url_element(xml,"/news.jsp", lastmod("news.jsp"), priority=0.8)&lt;br /&gt; url_element(xml,"/projects.jsp", lastmod("projects.jsp"), priority=0.5)&lt;br /&gt; url_element(xml,"/profile.jsp", lastmod("profile.jsp"), priority=0.5)&lt;br /&gt;&lt;br /&gt; # generate elements from the news.rss&lt;br /&gt; rss = parseDom(os.path.join(basedir,"news.rss"))&lt;br /&gt; for node in rss.getElementsByTagName("item"):&lt;br /&gt;  link = node.getElementsByTagName("link")[0].firstChild.data&lt;br /&gt;  strdate = node.getElementsByTagName("pubDate")[0].firstChild.data&lt;br /&gt;  date = datetime.strptime(strdate, "%a, %d %b %Y %H:%M:%S +0000")&lt;br /&gt;  url_element(xml, link, date, priority=0.5)&lt;br /&gt;&lt;br /&gt;print xml&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;the xmlbuilder used is from &lt;a href="http://github.com/galvez/gae-rest/blob/master/xmlbuilder.py"&gt;Jonas Galvez via github&lt;/a&gt; seems a very simple and elegant solution for building xml documents&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;How do I know that python must be a good thing? Well anything that I get up at 5 in the morning to code a bit more of before work has to be a good thing.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-5042994772042936041?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/5042994772042936041/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=5042994772042936041' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5042994772042936041'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5042994772042936041'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2009/03/python-is-just-lovely-thing.html' title='Python is just a lovely thing'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-1359443172078130774</id><published>2009-02-11T21:48:00.004Z</published><updated>2009-02-11T22:22:53.184Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Java assert - what I learnt today</title><content type='html'>I learnt something new today, the following I thought would be just fine:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;File f = new File("foo.txt");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;if( f.exists() )&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'lucida grande';"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;assert f.delete();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That all looked good to me, right up to the point that I discovered that an assert expression isn't even evaluated if asserts are not enabled, had to change it to.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;if( f.exists() ){&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;boolean deleted = f.delete();&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;assert deleted;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-1359443172078130774?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/1359443172078130774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=1359443172078130774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/1359443172078130774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/1359443172078130774'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2009/02/java-assert-what-i-learnt-today.html' title='Java assert - what I learnt today'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-5960436424713241110</id><published>2008-02-08T11:13:00.002Z</published><updated>2009-03-20T22:51:28.361Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='java maven'/><title type='text'>running sureFire twice in a build</title><content type='html'>I've run into this a couple of times in my experience with maven2. A single module web project, nothing to complex, just some servlets and a simple data access layer. What I wanted to be able to do was run both unit tests and integration tests both written with JUnit. So initially I started with:&lt;br /&gt;&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;&amp;lt;plugin&amp;gt;&lt;br /&gt; &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt; &amp;lt;configuration&amp;gt;&lt;br /&gt;     &amp;lt;skip&amp;gt;true&amp;lt;/skip&amp;gt;&lt;br /&gt; &amp;lt;/configuration&amp;gt;&lt;br /&gt; &amp;lt;executions&amp;gt;&lt;br /&gt;     &amp;lt;execution&amp;gt;&lt;br /&gt;         &amp;lt;id&amp;gt;integration-test&amp;lt;/id&amp;gt;&lt;br /&gt;         &amp;lt;phase&amp;gt;integration-test&amp;lt;/phase&amp;gt;&lt;br /&gt;         &amp;lt;goals&amp;gt;&lt;br /&gt;             &amp;lt;goal&amp;gt;test&amp;lt;/goal&amp;gt;&lt;br /&gt;         &amp;lt;/goals&amp;gt;&lt;br /&gt;         &amp;lt;configuration&amp;gt;&lt;br /&gt;             &amp;lt;skip&amp;gt;false&amp;lt;/skip&amp;gt;&lt;br /&gt;         &amp;lt;/configuration&amp;gt;&lt;br /&gt;     &amp;lt;/execution&amp;gt;&lt;br /&gt; &amp;lt;/executions&amp;gt;&lt;br /&gt;&amp;lt;/plugin&amp;gt;&lt;br /&gt;&lt;/pre&gt;This seemed like at least half the solution. It moves the test run to integration-test, where both the unit test and integration tests run. Not so bad I figured, I worked with this for the last couple of months and it's been bugging me. Last week I came up with:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;plugin&gt;&lt;executions&gt;&amp;lt;plugin&amp;gt;&lt;br /&gt; &amp;lt;artifactId&amp;gt;maven-surefire-plugin&amp;lt;/artifactId&amp;gt;&lt;br /&gt; &amp;lt;configuration&amp;gt;&lt;br /&gt;     &amp;lt;skip&amp;gt;true&amp;lt;/skip&amp;gt;&lt;br /&gt; &amp;lt;/configuration&amp;gt;&lt;br /&gt; &amp;lt;executions&amp;gt;&lt;br /&gt;     &amp;lt;execution&amp;gt;&lt;br /&gt;         &amp;lt;id&amp;gt;test&amp;lt;/id&amp;gt;&lt;br /&gt;         &amp;lt;phase&amp;gt;test&amp;lt;/phase&amp;gt;&lt;br /&gt;         &amp;lt;goals&amp;gt;&lt;br /&gt;             &amp;lt;goal&amp;gt;test&amp;lt;/goal&amp;gt;&lt;br /&gt;         &amp;lt;/goals&amp;gt;&lt;br /&gt;         &amp;lt;configuration&amp;gt;&lt;br /&gt;             &amp;lt;skip&amp;gt;false&amp;lt;/skip&amp;gt;&lt;br /&gt;             &amp;lt;excludes&amp;gt;&lt;br /&gt;                 &amp;lt;exclude&amp;gt;**/*IntegrationTest.java&amp;lt;/exclude&amp;gt;&lt;br /&gt;             &amp;lt;/excludes&amp;gt;                        &lt;br /&gt;         &amp;lt;/configuration&amp;gt;&lt;br /&gt;     &amp;lt;/execution&amp;gt;&lt;br /&gt;     &amp;lt;execution&amp;gt;&lt;br /&gt;         &amp;lt;id&amp;gt;integration-test&amp;lt;/id&amp;gt;&lt;br /&gt;         &amp;lt;phase&amp;gt;integration-test&amp;lt;/phase&amp;gt;&lt;br /&gt;         &amp;lt;goals&amp;gt;&lt;br /&gt;             &amp;lt;goal&amp;gt;test&amp;lt;/goal&amp;gt;&lt;br /&gt;         &amp;lt;/goals&amp;gt;&lt;br /&gt;         &amp;lt;configuration&amp;gt;&lt;br /&gt;             &amp;lt;skip&amp;gt;false&amp;lt;/skip&amp;gt;&lt;br /&gt;             &amp;lt;includes&amp;gt;&lt;br /&gt;                 &amp;lt;include&amp;gt;**/*IntegrationTest.java&amp;lt;/include&amp;gt;&lt;br /&gt;             &amp;lt;/includes&amp;gt;                        &lt;br /&gt;         &amp;lt;/configuration&amp;gt;&lt;br /&gt;     &amp;lt;/execution&amp;gt;&lt;br /&gt; &amp;lt;/executions&amp;gt;&lt;br /&gt;&amp;lt;/plugin&amp;gt;&lt;br /&gt;            &lt;/executions&gt;&lt;br /&gt;        &lt;/plugin&gt;&lt;br /&gt;&lt;/pre&gt;It requires that the tests are named correctly, but that isn't such a big deal. So now the test phase runs just the unit tests (named *Test.java) and integration-test runs everything but in two phases, first "test" and second in integration-test.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-5960436424713241110?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/5960436424713241110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=5960436424713241110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5960436424713241110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/5960436424713241110'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2008/02/running-surefire-twice-in-build.html' title='running sureFire twice in a build'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3955979283461686947.post-833447391006078055</id><published>2008-01-26T20:16:00.001Z</published><updated>2009-03-27T21:52:13.217Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>a bit of fun with collections</title><content type='html'>&lt;div&gt;A while ago a friend introduced me to hamcrest matchers and soon after that I started looking in to how I could start to use these to make working with collections. I've spent a little while working with dynamic languages such as groovy, ruby and python and they have got under my skin. In the java world you just don't have the flexiblity of fancy closures and chained method calls.&lt;br /&gt;&lt;br /&gt;In order to satisfiy my craving for collection tools, what I really want to do is what this &lt;a href="http://jroller.com/ghettoJedi/"&gt;guy&lt;/a&gt; &lt;a href="http://jroller.com/ghettoJedi/entry/using_hamcrest_for_iterators"&gt;claims to be able to do&lt;/a&gt;.  I first looked at Sam Newman's &lt;a href="http://code.google.com/p/hamcrest-collections/"&gt;hamcrest-collections&lt;/a&gt; project, it's good, but it didn't do what I really wanted completely.&lt;br /&gt;&lt;br /&gt;So in true if it wasn't invented here style I've written my own collections library.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/logicalpractice-collections/"&gt;http://code.google.com/p/logicalpractice-collections/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It's not 100% complete, but it does allow you to do some quite clever stuff:&lt;br /&gt;&lt;code style="font-size: smaller;"&gt;&lt;br /&gt;smiths = select(from(people).getLastName(),  equalToIgnoringCase("smith"));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Give it a go and let me know what you think.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3955979283461686947-833447391006078055?l=codething.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codething.blogspot.com/feeds/833447391006078055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3955979283461686947&amp;postID=833447391006078055' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/833447391006078055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3955979283461686947/posts/default/833447391006078055'/><link rel='alternate' type='text/html' href='http://codething.blogspot.com/2008/01/bit-of-fun-with-collections.html' title='a bit of fun with collections'/><author><name>Gareth</name><uri>http://www.blogger.com/profile/16924389076032515313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
