<?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-8511353585132603614</id><updated>2011-12-11T21:13:08.818-08:00</updated><category term='deployment'/><category term='revo'/><category term='flash'/><category term='tdd'/><category term='hudson'/><category term='ubuntu'/><category term='testing'/><category term='bdd'/><category term='java'/><category term='mockito'/><category term='groovy'/><title type='text'>Decodify</title><subtitle type='html'>Thoughts on Java coding, frameworks and architecture.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8511353585132603614.post-8128992052126231517</id><published>2011-01-20T14:26:00.000-08:00</published><updated>2011-01-20T14:37:19.573-08:00</updated><title type='text'>The Artifact per Environment Anti-Pattern</title><content type='html'>&lt;b&gt;The Problem&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;How to handle environment specific properties is a topic that seems to generate much discussion.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;While initially this may seem a trivial problem as requirements grow the complexity of the solutions will also. Here are some of the requirements you might have to tackle:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Overriding&amp;nbsp;default properties&lt;/li&gt;&lt;li&gt;Dealing with properties that need to kept secret to the development team e.g. production passwords&amp;nbsp;&lt;/li&gt;&lt;li&gt;Properties that need to be changed dynamically (tuned) while the app is running e.g. cache configuration&lt;/li&gt;&lt;li&gt;The addition of new environments after the original artifact has been built&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;I've seen countless approaches to the problem - properties in the jndi tree, in the database, good old property files, pojo's etc. Each has its own pro's and con's and can range from simple implementations to hugely complex frameworks.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;Not the Solution&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One solution that is often suggested is rebuilding the&amp;nbsp;artifact&amp;nbsp;per environment and "baking" in the environment specific properties. This pattern very standard in Grails (&lt;a href="http://www.grails.org/Environments"&gt;http://www.grails.org/Environments&lt;/a&gt;) and often&amp;nbsp;recommended&amp;nbsp;for Maven (&lt;a href="http://www.sonatype.com/books/maven-book/reference/profiles-sect-tips-tricks.html"&gt;http://www.sonatype.com/books/maven-book/reference/profiles-sect-tips-tricks.html&lt;/a&gt;)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now I'm sure there are many situations where this works perfectly well - a blunt axe can still chop a tree down! &amp;nbsp;But, I believe that for many reasons its sub-optimal..&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The Downsides an Artifact per Environment:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Inefficient &lt;/b&gt;- the simple fact that do you have to rebuild the&amp;nbsp;artifact&amp;nbsp;for each environment is time consuming and involves repetition of effort&lt;/li&gt;&lt;li&gt;&lt;b&gt;Risky &lt;/b&gt;- After testing your&amp;nbsp;artifact&amp;nbsp;in your test environment you are then going to deploy a different&amp;nbsp;artefact&amp;nbsp;that was never tested to production&lt;/li&gt;&lt;li&gt;&lt;b&gt;Unnecessary Builds&lt;/b&gt; - If the properties change after you build the&amp;nbsp;artifact&amp;nbsp;- you need to build it again!&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Hard to diagnose problems&lt;/b&gt; - did some deploy the test war to production by accident? Get used to having to crack open jar's and war's to check the config.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Not compatible with Maven repositories - &lt;/b&gt;Maven repositories work best with one version of an artifact per version number - e.g. there's only one Apache commons-collections 3.2.1. An&amp;nbsp;artefact&amp;nbsp;per environment breaks this.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;b&gt;The Alternatives:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;So what to do instead? Generally the best way to go is to externalise your properties from the artefact and then have it choose the correct properties at runtime. This is too general an area for one&amp;nbsp;prescriptive&amp;nbsp;approach but hopefully this article has ruled out building an artifact per environment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Links:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Some ways to load properties from locations dependent on system variables in Spring&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;a href="http://stackoverflow.com/questions/1311360/property-placeholder-location-from-another-property/1312341#1312341"&gt;http://stackoverflow.com/questions/1311360/property-placeholder-location-from-another-property/1312341#1312341&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Externalising Grails config&lt;/div&gt;&lt;div&gt;&lt;a href="http://phatness.com/2010/03/how-to-externalize-your-grails-configuration/"&gt;http://phatness.com/2010/03/how-to-externalize-your-grails-configuration/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8511353585132603614-8128992052126231517?l=decodify.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/8128992052126231517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://decodify.blogspot.com/2011/01/artifact-per-environment-anti-pattern.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/8128992052126231517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/8128992052126231517'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/2011/01/artifact-per-environment-anti-pattern.html' title='The Artifact per Environment Anti-Pattern'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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-8511353585132603614.post-3237672827051682882</id><published>2010-12-05T05:03:00.000-08:00</published><updated>2010-12-05T05:13:19.851-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='revo'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Getting Flash 10.2 beta GPU acceleration working on Ubuntu 10.10 on an Acer Revo</title><content type='html'>&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;Unloading the video rendering to the GPU is one of the main reasons a cheap low-powered box like the Revo can function as a HD video source.&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;This has been supported in lots of ways previously (vlc etc.) but Flash support was always a bit of a let down.&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;"&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; font-size: 14px; line-height: 17px;"&gt;But Flash 10.2 beta changes that. It unloads almost all the work to the GPU leaving the&amp;nbsp;CPU&amp;nbsp;usage very low. The difference is startling - my Revo can now play full 1080p flash video with ease.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;b&gt;Here's how I set it up:&lt;/b&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;The full way to get flash using on an Acer Revo on ubuntu 10.10:&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;Install the new flash 10.2 beta:&lt;/div&gt;&lt;pre style="background-color: #cccccc; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; line-height: 17px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="background-color: #cccccc; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;wget http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_2_p2_32bit_linux_111710.tar.gz&lt;br /&gt;tar zxvf flashplayer10_2_p2_32bit_linux_111710.tar.gz&lt;br /&gt;sudo cp libflashplayer.so /usr/lib/flashplugin-installer/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;You may need to also replace flash in other locations if you have installed in multiple places (try using 'locate libflashplayer.so' for a complete list)&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;Then for gpu support you also need:&lt;/div&gt;&lt;pre style="background-color: #cccccc; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #333333; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; line-height: 17px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="background-color: #cccccc; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #222222; font-family: 'Ubuntu Mono', 'Ubuntu Beta Mono A', Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;sudo apt-get install libvdpau1&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;If you also want it working in chrome try:&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;a href="http://lifehacker.com/5705588/how-to-get-the-flash-102-beta-working-in-google-chrome" rel="nofollow" style="background-color: transparent; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #dd4814; cursor: pointer; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none; vertical-align: baseline;"&gt;http://lifehacker.com/5705588/how-to-get-the-flash-102-beta-working-in-google-chrome&lt;/a&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;To verify it is working go to a high-def you-tube video and play it. While it is playing right click and select - video info. You should see "Accelerated Video Rendering" if it has worked.&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;These instructions worked on my Acer Revo with Ubuntu 10.10.&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;b&gt;Links:&lt;/b&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;a href="http://www.osnews.com/story/24092/Flash_Player_10_2_Beta_Delivers_Hardware_Acceleration_on_Linux"&gt;http://www.osnews.com/story/24092/Flash_Player_10_2_Beta_Delivers_Hardware_Acceleration_on_Linux&lt;/a&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;a href="http://blogs.adobe.com/flashplayer/2010/11/flash-player-10-2-beta.html"&gt;http://blogs.adobe.com/flashplayer/2010/11/flash-player-10-2-beta.html&lt;/a&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;My answer (and question!) here:&amp;nbsp;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; line-height: normal;"&gt;&lt;a href="http://askubuntu.com/questions/16172/getting-flash-10-2-gpu-acceleration-working/16283#16283"&gt;http://askubuntu.com/questions/16172/getting-flash-10-2-gpu-acceleration-working/16283#16283&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;This helpful thread:&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&gt;&lt;a href="http://forums.boxee.tv/showthread.php?t=21287"&gt;http://forums.boxee.tv/showthread.php?t=21287&lt;/a&gt;&lt;/div&gt;&lt;div style="background-color: transparent; border-bottom-width: 0px; border-collapse: collapse; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; color: #333333; font-family: 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"&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/8511353585132603614-3237672827051682882?l=decodify.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/3237672827051682882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://decodify.blogspot.com/2010/12/getting-flash-102-beta-gpu-acceleration.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/3237672827051682882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/3237672827051682882'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/2010/12/getting-flash-102-beta-gpu-acceleration.html' title='Getting Flash 10.2 beta GPU acceleration working on Ubuntu 10.10 on an Acer Revo'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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-8511353585132603614.post-4324664435269315204</id><published>2010-10-05T14:38:00.000-07:00</published><updated>2010-10-05T14:38:45.927-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='deployment'/><category scheme='http://www.blogger.com/atom/ns#' term='hudson'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>How to build a one click deployment job with Hudson</title><content type='html'>While there are many solutions available for automated deployment, none of them seemed quite right for our needs. After one failed attempt at a homegrown solution our team went back to the drawing board and specified our requirements:&lt;br /&gt;&lt;br /&gt;The ideal solution had to be:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Easy to Use&lt;/b&gt; - with an audience ranging from developers to business analysts the solution needed to be intuitive and easy to explain.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Modular &lt;/b&gt;- Things change if we changed app server or SCM we wanted only minimal changes to the tool. This also useful for testing parts of the process in isolation.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Not tied to the build tool or process of the deployable.&lt;/b&gt; Once I've built the artifact, I don't want anything to do with its build config - that's right I don't want to look at its pom or build.xml. When working with multiple teams with differing build approaches, this is a must.&lt;/li&gt;&lt;li&gt;&lt;b&gt;One stop shop - &lt;/b&gt;We want the ability to deploy any of our artifacts from one place.&lt;/li&gt;&lt;li&gt;&lt;b&gt;No Magic&lt;/b&gt; - The worst thing that can happen with an automated approach is that when it fails no-one knows why. We wanted know what was happening during all steps of the process.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Auditable&lt;/b&gt; - We needed to know who deployed what, to where and when&lt;/li&gt;&lt;li&gt;&lt;b&gt;Secure&lt;/b&gt; - Can I restrict who deploys what to where?&lt;/li&gt;&lt;li&gt;&lt;b&gt;Simple&lt;/b&gt; - We're lazy and code costs - the solution should contain as little custom code as possible.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Repeatable - &lt;/b&gt;The tool should deploy any artifact to anywhere but some deployments are used over and over again e.g. latest snapshot to the systest environment. Repeating these builds should be simple.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;As with most things there is no silver bullet but the approach below worked very well for us.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step 1. Build&amp;nbsp;a simple solution you can call from the command line&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Build the a bare minimum solution that works from the command line. Don't think about GUI's, security or anything else. Do think about what the minimum set of inputs are. e.g. enough to identify the deployable and the target server, no more and no less.&amp;nbsp;For us this consisted of three very simple Groovy scripts:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The first simply took the artifact id and version, constructed the correct url to our Maven Repository and downloaded the correct deployable.&amp;nbsp;&lt;/li&gt;&lt;li&gt;The second script pushed the deployable to the remote server.&amp;nbsp;&lt;/li&gt;&lt;li&gt;The third took the deployable and ran the actual deployment to the app server.&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;Each step was extremely simple, logged exactly what it was doing and could be tested in isolation. We then wrapped the three scripts in one master script that called each in turn. Through this approach we now had the means to deploy any artifacts in our maven repository to any of our servers. By using a command line compatible approach you leave your options wide open for calling the job from almost anywhere. Tools to help with this step come included with most Application servers or see Cargo for a catch all solution.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step 2. Add the command line solution as a&amp;nbsp;parameterised&amp;nbsp;job in Hudson&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;Hudson already provides great security and auditing abilities and it seemed like a natural fit. We used a&amp;nbsp;parametrised&amp;nbsp;build&amp;nbsp;to pass the necessary parameters to the scripts:&amp;nbsp;&lt;a href="http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build"&gt;http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We used drop-down fields for target servers and group id's leaving the artifact id and version as free text fields. Turning on Hudson security ensures an audit trail and if necessary the job can be locked down to certain users only. Hudson also gives&amp;nbsp;you a simple gui that anyone can use.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Step 3. Enhance the Hudson Job with a Groovy Post Build step.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Secret sauce... While you now have a fully working solution there are some things that can be improved. I had promised one click deployments and also the Hudson gui lacks in some areas -To improve this use the Hudson Groovy Post build plugin:&amp;nbsp;&lt;a href="http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin"&gt;http://wiki.hudson-ci.org/display/HUDSON/Groovy+Postbuild+Plugin&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Configure a post build step to add a badge to each build detailing what was deployed, by whom and to where. Then you using the passed in parameters you can construct a hudson url that will repeat the same deployment job again. e.g.&amp;nbsp;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: 'Courier New', Courier, monospace; font-size: 13px; line-height: 16px; white-space: pre;"&gt;http://myhudson-server/job/myDeploymentJob/buildWithParameters?Artifact=website2&amp;amp;Version=1.5-SNAPSHOT&amp;amp;TargetServer=SystemTestBox4&lt;/span&gt;&amp;nbsp;Add this url to the build badge too. By creating bookmarks with this url you now have truly "one click" deployments. These url's can also be easily sent non-technical users - e.g. by providing to the test team they can pull down the latest build for testing whenever is&amp;nbsp;convenient.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;After a lot of thought, I feel we have come up with a solution that ticks all the boxes. It works well for us and after over 1000 deployments to both test and production systems I'm happy to say it's a huge success. Good luck with your approach and let me know how it goes in the comments.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8511353585132603614-4324664435269315204?l=decodify.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/4324664435269315204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://decodify.blogspot.com/2010/10/how-to-build-one-click-deployment-job.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/4324664435269315204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/4324664435269315204'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/2010/10/how-to-build-one-click-deployment-job.html' title='How to build a one click deployment job with Hudson'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8511353585132603614.post-57235332013574406</id><published>2009-10-04T08:59:00.001-07:00</published><updated>2009-10-04T09:47:18.453-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='tdd'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='bdd'/><category scheme='http://www.blogger.com/atom/ns#' term='mockito'/><title type='text'>Mockito 1.8  - new useful features</title><content type='html'>I was once a happy &lt;a href="http://easymock.org/"&gt;EasyMock&lt;/a&gt; user. If asked, I think I would have even questioned the need for a new mocking framework – EasyMock did it all, didn’t it?&lt;br /&gt;But after using &lt;a href="http://mockito.org/"&gt;Mockito&lt;/a&gt; for a short while I was impressed by its efficiency and ease of use. The key features for me were its simple and intuitive API and the way any Mock object will return sensible defaults for all of its methods – allowing you to concentrate on the behaviour of the methods you care about.&lt;br /&gt;The framework continues to improve incrementally with each release. This post gives a quick view of two of the most useful new features in Mockito 1.8&lt;br /&gt;&lt;h2&gt;&lt;/h2&gt;&lt;h2&gt;BDD-Style Language Supported Natively&lt;/h2&gt;BDD (&lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development"&gt;Behaviour Driven Development&lt;/a&gt;) is rapidly becoming mainstream. Standard BDD conventions recommend the use of given-when-then comments in your tests. This allows improved readability by giving clear delineation between test setup, execution and assertions. &lt;br /&gt;Mockito’s choice of method names previously were in conflict with these BDD conventions. Version 1.8 allows you to stick with the BDD conventions while also remaining backward compatible will older Mockito tests. &lt;br /&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; height: 270px; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 100.03%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;import&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; org.mockito.BDDMockito.*;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; Seller seller = mock(Seller.&lt;span style="color: blue;"&gt;class&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt; Shop shop = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Shop(seller);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; shouldBuyBread() &lt;span style="color: blue;"&gt;throws&lt;/span&gt; Exception {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;   &lt;span style="color: green;"&gt;//given  &lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;   given(seller.askForBread()).willReturn(&lt;span style="color: blue;"&gt;new&lt;/span&gt; Bread());&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;   &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;   &lt;span style="color: green;"&gt;//when&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;   Goods goods = shop.buyBread();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;   &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;   &lt;span style="color: green;"&gt;//then&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;   assertThat(goods, containBread());&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt; } &lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;Capturing arguments&lt;/h2&gt;&lt;br /&gt;Mockito has always supported a wide range of matchers to allow verification that mocked methods are invoked with the expected arguments. However sometimes (especially when dealing with legacy code) this can limit the checks you can do without the overhead of writing a custom matcher.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Version 1.8 introduces new functionality to allow you to capture and store the arguments passed the mocked methods. Standard jUnit assertions can then be applied to the captured arguments. Over reliance on capturing arguments would be a code smell in my opinion as most well abstracted code should not need to do this. However for testing legacy code and interactions with outside systems ArgumentCaptors can be very useful. &lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;br /&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; ArgumentCaptor&amp;lt;Person&amp;gt; argument = ArgumentCaptor.forClass(Person.&lt;span style="color: blue;"&gt;class&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;    verify(mock).doSomething(argument.capture());&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;    assertEquals(&lt;span style="color: #006080;"&gt;"John"&lt;/span&gt;, argument.getValue().getName())&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;More Info…&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;Downloads and more information can be found at &lt;a href="http://mockito.org/"&gt;mockito.org&lt;/a&gt;. For maven users – simply add the following dependency to your pom:&lt;a href="http://www.blogger.com/post-edit.g?blogID=8511353585132603614&amp;amp;postID=57235332013574406" name="Mockito_1.8.0"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;br /&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;br /&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;groupId&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;org.mockito&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;groupId&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;artifactId&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;mockito-all&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;artifactId&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;1.8.0&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&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/8511353585132603614-57235332013574406?l=decodify.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/57235332013574406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://decodify.blogspot.com/2009/10/mockito-18-new-useful-features.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/57235332013574406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/57235332013574406'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/2009/10/mockito-18-new-useful-features.html' title='Mockito 1.8  - new useful features'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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-8511353585132603614.post-6673450626997905925</id><published>2009-10-04T08:03:00.001-07:00</published><updated>2009-10-04T08:03:43.769-07:00</updated><title type='text'>The first post</title><content type='html'>First post - more soon!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8511353585132603614-6673450626997905925?l=decodify.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://decodify.blogspot.com/feeds/6673450626997905925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://decodify.blogspot.com/2009/10/first-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/6673450626997905925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8511353585132603614/posts/default/6673450626997905925'/><link rel='alternate' type='text/html' href='http://decodify.blogspot.com/2009/10/first-post.html' title='The first post'/><author><name>Barry</name><uri>http://www.blogger.com/profile/02017529619785284672</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></feed>
