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

<channel>
	<title>Tech21</title>
	<atom:link href="http://maips21.altervista.org/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://maips21.altervista.org/tech</link>
	<description>my IT daily work experience</description>
	<pubDate>Wed, 21 Oct 2009 13:50:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>(ITA) - TESTING &amp; Magnolia</title>
		<link>http://maips21.altervista.org/tech/2009/10/21/ita-testing-magnolia/</link>
		<comments>http://maips21.altervista.org/tech/2009/10/21/ita-testing-magnolia/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 13:50:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[Livelink]]></category>

		<category><![CDATA[Magnolia]]></category>

		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=65</guid>
		<description><![CDATA[Prima di chiedersi come si fa a testare, occorre chiedersi &#8220;cosa&#8221; testare e perchè.
Se il perchè può essere ovvio, il &#8220;cosa&#8221; no e spesso è la chiave di volta per dei test di successo.
Cosa NON testare:
- funzionalità &#8220;core&#8221; di Magnolia: per queste ci affidiamo ad un prodotto, si spera che sia testato
- funzionalità &#8220;core&#8221; di [...]]]></description>
			<content:encoded><![CDATA[<p>Prima di chiedersi come si fa a testare, occorre chiedersi &#8220;cosa&#8221; testare e perchè.<br />
Se il perchè può essere ovvio, il &#8220;cosa&#8221; no e spesso è la chiave di volta per dei test di successo.</p>
<p>Cosa NON testare:</p>
<p>- funzionalità &#8220;core&#8221; di Magnolia: per queste ci affidiamo ad un prodotto, si spera che sia testato<br />
- funzionalità &#8220;core&#8221; di Java / Tomcat / Loadbalancer / Sistemi di rete, ecc&#8230; non è compito dei test applicativi testare queste cose</p>
<p>Cosa vale la pena di testare</p>
<p>- funzionalità di business logic<br />
- grafica<br />
- interazioni via browser<br />
- integrazioni con sistemi legacy / esterni<br />
- scritture / letture / interazioni con dati da fonti esterne<br />
- tutto quello che viene costruito &#8220;sopra&#8221; il mattoncino Magnolia</p>
<p>In un progetto Java, ci sono principalmente due modi per effettuare test:</p>
<p>1) Test in fase di build<br />
2) Continuos Integration [3]</p>
<p>Mentre la seconda modalità prevede l&#8217;utilizzo di un ambiente di test separato, integrazione con SVN, definizione rigorosa di suite di test, ecc&#8230; (ovvero, è al momento troppo costoso!) si può procedere con la prima modalità.</p>
<p>In fase di build si possono quindi fare test di due tipi:<br />
1) Test funzionali, puramente java-based<br />
2) Test di &#8220;container&#8221;, ovvero simulando il deploy dell&#8217;artifact in un container (tomcat)</p>
<p>La suite di test da utilizzare è TestNG [1]. In alternativa è possibile ad esempio utilizzare JUnit, che si integra anch&#8217;essa con Surefire.<br />
I test sono da effettuare in fase di build (Maven build).<br />
Per utilizzare testNG è sufficiente dichiarare questa dipendenza all&#8217;interno del parent POM:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <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.testng<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testng<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>5.8<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <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>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classifier<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdk15<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classifier<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>ed utilizzare il plugin</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<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.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-surefire-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.4.3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>I test saranno eseguiti dal plugin Surefire come test TestNG.<br />
Per ulteriori informazioni su Surefire e TestNG vedi [2]</p>
<p>A questo punto occorre chiedersi cosa è possibile testare con un&#8217;ambiente di questo tipo a disposizione.<br />
Sicuramente è possibile testare i metodi di utility, le integrazioni con sistemi esterni (lettura di feed RSS, accesso a DB, ecc..).<br />
L&#8217;unica cosa a cui bisogna porre attenzione è lo &#8220;scope&#8221; del test.<br />
Un test eseguito in fase di build di un modulo altro non può testare che le funzionalità esclusive del modulo stesso o le integrazioni del modulo con l&#8217;ambiente di deploy.<br />
Non è possibile testare le interazioni del modulo con altri moduli.</p>
<p>Es1: vorrei testare la spedizione di una newsletter</p>
<p>artifact: example-magnolia-newsletter.jar<br />
metodo da testare: NewsletterUtil.sendNewsletter(recipientList, newsletterIstance, delay);<br />
presupposti: occorre avere a disposizione l&#8217;architettura dei server / servizi da utilizzare per spedire la newsletter</p>
<p>OK, è testabile.</p>
<p>Es2: vorrei testare la spedizione di una newsletter LEGGENDO gli indirizzi dal DMS Alfresco, utilizzando il modulo example-magnolia-dms.jar</p>
<p>artifact: example-magnolia-newsletter.jar<br />
metodo da testare: NewsletterUtil.sendNewsletter(DMSUtil.getRecipient(id), newsletterIstance, delay);<br />
presupposti: occorre avere a disposizione l&#8217;architettura dei server / servizi da utilizzare per spedire la newsletter</p>
<p>NON è testabile, a meno di non avere un ambiente di test &#8220;reale&#8221; &#8211;&gt; Continuos Integration</p>
<p>Vi è un altro tipo di test, particolare dell&#8217;ambiente di sviluppo di Magnolia.<br />
E&#8217; possibile effettuare dei test automatici che simulano l&#8217;interazione della nostra applicazione con un browser.<br />
Per fare questo occorre utilizzare Selenium [4].<br />
Selenium si compone di due parti, la parte server (o grid) ha il compito di eseguire in un browser i comandi che la parte client invia tramite connessione TCP su porta 4444 (default).</p>
<p>Gli step da percorrere sono i seguenti:<br />
1) Configurare l&#8217;utilizzo di Surefire e TestNG<br />
2) Far partire Selenium Remote Command in fase di pre-integration-test [5]. (* perchè in questa fase?)<br />
3) Far partire un container nel quale &#8220;deployare&#8221; l&#8217;applicazione web<br />
4) DEPLOY -&gt; Magnolia + Modulo<br />
5) Eseguire i test Selenium<br />
6) Spegnere il container e il server Selenium</p>
<p>-&gt; 1) Vedi sopra (Surefire + TestNG)<br />
-&gt; 2) Occorre utilizzare un plugin (selenium-maven-plugin), in fase di pre-integration-test</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<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.codehaus.mojo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>selenium-maven-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #808080; font-style: italic;">&lt;!-- start Selenium server before test execution --&gt;</span>
        		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pre-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start-server<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;background<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/background<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;logOutput<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/logOutput<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;multiWindow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/multiWindow<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        		<span style="color: #808080; font-style: italic;">&lt;!-- stop Selenium server after test execution --&gt;</span>
        		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>stop<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>post-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>stop-server<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
           			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>-&gt; 3) Per far partire Tomcat (il container di riferimento per la piattaforma) occorre utilizzare l&#8217;ennesimo plugin (cargo-maven-plugin), in fase di pre-integration-test</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;inherited<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/inherited<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<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.codehaus.cargo<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>cargo-maven2-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
				<span style="color: #808080; font-style: italic;">&lt;!-- Container configuration --&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;container<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;containerId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>tomcat6x<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/containerId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #808080; font-style: italic;">&lt;!-- container.home: indica dove andare a prendere i file originari di tomcat --&gt;</span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>c:/dev/apache-tomcat/apache-tomcat-6.0.20<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;output<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/cargo/tomcat.log<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/output<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/cargo/cargo.log<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/log<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/container<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
				<span style="color: #808080; font-style: italic;">&lt;!-- Configuration to use with the above container --&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #808080; font-style: italic;">&lt;!-- configuration.home: indica dove far girare il container --&gt;</span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${project.build.directory}/tomcat/container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/home<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cargo.servlet.port<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>8090<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cargo.servlet.port<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #808080; font-style: italic;">&lt;!-- utilizzare 8090, in quanto è possibile avere altre istanze attive --&gt;</span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cargo.logging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>high<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cargo.logging<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;cargo.jvmargs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${heap.pre} ${heap.max} ${permsize}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/cargo.jvmargs<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
				<span style="color: #808080; font-style: italic;">&lt;!--  </span>
