<?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/"
	>

<channel>
	<title>Software Passion &#187; Tools</title>
	<atom:link href="http://www.softwarepassion.com/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.softwarepassion.com</link>
	<description>by Krzysztof Grajek</description>
	<lastBuildDate>Fri, 23 Dec 2011 07:48:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Java EE 6 Testing with Arquillian Persistence Extension</title>
		<link>http://www.softwarepassion.com/java-ee-6-testing-with-arquillian-persistence-extension/</link>
		<comments>http://www.softwarepassion.com/java-ee-6-testing-with-arquillian-persistence-extension/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 07:42:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Learning Materials]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=721</guid>
		<description><![CDATA[Today I will describe my newly discovered library which is an extension to the great JBoss Arquillian project. The mission of the Arquillian project is to provide a simple test harness that abstracts away all container lifecycle and deployment from the test logic so developers can easily produce a broad range of integration tests for [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Today I will describe my newly discovered library which is an extension to the great <a href="http://www.jboss.org/arquillian">JBoss Arquillian</a> project.</p>
<blockquote><p>The mission of the Arquillian project is to provide a simple test harness that abstracts away all container lifecycle and deployment from the test logic so developers can easily produce a broad range of integration tests for their enterprise Java applications.</p></blockquote>
<p>Arquillian persistence extension allows you to test JPA related code without filling up the database with test data. All you have to do is to populate .yml file with your data specified. That will be best described with an example.</p>
<p>First of all add arquillian persistence dependencies to your project:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jboss.arquillian.extension<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>arquillian-persistence-api<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${version.arquillian_persistence}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.jboss.arquillian.extension<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>arquillian-persistence-impl<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${version.arquillian_persistence}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>where &#8216;${version.arquillian_persistence}&#8217;  is equal to &#8217;1.0.0.Alpha2&#8242;. I assume that you have the basic arquillian tests (for EJB&#8217;s and CDI) working, If not read on.</p>
<p>I have found myself setting up arquillian enabled project quite cumbersome, always ending up with some classpath dependency problems while trying to remote test my classes. For those of you new to Arquillian I would strongly recommend starting up with working example provided by <a href="https://github.com/bartoszmajsak">Bartosz Majsak</a> and available on github as a <a href="https://github.com/bartoszmajsak/Beer-Advisor">&#8216;Beer-Advisor</a>&#8216; project. </p>
<p>The &#8216;Beer-Advisor&#8217; project can be quickly refactored to suit your needs, it lack comments but its so clearly written that it shouldn&#8217;t be a problem to grasp the idea.</p>
<p>Ok then, lets get going with the arquillian persistence extension, we are going to use two nice annotations to help us testing our JPA layer: @UsingDataSet and @ShouldMatchDataSet.</p>
<p>We start off with doing some setup, I will copy part of the example from the Beer-Advisor project which you can easily clone and try for yourself:</p>
<p>Having an entity class Beer:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aentity+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Entity</span></a><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Beer <span style="color: #000000; font-weight: bold;">implements</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aserializable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Serializable</span></a><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">long</span> serialVersionUID <span style="color: #339933;">=</span> 5892013208071126314L<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Id<br />
&nbsp; &nbsp;@GeneratedValue<span style="color: #009900;">&#40;</span>strategy <span style="color: #339933;">=</span> GenerationType.<span style="color: #006633;">AUTO</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Along+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Long</span></a> id<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Basic<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> name<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Basic<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abigdecimal+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BigDecimal</span></a> price<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Basic<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abigdecimal+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BigDecimal</span></a> alcohol<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Basic<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> code<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Enumerated<span style="color: #009900;">&#40;</span>EnumType.<span style="color: #006633;">STRING</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> Type type<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// If lazy then Glassfish Embedded is facing this problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=323403</span><br />
&nbsp; &nbsp;@ManyToOne<span style="color: #009900;">&#40;</span>optional <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span>, cascade <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>CascadeType.<span style="color: #006633;">PERSIST</span>, CascadeType.<span style="color: #006633;">MERGE</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> Brewery brewery<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;Beer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// to satisfy JPA</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> Beer<span style="color: #009900;">&#40;</span>Brewery brewery, Type type, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> name, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abigdecimal+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BigDecimal</span></a> price, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Abigdecimal+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">BigDecimal</span></a> alcohol<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">price</span> <span style="color: #339933;">=</span> price<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">alcohol</span> <span style="color: #339933;">=</span> alcohol<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">type</span> <span style="color: #339933;">=</span> type<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">brewery</span> <span style="color: #339933;">=</span> brewery<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">brewery</span>.<span style="color: #006633;">addBeer</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
........ <span style="color: #006633;">Getters</span> and Setters ...............</div></div>
<p>and simple DAO for managing Beer objects on the persistence layer:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@RequestScoped<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JpaBeerRepository <span style="color: #000000; font-weight: bold;">implements</span> BeerRepository<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;@PersistenceContext<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> EntityManager em<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> Beer getById<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Along+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Long</span></a> id<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> em.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span>Beer.<span style="color: #000000; font-weight: bold;">class</span>, id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
..........<br />
<br />
@Override<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> Set<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span> fetchAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; CriteriaBuilder criteriaBuilder <span style="color: #339933;">=</span> em.<span style="color: #006633;">getCriteriaBuilder</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; CriteriaQuery<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span> query <span style="color: #339933;">=</span> criteriaBuilder.<span style="color: #006633;">createQuery</span><span style="color: #009900;">&#40;</span>Beer.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; Root<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span> from <span style="color: #339933;">=</span> query.<span style="color: #006633;">from</span><span style="color: #009900;">&#40;</span>Beer.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; CriteriaQuery<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span> select <span style="color: #339933;">=</span> query.<span style="color: #006633;">select</span><span style="color: #009900;">&#40;</span>from<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; Set<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span> result <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashSet<span style="color: #339933;">&lt;</span>Beer<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; result.<span style="color: #006633;">addAll</span><span style="color: #009900;">&#40;</span>em.<span style="color: #006633;">createQuery</span><span style="color: #009900;">&#40;</span>select<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getResultList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp;@Override<br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> save<span style="color: #009900;">&#40;</span>Beer beer<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>beer.<span style="color: #006633;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;em.<span style="color: #006633;">persist</span><span style="color: #009900;">&#40;</span>beer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;em.<span style="color: #006633;">merge</span><span style="color: #009900;">&#40;</span>beer<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
..................</div></div>
<p>We can easily test our DAO by creating datasets in yml format and test our logic against it:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Beer:<br />
&nbsp; - id: <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; alcohol: <span style="color: #000000;">4.5</span><br />
&nbsp; &nbsp; name: <span style="color: #ff0000;">&quot;Mocny Full&quot;</span><br />
&nbsp; &nbsp; price: <span style="color: #000000;">1.0</span><br />
&nbsp; &nbsp; type: LAGER<br />
&nbsp; &nbsp; brewery_id: <span style="color: #000000;">1</span><br />
&nbsp; - id: <span style="color: #000000;">2</span><br />
&nbsp; &nbsp; alcohol: <span style="color: #000000;">55.0</span><br />
&nbsp; &nbsp; name: <span style="color: #ff0000;">&quot;End of history&quot;</span><br />
&nbsp; &nbsp; price: <span style="color: #000000;">765</span><br />
&nbsp; &nbsp; type: BLOND_ALE<br />
&nbsp; &nbsp; brewery_id: <span style="color: #000000;">2</span><br />
&nbsp; - id: <span style="color: #000000;">3</span><br />
&nbsp; &nbsp; alcohol: <span style="color: #000000;">41.0</span><br />
&nbsp; &nbsp; name: <span style="color: #ff0000;">&quot;Sink The Bismarck!&quot;</span><br />
&nbsp; &nbsp; price: <span style="color: #000000;">64.0</span><br />
&nbsp; &nbsp; type: QUADRUPEL_IPA<br />
&nbsp; &nbsp; brewery_id: <span style="color: #000000;">2</span><br />
&nbsp; - id: <span style="color: #000000;">4</span><br />
&nbsp; &nbsp; alcohol: <span style="color: #000000;">8.5</span><br />
&nbsp; &nbsp; name: <span style="color: #ff0000;">&quot;Delirium Tremens&quot;</span><br />
&nbsp; &nbsp; price: <span style="color: #000000;">10.0</span><br />
&nbsp; &nbsp; type: PALE_ALE<br />
&nbsp; &nbsp; brewery_id: <span style="color: #000000;">3</span><br />
&nbsp; - id: <span style="color: #000000;">5</span><br />
&nbsp; &nbsp; alcohol: <span style="color: #000000;">8.4</span><br />
&nbsp; &nbsp; name: <span style="color: #ff0000;">&quot;Pauwel Kwak&quot;</span><br />
&nbsp; &nbsp; price: <span style="color: #000000;">4.0</span><br />
&nbsp; &nbsp; type: AMBER<br />
&nbsp; &nbsp; brewery_id: <span style="color: #000000;">4</span></div></div>
<p>You should put your .yml file into test/resources/datasets folder in you maven project</p>
<p>@UsingDataSet annotation will populate our database with the data specified in beers.yml file</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;@Test<br />
&nbsp; &nbsp;@UsingDataSet<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;beers.yml&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> shouldReturnBeerByItsId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a><br />
&nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// given</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Along+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Long</span></a> beerId <span style="color: #339933;">=</span> 1L<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> expectedName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Mocny Full&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// when</span><br />
&nbsp; &nbsp; &nbsp; Beer beers <span style="color: #339933;">=</span> beerRepository.<span style="color: #006633;">getById</span><span style="color: #009900;">&#40;</span>beerId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// then</span><br />
&nbsp; &nbsp; &nbsp; assertThat<span style="color: #009900;">&#40;</span>beers.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isEqualTo</span><span style="color: #009900;">&#40;</span>expectedName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span></div></div>
<p>Now, lets say we want to add new Beer and see if the database will have a specific data in it, for this purpose we are going to use @ShouldMatchDataSet(..)</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@Test<br />
&nbsp; &nbsp; @ShouldMatchDataSet<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;expected-insert-beer.yml&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> shouldSaveNewBeer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//when</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Beer b <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Beer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//set the necessary fields on the beer object</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; beerRepository.<span style="color: #006633;">save</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; assertThat<span style="color: #009900;">&#40;</span>beerRepository<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isNotNull</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>after inserting our Beer object to the database through the EntityManager we should end up with a single beer record in our database, exactly like the one specified in &#8216;expected-insert-beer.yml&#8217;.</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/java-ee-6-testing-with-arquillian-persistence-extension/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse Code Recommenders</title>
		<link>http://www.softwarepassion.com/eclipse-code-recommenders/</link>
		<comments>http://www.softwarepassion.com/eclipse-code-recommenders/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 18:25:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=642</guid>
		<description><![CDATA[Thanks to @Vogella I have found out lately about Eclipse Code Recommenders. For anyone using Eclipse or considering a switch from other IDE check out this: Eclipse Code Recommenders This is in my opinion the way to go for the IDE but I wonder how good this can actually get, anyway looks interesting though. What [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Thanks to<a href="http://twitter.com/#!/vogella"> @Vogella</a> I have found out lately about Eclipse Code Recommenders.<br />
For anyone using Eclipse or considering a switch from other IDE check out this: <a href="http://www.eclipse.org/recommenders/documentation/completion/">Eclipse Code Recommenders</a></p>
<p>This is in my opinion the way to go for the IDE but I wonder how good this can actually get, anyway looks interesting though.</p>
<p>What you get with code recommenders:</p>
<p>1. Intelligent Call Completion<br />
2. Dynamic and Example-driven Template Completion<br />
3. Java Chain Completion</p>
<p>So far it covers quite a short list of classes/functionality but anyway still impressive.<br />
There is no stable release yet. More details on the mentioned website above.<br />
Check out the website for more details.</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/eclipse-code-recommenders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improving your Eclipse productivity</title>
		<link>http://www.softwarepassion.com/improving-your-eclipse-productivity/</link>
		<comments>http://www.softwarepassion.com/improving-your-eclipse-productivity/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 09:12:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=597</guid>
		<description><![CDATA[One of the quickest ways to improve your productivity as a programmer is to learn your tools. The easiest way to master your tools is to learn its shortcuts and one of the easiest ways to learn shortcuts is to use a flash card based learning software . As I have moved recently from Netbeans [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>One of the quickest ways to improve your productivity as a programmer is to learn your tools. The easiest way to master your tools is to learn its shortcuts and one of the easiest ways to learn shortcuts is to use a flash card based learning software <img src='http://www.softwarepassion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
As I have moved recently from Netbeans to Eclipse I have decided to upgrade my eclipse skills by learning its shortcuts extensively.<br />
If you are a linux user you can try to install small program just for that called <a href="http://ankisrs.net/shots.html"><strong>Anki</strong></a>, this is a very simple and intuitive software which allows you to quickly and easily create new sets of flash cards as well as import some already created by the community.<br />
Based on the post <a href="http://theshyam.com/2009/07/eclipse-productivity-shortcuts/">here</a> I have quickly created a set of flash cards for learning Eclispe shortcuts.<br />
You can download the .anki file contained in a zip from here:<br />
<a href='http://softwarepassion.s3.amazonaws.com/wp-content/uploads/eclipse_shortcuts.anki_.zip'>eclipse_shortcuts.anki</a><br />
This is an example screen from the Anki software displaying random flash card:<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/anki.png" rel="lightbox[597]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/anki.png" alt="" title="anki" width="512" height="476" class="aligncenter size-full wp-image-600" /></a></p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/improving-your-eclipse-productivity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Artifactory on Ubuntu box</title>
		<link>http://www.softwarepassion.com/install-artifactory-on-ubuntu-box/</link>
		<comments>http://www.softwarepassion.com/install-artifactory-on-ubuntu-box/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 10:28:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=586</guid>
		<description><![CDATA[This is a simple and straightforward guide on how to install Artifactory and import exisiting maven repository into it. 1. Download Artifactory from JFrog website 2. Unzip downloaded file in your home directory 3. Change to root user (su -) 4. Set your JAVA_HOME in /etc/environment JAVA_HOME=/usr/lib/jvm/java-6-sun/ PATH=&#34;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games&#34; 5. Set your JAVA_HOME in /etc/profile # [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>This is a simple and straightforward guide on how to install Artifactory and import exisiting maven repository into it.</p>
<p><a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/Screenshot-1.png" rel="lightbox[586]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/Screenshot-1.png" alt="" title="Screenshot-1" width="800" height="404" class="aligncenter size-full wp-image-590" /></a></p>
<p>1. Download Artifactory from <a href="http://www.jfrog.com/download.php">JFrog website</a><br />
2. Unzip downloaded file in your home directory<br />
3. Change to root user (su -)<br />
4. Set your JAVA_HOME in /etc/environment</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-sun<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #007800;">PATH</span>=<span style="color: #ff0000;">&quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games&quot;</span></div></div>
<p>5. Set your JAVA_HOME in /etc/profile</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># /etc/profile: system-wide .profile file for the Bourne shell (sh(1))</span><br />
<span style="color: #666666; font-style: italic;"># and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-sun<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>profile.d <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>profile.d<span style="color: #000000; font-weight: bold;">/*</span>.sh; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp;.............. rest of the file.....</div></div>
<p>6. Go to /home/kris/artifactory-2.3.2/bin (of course replace &#8216;kris&#8217; with your home folder name)<br />
7. Run</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$</span>: .<span style="color: #000000; font-weight: bold;">/</span>install.sh</div></div>
<p>8. Check if your installation was successful, run:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$</span>: service artifactory check</div></div>
<p>9. If you get error saying something like: &#8220;Cannot find a JRE or JDK. Please set JAVA_HOME to a >=1.5 JRE&#8221; , edit /etc/artifactory/default and add JAVA_HOME export:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">10</span>. Run the check again <span style="color: #7a0874; font-weight: bold;">&#40;</span>service artifactory check<span style="color: #7a0874; font-weight: bold;">&#41;</span> and <span style="color: #000000; font-weight: bold;">if</span> all goes fine run<br />
<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">cc</span> <span style="color: #007800;">lang</span>=<span style="color: #ff0000;">&quot;bash&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
$: service artifactory start</div></div>
<p>11. In your browser to into: http://localhost:8081/artifactory and log in as administrator (default user/pass is admin/password)</p>
<p>12. After logging in, click on the &#8216;Admin&#8217; tab, then &#8216;Import &#038; Export&#8217; and &#8216;Repositories&#8217;</p>
<p>13. Inside the &#8216;Import&#8217; section select &#8216;ext-release-local&#8217; as your &#8216;Target Local Repo&#8217; and find your maven .m2 repository<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/artifactory_import.png" rel="lightbox[586]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/artifactory_import-300x172.png" alt="" title="artifactory_import" width="300" height="172" class="aligncenter size-medium wp-image-587" /></a></p>
<p>14. Click import and your are all set!</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/install-artifactory-on-ubuntu-box/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oracle SQL Developer on Ubuntu 10.04 &#8211; No brainer instalation guide</title>
		<link>http://www.softwarepassion.com/oracle-sql-developer-on-ubuntu-10-04-no-brainer-instalation-guide/</link>
		<comments>http://www.softwarepassion.com/oracle-sql-developer-on-ubuntu-10-04-no-brainer-instalation-guide/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 06:47:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=406</guid>
		<description><![CDATA[This is a short tutorial on how to install &#8216;Oracle SQL Developer&#8217; on Ubuntu 10.04 (Lucid) platform. 1. Instal sqldeveloper-package package sudo apt-get install sqldeveloper-package 2. Download &#8216;SqlDeveloper&#8217; itself from Oracle website (you have to be registered prior to download) 3. Install tofrodos package sudo apt-get install tofrodos 4. Create symlinks for dos2unix and unix2dos [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p><a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/sqldeveloper.jpg" rel="lightbox[406]"><img class="aligncenter size-full wp-image-407" title="sqldeveloper" src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/sqldeveloper.jpg" alt="" width="400" height="255" /></a></p>
<p>This is a short tutorial on how to install &#8216;Oracle SQL Developer&#8217; on Ubuntu 10.04 (Lucid) platform.<br />
1. Instal sqldeveloper-package package</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> sqldeveloper-package</div></div>
<p>2. Download &#8216;SqlDeveloper&#8217; itself from<a title="Oracle SQL Developer Download Page" href="http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html" target="_blank"> Oracle </a>website (you have to be registered prior to download)</p>
<p>3. Install tofrodos package</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> tofrodos</div></div>
<p>4. Create symlinks for dos2unix and unix2dos (execute the following inside your /usr/bin folder)</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">username<span style="color: #000000; font-weight: bold;">@</span>linuxbox:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #666666; font-style: italic;"># sudo ln -s fromdos dos2unix</span><br />
<br />
username<span style="color: #000000; font-weight: bold;">@</span>linuxbox:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #666666; font-style: italic;"># sudo ln -s todos unix2dos</span></div></div>
<p>5. Install debhelper package</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> debhelper</div></div>
<p>6. Go to the folder where you have downloaded the SQL Developer in step 2 and run the following command:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">make-sqldeveloper-package sqldeveloper-2.1.1.64.45-no-jre.zip</div></div>
<p>7. Install the newly created deb package</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">--install</span> sqldeveloper_2.1.1.64.45+0.2.3-<span style="color: #000000;">1</span>_all.deb</div></div>
<p>8. Run Sql Developer and when asked provide JDK home eg.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-openjdk</div></div>
<p>And thats it! Enjoy!</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/oracle-sql-developer-on-ubuntu-10-04-no-brainer-instalation-guide/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Getting started with Apache Click and Eclipse Galileo</title>
		<link>http://www.softwarepassion.com/getting-started-with-apache-click-and-eclipse-galileo/</link>
		<comments>http://www.softwarepassion.com/getting-started-with-apache-click-and-eclipse-galileo/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 10:42:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[apache click]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=356</guid>
		<description><![CDATA[Last couple of days I read here and there about Apache Click, which is now in version 2.1.0. It looks preety cool and easy to learn, so I decided to give it a try and see for myself. I understand that its cool to learn things using vi and shell only, but when you tried [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Last couple of days I read here and there about Apache Click, which is now in version 2.1.0. It looks preety cool and easy to learn, so I decided to give it a try and see for myself.<br />
I understand that its cool to learn things using vi and shell only, but when you tried many frameworks before, you know how things works, you just want to see how or how not, productive you can be with the new framework, thats why I jump straight to the IDE.<br />
And here, first surprise, with apache click its&#8217; not that easy, well, I&#8217;m mean its still easy but I have encountered a few problems, and right now I would like to share the solution.<br />
First of all, I did not tried all the examples in the apache click user guide yet, haven&#8217;t build anything usefull and definietly I&#8217;m not an Apache Click expert, I think I have figured out how to plug it to Eclipse and I think this is good start <img src='http://www.softwarepassion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
<script type="text/javascript"><!--
google_ad_client = "pub-3015706834207881";
/* 468x15, utworzono 09-11-19 */
google_ad_slot = "3912330401";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Here you have a few points to build your Apache Click IDE:<br />
1. First of all download latest and greatest Eclipse Galileo from <a href="http://www.eclipse.org/downloads/">here</a> &#8211; choose Eclipse for Java EE developers<br />
2. Download Apache Click libraries from <a href="http://click.apache.org/">here</a> &#8211; choose version 2.1.0<br />
3. Download Apache Click IDE from <a href="http://click.apache.org/docs/click-ide-downloads.html">here</a> &#8211; note that it contains Click version 1.5 and it was last updated in November 2008 &#8211; maybe I&#8217;m missing something here?<br />
4. Unzip your ClickIDE and copy the &#8216;features&#8217; and &#8216;plugins&#8217; folders into your Eclipse home directory<br />
5. Unzip your latest click libraries and keep it for later <img src='http://www.softwarepassion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
6. Start your Eclipse IDE and create new &#8216;Dynamic Web Project&#8217;<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/dynamic_web_project.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/dynamic_web_project-254x300.jpg" alt="" title="dynamic_web_project" width="254" height="300" class="aligncenter size-medium wp-image-361" /></a><br />
Choose target name, in this case &#8216;ClickDemo2&#8242;, select your target runtime as Tomcat 6+ etc.<br />
7. Under configuration combo box, select custom and click &#8216;Modify&#8217;<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/custom_click_config.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/custom_click_config-300x265.jpg" alt="" title="custom_click_config" width="300" height="265" class="aligncenter size-medium wp-image-359" /></a><br />
8. Select &#8216;Click&#8217; in Project Facet List and save the configuration as click config<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/click_config.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/click_config-300x232.jpg" alt="" title="click_config" width="300" height="232" class="aligncenter size-medium wp-image-357" /></a><br />
9. Once you have your configuration created, dynamic web project screen should look like in the following screenshot:<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/custom_click_config2.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/custom_click_config2-255x300.jpg" alt="" title="custom_click_config2" width="255" height="300" class="aligncenter size-medium wp-image-360" /></a><br />
10. The rest of the settings you can leave as it is, just click &#8216;Next&#8217; up to the point when you finish creating new dynamic web project.<br />
11. After your project is created it will have the structure like in the following screen:<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/clickdemo_project_structure.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/clickdemo_project_structure-274x300.jpg" alt="" title="clickdemo_project_structure" width="274" height="300" class="aligncenter size-medium wp-image-358" /></a><br />
<script type="text/javascript"><!--
google_ad_client = "pub-3015706834207881";
/* 468x15, utworzono 09-11-19 */
google_ad_slot = "3912330401";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Notice that there are click libraries from version 1.5, which is no good, we want to use the latest version which is 2.1.0.<br />
12. Copy the files &#8216;click-2.1.0.jar&#8217; and &#8216;click-extras-2.1.0.jar&#8217; into the same lib folder where the old libraries are found.<br />
13. Delete old libraries and refresh the project tree under eclipse (right click on the project node and select &#8216;Refresh&#8217;), now you will see the new libraries come up in the lib folder.<br />
14. Open your web.xml file under &#8216;WebContent/WEB-INF/&#8217; folder and change the class name of the main Click Servlet, from &#8216;net.sf.click.ClickServlet&#8217; to &#8216;org.apache.click.ClickServlet&#8217; in &#8216;servlet-class&#8217; declaration.<br />
15. With Eclipse, select the project node and click &#8216;New&#8217; -> &#8216;Other&#8217;, choose &#8216;Click Page&#8217; under &#8216;click&#8217; directory.<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/new_click_page.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/new_click_page-300x285.jpg" alt="" title="new_click_page" width="300" height="285" class="aligncenter size-medium wp-image-362" /></a><br />
16. Fill out the necessary fields for your new click page as below:<br />
<a href="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/new_click_page2.jpg" rel="lightbox[356]"><img src="http://softwarepassion.s3.amazonaws.com/wp-content/uploads/new_click_page2-264x300.jpg" alt="" title="new_click_page2" width="264" height="300" class="aligncenter size-medium wp-image-363" /></a><br />
17. Name the file &#8216;index.htm&#8217; and click &#8216;Finish&#8217;<br />
18. Under the page java source file, fix the Page class by using the page from the: org.apache.click.Page instead of the old path.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.softwarepassion</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.click.Page</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Index <span style="color: #000000; font-weight: bold;">extends</span> Page <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adate+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Date</span></a> time <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Adate+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Date</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> Index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; addModel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;time&quot;</span>, time<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Modify your &#8216;index.htm&#8217; using html editor to look something like this:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/meta.html"><span style="color: #000000; font-weight: bold;">META</span></a> <span style="color: #000066;">HTTP-EQUIV</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">CONTENT</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html;charset=UTF-8&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span>Blank<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">title</span></a>&gt;</span><br />
&nbsp; &nbsp; $imports<br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
&nbsp; $time<br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">html</span></a>&gt;</span></div></div>
<p>19. Start up your project in tomcat. The page should display current time!<br />
<script type="text/javascript"><!--
google_ad_client = "pub-3015706834207881";
/* 468x15, utworzono 09-11-19 */
google_ad_slot = "3912330401";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Additional Comments:<br />
I know that this is just a quickfix, and I just cannot belive that there is no proper eclipse plugin using the latest click framework, which would be up to date, if you know any, than please comment and save me and my readers precious time.</p>
<p>Thank you.</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/getting-started-with-apache-click-and-eclipse-galileo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Jasperberry &#8211; the most dynamic reports ever.</title>
		<link>http://www.softwarepassion.com/jasperberry-the-most-dynamic-reports-ever/</link>
		<comments>http://www.softwarepassion.com/jasperberry-the-most-dynamic-reports-ever/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 09:03:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jasperberry]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=350</guid>
		<description><![CDATA[Today I will describe in short my latest and simplest quick and dirty trick, generating jasper report dynamically. Jasperberry is a component written very quickly to help me generate pdf report in a situation where I don&#8217;t know the number of columns I will have, I don&#8217;t know their widths, the data they contain etc, [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Today I will describe in short my latest and simplest quick and dirty trick, generating jasper report dynamically. Jasperberry is a component written very quickly to help me<br />
generate pdf report in a situation where I don&#8217;t know the number of columns I will have, I don&#8217;t know their widths, the data they contain etc, all is generated at runtime dynamically.<br />
I know that there is DynamicJasper project but it seems to be dead, and its dead in a very strange way, I mean, I see that the authors commit new code but there is no chance to get any support unless, I guess, you pay for it.<br />
With dynamic jasper I couldn&#8217;t generate report with polish fonts displayed properly, tried many different tricks, no support on the forum, no support on stack overflow, no nothing. After 2 days I have realized that I will write my own library quicker to solve my problem than get an answer from the dynamic jasper community (if there is any).<br />
So here we have: jasperberry!<br />
<script type="text/javascript"><!--
google_ad_client = "pub-3015706834207881";
/* 468x15, utworzono 09-11-19 */
google_ad_slot = "3912330401";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Don&#8217;t expect too much from it but if you want to display simple table with data, dynamic columns, adjustable fonts and colors than this is it.</p>
<p>In fact you don&#8217;t have to even know object properties to generate the report, we will use Apache DynaBeans for that:</p>
<p>This is a simple example code snipped showing you how to get started with the simplest and most dynamic reporting library ever (as well as lacking features probably but we hope its enough for simple projects)</p>
<p>This example assumes the following:</p>
<p>1. You want simple report<br />
2. You dont have to know the object which properties you want to display in advance, by this I mean you can create report columns dynamically, and by using apache dyna beans your objects don&#8217;t have to even exists. You just dynamically create them and inject them into the report.</p>
<p>Here is an example test class showing you how to use jasperberry, for more info please contact us directly at softberries.com<br />
Code:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JRXMLBuilderTest <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> List<span style="color: #339933;">&lt;</span>JBColumnBean<span style="color: #339933;">&gt;</span> columns<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> JRXMLBuilderTest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @BeforeClass<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> setUpClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>JBColumnBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col2 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col3 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col4 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col5 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col6 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JBColumnBean col7 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBColumnBean<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col1.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col1.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col1.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Imię&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col2.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col2.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;surname&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col2.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Nazwisko&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col3.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">160</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col3.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col3.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Komentarz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col4.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col4.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col4.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Komentarz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col5.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col5.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col5.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Komentarz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col6.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col6.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment4&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col6.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Komentarz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col7.<span style="color: #006633;">setPreferredWidth</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col7.<span style="color: #006633;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; col7.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Komentarz&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col3<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col4<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col5<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col6<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; columns.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>col7<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @AfterClass<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> tearDownClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @Before<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; @After<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> tearDown<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #008000; font-style: italic; font-weight: bold;">/** * Test of build method, of class JRXMLBuilder. */</span><br />
&nbsp; &nbsp; @Test<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testBuild<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">System</span></a>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;build&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List<span style="color: #339933;">&lt;</span>JBReportElement<span style="color: #339933;">&gt;</span> elements <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>JBReportElement<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//col header font </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JBFont colHeaderFont <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colHeaderFont.<span style="color: #006633;">setBold</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colHeaderFont.<span style="color: #006633;">setSize</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; colHeaderFont.<span style="color: #006633;">setForegroundColor</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#555555&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//detail font </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JBFont detailFont <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detailFont.<span style="color: #006633;">setSize</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detailFont.<span style="color: #006633;">setForegroundColor</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#000000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; detailFont.<span style="color: #006633;">setPdfEncoding</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cp1257&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JBPage page <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBPage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JBReport report <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBReport<span style="color: #009900;">&#40;</span>page, colHeaderFont, detailFont, <span style="color: #0000ff;">&quot;#CCCCFF&quot;</span>, <span style="color: #0000ff;">&quot;#DEDEDE&quot;</span>, <span style="color: #0000ff;">&quot;#FFFFFF&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JBFont titleFont <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JBFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleFont.<span style="color: #006633;">setBold</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleFont.<span style="color: #006633;">setSize</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleFont.<span style="color: #006633;">setForegroundColor</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#FF0000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; titleFont.<span style="color: #006633;">setPdfEncoding</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cp1257&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//add title elements </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elements.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> JBStaticTextElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello World!&quot;</span>, <span style="color: #cc66cc;">450</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">300</span>, titleFont<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elements.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> JBImageElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;C:<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>Documents and Settings<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>admin<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>Moje dokumenty<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>NetBeansProjects<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>JASPER_BERRY<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\\</span>test.jpg&quot;</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">350</span>, <span style="color: #cc66cc;">242</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report.<span style="color: #006633;">setTitleElements</span><span style="color: #009900;">&#40;</span>elements<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JRXMLBuilder instance <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JRXMLBuilder<span style="color: #009900;">&#40;</span>columns, report<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> expResult <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span> instance.<span style="color: #006633;">build</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JasperReport jr <span style="color: #339933;">=</span> JasperCompileManager.<span style="color: #006633;">compileReport</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jasperberry_by_softberries.jrxml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//PREPARE SOME DATA </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DynaProperty<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> props <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DynaProperty<span style="color: #009900;">&#91;</span>columns.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> columns.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; props<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DynaProperty<span style="color: #009900;">&#40;</span>columns.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BasicDynaClass dynaClass <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BasicDynaClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tester&quot;</span>, <span style="color: #000066; font-weight: bold;">null</span>, props<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List<span style="color: #339933;">&lt;</span>DynaBean<span style="color: #339933;">&gt;</span> beans <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>DynaBean<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DynaBean db <span style="color: #339933;">=</span> dynaClass.<span style="color: #006633;">newInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;name&quot;</span>, <span style="color: #0000ff;">&quot;Krzysztof &quot;</span> <span style="color: #339933;">+</span> i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;surname&quot;</span>, <span style="color: #0000ff;">&quot;Grajek &quot;</span> <span style="color: #339933;">+</span> i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment&quot;</span>, <span style="color: #0000ff;">&quot;Komentarz &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment2&quot;</span>, <span style="color: #0000ff;">&quot;Komentarz &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment3&quot;</span>, <span style="color: #0000ff;">&quot;Komentarz &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment4&quot;</span>, <span style="color: #0000ff;">&quot;Komentarz &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; db.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment5&quot;</span>, <span style="color: #0000ff;">&quot;Komentarz &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beans.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>db<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JasperPrint jp <span style="color: #339933;">=</span> JasperFillManager.<span style="color: #006633;">fillReport</span><span style="color: #009900;">&#40;</span>jr, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">new</span> JRBeanCollectionDataSource<span style="color: #009900;">&#40;</span>beans<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JasperExportManager.<span style="color: #006633;">exportReportToPdfFile</span><span style="color: #009900;">&#40;</span>jp, <span style="color: #0000ff;">&quot;jasperberry.pdf&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertEquals<span style="color: #009900;">&#40;</span>expResult, result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> ex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Logger.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>JRXMLBuilderTest.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">log</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">SEVERE</span>, <span style="color: #000066; font-weight: bold;">null</span>, ex<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>You should find similar snippet in a test suite of the project.<br />
The project itself is licensed under LGPL and its available from sourceforge <a href="http://sourceforge.net/projects/jasperberry/">here</a></p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/jasperberry-the-most-dynamic-reports-ever/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Free file sharing service based on Amazon S3</title>
		<link>http://www.softwarepassion.com/free-file-sharing-service-based-on-amazon-s3/</link>
		<comments>http://www.softwarepassion.com/free-file-sharing-service-based-on-amazon-s3/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 16:56:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=140</guid>
		<description><![CDATA[A short note about a brand new rapidshare competition based on Amazon S3 called Storage For Free (www.storage43.com). Without registration you can share here your project files or basically anything you want to share quickly (up to 200 MB no registration required and the file is alive on the server for 30 days), if you [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p><img src="http://www.softwarepassion.com/wp-content/storage-300x167.png" alt="storage" title="storage" width="300" height="167" class="alignleft size-medium wp-image-141" /><br/>A short note about a brand new rapidshare competition based on Amazon S3 called Storage For Free (<a href="http://www.storage43.com">www.storage43.com</a>). Without registration you can share here your project files or basically anything you want to share quickly (up to 200 MB no registration required and the file is alive on the server for 30 days), if you are still unhappy you can register for free and get 500MB for a single upload. This is another service that proves growing popularity of Amazon Web Services which in my opinion are great!</p>
<p>Enjoy!</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/free-file-sharing-service-based-on-amazon-s3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Continuous Integration with CruiseControll.NET</title>
		<link>http://www.softwarepassion.com/continuous-integration-with-cruisecontrollnet/</link>
		<comments>http://www.softwarepassion.com/continuous-integration-with-cruisecontrollnet/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 13:10:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Add new tag]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=89</guid>
		<description><![CDATA[Today I will try to bite quite a big topic which is continuous integration setup for .NET application build using Visual Studio 2008, Vistual Studio Unit Tests and Cruise Control.NET. Continuous integration, in a few simple words works the following way: there are a number of developers working on a project, developers use subversion or [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Today I will try to bite quite a big topic which is continuous integration setup for .NET application build using Visual Studio 2008, Vistual Studio Unit Tests and Cruise Control.NET.<br />
Continuous integration, in a few simple words works the following way: there are a number of developers working on a project, developers use subversion or other code versioning system to manage their source code. When they work on the project they commit changes to the subversion repo and from the other side another part of the process called &#8216;continuous integration server&#8217; checks this code out every few minutes, and tries to build it and run unit tests on it, to see if it is so far all ok.<br />
That was probably the shortest description  of continuous integration process you would ever be able to find on the internet <img src='http://www.softwarepassion.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>So, how do you set up your own? Well, actually its not that difficult but looks scary at the frist sight. First of all of course, you would have to download and install all software needed, and this is:</p>
<ul>
<ol><a href="http://msdn.microsoft.com/en-us/visualc/aa700831.aspx">Visual Studio 2008</a></ol>
<ol><a href="http://subversion.tigris.org/">Subversion</a></ol>
<ol><a href="http://tortoisesvn.tigris.org/">Tortoise</a> or <a href="http://ankhsvn.open.collab.net/">Ankh SVN(recommended)</a></ol>
<ol><a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CruiseControl .NET</a></ol>
</ul>
<p>That should be it on the server side! While installing just follow the defaults and you should be fine. I do install Cruise Control directly on the C: drive which ends up as C:CruiseControl.NET but you can install it wherever you want, I do it this way as its easier for me to write scripts if neccessary (short pathes instead of long ones).</p>
<p>Once CC.NET is installed you should be able to run it. You have two options, first one run it as a console app or run it as a service. For the setup, I would recommend running it as a console, make sure that CC.NET service is not running and double click ccnet.exe file inside C:CruiseControl.NETserver directory or any other &#8216;server&#8217; directory depending on your installation path.<br />
If all went fine you can see the CC.NET dashboard in your browser. Just browse to the url &#8216;http://localhost/ccnet&#8217; where &#8216;ccnet&#8217; is a virtual directory created by Cruise Control application setup.<br />
<img src="http://www.softwarepassion.com/wp-content/uploads/capture1-300x100.png" alt="capture1" title="capture1" width="300" height="100" class="aligncenter size-medium wp-image-94" /></p>
<p>Ok then, once all is runnning and installed we can start configuring our CC server. To do that you would need to open ccnet.config file in your favourite text editor. Inside ccnet.config you will be able to set your project which should be build and tested by Cruise Control. The ccnet.config file consist of a number of project sections. You can have as many &#8216;project sections as you wish, all contained inside the root element of the document.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cruisecontrol</span> <span style="color: #000066;">xmlns:cb</span>=<span style="color: #ff0000;">&quot;urn:ccnet.config.builder&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Project One&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Project Two&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cruisecontrol<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Lets configure one of the projects, all elements described above would be a subnodes of the project element. First of all we need to specify a working directory for our project. Simply create a dir on your drive somewhere and add a path to it between &#8216;workingDirectory&#8217; elements. This directory will be used to download the subversion sources.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>c:projectone<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>After we specify &#8216;workingDirectory&#8217; we have to specify a trigger which will call updates on our source code, checked out form the subversion. Right here we specify that CC.NET should check the subversion repo every 60 seconds and if it finds any modifications it should run the whole continuous integration process.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;triggers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intervalTrigger</span> <span style="color: #000066;">seconds</span>=<span style="color: #ff0000;">&quot;60&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/triggers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>To allow cruise controll download/update your sources, we need to specify the adress of the subversion repository as well as username and password</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--set the sourcecontrol type to subversion and point to the subversion exe--&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sourcecontrol</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;svn&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:Program FilesSubversionbinsvn.exe<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:projectone<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trunkUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://svn_server.com/projectone<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trunkUrl<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;autoGetSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/autoGetSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>your_username<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/username<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>your_password<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/password<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sourcecontrol<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>This section was pretty easy, after we specify working directory, trigger and subversion settings we are ready to add sections responsible for building, testing and publishing our results.<br />
All of the mentioned should happen inside the &#8216;tasks&#8217; section so, just after the &#8216;sourcecontrol&#8217; element add the following:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Inside the &#8216;tasks&#8217; we will add the elements for building the project/solution (msbuild element), unit testing (2 times &#8216;exec&#8217; element), publishing our work to a separate directory (&#8216;buildpublisher&#8217; element) as well as publish our test results to CC.NET dashboard (&#8216;publishers&#8217; element).</p>
<p>To do all that, we need to first build our project. We are going to use MSBuild.exe which you should be able to find in C:WINDOWSMicrosoft.NETFrameworkv3.5 if you are using .NET 3.5 version. Instead of building single project we are going to build a whole solution. To build a solution you need to specify the place where the solution file exists as well as the name of the solution file itself. Depending on the project size and characteristics you have to set the timeout option to suit your needs and to prevent CC.NET to timeout before the project have a chance to actually build.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Configure MSBuild to compile the updated files --&gt;</span>c:<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;msbuild<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:WINDOWSMicrosoft.NETFrameworkv3.5MSBuild.exe<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:projectonetrunk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/workingDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;projectFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>projectOne.sln<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/projectFile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/noconsolelogger /p:Configuration=Debug<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;targets<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/targets<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;timeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>300<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/timeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;logger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:CruiseControl.NETwebdashboardbinThoughtWorks.CruiseControl.MsBuild.dll<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/logger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/msbuild<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Ok, so we are already able to automatically build our project and this is really cool but what would be continuous integration without executing unit tests <img src='http://www.softwarepassion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . As it makes development easier, for my projects, wherever possible I use built in Unit Test functionality in Visual Studio 2008.In my opinion, VS Unit Tests are a bit more tricky to set up than NUnit on CC.NET, especially publishing results part of it) but the developmnet on the other hand is easier and I will stick to it.<br />
We need to do the following three things to properly execute tests. First of all we need to run tests using MSTest.exe, this part is pretty easy but before doing that we need to delete previous test results or otherwise our MSTest would complain. Therefore you have to add into your tasks the two following &#8216;exec&#8217; sections.<br />
First one to delete any previouse test results using bat file (deleteTestLog.bat) with single command:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; DEL C:projectoneresults.trx</div></div>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deleteTestLog.bat<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;baseDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:CruiseControl.NETserver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/baseDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildTimeoutSeconds<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>30<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildTimeoutSeconds<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Second &#8216;exec&#8217; section running the actual unit tests:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--Call mstest to run the tests contained in the TestProject --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>mstest.exe<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;baseDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:projectonetrunkprojectOneTests<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/baseDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--testcontainer: points to the DLL that contains the tests --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--runconfig: points to solutions testrunconfig that is created by vs.net, list what test to run --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--resultsfile: normally the test run log is written to the uniquely named testresults directory &nbsp;--&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this option causes a fixed name copy of the file to be written as well --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/testcontainer:C:projectonetrunkprojectOneTestsBinDebugprojectOneTests.dll /resultsfile:C:projectoneresults.trx<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildArgs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildTimeoutSeconds<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>90<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildTimeoutSeconds<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Right now our server builds and tests our solution automatically. If we want to publish the build results somewhere else, lets say to another virtual directory or web site we can copy the files using &#8216;buildPublisher&#8217;. This way, if its a web application, after each build you can browse to the web site url and see the latest changes in place, all freshly build and tested.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;buildpublisher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sourceDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>C:projectonetrunkprojectOne<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sourceDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publishDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>D:projectOnePublished<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/publishDir<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;useLabelSubDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/useLabelSubDirectory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/buildpublisher<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>At this point we have a continuous integration server running which automatically update our solution if it detects any changes on subversion server, builds the sources, runs unit tests and publish the build results. This is great, one problem though, MSTest is not well integrated into CC.NET so we won&#8217;t be able to see our tests results, if any fails for e.g. on our CC dashboard.<br />
To publish your test results into cruise control dashboard you would need to add the following section inside your &#8216;project&#8217;, just after &#8216;exec&#8217; or &#8216;buildPublisher&#8217; sections:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--Publishers will be done after the build has completed--&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;publishers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;merge<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>results.trx<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/merge<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xmllogger</span> <span style="color: #000066;">logDir</span>=<span style="color: #ff0000;">&quot;C:CruiseControl.NETserverProjectOneArtifactsbuildlogs&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/publishers<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>This will merge your test results into the dashboard. </p>
<p>I hope you will enjoy having continuous integration as part of your project building flow. Have fun.</p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/continuous-integration-with-cruisecontrollnet/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Affirma S3 library for C#</title>
		<link>http://www.softwarepassion.com/affirma-s3-library-for-c/</link>
		<comments>http://www.softwarepassion.com/affirma-s3-library-for-c/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:20:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.softwarepassion.com/?p=70</guid>
		<description><![CDATA[Finally I have found S3 library that works in C#. The library was written by Joel Wetzel from Affirma Consulting and I just wanted to spread the word about it. Once downloaded you are presented with the whole C# Visual Studio solution which contains the library project as well as some example on how to [...]]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON--><p>Finally I have found S3 library that works in C#. The library was written by Joel Wetzel from Affirma Consulting and I just wanted to spread the word about it.<br />
Once downloaded you are presented with the whole C# Visual Studio solution which contains the library project as well as some example on how to use it.<br />
There is even a simple wrapper written which greatly simplyfies the use of the affirma&#8217;s library.<br />
As an example:<br />
1. Create wrapper object (constructor listed)</p>
<pre>
<div class="codecolorer-container text default csharp" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; public ThreeSharpWrapper(String awsAccessKeyId, String awsSecretAccessKey)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.config = new ThreeSharpConfig();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.config.AwsAccessKeyID = awsAccessKeyId;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.config.AwsSecretAccessKey = awsSecretAccessKey;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.service = new ThreeSharpQuery(this.config);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }</div></div>
</pre>
<p>and then use it having the following methods:</p>
<pre>
<div class="codecolorer-container text default csharp" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/// Adds a bucket to an S3 account<br />
public void AddBucket(String bucketName);<br />
<br />
&nbsp;/// Returns a string of XML, describing the contents of a bucket<br />
public String ListBucket(String bucketName);<br />
<br />
/// Adds a string to a bucket, as an object<br />
public void AddStringObject(String bucketName, String keyName, String data);<br />
<br />
/// Streams a file to a bucket as an object<br />
public void AddFileObject(String bucketName, String keyName, String localfile);<br />
<br />
/// Streams a file to a bucket as an object, with encryption<br />
public void AddEncryptFileObject(String bucketName, String keyName, String localfile, String encryptionKey, String encryptionIV);<br />
<br />
/// Gets a string object from a bucket, and returns it as a String<br />
public String GetStringObject(String bucketName, String keyName);<br />
<br />
/// Gets a file object from a bucket, and streams it to disk<br />
public void GetFileObject(String bucketName, String keyName, String localfile);<br />
<br />
/// Gets a file object from a bucket, streaming it to disk, with decryption<br />
public void GetDecryptFileObject(String bucketName, String keyName, String localfile, String encryptionKey, String encryptionIV);<br />
<br />
/// Copies an object from a source location to a destination location<br />
public void CopyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey);<br />
<br />
/// Generates a URL to access an S3 object in a bucket<br />
public String GetUrl(String bucketName, String keyName);<br />
<br />
/// Deletes an object from a bucket<br />
public void DeleteObject(String bucketName, String keyName);<br />
<br />
/// Deletes a bucket from an S3 account<br />
public void DeleteBucket(String bucketName);<br />
<br />
/// Changes the request payer value for the specified bucket<br />
public String PaymentChange(String bucketName, PaymentChangeRequest.Payer payer);<br />
<br />
/// Gets the request payer value for the specified bucket<br />
public String PaymentGet(String bucketName);</div></div>
</pre>
<p>The library is dead easy to use and most importantly it works (comparing to other S3 libraries I&#8217;ve found). Great work Joel!<br />
You can download the solution zip from <a href="http://storage43.com/file/show/47">here</a> or directly from the codeplex hosting the project <a href="http://threesharp.codeplex.com/">here</a></p>
<!--INFOLINKS_OFF-->]]></content:encoded>
			<wfw:commentRss>http://www.softwarepassion.com/affirma-s3-library-for-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

