# HG changeset patch # User ymh # Date 1381937571 -7200 # Node ID ecbb104cf3b65395599f8faa6b7c36e55fb74197 # Parent 885f09f3462bd5761d102ba765b1f53e6092c599 Upgrade to jetty 8, Jersey 2.3, cometd 2.7, coweb 1.0.1 and more... diff -r 885f09f3462b -r ecbb104cf3b6 .classpath --- a/.classpath Sun Oct 06 14:12:02 2013 +0200 +++ b/.classpath Wed Oct 16 17:32:51 2013 +0200 @@ -4,69 +4,24 @@ - - - - - - - - - - - - - - - - - - - + - + - - - - - - + - - - - - - - - - - - - - - - - - - - - - - @@ -119,19 +74,19 @@ - + - + - + @@ -200,56 +155,20 @@ - + - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - @@ -269,10 +188,17 @@ - - - - - + + + + + + + + + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:20 CEST 2013 +admin-archetype-1.0.1-SNAPSHOT.jar>= +admin-archetype-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/admin-archetype-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/admin-archetype-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/admin-archetype-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/admin-archetype-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,46 @@ + + + + + org.opencoweb + coweb-admin + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + admin-archetype + maven-archetype + OpenCoweb :: Java :: Admin :: Archetype + + + + + org.apache.maven.archetype + archetype-packaging + 2.0-alpha-5 + + + + + maven-archetype-plugin + 2.0-alpha-4 + true + + + + + ${basedir}/src/main/resources + false + + + ${basedir}/src/main/resources + + **/archetype-metadata.xml + + true + + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-archetype/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + admin-archetype + 1.0.1-SNAPSHOT + + + true + + 20131014145420 + + + jar + 1.0.1-SNAPSHOT + 20131014145420 + + + pom + 1.0.1-SNAPSHOT + 20131014145420 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-archetype/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-archetype/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + admin-archetype + + + 1.0.1-SNAPSHOT + + 20131014145420 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:21 CEST 2013 +admin-jar-1.0.1-SNAPSHOT.jar>= +admin-jar-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/admin-jar-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/admin-jar-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/admin-jar-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/admin-jar-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,43 @@ + + + + + org.opencoweb + coweb-admin + 1.0.1-SNAPSHOT + + + 4.0.0 + admin-jar + jar + OpenCoweb :: Java :: Admin :: Jar + + + + javax + javaee-api + 6.0 + provided + + + javax.servlet + servlet-api + 2.5 + provided + + + org.apache.wink + wink-json4j + 1.1.2-incubating + jar + compile + + + org.opencoweb + coweb-server + ${project.version} + jar + provided + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-jar/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + admin-jar + 1.0.1-SNAPSHOT + + + true + + 20131014145421 + + + jar + 1.0.1-SNAPSHOT + 20131014145421 + + + pom + 1.0.1-SNAPSHOT + 20131014145421 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/admin-jar/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/admin-jar/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + admin-jar + + + 1.0.1-SNAPSHOT + + 20131014145421 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,3 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:20 CEST 2013 +coweb-admin-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/coweb-admin-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/coweb-admin-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,18 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + coweb-admin + pom + OpenCoweb :: Java :: Admin + + + admin-archetype + admin-jar + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-admin/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,19 @@ + + + org.opencoweb + coweb-admin + 1.0.1-SNAPSHOT + + + true + + 20131014145420 + + + pom + 1.0.1-SNAPSHOT + 20131014145420 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-admin/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-admin/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-admin + + + 1.0.1-SNAPSHOT + + 20131014145420 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:20 CEST 2013 +coweb-archetype-1.0.1-SNAPSHOT.jar>= +coweb-archetype-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/coweb-archetype-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/coweb-archetype-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/coweb-archetype-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/coweb-archetype-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,45 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + coweb-archetype + maven-archetype + OpenCoweb :: Java :: Archetype + + + + + org.apache.maven.archetype + archetype-packaging + 2.0-alpha-5 + + + + + maven-archetype-plugin + 2.0-alpha-4 + true + + + + + ${basedir}/src/main/resources + false + + + ${basedir}/src/main/resources + + **/archetype-metadata.xml + + true + + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-archetype/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-archetype + 1.0.1-SNAPSHOT + + + true + + 20131014145420 + + + jar + 1.0.1-SNAPSHOT + 20131014145420 + + + pom + 1.0.1-SNAPSHOT + 20131014145420 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-archetype/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-archetype/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-archetype + + + 1.0.1-SNAPSHOT + + 20131014145420 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:09 CEST 2013 +coweb-bots-1.0.1-SNAPSHOT.jar>= +coweb-bots-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/coweb-bots-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/coweb-bots-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/coweb-bots-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/coweb-bots-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,14 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + coweb-bots + org.opencoweb + jar + OpenCoweb :: Java :: Bots + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-bots/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-bots + 1.0.1-SNAPSHOT + + + true + + 20131014145409 + + + jar + 1.0.1-SNAPSHOT + 20131014145409 + + + pom + 1.0.1-SNAPSHOT + 20131014145409 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-bots/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-bots/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-bots + + + 1.0.1-SNAPSHOT + + 20131014145409 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:22 CEST 2013 +coweb-build-1.0.1-SNAPSHOT.pom>= +coweb-build-1.0.1-SNAPSHOT.war>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/coweb-build-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/coweb-build-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,62 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + coweb-build + OpenCoweb Build :: Applications + war + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.1.1 + + + + org.opencoweb + coweb-javascript + war + + META-INF/** + WEB-INF/** + + lib + + + + + + + + + + org.opencoweb + coweb-bots + ${coweb-version} + + + org.opencoweb + coweb-operationengine + ${coweb-version} + + + org.opencoweb + coweb-server + ${coweb-version} + + + org.opencoweb + coweb-javascript + ${coweb-version} + war + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/coweb-build-1.0.1-SNAPSHOT.war Binary file server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/coweb-build-1.0.1-SNAPSHOT.war has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-build/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-build + 1.0.1-SNAPSHOT + + + true + + 20131014145422 + + + war + 1.0.1-SNAPSHOT + 20131014145422 + + + pom + 1.0.1-SNAPSHOT + 20131014145422 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-build/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-build/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-build + + + 1.0.1-SNAPSHOT + + 20131014145422 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:19 CEST 2013 +coweb-client-1.0.1-SNAPSHOT.jar>= +coweb-client-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/coweb-client-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/coweb-client-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/coweb-client-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/coweb-client-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,22 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + coweb-client + OpenCoweb :: Java :: Client + + + + org.cometd.java + cometd-java-client + ${cometd-version} + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-client/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-client + 1.0.1-SNAPSHOT + + + true + + 20131014145419 + + + jar + 1.0.1-SNAPSHOT + 20131014145419 + + + pom + 1.0.1-SNAPSHOT + 20131014145419 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-client/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-client/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-client + + + 1.0.1-SNAPSHOT + + 20131014145419 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,3 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:04 CEST 2013 +coweb-java-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/coweb-java-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/coweb-java-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,139 @@ + + + + 4.0.0 + org.opencoweb + coweb-java + pom + + OpenCoweb + Open Cooperative Web Framework + 1.0.1-SNAPSHOT + http://opencoweb.org + 2011 + + The Dojo Foundation + http://dojofoundation.org + + + + + The New BSD License + http://www.opensource.org/licenses/bsd-license.html + + + The Academic Free License, v. 2.1 + http://en.wikipedia.org/wiki/Academic_Free_License + + + + + + parente + Peter Parente + pparent@us.ibm.com + IBM Corporation + + + bpburns + Brian Burns + bburns@us.ibm.com + IBM Corporation + + + vinomaster + Dan Gisolfi + gisolfi@us.ibm.com + IBM Corporation + + + + + scm:git:git@github.com:opencoweb/coweb.git + scm:git:git@github.com:opencoweb/coweb.git + git@github.com:opencoweb/coweb.git + + + + UTF-8 + 2.7.0 + 1.0.1-SNAPSHOT + + + + coweb-operationengine + coweb-bots + coweb-server + coweb-javascript + coweb-client + coweb-archetype + coweb-admin + coweb-build + + + + install + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + ${project.name} ${project.version} Java Server API + + + + aggregate + + aggregate + + site + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + + + + + release-sign-artifacts + + + performRelease + true + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.1 + + + sign-artifacts + verify + + sign + + + + + + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-java/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,19 @@ + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + true + + 20131014145404 + + + pom + 1.0.1-SNAPSHOT + 20131014145404 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-java/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-java/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-java + + + 1.0.1-SNAPSHOT + + 20131014145404 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:19 CEST 2013 +coweb-javascript-1.0.1-SNAPSHOT.pom>= +coweb-javascript-1.0.1-SNAPSHOT.war>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/coweb-javascript-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/coweb-javascript-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,110 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + coweb-javascript + OpenCoweb :: Java :: JavaScript + war + + + http://requirejs.org/docs/release/1.0.0/minified/i18n.js + ${project.build.directory}/${project.artifactId}-${project.version}/coweb/jsoe + src/main/webapp/coweb/jsoe + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.2 + + coweb/jsoe/ + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.4 + + + unpack + compile + unpack + + + + org.cometd.javascript + cometd-javascript-common + ${cometd.version} + war + false + ${project.build.directory}/tmp + **/cometd.js,**/cometd/AckExtension.js + + + + + + + + + + maven-antrun-plugin + + + prepare-package + + + + + + + + + + + + + + + + + + + + + + + + + + + + + run + + + + + + + + + org.cometd.javascript + cometd-javascript-common + ${cometd-version} + war + provided + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/coweb-javascript-1.0.1-SNAPSHOT.war Binary file server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/coweb-javascript-1.0.1-SNAPSHOT.war has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-javascript/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-javascript + 1.0.1-SNAPSHOT + + + true + + 20131014145419 + + + war + 1.0.1-SNAPSHOT + 20131014145419 + + + pom + 1.0.1-SNAPSHOT + 20131014145419 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-javascript/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-javascript/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-javascript + + + 1.0.1-SNAPSHOT + + 20131014145419 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:09 CEST 2013 +coweb-operationengine-1.0.1-SNAPSHOT.jar>= +coweb-operationengine-1.0.1-SNAPSHOT.pom>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/coweb-operationengine-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/coweb-operationengine-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/coweb-operationengine-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/coweb-operationengine-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,14 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + coweb-operationengine + OpenCoweb :: Java :: OperationEngine + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-operationengine/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-operationengine + 1.0.1-SNAPSHOT + + + true + + 20131014145409 + + + jar + 1.0.1-SNAPSHOT + 20131014145409 + + + pom + 1.0.1-SNAPSHOT + 20131014145409 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-operationengine/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-operationengine/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-operationengine + + + 1.0.1-SNAPSHOT + + 20131014145409 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/_remote.repositories --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/_remote.repositories Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,4 @@ +#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. +#Mon Oct 14 16:54:10 CEST 2013 +coweb-server-1.0.1-SNAPSHOT.pom>= +coweb-server-1.0.1-SNAPSHOT.jar>= diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/coweb-server-1.0.1-SNAPSHOT.jar Binary file server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/coweb-server-1.0.1-SNAPSHOT.jar has changed diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/coweb-server-1.0.1-SNAPSHOT.pom --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/coweb-server-1.0.1-SNAPSHOT.pom Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,53 @@ + + + + org.opencoweb + coweb-java + 1.0.1-SNAPSHOT + + + 4.0.0 + org.opencoweb + coweb-server + OpenCoweb :: Java :: Server + + + + org.opencoweb + coweb-bots + ${project.version} + + + org.opencoweb + coweb-operationengine + ${project.version} + + + org.cometd.java + cometd-java-server + ${cometd-version} + + + org.cometd.java + bayeux-api + ${cometd-version} + + + org.cometd.java + cometd-java-common + ${cometd-version} + + + org.cometd.java + cometd-websocket-jetty + ${cometd-version} + + + javax.servlet + servlet-api + 2.5 + provided + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-server/1.0.1-SNAPSHOT/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,24 @@ + + + org.opencoweb + coweb-server + 1.0.1-SNAPSHOT + + + true + + 20131014145410 + + + jar + 1.0.1-SNAPSHOT + 20131014145410 + + + pom + 1.0.1-SNAPSHOT + 20131014145410 + + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/coweb-server/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/coweb-server/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,11 @@ + + + org.opencoweb + coweb-server + + + 1.0.1-SNAPSHOT + + 20131014145410 + + diff -r 885f09f3462b -r ecbb104cf3b6 server/lib/org/opencoweb/maven-metadata-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/lib/org/opencoweb/maven-metadata-local.xml Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,15 @@ + + + + + OpenCoweb :: Java :: Archetype + coweb-archetype + coweb-archetype + + + OpenCoweb :: Java :: Admin :: Archetype + admin-archetype + admin-archetype + + + diff -r 885f09f3462b -r ecbb104cf3b6 server/pom.xml --- a/server/pom.xml Sun Oct 06 14:12:02 2013 +0200 +++ b/server/pom.xml Wed Oct 16 17:32:51 2013 +0200 @@ -8,21 +8,37 @@ war - 2.14 - 1.0 + 2.16 + 1.0.1-SNAPSHOT 1.0 - 1.17.1 + 2.3.1 3.2.1.RELEASE 1.2.0.RELEASE 3.1.3.RELEASE - 8.1.10.v20130312 + 1.5.0.RELEASE + 1.3.0.RELEASE + 8.1.13.v20130916 + 8.1.13.v20130916 4.10 2.0.16 2.0.0 - 2.5.1 - 2.1.4 + 2.7.0 + 2.2.3 2.1 2.11.0 + 2.0 + 1.2 + 1 + 3.1.0 + 1.2 + 1.0.2 + 1.1.0.CR2 + 4.2.0.Final + 1.7.5 + 1.9.16 + 1.7 + 2.1.1 + 3.1.3 UTF-8 @@ -32,7 +48,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.0 + 3.1 1.7 1.7 @@ -42,7 +58,7 @@ org.mortbay.jetty jetty-maven-plugin - ${jetty-version} + ${jetty-plugin-version} 10 @@ -55,7 +71,7 @@ maven-war-plugin 2.3 - + true true @@ -136,6 +152,15 @@ + lib + lib + + true + ignore + + file://${project.basedir}/lib + + spring-maven-release Spring Maven Release Repository http://maven.springframework.org/release @@ -149,24 +174,39 @@ spring-release Spring Maven SNAPSHOT Repository http://repo.springsource.org/release - + javax.inject javax.inject - 1 + ${javax-inject-version} javax.servlet javax.servlet-api - 3.0.1 + ${javax-servlet-api-version} + + + javax.ws.rs + javax.ws.rs-api + ${jaxrs-api-version} + + + javax.annotation + javax.annotation-api + ${javax-annotation-version} + + + org.cometd.java + bayeux-api + ${cometd-version} org.cometd.java cometd-java-common ${cometd-version} - + org.cometd.java cometd-java-annotations @@ -176,7 +216,7 @@ org.cometd.java cometd-websocket-jetty ${cometd-version} - + org.opencoweb coweb-bots @@ -200,20 +240,20 @@ war - com.sun.jersey - jersey-server - ${jersey-version} - - - com.sun.jersey - jersey-json + org.glassfish.jersey.core + jersey-server ${jersey-version} - com.sun.jersey.contribs - jersey-spring + org.glassfish.jersey.media + jersey-media-json-jackson ${jersey-version} - + + + org.glassfish.jersey.ext + jersey-spring3 + ${jersey-version} + - - com.sun.jersey.jersey-test-framework - jersey-test-framework-grizzly2 - ${jersey-version} - test - + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + ${jersey-version} + test + org.mongodb mongo-java-driver @@ -250,7 +290,7 @@ org.slf4j slf4j-log4j12 - 1.7.2 + ${slf4j-log4j12-version} org.springframework @@ -266,13 +306,13 @@ org.springframework spring-web ${spring-version} - + org.springframework spring-test ${spring-version} test - + org.springframework spring-webmvc @@ -281,12 +321,12 @@ org.springframework.data spring-data-commons - 1.5.0.RELEASE + ${spring-data-commons-version} org.springframework.data spring-data-jpa - 1.3.0.RELEASE + ${spring-data-jpa-version} org.springframework.data @@ -296,18 +336,18 @@ javax.persistence persistence-api - 1.0.2 + ${javax-persistence-api-version} - - junit - junit + + junit + junit ${junit-version} - test + test javax.servlet jstl - 1.2 + ${javax-servlet-jstl-version} runtime @@ -328,7 +368,22 @@ net.sourceforge.nekohtml nekohtml - 1.9.16 + ${nekohtml-version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} com.fasterxml.jackson.jaxrs @@ -338,36 +393,11 @@ commons-codec commons-codec - 1.7 - - - org.eclipse.jetty - jetty-server - ${jetty-version} - - - org.eclipse.jetty - jetty-client - ${jetty-version} + ${commons-codec-version} - org.eclipse.jetty - jetty-websocket - ${jetty-version} - - - org.eclipse.jetty - jetty-jmx - ${jetty-version} - - - org.eclipse.jetty - jetty-util - ${jetty-version} - - - org.eclipse.jetty - jetty-servlets + org.eclipse.jetty.aggregate + jetty-all ${jetty-version} @@ -398,7 +428,7 @@ de.undercouch bson4jackson - 2.1.1 + ${bson4jackson-version} joda-time @@ -408,21 +438,21 @@ javax.validation validation-api - 1.1.0.CR2 + ${javax-validation-api-version} org.hibernate hibernate-validator - 4.2.0.Final + ${hibernate-validator-version} com.fasterxml.uuid java-uuid-generator - 3.1.3 + ${fasterxml-java-uuid-generator-version} - IRI - http://www.iri.centrepompidou.fr + IRI + http://www.iri.centrepompidou.fr diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/models/Project.java --- a/server/src/main/java/org/iri_research/renkan/models/Project.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/Project.java Wed Oct 16 17:32:51 2013 +0200 @@ -23,6 +23,7 @@ import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; @Document(collection="projects") @@ -34,7 +35,9 @@ @Field("rev_counter") private int revCounter = 1; + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date created; + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date updated; // Space @@ -109,6 +112,7 @@ return this.users; } + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") public Date getCreated() { return created; } @@ -175,6 +179,7 @@ return new_key.equals(signature); } + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") public Date getUpdated() { return updated; } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/models/ProjectRevision.java --- a/server/src/main/java/org/iri_research/renkan/models/ProjectRevision.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/ProjectRevision.java Wed Oct 16 17:32:51 2013 +0200 @@ -10,6 +10,8 @@ import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; +import com.fasterxml.jackson.annotation.JsonFormat; + @Document(collection="projectRevisions") public class ProjectRevision extends AbstractRenkanModel { @@ -21,6 +23,7 @@ @DBRef private Project project; + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date created; // Nodes @@ -66,6 +69,7 @@ return edges; } + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") public Date getCreated() { return created; } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/models/ProjectSync.java --- a/server/src/main/java/org/iri_research/renkan/models/ProjectSync.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/ProjectSync.java Wed Oct 16 17:32:51 2013 +0200 @@ -6,6 +6,8 @@ import org.springframework.data.mongodb.core.mapping.DBRef; import org.springframework.data.mongodb.core.mapping.Document; +import com.fasterxml.jackson.annotation.JsonFormat; + @Document(collection="projectSyncs") public class ProjectSync { @@ -19,6 +21,7 @@ private int revision; + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date created; private String user; diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/models/Space.java --- a/server/src/main/java/org/iri_research/renkan/models/Space.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/Space.java Wed Oct 16 17:32:51 2013 +0200 @@ -14,6 +14,7 @@ import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; @Document(collection="spaces") @@ -43,6 +44,8 @@ @JsonProperty("created_by") private String createdBy = null; private String image; + + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date created; public String getImage() { @@ -54,6 +57,7 @@ return createdBy; } + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") public Date getCreated() { return created; } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/models/User.java --- a/server/src/main/java/org/iri_research/renkan/models/User.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/models/User.java Wed Oct 16 17:32:51 2013 +0200 @@ -8,6 +8,7 @@ import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; @Document(collection="users") @@ -23,9 +24,11 @@ private boolean locked; @Field("expiration_date") + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date expirationDate; @Field("credentials_expiration_date") + @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ", timezone="GMT") private Date credentialExpirationDate; public User(String id, String title, String description, String uri, String color) { diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/rest/ObjectMapperProvider.java --- a/server/src/main/java/org/iri_research/renkan/rest/ObjectMapperProvider.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/ObjectMapperProvider.java Wed Oct 16 17:32:51 2013 +0200 @@ -12,12 +12,12 @@ @Provider public class ObjectMapperProvider implements ContextResolver { - @Override - public ObjectMapper getContext(Class type) { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); - - return objectMapper; - } + @Override + public ObjectMapper getContext(Class type) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS , false); + + return objectMapper; + } } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/ProjectsResource.java Wed Oct 16 17:32:51 2013 +0200 @@ -4,6 +4,7 @@ import java.util.Date; import java.util.List; +import javax.inject.Singleton; import javax.ws.rs.Path; import org.iri_research.renkan.Constants; @@ -15,8 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.sun.jersey.spi.resource.Singleton; - @Singleton @Path("projects") diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/rest/RenkanResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/RenkanResource.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/RenkanResource.java Wed Oct 16 17:32:51 2013 +0200 @@ -6,14 +6,12 @@ import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; @@ -21,6 +19,7 @@ import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriInfo; +import org.glassfish.jersey.server.JSONP; import org.iri_research.renkan.models.IRenkanModel; import org.iri_research.renkan.repositories.IRenkanRepository; import org.slf4j.Logger; @@ -33,151 +32,178 @@ import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; -import com.sun.jersey.api.json.JSONWithPadding; public abstract class RenkanResource, ID extends Serializable> { - - private Logger logger = LoggerFactory.getLogger(RenkanResource.class); - - protected String[] baseObjectListFieldList = {"description","title","uri","created", "color"}; + + private Logger logger = LoggerFactory.getLogger(RenkanResource.class); + + protected String[] baseObjectListFieldList = { "description", "title", + "uri", "created", "color" }; + + abstract protected IRenkanRepository getRepository(); + + abstract protected ID getNewId(); + + abstract protected List getObjectListFieldList(); + + @Context + private UriInfo uriInfo; + + protected DBCollection getCollection() { + return this.getRepository().getCollection(); + } - abstract protected IRenkanRepository getRepository(); - abstract protected ID getNewId(); - abstract protected List getObjectListFieldList(); + abstract protected void prepareObject(T obj); + + protected void doDeleteObject(ID objectId) { + this.getRepository().delete(objectId); + } - @Context - private UriInfo uriInfo; + // TODO: this produce application/javascript by default. I would rather have + // application/json. The prefered behaviour would be to produde js only od + // the callbacl query param is used + @GET + @Path("{id : [a-zA-Z\\-0-9]+}") + @JSONP(callback="callback", queryParam="callback") + @Produces({"application/javascript", "application/x-javascript", + "text/ecmascript", "application/ecmascript", "text/jscript", MediaType.APPLICATION_JSON + ";charset=utf-8"}) + public T getObject(@PathParam("id") ID objectId) { + + this.logger.debug("GetObject: " + objectId); + + T obj = this.getRepository().findOne(objectId); - protected DBCollection getCollection() { - return this.getRepository().getCollection(); - } - - abstract protected void prepareObject(T obj); - - protected void doDeleteObject(ID objectId) { - this.getRepository().delete(objectId); - } - - - //TODO: this produce application/javascript by default. I would rather have application/json. The prefered behaviour would be to produde js only od the callbacl query param is used - @GET - @Path("{id : [a-zA-Z\\-0-9]+}") - @Produces({ "application/javascript", - "application/x-javascript", "text/ecmascript", - "application/ecmascript", "text/jscript", MediaType.APPLICATION_JSON + ";charset=utf-8"}) - public JSONWithPadding getObject(@PathParam("id") ID objectId, @QueryParam("callback") @DefaultValue("callback") String callback) { - - this.logger.debug("GetObject: " + objectId); - - T obj = this.getRepository().findOne(objectId); - - if (null == obj) { - throw new WebApplicationException(Status.NOT_FOUND); - } - - return new JSONWithPadding(obj, callback); - } - - @DELETE - @Path("{id : [a-zA-Z\\-0-9]+}") - @Produces(MediaType.TEXT_PLAIN + ";charset=utf-8") - public Response deleteObject(@PathParam("id") ID objectId) { - - this.logger.debug("DeleteObject : id " + objectId); - this.doDeleteObject(objectId); - - return Response.ok(this.uriInfo.getAbsolutePathBuilder().build().toString() + " deleted").build(); - - } - - /** - * test: curl -i -X PUT -H 'Content-Type: application/json' -d @test-data.json http://localhost:8080/renkan/rest/spaces/12eff140-e65c-11e1-aff1-0800200c9a66 - * @param objId - * @param objectContent - */ - @PUT - @Path("{id : [a-zA-Z\\-0-9]+}") - @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") - public Response putRenkanObject(@PathParam("id") ID objId, T obj) { + if (null == obj) { + throw new WebApplicationException(Status.NOT_FOUND); + } + + return obj; + } + + @DELETE + @Path("{id : [a-zA-Z\\-0-9]+}") + @Produces(MediaType.TEXT_PLAIN + ";charset=utf-8") + public Response deleteObject(@PathParam("id") ID objectId) { + + this.logger.debug("DeleteObject : id " + objectId); + this.doDeleteObject(objectId); + + return Response.ok( + this.uriInfo.getAbsolutePathBuilder().build().toString() + + " deleted").build(); + + } + + /** + * test: curl -i -X PUT -H 'Content-Type: application/json' -d + * @test-data.json http://localhost:8080/renkan/rest/spaces/ + * 12eff140-e65c-11e1-aff1-0800200c9a66 + * + * @param objId + * @param objectContent + */ + @PUT + @Path("{id : [a-zA-Z\\-0-9]+}") + @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") + public Response putRenkanObject(@PathParam("id") ID objId, T obj) { + + if (!objId.equals(obj.getId())) { + throw new WebApplicationException(Response + .status(Status.BAD_REQUEST) + .entity("Id parameter and id in JSON do not match").build()); + } + + if (!this.getRepository().exists(objId)) { + throw new WebApplicationException(Response.status(Status.NOT_FOUND) + .build()); + } - if(!objId.equals(obj.getId())) { - throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id parameter and id in JSON do not match").build()); - } - - if(!this.getRepository().exists(objId)) { - throw new WebApplicationException(Response.status(Status.NOT_FOUND).build()); - } - - this.prepareObject(obj); - this.getRepository().save(obj); - return Response.noContent().build(); - - } - - @POST - @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") - @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") - public Response postRenkanObject(T obj) { + this.prepareObject(obj); + this.getRepository().save(obj); + return Response.noContent().build(); + + } + + @POST + @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8") + @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") + public Response postRenkanObject(T obj) { + + if (obj.getId() != null) { + throw new WebApplicationException(Response + .status(Status.BAD_REQUEST) + .entity("Id in JSON must be null").build()); + } - if(obj.getId() != null) { - throw new WebApplicationException(Response.status(Status.BAD_REQUEST).entity("Id in JSON must be null").build()); - } - - obj.setId(getNewId()); - this.prepareObject(obj); - obj = this.getRepository().save(obj); - return Response.created(this.uriInfo.getAbsolutePathBuilder().segment(obj.getId().toString()).build()).entity(obj).build(); - } - + obj.setId(getNewId()); + this.prepareObject(obj); + obj = this.getRepository().save(obj); + return Response + .created( + this.uriInfo.getAbsolutePathBuilder() + .segment(obj.getId().toString()).build()) + .entity(obj).build(); + } + + @GET + @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") + public String getObjectList() throws JsonProcessingException { + + BasicDBObject keys = new BasicDBObject(); + + for (String fieldname : this.getObjectListFieldList()) { + keys.put(fieldname, 1); + } + DBCursor cursor = this.getCollection().find(new BasicDBObject(), keys); + + List res = new ArrayList(); - @GET - @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") - public String getObjectList() throws JsonProcessingException { - - BasicDBObject keys = new BasicDBObject(); - - for (String fieldname : this.getObjectListFieldList()) { - keys.put(fieldname, 1); - } - DBCursor cursor = this.getCollection().find(new BasicDBObject(), keys); - - List res = new ArrayList(); - - try { - while(cursor.hasNext()) { - DBObject obj = cursor.next(); - obj.put("id", obj.get("_id")); - DBObject links = new BasicDBObject(); - - DBObject linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "get"); - linkdef.put("produces", MediaType.APPLICATION_JSON + ";charset=utf-8"); - links.put("view", linkdef); - - linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "put"); - linkdef.put("consumes", MediaType.APPLICATION_JSON + ";charset=utf-8"); - links.put("update", linkdef); + try { + while (cursor.hasNext()) { + DBObject obj = cursor.next(); + obj.put("id", obj.get("_id")); + DBObject links = new BasicDBObject(); + + DBObject linkdef = new BasicDBObject(); + linkdef.put( + "href", + this.uriInfo.getAbsolutePathBuilder() + .path(obj.get("_id").toString()).build() + .toString()); + linkdef.put("method", "get"); + linkdef.put("produces", MediaType.APPLICATION_JSON + + ";charset=utf-8"); + links.put("view", linkdef); - linkdef = new BasicDBObject(); - linkdef.put("href", this.uriInfo.getAbsolutePathBuilder().path(obj.get("_id").toString()).build().toString()); - linkdef.put("method", "delete"); - links.put("delete", linkdef); - - obj.put("__links", links); - res.add(obj); - } - } - finally { - cursor.close(); - } - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); - return mapper.writeValueAsString(res); - } + linkdef = new BasicDBObject(); + linkdef.put( + "href", + this.uriInfo.getAbsolutePathBuilder() + .path(obj.get("_id").toString()).build() + .toString()); + linkdef.put("method", "put"); + linkdef.put("consumes", MediaType.APPLICATION_JSON + + ";charset=utf-8"); + links.put("update", linkdef); + linkdef = new BasicDBObject(); + linkdef.put( + "href", + this.uriInfo.getAbsolutePathBuilder() + .path(obj.get("_id").toString()).build() + .toString()); + linkdef.put("method", "delete"); + links.put("delete", linkdef); - + obj.put("__links", links); + res.add(obj); + } + } finally { + cursor.close(); + } + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + return mapper.writeValueAsString(res); + } + } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/rest/RestApplication.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/server/src/main/java/org/iri_research/renkan/rest/RestApplication.java Wed Oct 16 17:32:51 2013 +0200 @@ -0,0 +1,14 @@ +package org.iri_research.renkan.rest; + +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.spring.SpringLifecycleListener; +import org.glassfish.jersey.server.spring.scope.RequestContextFilter; + + +public class RestApplication extends ResourceConfig { + public RestApplication() { + this.packages("org.iri_research.renkan.rest"); + this.register(SpringLifecycleListener.class); + this.register(RequestContextFilter.class); + } +} diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java --- a/server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/java/org/iri_research/renkan/rest/SpacesResource.java Wed Oct 16 17:32:51 2013 +0200 @@ -1,11 +1,11 @@ package org.iri_research.renkan.rest; - import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import javax.inject.Singleton; import javax.ws.rs.Path; import org.iri_research.renkan.Constants; @@ -17,48 +17,45 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.sun.jersey.spi.resource.Singleton; - @Singleton @Path("spaces") @Component public class SpacesResource extends RenkanResource { - - @SuppressWarnings("unused") - private Logger logger = LoggerFactory.getLogger(SpacesResource.class); - - private String[] spaceObjectListFieldList = {"created_by","bin_config","image"}; - - @Autowired - private SpacesRepository spacesRepository; - - @Override - protected IRenkanRepository getRepository() { - return spacesRepository; - } + + @SuppressWarnings("unused") + private Logger logger = LoggerFactory.getLogger(SpacesResource.class); + + private String[] spaceObjectListFieldList = { "created_by", "bin_config", + "image" }; + @Autowired + private SpacesRepository spacesRepository; + + @Override + protected IRenkanRepository getRepository() { + return spacesRepository; + } - @Override - protected String getNewId() { - return Constants.UUID_GENERATOR.generate().toString(); - } - + @Override + protected String getNewId() { + return Constants.UUID_GENERATOR.generate().toString(); + } - @Override - protected void prepareObject(Space obj) { - if(obj.getCreated() == null) { - obj.setCreated(new Date()); - } - } - + @Override + protected void prepareObject(Space obj) { + if (obj.getCreated() == null) { + obj.setCreated(new Date()); + } + } - @Override - protected List getObjectListFieldList() { - ArrayList fieldList = new ArrayList<>(this.baseObjectListFieldList.length + this.spaceObjectListFieldList.length); - fieldList.addAll(Arrays.asList(this.baseObjectListFieldList)); - fieldList.addAll(Arrays.asList(this.spaceObjectListFieldList)); - return fieldList; - } - + @Override + protected List getObjectListFieldList() { + ArrayList fieldList = new ArrayList<>( + this.baseObjectListFieldList.length + + this.spaceObjectListFieldList.length); + fieldList.addAll(Arrays.asList(this.baseObjectListFieldList)); + fieldList.addAll(Arrays.asList(this.spaceObjectListFieldList)); + return fieldList; + } } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/main/webapp/WEB-INF/web.xml --- a/server/src/main/webapp/WEB-INF/web.xml Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/main/webapp/WEB-INF/web.xml Wed Oct 16 17:32:51 2013 +0200 @@ -66,11 +66,11 @@ /ocw_admin/* - rest Servlet - com.sun.jersey.spi.spring.container.servlet.SpringServlet + restServlet + org.glassfish.jersey.servlet.ServletContainer - com.sun.jersey.config.property.packages - org.iri_research.renkan.rest + javax.ws.rs.Application + org.iri_research.renkan.rest.RestApplication com.sun.jersey.api.json.POJOMappingFeature @@ -79,7 +79,7 @@ 1 - rest Servlet + restServlet /rest/* diff -r 885f09f3462b -r ecbb104cf3b6 server/src/test/java/org/iri_research/renkan/test/rest/ProjectRestTest.java --- a/server/src/test/java/org/iri_research/renkan/test/rest/ProjectRestTest.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/test/java/org/iri_research/renkan/test/rest/ProjectRestTest.java Wed Oct 16 17:32:51 2013 +0200 @@ -5,6 +5,13 @@ import java.util.List; import java.util.UUID; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; + +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.spring.SpringLifecycleListener; +import org.glassfish.jersey.server.spring.scope.RequestContextFilter; +import org.glassfish.jersey.test.JerseyTest; import org.iri_research.renkan.models.Edge; import org.iri_research.renkan.models.Node; import org.iri_research.renkan.models.Project; @@ -26,146 +33,168 @@ import org.springframework.data.mongodb.core.geo.Point; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.context.ContextLoaderListener; import com.mongodb.BasicDBObject; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.spi.spring.container.servlet.SpringServlet; -import com.sun.jersey.test.framework.AppDescriptor; -import com.sun.jersey.test.framework.JerseyTest; -import com.sun.jersey.test.framework.WebAppDescriptor; +//import com.sun.jersey.spi.spring.container.servlet.SpringServlet; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("rest-context.xml") public class ProjectRestTest extends JerseyTest { - - private Logger logger = LoggerFactory.getLogger(ProjectRestTest.class); - - @Autowired - private ProjectsRepository projectsRepository; - - @Autowired - private SpacesRepository spacesRepository; - - @Autowired - private NodesRepository nodesRepository; - - @Autowired - private EdgesRepository edgesRepository; - - @Autowired - private ProjectRevisionsRepository projectRevisionsRepository; - - @Autowired - private MongoTemplate mongoTemplate; - - private Project testProject; - private List testNodes = new ArrayList(); - private List testEdges = new ArrayList<>(); - - private Date creationDate = new Date(); - - private String spaceId = UUID.randomUUID().toString(); - - public ProjectRestTest() { - } - - @Override - protected AppDescriptor configure() { - return new WebAppDescriptor.Builder("org.iri_research.renkan.rest") - .contextPath("rest") - .contextParam("contextConfigLocation", "classpath:/org/iri_research/renkan/test/rest/rest-context.xml") - .initParam("com.sun.jersey.config.property.packages", "org.iri_research.renkan.rest") - .servletClass(SpringServlet.class) - .contextListenerClass(ContextLoaderListener.class) - .build(); - }; - - @Before - public void setup() { + + private Logger logger = LoggerFactory.getLogger(ProjectRestTest.class); + + @Autowired + private ProjectsRepository projectsRepository; + + @Autowired + private SpacesRepository spacesRepository; + + @Autowired + private NodesRepository nodesRepository; + + @Autowired + private EdgesRepository edgesRepository; + + @Autowired + private ProjectRevisionsRepository projectRevisionsRepository; + + @Autowired + private MongoTemplate mongoTemplate; + + private Project testProject; + private List testNodes = new ArrayList(); + private List testEdges = new ArrayList<>(); + + private Date creationDate = new Date(); + + private String spaceId = UUID.randomUUID().toString(); + + public ProjectRestTest() { + } + + //@Override + // protected AppDescriptor configure() { + // return new WebAppDescriptor.Builder("org.iri_research.renkan.rest") + // .contextPath("rest") + // .contextParam("contextConfigLocation", + // "classpath:/org/iri_research/renkan/test/rest/rest-context.xml") + // .initParam("com.sun.jersey.config.property.packages", + // "org.iri_research.renkan.rest") + // .servletClass(SpringServlet.class) + // .contextListenerClass(ContextLoaderListener.class) + // .build(); + // }; + + @Override + protected Application configure() { + ResourceConfig rc = new ResourceConfig() + .packages("org.iri_research.renkan.rest") + .register(SpringLifecycleListener.class) + .register(RequestContextFilter.class) + .property("contextConfigLocation", + "classpath:/org/iri_research/renkan/test/rest/rest-context.xml"); + rc.setApplicationName("rest"); + return rc; + }; + + + @Before + public void setup() { + + logger.debug("Setup"); + Space testSpace = new Space(this.spaceId, "test space", "Test space", + null, null, null, "test_user", null, this.creationDate); + testSpace = spacesRepository.save(testSpace); + testProject = new Project(testSpace.getId(), UUID.randomUUID() + .toString(), "test", "desc", + "http://localhost:8080/rest/projects/id", this.creationDate); - logger.debug("Setup"); - Space testSpace = new Space(this.spaceId, "test space", "Test space", null, null, null, "test_user", null, this.creationDate); - testSpace = spacesRepository.save(testSpace); - testProject = new Project(testSpace.getId(), UUID.randomUUID().toString(), "test", "desc", "http://localhost:8080/rest/projects/id", this.creationDate); - - for(int i=0;i<3;i++) { - Node node = new Node("Node"+i, "Node"+i, "Node "+i, "http://renkan.org/nodes/node"+i, "#ffff0"+i, "test_user", new Point(0, i), "http://renkan.org/images/node"+i, i, testProject.getId()); - node = this.nodesRepository.save(node); - testProject.getNodes().add(node); - this.testNodes.add(node); - } - - for(int i=0;i<3;i++) { - Edge edge = new Edge("Node"+i, "Node"+i, "Node "+i, "http://renkan.org/edges/edge"+i, "#ffff0"+i, this.testNodes.get((i+2)%3), this.testNodes.get(i), "test_user", testProject.getId()); - edge = this.edgesRepository.save(edge); - testProject.getEdges().add(edge); - this.testEdges.add(edge); - } - - this.projectsRepository.save(testProject); + for (int i = 0; i < 3; i++) { + Node node = new Node("Node" + i, "Node" + i, "Node " + i, + "http://renkan.org/nodes/node" + i, "#ffff0" + i, + "test_user", new Point(0, i), + "http://renkan.org/images/node" + i, i, testProject.getId()); + node = this.nodesRepository.save(node); + testProject.getNodes().add(node); + this.testNodes.add(node); + } + + for (int i = 0; i < 3; i++) { + Edge edge = new Edge("Node" + i, "Node" + i, "Node " + i, + "http://renkan.org/edges/edge" + i, "#ffff0" + i, + this.testNodes.get((i + 2) % 3), this.testNodes.get(i), + "test_user", testProject.getId()); + edge = this.edgesRepository.save(edge); + testProject.getEdges().add(edge); + this.testEdges.add(edge); + } - } - - @After - public void teardown() { - logger.debug("Teardown"); - edgesRepository.deleteAll(); - nodesRepository.deleteAll(); - projectRevisionsRepository.deleteAll(); - projectsRepository.deleteAll(); - spacesRepository.deleteAll(); - } - - - @Test - public void testDeleteProject() { + this.projectsRepository.save(testProject); + + } + + @After + public void teardown() { + logger.debug("Teardown"); + edgesRepository.deleteAll(); + nodesRepository.deleteAll(); + projectRevisionsRepository.deleteAll(); + projectsRepository.deleteAll(); + spacesRepository.deleteAll(); + } + + @Test + public void testDeleteProject() { + + List nodes = testProject.getNodes(); + List edges = testProject.getEdges(); - List nodes= testProject.getNodes(); - List edges= testProject.getEdges(); - - WebResource webResource = this.resource(); - String respString = webResource.path("projects").path(testProject.getId()).delete(String.class); - - Assert.assertTrue("Response text must contain deleted", respString.contains("deleted")); - Assert.assertTrue("Response text must contain id", respString.contains(this.testProject.getId())); - - DBObject filter = new BasicDBObject(); - filter.put("_id", testProject.getId()); - - DBCollection coll = mongoTemplate.getCollection(mongoTemplate.getCollectionName(Project.class)); - DBCursor resFind = coll.find(filter); - - Assert.assertEquals("The project must not be found", 0, resFind.count()); - - filter = new BasicDBObject(); - filter.put("project_id", testProject.getId()); - - DBCollection nodesColl = mongoTemplate.getCollection(mongoTemplate.getCollectionName(Node.class)); - resFind = nodesColl.find(filter); - - Assert.assertEquals("no nodes left", 0, resFind.count()); - - for(Node n: nodes) { - DBObject nobj = nodesColl.findOne(n.getId()); - Assert.assertNull("node should be deleted", nobj); - } + WebTarget webResource = this.target(); + String respString = webResource.path("projects") + .path(testProject.getId()).request().delete(String.class); + + Assert.assertTrue("Response text must contain deleted", + respString.contains("deleted")); + Assert.assertTrue("Response text must contain id", + respString.contains(this.testProject.getId())); + + DBObject filter = new BasicDBObject(); + filter.put("_id", testProject.getId()); + + DBCollection coll = mongoTemplate.getCollection(mongoTemplate + .getCollectionName(Project.class)); + DBCursor resFind = coll.find(filter); + + Assert.assertEquals("The project must not be found", 0, resFind.count()); + + filter = new BasicDBObject(); + filter.put("project_id", testProject.getId()); - - DBCollection edgesColl = mongoTemplate.getCollection(mongoTemplate.getCollectionName(Edge.class)); - resFind = edgesColl.find(filter); - - Assert.assertEquals("no edges left", 0, resFind.count()); - - for(Edge e: edges) { - DBObject eobj = edgesColl.findOne(e.getId()); - Assert.assertNull("edge should be deleted", eobj); - } - - } + DBCollection nodesColl = mongoTemplate.getCollection(mongoTemplate + .getCollectionName(Node.class)); + resFind = nodesColl.find(filter); + + Assert.assertEquals("no nodes left", 0, resFind.count()); + + for (Node n : nodes) { + DBObject nobj = nodesColl.findOne(n.getId()); + Assert.assertNull("node should be deleted", nobj); + } + DBCollection edgesColl = mongoTemplate.getCollection(mongoTemplate + .getCollectionName(Edge.class)); + resFind = edgesColl.find(filter); + + Assert.assertEquals("no edges left", 0, resFind.count()); + + for (Edge e : edges) { + DBObject eobj = edgesColl.findOne(e.getId()); + Assert.assertNull("edge should be deleted", eobj); + } + + } } diff -r 885f09f3462b -r ecbb104cf3b6 server/src/test/java/org/iri_research/renkan/test/rest/SpaceRestTest.java --- a/server/src/test/java/org/iri_research/renkan/test/rest/SpaceRestTest.java Sun Oct 06 14:12:02 2013 +0200 +++ b/server/src/test/java/org/iri_research/renkan/test/rest/SpaceRestTest.java Wed Oct 16 17:32:51 2013 +0200 @@ -7,13 +7,23 @@ import java.util.Map; import java.util.UUID; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.WebTarget; +import javax.ws.rs.core.Application; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import junit.framework.Assert; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.server.model.Resource; +import org.glassfish.jersey.server.spring.SpringLifecycleListener; +import org.glassfish.jersey.server.spring.scope.RequestContextFilter; +import org.glassfish.jersey.test.JerseyTest; import org.iri_research.renkan.models.Space; import org.iri_research.renkan.repositories.SpacesRepository; +import org.iri_research.renkan.rest.SpacesResource; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.ISODateTimeFormat; @@ -26,762 +36,853 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.web.context.ContextLoaderListener; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.sun.jersey.api.client.ClientHandlerException; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.spi.spring.container.servlet.SpringServlet; -import com.sun.jersey.test.framework.AppDescriptor; -import com.sun.jersey.test.framework.JerseyTest; -import com.sun.jersey.test.framework.WebAppDescriptor; + + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("rest-context.xml") public class SpaceRestTest extends JerseyTest { - - private Logger logger = LoggerFactory.getLogger(SpaceRestTest.class); - - @Autowired - private SpacesRepository spacesRepository; - - private Map spacesList = new HashMap(); - private String firstSpaceUUID = null; - + + private Logger logger = LoggerFactory.getLogger(SpaceRestTest.class); + + @Autowired + private SpacesRepository spacesRepository; + + private Map spacesList = new HashMap(); + private String firstSpaceUUID = null; + + public SpaceRestTest() { + } + + // @Override + // protected AppDescriptor configure() { + // return new WebAppDescriptor.Builder("org.iri_research.renkan.rest") + // .contextPath("rest") + // .contextParam("contextConfigLocation", + // "classpath:/org/iri_research/renkan/test/rest/rest-context.xml") + // .initParam("com.sun.jersey.config.property.packages", + // "org.iri_research.renkan.rest") + // .servletClass(SpringServlet.class) + // .contextListenerClass(ContextLoaderListener.class) + // .build(); + // }; + + @Override + protected Application configure() { + ResourceConfig rc = new ResourceConfig() + .packages("org.iri_research.renkan.rest") + .register(SpringLifecycleListener.class) + .register(RequestContextFilter.class) + .property("contextConfigLocation", + "classpath:/org/iri_research/renkan/test/rest/rest-context.xml"); + rc.setApplicationName("rest"); + return rc; + }; + + @Before + public void setup() { - public SpaceRestTest() { - } - - @Override - protected AppDescriptor configure() { - return new WebAppDescriptor.Builder("org.iri_research.renkan.rest") - .contextPath("rest") - .contextParam("contextConfigLocation", "classpath:/org/iri_research/renkan/test/rest/rest-context.xml") - .initParam("com.sun.jersey.config.property.packages", "org.iri_research.renkan.rest") - .servletClass(SpringServlet.class) - .contextListenerClass(ContextLoaderListener.class) - .build(); - }; - - @Before - public void setup() { - - logger.debug("Setup"); - spacesRepository.deleteAll(); - Date creationDate = new Date(); - this.firstSpaceUUID = UUID.randomUUID().toString(); - Space testSpace = new Space(firstSpaceUUID, "test", "Test space", "{}", "http://ldt.iri.centrepompidou.fr", "#ababab", "test_user", "http://ldt.iri.centrepompidou.fr", creationDate); - testSpace = spacesRepository.save(testSpace); - this.spacesList.put(firstSpaceUUID, testSpace); - } - - @After - public void teardown() { - spacesRepository.deleteAll(); - } + logger.debug("Setup"); + spacesRepository.deleteAll(); + Date creationDate = new Date(); + this.firstSpaceUUID = UUID.randomUUID().toString(); + Space testSpace = new Space(firstSpaceUUID, "test", "Test space", "{}", + "http://ldt.iri.centrepompidou.fr", "#ababab", "test_user", + "http://ldt.iri.centrepompidou.fr", creationDate); + testSpace = spacesRepository.save(testSpace); + this.spacesList.put(firstSpaceUUID, testSpace); + + Resource resource = Resource.builder(SpacesResource.class).build(); + String baseUri = resource.getPath(); + logger.debug("Path is " + baseUri); + for (Resource cres : resource.getChildResources()) { + logger.debug(cres.getAllMethods().toString() + " at " + baseUri + "/" + cres.getPath()); + } + + } + + @After + public void teardown() { + spacesRepository.deleteAll(); + } + + @Test + public void testSetup() throws JsonProcessingException, IOException { + + WebTarget webTarget = this.target("spaces"); + String respString = webTarget.request().get(String.class); - - @Test - public void testSetup() throws JsonProcessingException, IOException { + Assert.assertNotNull( + "The response string for the list of spaces must not be null", + respString); + + logger.debug("RESPONSE : " + respString); + + Assert.assertTrue( + "The length of the space list resp. string must be > 0", + respString.length() > 0); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + Assert.assertTrue("The spaceList must be an array", + spacesList.isArray()); + Assert.assertEquals( + "The spaceList length must be = " + this.spacesList.size(), + this.spacesList.size(), spacesList.size()); + + for (JsonNode jsonNode : spacesList) { + Assert.assertTrue("the space must have an id", + jsonNode.hasNonNull("id")); + String id = jsonNode.get("id").asText(); + Assert.assertTrue("The id must be in the spacesList", + this.spacesList.containsKey(id)); + Space space = this.spacesList.get(id); + Assert.assertNotNull( + "The object must in the spacesList must not be null", space); + + } - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - - Assert.assertNotNull("The response string for the list of spaces must not be null", respString); - - logger.debug("RESPONSE : " + respString); - - Assert.assertTrue("The length of the space list resp. string must be > 0", respString.length() > 0); - - - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - Assert.assertTrue("The spaceList must be an array", spacesList.isArray()); - Assert.assertEquals("The spaceList length must be = " + this.spacesList.size(), this.spacesList.size(), spacesList.size()); - - for (JsonNode jsonNode : spacesList) { - Assert.assertTrue("the space must have an id", jsonNode.hasNonNull("id")); - String id = jsonNode.get("id").asText(); - Assert.assertTrue("The id must be in the spacesList", this.spacesList.containsKey(id)); - Space space = this.spacesList.get(id); - Assert.assertNotNull("The object must in the spacesList must not be null", space); - - } - - } - - @Test - public void testTitle() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("_id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a title", jsonNode.hasNonNull("title")); - String title = jsonNode.get("title").asText(); - Assert.assertEquals("space title must be equals to " + space.getTitle(), space.getTitle(), title); - } + } + + @Test + public void testTitle() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("_id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a title", + jsonNode.hasNonNull("title")); + String title = jsonNode.get("title").asText(); + Assert.assertEquals( + "space title must be equals to " + space.getTitle(), + space.getTitle(), title); + } + + } - } + @Test + public void testDescription() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a description", + jsonNode.hasNonNull("description")); + String description = jsonNode.get("description").asText(); + Assert.assertEquals( + "space description must be equals to " + + space.getDescription(), space.getDescription(), + description); + } + + } + + @Test + public void testUri() throws JsonProcessingException, IOException { - @Test - public void testDescription() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a description", jsonNode.hasNonNull("description")); - String description = jsonNode.get("description").asText(); - Assert.assertEquals("space description must be equals to " + space.getDescription(), space.getDescription(), description); - } + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); - } + Assert.assertTrue("the space must have a uri", + jsonNode.hasNonNull("uri")); + String uri = jsonNode.get("uri").asText(); + Assert.assertEquals( + "space uri must be equals to " + space.getUri(), + space.getUri(), uri); + } + + } + + @Test + public void testColor() throws JsonProcessingException, IOException { - @Test - public void testUri() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a uri", jsonNode.hasNonNull("uri")); - String uri = jsonNode.get("uri").asText(); - Assert.assertEquals("space uri must be equals to " + space.getUri(), space.getUri(), uri); - } + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); - } + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); - @Test - public void testColor() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a color", jsonNode.hasNonNull("color")); - String color = jsonNode.get("color").asText(); - Assert.assertEquals("space color must be equals to " + space.getColor(), space.getColor(), color); - } + Assert.assertTrue("the space must have a color", + jsonNode.hasNonNull("color")); + String color = jsonNode.get("color").asText(); + Assert.assertEquals( + "space color must be equals to " + space.getColor(), + space.getColor(), color); + } - } + } + + @Test + public void testBinConfig() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); - - - @Test - public void testBinConfig() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a bin_config", jsonNode.hasNonNull("bin_config")); - String binConfig = jsonNode.get("bin_config").asText(); - Assert.assertEquals("space bin_config must be equals to " + space.getBinConfig(), space.getBinConfig(), binConfig); - } + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a bin_config", + jsonNode.hasNonNull("bin_config")); + String binConfig = jsonNode.get("bin_config").asText(); + Assert.assertEquals( + "space bin_config must be equals to " + + space.getBinConfig(), space.getBinConfig(), + binConfig); + } + + } + + @Test + public void testCreatedBy() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a created_by", + jsonNode.hasNonNull("created_by")); + String createdBy = jsonNode.get("created_by").asText(); + Assert.assertEquals( + "space created_by must be equals to " + + space.getCreatedBy(), space.getCreatedBy(), + createdBy); + } + + } + + @Test + public void testCreated() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); + + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); - } - - @Test - public void testCreatedBy() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a created_by", jsonNode.hasNonNull("created_by")); - String createdBy = jsonNode.get("created_by").asText(); - Assert.assertEquals("space created_by must be equals to " + space.getCreatedBy(), space.getCreatedBy(), createdBy); - } + Assert.assertTrue("the space must have a created", + jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); + + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", + space.getCreated(), date.toDate()); + + } + + } + + @Test + public void testImage() throws JsonProcessingException, IOException { + + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces").request().get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode spacesList = mapper.readTree(respString); - } - - - @Test - public void testCreated() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); - - String dateStr = jsonNode.get("created").asText(); - - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime date = fmt.parseDateTime(dateStr); - - Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); - - } + for (JsonNode jsonNode : spacesList) { + String id = jsonNode.get("id").asText(); + Space space = this.spacesList.get(id); + + Assert.assertTrue("the space must have a image", + jsonNode.hasNonNull("image")); + String image = jsonNode.get("image").asText(); + Assert.assertEquals( + "space image must be equals to " + space.getImage(), + space.getImage(), image); + } + + } + + @Test + public void testSingleCreated() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + String id = jsonNode.get("id").asText(); + Assert.assertEquals("id must be equals", space.getId(), id); - } - - @Test - public void testImage() throws JsonProcessingException, IOException { - - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode spacesList = mapper.readTree(respString); - - for (JsonNode jsonNode : spacesList) { - String id = jsonNode.get("id").asText(); - Space space = this.spacesList.get(id); - - Assert.assertTrue("the space must have a image", jsonNode.hasNonNull("image")); - String image = jsonNode.get("image").asText(); - Assert.assertEquals("space image must be equals to " + space.getImage(), space.getImage(), image); - } + Assert.assertTrue("the space must have a created", + jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); + + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", + space.getCreated(), date.toDate()); + + } + + @Test + public void testSingleTitle() throws JsonProcessingException, IOException { - } - - @Test - public void testSingleCreated() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - String id = jsonNode.get("id").asText(); - Assert.assertEquals("id must be equals", space.getId(), id); - - Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); - - String dateStr = jsonNode.get("created").asText(); - - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime date = fmt.parseDateTime(dateStr); - - Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a title", + jsonNode.hasNonNull("title")); + String title = jsonNode.get("title").asText(); + Assert.assertEquals( + "space title must be equals to " + space.getTitle(), + space.getTitle(), title); + } + + @Test + public void testSingleDescription() throws JsonProcessingException, + IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); - } - - @Test - public void testSingleTitle() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a title", jsonNode.hasNonNull("title")); - String title = jsonNode.get("title").asText(); - Assert.assertEquals("space title must be equals to " + space.getTitle(), space.getTitle(), title); - } + Assert.assertTrue("the space must have a description", + jsonNode.hasNonNull("description")); + String description = jsonNode.get("description").asText(); + Assert.assertEquals( + "space description must be equals to " + space.getDescription(), + space.getDescription(), description); + } + + @Test + public void testSingleUri() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a uri", + jsonNode.hasNonNull("uri")); + String uri = jsonNode.get("uri").asText(); + Assert.assertEquals("space uri must be equals to " + space.getUri(), + space.getUri(), uri); + } + + @Test + public void testSingleColor() throws JsonProcessingException, IOException { - @Test - public void testSingleDescription() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a description", jsonNode.hasNonNull("description")); - String description = jsonNode.get("description").asText(); - Assert.assertEquals("space description must be equals to " + space.getDescription(), space.getDescription(), description); - } + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); - @Test - public void testSingleUri() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a uri", jsonNode.hasNonNull("uri")); - String uri = jsonNode.get("uri").asText(); - Assert.assertEquals("space uri must be equals to " + space.getUri(), space.getUri(), uri); - } + Assert.assertTrue("the space must have a color", + jsonNode.hasNonNull("color")); + String color = jsonNode.get("color").asText(); + Assert.assertEquals( + "space color must be equals to " + space.getColor(), + space.getColor(), color); + } - @Test - public void testSingleColor() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a color", jsonNode.hasNonNull("color")); - String color = jsonNode.get("color").asText(); - Assert.assertEquals("space color must be equals to " + space.getColor(), space.getColor(), color); - } + @Test + public void testSingleBinConfig() throws JsonProcessingException, + IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); - - - @Test - public void testSingleBinConfig() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a bin_config", jsonNode.hasNonNull("bin_config")); - String binConfig = jsonNode.get("bin_config").asText(); - Assert.assertEquals("space bin_config must be equals to " + space.getBinConfig(), space.getBinConfig(), binConfig); - } - - @Test - public void testSingleCreatedBy() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a created_by", jsonNode.hasNonNull("created_by")); - String createdBy = jsonNode.get("created_by").asText(); - Assert.assertEquals("space created_by must be equals to " + space.getCreatedBy(), space.getCreatedBy(), createdBy); - } - - - @Test - public void testSingleImage() throws JsonProcessingException, IOException { - - Space space = this.spacesList.get(this.firstSpaceUUID); - WebResource webResource = this.resource(); - String respString = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.APPLICATION_JSON).get(String.class); - logger.debug("RESPONSE : " + respString); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(respString); - - Assert.assertTrue("the space must have a image", jsonNode.hasNonNull("image")); - String image = jsonNode.get("image").asText(); - Assert.assertEquals("space image must be equals to " + space.getImage(), space.getImage(), image); - } - - - @Test - public void testPost() throws JsonProcessingException, ClientHandlerException, UniformInterfaceException, IOException { - - String title = "test_post"; - String description = "test space post"; - String uri = "http://ldt.iri.centrepompidou.fr/test_post"; - String color = "#bcbcbc"; - String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; - String created = "2013-01-01T01:01:01.001+0000"; - String bin_config = "{name: 'test_post_config'}"; - String created_by = "test_user_post"; - - String spaceJson = String.format("{" + - "\"title\":\"%s\"," + - "\"description\":\"%s\"," + - "\"uri\":\"%s\"," + - "\"color\":\"%s\"," + - "\"image\":\"%s\"," + - "\"created\":\"%s\"," + - "\"bin_config\":\"%s\"," + - "\"created_by\":\"%s\"" + - "}", - title, - description, - uri, - color, - image, - created, - bin_config, - created_by); - - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).post(ClientResponse.class); - - String respStr = resp.getEntity(String.class); - - Assert.assertEquals("Resp status = created : " + respStr, Status.CREATED.getStatusCode(), resp.getStatus()); - Assert.assertTrue("Resp must be application/json", resp.getType().isCompatible(MediaType.APPLICATION_JSON_TYPE)); - - ObjectMapper mapper = new ObjectMapper(); - JsonNode objNode = mapper.readTree(respStr); + Assert.assertTrue("the space must have a bin_config", + jsonNode.hasNonNull("bin_config")); + String binConfig = jsonNode.get("bin_config").asText(); + Assert.assertEquals( + "space bin_config must be equals to " + space.getBinConfig(), + space.getBinConfig(), binConfig); + } + + @Test + public void testSingleCreatedBy() throws JsonProcessingException, + IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a created_by", + jsonNode.hasNonNull("created_by")); + String createdBy = jsonNode.get("created_by").asText(); + Assert.assertEquals( + "space created_by must be equals to " + space.getCreatedBy(), + space.getCreatedBy(), createdBy); + } + + @Test + public void testSingleImage() throws JsonProcessingException, IOException { + + Space space = this.spacesList.get(this.firstSpaceUUID); + WebTarget WebTarget = this.target(); + String respString = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.APPLICATION_JSON) + .get(String.class); + logger.debug("RESPONSE : " + respString); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(respString); + + Assert.assertTrue("the space must have a image", + jsonNode.hasNonNull("image")); + String image = jsonNode.get("image").asText(); + Assert.assertEquals( + "space image must be equals to " + space.getImage(), + space.getImage(), image); + } + + @Test + public void testPost() throws JsonProcessingException, IOException { + + String title = "test_post"; + String description = "test space post"; + String uri = "http://ldt.iri.centrepompidou.fr/test_post"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_post_config'}"; + String created_by = "test_user_post"; + + String spaceJson = String.format("{" + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + "}", title, description, uri, + color, image, created, bin_config, created_by); + + WebTarget webTarget = this.target(); + Response resp = webTarget.path("spaces").request() + .accept(MediaType.APPLICATION_JSON) + .post(Entity.entity(spaceJson, MediaType.APPLICATION_JSON)); + + String respStr = resp.readEntity(String.class); + + Assert.assertEquals("Resp status = created : " + respStr, + Status.CREATED.getStatusCode(), resp.getStatus()); + Assert.assertTrue("Resp must be application/json", resp.getMediaType() + .isCompatible(MediaType.APPLICATION_JSON_TYPE)); + + ObjectMapper mapper = new ObjectMapper(); + JsonNode objNode = mapper.readTree(respStr); + + Assert.assertTrue("the space must have an id", objNode.hasNonNull("id")); + String idStr = objNode.get("id").asText(); + Assert.assertFalse("The id str must not be empty", idStr.length() == 0); + + Assert.assertTrue("the space must have a title", + objNode.hasNonNull("title")); + String titleStr = objNode.get("title").asText(); + Assert.assertEquals("space title must be equals to " + title, title, + titleStr); + + Assert.assertTrue("the space must have a description", + objNode.hasNonNull("description")); + String descriptionStr = objNode.get("description").asText(); + Assert.assertEquals("space description must be equals to " + + description, description, descriptionStr); + + Assert.assertTrue("the space must have a uri", + objNode.hasNonNull("uri")); + String uriStr = objNode.get("uri").asText(); + Assert.assertEquals("space uri must be equals to " + uri, uri, uriStr); - Assert.assertTrue("the space must have an id", objNode.hasNonNull("id")); - String idStr = objNode.get("id").asText(); - Assert.assertFalse("The id str must not be empty", idStr.length()==0); - - Assert.assertTrue("the space must have a title", objNode.hasNonNull("title")); - String titleStr = objNode.get("title").asText(); - Assert.assertEquals("space title must be equals to " + title, title, titleStr); + Assert.assertTrue("the space must have a color", + objNode.hasNonNull("color")); + String colorStr = objNode.get("color").asText(); + Assert.assertEquals("space color must be equals to " + color, color, + colorStr); + + Assert.assertTrue("the space must have a bin_config", + objNode.hasNonNull("bin_config")); + String bin_configStr = objNode.get("bin_config").asText(); + Assert.assertEquals("space bin_config must be equals to " + bin_config, + bin_config, bin_configStr); - Assert.assertTrue("the space must have a description", objNode.hasNonNull("description")); - String descriptionStr = objNode.get("description").asText(); - Assert.assertEquals("space description must be equals to " + description, description, descriptionStr); + Assert.assertTrue("the space must have a created_by", + objNode.hasNonNull("created_by")); + String created_byStr = objNode.get("created_by").asText(); + Assert.assertEquals("space created_by must be equals to " + created_by, + created_by, created_byStr); + + Assert.assertTrue("the space must have a created", + objNode.hasNonNull("created")); + String createdStr = objNode.get("created").asText(); + Assert.assertEquals("space created must be equals to " + created, + created, createdStr); - Assert.assertTrue("the space must have a uri", objNode.hasNonNull("uri")); - String uriStr = objNode.get("uri").asText(); - Assert.assertEquals("space uri must be equals to " + uri, uri, uriStr); + // object must be created + Space sp = this.spacesRepository.findOne(idStr); + + Assert.assertNotNull("Space object must be in rep", sp); - Assert.assertTrue("the space must have a color", objNode.hasNonNull("color")); - String colorStr = objNode.get("color").asText(); - Assert.assertEquals("space color must be equals to " + color, color, colorStr); + Assert.assertEquals("space title must be equals to " + title, title, + sp.getTitle()); + Assert.assertEquals("space description must be equals to " + + description, description, sp.getDescription()); + Assert.assertEquals("space uri must be equals to " + uri, uri, + sp.getUri()); + Assert.assertEquals("space color must be equals to " + color, color, + sp.getColor()); + Assert.assertEquals("space bin_config must be equals to " + bin_config, + bin_config, sp.getBinConfig()); + Assert.assertEquals("space created_by must be equals to " + created_by, + created_by, sp.getCreatedBy()); + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime created_date = fmt.parseDateTime(created); + Assert.assertEquals("space created must be equals to " + created, + created_date.toDate(), sp.getCreated()); - Assert.assertTrue("the space must have a bin_config", objNode.hasNonNull("bin_config")); - String bin_configStr = objNode.get("bin_config").asText(); - Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, bin_configStr); + } + + @Test + public void testPostWithId() { - Assert.assertTrue("the space must have a created_by", objNode.hasNonNull("created_by")); - String created_byStr = objNode.get("created_by").asText(); - Assert.assertEquals("space created_by must be equals to " + created_by, created_by, created_byStr); - - Assert.assertTrue("the space must have a created", objNode.hasNonNull("created")); - String createdStr = objNode.get("created").asText(); - Assert.assertEquals("space created must be equals to " + created, created, createdStr); - - // object must be created - Space sp = this.spacesRepository.findOne(idStr); - - Assert.assertNotNull("Space object must be in rep", sp); - - Assert.assertEquals("space title must be equals to " + title, title, sp.getTitle()); - Assert.assertEquals("space description must be equals to " + description, description, sp.getDescription()); - Assert.assertEquals("space uri must be equals to " + uri, uri, sp.getUri()); - Assert.assertEquals("space color must be equals to " + color, color, sp.getColor()); - Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, sp.getBinConfig()); - Assert.assertEquals("space created_by must be equals to " + created_by, created_by, sp.getCreatedBy()); - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime created_date = fmt.parseDateTime(created); - Assert.assertEquals("space created must be equals to " + created, created_date.toDate(), sp.getCreated()); - - } + String id = UUID.randomUUID().toString(); + String title = "test_post"; + String description = "test space post"; + String uri = "http://ldt.iri.centrepompidou.fr/test_post"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_post_config'}"; + String created_by = "test_user_post"; + + String spaceJson = String.format("{" + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + "\"color\":\"%s\"," + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + "}", id, title, description, uri, + color, image, created, bin_config, created_by); + + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces").request() + .accept(MediaType.APPLICATION_JSON) + .post(Entity.entity(spaceJson, MediaType.APPLICATION_JSON)); + + String respStr = resp.readEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, + Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); + Assert.assertEquals("Error message", "Id in JSON must be null", respStr); + + } + + @Test + public void testPut() throws JsonProcessingException, IOException { + + String id = this.firstSpaceUUID; + String title = "test_post"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; + + String spaceJson = String.format("{" + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + "\"color\":\"%s\"," + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + "}", id, title, description, uri, + color, image, created, bin_config, created_by); + + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request()//type(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)//.entity(spaceJson) + .put(Entity.entity(spaceJson, MediaType.APPLICATION_JSON)); - - @Test - public void testPostWithId() { - - String id = UUID.randomUUID().toString(); - String title = "test_post"; - String description = "test space post"; - String uri = "http://ldt.iri.centrepompidou.fr/test_post"; - String color = "#bcbcbc"; - String image = "http://ldt.iri.centrepompidou.fr/test_post/image"; - String created = "2013-01-01T01:01:01.001+0000"; - String bin_config = "{name: 'test_post_config'}"; - String created_by = "test_user_post"; - - String spaceJson = String.format("{" + - "\"id\":\"%s\"," + - "\"title\":\"%s\"," + - "\"description\":\"%s\"," + - "\"uri\":\"%s\"," + - "\"color\":\"%s\"," + - "\"image\":\"%s\"," + - "\"created\":\"%s\"," + - "\"bin_config\":\"%s\"," + - "\"created_by\":\"%s\"" + - "}", - id, - title, - description, - uri, - color, - image, - created, - bin_config, - created_by); - - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).post(ClientResponse.class); - - String respStr = resp.getEntity(String.class); - - Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); - Assert.assertEquals("Error message", "Id in JSON must be null", respStr); - - } - - @Test - public void testPut() throws JsonProcessingException, IOException { - - String id = this.firstSpaceUUID; - String title = "test_post"; - String description = "test space put"; - String uri = "http://ldt.iri.centrepompidou.fr/test_put"; - String color = "#bcbcbc"; - String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; - String created = "2013-01-01T01:01:01.001+0000"; - String bin_config = "{name: 'test_put_config'}"; - String created_by = "test_user_put"; - - String spaceJson = String.format("{" + - "\"id\":\"%s\"," + - "\"title\":\"%s\"," + - "\"description\":\"%s\"," + - "\"uri\":\"%s\"," + - "\"color\":\"%s\"," + - "\"image\":\"%s\"," + - "\"created\":\"%s\"," + - "\"bin_config\":\"%s\"," + - "\"created_by\":\"%s\"" + - "}", - id, - title, - description, - uri, - color, - image, - created, - bin_config, - created_by); - - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); - - String respStr = ""; - - if(resp.getStatus() != 204) { - respStr = resp.getEntity(String.class); - } - - Assert.assertEquals("Resp status = created : " + respStr, Status.NO_CONTENT.getStatusCode(), resp.getStatus()); - Assert.assertNull("Resp type must be null", resp.getType()); + String respStr = ""; + + if (resp.getStatus() != 204) { + respStr = resp.readEntity(String.class); + } + + Assert.assertEquals("Resp status = created : " + respStr, + Status.NO_CONTENT.getStatusCode(), resp.getStatus()); + Assert.assertNull("Resp type must be null", resp.getMediaType()); + + // object must be updated + Space sp = this.spacesRepository.findOne(id); + + Assert.assertNotNull("Space object must be in rep", sp); + + Assert.assertEquals("space title must be equals to " + title, title, + sp.getTitle()); + Assert.assertEquals("space description must be equals to " + + description, description, sp.getDescription()); + Assert.assertEquals("space uri must be equals to " + uri, uri, + sp.getUri()); + Assert.assertEquals("space color must be equals to " + color, color, + sp.getColor()); + Assert.assertEquals("space bin_config must be equals to " + bin_config, + bin_config, sp.getBinConfig()); + Assert.assertEquals("space created_by must be equals to " + created_by, + created_by, sp.getCreatedBy()); + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime created_date = fmt.parseDateTime(created); + Assert.assertEquals("space created must be equals to " + created, + created_date.toDate(), sp.getCreated()); + + } + + @Test + public void testPutWithoutId() { + + String title = "test_put"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; - - // object must be updated - Space sp = this.spacesRepository.findOne(id); - - Assert.assertNotNull("Space object must be in rep", sp); - - Assert.assertEquals("space title must be equals to " + title, title, sp.getTitle()); - Assert.assertEquals("space description must be equals to " + description, description, sp.getDescription()); - Assert.assertEquals("space uri must be equals to " + uri, uri, sp.getUri()); - Assert.assertEquals("space color must be equals to " + color, color, sp.getColor()); - Assert.assertEquals("space bin_config must be equals to " + bin_config, bin_config, sp.getBinConfig()); - Assert.assertEquals("space created_by must be equals to " + created_by, created_by, sp.getCreatedBy()); - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime created_date = fmt.parseDateTime(created); - Assert.assertEquals("space created must be equals to " + created, created_date.toDate(), sp.getCreated()); + String spaceJson = String.format("{" + "\"title\":\"%s\"," + + "\"description\":\"%s\"," + "\"uri\":\"%s\"," + + "\"color\":\"%s\"," + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + "}", title, description, uri, + color, image, created, bin_config, created_by); + + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request() + .accept(MediaType.APPLICATION_JSON) + .put(Entity.entity(spaceJson, MediaType.APPLICATION_JSON)); + + String respStr = resp.readEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, + Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); + Assert.assertEquals("Error message", + "Id parameter and id in JSON do not match", respStr); + } + + @Test + public void testPutBadId() { - } - - @Test - public void testPutWithoutId() { + String id = UUID.randomUUID().toString(); + String title = "test_post"; + String description = "test space put"; + String uri = "http://ldt.iri.centrepompidou.fr/test_put"; + String color = "#bcbcbc"; + String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; + String created = "2013-01-01T01:01:01.001+0000"; + String bin_config = "{name: 'test_put_config'}"; + String created_by = "test_user_put"; + + String spaceJson = String.format("{" + "\"id\":\"%s\"," + + "\"title\":\"%s\"," + "\"description\":\"%s\"," + + "\"uri\":\"%s\"," + "\"color\":\"%s\"," + "\"image\":\"%s\"," + + "\"created\":\"%s\"," + "\"bin_config\":\"%s\"," + + "\"created_by\":\"%s\"" + "}", id, title, description, uri, + color, image, created, bin_config, created_by); + + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces").path(id) + .request(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON) + .put(Entity.entity(spaceJson, MediaType.APPLICATION_JSON)); + + String respStr = resp.readEntity(String.class); + + Assert.assertEquals("Resp status = Bad Request : " + respStr, + Status.NOT_FOUND.getStatusCode(), resp.getStatus()); + + } + + @Test + public void testDelete() { - String title = "test_put"; - String description = "test space put"; - String uri = "http://ldt.iri.centrepompidou.fr/test_put"; - String color = "#bcbcbc"; - String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; - String created = "2013-01-01T01:01:01.001+0000"; - String bin_config = "{name: 'test_put_config'}"; - String created_by = "test_user_put"; - - String spaceJson = String.format("{" + - "\"title\":\"%s\"," + - "\"description\":\"%s\"," + - "\"uri\":\"%s\"," + - "\"color\":\"%s\"," + - "\"image\":\"%s\"," + - "\"created\":\"%s\"," + - "\"bin_config\":\"%s\"," + - "\"created_by\":\"%s\"" + - "}", - title, - description, - uri, - color, - image, - created, - bin_config, - created_by); - - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); - - String respStr = resp.getEntity(String.class); - - Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); - Assert.assertEquals("Error message", "Id parameter and id in JSON do not match", respStr); - } - - @Test - public void testPutBadId() { - - String id = UUID.randomUUID().toString(); - String title = "test_post"; - String description = "test space put"; - String uri = "http://ldt.iri.centrepompidou.fr/test_put"; - String color = "#bcbcbc"; - String image = "http://ldt.iri.centrepompidou.fr/test_put/image"; - String created = "2013-01-01T01:01:01.001+0000"; - String bin_config = "{name: 'test_put_config'}"; - String created_by = "test_user_put"; - - String spaceJson = String.format("{" + - "\"id\":\"%s\"," + - "\"title\":\"%s\"," + - "\"description\":\"%s\"," + - "\"uri\":\"%s\"," + - "\"color\":\"%s\"," + - "\"image\":\"%s\"," + - "\"created\":\"%s\"," + - "\"bin_config\":\"%s\"," + - "\"created_by\":\"%s\"" + - "}", - id, - title, - description, - uri, - color, - image, - created, - bin_config, - created_by); - - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(id).type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).entity(spaceJson).put(ClientResponse.class); - - String respStr = resp.getEntity(String.class); - - Assert.assertEquals("Resp status = Bad Request : " + respStr, Status.NOT_FOUND.getStatusCode(), resp.getStatus()); - - } - - @Test - public void testDelete() { + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces") + .path(this.firstSpaceUUID).request().accept(MediaType.TEXT_PLAIN) + .delete(); + + String respStr = resp.readEntity(String.class); + URI reqUri = WebTarget.getUriBuilder().path("spaces") + .path(this.firstSpaceUUID).build(); + + Assert.assertEquals("Status must be deleted : " + respStr, + Status.OK.getStatusCode(), resp.getStatus()); + Assert.assertEquals( + String.format("Message must be \"%s deleted\"", reqUri), + String.format("%s deleted", reqUri), respStr); + + // object must be updated + Space sp = this.spacesRepository.findOne(this.firstSpaceUUID); + + Assert.assertNull("Space object must be in rep", sp); + + } + + @Test + public void testSingleGetJsonp() throws JsonProcessingException, + IOException { + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces") + .path(this.firstSpaceUUID) + .queryParam("callback", "callback_func").request() + .accept("application/javascript").get(); + Assert.assertEquals("return type must be application/javascript", + "application/javascript", resp.getMediaType().toString()); + + String respStr = resp.readEntity(String.class); + + Assert.assertTrue("resp must start with callback call", + respStr.startsWith("callback_func(")); + Assert.assertTrue("resp must start with callback call", + respStr.endsWith(")")); + + String jsonStr = respStr.substring("callback_func(".length(), + respStr.length() - 1); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(jsonStr); + + Space space = this.spacesList.get(this.firstSpaceUUID); + + String id = jsonNode.get("id").asText(); + Assert.assertEquals("id must be equals", space.getId(), id); + + Assert.assertTrue("the space must have a created", + jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).accept(MediaType.TEXT_PLAIN).delete(ClientResponse.class); - - String respStr = resp.getEntity(String.class); - URI reqUri = webResource.getUriBuilder().path("spaces").path(this.firstSpaceUUID).build(); + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", + space.getCreated(), date.toDate()); + + Assert.assertEquals("title must be the same", space.getTitle(), + jsonNode.get("title").asText()); + + } - Assert.assertEquals("Status must be deleted : " + respStr, Status.OK.getStatusCode(), resp.getStatus()); - Assert.assertEquals(String.format("Message must be \"%s deleted\"", reqUri), String.format("%s deleted",reqUri) , respStr); - - // object must be updated - Space sp = this.spacesRepository.findOne(this.firstSpaceUUID); - - Assert.assertNull("Space object must be in rep", sp); + @Test + public void testSingleGetJsonpAcceptAll() throws JsonProcessingException, + IOException { + WebTarget WebTarget = this.target(); + Response resp = WebTarget.path("spaces") + .path(this.firstSpaceUUID) + .queryParam("callback", "callback_func").request().accept("*/*") + .get(); + Assert.assertEquals("return type must be application/javascript", + "application/javascript", resp.getMediaType().toString()); - } - - @Test - public void testSingleGetJsonp() throws JsonProcessingException, IOException { - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).queryParam("callback", "callback_func").accept("application/javascript").get(ClientResponse.class); - Assert.assertEquals("return type must be application/javascript","application/javascript", resp.getType().toString()); + String respStr = resp.readEntity(String.class); - String respStr = resp.getEntity(String.class); - - Assert.assertTrue("resp must start with callback call", respStr.startsWith("callback_func(")); - Assert.assertTrue("resp must start with callback call", respStr.endsWith(")")); - - String jsonStr = respStr.substring("callback_func(".length(), respStr.length()-1); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(jsonStr); - - Space space = this.spacesList.get(this.firstSpaceUUID); - - String id = jsonNode.get("id").asText(); - Assert.assertEquals("id must be equals", space.getId(), id); - - Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); - - String dateStr = jsonNode.get("created").asText(); - - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime date = fmt.parseDateTime(dateStr); - - Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); - - Assert.assertEquals("title must be the same", space.getTitle(), jsonNode.get("title").asText()); - - } - - @Test - public void testSingleGetJsonpAcceptAll() throws JsonProcessingException, IOException { - WebResource webResource = this.resource(); - ClientResponse resp = webResource.path("spaces").path(this.firstSpaceUUID).queryParam("callback", "callback_func").accept("*/*").get(ClientResponse.class); - Assert.assertEquals("return type must be application/javascript","application/javascript", resp.getType().toString()); + Assert.assertTrue("resp must start with callback call", + respStr.startsWith("callback_func(")); + Assert.assertTrue("resp must start with callback call", + respStr.endsWith(")")); + + String jsonStr = respStr.substring("callback_func(".length(), + respStr.length() - 1); + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(jsonStr); + + Space space = this.spacesList.get(this.firstSpaceUUID); + + String id = jsonNode.get("id").asText(); + Assert.assertEquals("id must be equals", space.getId(), id); - String respStr = resp.getEntity(String.class); - - Assert.assertTrue("resp must start with callback call", respStr.startsWith("callback_func(")); - Assert.assertTrue("resp must start with callback call", respStr.endsWith(")")); - - String jsonStr = respStr.substring("callback_func(".length(), respStr.length()-1); - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(jsonStr); - - Space space = this.spacesList.get(this.firstSpaceUUID); - - String id = jsonNode.get("id").asText(); - Assert.assertEquals("id must be equals", space.getId(), id); - - Assert.assertTrue("the space must have a created", jsonNode.hasNonNull("created")); - - String dateStr = jsonNode.get("created").asText(); - - DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); - DateTime date = fmt.parseDateTime(dateStr); - - Assert.assertEquals("Created date must be the same", space.getCreated(), date.toDate()); - - Assert.assertEquals("title must be the same", space.getTitle(), jsonNode.get("title").asText()); - - } + Assert.assertTrue("the space must have a created", + jsonNode.hasNonNull("created")); + + String dateStr = jsonNode.get("created").asText(); + + DateTimeFormatter fmt = ISODateTimeFormat.dateTime(); + DateTime date = fmt.parseDateTime(dateStr); + + Assert.assertEquals("Created date must be the same", + space.getCreated(), date.toDate()); + + Assert.assertEquals("title must be the same", space.getTitle(), + jsonNode.get("title").asText()); + + } }