<span style="color: #808080; font-style: italic;">					By default the Maven2 plugin will wait after the container is started. </span>
<span style="color: #808080; font-style: italic;">					It means that you have to either press Ctrl-C or to run cargo:stop from another shell to stop it. </span>
<span style="color: #808080; font-style: italic;">					If you are using Cargo to automate your functional tests, you'll want the plugin </span>
<span style="color: #808080; font-style: italic;">					not to wait so that you can execute your tests after the container is started. </span>
<span style="color: #808080; font-style: italic;">					To achieve this simply specify &lt;wait&gt;false&lt;/wait&gt; in the Cargo's configuration in your pom.xml.</span>
<span style="color: #808080; font-style: italic;">				--&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wait<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wait<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #808080; font-style: italic;">&lt;!-- start container before tests execution --&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start-container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pre-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deploy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
				<span style="color: #808080; font-style: italic;">&lt;!-- stop container before tests execution --&gt;</span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>stop-container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>post-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>stop<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>-&gt; 4) Questa è la fase più delicata. Una volta partito tomcat occorre deployare all&#8217;interno webapp Magnolia, possibilimente già installata e con licenza EE, e occorre deployare al suo interno il modulo in questione.<br />
Per fare questo ci sono due opzioni:<br />
A) Procedere con un deploy configurato in cargo:</p>
<p>modificare:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">		<span style="color: #808080; font-style: italic;">&lt;!-- start container before tests execution --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start-container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pre-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deploy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>		in:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">		<span style="color: #808080; font-style: italic;">&lt;!-- start container before tests execution --&gt;</span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start-container<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pre-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>start<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deploy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployables<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;group-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.example.magnolia<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/group-id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>magnoliaAuthor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>war<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pingURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://localhost:8090/magnoliaAuthor/.magnolia/pages/adminCentral.html?mgnlUserId=superuser<span style="color: #ddbb00;">&amp;amp;</span>mgnlUserPSWD=superuser<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pingURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pingTimeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>180000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pingTimeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>magnoliaAuthor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployables<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>in questo modo, il WAR identificato dal gruppo Maven indicato verrà deployato all&#8217;interno del container.<br />
Rimane ancora il problema di integrare il progetto attualmente in fase di build con il file WAR e di eseguire l&#8217;installazione di Magnolia.</p>
<p>B) Procedere con un deploy &#8220;manuale&#8221;, mediato da task ant</p>
<p>è possibile definire un task ant da eseguire in una qualunque fase di esecuzione di una maven build.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				...
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<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.apache.maven.plugins<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>maven-antrun-plugin<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>copyModule<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>pre-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
									<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Copy module ${project.build.finalName}.jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
									<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> </span>
