<?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>Martin Ahrer - Together we&#039;ll make IT</title>
	<atom:link href="http://www.martinahrer.at/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinahrer.at</link>
	<description>Java Enterprise Softwareentwicklung und Consulting</description>
	<lastBuildDate>Sat, 02 Mar 2013 19:54:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<meta name="generator" content="deSignum 0.8.1" />
		<item>
		<title>Zero2Hero offering trainings on hot technologies</title>
		<link>http://www.martinahrer.at/2013/03/02/zero2hero-offering-trainings-on-hot-technologies/</link>
		<comments>http://www.martinahrer.at/2013/03/02/zero2hero-offering-trainings-on-hot-technologies/#comments</comments>
		<pubDate>Sat, 02 Mar 2013 19:52:58 +0000</pubDate>
		<dc:creator>martin - Administrator</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=901</guid>
		<description><![CDATA[I&#8217;s been a while since I have written my last blog post. Mostly because I have been busy with Zero2Hero which I have co-founded in fall last year. Zero2Hero is offering the coolest trainings on hot technologies. You can checkout the current offerings at http://www.zero2hero.at. At the moment we are preparing some Git workshops &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;s been a while since I have written my last blog post. Mostly because I have been busy with <a href="http://www.zero2hero.at">Zero2Hero</a> which I have co-founded in fall last year. Zero2Hero is offering the coolest trainings on hot technologies. You can checkout the current offerings at <a href="http://www.zero2hero.at">http://www.zero2hero.at</a>.</p>
<p><a href="http://www.martinahrer.at/wp-content/uploads/2013/03/zero2hero_PNG.png"><img src="http://www.martinahrer.at/wp-content/uploads/2013/03/zero2hero_PNG-300x106.png" alt="" title="zero2hero_PNG" width="300" height="106" class="alignleft size-medium wp-image-902" /></a></p>
<p> At the moment we are preparing some Git workshops &#8211; we have been able to engage Tim Berglund, a well known GitHubber. Registration has already started.</p>
<ul>
<li><a href="http://www.zero2hero.at/gitfromzero2hero/beginners">Git Beginners</a></li>
<li><a href="http://www.zero2hero.at/gitfromzero2hero/advanced">Git Advanced</a></li>
</ul>
<p>In the past months we started a series of workhops around Groovy technologies. So we had started out with Groovy (with Dierk König, Canoo), did Gradle (with Peter Niederwieser, Gradleware). In Fall this year we should finalize this series with a Grails training.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2013/03/02/zero2hero-offering-trainings-on-hot-technologies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy Workshop With Dierk König</title>
		<link>http://www.martinahrer.at/2012/07/21/892/</link>
		<comments>http://www.martinahrer.at/2012/07/21/892/#comments</comments>
		<pubDate>Sat, 21 Jul 2012 18:31:41 +0000</pubDate>
		<dc:creator>martin - Administrator</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=892</guid>
		<description><![CDATA[Zero2Hero is starting their first class series of Groovy trainings with a core Groovy training with Dierk König. Registration is open now! Seats are limited to a maximum of 15.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zero2hero.at/">Zero2Hero</a> is starting their first class series of Groovy trainings with a core <a href="http://www.zero2hero.at/groovyfromzero2hero/">Groovy training</a> with Dierk König. Registration is open now! Seats are limited to a maximum of 15.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2012/07/21/892/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Architecture …</title>
		<link>http://www.martinahrer.at/2012/04/01/architecture/</link>
		<comments>http://www.martinahrer.at/2012/04/01/architecture/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 12:14:04 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Architecture]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=883</guid>
		<description><![CDATA[Whoops! Where did my architecture go? View more presentations from Oliver Gierke]]></description>
			<content:encoded><![CDATA[<div style="width:425px" id="__ss_11678054"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/olivergierke/whoops-where-did-my-architecture-go-11678054" title="Whoops! Where did my architecture go?" target="_blank">Whoops! Where did my architecture go?</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/11678054" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/olivergierke" target="_blank">Oliver Gierke</a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2012/04/01/architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving files from a Git repository to another keeping history</title>
		<link>http://www.martinahrer.at/2012/02/15/868/</link>
		<comments>http://www.martinahrer.at/2012/02/15/868/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 14:54:15 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=868</guid>
		<description><![CDATA[Yesterday I had to move a few files from a Git repository A to repository B while working on a client&#8217;s project. Today I had to do it again on another project. Again I had to think about the sequence of commands I had used. For this reason I&#8217;m posting this here. Prepare repository A [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I had to move a few files from a Git repository A to repository B while working on a client&#8217;s project. Today I had to do it again on another project. Again I had to think about the sequence of commands I had used. For this reason I&#8217;m posting this here.</p>
<p>Prepare repository A (the source)</p>
<pre class="brush:bash">git clone --no-hardlinks /path/to/sourcerepository repositoryA
cd repositoryA
# remove remote origin just so we can't break anything in the source repository
git remote rm origin
# filter for desired files
git filter-branch --subdirectory-filter directory HEAD
# move around files, etc.
# then commit
git add .
git commit -m"isolated files"</pre>
<p>In line #1 we clone the source repository so we can&#8217;t break the original one, we also remove the remote in line #4 so no links back to the source repository exist. Next using the filter-branch command we filter out everything but the directory we want to keep. Read <a href="https://github.com/matthewmccullough/git-workshop/blob/master/workbook/markdown/27-Filter-Branch.md">more</a>&#8230;</p>
<p>Pull files to new repository</p>
<pre class="brush:bash">git clone repositoryB_URL repositoryB
cd repositoryB
git remote add repositoryAbranch /path/to/repositoryA
git pull repositoryAbranch master
git remote rm repositoryAbranch
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2012/02/15/868/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Migrate from Hades to Spring Data JPA</title>
		<link>http://www.martinahrer.at/2011/09/13/migrate-from-hades-to-spring-data-jpa/</link>
		<comments>http://www.martinahrer.at/2011/09/13/migrate-from-hades-to-spring-data-jpa/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 19:27:44 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[hades]]></category>
		<category><![CDATA[spring-data-jpa]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=818</guid>
		<description><![CDATA[For the past 18 months I have been utilizing hades for implementing JPA based repositories/DAOs. Hades has now been moved into the Spring Data JPA project. Starting with their 1.0.1 release I tried migrating one of my projects to this release. Following I document the steps that were necessary to achieve this. Their project page [...]]]></description>
			<content:encoded><![CDATA[<p>For the past 18 months I have been utilizing <a href="http://redmine.synyx.org/projects/hades">hades</a> for implementing JPA based repositories/DAOs. Hades has now been moved into the <a href="http://www.springsource.org/spring-data/jpa">Spring Data JPA</a> project. Starting with their 1.0.1 release I tried migrating one of my projects to this release. Following I document the steps that were necessary to achieve this.</p>
<p>Their project page starts off with showing the Maven repositories and dependency descriptors (in case you are using Maven). Obviously the first thing is to replace the hades artifact by the spring-data-jpa artifact.</p>
<h2>Domain classes, JPA entities</h2>
<p>The project&#8217;s domain classes implement the <code>org.synyx.hades.domain.Persistable</code> interface which has to be replaced by <code>org.springframework.data.domain.Persistable</code> (takes a single generics parameter for the id type).</p>
<h2>CRUD repositories</h2>
<p>DAO interfaces extending <code>org.synyx.hades.dao.GenericDao</code> have to be modified to extend <code>org.springframework.data.repository.CrudRepository</code>. With this modification you will face a couple of compile problems. <code>read*</code>-methods have been renamed to <code>find*</code>-methods. Also you are loosing the paging and sorting capable <code>find*</code> &#8211; methods (which I didn&#8217;t use). If those are required then extend the <code>org.springframework.data.repository.PagingAndSortingRepository</code> interface.</p>
<p><code>find*</code> &#8211; methods now return iterables rather than list types requiring minor adjustments to existing codebase. To get around this, the interface can also extend from <code>JpaRepository</code>. Using this base interface hands you a pretty powerful DAO that goes far beyond a simple CRUD repository.</p>
<h2>CRUD repository instantiation</h2>
<p>When I started off with hades many month ago I used an explicit XML-based configuration of DAO components.</p>
<pre class="brush:xml">
&lt;bean id="addressDao" class="org.synyx.hades.dao.orm.GenericDaoFactoryBean" p:daoInterface="at.martinahrer.training.spring.jpa.dao.hades.AddressDao" /&gt;
</pre>
<p>For migration the factory bean class has to be changed:</p>
<pre class="brush:xml">
&lt;bean id="addressDao" class="org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean" p:daoInterface="at.martinahrer.training.spring.jpa.dao.hades.AddressDao" /&gt;</pre>
<p>With these changes in place all tests were showing the green bar again. However, today I would recommend using repository namespace http://www.springframework.org/schema/data/jpa which significantly reduces the amount of configuration needed by utilizing class path scanning to detect repository components.</p>
<pre class="brush:xml">
&lt;repository:repositories base-package="at.martinahrer.training.spring.jpa.dao" /&gt;
</pre>
<p>Certainly you might encounter more steps during migration depending on the features you have used from the old hades code base. In my case I only had used named JPA queries which just continued to work like before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2011/09/13/migrate-from-hades-to-spring-data-jpa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Analyzing class metadata with the Springframework</title>
		<link>http://www.martinahrer.at/2011/08/16/analyzing-class-metadata-with-the-springframework/</link>
		<comments>http://www.martinahrer.at/2011/08/16/analyzing-class-metadata-with-the-springframework/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 20:11:45 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Bytecode]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Springframework]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=805</guid>
		<description><![CDATA[What a shame I haven&#8217;t published anything for a long time. To make up for this long pause, I&#8217;m going to discuss how Spring can support with analyzing class metadata. These days everybody is crazy about using annotations in their frameworks. Occasionally you need to know what classes/methods are annotated. A good example might be [...]]]></description>
			<content:encoded><![CDATA[<p>What a shame I haven&#8217;t published anything for a long time. To make up for this long pause, I&#8217;m going to discuss how Spring can support with analyzing class metadata. These days everybody is crazy about using annotations in their frameworks. Occasionally you need to know what classes/methods are annotated. A good example might be to build a list of class names for all JPA entities (those classes annotated with javax.persistence.Entity and the like).</p>
<p><strong>A simple use-case showing how to detect classes annotated as components</strong></p>
<p>This use-case is using a few Spring APIs and some home grown code that controls resource matching (ClassResourceResolver and AnnotationMetadataMatcher).</p>
<pre class="brush:java">
import java.io.IOException;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.util.ClassUtils;

public class ClassResourceResolverTest {
	@Test
	public void testSelect() throws IOException {
		// given
		ClassResourceResolver scanner = new ClassResourceResolver(
				ClassUtils.convertClassNameToResourcePath(AComponent.class.getPackage().getName()));
		final MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(
				new PathMatchingResourcePatternResolver());

		// when
		String[] classNames = scanner.select(new AnnotationMetadataMatcher(metadataReaderFactory, false,
				Component.class));
		// then
		Assert.assertArrayEquals(new String[] { AComponent.class.getName() }, classNames);
		Assert.assertTrue(metadataReaderFactory.getMetadataReader(classNames[0]).getAnnotationMetadata()
				.isAnnotated(Component.class.getName()));
	}
}

@Component
class AComponent {
}

@Repository
class ARepository {
}
</pre>
<p><strong>ClassResourceResolver is doing the resource matching all from a set of resource paths</strong></p>
<pre class="brush:java">
	public String[] select(ClassResourceMetadataMatcher matcher) throws IOException {
		List&lt;String&gt; result = new ArrayList&lt;String&gt;();

		for (String path : resourcePath) {
			String resourcePattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + path + "/**/*.class";
			Resource[] resources = this.resourcePatternResolver.getResources(resourcePattern);
			for (Resource resource : resources) {
				if (resource.isReadable()) {
					MetadataReader reader = matcher.match(resource, resourcePatternResolver);
					if (reader != null) {
						result.add(reader.getClassMetadata().getClassName());
					}
				}
			}
		}
		return result.toArray(new String[result.size()]);
	}
</pre>
<p><strong>A ClassResourceMetadataMatcher is looking at the annotations present on a class resource</strong></p>
<pre class="brush:java">
	@Override
	public MetadataReader match(Resource resource, ResourceLoader resolver) throws IOException {
		for (Class&lt;? extends Annotation&gt; annotationType : annotationTypes) {
			MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
			if (new AnnotationTypeFilter(annotationType, considerMetaAnnotations).match(metadataReader,
					metadataReaderFactory)) {
				return metadataReader;
			}
		}
		return null;
	}
</pre>
<p>Under the hood Spring is using the <a href="http://asm.ow2.org/">ASM</a> bytecode library for looking into the class files. Not that no class examined by the code above is actually loading any of the class objects so it is fairly lightweight and not filling up your perm gen space. Still you need to make up useful search paths so you don&#8217;t end up scanning through you full classpath.</p>
<p>The full code just is available as a gist
<pre class="brush:bash">git clone git@gist.github.com:73f21e68d24032ad7672.git</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2011/08/16/analyzing-class-metadata-with-the-springframework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git Workshop mit Matthew McCullough (Github Trainer)</title>
		<link>http://www.martinahrer.at/2011/03/23/git-workshop-mit-matthew-mccullough/</link>
		<comments>http://www.martinahrer.at/2011/03/23/git-workshop-mit-matthew-mccullough/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 20:02:32 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Workshop]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=707</guid>
		<description><![CDATA[Subversion, das wohl immer noch am weitesten verbreitete SCM im Java-Bereich, muss sich in letzter Zeit einige Kritik gefallen lassen. Tatsächlich häufen sich die Anzeichen, dass die Konkurrenten aus dem Lager der verteilten Systeme immer mehr an Popularität gewinnen. So wechseln immer mehr Projekte auf das verteilte Versionsmanagementsystem (DVCS) Git.Ist das nur ein temporärer Hype [...]]]></description>
			<content:encoded><![CDATA[<p>Subversion, das wohl immer noch am weitesten verbreitete SCM im Java-Bereich, muss sich in letzter Zeit einige Kritik gefallen lassen.<br />
Tatsächlich häufen sich die Anzeichen, dass die Konkurrenten aus dem Lager der verteilten Systeme immer mehr an Popularität gewinnen. So wechseln immer mehr Projekte auf das verteilte Versionsmanagementsystem (DVCS) Git.Ist das nur ein temporärer Hype oder eine technologische (R)Evolution?</p>
<p>Am 4.Mai 2011 gibt es erstmals in Österreich einen Git Workshop mit Matthew McCullough (offizieller GitHub Trainer) und somit eine einmalige Gelegenheit zu erfahren was denn hinter dem Erfolg von Git steckt.</p>
<ul>
<li>mit <strong>Matthew McCullough</strong></li>
<li>am <strong>4. Mai 2011, von 9:00-16:30</strong></li>
<li><strong>Spitz Hotel</strong> &#8211; Raum “Round Table 2”<br />
Fiedlerstrasse 6,  4040 Linz<br />
<a href="http://www.spitzhotel.at/">http:// www.spitzhotel.at</a></li>
<li><a href="http://www.martinahrer.at/wp-content/uploads/2011/03/Git-Workshop.pdf" target="_blank" >Trainingsprogramm (Broschüre)</a></li>
<li>€330,00 (zuzüglich Mwst.)</li>
</ul>
<p>Anmeldung per EMail (mit Name und Adresse des anzumeldenden Teilnehmers) an <a href="mailto:office@martinahrer.at?subject=Anmeldung zum Git Workshop mit Matthew McCullough">office@martinahrer.at</a>.  Zum Workshop in Englisch werden maximal 20 Teilnehmer zugelassen, ein eigener Laptop ist mitzunehmen. </p>
<p><strong>Anmeldung von Gruppen ab 3 Personen zu ermäßigtem Preis</strong> auf Anfrage. Im Preis enthalten sind Getränke sowie ein Brötchenbuffet zu Mittag! Ermäßigtes Parken in der Hoteltiefgarage ist möglich.</p>
<p><p><a href="mailto:office@martinahrer.at?subject=Anmeldung zum Git Workshop mit Matthew McCullough" class="btn btn-small" >Zur Anmeldung</a></p>
 <span id="more-707"></span><br />
<br/><br />
<strong>Matthew McCullough’s Bio</strong><br />
<img alt="Matthew McCullough" src="https://d3nwyuy0nl342s.cloudfront.net/images/modules/training/McCullough.jpg" title="Matthew McCullough" class="alignleft" width="130" height="170" />Matthew McCullough is an energetic 15 year veteran of enterprise software development, world-traveling open source educator, and co-founder of Ambient Ideas, LLC, a US consultancy. Matthew currently is a trainer for GitHub.com, author of the Git Master Class series for O&#8217;Reilly, speaker on the No Fluff Just Stuff tour, author of three of the top 10 DZone RefCards, including the Git RefCard, and President of the Denver Open Source Users Group.<br />
His current topics of research center around project automation: build tools (Maven, Leiningen, Gradle), distributed version control (Git), Continuous Integration (Hudson) and Quality Metrics (Sonar).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2011/03/23/git-workshop-mit-matthew-mccullough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing static methods…</title>
		<link>http://www.martinahrer.at/2011/01/19/testing-static-methods/</link>
		<comments>http://www.martinahrer.at/2011/01/19/testing-static-methods/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 11:46:42 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=685</guid>
		<description><![CDATA[We all have learned that it is not wise to overuse static methods as these are kind of hard to test and deal with. So in general I strive to get out of their way. Sometimes I&#8217;m facing the situation that the use of a framework or that some technical infrastructure requires me to implement [...]]]></description>
			<content:encoded><![CDATA[<p>We all have learned that it is not wise to overuse static methods as these are kind of hard to test and deal with. So in general I strive to get out of their way. Sometimes I&#8217;m facing the situation that the use of a framework or that some technical infrastructure requires me to implement static methods.<br />
So for testing I found <a href="https://code.google.com/p/powermock/">PowerMock</a> which nicely integrates with <a href="https://code.google.com/p/powermock/wiki/EasyMock">EasyMock</a> and Mockito.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2011/01/19/testing-static-methods/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActiveMQ in embedded mode</title>
		<link>http://www.martinahrer.at/2010/10/19/activemq-in-embedded-mode/</link>
		<comments>http://www.martinahrer.at/2010/10/19/activemq-in-embedded-mode/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 20:41:38 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ActiveMQ]]></category>
		<category><![CDATA[Springframework]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=665</guid>
		<description><![CDATA[I&#8217;m using Apache ActiveMQ for testing JMS based code. With their Springframework support it&#8217;s pretty simple to embed it into a test suite. Today I encountered a strange problem. After I had broken my test and fixed the bug later I was not able to restart the embedded ActiveMQ container. Obviously java.io.EOFException: Chunk stream does [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using Apache ActiveMQ for testing JMS based code. With their Springframework support it&#8217;s pretty simple to embed it into a test suite.<br />
Today I encountered a strange problem. After I had broken my test and fixed the bug later I was not able to restart the embedded ActiveMQ container.</p>
<p>Obviously <strong>java.io.EOFException: Chunk stream does not exist at page: 0</strong> sounds like some temporary file data was corrupt. <code>JobSchedulerStore</code> creates a directory <code>activemq-data/localhost/scheduler</code> for storing scheduler data. Clean/delete that and it should be startable again. If you don&#8217;t need that then you are better off with completely deactivating that feature.<br />
<span id="more-665"></span></p>
<pre class="brush:xml">
	&lt;amq:broker useJmx="true" persistent="false" start="false" schedulerSupport="true"&gt;
		&lt;amq:transportConnectors&gt;
			&lt;amq:transportConnector uri="${amq.brokerURL}" /&gt;
		&lt;/amq:transportConnectors&gt;
	&lt;/amq:broker&gt;
</pre>
<p>Also its helpful to disable automatic start of the queue container so the test can fully control it.</p>
<pre class="brush:java">
public class ServiceOperationsJmsProducerTest extends AbstractJUnit4SpringContextTests implements BrokerServiceAware {
	private BrokerService brokerService;

	@Test
	public void testProducer() throws Exception {
		try {
			brokerService.start();
			// do the testing
		} finally {
			brokerService.stop();
			brokerService.waitUntilStopped();
		}
	}

	@Override
	@Resource
	public void setBrokerService(BrokerService brokerService) {
		this.brokerService = brokerService;
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2010/10/19/activemq-in-embedded-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AspectJ runtime weaving within a Maven build</title>
		<link>http://www.martinahrer.at/2010/10/16/aspectj-runtime-weaving-within-a-maven-build/</link>
		<comments>http://www.martinahrer.at/2010/10/16/aspectj-runtime-weaving-within-a-maven-build/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 16:11:06 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[AspectJ]]></category>
		<category><![CDATA[Maven]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=654</guid>
		<description><![CDATA[In order to perform AspectJ runtime weaving, an agent is required. Here we are using the agent (spring-instrument-3.0.3.RELEASE) provided by the Springframework. So for surefire we have to use a command line argument -javaagent: that specifies the JAR file containing the agent. To keep the build portable we copy that artifact to the build directory [...]]]></description>
			<content:encoded><![CDATA[<p>In order to perform AspectJ runtime weaving, an agent is required. Here we are using the agent (spring-instrument-3.0.3.RELEASE) provided by the Springframework. So for surefire we have to use a command line argument -javaagent: that specifies the JAR file containing the agent. To keep the build portable we copy that artifact to the build directory first using the maven-dependency-plugin.<br />
<span id="more-654"></span></p>
<pre class="brush:xml">
&lt;plugin&gt;
	&lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
	&lt;executions&gt;
		&lt;execution&gt;
			&lt;id&gt;copy&lt;/id&gt;
			&lt;phase&gt;process-sources&lt;/phase&gt;
			&lt;goals&gt;
				&lt;goal&gt;copy&lt;/goal&gt;
			&lt;/goals&gt;
			&lt;configuration&gt;
				&lt;artifactItems&gt;
					&lt;artifactItem&gt;
						&lt;groupId&gt;org.springframework&lt;/groupId&gt;
						&lt;artifactId&gt;spring-instrument&lt;/artifactId&gt;
						&lt;version&gt;3.0.3.RELEASE&lt;/version&gt;
					&lt;/artifactItem&gt;
				&lt;/artifactItems&gt;
			&lt;/configuration&gt;
		&lt;/execution&gt;
	&lt;/executions&gt;
&lt;/plugin&gt;
</pre>
<p>We have to pass in the weaving agent to surefire.</p>
<pre class="brush:xml">
&lt;plugin&gt;
	&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
	&lt;configuration&gt;
		&lt;argLine&gt;-javaagent:${project.build.directory}/dependency/spring-instrument-3.0.3.RELEASE.jar&lt;/argLine&gt;
	&lt;/configuration&gt;
&lt;/plugin&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2010/10/16/aspectj-runtime-weaving-within-a-maven-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
