Difference between revisions of "Integration and Interoperability Facilities Framework: Client Libraries Management Model"

From Gcube Wiki
Jump to: navigation, search
m (How)
(How)
Line 75: Line 75:
 
</build>
 
</build>
 
</source>
 
</source>
 +
 +
Note that when running the tests from the IDE, Eclipse does not go through all phases of a maven build, so either go to the shell and do:
 +
<source>
 +
> mvn generate-test-resources
 +
</source>
 +
 +
so as to stage the resources necessary for testing, or do the same from within the IDE (simply running them as JUnit test won't do it).
  
 
==Integration Testing==
 
==Integration Testing==
 
===When===
 
===When===
 
===How===
 
===How===

Revision as of 19:13, 25 June 2012

Building of Client Libraries

Profiling of client libraries as system components

Testing of client libraries

Unit Testing using My-Container

When

When needing to exercise the functional features of a CL against the targeted service, the most convenient way to do it is through in-container testing, using my-container. My-container can be used as a convenience for running the tests through Maven or in Eclipse against a small distribution and for simple interactions, not requiring contacting the outside world.

How

To test your CL calls to the targeted web service through my container you need to add the relevant dependencies to its POM, declaring their scope as test. Assuming our web service is marked by the artifact id 'sample-service-multi-core' the declarations areL

<dependency>
    <groupId>org.gcube.tools</groupId>
    <artifactId>my-container</artifactId>
    <version>1.0.0</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.gcube.samples</groupId>
    <artifactId>sample-service-multi-core</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <type>gar</type>
    <scope>test</scope>
</dependency>

Then you need to instruct Maven to install my-container and to deploy the service GAR in my-container for the service to be up and running. In the POM of the CL, instruct Maven to take it and place it in src/test/resources before the tests are ran:

<build>
<plugins>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-dependency-plugin</artifactId>
		<version>2.3</version>
		<executions>
			<execution>
				<id>install-service</id>
				<phase>generate-test-resources</phase>
				<goals>
					<goal>copy-dependencies</goal>
				</goals>
				<configuration>
					<includeArtifactIds>sample-service-multi-core</includeArtifactIds>
					<overWriteSnapshots>true</overWriteSnapshots>
					<includeTypes>gar</includeTypes>
					<excludeTransitive>true</excludeTransitive>
					<outputDirectory>src/test/resources</outputDirectory>
					<stripVersion>true</stripVersion>
				</configuration>
			</execution>		
			<execution>
				<id>install-my-container</id>
				<phase>generate-test-resources</phase>
				<configuration>
					<artifactItems>
						<artifactItem>
							<groupId>org.gcube.tools</groupId>
							<artifactId>my-container</artifactId>
							<version>1.0.0</version>
							<type>tar.gz</type>
							<classifier>distro</classifier>
							<overWrite>false</overWrite>
							<outputDirectory>${project.basedir}</outputDirectory>
						</artifactItem>
					</artifactItems>
					<markersDirectory>${project.basedir}</markersDirectory>
				</configuration>
				<goals>
					<goal>unpack</goal>
				</goals>
			</execution>
		</executions>
	</plugin>
 
</plugins>
</build>

Note that when running the tests from the IDE, Eclipse does not go through all phases of a maven build, so either go to the shell and do:

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic


> mvn generate-test-resources

so as to stage the resources necessary for testing, or do the same from within the IDE (simply running them as JUnit test won't do it).

Integration Testing

When

How