<span style="color: #009900;">										<span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;target/${project.build.finalName}.jar&quot;</span></span>
<span style="color: #009900;">										<span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;../magnoliaAuthor-integrationTest/src/main/magnoliaAuthor/WEB-INF/lib&quot;</span></span>
<span style="color: #009900;">										<span style="color: #000066;">overwrite</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>run<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
						<span style="color: #808080; font-style: italic;">&lt;!-- cancella il file dopo i test --&gt;</span>					
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>deleteModule<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>post-integration-test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/phase<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
									<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Delete module  ${project.name}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
									<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
										<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> </span>
<span style="color: #009900;">											<span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;../magnoliaAuthor-integrationTest/src/main/magnoliaAuthor/WEB-INF/lib&quot;</span></span>
<span style="color: #009900;">										    <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;${project.build.finalName}*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
									<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/delete<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/tasks<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
								<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>run<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goal<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
							<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/goals<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/execution<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/executions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				...
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plugins<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/build<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>		A questo punto occorre modificare Cargo, in modo da caricare la webapp di integration:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployables<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;deployable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>war<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;location<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>../magnoliaAuthor-integrationTest/src/main/magnoliaAuthor<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/location<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pingURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://localhost:8080/magnoliaAuthor/demo-project.html?mgnlUserId=superuser<span style="color: #ddbb00;">&amp;amp;</span>mgnlUserPSWD=superuser<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pingURL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
						<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pingTimeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>180000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pingTimeout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
					<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployables<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/deployer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>La webapp sarà quindi deployata non più come war, ma come semplice &#8220;copia e incolla&#8221; di cartella e conterrà al suo interno il file da testare.</p>
<p>-&gt; 5) I test partono e se contengono invocazioni remote a Selenium queste saranno eseguite e si vedrà &#8220;apparire&#8221; sullo schermo un browser che eseguirà i comandi richiesti.<br />
-&gt; 6) Le dichiarazioni dei plugin precedenti contengono due fasi di esecuzione: quella relativa alla fase &#8220;post-integration-test&#8221; avviene dopo aver eseguito i test.</p>
<p>PUNTI APERTI:</p>
<p>è possibile partire dalla empty webapp di magnolia e utilizzare un cargo che carica:<br />
- empty webapp CE (versione X)<br />
- moduli EE dichiarati per la versione (X)<br />
- modulo aggiuntivo da testare<br />
- effettua l&#8217;installazione del repository<br />
- effettua il caricamento della licenza<br />
?</p>
<p>E&#8217; possibile / ha senso avere un WAR di test collegato ad un repository di test, in modo da evitare la fase di installazione?</p>
<p>NB: per testare funzionalità core di Magnolia e precisamente legate a:<br />
- Content<br />
- Context<br />
- HierarchyManager<br />
è possibile utilizzare delle classi di mockup (http://www.easymock.org) che facilitano l&#8217;interazione con questi oggetti.<br />
Vedere [7]</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[1] <a href="http://testng.org">http://testng.org</a><br />
[2] <a href="http://maven.apache.org/plugins/maven-surefire-plugin/testng.html">http://maven.apache.org/plugins/maven-surefire-plugin/testng.html</a><br />
[3] <a href="http://en.wikipedia.org/wiki/Continuous_integration">http://en.wikipedia.org/wiki/Continuous_integration</a><br />
[4] <a href="http://seleniumhq.org">http://seleniumhq.org</a><br />
[5] <a href="http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference">http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference</a><br />
[6] <a href="http://mojo.codehaus.org/selenium-maven-plugin/">http://mojo.codehaus.org/selenium-maven-plugin/</a><br />
[7] <a href="http://wiki.magnolia-cms.com/display/DEV/Testing+Magnolia">http://wiki.magnolia-cms.com/display/DEV/Testing+Magnolia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/10/21/ita-testing-magnolia/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Repairing a &#8220;missing child&#8221; error on Magnolia 3.6.3</title>
		<link>http://maips21.altervista.org/tech/2009/06/24/repairing-a-missing-child-error-on-magnolia-363/</link>
		<comments>http://maips21.altervista.org/tech/2009/06/24/repairing-a-missing-child-error-on-magnolia-363/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 15:03:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=62</guid>
		<description><![CDATA[This little article is related to Magnolia 3.6.3 but it uses magnolia-tools, a common tool for any >3.5 version of Magnolia.
Case description
At tomcat start-up an error message, thrown by SearchIndexer says:

ERROR org.apache.jackrabbit.core.query.OnWorkspaceInconsistency OnWorkspaceInconsistency.java(handleMissingChildNode:57) 18.06.2009 16:38:38 Node /news/latest/2009/04/18 (16a3070f-5297-435b-b04b-304b889cb26d) has missing child 'latestnews-77811' (19d83f35-05cd-4f81-ace6-81477039fe61)
ERROR org.apache.jackrabbit.core.RepositoryImpl RepositoryImpl.java(getWorkspaceInfo:733) 18.06.2009 16:38:38 Unable to initialize workspace 'data'
javax.jcr.RepositoryException: Error indexing workspace: [...]]]></description>
			<content:encoded><![CDATA[<p>This little article is related to Magnolia 3.6.3 but it uses magnolia-tools, a common tool for any >3.5 version of Magnolia.</p>
<p>Case description<br />
At tomcat start-up an error message, thrown by SearchIndexer says:</p>

<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">ERROR org.apache.jackrabbit.core.query.OnWorkspaceInconsistency OnWorkspaceInconsistency.java(handleMissingChildNode:57) 18.06.2009 16:38:38 Node /news/latest/2009/04/18 (16a3070f-5297-435b-b04b-304b889cb26d) has missing child 'latestnews-77811' (19d83f35-05cd-4f81-ace6-81477039fe61)
ERROR org.apache.jackrabbit.core.RepositoryImpl RepositoryImpl.java(getWorkspaceInfo:733) 18.06.2009 16:38:38 Unable to initialize workspace 'data'
javax.jcr.RepositoryException: Error indexing workspace: Error indexing workspace: Error indexing workspace</pre></div></div>

<p>The approach of forcing consistency check within Jackrabbit configuration was not helpful, because Jackrabbit can fix missing references, but not missing nodes.</p>
<p>With a good help of our friend (Jan) we manage to fix this, althought some data has been lost.</p>
<p>1) Do a full backup, anyway<br />
2) In this case, the affected workspace is &#8220;data&#8221;, so we created a /tmp folder within Magnolia AdminInterface<br />
3) We moved the &#8220;father&#8221; on /tmp, again within AdminInterface<br />
4) We deployed magnolia-tools (version 1.0.5) jar in webapp/WEB-INF/lib folder.<br />
5) We copied the /bin folder of magnolia-tools on webapp folder<br />
6) Now, to avoid time consumption, we commented out the &#8220;SearchIndexer&#8221; part on webapp/repositories/magnolia/workspaces/data/workspace.xml file<br />
7) with tomcat stopped, we launch this from the /bin folder:</p>

<div class="wp_syntax"><div class="code"><pre class="bat" style="font-family:monospace;">sh ./removenode --uuid 16a3070f-5297-435b-b04b-304b889cb26d --workspace
data --webapp /var/lib/tomcat5/webapps/magnoliaAuthor &gt; log 2&gt;&amp;1</pre></div></div>

<p>where 16a3070f-5297-435b-b04b-304b889cb26d is the node&#8217;s uuid of the parent of the missing node (missing node uuid = 19d83f35-05cd-4f81-ace6-81477039fe61).</p>
<p>Now the parent is removed and Magnolia can bootstrap fine!</p>
<p>8 and final step) Uncomment worskpace.xml and decide if remove the /bin folder, for security purpose.</p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/06/24/repairing-a-missing-child-error-on-magnolia-363/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS Training Course</title>
		<link>http://maips21.altervista.org/tech/2009/06/02/css-training-course/</link>
		<comments>http://maips21.altervista.org/tech/2009/06/02/css-training-course/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 10:11:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=54</guid>
		<description><![CDATA[Being called to teach CSS techniques, I&#8217;ve decided to add a post here which can contains all references I&#8217;ll found over this topic. 
* Most of this resources are in italian because it is the course spoken lanaguage, sorry.
First of all, PPT slides I&#8217;ve made for Politecnico di Milano CSS Crash Course, on 2006.
CSS basic [...]]]></description>
			<content:encoded><![CDATA[<p>Being called to teach CSS techniques, I&#8217;ve decided to add a post here which can contains all references I&#8217;ll found over this topic. </p>
<p>* Most of this resources are in italian because it is the course spoken lanaguage, sorry.</p>
<p>First of all, PPT slides I&#8217;ve made for Politecnico di Milano CSS Crash Course, on 2006.<br />
<a href='http://maips21.altervista.org/tech/wp-content/uploads/2009/06/e_03_css.pdf'>CSS basic course (PDF)</a><br />
<a href='http://maips21.altervista.org/tech/wp-content/uploads/2009/06/e_04_esempi_css.pdf'>CSS basic course, samples (PDF)</a></p>
<p>Italian resources:<br />
<a href="http://css.html.it/guide/leggi/2/guida-css-di-base/">HTML.it CSS basic course</a><br />
 - <a href='http://maips21.altervista.org/tech/wp-content/uploads/2009/06/01_guida_stampabile.pdf'>printable version</a><br />
<a href="http://css.html.it/guide/leggi/3/guida-layout-dei-siti-con-i-css/">HTML.it CSS layout course</a><br />
 - <a href='http://maips21.altervista.org/tech/wp-content/uploads/2009/06/01_guida_stampabile1.pdf'>printable version</a><br />
<a href="http://it.html.net/tutorials/css/">html.net css tutorial</a></p>
<p>English resources:<br />
<a href="http://www.w3schools.com/css/">W3Schools CSS tutorial</a><br />
<a href="http://www.freecsstemplates.org/">Free CSS Templates</a> (400+ free templates)<br />
<a href="http://blog.html.it/layoutgala/">Layout Gala</a>: 1 markup, 40 templates<br />
<a href="http://www.intensivstation.ch/en/templates/">Intensivstation</a><br />
<a href="http://layouts.ironmyers.com/">Ironmyers </a>- Layout generator<br />
<a href="http://www.mycelly.com/">MyCelly.com</a><br />
<a href="http://www.dynamicdrive.com/style/layouts/">DynamicDrive</a></p>
<p>Frameworks:<br />
<a href="http://www.smashingmagazine.com/2007/09/21/css-frameworks-css-reset-design-from-scratch/">A good article speaking about CSS frameworks</a><br />
<a href="http://www.blueprintcss.org/">BlueprintCSS </a>- Maybe the first CSS framework<br />
<a href="http://speckyboy.com/2008/03/28/top-12-css-frameworks-and-how-to-understand-them/">Top 12 (11?) CSS Frameworks</a></p>
<p>Tools:<br />
<a href="http://greengeckodesign.com/projects/menumatic.aspx">MenuMatic: a dynamic MooTools based menu engine</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/06/02/css-training-course/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to install Windows XP over Acer Aspire 7738G</title>
		<link>http://maips21.altervista.org/tech/2009/05/26/how-to-install-windows-xp-over-acer-aspire-7738g/</link>
		<comments>http://maips21.altervista.org/tech/2009/05/26/how-to-install-windows-xp-over-acer-aspire-7738g/#comments</comments>
		<pubDate>Mon, 25 May 2009 23:50:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Windows XP]]></category>

		<category><![CDATA[7738g]]></category>

		<category><![CDATA[acer]]></category>

		<category><![CDATA[AHCI]]></category>

		<category><![CDATA[aspire]]></category>

		<category><![CDATA[Intel Matrix Storage]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=50</guid>
		<description><![CDATA[The Acer Aspire 7738G notebook is shipped with Windows Vista Home Premium SO.
A friend of mine bought this (good) notebook but wanted to downgrade to Windows XP.
The first thing I made is to check if drivers are available: 
http://www.acer.com &#8211;> Support &#8211;> Drivers &#8211;> &#8230; &#8211;> YES! They are! 
So download all of them and [...]]]></description>
			<content:encoded><![CDATA[<p>The Acer Aspire 7738G notebook is shipped with Windows Vista Home Premium SO.<br />
A friend of mine bought this (good) notebook but wanted to downgrade to Windows XP.<br />
The first thing I made is to check if drivers are available: </p>
<p><a href="http://www.acer.com">http://www.acer.com</a> &#8211;> Support &#8211;> Drivers &#8211;> &#8230; &#8211;> YES! They are! </p>
<p>So download all of them and extract on a USB Key (you can also burn a CD).<br />
Then, the second thing is to find a solution for the AHCI Controller.</p>
<p>To properly boot WIndows XP CD, first enter the BIOS and change SATA Controller Mode from AHCI to IDE. In this way, a normal Windows XP boot CD can load, otherwise you have 2 options: </p>
<p>1) Download SATA HCI Drivers (see below), create a driver floppy disk and on Windows XP boot start, hit F6 and load custom driver<br />
2) Using nLite create your own Windows XP copy with AHCI driver already preloaded.</p>
<p>Method 1 requires a floppy driver, I have none! Method 2 is time consuming, so I prefer to try another way.</p>
<p>After enabled IDE mode for SATA drivers, I installed Windows XP as usual: the only thing to take care is to use the &#8220;C&#8221; partition, the &#8220;Acer&#8221; one, because the &#8220;E&#8221; partition and the &#8220;unnamed&#8221; partition contains recovery information, so avoid to touch them.</p>
<p>Wait until Windows load&#8230;</p>
<p>At this point we need to enable the AHCI SATA mode.<br />
Download <strong>the latest</strong> version of Intel Matrix Storage Manager here: </p>
<p><a href="http://www.intel.com/support/it/chipsets/imsm/ ">http://www.intel.com/support/it/chipsets/imsm/ </a></p>
<p>Since we want to change drivers of a boot hard drive, a standard installation would not have success. So we need a little more work.</p>
<p>Unpack with &#8220;-a&#8221; command line option: cmd > iata88cd.exe -a</p>
<p>It will unpack all files under &#8220;Program Files > Intel > Matrix Storage Manager&#8221;.<br />
Look for the folder &#8220;Driver&#8221;, or Driver64 if you need drivers for 64 bit.<br />
Copy iaStor.sys from this folder to C:\Windows\System32\Drivers folder, overwriting the existing one.</p>
<p>Now, open Device Manager (Control Panel > System > third tab) and select the Intel(R) ICH9M/M-E 2 port &#8230; 2928 controller.<br />
Right click, update drivers.<br />
Force to load drivers from the Matrix Storage Manager Driver folder and select the <strong>iaahci.inf</strong> file. Click next and select the right controller, in this case it is the Intel(R) ICH9M/M-E.<br />
Windows now says that the driver can be harmful, but trust me and go on.<br />
When installation is finished, reboot the system WITHOUT touching the second controller (292D).</p>
<p>Now enable from the BIOS the AHCI mode.</p>
<p>Windows should start well and now it will let you install the standard Intel Matrix Storage Manager installation procedure.<br />
Reboot the system and now you have only one AHCI enabled controller!</p>
<p>NOTES:<br />
At one moment I have tried also to follow another procedure, with a little regedit phase.<br />
I&#8217;ve launched this code from a hci.reg file:</p>

<div class="wp_syntax"><div class="code"><pre class="reg" style="font-family:monospace;"><span style="color: #0000FF;">Windows Registry Editor Version 5.00</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_LOCAL_MACHINE</span>\SYSTEM\ControlSet001\Control\CriticalDeviceDatabase\pci#ven_8086&amp;dev_2922&amp;cc_0106<span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">&quot;Service&quot;</span><span style="color: #000000;">=</span><span style="">&quot;iaStor&quot;</span>
<span style="color: #0000FF;">&quot;ClassGUID&quot;</span><span style="color: #000000;">=</span><span style="">&quot;<span style="color: #FF6600;"><span style="color: #000000;">&#123;</span>4D36E96A-E325-11CE-BFC1-08002BE10318<span style="color: #000000;">&#125;</span></span>&quot;</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_LOCAL_MACHINE</span>\SYSTEM\CurrentControlSet\Services\iaStor<span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">&quot;Type&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000001</span>
<span style="color: #0000FF;">&quot;Start&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000000</span>
<span style="color: #0000FF;">&quot;Group&quot;</span><span style="color: #000000;">=</span><span style="">&quot;SCSI miniport&quot;</span>
<span style="color: #0000FF;">&quot;ErrorControl&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000001</span>
<span style="color: #0000FF;">&quot;ImagePath&quot;</span><span style="color: #000000;">=</span><span style="">&quot;system32\\drivers\\iaStor.sys&quot;</span>
<span style="color: #0000FF;">&quot;tag&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000019</span>
<span style="color: #0000FF;">&quot;DisplayName&quot;</span><span style="color: #000000;">=</span><span style="">&quot;Intel AHCI Controller&quot;</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_LOCAL_MACHINE</span>\SYSTEM\CurrentControlSet\Services\iaStor\Parameters<span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">&quot;queuePriorityEnable&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000000</span>
&nbsp;
<span style="color: #000000;">&#91;</span><span style="color: #800000;">HKEY_LOCAL_MACHINE</span>\SYSTEM\CurrentControlSet\Services\iaStor\Enum<span style="color: #000000;">&#93;</span>
<span style="color: #0000FF;">&quot;0&quot;</span><span style="color: #000000;">=</span><span style="">&quot;PCI\\VEN_8086&amp;DEV_2922&amp;SUBSYS_B0051458&amp;REV_02\\3&amp;13c0b0c5&amp;0&amp;FA&quot;</span>
<span style="color: #0000FF;">&quot;Count&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000001</span>
<span style="color: #0000FF;">&quot;NextInstance&quot;</span><span style="color: #000000;">=</span><span style="color: #0000FF;">dword:00000001</span></pre></div></div>

<p>USEFUL LINKS:<br />
- <a href="http://www.tlishop.it/DIT_Products/DIT_ProdDetailsL5.asp?ref=0793A861">Some details on Acer Aspire 7738g </a><br />
- <a href="http://www.intel.com/support/it/chipsets/imsm/">Intel Matrix Storage Manager</a><br />
- <a href="http://www.hwupgrade.it/forum/showpost.php?p=24283388&#038;postcount=6280">HWUpgrade forum (italian) speaking about it</a><br />
- <a href="http://forums.pcper.com/showthread.php?t=444831">English forum speaking about it</a></p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/05/26/how-to-install-windows-xp-over-acer-aspire-7738g/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Building a modular component for Magnolia - Part 1</title>
		<link>http://maips21.altervista.org/tech/2009/05/22/building-a-modular-component-for-magnolia-part-1/</link>
		<comments>http://maips21.altervista.org/tech/2009/05/22/building-a-modular-component-for-magnolia-part-1/#comments</comments>
		<pubDate>Fri, 22 May 2009 16:37:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=21</guid>
		<description><![CDATA[Let&#8217;s say: I would like to have  on my site a html component which let me see next days weather forecast.
This component can be configured for each instance (e.g.: on home I would like to see a summary and on other pages I would like to see a detailed forecast).
This component can also answer to [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say: I would like to have  on my site a html component which let me see next days weather forecast.</p>
<p>This component can be configured for each instance (e.g.: on home I would like to see a summary and on other pages I would like to see a detailed forecast).</p>
<p>This component can also answer to specific parameters (e.g.: ?showTime=true / ?forecastDate=2009.05.23).</p>
<p>Ok, we are ready to start!</p>
<p><strong>01 - Build an empty component</strong></p>
<p>Create a new Java class, call it <em>WeatherStation.java</em></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.mycompany.magnolia.modules</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">info.magnolia.cms.core.Content</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WeatherStation <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> WeatherStation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>HttpServletRequest request, Content config<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//...</span>
    <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;component weather instantiated!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now, create a new paragraph renderer, <em>WeatherStationParagraphRenderer.java</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.mycompany.magnolia.modules</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">info.magnolia.cms.core.Content</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WeatherStationParagraphRenderer <span style="color: #000000; font-weight: bold;">implements</span> ParagraphRenderer<span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//...</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> render<span style="color: #009900;">&#40;</span>Content content, Paragraph paragraph, <span style="color: #003399;">Writer</span> out<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//...</span>
&nbsp;
  HttpServletRequest request <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>WebContext<span style="color: #009900;">&#41;</span>ctx<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  WeatherStation weatherStationComponent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WeatherStation <span style="color: #009900;">&#40;</span>request, content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//..</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This because we want to &#8220;emulate&#8221; a MVC lifecycle, instantiating object outside the rendering JSP templates.</p>
<p>At this point we can log-in to Magnolia AdminCentral and configure a paragraph, making it pointing to the right paragraphRenderer (add one or use one you can edit, not the default one). Remember to add a paragraph and a dialog too.</p>
<p><a href="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/config.jpg"><img class="alignnone size-medium wp-image-24" src="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/config-300x171.jpg" alt="config" width="300" height="171" /></a></p>
<p>Click on this picure to enlarge.</p>
<p>The corresponding eclipse project structure is the following:</p>
<p><a href="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/eclipse-config.png"><img class="alignnone size-full wp-image-25" src="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/eclipse-config.png" alt="eclipse-config" width="306" height="341" /></a></p>
<p>To complete, this is the code inside main.jsp</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;%@ taglib prefix<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cms&quot;</span> uri<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cms-taglib&quot;</span>%&gt;</span>
<span style="color: #009900;">&lt;cms:editBar editLabel<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Edit&quot;</span> moveLabel<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Move&quot;</span> deleteLabel<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Delete&quot;</span> showParagraphName<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Weather station is alive<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>

<p>and inside weatherStationTest.jsp</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;%@ taglib prefix<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cms&quot;</span> uri<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;cms-taglib&quot;</span>%&gt;</span>
<span style="color: #009900;">&lt;%@ taglib prefix<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;c&quot;</span> uri<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://java.sun.com/jsp/jstl/core&quot;</span> %&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;cms:links <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Test Weather Station<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Ready for testing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
		<span style="color: #009900;">&lt;cms:newBar contentNodeCollectionName<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mainAreaComponents&quot;</span> paragraph<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;weather-station&quot;</span> newLabel<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Add&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;cms:contentNodeIterator contentNodeCollectionName<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mainAreaComponents&quot;</span>&gt;</span>
			<span style="color: #009900;">&lt;cms:includeTemplate <span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>cms:contentNodeIterator&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>Ok, if everything is done correctly you can add a new page, add a template and add all Magnolia standard taglibs to handle paragraph instantiation:</p>
<p><a href="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/website.jpg"><img class="alignnone size-medium wp-image-32" src="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/website-300x103.jpg" alt="website" width="300" height="103" /></a></p>
<p>And the output should be that:<br />
<a href="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/ready.jpg"><img class="alignnone size-full wp-image-30" src="http://maips21.altervista.org/tech/wp-content/uploads/2009/05/ready.jpg" alt="ready" width="518" height="113" /></a></p>
<p>Of course, on the log file you should see the message: <em>component weather instantiated!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/05/22/building-a-modular-component-for-magnolia-part-1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Too many open files!</title>
		<link>http://maips21.altervista.org/tech/2009/03/06/too-many-open-files/</link>
		<comments>http://maips21.altervista.org/tech/2009/03/06/too-many-open-files/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 22:33:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[CMS]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Magnolia]]></category>

		<category><![CDATA[Ubuntu Linux]]></category>

		<category><![CDATA[files]]></category>

		<category><![CDATA[too many]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=13</guid>
		<description><![CDATA[While testing Magnolia CMS 4.0 RC4 on my Ubuntu Linux, I&#8217;ve encounter this error in catalina.out

  java.io.FileNotFoundException: /home/matteo/software/magnolia/magnolia-enterprise-4.0-rc4/apache-tomcat-5.5.27/webapps/magnoliaAuthor/repositories/magnolia/workspaces/config/db/seg0/cd1.dat (Too many open files)

Magnolia, by default, uses Derby database, a filesystem based ones, which opens a large amount of files.
I&#8217;ve solved this issue changing file limit by editing /etc/sysctl.conf and set fs.file-max to 400000 AND setting [...]]]></description>
			<content:encoded><![CDATA[<p>While testing Magnolia CMS 4.0 RC4 on my Ubuntu Linux, I&#8217;ve encounter this error in catalina.out</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">  java.io.FileNotFoundException: /home/matteo/software/magnolia/magnolia-enterprise-<span style="color: #ff0000;">4.0</span>-rc4/apache-tomcat-5.5.27/webapps/magnoliaAuthor/repositories/magnolia/workspaces/config/db/seg0/cd1.dat (Too many open <span style="color: #00007f;">files</span>)</pre></div></div>

<p>Magnolia, by default, uses Derby database, a filesystem based ones, which opens a large amount of files.<br />
I&#8217;ve solved this issue changing file limit by editing /etc/sysctl.conf and set fs.file-max to 400000 AND setting this line</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">  tomcatservice hard nofile <span style="color: #ff0000;">5000</span></pre></div></div>

<p>in /etc/security/limits.conf. I needed to restart the session and everything works fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/03/06/too-many-open-files/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ok, let&#8217;s start!</title>
		<link>http://maips21.altervista.org/tech/2009/02/17/ok-lets-start/</link>
		<comments>http://maips21.altervista.org/tech/2009/02/17/ok-lets-start/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 23:01:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[OT]]></category>

		<category><![CDATA[introduction hello world]]></category>

		<guid isPermaLink="false">http://maips21.altervista.org/tech/?p=3</guid>
		<description><![CDATA[Hi all, a little introduction just to break the ice.
This is the first post in this blog. My name is Matteo Pelucco, I&#8217;m a Computer Science Engineer and I like to work around the field of CMS (Content Management System). This blog would like to be a sort of &#8220;daily diary&#8221; of my IT activities, [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all, a little introduction just to break the ice.</p>
<p>This is the first post in this blog. My name is Matteo Pelucco, I&#8217;m a Computer Science Engineer and I like to work around the field of CMS (Content Management System). This blog would like to be a sort of &#8220;daily diary&#8221; of my IT activities, I hope that my notes can help somebody out here looking for help.</p>
<p>I want to start simply saying&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloWorld <span style="color: #009900;">&#123;</span>
      <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> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello World!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And good reading&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://maips21.altervista.org/tech/2009/02/17/ok-lets-start/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
