From 2435e66439c95c2dd36baf0ad89e2bcc07671b92 Mon Sep 17 00:00:00 2001 From: sghosh Date: Mon, 4 Jan 2016 00:15:43 +0530 Subject: [PATCH 0001/1106] Source code for Intro to QueryDSL article. --- querydsl/pom.xml | 187 ++++++++++++++++++ .../main/java/org/baeldung/dao/PersonDao.java | 12 ++ .../java/org/baeldung/dao/PersonDaoImpl.java | 30 +++ .../main/java/org/baeldung/entity/Person.java | 50 +++++ .../main/resources/META-INF/persistence.xml | 19 ++ querydsl/src/main/resources/log4j.xml | 42 ++++ .../java/org/baeldung/dao/PersonDaoTest.java | 33 ++++ querydsl/src/test/resources/db.properties | 6 + querydsl/src/test/resources/test-context.xml | 20 ++ querydsl/src/test/resources/test-db.xml | 49 +++++ 10 files changed, 448 insertions(+) create mode 100644 querydsl/pom.xml create mode 100644 querydsl/src/main/java/org/baeldung/dao/PersonDao.java create mode 100644 querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java create mode 100644 querydsl/src/main/java/org/baeldung/entity/Person.java create mode 100644 querydsl/src/main/resources/META-INF/persistence.xml create mode 100644 querydsl/src/main/resources/log4j.xml create mode 100644 querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java create mode 100644 querydsl/src/test/resources/db.properties create mode 100644 querydsl/src/test/resources/test-context.xml create mode 100644 querydsl/src/test/resources/test-db.xml diff --git a/querydsl/pom.xml b/querydsl/pom.xml new file mode 100644 index 0000000000..4efb5dcb8b --- /dev/null +++ b/querydsl/pom.xml @@ -0,0 +1,187 @@ + + + 4.0.0 + + org.baeldung + querydsl + 0.1-SNAPSHOT + jar + + querydsl + http://maven.apache.org + + + UTF-8 + 1.6 + 4.10 + 3.1.0.RELEASE + 4.1.1.Final + 2.5.0 + 1.5.10 + + + + + + com.mysema.querydsl + querydsl-core + ${querydsl.version} + + + + com.mysema.querydsl + querydsl-jpa + ${querydsl.version} + + + + com.mysema.querydsl + querydsl-apt + ${querydsl.version} + provided + + + + + org.hibernate + hibernate-entitymanager + ${hibernate.version} + compile + + + + org.hibernate.javax.persistence + hibernate-jpa-2.0-api + 1.0.0.Final + compile + + + + commons-dbcp + commons-dbcp + 1.4 + jar + compile + + + + commons-pool + commons-pool + 1.5.5 + jar + compile + + + + + org.hsqldb + hsqldb-j5 + 2.2.4 + + + + + org.springframework + spring-context + ${spring.version} + + + + org.springframework + spring-webmvc + ${spring.version} + + + + org.springframework + spring-orm + ${spring.version} + jar + compile + + + + org.springframework + spring-aop + ${spring.version} + + + + org.springframework + spring-test + ${spring.version} + jar + test + + + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + jcl-over-slf4j + ${slf4j.version} + runtime + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + runtime + + + log4j + log4j + 1.2.16 + + + + + junit + junit + ${junit.version} + test + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + ${java.version} + ${java.version} + -proc:none + + + + + + com.mysema.maven + maven-apt-plugin + 1.0.3 + + + + process + + + target/metamodel + com.mysema.query.apt.jpa.JPAAnnotationProcessor + + + + + + + \ No newline at end of file diff --git a/querydsl/src/main/java/org/baeldung/dao/PersonDao.java b/querydsl/src/main/java/org/baeldung/dao/PersonDao.java new file mode 100644 index 0000000000..cc193de44b --- /dev/null +++ b/querydsl/src/main/java/org/baeldung/dao/PersonDao.java @@ -0,0 +1,12 @@ +package org.baeldung.dao; + +import org.baeldung.entity.Person; + +import java.util.List; + +public interface PersonDao { + + public Person save(Person person); + + public List findPersonsByFirstnameQueryDSL(String firstname); +} \ No newline at end of file diff --git a/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java b/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java new file mode 100644 index 0000000000..82ee4c16cd --- /dev/null +++ b/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java @@ -0,0 +1,30 @@ +package org.baeldung.dao; + +import com.mysema.query.jpa.impl.JPAQuery; +import org.baeldung.entity.Person; +import org.baeldung.entity.QPerson; +import org.springframework.stereotype.Repository; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import java.util.List; + +@Repository +public class PersonDaoImpl implements PersonDao { + + @PersistenceContext + private EntityManager em; + + public Person save(Person person) { + em.persist(person); + return person; + } + + public List findPersonsByFirstnameQueryDSL(String firstname) { + JPAQuery query = new JPAQuery(em); + QPerson person = QPerson.person; + + return query.from(person).where(person.firstname.eq(firstname)).list(person); + } + +} \ No newline at end of file diff --git a/querydsl/src/main/java/org/baeldung/entity/Person.java b/querydsl/src/main/java/org/baeldung/entity/Person.java new file mode 100644 index 0000000000..d9b0a5a97d --- /dev/null +++ b/querydsl/src/main/java/org/baeldung/entity/Person.java @@ -0,0 +1,50 @@ +package org.baeldung.entity; + +import javax.persistence.*; + +@Entity +public class Person { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column + private String firstname; + + @Column + private String surname; + + Person() { + } + + public Person(String firstname, String surname) { + this.firstname = firstname; + this.surname = surname; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + +} \ No newline at end of file diff --git a/querydsl/src/main/resources/META-INF/persistence.xml b/querydsl/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..111d7933c3 --- /dev/null +++ b/querydsl/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/querydsl/src/main/resources/log4j.xml b/querydsl/src/main/resources/log4j.xml new file mode 100644 index 0000000000..a7f96b38a4 --- /dev/null +++ b/querydsl/src/main/resources/log4j.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java b/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java new file mode 100644 index 0000000000..29d4dd98e9 --- /dev/null +++ b/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java @@ -0,0 +1,33 @@ +package org.baeldung.dao; + +import junit.framework.Assert; +import org.baeldung.entity.Person; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.transaction.TransactionConfiguration; +import org.springframework.transaction.annotation.Transactional; + + +@ContextConfiguration("/test-context.xml") +@RunWith(SpringJUnit4ClassRunner.class) +@Transactional +@TransactionConfiguration(defaultRollback=true) +public class PersonDaoTest { + + @Autowired + private PersonDao personDao; + + @Test + public void testCreation() { + personDao.save(new Person("Erich", "Gamma")); + Person person = new Person("Kent", "Beck"); + personDao.save(person); + personDao.save(new Person("Ralph", "Johnson")); + + Person personFromDb = personDao.findPersonsByFirstnameQueryDSL("Kent").get(0); + Assert.assertEquals(person.getId(), personFromDb.getId()); + } +} \ No newline at end of file diff --git a/querydsl/src/test/resources/db.properties b/querydsl/src/test/resources/db.properties new file mode 100644 index 0000000000..efee3669ce --- /dev/null +++ b/querydsl/src/test/resources/db.properties @@ -0,0 +1,6 @@ +#In memory db +db.username=sa +db.password= +db.driver=org.hsqldb.jdbcDriver +db.url=jdbc:hsqldb:mem:app-db +db.dialect=org.hibernate.dialect.HSQLDialect \ No newline at end of file diff --git a/querydsl/src/test/resources/test-context.xml b/querydsl/src/test/resources/test-context.xml new file mode 100644 index 0000000000..13d823a857 --- /dev/null +++ b/querydsl/src/test/resources/test-context.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/querydsl/src/test/resources/test-db.xml b/querydsl/src/test/resources/test-db.xml new file mode 100644 index 0000000000..7f85630b6b --- /dev/null +++ b/querydsl/src/test/resources/test-db.xml @@ -0,0 +1,49 @@ + + + + + + + classpath:db.properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 21e3d749636603513105a0ffbfc9f2370a88f1d5 Mon Sep 17 00:00:00 2001 From: amedviediev Date: Tue, 26 Jan 2016 00:06:58 +0200 Subject: [PATCH 0002/1106] Source code for the article "Returning Custom Status Codes from Spring MVC Controllers" --- spring-mvc-custom-status-codes/.gitignore | 13 ++++++ spring-mvc-custom-status-codes/pom.xml | 44 +++++++++++++++++++ .../CustomStatusCodesApplication.java | 11 +++++ .../java/com/baeldung/ExampleController.java | 24 ++++++++++ .../java/com/baeldung/ForbiddenException.java | 9 ++++ .../src/main/resources/application.properties | 0 6 files changed, 101 insertions(+) create mode 100644 spring-mvc-custom-status-codes/.gitignore create mode 100644 spring-mvc-custom-status-codes/pom.xml create mode 100644 spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java create mode 100644 spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java create mode 100644 spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java create mode 100644 spring-mvc-custom-status-codes/src/main/resources/application.properties diff --git a/spring-mvc-custom-status-codes/.gitignore b/spring-mvc-custom-status-codes/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-mvc-custom-status-codes/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-mvc-custom-status-codes/pom.xml b/spring-mvc-custom-status-codes/pom.xml new file mode 100644 index 0000000000..3fce332645 --- /dev/null +++ b/spring-mvc-custom-status-codes/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.baeldung + custom-status-codes + 0.0.1-SNAPSHOT + jar + + spring-mvc-custom-status-codes + Returning Custom Status Codes from Spring MVC Controllers + + + org.springframework.boot + spring-boot-starter-parent + 1.3.2.RELEASE + + + + + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + 1.3.2.RELEASE + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java new file mode 100644 index 0000000000..2baf4b122f --- /dev/null +++ b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java @@ -0,0 +1,11 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CustomStatusCodesApplication { + public static void main(String[] args) { + SpringApplication.run(CustomStatusCodesApplication.class, args); + } +} diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java new file mode 100644 index 0000000000..2d8f699776 --- /dev/null +++ b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java @@ -0,0 +1,24 @@ +package com.baeldung; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class ExampleController { + + @RequestMapping(value = "/controller", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity sendViaResponseEntity() { + return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE); + } + + @RequestMapping(value = "/exception", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity sendViaException() { + throw new ForbiddenException(); + } +} diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java new file mode 100644 index 0000000000..858d428681 --- /dev/null +++ b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java @@ -0,0 +1,9 @@ +package com.baeldung; + +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.ResponseStatus; + +@ResponseStatus(value = HttpStatus.FORBIDDEN, reason="To show an example of a custom message") +public class ForbiddenException extends RuntimeException { + +} diff --git a/spring-mvc-custom-status-codes/src/main/resources/application.properties b/spring-mvc-custom-status-codes/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 From c14e7ad1a17b34a60b74a4a4b63e8850567365d6 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0003/1106] RestEasy Tutorial, CRUD Services example --- RestEasy Example/pom.xml | 91 +++ .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../baeldung/client/ServicesInterface.java | 44 ++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../src/main/resources/schema1.xsd | 29 + .../main/webapp/WEB-INF/classes/logback.xml | 3 + .../WEB-INF/jboss-deployment-structure.xml | 16 + .../src/main/webapp/WEB-INF/jboss-web.xml | 4 + .../src/main/webapp/WEB-INF/web.xml | 51 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 12 files changed, 979 insertions(+) create mode 100644 RestEasy Example/pom.xml create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/main/resources/schema1.xsd create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/web.xml create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml new file mode 100644 index 0000000000..b16c5e8267 --- /dev/null +++ b/RestEasy Example/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + com.baeldung + resteasy-tutorial + 1.0 + war + + + + jboss + http://repository.jboss.org/nexus/content/groups/public/ + + + + + 3.0.14.Final + runtime + + + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + ${resteasy.scope} + + + jboss-jaxrs-api_2.0_spec + org.jboss.spec.javax.ws.rs + + + + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + ${resteasy.scope} + + + + + javax.ws.rs + javax.ws.rs-api + 2.0.1 + + + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + ${resteasy.scope} + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java new file mode 100644 index 0000000000..53e88961be --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -0,0 +1,44 @@ +package com.baeldung.client; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +public interface ServicesInterface { + + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response addMovie(Movie movie); + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response updateMovie(Movie movie); + + + @DELETE + @Path("/deletemovie") + Response deleteMovie(@QueryParam("imdbID") String imdbID); + + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd new file mode 100644 index 0000000000..0d74b7c366 --- /dev/null +++ b/RestEasy Example/src/main/resources/schema1.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml new file mode 100644 index 0000000000..d94e9f71ab --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000000..84d75934a7 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..694bb71332 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c66d3b56ae --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + RestEasy Example + + + + org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap + + + + RestEasy Example + + + webAppRootKey + RestEasyExample + + + + + + resteasy.servlet.mapping.prefix + /rest + + + + + resteasy-servlet + + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + javax.ws.rs.Application + com.baeldung.server.service.RestEasyServices + + + + + resteasy-servlet + /rest/* + + + + + index.html + + + + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From a85c9cbda573fc25ac4d0f133eaf6ed779611ad6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0004/1106] Added testCase for List All Movies and Add a Movie --- RestEasy Example/pom.xml | 29 +++++ .../baeldung/client/ServicesInterface.java | 6 +- .../java/com/baeldung/{ => model}/Movie.java | 45 +++++++- .../{service => }/MovieCrudService.java | 5 +- .../{service => }/RestEasyServices.java | 2 +- .../com/baeldung/server/RestEasyClient.java | 104 ++++++++++++++---- .../com/baeldung/server/movies/batman.json | 22 ++++ .../baeldung}/server/movies/transformer.json | 2 +- 8 files changed, 184 insertions(+), 31 deletions(-) rename RestEasy Example/src/main/java/com/baeldung/{ => model}/Movie.java (86%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/MovieCrudService.java (96%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/RestEasyServices.java (95%) create mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json rename RestEasy Example/src/test/resources/{ => com/baeldung}/server/movies/transformer.json (99%) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index b16c5e8267..8dabfc863b 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -85,6 +85,35 @@ ${resteasy.scope} + + + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + + com.fasterxml.jackson.core + jackson-core + 2.7.0 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.7.0 + + + + + diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 53e88961be..2585c32438 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,15 +1,13 @@ package com.baeldung.client; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; - +@Path("/movies") public interface ServicesInterface { diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java similarity index 86% rename from RestEasy Example/src/main/java/com/baeldung/Movie.java rename to RestEasy Example/src/main/java/com/baeldung/model/Movie.java index c0041d2e95..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,5 +1,5 @@ -package com.baeldung; +package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -532,4 +532,47 @@ public class Movie { this.year = value; } + @Override + public String toString() { + return "Movie{" + + "actors='" + actors + '\'' + + ", awards='" + awards + '\'' + + ", country='" + country + '\'' + + ", director='" + director + '\'' + + ", genre='" + genre + '\'' + + ", imdbID='" + imdbID + '\'' + + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + + ", language='" + language + '\'' + + ", metascore='" + metascore + '\'' + + ", poster='" + poster + '\'' + + ", rated='" + rated + '\'' + + ", released='" + released + '\'' + + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + + ", title='" + title + '\'' + + ", type='" + type + '\'' + + ", writer='" + writer + '\'' + + ", year='" + year + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Movie movie = (Movie) o; + + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + return title != null ? title.equals(movie.title) : movie.title == null; + + } + + @Override + public int hashCode() { + int result = imdbID != null ? imdbID.hashCode() : 0; + result = 31 * result + (title != null ? title.hashCode() : 0); + return result; + } } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java similarity index 96% rename from RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java rename to RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index d1973e7037..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,11 +1,10 @@ -package com.baeldung.server.service; +package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java similarity index 95% rename from RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java rename to RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 16b6200ad1..8c57d2c9b4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,4 +1,4 @@ -package com.baeldung.server.service; +package com.baeldung.server; import javax.ws.rs.ApplicationPath; diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json new file mode 100644 index 0000000000..28061d5bf9 --- /dev/null +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -0,0 +1,22 @@ +{ + "title": "Batman", + "year": "1989", + "rated": "PG-13", + "released": "23 Jun 1989", + "runtime": "126 min", + "genre": "Action, Adventure", + "director": "Tim Burton", + "writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)", + "actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl", + "plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.", + "language": "English, French", + "country": "USA, UK", + "awards": "Won 1 Oscar. Another 9 wins & 22 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg", + "metascore": "66", + "imdbRating": "7.6", + "imdbVotes": "256,000", + "imdbID": "tt0096895", + "type": "movie", + "response": "True" +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json similarity index 99% rename from RestEasy Example/src/test/resources/server/movies/transformer.json rename to RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index 2154868265..a3b033a8ba 100644 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -17,6 +17,6 @@ "imdbRating": "7.1", "imdbVotes": "492,225", "imdbID": "tt0418279", - "Type": "movie", + "type": "movie", "response": "True" } \ No newline at end of file From 453d9953858aa8ef9b5c0e54a3c7887e6fd36f9d Mon Sep 17 00:00:00 2001 From: amedviediev Date: Sat, 30 Jan 2016 23:05:06 +0200 Subject: [PATCH 0005/1106] - Updated source code for the article "Returning Custom Status Codes from Spring MVC Controllers" to be included in the spring-rest project --- spring-mvc-custom-status-codes/.gitignore | 13 ------ spring-mvc-custom-status-codes/pom.xml | 44 ------------------- .../CustomStatusCodesApplication.java | 11 ----- .../src/main/resources/application.properties | 0 .../controller/status}/ExampleController.java | 2 +- .../status}/ForbiddenException.java | 2 +- 6 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 spring-mvc-custom-status-codes/.gitignore delete mode 100644 spring-mvc-custom-status-codes/pom.xml delete mode 100644 spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java delete mode 100644 spring-mvc-custom-status-codes/src/main/resources/application.properties rename {spring-mvc-custom-status-codes/src/main/java/com/baeldung => spring-rest/src/main/java/org/baeldung/web/controller/status}/ExampleController.java (94%) rename {spring-mvc-custom-status-codes/src/main/java/com/baeldung => spring-rest/src/main/java/org/baeldung/web/controller/status}/ForbiddenException.java (85%) diff --git a/spring-mvc-custom-status-codes/.gitignore b/spring-mvc-custom-status-codes/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/spring-mvc-custom-status-codes/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file diff --git a/spring-mvc-custom-status-codes/pom.xml b/spring-mvc-custom-status-codes/pom.xml deleted file mode 100644 index 3fce332645..0000000000 --- a/spring-mvc-custom-status-codes/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - com.baeldung - custom-status-codes - 0.0.1-SNAPSHOT - jar - - spring-mvc-custom-status-codes - Returning Custom Status Codes from Spring MVC Controllers - - - org.springframework.boot - spring-boot-starter-parent - 1.3.2.RELEASE - - - - - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-web - 1.3.2.RELEASE - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java b/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java deleted file mode 100644 index 2baf4b122f..0000000000 --- a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/CustomStatusCodesApplication.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class CustomStatusCodesApplication { - public static void main(String[] args) { - SpringApplication.run(CustomStatusCodesApplication.class, args); - } -} diff --git a/spring-mvc-custom-status-codes/src/main/resources/application.properties b/spring-mvc-custom-status-codes/src/main/resources/application.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java b/spring-rest/src/main/java/org/baeldung/web/controller/status/ExampleController.java similarity index 94% rename from spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java rename to spring-rest/src/main/java/org/baeldung/web/controller/status/ExampleController.java index 2d8f699776..ceda138768 100644 --- a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ExampleController.java +++ b/spring-rest/src/main/java/org/baeldung/web/controller/status/ExampleController.java @@ -1,4 +1,4 @@ -package com.baeldung; +package org.baeldung.web.controller.status; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; diff --git a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java b/spring-rest/src/main/java/org/baeldung/web/controller/status/ForbiddenException.java similarity index 85% rename from spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java rename to spring-rest/src/main/java/org/baeldung/web/controller/status/ForbiddenException.java index 858d428681..1d4aff2ebf 100644 --- a/spring-mvc-custom-status-codes/src/main/java/com/baeldung/ForbiddenException.java +++ b/spring-rest/src/main/java/org/baeldung/web/controller/status/ForbiddenException.java @@ -1,4 +1,4 @@ -package com.baeldung; +package org.baeldung.web.controller.status; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; From a2a026a503167a5e3a0fb2f3e8856686ce1428cc Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0006/1106] Added testCase for all Services --- RestEasy Example/pom.xml | 15 -- .../baeldung/client/ServicesInterface.java | 10 +- .../com/baeldung/server/MovieCrudService.java | 15 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../com/baeldung/server/RestEasyClient.java | 112 ----------- .../baeldung/server/RestEasyClientTest.java | 189 ++++++++++++++++++ 6 files changed, 206 insertions(+), 137 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 8dabfc863b..6935238d91 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -99,21 +99,6 @@ 2.4 - - com.fasterxml.jackson.core - jackson-core - 2.7.0 - - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.0 - - - - - diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 2585c32438..7efed546d8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -17,6 +17,12 @@ public interface ServicesInterface { Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -34,9 +40,5 @@ public interface ServicesInterface { Response deleteMovie(@QueryParam("imdbID") String imdbID); - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index c66d3b56ae..ab3bc1aa83 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -33,7 +33,7 @@ javax.ws.rs.Application - com.baeldung.server.service.RestEasyServices + com.baeldung.server.RestEasyServices diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java new file mode 100644 index 0000000000..fb4205bcd7 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -0,0 +1,189 @@ +package com.baeldung.server; + +import com.baeldung.model.Movie; +import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +public class RestEasyClientTest { + + + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; + + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + + @Test + public void testListAllMovies() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testMovieByImdbID() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + + final Movie movies = simple.movieByImdbID(transformerImdbId); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); + + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testDeleteMovie() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(transformerImdbId); + moviesResponse.close(); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testUpdateMovie() { + + try { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file From ddec979e4d0383161654b79fce48b88f59286735 Mon Sep 17 00:00:00 2001 From: David Morley Date: Mon, 1 Feb 2016 05:51:27 -0600 Subject: [PATCH 0007/1106] Update Spring Data Redis example to use constructor injection --- .../data/redis/repo/StudentRepository.java | 3 ++- .../redis/repo/StudentRepositoryImpl.java | 24 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java index 6a909ed137..9e5502f8e0 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java @@ -1,12 +1,13 @@ package org.baeldung.spring.data.redis.repo; import org.baeldung.spring.data.redis.model.Student; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import java.util.Map; public interface StudentRepository { - + void saveStudent(Student person); void updateStudent(Student student); diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepositoryImpl.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepositoryImpl.java index 55e6ad5edc..43294cae58 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepositoryImpl.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepositoryImpl.java @@ -2,9 +2,11 @@ package org.baeldung.spring.data.redis.repo; import org.baeldung.spring.data.redis.model.Student; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Repository; +import javax.annotation.PostConstruct; import java.util.Map; @Repository @@ -12,26 +14,36 @@ public class StudentRepositoryImpl implements StudentRepository { private static final String KEY = "Student"; - @Autowired private RedisTemplate redisTemplate; + private HashOperations hashOperations; + + @Autowired + public StudentRepositoryImpl(RedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + @PostConstruct + private void init() { + hashOperations = redisTemplate.opsForHash(); + } public void saveStudent(final Student student) { - redisTemplate.opsForHash().put(KEY, student.getId(), student); + hashOperations.put(KEY, student.getId(), student); } public void updateStudent(final Student student) { - redisTemplate.opsForHash().put(KEY, student.getId(), student); + hashOperations.put(KEY, student.getId(), student); } public Student findStudent(final String id) { - return (Student) redisTemplate.opsForHash().get(KEY, id); + return (Student) hashOperations.get(KEY, id); } public Map findAllStudents() { - return redisTemplate.opsForHash().entries(KEY); + return hashOperations.entries(KEY); } public void deleteStudent(final String id) { - this.redisTemplate.opsForHash().delete(KEY, id); + hashOperations.delete(KEY, id); } } From 2fff2739690a712e5d87263c3f1c1c192f51ae9f Mon Sep 17 00:00:00 2001 From: oborkovskyi Date: Mon, 1 Feb 2016 16:12:47 +0200 Subject: [PATCH 0008/1106] Added guava19 test project --- guava19/pom.xml | 46 +++++++++ .../java/com/baeldung/guava/entity/User.java | 36 +++++++ .../com/baeldung/guava/CharMatcherTest.java | 33 +++++++ .../baeldung/guava/GuavaMiscUtilsTest.java | 95 +++++++++++++++++++ .../java/com/baeldung/guava/HashingTest.java | 34 +++++++ .../com/baeldung/guava/TypeTokenTest.java | 45 +++++++++ 6 files changed, 289 insertions(+) create mode 100644 guava19/pom.xml create mode 100644 guava19/src/main/java/com/baeldung/guava/entity/User.java create mode 100644 guava19/src/test/java/com/baeldung/guava/CharMatcherTest.java create mode 100644 guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java create mode 100644 guava19/src/test/java/com/baeldung/guava/HashingTest.java create mode 100644 guava19/src/test/java/com/baeldung/guava/TypeTokenTest.java diff --git a/guava19/pom.xml b/guava19/pom.xml new file mode 100644 index 0000000000..97c1b0ea4e --- /dev/null +++ b/guava19/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + com.baeldung + guava + 1.0-SNAPSHOT + + + + com.google.guava + guava + 19.0 + + + junit + junit + 4.12 + + + org.hamcrest + hamcrest-all + 1.3 + + + + + + maven-compiler-plugin + 3.3 + + true + true + 1.8 + 1.8 + UTF-8 + true + true + + + + + + \ No newline at end of file diff --git a/guava19/src/main/java/com/baeldung/guava/entity/User.java b/guava19/src/main/java/com/baeldung/guava/entity/User.java new file mode 100644 index 0000000000..be673edb10 --- /dev/null +++ b/guava19/src/main/java/com/baeldung/guava/entity/User.java @@ -0,0 +1,36 @@ +package com.baeldung.guava.entity; + +import com.google.common.base.MoreObjects; + +public class User{ + private long id; + private String name; + private int age; + + public User(long id, String name, int age) { + this.id = id; + this.name = name; + this.age = age; + } + + public long getId() { + return id; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(User.class) + .add("id", id) + .add("name", name) + .add("age", age) + .toString(); + } +} \ No newline at end of file diff --git a/guava19/src/test/java/com/baeldung/guava/CharMatcherTest.java b/guava19/src/test/java/com/baeldung/guava/CharMatcherTest.java new file mode 100644 index 0000000000..f890d9abc1 --- /dev/null +++ b/guava19/src/test/java/com/baeldung/guava/CharMatcherTest.java @@ -0,0 +1,33 @@ +package com.baeldung.guava; + +import com.google.common.base.CharMatcher; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class CharMatcherTest { + @Test + public void whenMatchingLetterOrString_ShouldReturnTrueForCorrectString() throws Exception { + String inputString = "someString789"; + boolean result = CharMatcher.javaLetterOrDigit().matchesAllOf(inputString); + + assertTrue(result); + } + + @Test + public void whenCollapsingString_ShouldReturnStringWithDashesInsteadOfWhitespaces() throws Exception { + String inputPhoneNumber = "8 123 456 123"; + String result = CharMatcher.whitespace().collapseFrom(inputPhoneNumber, '-'); + + assertEquals("8-123-456-123", result); + } + + @Test + public void whenCountingDigitsInString_ShouldReturnActualCountOfDigits() throws Exception { + String inputPhoneNumber = "8 123 456 123"; + int result = CharMatcher.digit().countIn(inputPhoneNumber); + + assertEquals(10, result); + } +} diff --git a/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java new file mode 100644 index 0000000000..4569019e60 --- /dev/null +++ b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java @@ -0,0 +1,95 @@ +package com.baeldung.guava; + +import com.baeldung.guava.entity.User; +import com.google.common.base.CharMatcher; +import com.google.common.base.Throwables; +import com.google.common.collect.*; +import com.google.common.hash.HashCode; +import com.google.common.hash.HashFunction; +import com.google.common.hash.Hashing; +import com.google.common.reflect.TypeToken; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder; +import static org.hamcrest.core.AnyOf.anyOf; +import static org.junit.Assert.*; + +public class GuavaMiscUtilsTest { + + @Test + public void whenGettingLazyStackTrace_ListShouldBeReturned() throws Exception { + IllegalArgumentException e = new IllegalArgumentException("Some argument is incorrect"); + + List stackTraceElements = Throwables.lazyStackTrace(e); + + assertEquals(27, stackTraceElements.size()); + } + + @Test + public void multisetShouldCountHitsOfMultipleDuplicateObjects() throws Exception { + List userNames = Arrays.asList("David", "Eugene", "Alex", "Alex", "David", "David", "David"); + + Multiset userNamesMultiset = HashMultiset.create(userNames); + + assertEquals(7, userNamesMultiset.size()); + assertEquals(4, userNamesMultiset.count("David")); + assertEquals(2, userNamesMultiset.count("Alex")); + assertEquals(1, userNamesMultiset.count("Eugene")); + assertThat(userNamesMultiset.elementSet(), anyOf(containsInAnyOrder("Alex", "David", "Eugene"))); + } + + @Test + public void whenAddingNewConnectedRange_RangesShouldBeMerged() throws Exception { + RangeSet rangeSet = TreeRangeSet.create(); + + rangeSet.add(Range.closed(1, 10)); + rangeSet.add(Range.closed(5, 15)); + rangeSet.add(Range.closedOpen(10, 17)); + + assertTrue(rangeSet.encloses(Range.closedOpen(1, 17))); + assertTrue(rangeSet.encloses(Range.closed(2, 3))); + assertTrue(rangeSet.contains(15)); + assertFalse(rangeSet.contains(17)); + assertEquals(1, rangeSet.asDescendingSetOfRanges().size()); + } + + @Test + public void cartesianProductShouldReturnAllPossibleCombinations() throws Exception { + List first = Lists.newArrayList("value1", "value2"); + List second = Lists.newArrayList("value3", "value4"); + + List> cartesianProduct = Lists.cartesianProduct(first, second); + + List pair1 = Lists.newArrayList("value2", "value3"); + List pair2 = Lists.newArrayList("value2", "value4"); + List pair3 = Lists.newArrayList("value1", "value3"); + List pair4 = Lists.newArrayList("value1", "value4"); + + assertThat(cartesianProduct, anyOf(containsInAnyOrder(pair1, pair2, pair3, pair4))); + } + + @Test + public void multisetShouldRemoveOccurrencesOfSpecifiedObjects() throws Exception { + Multiset multisetToModify = HashMultiset.create(); + Multiset occurrencesToRemove = HashMultiset.create(); + + multisetToModify.add("John"); + multisetToModify.add("Max"); + multisetToModify.add("Alex"); + + occurrencesToRemove.add("Alex"); + occurrencesToRemove.add("John"); + + Multisets.removeOccurrences(multisetToModify, occurrencesToRemove); + + assertEquals(1, multisetToModify.size()); + assertTrue(multisetToModify.contains("Max")); + assertFalse(multisetToModify.contains("John")); + assertFalse(multisetToModify.contains("Alex")); + } +} \ No newline at end of file diff --git a/guava19/src/test/java/com/baeldung/guava/HashingTest.java b/guava19/src/test/java/com/baeldung/guava/HashingTest.java new file mode 100644 index 0000000000..9b4acde9f7 --- /dev/null +++ b/guava19/src/test/java/com/baeldung/guava/HashingTest.java @@ -0,0 +1,34 @@ +package com.baeldung.guava; + +import com.google.common.hash.HashCode; +import com.google.common.hash.HashFunction; +import com.google.common.hash.Hashing; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class HashingTest { + @Test + public void whenHashingInSha384_hashFunctionShouldBeReturned() throws Exception { + int inputData = 15; + + HashFunction hashFunction = Hashing.sha384(); + HashCode hashCode = hashFunction.hashInt(inputData); + + assertEquals("0904b6277381dcfbdddd6b6c66e4e3e8f83d4690718d8e6f272c891f24773a12feaf8c449fa6e42240a621b2b5e3cda8", + hashCode.toString()); + } + + @Test + public void whenConcatenatingHashFunction_concatenatedHashShouldBeReturned() throws Exception { + int inputData = 15; + + HashFunction hashFunction = Hashing.concatenating(Hashing.crc32(), Hashing.crc32()); + HashFunction crc32Function = Hashing.crc32(); + + HashCode hashCode = hashFunction.hashInt(inputData); + HashCode crc32HashCode = crc32Function.hashInt(inputData); + + assertEquals(crc32HashCode.toString() + crc32HashCode.toString(), hashCode.toString()); + } +} diff --git a/guava19/src/test/java/com/baeldung/guava/TypeTokenTest.java b/guava19/src/test/java/com/baeldung/guava/TypeTokenTest.java new file mode 100644 index 0000000000..1923451f20 --- /dev/null +++ b/guava19/src/test/java/com/baeldung/guava/TypeTokenTest.java @@ -0,0 +1,45 @@ +package com.baeldung.guava; + +import com.google.common.reflect.TypeToken; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class TypeTokenTest { + @Test + public void whenCheckingIsAssignableFrom_shouldReturnTrueEvenIfGenericIsSpecified() throws Exception { + ArrayList stringList = new ArrayList<>(); + ArrayList intList = new ArrayList<>(); + boolean isAssignableFrom = stringList.getClass().isAssignableFrom(intList.getClass()); + + assertTrue(isAssignableFrom); + } + + @Test + public void whenCheckingIsSupertypeOf_shouldReturnFalseIfGenericIsSpecified() throws Exception { + TypeToken> listString = new TypeToken>() { + }; + TypeToken> integerString = new TypeToken>() { + }; + + boolean isSupertypeOf = listString.isSupertypeOf(integerString); + + assertFalse(isSupertypeOf); + } + + @Test + public void whenCheckingIsSubtypeOf_shouldReturnTrueIfClassIsExtendedFrom() throws Exception { + TypeToken> stringList = new TypeToken>() { + }; + TypeToken list = new TypeToken() { + }; + + boolean isSubtypeOf = stringList.isSubtypeOf(list); + + assertTrue(isSubtypeOf); + } +} From de3b09bfd1d72942b333b73c4ff735d5fcf17f04 Mon Sep 17 00:00:00 2001 From: amedviediev Date: Mon, 1 Feb 2016 20:38:01 +0200 Subject: [PATCH 0009/1106] - Added test code for the article "Returning Custom Status Codes from Spring MVC Controllers" --- .../status/ExampleControllerTest.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java new file mode 100644 index 0000000000..8d4f583a08 --- /dev/null +++ b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java @@ -0,0 +1,43 @@ +package com.baeldung; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = WebConfig.class) +@WebAppConfiguration +public class ExampleControllerTest { + + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext webApplicationContext; + + @Before + public void setUp() { + mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); + } + + @Test + public void whenGetRequestSentToController_thenReturnsStatusNotAcceptable() throws Exception { + mockMvc.perform(get("/controller")) + .andExpect(status().isNotAcceptable()); + } + + @Test + public void whenGetRequestSentToException_thenReturnsStatusForbidden() throws Exception { + mockMvc.perform(get("/exception")) + .andExpect(status().isForbidden()); + } +} From dfc96b2dd101a98d214e9b289f05b6a0cc885d25 Mon Sep 17 00:00:00 2001 From: amedviediev Date: Tue, 2 Feb 2016 20:15:51 +0200 Subject: [PATCH 0010/1106] - Fixed tests --- spring-rest/pom.xml | 4 ---- .../web/controller/status/ExampleControllerTest.java | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index e2cf9d7c3e..54ac868b95 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -33,7 +33,6 @@ org.springframework spring-web - ${org.springframework.version} commons-logging @@ -44,12 +43,10 @@ org.springframework spring-webmvc - ${org.springframework.version} org.springframework spring-oxm - ${org.springframework.version} @@ -229,7 +226,6 @@ - 4.2.4.RELEASE 4.0.3.RELEASE diff --git a/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java index 8d4f583a08..1344d2d40e 100644 --- a/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java +++ b/spring-rest/src/test/java/org/baeldung/web/controller/status/ExampleControllerTest.java @@ -1,13 +1,14 @@ -package com.baeldung; +package org.baeldung.web.controller.status; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import org.baeldung.config.WebConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; From dffa1d2504053dccf48d5effe7ff60aa806f35ce Mon Sep 17 00:00:00 2001 From: eugenp Date: Wed, 3 Feb 2016 19:28:48 +0200 Subject: [PATCH 0011/1106] minor cleanup work --- .../converter/UserWriterConverter.java | 2 + .../baeldung/spring/web/config/WebConfig.java | 65 +++++++++---------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java b/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java index 54fa78e2d0..2dedda46ec 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java @@ -9,6 +9,7 @@ import com.mongodb.DBObject; @Component public class UserWriterConverter implements Converter { + @Override public DBObject convert(final User user) { final DBObject dbObject = new BasicDBObject(); @@ -22,4 +23,5 @@ public class UserWriterConverter implements Converter { dbObject.removeField("_class"); return dbObject; } + } diff --git a/spring-mvc-java/src/main/java/org/baeldung/spring/web/config/WebConfig.java b/spring-mvc-java/src/main/java/org/baeldung/spring/web/config/WebConfig.java index 58438d2976..09e9cff917 100644 --- a/spring-mvc-java/src/main/java/org/baeldung/spring/web/config/WebConfig.java +++ b/spring-mvc-java/src/main/java/org/baeldung/spring/web/config/WebConfig.java @@ -18,43 +18,42 @@ import org.springframework.web.servlet.view.XmlViewResolver; @ComponentScan("org.baeldung.web") public class WebConfig extends WebMvcConfigurerAdapter { - public WebConfig() { - super(); - } + public WebConfig() { + super(); + } - @Override - public void addViewControllers(final ViewControllerRegistry registry) { + // - super.addViewControllers(registry); - registry.addViewController("/sample.html"); - } + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + super.addViewControllers(registry); + registry.addViewController("/sample.html"); + } - @Bean - public ViewResolver internalResourceViewResolver() { + @Bean + public ViewResolver internalResourceViewResolver() { + final InternalResourceViewResolver bean = new InternalResourceViewResolver(); + bean.setViewClass(JstlView.class); + bean.setPrefix("/WEB-INF/view/"); + bean.setSuffix(".jsp"); + bean.setOrder(2); + return bean; + } - final InternalResourceViewResolver bean = new InternalResourceViewResolver(); - bean.setViewClass(JstlView.class); - bean.setPrefix("/WEB-INF/view/"); - bean.setSuffix(".jsp"); - bean.setOrder(2); - return bean; - } + @Bean + public ViewResolver xmlViewResolver() { + final XmlViewResolver bean = new XmlViewResolver(); + bean.setLocation(new ClassPathResource("views.xml")); + bean.setOrder(1); + return bean; + } - @Bean - public ViewResolver xmlViewResolver() { + @Bean + public ViewResolver resourceBundleViewResolver() { + final ResourceBundleViewResolver bean = new ResourceBundleViewResolver(); + bean.setBasename("views"); + bean.setOrder(0); + return bean; + } - final XmlViewResolver bean = new XmlViewResolver(); - bean.setLocation(new ClassPathResource("views.xml")); - bean.setOrder(1); - return bean; - } - - @Bean - public ViewResolver resourceBundleViewResolver() { - - final ResourceBundleViewResolver bean = new ResourceBundleViewResolver(); - bean.setBasename("views"); - bean.setOrder(0); - return bean; - } } \ No newline at end of file From e14be27fcc4e43cc597ddb79bce2ce7aab8e0288 Mon Sep 17 00:00:00 2001 From: ypatil Date: Thu, 4 Feb 2016 14:10:46 +0530 Subject: [PATCH 0012/1106] Spring with Apache Camel for file processing --- spring-apache-camel/data/file1.txt | 1 + .../data/input/.camel/file1.txt | 1 + .../data/outputLowerCase/file1.txt | 1 + .../data/outputUppperCase/file1.txt | 1 + spring-apache-camel/pom.xml | 43 +++++++++++++++++++ .../main/java/org/apache/camel/main/App.java | 12 ++++++ .../apache/camel/processor/FileProcessor.java | 19 ++++++++ .../src/main/resources/camel-context.xml | 41 ++++++++++++++++++ 8 files changed, 119 insertions(+) create mode 100644 spring-apache-camel/data/file1.txt create mode 100644 spring-apache-camel/data/input/.camel/file1.txt create mode 100644 spring-apache-camel/data/outputLowerCase/file1.txt create mode 100644 spring-apache-camel/data/outputUppperCase/file1.txt create mode 100644 spring-apache-camel/pom.xml create mode 100644 spring-apache-camel/src/main/java/org/apache/camel/main/App.java create mode 100644 spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java create mode 100644 spring-apache-camel/src/main/resources/camel-context.xml diff --git a/spring-apache-camel/data/file1.txt b/spring-apache-camel/data/file1.txt new file mode 100644 index 0000000000..c8436b654b --- /dev/null +++ b/spring-apache-camel/data/file1.txt @@ -0,0 +1 @@ +THIS IS UPPERCASE CONTENT. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/input/.camel/file1.txt b/spring-apache-camel/data/input/.camel/file1.txt new file mode 100644 index 0000000000..c8436b654b --- /dev/null +++ b/spring-apache-camel/data/input/.camel/file1.txt @@ -0,0 +1 @@ +THIS IS UPPERCASE CONTENT. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/outputLowerCase/file1.txt b/spring-apache-camel/data/outputLowerCase/file1.txt new file mode 100644 index 0000000000..06a9866342 --- /dev/null +++ b/spring-apache-camel/data/outputLowerCase/file1.txt @@ -0,0 +1 @@ +this is uppercase content. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/outputUppperCase/file1.txt b/spring-apache-camel/data/outputUppperCase/file1.txt new file mode 100644 index 0000000000..ce07e477bc --- /dev/null +++ b/spring-apache-camel/data/outputUppperCase/file1.txt @@ -0,0 +1 @@ +THIS IS UPPERCASE CONTENT. THIS IS LOWECASE CONTENT. \ No newline at end of file diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml new file mode 100644 index 0000000000..5b143fedb4 --- /dev/null +++ b/spring-apache-camel/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + org.apache.camel + spring-apache-camel + jar + 1.0-SNAPSHOT + spring-apache-camel + http://maven.apache.org + + + 2.16.1 + 4.2.4.RELEASE + + + + + + org.apache.camel + camel-core + ${env.camel.version} + + + + org.apache.camel + camel-spring + ${env.camel.version} + + + + org.apache.camel + camel-stream + ${env.camel.version} + + + + org.springframework + spring-context + ${env.spring.version} + + + + diff --git a/spring-apache-camel/src/main/java/org/apache/camel/main/App.java b/spring-apache-camel/src/main/java/org/apache/camel/main/App.java new file mode 100644 index 0000000000..4d0793903e --- /dev/null +++ b/spring-apache-camel/src/main/java/org/apache/camel/main/App.java @@ -0,0 +1,12 @@ +package org.apache.camel.main; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class App { + public static void main(final String[] args) throws Exception { + //Load application context + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context.xml"); + Thread.sleep(5000); + applicationContext.close(); + } +} \ No newline at end of file diff --git a/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java b/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java new file mode 100644 index 0000000000..961f877806 --- /dev/null +++ b/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java @@ -0,0 +1,19 @@ +package org.apache.camel.processor; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; + +public class FileProcessor implements Processor { + + public void process(Exchange exchange) throws Exception { + //Read file content + String originalFileContent = (String)exchange.getIn().getBody(String.class); + + //Convert file content to upper case. + String upperCaseFileContent = originalFileContent.toUpperCase(); + + //Update file content. + exchange.getIn().setBody(upperCaseFileContent); + } + +} diff --git a/spring-apache-camel/src/main/resources/camel-context.xml b/spring-apache-camel/src/main/resources/camel-context.xml new file mode 100644 index 0000000000..d304ceb857 --- /dev/null +++ b/spring-apache-camel/src/main/resources/camel-context.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + ${body.toLowerCase()} + + + + + + + + .......... File content conversion completed .......... + + + + + + + + + \ No newline at end of file From c385d23cd53543d6bb0a0f6f7ec8c97a8679c31d Mon Sep 17 00:00:00 2001 From: ypatil Date: Thu, 4 Feb 2016 14:13:39 +0530 Subject: [PATCH 0013/1106] Readme file added --- spring-apache-camel/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 spring-apache-camel/README.md diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md new file mode 100644 index 0000000000..28b95bdf89 --- /dev/null +++ b/spring-apache-camel/README.md @@ -0,0 +1,28 @@ + +

Configure and Use Apache Camel with Spring

+ +This article will demonstrate how to configure and use Apache Camel with Spring Framework. + +

Relevant Article

+ + + +

Framework Versions:

+ +
    +
  • Spring 4.2.4
  • +
  • Apache Camel 2.16.1
  • +
+ +

Build and Run Application

+ +To build this application execute following maven command in ApacheCamelFileProcessor directory. + +mvn clean install + +To run this application you can either run our main class org.apache.camel.main.App from your IDE or you can execute following maven command: + +mvn exec:java -Dexec.mainClass="org.apache.camel.main.App" \ No newline at end of file From 032be8319e108f95f0d87d9f020a9f021186ef93 Mon Sep 17 00:00:00 2001 From: Dmitry Zinkevich Date: Thu, 14 Jan 2016 08:42:10 +0300 Subject: [PATCH 0014/1106] Add Elasticsearch Spring Data test cases --- spring-data-elasticsearch/.classpath | 31 +++++ spring-data-elasticsearch/.project | 29 ++++ spring-data-elasticsearch/README.md | 12 ++ spring-data-elasticsearch/pom.xml | 78 +++++++++++ .../main/java/com/baeldung/config/Config.java | 53 +++++++ .../com/baeldung/dao/ArticleRepository.java | 16 +++ .../main/java/com/baeldung/model/Article.java | 60 ++++++++ .../main/java/com/baeldung/model/Author.java | 28 ++++ .../com/baeldung/service/ArticleService.java | 15 ++ .../baeldung/service/ArticleServiceImpl.java | 54 ++++++++ .../src/main/resources/logback.xml | 20 +++ .../java/com/baeldung/ElasticSearchTest.java | 130 ++++++++++++++++++ 12 files changed, 526 insertions(+) create mode 100644 spring-data-elasticsearch/.classpath create mode 100644 spring-data-elasticsearch/.project create mode 100644 spring-data-elasticsearch/README.md create mode 100644 spring-data-elasticsearch/pom.xml create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java create mode 100644 spring-data-elasticsearch/src/main/resources/logback.xml create mode 100644 spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java diff --git a/spring-data-elasticsearch/.classpath b/spring-data-elasticsearch/.classpath new file mode 100644 index 0000000000..698778fef3 --- /dev/null +++ b/spring-data-elasticsearch/.classpath @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-data-elasticsearch/.project b/spring-data-elasticsearch/.project new file mode 100644 index 0000000000..09b9a781ed --- /dev/null +++ b/spring-data-elasticsearch/.project @@ -0,0 +1,29 @@ + + + spring-data-elasticsearch + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/spring-data-elasticsearch/README.md b/spring-data-elasticsearch/README.md new file mode 100644 index 0000000000..0dae92e0e7 --- /dev/null +++ b/spring-data-elasticsearch/README.md @@ -0,0 +1,12 @@ +## Spring Data Elasticsearch + +### Build the Project with Tests Running +``` +mvn clean install +``` + +### Run Tests Directly +``` +mvn test +``` + diff --git a/spring-data-elasticsearch/pom.xml b/spring-data-elasticsearch/pom.xml new file mode 100644 index 0000000000..7ac6dd0fcf --- /dev/null +++ b/spring-data-elasticsearch/pom.xml @@ -0,0 +1,78 @@ + + 4.0.0 + + org.baeldung + spring-data-elasticsearch + 0.0.1-SNAPSHOT + jar + + spring-data-elasticsearch + + + UTF-8 + 1.3.2.RELEASE + 4.2.2.RELEASE + 4.11 + 1.7.12 + 1.1.3 + 1.3.2.RELEASE + + + + + org.springframework + spring-core + ${org.springframework.version} + + + junit + junit-dep + ${junit.version} + test + + + org.springframework + spring-test + ${org.springframework.version} + test + + + org.springframework.data + spring-data-elasticsearch + ${elasticsearch.version} + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + + + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + + diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java b/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java new file mode 100644 index 0000000000..eb65e38f65 --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java @@ -0,0 +1,53 @@ +package com.baeldung.config; + +import org.elasticsearch.common.settings.ImmutableSettings; +import org.elasticsearch.node.NodeBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.elasticsearch.core.ElasticsearchOperations; +import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; +import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +@Configuration +@EnableElasticsearchRepositories(basePackages = "com.baeldung.dao") +@ComponentScan(basePackages = {"com.baeldung.service"}) +public class Config { + + private static Logger logger = LoggerFactory.getLogger(Config.class); + + @Bean + public NodeBuilder nodeBuilder() { + return new NodeBuilder(); + } + + @Bean + public ElasticsearchOperations elasticsearchTemplate() { + + try { + Path tmpDir = Files.createTempDirectory(Paths.get(System.getProperty("java.io.tmpdir")), "elasticsearch_data"); + + ImmutableSettings.Builder elasticsearchSettings = ImmutableSettings.settingsBuilder() + .put("http.enabled", "false") + .put("path.data", tmpDir.toAbsolutePath().toString()); + + logger.debug(tmpDir.toAbsolutePath().toString()); + + return new ElasticsearchTemplate(nodeBuilder() + .local(true) + .settings(elasticsearchSettings.build()) + .node() + .client()); + } catch (IOException ioex) { + logger.error("Cannot create temp dir", ioex); + throw new RuntimeException(); + } + } +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java b/spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java new file mode 100644 index 0000000000..6ed86eff9b --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java @@ -0,0 +1,16 @@ +package com.baeldung.dao; + +import com.baeldung.model.Article; +import com.baeldung.model.Article; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.elasticsearch.annotations.Query; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; + +public interface ArticleRepository extends ElasticsearchRepository { + + Page
findByAuthorsName(String name, Pageable pageable); + + @Query("{\"bool\": {\"must\": [{\"match\": {\"authors.name\": \"?0\"}}]}}") + Page
findByAuthorsNameUsingCustomQuery(String name, Pageable pageable); +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java new file mode 100644 index 0000000000..17580ca0db --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java @@ -0,0 +1,60 @@ +package com.baeldung.model; + +import org.springframework.data.annotation.Id; +import org.springframework.data.elasticsearch.annotations.Document; +import org.springframework.data.elasticsearch.annotations.Field; +import org.springframework.data.elasticsearch.annotations.FieldIndex; +import org.springframework.data.elasticsearch.annotations.FieldType; + +import java.util.List; + +@Document(indexName = "article", type = "article") +public class Article { + + @Id + private String id; + @Field(type = FieldType.String, index = FieldIndex.not_analyzed) + private String title; + @Field(type = FieldType.Nested) + private List authors; + + public Article() { + } + + public Article(String title) { + this.title = title; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public List getAuthors() { + return authors; + } + + public void setAuthors(List authors) { + this.authors = authors; + } + + @Override + public String toString() { + return "Article{" + + "id='" + id + '\'' + + ", title='" + title + '\'' + + ", authors=" + authors + + '}'; + } +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java new file mode 100644 index 0000000000..09239efbe5 --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java @@ -0,0 +1,28 @@ +package com.baeldung.model; + +public class Author { + + private String name; + + public Author() { + } + + public Author(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Author{" + + "name='" + name + '\'' + + '}'; + } +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java new file mode 100644 index 0000000000..052e22c67d --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java @@ -0,0 +1,15 @@ +package com.baeldung.service; + +import com.baeldung.model.Article; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +public interface ArticleService { + Article save(Article article); + Article findOne(String id); + Iterable
findAll(); + Page
findByAuthorName(String name, Pageable pageable); + Page
findByAuthorNameUsingCustomQuery(String name, Pageable pageable); + long count(); + void delete(Article article); +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java new file mode 100644 index 0000000000..4dc100ec22 --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java @@ -0,0 +1,54 @@ +package com.baeldung.service; + +import com.baeldung.dao.ArticleRepository; +import com.baeldung.model.Article; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; + +@Service +public class ArticleServiceImpl implements ArticleService { + + private ArticleRepository articleRepository; + + @Autowired + public void setArticleRepository(ArticleRepository articleRepository) { + this.articleRepository = articleRepository; + } + + @Override + public Article save(Article article) { + return articleRepository.save(article); + } + + @Override + public Article findOne(String id) { + return articleRepository.findOne(id); + } + + @Override + public Iterable
findAll() { + return articleRepository.findAll(); + } + + @Override + public Page
findByAuthorName(String name, Pageable pageable) { + return articleRepository.findByAuthorsName(name, pageable); + } + + @Override + public Page
findByAuthorNameUsingCustomQuery(String name, Pageable pageable) { + return articleRepository.findByAuthorsNameUsingCustomQuery(name, pageable); + } + + @Override + public long count() { + return articleRepository.count(); + } + + @Override + public void delete(Article article) { + articleRepository.delete(article); + } +} diff --git a/spring-data-elasticsearch/src/main/resources/logback.xml b/spring-data-elasticsearch/src/main/resources/logback.xml new file mode 100644 index 0000000000..37a9e2edbf --- /dev/null +++ b/spring-data-elasticsearch/src/main/resources/logback.xml @@ -0,0 +1,20 @@ + + + + + elasticsearch - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java new file mode 100644 index 0000000000..07248149c2 --- /dev/null +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java @@ -0,0 +1,130 @@ +package com.baeldung; + +import com.baeldung.config.Config; +import com.baeldung.model.Article; +import com.baeldung.model.Author; +import com.baeldung.service.ArticleService; +import org.elasticsearch.index.query.QueryBuilder; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; +import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; +import org.springframework.data.elasticsearch.core.query.SearchQuery; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import java.util.List; + +import static java.util.Arrays.asList; +import static org.elasticsearch.index.query.FilterBuilders.regexpFilter; +import static org.elasticsearch.index.query.QueryBuilders.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {Config.class}, loader = AnnotationConfigContextLoader.class) +public class ElasticSearchTest { + + @Autowired + private ElasticsearchTemplate elasticsearchTemplate; + @Autowired + private ArticleService articleService; + + private final Author johnSmith = new Author("John Smith"); + private final Author johnDoe = new Author("John Doe"); + + @Before + public void before() { + elasticsearchTemplate.deleteIndex(Article.class); + elasticsearchTemplate.createIndex(Article.class); + + Article article = new Article("Spring Data Elasticsearch"); + article.setAuthors(asList(johnSmith, johnDoe)); + articleService.save(article); + + article = new Article("Search engines"); + article.setAuthors(asList(johnDoe)); + articleService.save(article); + + article = new Article("Second Article About Elasticsearch"); + article.setAuthors(asList(johnSmith)); + articleService.save(article); + } + + @Test + public void givenArticleService_whenSaveArticle_thenIdIsAssigned() { + List authors = asList( + new Author("John Smith"), johnDoe); + + Article article = new Article("Making Search Elastic"); + article.setAuthors(authors); + + article = articleService.save(article); + assertNotNull(article.getId()); + } + + @Test + public void givenPersistedArticles_whenSearchByAuthorsName_thenRightFound() { + + Page
articleByAuthorName = articleService.findByAuthorName(johnSmith.getName(), new PageRequest(0, 10)); + assertEquals(2L, articleByAuthorName.getTotalElements()); + } + + @Test + public void givenCustomQuery_whenSearchByAuthorsName_thenArticleIsFound() { + + Page
articleByAuthorName = articleService.findByAuthorNameUsingCustomQuery("John Smith", new PageRequest(0, 10)); + assertEquals(3L, articleByAuthorName.getTotalElements()); + } + + + @Test + public void givenPersistedArticles_whenUseRegexQuery_thenRightArticlesFound() { + + SearchQuery searchQuery = new NativeSearchQueryBuilder() + .withFilter(regexpFilter("title", ".*data.*")) + .build(); + List
articles = elasticsearchTemplate.queryForList(searchQuery, Article.class); + + assertEquals(1, articles.size()); + } + + @Test + public void givenSavedDoc_whenTitleUpdated_thenCouldFindByUpdatedTitle() { + SearchQuery searchQuery = new NativeSearchQueryBuilder() + .withQuery(fuzzyQuery("title", "serch")) + .build(); + List
articles = elasticsearchTemplate.queryForList(searchQuery, Article.class); + + assertEquals(1, articles.size()); + + Article article = articles.get(0); + final String newTitle = "Getting started with Search Engines"; + article.setTitle(newTitle); + articleService.save(article); + + assertEquals(newTitle, articleService.findOne(article.getId()).getTitle()); + } + + @Test + public void givenSavedDoc_whenDelete_thenRemovedFromIndex() { + + final String articleTitle = "Spring Data Elasticsearch"; + + SearchQuery searchQuery = new NativeSearchQueryBuilder() + .withQuery(matchQuery("title", articleTitle).minimumShouldMatch("75%")) + .build(); + List
articles = elasticsearchTemplate.queryForList(searchQuery, Article.class); + assertEquals(1, articles.size()); + final long count = articleService.count(); + + articleService.delete(articles.get(0)); + + assertEquals(count - 1, articleService.count()); + } +} From 68f33a231298f75ed4d73d86a879491b4a05e4a1 Mon Sep 17 00:00:00 2001 From: Dmitry Zinkevich Date: Thu, 4 Feb 2016 15:10:06 +0300 Subject: [PATCH 0015/1106] Change index name to 'blog' and rename package to 'repository' --- .../src/main/java/com/baeldung/config/Config.java | 2 +- .../src/main/java/com/baeldung/model/Article.java | 2 +- .../baeldung/repository/ArticleRepository.java | 15 +++++++++++++++ .../com/baeldung/service/ArticleServiceImpl.java | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java b/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java index eb65e38f65..a67ec64534 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java @@ -17,7 +17,7 @@ import java.nio.file.Path; import java.nio.file.Paths; @Configuration -@EnableElasticsearchRepositories(basePackages = "com.baeldung.dao") +@EnableElasticsearchRepositories(basePackages = "com.baeldung.repository") @ComponentScan(basePackages = {"com.baeldung.service"}) public class Config { diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java index 17580ca0db..dee1d0817e 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java @@ -8,7 +8,7 @@ import org.springframework.data.elasticsearch.annotations.FieldType; import java.util.List; -@Document(indexName = "article", type = "article") +@Document(indexName = "blog", type = "article") public class Article { @Id diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java b/spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java new file mode 100644 index 0000000000..1cb74889c5 --- /dev/null +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java @@ -0,0 +1,15 @@ +package com.baeldung.repository; + +import com.baeldung.model.Article; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.elasticsearch.annotations.Query; +import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; + +public interface ArticleRepository extends ElasticsearchRepository { + + Page
findByAuthorsName(String name, Pageable pageable); + + @Query("{\"bool\": {\"must\": [{\"match\": {\"authors.name\": \"?0\"}}]}}") + Page
findByAuthorsNameUsingCustomQuery(String name, Pageable pageable); +} diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java index 4dc100ec22..59feb2816c 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java @@ -1,6 +1,6 @@ package com.baeldung.service; -import com.baeldung.dao.ArticleRepository; +import com.baeldung.repository.ArticleRepository; import com.baeldung.model.Article; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; From 596486aea00f488010c79ff1931c418c1b5ffa12 Mon Sep 17 00:00:00 2001 From: Thai Nguyen Date: Fri, 5 Feb 2016 14:11:39 +0700 Subject: [PATCH 0016/1106] initial commit for json-path --- json-path/.classpath | 32 +++++++ json-path/.gitignore | 13 +++ json-path/.project | 23 +++++ json-path/pom.xml | 61 +++++++++++++ json-path/src/main/resources/intro_api.json | 57 +++++++++++++ json-path/src/main/resources/intro_user.json | 46 ++++++++++ .../introduction/ChangingPasswordTest.java | 85 +++++++++++++++++++ .../jsonpath/introduction/LoggingInTest.java | 50 +++++++++++ .../jsonpath/introduction/OperationTest.java | 71 ++++++++++++++++ .../introduction/RegisteringAccountTest.java | 46 ++++++++++ 10 files changed, 484 insertions(+) create mode 100644 json-path/.classpath create mode 100644 json-path/.gitignore create mode 100644 json-path/.project create mode 100644 json-path/pom.xml create mode 100644 json-path/src/main/resources/intro_api.json create mode 100644 json-path/src/main/resources/intro_user.json create mode 100644 json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java create mode 100644 json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java create mode 100644 json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java create mode 100644 json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java diff --git a/json-path/.classpath b/json-path/.classpath new file mode 100644 index 0000000000..2244ed1e21 --- /dev/null +++ b/json-path/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/json-path/.gitignore b/json-path/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/json-path/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/json-path/.project b/json-path/.project new file mode 100644 index 0000000000..caa2c41711 --- /dev/null +++ b/json-path/.project @@ -0,0 +1,23 @@ + + + json-path + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/json-path/pom.xml b/json-path/pom.xml new file mode 100644 index 0000000000..b51f59c411 --- /dev/null +++ b/json-path/pom.xml @@ -0,0 +1,61 @@ + + 4.0.0 + org.baeldung + json-path + 0.0.1-SNAPSHOT + json-path + + + + + com.jayway.jsonpath + json-path + ${json-path.version} + + + + + joda-time + joda-time + ${joda-time.version} + + + + + junit + junit + ${junit.version} + test + + + + + org.slf4j + slf4j-api + ${slf4j.version} + runtime + + + ch.qos.logback + logback-classic + ${logback.version} + runtime + + + + + + 2.1.0 + + + 2.9.2 + + + 4.12 + + + 1.7.14 + 1.1.3 + + \ No newline at end of file diff --git a/json-path/src/main/resources/intro_api.json b/json-path/src/main/resources/intro_api.json new file mode 100644 index 0000000000..8a252f2971 --- /dev/null +++ b/json-path/src/main/resources/intro_api.json @@ -0,0 +1,57 @@ +{ + "tool": + { + "jsonpath": + { + "creator": + { + "name": "Jayway Inc.", + "location": + [ + "Malmo", + "Stockholm", + "Copenhagen", + "San Francisco", + "Karlskrona", + "Halmstad", + "Helsingborg" + ] + }, + + "current release": "2.1" + } + }, + + "book": + [ + { + "title": "Beginning JSON", + "author": "Ben Smith", + "price": 49.99 + }, + + { + "title": "JSON at Work", + "author": "Tom Marrs", + "price": 29.99 + }, + + { + "title": "Learn JSON in a DAY", + "author": "Acodemy", + "price": 8.99 + }, + + { + "title": "JSON: Questions and Answers", + "author": "George Duckett", + "price": 6.00 + } + ], + + "price range": + { + "cheap": 10.00, + "medium": 20.00 + } +} \ No newline at end of file diff --git a/json-path/src/main/resources/intro_user.json b/json-path/src/main/resources/intro_user.json new file mode 100644 index 0000000000..c35914c6c4 --- /dev/null +++ b/json-path/src/main/resources/intro_user.json @@ -0,0 +1,46 @@ +[ + { + "username": "oracle", + "password": + { + "current": + { + "value": "Java_SE_8", + "created": 1397754000000 + }, + + "old": + [ + { + "value": "Java_SE_7", + "created": 1312650000000 + } + ] + } + }, + + { + "username": "sun", + "password": + { + "current": + { + "value": "Java_SE_6", + "created": 1168448400000 + }, + + "old": + [ + { + "value": "J2SE_5.0", + "created": 1099069200000 + }, + + { + "value": "J2SE_1.4", + "created": 1025542800000 + } + ] + } + } +] \ No newline at end of file diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java b/json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java new file mode 100644 index 0000000000..24f8500d3d --- /dev/null +++ b/json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java @@ -0,0 +1,85 @@ +package org.baeldung.jsonpath.introduction; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.Scanner; + +import org.joda.time.DateTime; +import org.joda.time.Years; + +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; + +public class ChangingPasswordTest { + + enum Result { + SUCCESS, FAILURE + } + + InputStream jsonValueInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_user.json"); + String jsonDataSourceString = new Scanner(jsonValueInputStream, "UTF-8").useDelimiter("\\Z").next(); + + @Test + public void givenUseCase_whenChangingPasswordOfNonExistentUser_thenFail() { + String failedRequestBody = "{\"username\":\"jayway\", \"new_password\":\"JsonPath\"}"; + Result result = changingPasswordHelper(failedRequestBody); + + assertEquals(Result.FAILURE, result); + } + + @Test + public void givenUseCase_whenChangingToUnusedPassword_thenSucceed() { + String successfulRequestBody = "{\"username\":\"oracle\", \"new_password\":\"Java_SE_9\"}"; + Result result = changingPasswordHelper(successfulRequestBody); + + assertEquals(Result.SUCCESS, result); + } + + @Test + public void givenUseCase_whenChangingToRecentlyUsedPassword_thenFail() { + String failedRequestBody = "{\"username\":\"oracle\", \"new_password\":\"Java_SE_7\"}"; + Result result = changingPasswordHelper(failedRequestBody); + + assertEquals(Result.FAILURE, result); + } + + @Test + public void givenUseCase_whenChangingToLongTimeAgoPassword_thenSucceed() { + String successfulRequestBody = "{\"username\":\"sun\", \"new_password\":\"J2SE_5.0\"}"; + Result result = changingPasswordHelper(successfulRequestBody); + + assertEquals(Result.SUCCESS, result); + } + + private Result changingPasswordHelper(String requestBody) { + DocumentContext requestContext = JsonPath.parse(requestBody); + String extractedUsername = requestContext.read("$['username']"); + String extractedPassword = requestContext.read("$['new_password']"); + + DocumentContext jsonContext = JsonPath.parse(jsonDataSourceString); + List dataSourceUsername = jsonContext.read("$[?(@.username == '" + extractedUsername + "')]"); + if (dataSourceUsername.size() == 0) + return Result.FAILURE; + + Configuration pathConfiguration = Configuration.builder().options(Option.AS_PATH_LIST).build(); + List pathToCurrentUser = JsonPath.using(pathConfiguration).parse(jsonDataSourceString).read("$[?(@.username == '" + extractedUsername + "')]"); + List passwordCreatedTimeList = jsonContext.read(pathToCurrentUser.get(0) + "['password']['old'][?(@.value == '" + extractedPassword + "')]['created']"); + if (passwordCreatedTimeList.size() == 0) + return Result.SUCCESS; + + Long[] passwordCreatedTimeArray = (passwordCreatedTimeList.toArray(new Long[passwordCreatedTimeList.size()])); + Arrays.sort(passwordCreatedTimeArray); + DateTime oldDate = new DateTime(passwordCreatedTimeArray[passwordCreatedTimeArray.length - 1]); + if (Years.yearsBetween(oldDate, new DateTime()).getYears() <= 10) + return Result.FAILURE; + + return Result.SUCCESS; + } +} diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java b/json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java new file mode 100644 index 0000000000..1ab7dad88e --- /dev/null +++ b/json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java @@ -0,0 +1,50 @@ +package org.baeldung.jsonpath.introduction; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import java.io.InputStream; +import java.util.List; +import java.util.Scanner; + +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; + +public class LoggingInTest { + + enum Result { + SUCCESS, FAILURE + } + + InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_user.json"); + String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + + @Test + public void givenUseCase_whenLoggingInWithCorrectUserData_thenSucceed() { + String correctRequestBody = "{\"username\":\"sun\", \"password\":\"Java_SE_6\"}"; + Result result = loggingInHelper(correctRequestBody); + + assertEquals(Result.SUCCESS, result); + } + + @Test + public void givenUseCase_whenLoggingInWithIncorrectUserData_thenFail() { + String incorrectRequestBody = "{\"username\":\"oracle\", \"password\":\"Java_SE_9\"}"; + Result result = loggingInHelper(incorrectRequestBody); + + assertEquals(Result.FAILURE, result); + } + + private Result loggingInHelper(String requestBody) { + DocumentContext requestContext = JsonPath.parse(requestBody); + String extractedUsername = requestContext.read("$['username']"); + String extractedPassword = requestContext.read("$['password']"); + List list = JsonPath.parse(jsonDataSourceString).read("$[?(@.username == '" + extractedUsername + "' && @.password.current.value == '" + extractedPassword + "')]"); + + if (list.size() == 0) + return Result.FAILURE; + return Result.SUCCESS; + } + +} diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java b/json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java new file mode 100644 index 0000000000..9347a7f754 --- /dev/null +++ b/json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java @@ -0,0 +1,71 @@ +package org.baeldung.jsonpath.introduction; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.not; + +import org.junit.Test; + +import java.io.InputStream; +import java.util.List; +import java.util.Map; +import java.util.Scanner; + +import com.jayway.jsonpath.Criteria; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.Filter; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Predicate; + +public class OperationTest { + InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_api.json"); + String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + + @Test + public void givenJsonPathWithoutPredicates_whenReading_thenCorrect() { + String jsonpathCreatorNamePath = "$['tool']['jsonpath']['creator']['name']"; + String jsonpathCreatorLocationPath = "$['tool']['jsonpath']['creator']['location'][*]"; + + DocumentContext jsonContext = JsonPath.parse(jsonDataSourceString); + String jsonpathCreatorName = jsonContext.read(jsonpathCreatorNamePath); + List jsonpathCreatorLocation = jsonContext.read(jsonpathCreatorLocationPath); + + assertEquals("Jayway Inc.", jsonpathCreatorName); + assertThat(jsonpathCreatorLocation.toString(), containsString("Malmo")); + assertThat(jsonpathCreatorLocation.toString(), containsString("San Francisco")); + assertThat(jsonpathCreatorLocation.toString(), containsString("Helsingborg")); + } + + @Test + public void givenJsonPathWithFilterPredicate_whenReading_thenCorrect() { + Filter expensiveFilter = Filter.filter(Criteria.where("price").gt(20.00)); + List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?]", expensiveFilter); + predicateUsageAssertionHelper(expensive); + } + + @Test + public void givenJsonPathWithCustomizedPredicate_whenReading_thenCorrect() { + Predicate expensivePredicate = new Predicate() { + public boolean apply(PredicateContext context) { + String value = context.item(Map.class).get("price").toString(); + return Float.valueOf(value) > 20.00; + } + }; + List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?]", expensivePredicate); + predicateUsageAssertionHelper(expensive); + } + + @Test + public void givenJsonPathWithInlinePredicate_whenReading_thenCorrect() { + List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?(@['price'] > $['price range']['medium'])]"); + predicateUsageAssertionHelper(expensive); + } + + private void predicateUsageAssertionHelper(List predicate) { + assertThat(predicate.toString(), containsString("Beginning JSON")); + assertThat(predicate.toString(), containsString("JSON at Work")); + assertThat(predicate.toString(), not(containsString("Learn JSON in a DAY"))); + assertThat(predicate.toString(), not(containsString("JSON: Questions and Answers"))); + } +} diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java b/json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java new file mode 100644 index 0000000000..6e5cba63b0 --- /dev/null +++ b/json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java @@ -0,0 +1,46 @@ +package org.baeldung.jsonpath.introduction; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import java.io.InputStream; +import java.util.List; +import java.util.Scanner; + +import com.jayway.jsonpath.JsonPath; + +public class RegisteringAccountTest { + + enum Result { + SUCCESS, FAILURE + } + + InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_user.json"); + String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + + @Test + public void givenUseCase_whenRegisteringUnusedAccount_thenSucceed() { + String unusedRequestBody = "{\"username\":\"jayway\", \"password\":\"JsonPath\"}"; + Result result = registeringNewAccountHelper(unusedRequestBody); + + assertEquals(Result.SUCCESS, result); + } + + @Test + public void givenUseCase_whenRegisteringUsedAccount_thenFail() { + String usedRequestBody = "{\"username\":\"oracle\", \"password\":\"Java_SE_9\"}"; + Result result = registeringNewAccountHelper(usedRequestBody); + + assertEquals(Result.FAILURE, result); + } + + private Result registeringNewAccountHelper(String requestBody) { + List userDataSource = JsonPath.parse(jsonDataSourceString).read("$[*]['username']"); + String extractedUsername = JsonPath.parse(requestBody).read("$['username']"); + + if (userDataSource.toString().contains(extractedUsername)) + return Result.FAILURE; + return Result.SUCCESS; + } +} From 65635956703a6473aef19009070118e536c71076 Mon Sep 17 00:00:00 2001 From: Eugen Date: Fri, 5 Feb 2016 10:25:17 +0200 Subject: [PATCH 0017/1106] Create README.md --- spring-batch/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 spring-batch/README.md diff --git a/spring-batch/README.md b/spring-batch/README.md new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/spring-batch/README.md @@ -0,0 +1 @@ + From 6ab868cef39ac442eba1421b38826aaf9f4b541e Mon Sep 17 00:00:00 2001 From: eugenp Date: Sat, 6 Feb 2016 12:50:32 +0200 Subject: [PATCH 0018/1106] cleanup work --- ...pse.wst.jsdt.core.javascriptValidator.launch | 7 +++++++ spring-security-login-and-registration/.project | 17 ++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 spring-security-login-and-registration/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch diff --git a/spring-security-login-and-registration/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch b/spring-security-login-and-registration/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch new file mode 100644 index 0000000000..627021fb96 --- /dev/null +++ b/spring-security-login-and-registration/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch @@ -0,0 +1,7 @@ + + + + + + + diff --git a/spring-security-login-and-registration/.project b/spring-security-login-and-registration/.project index 2c3e86ed06..4a27f224a4 100644 --- a/spring-security-login-and-registration/.project +++ b/spring-security-login-and-registration/.project @@ -6,8 +6,13 @@ - org.eclipse.wst.jsdt.core.javascriptValidator + org.eclipse.ui.externaltools.ExternalToolBuilder + full,incremental, + + LaunchConfigHandle + <project>/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch + @@ -25,16 +30,6 @@ - - org.jboss.tools.jst.web.kb.kbbuilder - - - - - org.hibernate.eclipse.console.hibernateBuilder - - - org.eclipse.wst.validation.validationbuilder From 0d45b71098d3dc53b0abe2ae9af500fc1a58c410 Mon Sep 17 00:00:00 2001 From: Kevin Gilmore Date: Sat, 6 Feb 2016 11:32:12 -0600 Subject: [PATCH 0019/1106] API for RAML modularization article --- .../api-before-modularization.raml | 119 ++++++++++++++++++ raml/modularization/api-with-libraries.raml | 50 ++++++++ .../api-with-typed-fragments.raml | 74 +++++++++++ raml/modularization/api.raml | 47 +++++++ raml/modularization/examples/Bar.json | 6 + raml/modularization/examples/Bars.json | 19 +++ raml/modularization/examples/Error.json | 4 + raml/modularization/examples/Foo.json | 4 + raml/modularization/examples/Foos.json | 16 +++ .../extensions/en_US/additionalResources.raml | 16 +++ raml/modularization/libraries/dataTypes.raml | 19 +++ .../libraries/resourceTypes.raml | 32 +++++ .../libraries/securitySchemes.raml | 20 +++ raml/modularization/libraries/traits.raml | 33 +++++ .../overlays/es_ES/additionalResources.raml | 13 ++ .../overlays/es_ES/documentationItems.raml | 23 ++++ .../resourceTypes/collection.raml | 12 ++ raml/modularization/resourceTypes/item.raml | 14 +++ raml/modularization/traits/hasNotFound.raml | 8 ++ .../modularization/traits/hasRequestItem.raml | 5 + .../traits/hasResponseCollection.raml | 8 ++ .../traits/hasResponseItem.raml | 8 ++ raml/modularization/types/Bar.raml | 7 ++ raml/modularization/types/Error.raml | 5 + raml/modularization/types/Foo.raml | 6 + 25 files changed, 568 insertions(+) create mode 100644 raml/modularization/api-before-modularization.raml create mode 100644 raml/modularization/api-with-libraries.raml create mode 100644 raml/modularization/api-with-typed-fragments.raml create mode 100644 raml/modularization/api.raml create mode 100644 raml/modularization/examples/Bar.json create mode 100644 raml/modularization/examples/Bars.json create mode 100644 raml/modularization/examples/Error.json create mode 100644 raml/modularization/examples/Foo.json create mode 100644 raml/modularization/examples/Foos.json create mode 100644 raml/modularization/extensions/en_US/additionalResources.raml create mode 100644 raml/modularization/libraries/dataTypes.raml create mode 100644 raml/modularization/libraries/resourceTypes.raml create mode 100644 raml/modularization/libraries/securitySchemes.raml create mode 100644 raml/modularization/libraries/traits.raml create mode 100644 raml/modularization/overlays/es_ES/additionalResources.raml create mode 100644 raml/modularization/overlays/es_ES/documentationItems.raml create mode 100644 raml/modularization/resourceTypes/collection.raml create mode 100644 raml/modularization/resourceTypes/item.raml create mode 100644 raml/modularization/traits/hasNotFound.raml create mode 100644 raml/modularization/traits/hasRequestItem.raml create mode 100644 raml/modularization/traits/hasResponseCollection.raml create mode 100644 raml/modularization/traits/hasResponseItem.raml create mode 100644 raml/modularization/types/Bar.raml create mode 100644 raml/modularization/types/Error.raml create mode 100644 raml/modularization/types/Foo.raml diff --git a/raml/modularization/api-before-modularization.raml b/raml/modularization/api-before-modularization.raml new file mode 100644 index 0000000000..b580c33983 --- /dev/null +++ b/raml/modularization/api-before-modularization.raml @@ -0,0 +1,119 @@ +#%RAML 1.0 +title: API for REST Services used in the RAML tutorials on Baeldung.com +documentation: + - title: Overview + - content: | + This document defines the interface for the REST services + used in the popular RAML Tutorial series at Baeldung.com. + - title: Disclaimer: + - content: | + All names used in this definition are purely fictional. + Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental. + - title: Copyright + - content: Copyright 2016 by Baeldung.com. All rights reserved. +version: v1 +protocols: [ HTTPS ] +baseUri: http://rest-api.baeldung.com/api/{version} +mediaType: application/json +securedBy: basicAuth +securitySchemes: + - basicAuth: + description: Each request must contain the headers necessary for + basic authentication + type: Basic Authentication + describedBy: + headers: + Authorization: + description: | + Used to send the Base64 encoded "username:password" + credentials + type: string + responses: + 401: + description: | + Unauthorized. Either the provided username and password + combination is invalid, or the user is not allowed to + access the content provided by the requested URL. +types: + Foo: !include types/Foo.raml + Bar: !include types/Bar.raml + Error: !include types/Error.raml +resourceTypes: + - collection: + usage: Use this resourceType to represent a collection of items + description: A collection of <> + get: + description: | + Get all <>, + optionally filtered + is: [ hasResponseCollection ] + post: + description: | + Create a new <> + is: [ hasRequestItem ] + - item: + usage: Use this resourceType to represent any single item + description: A single <> + get: + description: Get a <> by <> + is: [ hasResponseItem, hasNotFound ] + put: + description: Update a <> by <> + is: [ hasRequestItem, hasResponseItem, hasNotFound ] + delete: + description: Delete a <> by <> + is: [ hasNotFound ] + responses: + 204: +traits: + - hasRequestItem: + body: + application/json: + type: <> + - hasResponseItem: + responses: + 200: + body: + application/json: + type: <> + example: !include examples/<>.json + - hasResponseCollection: + responses: + 200: + body: + application/json: + type: <>[] + example: !include examples/<>.json + - hasNotFound: + responses: + 404: + body: + application/json: + type: Error + example: !include examples/Error.json +/foos: + type: collection + typeName: Foo + get: + queryParameters: + name?: string + ownerName?: string + /{fooId}: + type: item + typeName: Foo + /name/{name}: + get: + description: List all foos with a certain name + typeName: Foo + is: [ hasResponseCollection ] +/bars: + type: collection + typeName: Bar + /{barId}: + type: item + typeName: Bar + /fooId/{fooId}: + get: + description: Get all bars for the matching fooId + typeName: Bar + is: [ hasResponseCollection ] \ No newline at end of file diff --git a/raml/modularization/api-with-libraries.raml b/raml/modularization/api-with-libraries.raml new file mode 100644 index 0000000000..b3081e843a --- /dev/null +++ b/raml/modularization/api-with-libraries.raml @@ -0,0 +1,50 @@ +#%RAML 1.0 +title: API for REST Services used in the RAML tutorials on Baeldung.com +documentation: + - title: Overview + - content: | + This document defines the interface for the REST services + used in the popular RAML Tutorial series at Baeldung.com. + - title: Disclaimer: + - content: | + All names used in this definition are purely fictional. + Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental. + - title: Copyright + - content: Copyright 2016 by Baeldung.com. All rights reserved. +uses: + mySecuritySchemes: !include libraries/security.raml + myDataTypes: !include libraries/dataTypes.raml + myResourceTypes: !include libraries/resourceTypes.raml + myTraits: !include libraries/traits.raml +version: v1 +protocols: [ HTTPS ] +baseUri: http://rest-api.baeldung.com/api/{version} +mediaType: application/json +securedBy: [ mySecuritySchemes.basicAuth ] +/foos: + type: myResourceTypes.collection + typeName: myDataTypes.Foo + get: + queryParameters: + name?: string + ownerName?: string + /{fooId}: + type: myResourceTypes.item + typeName: myDataTypes.Foo + /name/{name}: + get: + description: List all foos with a certain name + typeName: myDataTypes.Foo + is: [ myTraits.hasResponseCollection ] +/bars: + type: myResourceTypes.collection + typeName: myDataTypes.Bar + /{barId}: + type: myResourceTypes.item + typeName: myDataTypes.Bar + /fooId/{fooId}: + get: + description: Get all bars for the matching fooId + type: myResourceTypes.item + typeName: myDataTypes.Bar + is: [ myTraits.hasResponseCollection ] \ No newline at end of file diff --git a/raml/modularization/api-with-typed-fragments.raml b/raml/modularization/api-with-typed-fragments.raml new file mode 100644 index 0000000000..2bb4e317c1 --- /dev/null +++ b/raml/modularization/api-with-typed-fragments.raml @@ -0,0 +1,74 @@ +#%RAML 1.0 +title: API for REST Services used in the RAML tutorials on Baeldung.com +documentation: + - title: Overview + - content: | + This document defines the interface for the REST services + used in the popular RAML Tutorial series at Baeldung.com. + - title: Disclaimer: + - content: | + All names used in this definition are purely fictional. + Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental. + - title: Copyright + - content: Copyright 2016 by Baeldung.com. All rights reserved. +version: v1 +protocols: [ HTTPS ] +baseUri: http://rest-api.baeldung.com/api/{version} +mediaType: application/json +securedBy: [ basicAuth ] +securitySchemes: + - basicAuth: + description: Each request must contain the headers necessary for + basic authentication + type: Basic Authentication + describedBy: + headers: + Authorization: + description: | + Used to send the Base64 encoded "username:password" + credentials + type: string + responses: + 401: + description: | + Unauthorized. Either the provided username and password + combination is invalid, or the user is not allowed to + access the content provided by the requested URL. +types: + Foo: !include types/Foo.raml + Bar: !include types/Bar.raml + Error: !include types/Error.raml +resourceTypes: + - collection: !include resourceTypes/collection.raml + - item: !include resourceTypes/item.raml +traits: + - hasRequestItem: !include traits/hasRequestItem.raml + - hasResponseItem: !include traits/hasResponseItem.raml + - hasResponseCollection: !include traits/hasResponseCollection.raml + - hasNotFound: !include traits/hasNotFound.raml +/foos: + type: collection + typeName: Foo + get: + queryParameters: + name?: string + ownerName?: string + /{fooId}: + type: item + typeName: Foo + /name/{name}: + get: + description: List all foos with a certain name + typeName: Foo + is: [ hasResponseCollection ] +/bars: + type: collection + typeName: Bar + /{barId}: + type: item + typeName: Bar + /fooId/{fooId}: + get: + description: Get all bars for the matching fooId + typeName: Bar + is: [ hasResponseCollection ] \ No newline at end of file diff --git a/raml/modularization/api.raml b/raml/modularization/api.raml new file mode 100644 index 0000000000..184027cd26 --- /dev/null +++ b/raml/modularization/api.raml @@ -0,0 +1,47 @@ +#%RAML 1.0 +title: Baeldung Foo REST Services API +uses: + security: !include libraries/security.raml +version: v1 +protocols: [ HTTPS ] +baseUri: http://rest-api.baeldung.com/api/{version} +mediaType: application/json +securedBy: [ security.basicAuth ] +types: + Foo: !include types/Foo.raml + Bar: !include types/Bar.raml + Error: !include types/Error.raml +resourceTypes: + - collection: !include resourceTypes/collection.raml + - item: !include resourceTypes/item.raml +traits: + - hasRequestItem: !include traits/hasRequestItem.raml + - hasResponseItem: !include traits/hasResponseItem.raml + - hasResponseCollection: !include traits/hasResponseCollection.raml + - hasNotFound: !include traits/hasNotFound.raml +/foos: + type: collection + typeName: Foo + get: + queryParameters: + name?: string + ownerName?: string + /{fooId}: + type: item + typeName: Foo + /name/{name}: + get: + description: List all foos with a certain name + typeName: Foo + is: [ hasResponseCollection ] +/bars: + type: collection + typeName: Bar + /{barId}: + type: item + typeName: Bar + /fooId/{fooId}: + get: + description: Get all bars for the matching fooId + typeName: Bar + is: [ hasResponseCollection ] \ No newline at end of file diff --git a/raml/modularization/examples/Bar.json b/raml/modularization/examples/Bar.json new file mode 100644 index 0000000000..0ee1b34edb --- /dev/null +++ b/raml/modularization/examples/Bar.json @@ -0,0 +1,6 @@ +{ + "id" : 1, + "name" : "First Bar", + "city" : "Austin", + "fooId" : 2 +} \ No newline at end of file diff --git a/raml/modularization/examples/Bars.json b/raml/modularization/examples/Bars.json new file mode 100644 index 0000000000..89ea875432 --- /dev/null +++ b/raml/modularization/examples/Bars.json @@ -0,0 +1,19 @@ +[ + { + "id" : 1, + "name" : "First Bar", + "city" : "Austin", + "fooId" : 2 + }, + { + "id" : 2, + "name" : "Second Bar", + "city" : "Dallas", + "fooId" : 1 + }, + { + "id" : 3, + "name" : "Third Bar", + "fooId" : 2 + } +] \ No newline at end of file diff --git a/raml/modularization/examples/Error.json b/raml/modularization/examples/Error.json new file mode 100644 index 0000000000..dca56da7c2 --- /dev/null +++ b/raml/modularization/examples/Error.json @@ -0,0 +1,4 @@ +{ + "message" : "Not found", + "code" : 1001 +} \ No newline at end of file diff --git a/raml/modularization/examples/Foo.json b/raml/modularization/examples/Foo.json new file mode 100644 index 0000000000..1b1b8c891e --- /dev/null +++ b/raml/modularization/examples/Foo.json @@ -0,0 +1,4 @@ +{ + "id" : 1, + "name" : "First Foo" +} \ No newline at end of file diff --git a/raml/modularization/examples/Foos.json b/raml/modularization/examples/Foos.json new file mode 100644 index 0000000000..74f64689f0 --- /dev/null +++ b/raml/modularization/examples/Foos.json @@ -0,0 +1,16 @@ +[ + { + "id" : 1, + "name" : "First Foo", + "ownerName" : "Jack Robinson" + }, + { + "id" : 2, + "name" : "Second Foo" + }, + { + "id" : 3, + "name" : "Third Foo", + "ownerName" : "Chuck Norris" + } +] \ No newline at end of file diff --git a/raml/modularization/extensions/en_US/additionalResources.raml b/raml/modularization/extensions/en_US/additionalResources.raml new file mode 100644 index 0000000000..20c6851f23 --- /dev/null +++ b/raml/modularization/extensions/en_US/additionalResources.raml @@ -0,0 +1,16 @@ +#%RAML 1.0 Extension +# File located at: +# /extensions/en_US/additionalResources.raml +masterRef: /api.raml +usage: This extension defines additional resources for version 2 of the API. +version: v2 +/foos: + /bar/{barId}: + get: + description: | + Get the foo that is related to the bar having barId = {barId} + typeName: Foo + queryParameters: + barId?: integer + typeName: Foo + is: [ hasResponseItem ] diff --git a/raml/modularization/libraries/dataTypes.raml b/raml/modularization/libraries/dataTypes.raml new file mode 100644 index 0000000000..8a240e62dc --- /dev/null +++ b/raml/modularization/libraries/dataTypes.raml @@ -0,0 +1,19 @@ +#%RAML 1.0 Library +# This is the file /libraries/dataTypes.raml +usage: This library defines the data types for the API +types: + Foo: + properties: + id: integer + name: string + ownerName?: string + Bar: + properties: + id: integer + name: string + city?: string + fooId: integer + Error: + properties: + code: integer + message: string diff --git a/raml/modularization/libraries/resourceTypes.raml b/raml/modularization/libraries/resourceTypes.raml new file mode 100644 index 0000000000..681ff710d6 --- /dev/null +++ b/raml/modularization/libraries/resourceTypes.raml @@ -0,0 +1,32 @@ +#%RAML 1.0 Library +# This is the file /libraries/resourceTypes.raml +usage: This library defines the resource types for the API +uses: + myTraits: !include traits.raml +resourceTypes: + collection: + usage: Use this resourceType to represent a collection of items + description: A collection of <> + get: + description: | + Get all <>, + optionally filtered + is: [ myTraits.hasResponseCollection ] + post: + description: | + Create a new <> + is: [ myTraits.hasRequestItem ] + item: + usage: Use this resourceType to represent any single item + description: A single <> + get: + description: Get a <> by <> + is: [ myTraits.hasResponseItem, myTraits.hasNotFound ] + put: + description: Update a <> by <> + is: [ myTraits.hasRequestItem, myTraits.hasResponseItem, myTraits.hasNotFound ] + delete: + description: Delete a <> by <> + is: [ myTraits.hasNotFound ] + responses: + 204: diff --git a/raml/modularization/libraries/securitySchemes.raml b/raml/modularization/libraries/securitySchemes.raml new file mode 100644 index 0000000000..621c6ac975 --- /dev/null +++ b/raml/modularization/libraries/securitySchemes.raml @@ -0,0 +1,20 @@ +#%RAML 1.0 Library +# This is the file /libraries/securitySchemes.raml +securitySchemes: + - basicAuth: + description: Each request must contain the headers necessary for + basic authentication + type: Basic Authentication + describedBy: + headers: + Authorization: + description: | + Used to send the Base64 encoded "username:password" + credentials + type: string + responses: + 401: + description: | + Unauthorized. Either the provided username and password + combination is invalid, or the user is not allowed to + access the content provided by the requested URL. diff --git a/raml/modularization/libraries/traits.raml b/raml/modularization/libraries/traits.raml new file mode 100644 index 0000000000..c101d94c02 --- /dev/null +++ b/raml/modularization/libraries/traits.raml @@ -0,0 +1,33 @@ +#%RAML 1.0 Library +# This is the file /libraries/traits.raml +usage: This library defines some basic traits +traits: + hasRequestItem: + usage: Use this trait for resources whose request body is a single item + body: + application/json: + type: <> + hasResponseItem: + usage: Use this trait for resources whose response body is a single item + responses: + 200: + body: + application/json: + type: <> + example: !include /examples/<>.json + hasResponseCollection: + usage: Use this trait for resources whose response body is a collection of items + responses: + 200: + body: + application/json: + type: <>[] + example: !include /examples/<>.json + hasNotFound: + usage: Use this trait for resources that could respond with a 404 status + responses: + 404: + body: + application/json: + type: Error + example: !include /examples/Error.json diff --git a/raml/modularization/overlays/es_ES/additionalResources.raml b/raml/modularization/overlays/es_ES/additionalResources.raml new file mode 100644 index 0000000000..e8748fd726 --- /dev/null +++ b/raml/modularization/overlays/es_ES/additionalResources.raml @@ -0,0 +1,13 @@ +#%RAML 1.0 Overlay +# Archivo situado en: +# /overlays/es_ES/additionalResources.raml +masterRef: /api.raml +usage: | + Se trata de un español demasiado que describe los recursos adicionales + para la versión 2 del API. +version: v2 +/foos: + /bar/{barId}: + get: + description: | + Obtener el foo que se relaciona con el bar tomando barId = {barId} diff --git a/raml/modularization/overlays/es_ES/documentationItems.raml b/raml/modularization/overlays/es_ES/documentationItems.raml new file mode 100644 index 0000000000..dc6ca3eaef --- /dev/null +++ b/raml/modularization/overlays/es_ES/documentationItems.raml @@ -0,0 +1,23 @@ +#%RAML 1.0 Overlay +# File located at (archivo situado en): +# /overlays/es_ES/documentationItems.raml +masterRef: /api.raml +usage: | + To provide user documentation and other descriptive text in Spanish + (Para proporcionar la documentación del usuario y otro texto descriptivo en español) +title: API para servicios REST utilizados en los tutoriales RAML en Baeldung.com +documentation: + - title: Descripción general + - content: | + Este documento define la interfaz para los servicios REST + utilizados en la popular serie de RAML Tutorial en Baeldung.com + - title: Renuncia + - content: | + Todos los nombres usados ​​en esta definición son pura ficción. + Cualquier similitud entre los nombres utilizados en este tutorial + y los de las personas reales, ya sea vivo o muerto, + no son más que coincidenta. + + - title: Derechos de autor + - content: | + Derechos de autor 2016 por Baeldung.com. Todos los derechos reservados. diff --git a/raml/modularization/resourceTypes/collection.raml b/raml/modularization/resourceTypes/collection.raml new file mode 100644 index 0000000000..0cab417f14 --- /dev/null +++ b/raml/modularization/resourceTypes/collection.raml @@ -0,0 +1,12 @@ +#%RAML 1.0 ResourceType +usage: Use this resourceType to represent a collection of items +description: A collection of <> +get: + description: | + Get all <>, + optionally filtered + is: [ hasResponseCollection ] +post: + description: | + Create a new <> + is: [ hasRequestItem ] diff --git a/raml/modularization/resourceTypes/item.raml b/raml/modularization/resourceTypes/item.raml new file mode 100644 index 0000000000..59f057ca98 --- /dev/null +++ b/raml/modularization/resourceTypes/item.raml @@ -0,0 +1,14 @@ +#%RAML 1.0 ResourceType +usage: Use this resourceType to represent any single item +description: A single <> +get: + description: Get a <> by <> + is: [ hasResponseItem, hasNotFound ] +put: + description: Update a <> by <> + is: [ hasRequestItem, hasResponseItem, hasNotFound ] +delete: + description: Delete a <> by <> + is: [ hasNotFound ] + responses: + 204: diff --git a/raml/modularization/traits/hasNotFound.raml b/raml/modularization/traits/hasNotFound.raml new file mode 100644 index 0000000000..8d2d940c03 --- /dev/null +++ b/raml/modularization/traits/hasNotFound.raml @@ -0,0 +1,8 @@ +#%RAML 1.0 Trait +usage: Use this trait for resources that could respond with a 404 status +responses: + 404: + body: + application/json: + type: Error + example: !include /examples/Error.json diff --git a/raml/modularization/traits/hasRequestItem.raml b/raml/modularization/traits/hasRequestItem.raml new file mode 100644 index 0000000000..06281781c0 --- /dev/null +++ b/raml/modularization/traits/hasRequestItem.raml @@ -0,0 +1,5 @@ +#%RAML 1.0 Trait +usage: Use this trait for resources whose request body is a single item +body: + application/json: + type: <> diff --git a/raml/modularization/traits/hasResponseCollection.raml b/raml/modularization/traits/hasResponseCollection.raml new file mode 100644 index 0000000000..47dc1c2d5f --- /dev/null +++ b/raml/modularization/traits/hasResponseCollection.raml @@ -0,0 +1,8 @@ +#%RAML 1.0 Trait +usage: Use this trait for resources whose response body is a collection of items +responses: + 200: + body: + application/json: + type: <>[] + example: !include /examples/<>.json diff --git a/raml/modularization/traits/hasResponseItem.raml b/raml/modularization/traits/hasResponseItem.raml new file mode 100644 index 0000000000..94d3ba0756 --- /dev/null +++ b/raml/modularization/traits/hasResponseItem.raml @@ -0,0 +1,8 @@ +#%RAML 1.0 Trait +usage: Use this trait for resources whose response body is a single item +responses: + 200: + body: + application/json: + type: <> + example: !include /examples/<>.json diff --git a/raml/modularization/types/Bar.raml b/raml/modularization/types/Bar.raml new file mode 100644 index 0000000000..92255a75fe --- /dev/null +++ b/raml/modularization/types/Bar.raml @@ -0,0 +1,7 @@ +#%RAML 1.0 DataType + +properties: + id: integer + name: string + city?: string + fooId: integer diff --git a/raml/modularization/types/Error.raml b/raml/modularization/types/Error.raml new file mode 100644 index 0000000000..8d54b5f181 --- /dev/null +++ b/raml/modularization/types/Error.raml @@ -0,0 +1,5 @@ +#%RAML 1.0 DataType + + properties: + code: integer + message: string diff --git a/raml/modularization/types/Foo.raml b/raml/modularization/types/Foo.raml new file mode 100644 index 0000000000..1702865e05 --- /dev/null +++ b/raml/modularization/types/Foo.raml @@ -0,0 +1,6 @@ +#%RAML 1.0 DataType + +properties: + id: integer + name: string + ownerName?: string From 8506171908e954c3453a3050fce22963d09e127a Mon Sep 17 00:00:00 2001 From: eugenp Date: Sat, 6 Feb 2016 21:09:04 +0200 Subject: [PATCH 0020/1106] removing unused file --- .../src/main/resources/webSecurityConfig.xml | 36 ------------------- 1 file changed, 36 deletions(-) delete mode 100644 spring-jpa/src/main/resources/webSecurityConfig.xml diff --git a/spring-jpa/src/main/resources/webSecurityConfig.xml b/spring-jpa/src/main/resources/webSecurityConfig.xml deleted file mode 100644 index 88af78dabc..0000000000 --- a/spring-jpa/src/main/resources/webSecurityConfig.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 2be93cd3216df16ced5143fb69e3056e628b80e0 Mon Sep 17 00:00:00 2001 From: eugenp Date: Sat, 6 Feb 2016 21:25:59 +0200 Subject: [PATCH 0021/1106] minimal cleanup in Eclipse --- .../org.hibernate.eclipse.console.hibernateBuilder.launch | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 spring-security-rest-full/.externalToolBuilders/org.hibernate.eclipse.console.hibernateBuilder.launch diff --git a/spring-security-rest-full/.externalToolBuilders/org.hibernate.eclipse.console.hibernateBuilder.launch b/spring-security-rest-full/.externalToolBuilders/org.hibernate.eclipse.console.hibernateBuilder.launch deleted file mode 100644 index 9bc0284d26..0000000000 --- a/spring-security-rest-full/.externalToolBuilders/org.hibernate.eclipse.console.hibernateBuilder.launch +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 8b7e761c00f4a1db8710e8f38a4fdf061fa489bb Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Sat, 6 Feb 2016 23:48:50 +0200 Subject: [PATCH 0022/1106] Update README.md --- spring-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-jpa/README.md b/spring-jpa/README.md index 11df42ac52..387e3c00eb 100644 --- a/spring-jpa/README.md +++ b/spring-jpa/README.md @@ -7,3 +7,4 @@ - [Spring 3 and JPA with Hibernate](http://www.baeldung.com/2011/12/13/the-persistence-layer-with-spring-3-1-and-jpa/) - [Transactions with Spring 3 and JPA](http://www.baeldung.com/2011/12/26/transaction-configuration-with-jpa-and-spring-3-1/) - [The DAO with JPA and Spring](http://www.baeldung.com/spring-dao-jpa) +- [JPA Pagination](http://www.baeldung.com/jpa-pagination) From f09bce94f9e670e48ad8b00030bb967ea2e5326b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Sat, 6 Feb 2016 23:51:06 +0200 Subject: [PATCH 0023/1106] Update README.md --- spring-hibernate4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-hibernate4/README.md b/spring-hibernate4/README.md index 0d1ac1600e..96f8074165 100644 --- a/spring-hibernate4/README.md +++ b/spring-hibernate4/README.md @@ -5,6 +5,7 @@ ### Relevant Articles: - [Hibernate 4 with Spring](http://www.baeldung.com/hibernate-4-spring) - [The DAO with Spring 3 and Hibernate](http://www.baeldung.com/2011/12/02/the-persistence-layer-with-spring-3-1-and-hibernate/) +- [Hibernate Pagination](http://www.baeldung.com/hibernate-pagination) ### Quick Start From ab4b2d8a1a51f0c24e455f17f671c503fd4c1928 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Sat, 6 Feb 2016 23:52:34 +0200 Subject: [PATCH 0024/1106] Update README.md --- spring-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-jpa/README.md b/spring-jpa/README.md index 387e3c00eb..da55ca7b75 100644 --- a/spring-jpa/README.md +++ b/spring-jpa/README.md @@ -8,3 +8,4 @@ - [Transactions with Spring 3 and JPA](http://www.baeldung.com/2011/12/26/transaction-configuration-with-jpa-and-spring-3-1/) - [The DAO with JPA and Spring](http://www.baeldung.com/spring-dao-jpa) - [JPA Pagination](http://www.baeldung.com/jpa-pagination) +- [Sorting with JPA](http://www.baeldung.com/jpa-sort) From 1ba1bf2bc5056effb8d718f41885ff30075fd4e0 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sun, 7 Feb 2016 12:49:30 +0200 Subject: [PATCH 0025/1106] jackson skip conditionally --- .../jackson/dynamicIgnore/Address.java | 41 +++++++ .../jackson/dynamicIgnore/Hidable.java | 9 ++ .../dynamicIgnore/HidableSerializer.java | 29 +++++ .../jackson/dynamicIgnore/Person.java | 41 +++++++ .../test/JacksonDynamicIgnoreTest.java | 100 ++++++++++++++++++ 5 files changed, 220 insertions(+) create mode 100644 jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Address.java create mode 100644 jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Hidable.java create mode 100644 jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/HidableSerializer.java create mode 100644 jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Person.java create mode 100644 jackson/src/test/java/org/baeldung/jackson/test/JacksonDynamicIgnoreTest.java diff --git a/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Address.java b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Address.java new file mode 100644 index 0000000000..41ea8e7be3 --- /dev/null +++ b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Address.java @@ -0,0 +1,41 @@ +package org.baeldung.jackson.dynamicIgnore; + + +public class Address implements Hidable { + private String city; + private String country; + private boolean hidden; + + public Address(final String city, final String country, final boolean hidden) { + super(); + this.city = city; + this.country = country; + this.hidden = hidden; + } + + public String getCity() { + return city; + } + + public void setCity(final String city) { + this.city = city; + } + + public String getCountry() { + return country; + } + + public void setCountry(final String country) { + this.country = country; + } + + @Override + public boolean isHidden() { + return hidden; + } + + public void setHidden(final boolean hidden) { + this.hidden = hidden; + } + +} diff --git a/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Hidable.java b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Hidable.java new file mode 100644 index 0000000000..9eaa0c9619 --- /dev/null +++ b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Hidable.java @@ -0,0 +1,9 @@ +package org.baeldung.jackson.dynamicIgnore; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + + +@JsonIgnoreProperties("hidden") +public interface Hidable { + boolean isHidden(); +} diff --git a/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/HidableSerializer.java b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/HidableSerializer.java new file mode 100644 index 0000000000..35bd8fd7f6 --- /dev/null +++ b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/HidableSerializer.java @@ -0,0 +1,29 @@ +package org.baeldung.jackson.dynamicIgnore; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +public class HidableSerializer extends JsonSerializer { + + private JsonSerializer defaultSerializer; + + public HidableSerializer(final JsonSerializer serializer) { + defaultSerializer = serializer; + } + + @Override + public void serialize(final Hidable value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { + if (value.isHidden()) + return; + defaultSerializer.serialize(value, jgen, provider); + } + + @Override + public boolean isEmpty(final SerializerProvider provider, final Hidable value) { + return (value == null || value.isHidden()); + } +} diff --git a/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Person.java b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Person.java new file mode 100644 index 0000000000..5fe294a5e1 --- /dev/null +++ b/jackson/src/test/java/org/baeldung/jackson/dynamicIgnore/Person.java @@ -0,0 +1,41 @@ +package org.baeldung.jackson.dynamicIgnore; + + +public class Person implements Hidable { + private String name; + private Address address; + private boolean hidden; + + public Person(final String name, final Address address, final boolean hidden) { + super(); + this.name = name; + this.address = address; + this.hidden = hidden; + } + + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public Address getAddress() { + return address; + } + + public void setAddress(final Address address) { + this.address = address; + } + @Override + public boolean isHidden() { + return hidden; + } + + public void setHidden(final boolean hidden) { + this.hidden = hidden; + } + +} diff --git a/jackson/src/test/java/org/baeldung/jackson/test/JacksonDynamicIgnoreTest.java b/jackson/src/test/java/org/baeldung/jackson/test/JacksonDynamicIgnoreTest.java new file mode 100644 index 0000000000..d98f948dec --- /dev/null +++ b/jackson/src/test/java/org/baeldung/jackson/test/JacksonDynamicIgnoreTest.java @@ -0,0 +1,100 @@ +package org.baeldung.jackson.test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; + +import org.baeldung.jackson.dynamicIgnore.Address; +import org.baeldung.jackson.dynamicIgnore.Hidable; +import org.baeldung.jackson.dynamicIgnore.HidableSerializer; +import org.baeldung.jackson.dynamicIgnore.Person; +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.BeanDescription; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationConfig; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.ser.BeanSerializerModifier; + +public class JacksonDynamicIgnoreTest { + + private ObjectMapper mapper = new ObjectMapper(); + + @Before + public void setUp() { + mapper.setSerializationInclusion(Include.NON_EMPTY); + mapper.registerModule(new SimpleModule() { + @Override + public void setupModule(final SetupContext context) { + super.setupModule(context); + context.addBeanSerializerModifier(new BeanSerializerModifier() { + @Override + public JsonSerializer modifySerializer(final SerializationConfig config, final BeanDescription beanDesc, final JsonSerializer serializer) { + if (Hidable.class.isAssignableFrom(beanDesc.getBeanClass())) { + return new HidableSerializer((JsonSerializer) serializer); + } + return serializer; + } + }); + } + }); + } + + @Test + public void whenNotHidden_thenCorrect() throws JsonProcessingException { + final Address ad = new Address("ny", "usa", false); + final Person person = new Person("john", ad, false); + final String result = mapper.writeValueAsString(person); + + assertTrue(result.contains("name")); + assertTrue(result.contains("john")); + assertTrue(result.contains("address")); + assertTrue(result.contains("usa")); + + System.out.println("Not Hidden = " + result); + } + + @Test + public void whenAddressHidden_thenCorrect() throws JsonProcessingException { + final Address ad = new Address("ny", "usa", true); + final Person person = new Person("john", ad, false); + final String result = mapper.writeValueAsString(person); + + assertTrue(result.contains("name")); + assertTrue(result.contains("john")); + assertFalse(result.contains("address")); + assertFalse(result.contains("usa")); + + System.out.println("Address Hidden = " + result); + } + + @Test + public void whenAllHidden_thenCorrect() throws JsonProcessingException { + final Address ad = new Address("ny", "usa", false); + final Person person = new Person("john", ad, true); + final String result = mapper.writeValueAsString(person); + + assertTrue(result.length() == 0); + + System.out.println("All Hidden = " + result); + } + + @Test + public void whenSerializeList_thenCorrect() throws JsonProcessingException { + final Address ad1 = new Address("tokyo", "jp", true); + final Address ad2 = new Address("london", "uk", false); + final Address ad3 = new Address("ny", "usa", false); + final Person p1 = new Person("john", ad1, false); + final Person p2 = new Person("tom", ad2, true); + final Person p3 = new Person("adam", ad3, false); + + final String result = mapper.writeValueAsString(Arrays.asList(p1, p2, p3)); + + System.out.println(result); + } +} From 333e8793bd20d4faabce6733e635844d050f5a2a Mon Sep 17 00:00:00 2001 From: eugenp Date: Sun, 7 Feb 2016 18:15:42 +0200 Subject: [PATCH 0026/1106] minor upgrade --- jackson/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jackson/pom.xml b/jackson/pom.xml index 9996330361..ed7a5944a5 100644 --- a/jackson/pom.xml +++ b/jackson/pom.xml @@ -140,7 +140,7 @@ 5.1.35 - 2.5.5 + 2.7.1-1 1.7.13 From 80b3e457f2eb16c2082381cf198c0be7c3b096a3 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0027/1106] Minor Bugfix --- .../baeldung/client/ServicesInterface.java | 4 +- .../main/java/com/baeldung/model/Movie.java | 22 +-- .../com/baeldung/server/MovieCrudService.java | 12 +- .../src/main/webapp/WEB-INF/web.xml | 37 +---- .../java/baeldung/client/RestEasyClient.java | 7 + .../baeldung/server/RestEasyClientTest.java | 149 +++++++----------- 6 files changed, 81 insertions(+), 150 deletions(-) create mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 7efed546d8..749cabc757 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -14,7 +14,7 @@ public interface ServicesInterface { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + Movie movieByImdbId(@QueryParam("imdbId") String imdbId); @GET @@ -37,7 +37,7 @@ public interface ServicesInterface { @DELETE @Path("/deletemovie") - Response deleteMovie(@QueryParam("imdbID") String imdbID); + Response deleteMovie(@QueryParam("imdbId") String imdbID); diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index ab3bc1aa83..f70fdf7975 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,47 +5,12 @@ RestEasy Example - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - RestEasy Example - - - webAppRootKey - RestEasyExample - - - - + resteasy.servlet.mapping.prefix /rest - - resteasy-servlet - - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - javax.ws.rs.Application - com.baeldung.server.RestEasyServices - - - - - resteasy-servlet - /rest/* - - - - - index.html - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java new file mode 100644 index 0000000000..b474b3d4f8 --- /dev/null +++ b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java @@ -0,0 +1,7 @@ +package baeldung.client; + +/** + * Created by Admin on 29/01/2016. + */ +public class RestEasyClient { +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index fb4205bcd7..b6a2e2a0c1 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -1,7 +1,7 @@ package com.baeldung.server; -import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; import org.apache.commons.io.IOUtils; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; @@ -9,7 +9,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import javax.naming.NamingException; @@ -23,22 +22,13 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; Movie batmanMovie=null; ObjectMapper jsonMapper=null; - @BeforeClass - public static void loadMovieInventory(){ - - - - } - @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); @@ -57,133 +47,102 @@ public class RestEasyClientTest { batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); } catch (Exception e) { - e.printStackTrace(); throw new RuntimeException("Test is going to die ...", e); } - } - @Test public void testListAllMovies() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + List movies = simple.listMovies(); + System.out.println(movies); } - @Test - public void testMovieByImdbID() { + public void testMovieByImdbId() { String transformerImdbId="tt0418279"; - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); - final Movie movies = simple.movieByImdbID(transformerImdbId); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + Movie movies = simple.movieByImdbId(transformerImdbId); + System.out.println(movies); } @Test public void testAddMovie() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); - if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test - public void testDeleteMovie() { + public void testDeleteMovi1e() { - String transformerImdbId="tt0418279"; + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.deleteMovie(transformerImdbId); - moviesResponse.close(); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test public void testUpdateMovie() { - try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - batmanMovie.setImdbVotes("300,000"); - moviesResponse = simple.updateMovie(batmanMovie); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } } \ No newline at end of file From a0c22cc22514d0190d14d51e6bcc06ad5eed8836 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0028/1106] RestEasy Tutorial, CRUD Services example --- RestEasy Example/pom.xml | 91 +++ .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../baeldung/client/ServicesInterface.java | 44 ++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../src/main/resources/schema1.xsd | 29 + .../main/webapp/WEB-INF/classes/logback.xml | 3 + .../WEB-INF/jboss-deployment-structure.xml | 16 + .../src/main/webapp/WEB-INF/jboss-web.xml | 4 + .../src/main/webapp/WEB-INF/web.xml | 51 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 12 files changed, 979 insertions(+) create mode 100644 RestEasy Example/pom.xml create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/main/resources/schema1.xsd create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/web.xml create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml new file mode 100644 index 0000000000..b16c5e8267 --- /dev/null +++ b/RestEasy Example/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + com.baeldung + resteasy-tutorial + 1.0 + war + + + + jboss + http://repository.jboss.org/nexus/content/groups/public/ + + + + + 3.0.14.Final + runtime + + + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + ${resteasy.scope} + + + jboss-jaxrs-api_2.0_spec + org.jboss.spec.javax.ws.rs + + + + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + ${resteasy.scope} + + + + + javax.ws.rs + javax.ws.rs-api + 2.0.1 + + + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + ${resteasy.scope} + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java new file mode 100644 index 0000000000..53e88961be --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -0,0 +1,44 @@ +package com.baeldung.client; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +public interface ServicesInterface { + + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response addMovie(Movie movie); + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response updateMovie(Movie movie); + + + @DELETE + @Path("/deletemovie") + Response deleteMovie(@QueryParam("imdbID") String imdbID); + + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd new file mode 100644 index 0000000000..0d74b7c366 --- /dev/null +++ b/RestEasy Example/src/main/resources/schema1.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml new file mode 100644 index 0000000000..d94e9f71ab --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000000..84d75934a7 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..694bb71332 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c66d3b56ae --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + RestEasy Example + + + + org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap + + + + RestEasy Example + + + webAppRootKey + RestEasyExample + + + + + + resteasy.servlet.mapping.prefix + /rest + + + + + resteasy-servlet + + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + javax.ws.rs.Application + com.baeldung.server.service.RestEasyServices + + + + + resteasy-servlet + /rest/* + + + + + index.html + + + + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From 72a74b8096cd535da6ff3c96d7cc05d305c5e1a9 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0029/1106] Added testCase for List All Movies and Add a Movie --- RestEasy Example/pom.xml | 29 +++++ .../baeldung/client/ServicesInterface.java | 6 +- .../java/com/baeldung/{ => model}/Movie.java | 45 +++++++- .../{service => }/MovieCrudService.java | 5 +- .../{service => }/RestEasyServices.java | 2 +- .../com/baeldung/server/RestEasyClient.java | 104 ++++++++++++++---- .../com/baeldung/server/movies/batman.json | 22 ++++ .../baeldung}/server/movies/transformer.json | 2 +- 8 files changed, 184 insertions(+), 31 deletions(-) rename RestEasy Example/src/main/java/com/baeldung/{ => model}/Movie.java (86%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/MovieCrudService.java (96%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/RestEasyServices.java (95%) create mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json rename RestEasy Example/src/test/resources/{ => com/baeldung}/server/movies/transformer.json (99%) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index b16c5e8267..8dabfc863b 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -85,6 +85,35 @@ ${resteasy.scope} + + + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + + com.fasterxml.jackson.core + jackson-core + 2.7.0 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.7.0 + + + + + diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 53e88961be..2585c32438 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,15 +1,13 @@ package com.baeldung.client; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; - +@Path("/movies") public interface ServicesInterface { diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java similarity index 86% rename from RestEasy Example/src/main/java/com/baeldung/Movie.java rename to RestEasy Example/src/main/java/com/baeldung/model/Movie.java index c0041d2e95..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,5 +1,5 @@ -package com.baeldung; +package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -532,4 +532,47 @@ public class Movie { this.year = value; } + @Override + public String toString() { + return "Movie{" + + "actors='" + actors + '\'' + + ", awards='" + awards + '\'' + + ", country='" + country + '\'' + + ", director='" + director + '\'' + + ", genre='" + genre + '\'' + + ", imdbID='" + imdbID + '\'' + + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + + ", language='" + language + '\'' + + ", metascore='" + metascore + '\'' + + ", poster='" + poster + '\'' + + ", rated='" + rated + '\'' + + ", released='" + released + '\'' + + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + + ", title='" + title + '\'' + + ", type='" + type + '\'' + + ", writer='" + writer + '\'' + + ", year='" + year + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Movie movie = (Movie) o; + + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + return title != null ? title.equals(movie.title) : movie.title == null; + + } + + @Override + public int hashCode() { + int result = imdbID != null ? imdbID.hashCode() : 0; + result = 31 * result + (title != null ? title.hashCode() : 0); + return result; + } } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java similarity index 96% rename from RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java rename to RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index d1973e7037..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,11 +1,10 @@ -package com.baeldung.server.service; +package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java similarity index 95% rename from RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java rename to RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 16b6200ad1..8c57d2c9b4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,4 +1,4 @@ -package com.baeldung.server.service; +package com.baeldung.server; import javax.ws.rs.ApplicationPath; diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json new file mode 100644 index 0000000000..28061d5bf9 --- /dev/null +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -0,0 +1,22 @@ +{ + "title": "Batman", + "year": "1989", + "rated": "PG-13", + "released": "23 Jun 1989", + "runtime": "126 min", + "genre": "Action, Adventure", + "director": "Tim Burton", + "writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)", + "actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl", + "plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.", + "language": "English, French", + "country": "USA, UK", + "awards": "Won 1 Oscar. Another 9 wins & 22 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg", + "metascore": "66", + "imdbRating": "7.6", + "imdbVotes": "256,000", + "imdbID": "tt0096895", + "type": "movie", + "response": "True" +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json similarity index 99% rename from RestEasy Example/src/test/resources/server/movies/transformer.json rename to RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index 2154868265..a3b033a8ba 100644 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -17,6 +17,6 @@ "imdbRating": "7.1", "imdbVotes": "492,225", "imdbID": "tt0418279", - "Type": "movie", + "type": "movie", "response": "True" } \ No newline at end of file From 4174ff7dd2a1deb7e023067326e8fa2495385003 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0030/1106] Added testCase for all Services --- RestEasy Example/pom.xml | 15 -- .../baeldung/client/ServicesInterface.java | 10 +- .../com/baeldung/server/MovieCrudService.java | 15 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../com/baeldung/server/RestEasyClient.java | 112 ----------- .../baeldung/server/RestEasyClientTest.java | 189 ++++++++++++++++++ 6 files changed, 206 insertions(+), 137 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 8dabfc863b..6935238d91 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -99,21 +99,6 @@ 2.4 - - com.fasterxml.jackson.core - jackson-core - 2.7.0 - - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.0 - - - - - diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 2585c32438..7efed546d8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -17,6 +17,12 @@ public interface ServicesInterface { Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -34,9 +40,5 @@ public interface ServicesInterface { Response deleteMovie(@QueryParam("imdbID") String imdbID); - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index c66d3b56ae..ab3bc1aa83 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -33,7 +33,7 @@ javax.ws.rs.Application - com.baeldung.server.service.RestEasyServices + com.baeldung.server.RestEasyServices diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java new file mode 100644 index 0000000000..fb4205bcd7 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -0,0 +1,189 @@ +package com.baeldung.server; + +import com.baeldung.model.Movie; +import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +public class RestEasyClientTest { + + + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; + + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + + @Test + public void testListAllMovies() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testMovieByImdbID() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + + final Movie movies = simple.movieByImdbID(transformerImdbId); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); + + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testDeleteMovie() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(transformerImdbId); + moviesResponse.close(); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testUpdateMovie() { + + try { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file From 85d299e739fa00317d687fdd2af2ffa43a9dfc1c Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0031/1106] Minor Bugfix --- .../baeldung/client/ServicesInterface.java | 4 +- .../main/java/com/baeldung/model/Movie.java | 22 +-- .../com/baeldung/server/MovieCrudService.java | 12 +- .../src/main/webapp/WEB-INF/web.xml | 37 +---- .../java/baeldung/client/RestEasyClient.java | 7 + .../baeldung/server/RestEasyClientTest.java | 149 +++++++----------- 6 files changed, 81 insertions(+), 150 deletions(-) create mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 7efed546d8..749cabc757 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -14,7 +14,7 @@ public interface ServicesInterface { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + Movie movieByImdbId(@QueryParam("imdbId") String imdbId); @GET @@ -37,7 +37,7 @@ public interface ServicesInterface { @DELETE @Path("/deletemovie") - Response deleteMovie(@QueryParam("imdbID") String imdbID); + Response deleteMovie(@QueryParam("imdbId") String imdbID); diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index ab3bc1aa83..f70fdf7975 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,47 +5,12 @@ RestEasy Example - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - RestEasy Example - - - webAppRootKey - RestEasyExample - - - - + resteasy.servlet.mapping.prefix /rest - - resteasy-servlet - - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - javax.ws.rs.Application - com.baeldung.server.RestEasyServices - - - - - resteasy-servlet - /rest/* - - - - - index.html - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java new file mode 100644 index 0000000000..b474b3d4f8 --- /dev/null +++ b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java @@ -0,0 +1,7 @@ +package baeldung.client; + +/** + * Created by Admin on 29/01/2016. + */ +public class RestEasyClient { +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index fb4205bcd7..b6a2e2a0c1 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -1,7 +1,7 @@ package com.baeldung.server; -import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; import org.apache.commons.io.IOUtils; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; @@ -9,7 +9,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import javax.naming.NamingException; @@ -23,22 +22,13 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; Movie batmanMovie=null; ObjectMapper jsonMapper=null; - @BeforeClass - public static void loadMovieInventory(){ - - - - } - @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); @@ -57,133 +47,102 @@ public class RestEasyClientTest { batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); } catch (Exception e) { - e.printStackTrace(); throw new RuntimeException("Test is going to die ...", e); } - } - @Test public void testListAllMovies() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + List movies = simple.listMovies(); + System.out.println(movies); } - @Test - public void testMovieByImdbID() { + public void testMovieByImdbId() { String transformerImdbId="tt0418279"; - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); - final Movie movies = simple.movieByImdbID(transformerImdbId); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + Movie movies = simple.movieByImdbId(transformerImdbId); + System.out.println(movies); } @Test public void testAddMovie() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); - if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test - public void testDeleteMovie() { + public void testDeleteMovi1e() { - String transformerImdbId="tt0418279"; + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.deleteMovie(transformerImdbId); - moviesResponse.close(); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test public void testUpdateMovie() { - try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - batmanMovie.setImdbVotes("300,000"); - moviesResponse = simple.updateMovie(batmanMovie); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } } \ No newline at end of file From d4a4d20fa03d9356ee122834846551cd71427c44 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:39:35 +0100 Subject: [PATCH 0032/1106] Minor Bugfix --- .../main/java/com/baeldung/model/Movie.java | 321 +----------------- 1 file changed, 1 insertion(+), 320 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index a2b2bd5250..805ba95209 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -52,482 +52,163 @@ public class Movie { protected String writer; protected String year; - /** - * Recupera il valore della propriet� actors. - * - * @return - * possible object is - * {@link String } - * - */ + public String getActors() { return actors; } - /** - * Imposta il valore della propriet� actors. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setActors(String value) { this.actors = value; } - /** - * Recupera il valore della propriet� awards. - * - * @return - * possible object is - * {@link String } - * - */ public String getAwards() { return awards; } - /** - * Imposta il valore della propriet� awards. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setAwards(String value) { this.awards = value; } - /** - * Recupera il valore della propriet� country. - * - * @return - * possible object is - * {@link String } - * - */ public String getCountry() { return country; } - /** - * Imposta il valore della propriet� country. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setCountry(String value) { this.country = value; } - /** - * Recupera il valore della propriet� director. - * - * @return - * possible object is - * {@link String } - * - */ public String getDirector() { return director; } - /** - * Imposta il valore della propriet� director. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setDirector(String value) { this.director = value; } - /** - * Recupera il valore della propriet� genre. - * - * @return - * possible object is - * {@link String } - * - */ public String getGenre() { return genre; } - /** - * Imposta il valore della propriet� genre. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setGenre(String value) { this.genre = value; } - /** - * Recupera il valore della propriet� imdbId. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbId() { return imdbId; } - /** - * Imposta il valore della propriet� imdbId. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbId(String value) { this.imdbId = value; } - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbRating() { return imdbRating; } - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbRating(String value) { this.imdbRating = value; } - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbVotes() { return imdbVotes; } - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbVotes(String value) { this.imdbVotes = value; } - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ public String getLanguage() { return language; } - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setLanguage(String value) { this.language = value; } - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ public String getMetascore() { return metascore; } - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setMetascore(String value) { this.metascore = value; } - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ public String getPlot() { return plot; } - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPlot(String value) { this.plot = value; } - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ public String getPoster() { return poster; } - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPoster(String value) { this.poster = value; } - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ public String getRated() { return rated; } - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRated(String value) { this.rated = value; } - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ public String getReleased() { return released; } - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setReleased(String value) { this.released = value; } - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ public String getResponse() { return response; } - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setResponse(String value) { this.response = value; } - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ public String getRuntime() { return runtime; } - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRuntime(String value) { this.runtime = value; } - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ public String getTitle() { return title; } - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setTitle(String value) { this.title = value; } - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ public String getType() { return type; } - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setType(String value) { this.type = value; } - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ public String getWriter() { return writer; } - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setWriter(String value) { this.writer = value; } - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ public String getYear() { return year; } - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setYear(String value) { this.year = value; } From 183ae3d3b9bae2ce9151c4ab0702b74ecb54d1dd Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:47:42 +0100 Subject: [PATCH 0033/1106] Minor Bugfix --- .../main/java/com/baeldung/model/Movie.java | 260 ------------------ 1 file changed, 260 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 8eb8283d28..76e84a6378 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -84,390 +84,130 @@ public class Movie { this.director = value; } - public String getGenre() { return genre; } - public void setGenre(String value) { this.genre = value; } - /** - * Recupera il valore della propriet� imdbId. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbId() { return imdbId; } - /** - * Imposta il valore della propriet� imdbId. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbId(String value) { this.imdbId = value; } - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbRating() { return imdbRating; } - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbRating(String value) { this.imdbRating = value; } - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbVotes() { return imdbVotes; } public void setImdbVotes(String value) { - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ this.imdbVotes = value; } public String getLanguage() { - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ return language; } - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setLanguage(String value) { this.language = value; } - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ public String getMetascore() { return metascore; } - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setMetascore(String value) { this.metascore = value; } - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ public String getPlot() { return plot; } - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPlot(String value) { this.plot = value; } - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ public String getPoster() { return poster; } - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPoster(String value) { this.poster = value; } - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ public String getRated() { return rated; } - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRated(String value) { this.rated = value; } - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ public String getReleased() { return released; } - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setReleased(String value) { this.released = value; } - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ public String getResponse() { return response; } - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setResponse(String value) { this.response = value; } - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ public String getRuntime() { return runtime; } - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRuntime(String value) { this.runtime = value; } - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ public String getTitle() { return title; } - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setTitle(String value) { this.title = value; } -<<<<<<< HEAD -======= - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ ->>>>>>> origin/master public String getType() { return type; } -<<<<<<< HEAD -======= - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ ->>>>>>> origin/master public void setType(String value) { this.type = value; } -<<<<<<< HEAD -======= - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ ->>>>>>> origin/master public String getWriter() { return writer; } -<<<<<<< HEAD -======= - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ ->>>>>>> origin/master public void setWriter(String value) { this.writer = value; } -<<<<<<< HEAD -======= - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ ->>>>>>> origin/master public String getYear() { return year; } -<<<<<<< HEAD -======= - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ ->>>>>>> origin/master public void setYear(String value) { this.year = value; } From 03b6cbf3e545dcb817abf364f1edea3e2b074a03 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:55:46 +0100 Subject: [PATCH 0034/1106] CleanUp Code --- RestEasy Example/pom.xml | 3 +- .../baeldung/client/ServicesInterface.java | 1 - .../main/java/com/baeldung/model/Movie.java | 2 -- .../com/baeldung/server/MovieCrudService.java | 17 ++++------- .../com/baeldung/server/RestEasyServices.java | 8 ----- .../src/main/resources/schema1.xsd | 29 ------------------- .../src/main/webapp/WEB-INF/web.xml | 3 -- .../java/baeldung/client/RestEasyClient.java | 7 ----- .../baeldung/server/RestEasyClientTest.java | 1 - 9 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 RestEasy Example/src/main/resources/schema1.xsd delete mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 6935238d91..9c890da2b7 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -36,7 +36,7 @@ - + org.jboss.resteasy jaxrs-api @@ -101,5 +101,4 @@ - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 749cabc757..3c8d6abc00 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,7 +1,6 @@ package com.baeldung.client; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 76e84a6378..7590f10487 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,11 +1,9 @@ - package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "movie", propOrder = { "actors", diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..bbb3b1e953 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,7 +1,6 @@ package com.baeldung.server; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -11,23 +10,21 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); + if(inventory.containsKey(imdbId)){ + return inventory.get(imdbId); }else return null; } @@ -70,16 +67,16 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbID)){ + if (null==inventory.get(imdbId)){ return Response.status(Response.Status.NOT_FOUND) .entity("Movie is not in the database.\nUnable to Delete").build(); } - inventory.remove(imdbID); + inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } @@ -93,6 +90,4 @@ public class MovieCrudService { } - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 8c57d2c9b4..7726e49f38 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,19 +1,11 @@ package com.baeldung.server; - import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; -import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.Set; -/** - * Created by Admin on 29/01/2016. - */ - - - @ApplicationPath("/rest") public class RestEasyServices extends Application { diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd deleted file mode 100644 index 0d74b7c366..0000000000 --- a/RestEasy Example/src/main/resources/schema1.xsd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index f70fdf7975..1e7f64004d 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,12 +5,9 @@ RestEasy Example - resteasy.servlet.mapping.prefix /rest - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java deleted file mode 100644 index b474b3d4f8..0000000000 --- a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package baeldung.client; - -/** - * Created by Admin on 29/01/2016. - */ -public class RestEasyClient { -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index b6a2e2a0c1..faa39e0199 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -10,7 +10,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; import org.junit.Test; - import javax.naming.NamingException; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; From 9c60f320892dcdfe2d15b5b68332c58e103fa64a Mon Sep 17 00:00:00 2001 From: David Morley Date: Sun, 7 Feb 2016 14:54:04 -0600 Subject: [PATCH 0035/1106] Clean up examples for Spring Data Elasticsearch --- .../baeldung/{ => spring/data/es}/config/Config.java | 4 ++-- .../data/es/dao}/ArticleRepository.java | 4 ++-- .../baeldung/{ => spring/data/es}/model/Article.java | 2 +- .../baeldung/{ => spring/data/es}/model/Author.java | 2 +- .../data/es/repository}/ArticleRepository.java | 5 ++--- .../{ => spring/data/es}/service/ArticleService.java | 4 ++-- .../data/es}/service/ArticleServiceImpl.java | 6 +++--- .../{ => spring/data/es}/ElasticSearchTest.java | 11 +++++------ 8 files changed, 18 insertions(+), 20 deletions(-) rename spring-data-elasticsearch/src/main/java/com/baeldung/{ => spring/data/es}/config/Config.java (94%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{repository => spring/data/es/dao}/ArticleRepository.java (86%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{ => spring/data/es}/model/Article.java (96%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{ => spring/data/es}/model/Author.java (90%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{dao => spring/data/es/repository}/ArticleRepository.java (85%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{ => spring/data/es}/service/ArticleService.java (82%) rename spring-data-elasticsearch/src/main/java/com/baeldung/{ => spring/data/es}/service/ArticleServiceImpl.java (89%) rename spring-data-elasticsearch/src/test/java/com/baeldung/{ => spring/data/es}/ElasticSearchTest.java (94%) diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java similarity index 94% rename from spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java index a67ec64534..78e4083a28 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/config/Config.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/config/Config.java @@ -1,4 +1,4 @@ -package com.baeldung.config; +package com.baeldung.spring.data.es.config; import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.node.NodeBuilder; @@ -18,7 +18,7 @@ import java.nio.file.Paths; @Configuration @EnableElasticsearchRepositories(basePackages = "com.baeldung.repository") -@ComponentScan(basePackages = {"com.baeldung.service"}) +@ComponentScan(basePackages = {"com.baeldung.spring.data.es.service"}) public class Config { private static Logger logger = LoggerFactory.getLogger(Config.class); diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/dao/ArticleRepository.java similarity index 86% rename from spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/dao/ArticleRepository.java index 1cb74889c5..313eba5b36 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/repository/ArticleRepository.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/dao/ArticleRepository.java @@ -1,6 +1,6 @@ -package com.baeldung.repository; +package com.baeldung.spring.data.es.dao; -import com.baeldung.model.Article; +import com.baeldung.spring.data.es.model.Article; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.annotations.Query; diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java similarity index 96% rename from spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java index dee1d0817e..dd472982ce 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Article.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Article.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.spring.data.es.model; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java similarity index 90% rename from spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java index 09239efbe5..c335c4534a 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/model/Author.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/model/Author.java @@ -1,4 +1,4 @@ -package com.baeldung.model; +package com.baeldung.spring.data.es.model; public class Author { diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java similarity index 85% rename from spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java index 6ed86eff9b..27628950d7 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/dao/ArticleRepository.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/repository/ArticleRepository.java @@ -1,7 +1,6 @@ -package com.baeldung.dao; +package com.baeldung.spring.data.es.repository; -import com.baeldung.model.Article; -import com.baeldung.model.Article; +import com.baeldung.spring.data.es.model.Article; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.annotations.Query; diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java similarity index 82% rename from spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java index 052e22c67d..760bad4b01 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleService.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleService.java @@ -1,6 +1,6 @@ -package com.baeldung.service; +package com.baeldung.spring.data.es.service; -import com.baeldung.model.Article; +import com.baeldung.spring.data.es.model.Article; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java similarity index 89% rename from spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java rename to spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java index 59feb2816c..3bb6e6a0e0 100644 --- a/spring-data-elasticsearch/src/main/java/com/baeldung/service/ArticleServiceImpl.java +++ b/spring-data-elasticsearch/src/main/java/com/baeldung/spring/data/es/service/ArticleServiceImpl.java @@ -1,7 +1,7 @@ -package com.baeldung.service; +package com.baeldung.spring.data.es.service; -import com.baeldung.repository.ArticleRepository; -import com.baeldung.model.Article; +import com.baeldung.spring.data.es.repository.ArticleRepository; +import com.baeldung.spring.data.es.model.Article; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java similarity index 94% rename from spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java rename to spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java index 07248149c2..34ccfd788e 100644 --- a/spring-data-elasticsearch/src/test/java/com/baeldung/ElasticSearchTest.java +++ b/spring-data-elasticsearch/src/test/java/com/baeldung/spring/data/es/ElasticSearchTest.java @@ -1,10 +1,9 @@ -package com.baeldung; +package com.baeldung.spring.data.es; -import com.baeldung.config.Config; -import com.baeldung.model.Article; -import com.baeldung.model.Author; -import com.baeldung.service.ArticleService; -import org.elasticsearch.index.query.QueryBuilder; +import com.baeldung.spring.data.es.config.Config; +import com.baeldung.spring.data.es.model.Article; +import com.baeldung.spring.data.es.model.Author; +import com.baeldung.spring.data.es.service.ArticleService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; From 58e82f3c1f630af700aa2890a1f01835969b9667 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 11:46:02 +0200 Subject: [PATCH 0036/1106] Update README.md --- spring-hibernate4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-hibernate4/README.md b/spring-hibernate4/README.md index 96f8074165..acf20632fe 100644 --- a/spring-hibernate4/README.md +++ b/spring-hibernate4/README.md @@ -6,6 +6,7 @@ - [Hibernate 4 with Spring](http://www.baeldung.com/hibernate-4-spring) - [The DAO with Spring 3 and Hibernate](http://www.baeldung.com/2011/12/02/the-persistence-layer-with-spring-3-1-and-hibernate/) - [Hibernate Pagination](http://www.baeldung.com/hibernate-pagination) +- [Sorting with Hibernate](http://www.baeldung.com/hibernate-sort) ### Quick Start From d68375cd6da76a53a8074daf862d659da21f22bb Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 11:57:26 +0200 Subject: [PATCH 0037/1106] Update README.md --- httpclient/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/httpclient/README.md b/httpclient/README.md index 529ac754f8..b9dd431500 100644 --- a/httpclient/README.md +++ b/httpclient/README.md @@ -5,12 +5,13 @@ ### Relevant Articles: -- [HttpClient 4 Send Custom Cookie](http://www.baeldung.com/httpclient-4-cookies) -- [HttpClient 4 Get the Status Code](http://www.baeldung.com/httpclient-status-code) -- [HttpClient 4 Cancel / Abort Request](http://www.baeldung.com/httpclient-cancel-request) +- [HttpClient 4 – Send Custom Cookie](http://www.baeldung.com/httpclient-4-cookies) +- [HttpClient 4 – Get the Status Code](http://www.baeldung.com/httpclient-status-code) +- [HttpClient 4 – Cancel / Abort Request](http://www.baeldung.com/httpclient-cancel-request) - [HttpClient 4 Cookbook](http://www.baeldung.com/httpclient4) - [Unshorten URLs with HttpClient](http://www.baeldung.com/unshorten-url-httpclient) - [HttpClient with SSL](http://www.baeldung.com/httpclient-ssl) -- [HttpClient 4 Follow Redirects for POST](http://www.baeldung.com/httpclient-redirect-on-http-post) -- [HttpClient Set Custom Header](http://www.baeldung.com/httpclient-custom-http-header) +- [HttpClient 4 – Follow Redirects for POST](http://www.baeldung.com/httpclient-redirect-on-http-post) +- [HttpClient – Set Custom Header](http://www.baeldung.com/httpclient-custom-http-header) - [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication) +- [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload) From e4e5a9e479859468c26a061711beeb3712d421f8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 11:58:55 +0200 Subject: [PATCH 0038/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index 63ca8c7926..b53435a222 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -11,6 +11,7 @@ - [ETags for REST with Spring](http://www.baeldung.com/2013/01/11/etags-for-rest-with-spring/) - [Error Handling for REST with Spring 3](http://www.baeldung.com/2013/01/31/exception-handling-for-rest-with-spring-3-2/) - [Integration Testing with the Maven Cargo plugin](http://www.baeldung.com/2011/10/16/how-to-set-up-integration-testing-with-the-maven-cargo-plugin/) +- [Introduction to Spring Data JPA](http://www.baeldung.com/2011/12/22/the-persistence-layer-with-spring-data-jpa/) ### Build the Project From 72bd9c54b9f53a8c01581cb0a6f3fd6f0a8aebe8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:01:25 +0200 Subject: [PATCH 0039/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 772681ad57..665a06a3c8 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -6,4 +6,5 @@ - [Immutable ArrayList in Java](http://www.baeldung.com/java-immutable-list) - [Java - Reading a Large File Efficiently](http://www.baeldung.com/java-read-lines-large-file) - [Java InputStream to String](http://www.baeldung.com/convert-input-stream-to-string) +- [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) From ec551bfe3fc43a6aeb2c3c20adcb0c8bef125149 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:02:58 +0200 Subject: [PATCH 0040/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 665a06a3c8..6aa04df33f 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -7,4 +7,5 @@ - [Java - Reading a Large File Efficiently](http://www.baeldung.com/java-read-lines-large-file) - [Java InputStream to String](http://www.baeldung.com/convert-input-stream-to-string) - [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) +- [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) From 693081d509ac9d9cb1e991ea5e18348f4cfd1c40 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:04:32 +0200 Subject: [PATCH 0041/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 6aa04df33f..a98e5524ac 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -8,4 +8,5 @@ - [Java InputStream to String](http://www.baeldung.com/convert-input-stream-to-string) - [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) - [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) +- [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) From c5cad39354069a1888cc547c2cf5cc165b298bf3 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:07:07 +0200 Subject: [PATCH 0042/1106] Update README.md --- core-java/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java/README.md b/core-java/README.md index a98e5524ac..b8f63717ed 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -9,4 +9,4 @@ - [Converting between an Array and a List in Java](http://www.baeldung.com/convert-array-to-list-and-list-to-array) - [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) - [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) - +- [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) From 9f9aee658f21ac127c2b1158832d7311bd1193ee Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:08:35 +0200 Subject: [PATCH 0043/1106] Update README.md --- spring-security-mvc-persisted-remember-me/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-mvc-persisted-remember-me/README.md b/spring-security-mvc-persisted-remember-me/README.md index 11f5417028..df83fd3d77 100644 --- a/spring-security-mvc-persisted-remember-me/README.md +++ b/spring-security-mvc-persisted-remember-me/README.md @@ -4,7 +4,7 @@ ### Relevant Articles: -- [Spring Security Persisted Remember Me] +- [Spring Security Persisted Remember Me](http://www.baeldung.com/spring-security-persistent-remember-me) - [Spring Security Remember Me](http://www.baeldung.com/spring-security-remember-me) - [Redirect to different pages after Login with Spring Security](http://www.baeldung.com/spring_redirect_after_login) From 7bc00c24b721a406a3434964b803f835335a4e43 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:13:41 +0200 Subject: [PATCH 0044/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index b53435a222..cffbcf40f0 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -12,6 +12,7 @@ - [Error Handling for REST with Spring 3](http://www.baeldung.com/2013/01/31/exception-handling-for-rest-with-spring-3-2/) - [Integration Testing with the Maven Cargo plugin](http://www.baeldung.com/2011/10/16/how-to-set-up-integration-testing-with-the-maven-cargo-plugin/) - [Introduction to Spring Data JPA](http://www.baeldung.com/2011/12/22/the-persistence-layer-with-spring-data-jpa/) +- [Project Configuration with Spring](http://www.baeldung.com/2012/03/12/project-configuration-with-spring/) ### Build the Project From dfc7b2113d40bf7c5a350027473f88ea6a51245a Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:14:54 +0200 Subject: [PATCH 0045/1106] Update README.md --- spring-mvc-xml/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-xml/README.md b/spring-mvc-xml/README.md index 908e21d4bf..2409ec8174 100644 --- a/spring-mvc-xml/README.md +++ b/spring-mvc-xml/README.md @@ -7,3 +7,4 @@ ### Relevant Articles: - [Spring MVC Tutorial](http://www.baeldung.com/spring-mvc-tutorial) - [Servlet Session Timeout](http://www.baeldung.com/servlet-session-timeout) +- [Basic Forms with Spring MVC](http://www.baeldung.com/spring-mvc-form-tutorial) From 550068f5a8fb8f0f02a5edeb66edd831f875ad47 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:19:34 +0200 Subject: [PATCH 0046/1106] Update README.md --- gson/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gson/README.md b/gson/README.md index 559e536d81..47d8ecfb39 100644 --- a/gson/README.md +++ b/gson/README.md @@ -2,5 +2,6 @@ ## GSON Cookbooks and Examples -### Relevant Articles: +### Relevant Articles: +-[Gson Deserialization Cookbook](http://www.baeldung.com/gson-deserialization-guide) From adc258155690a4d45e0ffd9c238cbf89081c8f29 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:20:01 +0200 Subject: [PATCH 0047/1106] Update README.md --- gson/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gson/README.md b/gson/README.md index 47d8ecfb39..67651b732e 100644 --- a/gson/README.md +++ b/gson/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: --[Gson Deserialization Cookbook](http://www.baeldung.com/gson-deserialization-guide) +- [Gson Deserialization Cookbook](http://www.baeldung.com/gson-deserialization-guide) From d33f16a68d762b189c4ea17fc2199ddacb748b81 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:21:29 +0200 Subject: [PATCH 0048/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 1c5b16d6f6..1638e82756 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -5,6 +5,7 @@ ### Relevant Articles: - [Spring Security Registration Tutorial](http://www.baeldung.com/spring-security-registration) +- [The Registration Process With Spring Security](http://www.baeldung.com/registration-with-spring-mvc-and-spring-security) From 28bddf2d8ebde5847c9f7f0cda79b7f9a24db63d Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:22:55 +0200 Subject: [PATCH 0049/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index b8f63717ed..6db2b370f6 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -10,3 +10,4 @@ - [Converting between an Array and a Set in Java](http://www.baeldung.com/convert-array-to-set-and-set-to-array) - [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) - [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) +- [Java – Write to File](http://www.baeldung.com/java-write-to-file) From 1d24669cbb35963cc06791a3156613cb7ada28c4 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:26:06 +0200 Subject: [PATCH 0050/1106] Update README.md --- guava/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guava/README.md b/guava/README.md index 8960b4676e..948087ff1e 100644 --- a/guava/README.md +++ b/guava/README.md @@ -7,7 +7,6 @@ - [Guava Collections Cookbook](http://www.baeldung.com/guava-collections) - [Guava Ordering Cookbook](http://www.baeldung.com/guava-order) - [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) - - [Hamcrest Collections Cookbook](http://www.baeldung.com/hamcrest-collections-arrays) - - [Partition a List in Java](http://www.baeldung.com/java-list-split) +- [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) From 20d79082dd70ddf6118e0e0bf2155ef6821371d4 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:28:15 +0200 Subject: [PATCH 0051/1106] Update README.md --- guava/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guava/README.md b/guava/README.md index 948087ff1e..86771a740c 100644 --- a/guava/README.md +++ b/guava/README.md @@ -10,3 +10,4 @@ - [Hamcrest Collections Cookbook](http://www.baeldung.com/hamcrest-collections-arrays) - [Partition a List in Java](http://www.baeldung.com/java-list-split) - [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) +- [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) From d8bb9affec51c483f021dd8564eb6597e4952b33 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:29:23 +0200 Subject: [PATCH 0052/1106] Update README.md --- guava/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guava/README.md b/guava/README.md index 86771a740c..43acf04bd1 100644 --- a/guava/README.md +++ b/guava/README.md @@ -11,3 +11,4 @@ - [Partition a List in Java](http://www.baeldung.com/java-list-split) - [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) - [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) +- [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) From c2a226141b750871e580b8e77f25561e7456b6eb Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:33:13 +0200 Subject: [PATCH 0053/1106] Update README.md --- guava/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guava/README.md b/guava/README.md index 43acf04bd1..dfffe8bc07 100644 --- a/guava/README.md +++ b/guava/README.md @@ -12,3 +12,4 @@ - [Filtering and Transforming Collections in Guava](http://www.baeldung.com/guava-filter-and-transform-a-collection) - [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) +- [Guava – Lists](http://www.baeldung.com/guava-lists) From 30b74f9d04a3614061c4c13748a91fa4fae3c564 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:34:20 +0200 Subject: [PATCH 0054/1106] Update README.md --- guava/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guava/README.md b/guava/README.md index dfffe8bc07..7fdf28033d 100644 --- a/guava/README.md +++ b/guava/README.md @@ -13,3 +13,4 @@ - [Guava – Join and Split Collections](http://www.baeldung.com/guava-joiner-and-splitter-tutorial) - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) - [Guava – Lists](http://www.baeldung.com/guava-lists) +- [Guava – Sets](http://www.baeldung.com/guava-sets) From 371ebf5db18d1495ba41b0cda5f7cc96b098d496 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:35:14 +0200 Subject: [PATCH 0055/1106] Update README.md --- guava/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guava/README.md b/guava/README.md index 7fdf28033d..28bcfeb912 100644 --- a/guava/README.md +++ b/guava/README.md @@ -14,3 +14,4 @@ - [Guava – Write to File, Read from File](http://www.baeldung.com/guava-write-to-file-read-from-file) - [Guava – Lists](http://www.baeldung.com/guava-lists) - [Guava – Sets](http://www.baeldung.com/guava-sets) +- [Guava – Maps](http://www.baeldung.com/guava-maps) From 86ca22330b3ee915b44032a0829de436b05ced9c Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:38:54 +0200 Subject: [PATCH 0056/1106] Update README.md --- mockito/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mockito/README.md b/mockito/README.md index 5ecc5722b0..eb80042c4b 100644 --- a/mockito/README.md +++ b/mockito/README.md @@ -6,4 +6,4 @@ ### Relevant Articles: - [Mockito Verify Cookbook](http://www.baeldung.com/mockito-verify) - [Mockito When/Then Cookbook](http://www.baeldung.com/mockito-behavior) - +- [Mockito – Using Spies](http://www.baeldung.com/mockito-spy) From b3dff4d5de740eab323a390895a66d5c8fb2eb32 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:40:40 +0200 Subject: [PATCH 0057/1106] Update README.md --- spring-all/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-all/README.md b/spring-all/README.md index 4a3bd25077..baab7ec083 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -6,4 +6,5 @@ This project is used to replicate Spring Exceptions only. ### Relevant articles: -- [Properties with Spring](http://www.baeldung.com/2012/02/06/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage \ No newline at end of file +- [Properties with Spring](http://www.baeldung.com/2012/02/06/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage +- [Spring Profiles](http://www.baeldung.com/spring-profiles) From 731c0803c4e5833c619ea40aa1f78e8f1f86f87a Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:42:32 +0200 Subject: [PATCH 0058/1106] Update README.md --- mockito/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/mockito/README.md b/mockito/README.md index eb80042c4b..5e7cd19f78 100644 --- a/mockito/README.md +++ b/mockito/README.md @@ -7,3 +7,4 @@ - [Mockito Verify Cookbook](http://www.baeldung.com/mockito-verify) - [Mockito When/Then Cookbook](http://www.baeldung.com/mockito-behavior) - [Mockito – Using Spies](http://www.baeldung.com/mockito-spy) +- [Mockito – @Mock, @Spy, @Captor and @InjectMocks](http://www.baeldung.com/mockito-annotations) From cfc4d69a88218b4a44db4a52fb2d1c23963c6641 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:44:18 +0200 Subject: [PATCH 0059/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 6db2b370f6..9a7c0d3776 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -11,3 +11,4 @@ - [Converting between a List and a Set in Java](http://www.baeldung.com/convert-list-to-set-and-set-to-list) - [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) - [Java – Write to File](http://www.baeldung.com/java-write-to-file) +- [Java Scanner](http://www.baeldung.com/java-scanner) From 32f6d8ab6c4776853fd3bc29c5a334fd5bd481ca Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:45:35 +0200 Subject: [PATCH 0060/1106] Update README.md --- httpclient/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/httpclient/README.md b/httpclient/README.md index b9dd431500..1cf788287c 100644 --- a/httpclient/README.md +++ b/httpclient/README.md @@ -15,3 +15,4 @@ - [HttpClient – Set Custom Header](http://www.baeldung.com/httpclient-custom-http-header) - [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication) - [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload) +- [HttpAsyncClient Tutorial](http://www.baeldung.com/httpasyncclient-tutorial) From e2de29e24ba0c8b422d0a4ad9c50658898b10b6e Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:47:00 +0200 Subject: [PATCH 0061/1106] Update README.md --- core-java-8/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-java-8/README.md b/core-java-8/README.md index 9bb6bb811c..f957b90799 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -3,4 +3,5 @@ ## Core Java 8 Cookbooks and Examples ### Relevant Articles: -// - [Java 8 Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) +// - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) +// - [Java – Directory Size](http://www.baeldung.com/java-folder-size) From 68aa809456ac772c98b0da813400d346926b9fd8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:47:21 +0200 Subject: [PATCH 0062/1106] Update README.md --- core-java-8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-8/README.md b/core-java-8/README.md index f957b90799..e3fa3f9848 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: // - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) -// - [Java – Directory Size](http://www.baeldung.com/java-folder-size) +- [Java – Directory Size](http://www.baeldung.com/java-folder-size) From a8165f78fece34a7c572208f65497dda37c4473b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:48:14 +0200 Subject: [PATCH 0063/1106] Update README.md --- core-java-8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-8/README.md b/core-java-8/README.md index e3fa3f9848..f957b90799 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: // - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) -- [Java – Directory Size](http://www.baeldung.com/java-folder-size) +// - [Java – Directory Size](http://www.baeldung.com/java-folder-size) From 06f00f1cb166492332794ce4aabd1fd1a7521b33 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:48:29 +0200 Subject: [PATCH 0064/1106] Update README.md --- core-java-8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-8/README.md b/core-java-8/README.md index f957b90799..e3fa3f9848 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: // - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) -// - [Java – Directory Size](http://www.baeldung.com/java-folder-size) +- [Java – Directory Size](http://www.baeldung.com/java-folder-size) From d9f9436f758683edd57b5d54b9b1605c964fc9b8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:50:49 +0200 Subject: [PATCH 0065/1106] Update README.md --- spring-security-login-and-registration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 1638e82756..a5a9701ff8 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -6,7 +6,7 @@ ### Relevant Articles: - [Spring Security Registration Tutorial](http://www.baeldung.com/spring-security-registration) - [The Registration Process With Spring Security](http://www.baeldung.com/registration-with-spring-mvc-and-spring-security) - +- [Registration – Activate a New Account by Email](http://www.baeldung.com/registration-verify-user-by-email) ### Build the Project From d12e115d0bf5cf9736f8aef516c42adbe51a0f28 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:53:05 +0200 Subject: [PATCH 0066/1106] Update README.md --- jackson/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jackson/README.md b/jackson/README.md index 539cb34761..bb19fc7f77 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -4,9 +4,8 @@ ### Relevant Articles: - [Jackson Ignore Properties on Marshalling](http://www.baeldung.com/jackson-ignore-properties-on-serialization) -- [Jackson Unmarshall to Collection/Array](http://www.baeldung.com/jackson-collection-array) +- [Jackson – Unmarshall to Collection/Array](http://www.baeldung.com/jackson-collection-array) - [Jackson Unmarshalling json with Unknown Properties](http://www.baeldung.com/jackson-deserialize-json-unknown-properties) -- [Jackson Custom Serializer](http://www.baeldung.com/jackson-custom-serialization) -- [Jackson Custom Deserializer](http://www.baeldung.com/jackson-deserialization) - - +- [Jackson – Custom Serializer](http://www.baeldung.com/jackson-custom-serialization) +- [Jackson – Custom Deserializer](http://www.baeldung.com/jackson-deserialization) +- [Jackson Exceptions – Problems and Solutions](http://www.baeldung.com/jackson-exception) From 9877e0008b0f1b7ea2fea271e9c5f661985e86dd Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Mon, 8 Feb 2016 12:54:36 +0200 Subject: [PATCH 0067/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index bb19fc7f77..046c6b6cfb 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -9,3 +9,4 @@ - [Jackson – Custom Serializer](http://www.baeldung.com/jackson-custom-serialization) - [Jackson – Custom Deserializer](http://www.baeldung.com/jackson-deserialization) - [Jackson Exceptions – Problems and Solutions](http://www.baeldung.com/jackson-exception) +- [Jackson Date](http://www.baeldung.com/jackson-serialize-dates) From c3ef41a10ddf15cc2e919272334fe666579863da Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 14:00:11 +0100 Subject: [PATCH 0068/1106] CleanUp and reformatting Code; dependency fix in pom.xml --- RestEasy Example/pom.xml | 147 +++++++----------- .../baeldung/client/ServicesInterface.java | 15 +- .../main/java/com/baeldung/model/Movie.java | 56 ++----- .../com/baeldung/server/MovieCrudService.java | 49 +++--- .../WEB-INF/jboss-deployment-structure.xml | 22 +-- .../src/main/webapp/WEB-INF/web.xml | 14 +- .../baeldung/server/RestEasyClientTest.java | 23 ++- .../com/baeldung/server/movies/batman.json | 2 +- .../baeldung/server/movies/transformer.json | 2 +- 9 files changed, 125 insertions(+), 205 deletions(-) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 9c890da2b7..ec9e87b0d1 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -1,104 +1,77 @@ - - 4.0.0 + + 4.0.0 - com.baeldung - resteasy-tutorial - 1.0 - war + com.baeldung + resteasy-tutorial + 1.0 + war - - - jboss - http://repository.jboss.org/nexus/content/groups/public/ - - + + 3.0.14.Final + - - 3.0.14.Final - runtime - + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + - - RestEasyTutorial - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - + - + - - org.jboss.resteasy - jaxrs-api - 3.0.12.Final - ${resteasy.scope} - - - - org.jboss.resteasy - resteasy-servlet-initializer - ${resteasy.version} - ${resteasy.scope} - - - jboss-jaxrs-api_2.0_spec - org.jboss.spec.javax.ws.rs - - - - - - org.jboss.resteasy - resteasy-client - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + - - javax.ws.rs - javax.ws.rs-api - 2.0.1 - + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + - - org.jboss.resteasy - resteasy-jackson-provider - ${resteasy.version} - ${resteasy.scope} - + - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + - + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + - - junit - junit - 4.4 - + - - commons-io - commons-io - 2.4 - + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 3c8d6abc00..3d03c16faf 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -9,35 +9,28 @@ import java.util.List; @Path("/movies") public interface ServicesInterface { - @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Movie movieByImdbId(@QueryParam("imdbId") String imdbId); - @GET @Path("/listmovies") - @Produces({"application/json"}) + @Produces({ "application/json" }) List listMovies(); - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response addMovie(Movie movie); - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response updateMovie(Movie movie); - @DELETE @Path("/deletemovie") Response deleteMovie(@QueryParam("imdbId") String imdbID); - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 7590f10487..5aade4591a 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -5,28 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { - "actors", - "awards", - "country", - "director", - "genre", - "imdbId", - "imdbRating", - "imdbVotes", - "language", - "metascore", - "plot", - "poster", - "rated", - "released", - "response", - "runtime", - "title", - "type", - "writer", - "year" -}) +@XmlType(name = "movie", propOrder = { "actors", "awards", "country", "director", "genre", "imdbId", "imdbRating", "imdbVotes", "language", "metascore", "plot", "poster", "rated", "released", "response", "runtime", "title", "type", "writer", "year" }) public class Movie { protected String actors; @@ -212,37 +191,22 @@ public class Movie { @Override public String toString() { - return "Movie{" + - "actors='" + actors + '\'' + - ", awards='" + awards + '\'' + - ", country='" + country + '\'' + - ", director='" + director + '\'' + - ", genre='" + genre + '\'' + - ", imdbId='" + imdbId + '\'' + - ", imdbRating='" + imdbRating + '\'' + - ", imdbVotes='" + imdbVotes + '\'' + - ", language='" + language + '\'' + - ", metascore='" + metascore + '\'' + - ", poster='" + poster + '\'' + - ", rated='" + rated + '\'' + - ", released='" + released + '\'' + - ", response='" + response + '\'' + - ", runtime='" + runtime + '\'' + - ", title='" + title + '\'' + - ", type='" + type + '\'' + - ", writer='" + writer + '\'' + - ", year='" + year + '\'' + - '}'; + return "Movie{" + "actors='" + actors + '\'' + ", awards='" + awards + '\'' + ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + ", metascore='" + metascore + '\'' + ", poster='" + poster + '\'' + ", rated='" + rated + '\'' + ", released='" + released + '\'' + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + ", title='" + title + '\'' + ", type='" + type + '\'' + ", writer='" + writer + '\'' + ", year='" + year + '\'' + '}'; } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Movie movie = (Movie) o; - if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) + return false; return title != null ? title.equals(movie.title) : movie.title == null; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index bbb3b1e953..6a0699874a 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -13,78 +13,71 @@ import java.util.stream.Collectors; @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); - + private Map inventory = new HashMap(); @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbId)){ + if (inventory.containsKey(imdbId)) { return inventory.get(imdbId); - }else return null; + } else + return null; } - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response addMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response addMovie(Movie movie) { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is Already in the database.").build(); + if (null != inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.CREATED).build(); } - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response updateMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response updateMovie(Movie movie) { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is not in the database.\nUnable to Update").build(); + if (null == inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); } - @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbId){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbId)){ - return Response.status(Response.Status.NOT_FOUND) - .entity("Movie is not in the database.\nUnable to Delete").build(); + if (null == inventory.get(imdbId)) { + return Response.status(Response.Status.NOT_FOUND).entity("Movie is not in the database.\nUnable to Delete").build(); } inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } - @GET @Path("/listmovies") - @Produces({"application/json"}) - public List listMovies(){ + @Produces({ "application/json" }) + public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 84d75934a7..7879603d19 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,16 +1,16 @@ - - - - + + + + - - - - - + + + + + - - + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index 1e7f64004d..d5f00293f4 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -1,13 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> - RestEasy Example + RestEasy Example - - resteasy.servlet.mapping.prefix - /rest - + + resteasy.servlet.mapping.prefix + /rest + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index faa39e0199..3760ae2415 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -21,14 +21,14 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; + Movie transformerMovie = null; + Movie batmanMovie = null; + ObjectMapper jsonMapper = null; @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); jsonMapper.setDateFormat(sdf); @@ -69,7 +69,7 @@ public class RestEasyClientTest { @Test public void testMovieByImdbId() { - String transformerImdbId="tt0418279"; + String transformerImdbId = "tt0418279"; ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); @@ -82,7 +82,6 @@ public class RestEasyClientTest { System.out.println(movies); } - @Test public void testAddMovie() { @@ -99,10 +98,9 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testDeleteMovi1e() { @@ -116,14 +114,13 @@ public class RestEasyClientTest { if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testUpdateMovie() { @@ -137,11 +134,11 @@ public class RestEasyClientTest { moviesResponse = simple.updateMovie(batmanMovie); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json index 28061d5bf9..173901c948 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -16,7 +16,7 @@ "metascore": "66", "imdbRating": "7.6", "imdbVotes": "256,000", - "imdbID": "tt0096895", + "imdbId": "tt0096895", "type": "movie", "response": "True" } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index a3b033a8ba..a4fd061a82 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -16,7 +16,7 @@ "metascore": "61", "imdbRating": "7.1", "imdbVotes": "492,225", - "imdbID": "tt0418279", + "imdbId": "tt0418279", "type": "movie", "response": "True" } \ No newline at end of file From d362112a31f1c283556f94f2a470eed1053dbdd6 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 16:08:15 +0100 Subject: [PATCH 0069/1106] CleanUp and reformatting Code. --- .../src/main/java/com/baeldung/server/MovieCrudService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 6a0699874a..b7f3215f3f 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -26,7 +26,6 @@ public class MovieCrudService { return inventory.get(imdbId); } else return null; - } @POST @@ -41,7 +40,6 @@ public class MovieCrudService { } inventory.put(movie.getImdbId(), movie); - return Response.status(Response.Status.CREATED).build(); } @@ -55,9 +53,9 @@ public class MovieCrudService { if (null == inventory.get(movie.getImdbId())) { return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); - } @DELETE @@ -80,7 +78,6 @@ public class MovieCrudService { public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); - } } From ae772727ce8e66289c6e883c22335d17fbdbdc43 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0070/1106] RestEasy Tutorial, CRUD Services example --- RestEasy Example/pom.xml | 91 +++ .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../baeldung/client/ServicesInterface.java | 44 ++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../src/main/resources/schema1.xsd | 29 + .../main/webapp/WEB-INF/classes/logback.xml | 3 + .../WEB-INF/jboss-deployment-structure.xml | 16 + .../src/main/webapp/WEB-INF/jboss-web.xml | 4 + .../src/main/webapp/WEB-INF/web.xml | 51 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 12 files changed, 979 insertions(+) create mode 100644 RestEasy Example/pom.xml create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/main/resources/schema1.xsd create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/web.xml create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml new file mode 100644 index 0000000000..b16c5e8267 --- /dev/null +++ b/RestEasy Example/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + com.baeldung + resteasy-tutorial + 1.0 + war + + + + jboss + http://repository.jboss.org/nexus/content/groups/public/ + + + + + 3.0.14.Final + runtime + + + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + ${resteasy.scope} + + + jboss-jaxrs-api_2.0_spec + org.jboss.spec.javax.ws.rs + + + + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + ${resteasy.scope} + + + + + javax.ws.rs + javax.ws.rs-api + 2.0.1 + + + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + ${resteasy.scope} + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java new file mode 100644 index 0000000000..53e88961be --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -0,0 +1,44 @@ +package com.baeldung.client; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +public interface ServicesInterface { + + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response addMovie(Movie movie); + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response updateMovie(Movie movie); + + + @DELETE + @Path("/deletemovie") + Response deleteMovie(@QueryParam("imdbID") String imdbID); + + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd new file mode 100644 index 0000000000..0d74b7c366 --- /dev/null +++ b/RestEasy Example/src/main/resources/schema1.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml new file mode 100644 index 0000000000..d94e9f71ab --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000000..84d75934a7 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..694bb71332 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c66d3b56ae --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + RestEasy Example + + + + org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap + + + + RestEasy Example + + + webAppRootKey + RestEasyExample + + + + + + resteasy.servlet.mapping.prefix + /rest + + + + + resteasy-servlet + + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + javax.ws.rs.Application + com.baeldung.server.service.RestEasyServices + + + + + resteasy-servlet + /rest/* + + + + + index.html + + + + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From 09c853477edb3a0cb0f4154b6a8c9077f877ae02 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0071/1106] Added testCase for List All Movies and Add a Movie --- RestEasy Example/pom.xml | 29 +++++ .../baeldung/client/ServicesInterface.java | 6 +- .../java/com/baeldung/{ => model}/Movie.java | 45 +++++++- .../{service => }/MovieCrudService.java | 5 +- .../{service => }/RestEasyServices.java | 2 +- .../com/baeldung/server/RestEasyClient.java | 104 ++++++++++++++---- .../com/baeldung/server/movies/batman.json | 22 ++++ .../baeldung}/server/movies/transformer.json | 2 +- 8 files changed, 184 insertions(+), 31 deletions(-) rename RestEasy Example/src/main/java/com/baeldung/{ => model}/Movie.java (86%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/MovieCrudService.java (96%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/RestEasyServices.java (95%) create mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json rename RestEasy Example/src/test/resources/{ => com/baeldung}/server/movies/transformer.json (99%) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index b16c5e8267..8dabfc863b 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -85,6 +85,35 @@ ${resteasy.scope} + + + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + + com.fasterxml.jackson.core + jackson-core + 2.7.0 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.7.0 + + + + + diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 53e88961be..2585c32438 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,15 +1,13 @@ package com.baeldung.client; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; - +@Path("/movies") public interface ServicesInterface { diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java similarity index 86% rename from RestEasy Example/src/main/java/com/baeldung/Movie.java rename to RestEasy Example/src/main/java/com/baeldung/model/Movie.java index c0041d2e95..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,5 +1,5 @@ -package com.baeldung; +package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -532,4 +532,47 @@ public class Movie { this.year = value; } + @Override + public String toString() { + return "Movie{" + + "actors='" + actors + '\'' + + ", awards='" + awards + '\'' + + ", country='" + country + '\'' + + ", director='" + director + '\'' + + ", genre='" + genre + '\'' + + ", imdbID='" + imdbID + '\'' + + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + + ", language='" + language + '\'' + + ", metascore='" + metascore + '\'' + + ", poster='" + poster + '\'' + + ", rated='" + rated + '\'' + + ", released='" + released + '\'' + + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + + ", title='" + title + '\'' + + ", type='" + type + '\'' + + ", writer='" + writer + '\'' + + ", year='" + year + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Movie movie = (Movie) o; + + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + return title != null ? title.equals(movie.title) : movie.title == null; + + } + + @Override + public int hashCode() { + int result = imdbID != null ? imdbID.hashCode() : 0; + result = 31 * result + (title != null ? title.hashCode() : 0); + return result; + } } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java similarity index 96% rename from RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java rename to RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index d1973e7037..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,11 +1,10 @@ -package com.baeldung.server.service; +package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java similarity index 95% rename from RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java rename to RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 16b6200ad1..8c57d2c9b4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,4 +1,4 @@ -package com.baeldung.server.service; +package com.baeldung.server; import javax.ws.rs.ApplicationPath; diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json new file mode 100644 index 0000000000..28061d5bf9 --- /dev/null +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -0,0 +1,22 @@ +{ + "title": "Batman", + "year": "1989", + "rated": "PG-13", + "released": "23 Jun 1989", + "runtime": "126 min", + "genre": "Action, Adventure", + "director": "Tim Burton", + "writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)", + "actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl", + "plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.", + "language": "English, French", + "country": "USA, UK", + "awards": "Won 1 Oscar. Another 9 wins & 22 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg", + "metascore": "66", + "imdbRating": "7.6", + "imdbVotes": "256,000", + "imdbID": "tt0096895", + "type": "movie", + "response": "True" +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json similarity index 99% rename from RestEasy Example/src/test/resources/server/movies/transformer.json rename to RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index 2154868265..a3b033a8ba 100644 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -17,6 +17,6 @@ "imdbRating": "7.1", "imdbVotes": "492,225", "imdbID": "tt0418279", - "Type": "movie", + "type": "movie", "response": "True" } \ No newline at end of file From 6263054087798e2bf302a2f72f231616b1c5488e Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0072/1106] Added testCase for all Services --- RestEasy Example/pom.xml | 15 -- .../baeldung/client/ServicesInterface.java | 10 +- .../com/baeldung/server/MovieCrudService.java | 15 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../com/baeldung/server/RestEasyClient.java | 112 ----------- .../baeldung/server/RestEasyClientTest.java | 189 ++++++++++++++++++ 6 files changed, 206 insertions(+), 137 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 8dabfc863b..6935238d91 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -99,21 +99,6 @@ 2.4 - - com.fasterxml.jackson.core - jackson-core - 2.7.0 - - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.0 - - - - - diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 2585c32438..7efed546d8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -17,6 +17,12 @@ public interface ServicesInterface { Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -34,9 +40,5 @@ public interface ServicesInterface { Response deleteMovie(@QueryParam("imdbID") String imdbID); - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index c66d3b56ae..ab3bc1aa83 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -33,7 +33,7 @@ javax.ws.rs.Application - com.baeldung.server.service.RestEasyServices + com.baeldung.server.RestEasyServices diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java new file mode 100644 index 0000000000..fb4205bcd7 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -0,0 +1,189 @@ +package com.baeldung.server; + +import com.baeldung.model.Movie; +import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +public class RestEasyClientTest { + + + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; + + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + + @Test + public void testListAllMovies() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testMovieByImdbID() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + + final Movie movies = simple.movieByImdbID(transformerImdbId); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); + + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testDeleteMovie() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(transformerImdbId); + moviesResponse.close(); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testUpdateMovie() { + + try { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file From c57578dba5d51ed62541518498550b6431b71cf6 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0073/1106] Minor Bugfix --- .../baeldung/client/ServicesInterface.java | 4 +- .../main/java/com/baeldung/model/Movie.java | 22 +-- .../com/baeldung/server/MovieCrudService.java | 12 +- .../src/main/webapp/WEB-INF/web.xml | 37 +---- .../java/baeldung/client/RestEasyClient.java | 7 + .../baeldung/server/RestEasyClientTest.java | 149 +++++++----------- 6 files changed, 81 insertions(+), 150 deletions(-) create mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 7efed546d8..749cabc757 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -14,7 +14,7 @@ public interface ServicesInterface { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + Movie movieByImdbId(@QueryParam("imdbId") String imdbId); @GET @@ -37,7 +37,7 @@ public interface ServicesInterface { @DELETE @Path("/deletemovie") - Response deleteMovie(@QueryParam("imdbID") String imdbID); + Response deleteMovie(@QueryParam("imdbId") String imdbID); diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index ab3bc1aa83..f70fdf7975 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,47 +5,12 @@ RestEasy Example - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - RestEasy Example - - - webAppRootKey - RestEasyExample - - - - + resteasy.servlet.mapping.prefix /rest - - resteasy-servlet - - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - javax.ws.rs.Application - com.baeldung.server.RestEasyServices - - - - - resteasy-servlet - /rest/* - - - - - index.html - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java new file mode 100644 index 0000000000..b474b3d4f8 --- /dev/null +++ b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java @@ -0,0 +1,7 @@ +package baeldung.client; + +/** + * Created by Admin on 29/01/2016. + */ +public class RestEasyClient { +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index fb4205bcd7..b6a2e2a0c1 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -1,7 +1,7 @@ package com.baeldung.server; -import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; import org.apache.commons.io.IOUtils; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; @@ -9,7 +9,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import javax.naming.NamingException; @@ -23,22 +22,13 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; Movie batmanMovie=null; ObjectMapper jsonMapper=null; - @BeforeClass - public static void loadMovieInventory(){ - - - - } - @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); @@ -57,133 +47,102 @@ public class RestEasyClientTest { batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); } catch (Exception e) { - e.printStackTrace(); throw new RuntimeException("Test is going to die ...", e); } - } - @Test public void testListAllMovies() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + List movies = simple.listMovies(); + System.out.println(movies); } - @Test - public void testMovieByImdbID() { + public void testMovieByImdbId() { String transformerImdbId="tt0418279"; - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); - final Movie movies = simple.movieByImdbID(transformerImdbId); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + Movie movies = simple.movieByImdbId(transformerImdbId); + System.out.println(movies); } @Test public void testAddMovie() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); - if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test - public void testDeleteMovie() { + public void testDeleteMovi1e() { - String transformerImdbId="tt0418279"; + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.deleteMovie(transformerImdbId); - moviesResponse.close(); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test public void testUpdateMovie() { - try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - batmanMovie.setImdbVotes("300,000"); - moviesResponse = simple.updateMovie(batmanMovie); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } } \ No newline at end of file From 9d3f34d6367e623aac467de603eba275f878e580 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0074/1106] RestEasy Tutorial, CRUD Services example --- .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 5 files changed, 741 insertions(+) create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From fa973988fb4b4d6357eac6bcadf1f3ac4143605a Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0075/1106] Added testCase for List All Movies and Add a Movie --- .../src/main/java/com/baeldung/Movie.java | 535 ------------------ .../main/java/com/baeldung/model/Movie.java | 22 +- .../com/baeldung/server/MovieCrudService.java | 25 +- .../server/service/MovieCrudService.java | 94 --- .../server/service/RestEasyServices.java | 40 -- .../com/baeldung/server/RestEasyClient.java | 104 +++- .../resources/server/movies/transformer.json | 22 - 7 files changed, 104 insertions(+), 738 deletions(-) delete mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java delete mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java delete mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java delete mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java deleted file mode 100644 index c0041d2e95..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ /dev/null @@ -1,535 +0,0 @@ - -package com.baeldung; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { - "actors", - "awards", - "country", - "director", - "genre", - "imdbID", - "imdbRating", - "imdbVotes", - "language", - "metascore", - "plot", - "poster", - "rated", - "released", - "response", - "runtime", - "title", - "type", - "writer", - "year" -}) -public class Movie { - - protected String actors; - protected String awards; - protected String country; - protected String director; - protected String genre; - protected String imdbID; - protected String imdbRating; - protected String imdbVotes; - protected String language; - protected String metascore; - protected String plot; - protected String poster; - protected String rated; - protected String released; - protected String response; - protected String runtime; - protected String title; - protected String type; - protected String writer; - protected String year; - - /** - * Recupera il valore della propriet� actors. - * - * @return - * possible object is - * {@link String } - * - */ - public String getActors() { - return actors; - } - - /** - * Imposta il valore della propriet� actors. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setActors(String value) { - this.actors = value; - } - - /** - * Recupera il valore della propriet� awards. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAwards() { - return awards; - } - - /** - * Imposta il valore della propriet� awards. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAwards(String value) { - this.awards = value; - } - - /** - * Recupera il valore della propriet� country. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCountry() { - return country; - } - - /** - * Imposta il valore della propriet� country. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCountry(String value) { - this.country = value; - } - - /** - * Recupera il valore della propriet� director. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirector() { - return director; - } - - /** - * Imposta il valore della propriet� director. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirector(String value) { - this.director = value; - } - - /** - * Recupera il valore della propriet� genre. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGenre() { - return genre; - } - - /** - * Imposta il valore della propriet� genre. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGenre(String value) { - this.genre = value; - } - - /** - * Recupera il valore della propriet� imdbID. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbID() { - return imdbID; - } - - /** - * Imposta il valore della propriet� imdbID. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbID(String value) { - this.imdbID = value; - } - - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbRating() { - return imdbRating; - } - - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbRating(String value) { - this.imdbRating = value; - } - - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbVotes() { - return imdbVotes; - } - - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbVotes(String value) { - this.imdbVotes = value; - } - - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLanguage() { - return language; - } - - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLanguage(String value) { - this.language = value; - } - - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMetascore() { - return metascore; - } - - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMetascore(String value) { - this.metascore = value; - } - - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPlot() { - return plot; - } - - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPlot(String value) { - this.plot = value; - } - - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoster() { - return poster; - } - - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoster(String value) { - this.poster = value; - } - - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRated() { - return rated; - } - - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRated(String value) { - this.rated = value; - } - - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ - public String getReleased() { - return released; - } - - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setReleased(String value) { - this.released = value; - } - - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponse() { - return response; - } - - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponse(String value) { - this.response = value; - } - - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTitle() { - return title; - } - - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTitle(String value) { - this.title = value; - } - - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWriter() { - return writer; - } - - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWriter(String value) { - this.writer = value; - } - - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ - public String getYear() { - return year; - } - - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setYear(String value) { - this.year = value; - } - -} diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index a2b2bd5250..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbId", + "imdbID", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbId; + protected String imdbID; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbId. + * Recupera il valore della propriet� imdbID. * * @return * possible object is * {@link String } * */ - public String getImdbId() { - return imdbId; + public String getImdbID() { + return imdbID; } /** - * Imposta il valore della propriet� imdbId. + * Imposta il valore della propriet� imdbID. * * @param value * allowed object is * {@link String } * */ - public void setImdbId(String value) { - this.imdbId = value; + public void setImdbID(String value) { + this.imdbID = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbId='" + imdbId + '\'' + + ", imdbID='" + imdbID + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbId != null ? imdbId.hashCode() : 0; + int result = imdbID != null ? imdbID.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,21 +18,18 @@ public class MovieCrudService { private Map inventory = new HashMap(); - @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo for a given ImdbID***"); - - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); - }else return null; + System.out.println("*** Calling getinfo ***"); + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; } - @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -40,12 +37,11 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbId())){ + if (null!=inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +54,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbId())){ + if (null!=inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +66,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ System.out.println("*** Calling deleteMovie ***"); @@ -83,7 +79,6 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } - @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java deleted file mode 100644 index d1973e7037..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.server.service; - -import com.baeldung.Movie; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - - -@Path("/movies") -public class MovieCrudService { - - - private Map inventory = new HashMap(); - - @GET - @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - - System.out.println("*** Calling getinfo ***"); - - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; - } - - @POST - @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response addMovie(Movie movie){ - - System.out.println("*** Calling addMovie ***"); - - if (null!=inventory.get(movie.getImdbID())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is Already in the database.").build(); - } - inventory.put(movie.getImdbID(),movie); - - return Response.status(Response.Status.CREATED).build(); - } - - - @PUT - @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response updateMovie(Movie movie){ - - System.out.println("*** Calling updateMovie ***"); - - if (null!=inventory.get(movie.getImdbID())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is not in the database.\nUnable to Update").build(); - } - inventory.put(movie.getImdbID(),movie); - return Response.status(Response.Status.OK).build(); - - } - - - @DELETE - @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ - - System.out.println("*** Calling deleteMovie ***"); - - if (null==inventory.get(imdbID)){ - return Response.status(Response.Status.NOT_FOUND) - .entity("Movie is not in the database.\nUnable to Delete").build(); - } - - inventory.remove(imdbID); - return Response.status(Response.Status.OK).build(); - } - - @GET - @Path("/listmovies") - @Produces({"application/json"}) - public List listMovies(){ - - return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); - - } - - - -} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java deleted file mode 100644 index 16b6200ad1..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.server.service; - - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * Created by Admin on 29/01/2016. - */ - - - -@ApplicationPath("/rest") -public class RestEasyServices extends Application { - - private Set singletons = new HashSet(); - - public RestEasyServices() { - singletons.add(new MovieCrudService()); - } - - @Override - public Set getSingletons() { - return singletons; - } - - @Override - public Set> getClasses() { - return super.getClasses(); - } - - @Override - public Map getProperties() { - return super.getProperties(); - } -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json deleted file mode 100644 index 2154868265..0000000000 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "title": "Transformers", - "year": "2007", - "rated": "PG-13", - "released": "03 Jul 2007", - "runtime": "144 min", - "genre": "Action, Adventure, Sci-Fi", - "director": "Michael Bay", - "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", - "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", - "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", - "language": "English, Spanish", - "country": "USA", - "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", - "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", - "metascore": "61", - "imdbRating": "7.1", - "imdbVotes": "492,225", - "imdbID": "tt0418279", - "Type": "movie", - "response": "True" -} \ No newline at end of file From 913f2908e0468550647ac32d61db4da23d7093a3 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0076/1106] Added testCase for all Services --- .../baeldung/client/ServicesInterface.java | 6 + .../com/baeldung/server/MovieCrudService.java | 15 ++- .../com/baeldung/server/RestEasyClient.java | 112 ------------------ 3 files changed, 16 insertions(+), 117 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 749cabc757..8898b83483 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -23,6 +23,12 @@ public interface ServicesInterface { List listMovies(); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file From 929a7d7483b6361f28ec19e8513ed7468f2686e8 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0077/1106] Minor Bugfix --- .../baeldung/client/ServicesInterface.java | 6 ----- .../main/java/com/baeldung/model/Movie.java | 22 +++++++++---------- .../com/baeldung/server/MovieCrudService.java | 12 +++++----- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 8898b83483..749cabc757 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -23,12 +23,6 @@ public interface ServicesInterface { List listMovies(); - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); - - @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); From bcad6811a346b82cb38c1a6cbe5d8fc7408450b8 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:39:35 +0100 Subject: [PATCH 0078/1106] Minor Bugfix --- .../main/java/com/baeldung/model/Movie.java | 321 +----------------- 1 file changed, 1 insertion(+), 320 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index a2b2bd5250..805ba95209 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -52,482 +52,163 @@ public class Movie { protected String writer; protected String year; - /** - * Recupera il valore della propriet� actors. - * - * @return - * possible object is - * {@link String } - * - */ + public String getActors() { return actors; } - /** - * Imposta il valore della propriet� actors. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setActors(String value) { this.actors = value; } - /** - * Recupera il valore della propriet� awards. - * - * @return - * possible object is - * {@link String } - * - */ public String getAwards() { return awards; } - /** - * Imposta il valore della propriet� awards. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setAwards(String value) { this.awards = value; } - /** - * Recupera il valore della propriet� country. - * - * @return - * possible object is - * {@link String } - * - */ public String getCountry() { return country; } - /** - * Imposta il valore della propriet� country. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setCountry(String value) { this.country = value; } - /** - * Recupera il valore della propriet� director. - * - * @return - * possible object is - * {@link String } - * - */ public String getDirector() { return director; } - /** - * Imposta il valore della propriet� director. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setDirector(String value) { this.director = value; } - /** - * Recupera il valore della propriet� genre. - * - * @return - * possible object is - * {@link String } - * - */ public String getGenre() { return genre; } - /** - * Imposta il valore della propriet� genre. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setGenre(String value) { this.genre = value; } - /** - * Recupera il valore della propriet� imdbId. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbId() { return imdbId; } - /** - * Imposta il valore della propriet� imdbId. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbId(String value) { this.imdbId = value; } - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbRating() { return imdbRating; } - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbRating(String value) { this.imdbRating = value; } - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbVotes() { return imdbVotes; } - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbVotes(String value) { this.imdbVotes = value; } - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ public String getLanguage() { return language; } - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setLanguage(String value) { this.language = value; } - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ public String getMetascore() { return metascore; } - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setMetascore(String value) { this.metascore = value; } - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ public String getPlot() { return plot; } - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPlot(String value) { this.plot = value; } - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ public String getPoster() { return poster; } - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPoster(String value) { this.poster = value; } - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ public String getRated() { return rated; } - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRated(String value) { this.rated = value; } - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ public String getReleased() { return released; } - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setReleased(String value) { this.released = value; } - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ public String getResponse() { return response; } - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setResponse(String value) { this.response = value; } - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ public String getRuntime() { return runtime; } - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRuntime(String value) { this.runtime = value; } - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ public String getTitle() { return title; } - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setTitle(String value) { this.title = value; } - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ public String getType() { return type; } - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setType(String value) { this.type = value; } - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ public String getWriter() { return writer; } - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setWriter(String value) { this.writer = value; } - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ public String getYear() { return year; } - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setYear(String value) { this.year = value; } From 31fbff34eb181c3898691c778920db10e8ffa18b Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:55:46 +0100 Subject: [PATCH 0079/1106] CleanUp Code --- RestEasy Example/pom.xml | 3 +- .../baeldung/client/ServicesInterface.java | 1 - .../main/java/com/baeldung/model/Movie.java | 2 -- .../com/baeldung/server/MovieCrudService.java | 17 ++++------- .../com/baeldung/server/RestEasyServices.java | 8 ----- .../src/main/resources/schema1.xsd | 29 ------------------- .../src/main/webapp/WEB-INF/web.xml | 3 -- .../java/baeldung/client/RestEasyClient.java | 7 ----- .../baeldung/server/RestEasyClientTest.java | 1 - 9 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 RestEasy Example/src/main/resources/schema1.xsd delete mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 6935238d91..9c890da2b7 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -36,7 +36,7 @@ - + org.jboss.resteasy jaxrs-api @@ -101,5 +101,4 @@ - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 749cabc757..3c8d6abc00 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,7 +1,6 @@ package com.baeldung.client; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 805ba95209..56ba766ff4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,11 +1,9 @@ - package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "movie", propOrder = { "actors", diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..bbb3b1e953 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,7 +1,6 @@ package com.baeldung.server; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -11,23 +10,21 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); + if(inventory.containsKey(imdbId)){ + return inventory.get(imdbId); }else return null; } @@ -70,16 +67,16 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbID)){ + if (null==inventory.get(imdbId)){ return Response.status(Response.Status.NOT_FOUND) .entity("Movie is not in the database.\nUnable to Delete").build(); } - inventory.remove(imdbID); + inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } @@ -93,6 +90,4 @@ public class MovieCrudService { } - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 8c57d2c9b4..7726e49f38 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,19 +1,11 @@ package com.baeldung.server; - import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; -import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.Set; -/** - * Created by Admin on 29/01/2016. - */ - - - @ApplicationPath("/rest") public class RestEasyServices extends Application { diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd deleted file mode 100644 index 0d74b7c366..0000000000 --- a/RestEasy Example/src/main/resources/schema1.xsd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index f70fdf7975..1e7f64004d 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,12 +5,9 @@ RestEasy Example - resteasy.servlet.mapping.prefix /rest - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java deleted file mode 100644 index b474b3d4f8..0000000000 --- a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package baeldung.client; - -/** - * Created by Admin on 29/01/2016. - */ -public class RestEasyClient { -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index b6a2e2a0c1..faa39e0199 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -10,7 +10,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; import org.junit.Test; - import javax.naming.NamingException; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; From 37acdef2a7bbe867416c1e1208cd93a068cd5bbc Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 14:00:11 +0100 Subject: [PATCH 0080/1106] CleanUp and reformatting Code; dependency fix in pom.xml --- RestEasy Example/pom.xml | 147 +++++++----------- .../baeldung/client/ServicesInterface.java | 15 +- .../main/java/com/baeldung/model/Movie.java | 56 ++----- .../com/baeldung/server/MovieCrudService.java | 49 +++--- .../WEB-INF/jboss-deployment-structure.xml | 22 +-- .../src/main/webapp/WEB-INF/web.xml | 14 +- .../baeldung/server/RestEasyClientTest.java | 23 ++- .../com/baeldung/server/movies/batman.json | 2 +- .../baeldung/server/movies/transformer.json | 2 +- 9 files changed, 125 insertions(+), 205 deletions(-) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 9c890da2b7..ec9e87b0d1 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -1,104 +1,77 @@ - - 4.0.0 + + 4.0.0 - com.baeldung - resteasy-tutorial - 1.0 - war + com.baeldung + resteasy-tutorial + 1.0 + war - - - jboss - http://repository.jboss.org/nexus/content/groups/public/ - - + + 3.0.14.Final + - - 3.0.14.Final - runtime - + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + - - RestEasyTutorial - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - + - + - - org.jboss.resteasy - jaxrs-api - 3.0.12.Final - ${resteasy.scope} - - - - org.jboss.resteasy - resteasy-servlet-initializer - ${resteasy.version} - ${resteasy.scope} - - - jboss-jaxrs-api_2.0_spec - org.jboss.spec.javax.ws.rs - - - - - - org.jboss.resteasy - resteasy-client - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + - - javax.ws.rs - javax.ws.rs-api - 2.0.1 - + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + - - org.jboss.resteasy - resteasy-jackson-provider - ${resteasy.version} - ${resteasy.scope} - + - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + - + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + - - junit - junit - 4.4 - + - - commons-io - commons-io - 2.4 - + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 3c8d6abc00..3d03c16faf 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -9,35 +9,28 @@ import java.util.List; @Path("/movies") public interface ServicesInterface { - @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Movie movieByImdbId(@QueryParam("imdbId") String imdbId); - @GET @Path("/listmovies") - @Produces({"application/json"}) + @Produces({ "application/json" }) List listMovies(); - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response addMovie(Movie movie); - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response updateMovie(Movie movie); - @DELETE @Path("/deletemovie") Response deleteMovie(@QueryParam("imdbId") String imdbID); - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 56ba766ff4..a959682a75 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -5,28 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { - "actors", - "awards", - "country", - "director", - "genre", - "imdbId", - "imdbRating", - "imdbVotes", - "language", - "metascore", - "plot", - "poster", - "rated", - "released", - "response", - "runtime", - "title", - "type", - "writer", - "year" -}) +@XmlType(name = "movie", propOrder = { "actors", "awards", "country", "director", "genre", "imdbId", "imdbRating", "imdbVotes", "language", "metascore", "plot", "poster", "rated", "released", "response", "runtime", "title", "type", "writer", "year" }) public class Movie { protected String actors; @@ -213,37 +192,22 @@ public class Movie { @Override public String toString() { - return "Movie{" + - "actors='" + actors + '\'' + - ", awards='" + awards + '\'' + - ", country='" + country + '\'' + - ", director='" + director + '\'' + - ", genre='" + genre + '\'' + - ", imdbId='" + imdbId + '\'' + - ", imdbRating='" + imdbRating + '\'' + - ", imdbVotes='" + imdbVotes + '\'' + - ", language='" + language + '\'' + - ", metascore='" + metascore + '\'' + - ", poster='" + poster + '\'' + - ", rated='" + rated + '\'' + - ", released='" + released + '\'' + - ", response='" + response + '\'' + - ", runtime='" + runtime + '\'' + - ", title='" + title + '\'' + - ", type='" + type + '\'' + - ", writer='" + writer + '\'' + - ", year='" + year + '\'' + - '}'; + return "Movie{" + "actors='" + actors + '\'' + ", awards='" + awards + '\'' + ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + ", metascore='" + metascore + '\'' + ", poster='" + poster + '\'' + ", rated='" + rated + '\'' + ", released='" + released + '\'' + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + ", title='" + title + '\'' + ", type='" + type + '\'' + ", writer='" + writer + '\'' + ", year='" + year + '\'' + '}'; } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Movie movie = (Movie) o; - if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) + return false; return title != null ? title.equals(movie.title) : movie.title == null; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index bbb3b1e953..6a0699874a 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -13,78 +13,71 @@ import java.util.stream.Collectors; @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); - + private Map inventory = new HashMap(); @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbId)){ + if (inventory.containsKey(imdbId)) { return inventory.get(imdbId); - }else return null; + } else + return null; } - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response addMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response addMovie(Movie movie) { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is Already in the database.").build(); + if (null != inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.CREATED).build(); } - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response updateMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response updateMovie(Movie movie) { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is not in the database.\nUnable to Update").build(); + if (null == inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); } - @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbId){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbId)){ - return Response.status(Response.Status.NOT_FOUND) - .entity("Movie is not in the database.\nUnable to Delete").build(); + if (null == inventory.get(imdbId)) { + return Response.status(Response.Status.NOT_FOUND).entity("Movie is not in the database.\nUnable to Delete").build(); } inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } - @GET @Path("/listmovies") - @Produces({"application/json"}) - public List listMovies(){ + @Produces({ "application/json" }) + public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 84d75934a7..7879603d19 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,16 +1,16 @@ - - - - + + + + - - - - - + + + + + - - + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index 1e7f64004d..d5f00293f4 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -1,13 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> - RestEasy Example + RestEasy Example - - resteasy.servlet.mapping.prefix - /rest - + + resteasy.servlet.mapping.prefix + /rest + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index faa39e0199..3760ae2415 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -21,14 +21,14 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; + Movie transformerMovie = null; + Movie batmanMovie = null; + ObjectMapper jsonMapper = null; @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); jsonMapper.setDateFormat(sdf); @@ -69,7 +69,7 @@ public class RestEasyClientTest { @Test public void testMovieByImdbId() { - String transformerImdbId="tt0418279"; + String transformerImdbId = "tt0418279"; ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); @@ -82,7 +82,6 @@ public class RestEasyClientTest { System.out.println(movies); } - @Test public void testAddMovie() { @@ -99,10 +98,9 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testDeleteMovi1e() { @@ -116,14 +114,13 @@ public class RestEasyClientTest { if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testUpdateMovie() { @@ -137,11 +134,11 @@ public class RestEasyClientTest { moviesResponse = simple.updateMovie(batmanMovie); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json index 28061d5bf9..173901c948 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -16,7 +16,7 @@ "metascore": "66", "imdbRating": "7.6", "imdbVotes": "256,000", - "imdbID": "tt0096895", + "imdbId": "tt0096895", "type": "movie", "response": "True" } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index a3b033a8ba..a4fd061a82 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -16,7 +16,7 @@ "metascore": "61", "imdbRating": "7.1", "imdbVotes": "492,225", - "imdbID": "tt0418279", + "imdbId": "tt0418279", "type": "movie", "response": "True" } \ No newline at end of file From 06bbf19265938d444d07841989397369cf01d3fd Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 16:08:15 +0100 Subject: [PATCH 0081/1106] CleanUp and reformatting Code. --- .../src/main/java/com/baeldung/server/MovieCrudService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 6a0699874a..b7f3215f3f 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -26,7 +26,6 @@ public class MovieCrudService { return inventory.get(imdbId); } else return null; - } @POST @@ -41,7 +40,6 @@ public class MovieCrudService { } inventory.put(movie.getImdbId(), movie); - return Response.status(Response.Status.CREATED).build(); } @@ -55,9 +53,9 @@ public class MovieCrudService { if (null == inventory.get(movie.getImdbId())) { return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); - } @DELETE @@ -80,7 +78,6 @@ public class MovieCrudService { public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); - } } From 4d3ce9afe9cf7c73a2955c0852c3b335828f3c3a Mon Sep 17 00:00:00 2001 From: Oleksandr Borkovskyi Date: Tue, 9 Feb 2016 13:59:35 +0200 Subject: [PATCH 0082/1106] Updated test --- .../src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java index 4569019e60..903381bd29 100644 --- a/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java +++ b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java @@ -27,7 +27,7 @@ public class GuavaMiscUtilsTest { List stackTraceElements = Throwables.lazyStackTrace(e); - assertEquals(27, stackTraceElements.size()); + assertTrue(stackTraceElements.size() > 0); } @Test From 420cbb202b3d101b10ea1b4eb9f8784ede50f112 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:27:46 +0200 Subject: [PATCH 0083/1106] Update README.md --- core-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java/README.md b/core-java/README.md index 9a7c0d3776..23fe12465f 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -12,3 +12,4 @@ - [Convert a Map to an Array, List or Set in Java](http://www.baeldung.com/convert-map-values-to-array-list-set) - [Java – Write to File](http://www.baeldung.com/java-write-to-file) - [Java Scanner](http://www.baeldung.com/java-scanner) +- [Java Timer](http://www.baeldung.com/java-timer-and-timertask) From 0757706c4718548c8031ef97be8c702196689977 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:30:27 +0200 Subject: [PATCH 0084/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index 046c6b6cfb..d49ad9088a 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -10,3 +10,4 @@ - [Jackson – Custom Deserializer](http://www.baeldung.com/jackson-deserialization) - [Jackson Exceptions – Problems and Solutions](http://www.baeldung.com/jackson-exception) - [Jackson Date](http://www.baeldung.com/jackson-serialize-dates) +- [Jackson – Bidirectional Relationships](http://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) From 86157e6beeb25cd85221038fbeb7291b48127aef Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:31:59 +0200 Subject: [PATCH 0085/1106] Update README.md --- spring-security-login-and-registration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index a5a9701ff8..57e7fd28f0 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -7,7 +7,7 @@ - [Spring Security Registration Tutorial](http://www.baeldung.com/spring-security-registration) - [The Registration Process With Spring Security](http://www.baeldung.com/registration-with-spring-mvc-and-spring-security) - [Registration – Activate a New Account by Email](http://www.baeldung.com/registration-verify-user-by-email) - +- [Registration with Spring Security – Password Encoding](http://www.baeldung.com/spring-security-registration-password-encoding-bcrypt) ### Build the Project ``` From 58d169cd241c998618969c2ead01eac5b2262ee9 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:33:43 +0200 Subject: [PATCH 0086/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 57e7fd28f0..299d096c37 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -8,6 +8,7 @@ - [The Registration Process With Spring Security](http://www.baeldung.com/registration-with-spring-mvc-and-spring-security) - [Registration – Activate a New Account by Email](http://www.baeldung.com/registration-verify-user-by-email) - [Registration with Spring Security – Password Encoding](http://www.baeldung.com/spring-security-registration-password-encoding-bcrypt) +- [Spring Security – Roles and Privileges](http://www.baeldung.com/role-and-privilege-for-spring-security-registration) ### Build the Project ``` From d806fa3925b681e4e81a74de4a27dc093d267806 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:35:18 +0200 Subject: [PATCH 0087/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index cffbcf40f0..64478589a3 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -13,6 +13,7 @@ - [Integration Testing with the Maven Cargo plugin](http://www.baeldung.com/2011/10/16/how-to-set-up-integration-testing-with-the-maven-cargo-plugin/) - [Introduction to Spring Data JPA](http://www.baeldung.com/2011/12/22/the-persistence-layer-with-spring-data-jpa/) - [Project Configuration with Spring](http://www.baeldung.com/2012/03/12/project-configuration-with-spring/) +- [REST Query Language with Spring and JPA Criteria](http://www.baeldung.com/rest-search-language-spring-jpa-criteria) ### Build the Project From ad0dd95004b88106744065cf68c28770433466bf Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:38:17 +0200 Subject: [PATCH 0088/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index 64478589a3..c5f52f44ad 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -14,6 +14,7 @@ - [Introduction to Spring Data JPA](http://www.baeldung.com/2011/12/22/the-persistence-layer-with-spring-data-jpa/) - [Project Configuration with Spring](http://www.baeldung.com/2012/03/12/project-configuration-with-spring/) - [REST Query Language with Spring and JPA Criteria](http://www.baeldung.com/rest-search-language-spring-jpa-criteria) +- [REST Query Language with Spring Data JPA Specifications](http://www.baeldung.com/rest-api-search-language-spring-data-specifications) ### Build the Project From 00ecb8c947a542eba055e214e3cda4d17a43c903 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:43:43 +0200 Subject: [PATCH 0089/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index c5f52f44ad..e2db0e0307 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -15,6 +15,7 @@ - [Project Configuration with Spring](http://www.baeldung.com/2012/03/12/project-configuration-with-spring/) - [REST Query Language with Spring and JPA Criteria](http://www.baeldung.com/rest-search-language-spring-jpa-criteria) - [REST Query Language with Spring Data JPA Specifications](http://www.baeldung.com/rest-api-search-language-spring-data-specifications) +- [REST Query Language with Spring Data JPA and QueryDSL](http://www.baeldung.com/rest-api-search-language-spring-data-querydsl) ### Build the Project From 2bad287a2eee1acd22deaf9b6ef5c00d08a6d149 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 9 Feb 2016 14:44:49 +0200 Subject: [PATCH 0090/1106] Update README.md --- spring-jpa/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-jpa/README.md b/spring-jpa/README.md index da55ca7b75..f974c6e22c 100644 --- a/spring-jpa/README.md +++ b/spring-jpa/README.md @@ -9,3 +9,4 @@ - [The DAO with JPA and Spring](http://www.baeldung.com/spring-dao-jpa) - [JPA Pagination](http://www.baeldung.com/jpa-pagination) - [Sorting with JPA](http://www.baeldung.com/jpa-sort) +- [Spring JPA – Multiple Databases](http://www.baeldung.com/spring-data-jpa-multiple-databases) From 5d896c28d386e6f86783dac649f0ba10fd1d54ff Mon Sep 17 00:00:00 2001 From: David Morley Date: Wed, 10 Feb 2016 05:14:57 -0600 Subject: [PATCH 0091/1106] Clean up Guava 19 examples --- .../test/java/com/baeldung/guava/GuavaMiscUtilsTest.java | 7 ------- 1 file changed, 7 deletions(-) diff --git a/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java index 903381bd29..c7b8441b78 100644 --- a/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java +++ b/guava19/src/test/java/com/baeldung/guava/GuavaMiscUtilsTest.java @@ -1,16 +1,9 @@ package com.baeldung.guava; -import com.baeldung.guava.entity.User; -import com.google.common.base.CharMatcher; import com.google.common.base.Throwables; import com.google.common.collect.*; -import com.google.common.hash.HashCode; -import com.google.common.hash.HashFunction; -import com.google.common.hash.Hashing; -import com.google.common.reflect.TypeToken; import org.junit.Test; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; From ed0c9aca109f02ea1e68db24df642578c67dc501 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:33:35 +0200 Subject: [PATCH 0092/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 299d096c37..7235ef3bf6 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -9,6 +9,7 @@ - [Registration – Activate a New Account by Email](http://www.baeldung.com/registration-verify-user-by-email) - [Registration with Spring Security – Password Encoding](http://www.baeldung.com/spring-security-registration-password-encoding-bcrypt) - [Spring Security – Roles and Privileges](http://www.baeldung.com/role-and-privilege-for-spring-security-registration) +- [Prevent Brute Force Authentication Attempts with Spring Security](http://www.baeldung.com/spring-security-block-brute-force-authentication-attempts) ### Build the Project ``` From 855c8b153ca209f171750f069bf007ecb520b803 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:34:34 +0200 Subject: [PATCH 0093/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 7235ef3bf6..8f47992c1d 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -10,6 +10,7 @@ - [Registration with Spring Security – Password Encoding](http://www.baeldung.com/spring-security-registration-password-encoding-bcrypt) - [Spring Security – Roles and Privileges](http://www.baeldung.com/role-and-privilege-for-spring-security-registration) - [Prevent Brute Force Authentication Attempts with Spring Security](http://www.baeldung.com/spring-security-block-brute-force-authentication-attempts) +- [Spring Security – Reset Your Password](http://www.baeldung.com/spring-security-registration-i-forgot-my-password) ### Build the Project ``` From 32373392a952a6c5bdb72fbc5754202889e4962c Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:35:55 +0200 Subject: [PATCH 0094/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index e2db0e0307..3df3947d5e 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -16,6 +16,7 @@ - [REST Query Language with Spring and JPA Criteria](http://www.baeldung.com/rest-search-language-spring-jpa-criteria) - [REST Query Language with Spring Data JPA Specifications](http://www.baeldung.com/rest-api-search-language-spring-data-specifications) - [REST Query Language with Spring Data JPA and QueryDSL](http://www.baeldung.com/rest-api-search-language-spring-data-querydsl) +- [REST Query Language – Advanced Search Operations](http://www.baeldung.com/rest-api-query-search-language-more-operations) ### Build the Project From bf6519b860da52ed8491c7bddeb7cc2d7d684dab Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:37:24 +0200 Subject: [PATCH 0095/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 8f47992c1d..5b1980dcbf 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -11,6 +11,7 @@ - [Spring Security – Roles and Privileges](http://www.baeldung.com/role-and-privilege-for-spring-security-registration) - [Prevent Brute Force Authentication Attempts with Spring Security](http://www.baeldung.com/spring-security-block-brute-force-authentication-attempts) - [Spring Security – Reset Your Password](http://www.baeldung.com/spring-security-registration-i-forgot-my-password) +- [Spring Security Registration – Resend Verification Email](http://www.baeldung.com/spring-security-registration-verification-email) ### Build the Project ``` From e051f36401d19a16a0b36af987807a9f48140a22 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:41:29 +0200 Subject: [PATCH 0096/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index 5b1980dcbf..ee565dca65 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -12,6 +12,7 @@ - [Prevent Brute Force Authentication Attempts with Spring Security](http://www.baeldung.com/spring-security-block-brute-force-authentication-attempts) - [Spring Security – Reset Your Password](http://www.baeldung.com/spring-security-registration-i-forgot-my-password) - [Spring Security Registration – Resend Verification Email](http://www.baeldung.com/spring-security-registration-verification-email) +- [The Registration API becomes RESTful](http://www.baeldung.com/registration-restful-api) ### Build the Project ``` From 24a8e3803ce097e584b2b1c46f7ff4b497ce4912 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:42:54 +0200 Subject: [PATCH 0097/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index 3df3947d5e..6b56f4b918 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -17,6 +17,7 @@ - [REST Query Language with Spring Data JPA Specifications](http://www.baeldung.com/rest-api-search-language-spring-data-specifications) - [REST Query Language with Spring Data JPA and QueryDSL](http://www.baeldung.com/rest-api-search-language-spring-data-querydsl) - [REST Query Language – Advanced Search Operations](http://www.baeldung.com/rest-api-query-search-language-more-operations) +- [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) ### Build the Project From 6b0d2165ce7c67a1d367c825dde605e2e121b78a Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:44:08 +0200 Subject: [PATCH 0098/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index ee565dca65..e1b3e61acc 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -13,6 +13,7 @@ - [Spring Security – Reset Your Password](http://www.baeldung.com/spring-security-registration-i-forgot-my-password) - [Spring Security Registration – Resend Verification Email](http://www.baeldung.com/spring-security-registration-verification-email) - [The Registration API becomes RESTful](http://www.baeldung.com/registration-restful-api) +- [Registration – Password Strength and Rules](http://www.baeldung.com/registration-password-strength-and-rules) ### Build the Project ``` From 11065cd00481cc472e9144a4274e7400a3ad53ab Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:45:30 +0200 Subject: [PATCH 0099/1106] Update README.md --- spring-security-login-and-registration/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-login-and-registration/README.md b/spring-security-login-and-registration/README.md index e1b3e61acc..07fb21bfff 100644 --- a/spring-security-login-and-registration/README.md +++ b/spring-security-login-and-registration/README.md @@ -14,6 +14,7 @@ - [Spring Security Registration – Resend Verification Email](http://www.baeldung.com/spring-security-registration-verification-email) - [The Registration API becomes RESTful](http://www.baeldung.com/registration-restful-api) - [Registration – Password Strength and Rules](http://www.baeldung.com/registration-password-strength-and-rules) +- [Updating your Password](http://www.baeldung.com/updating-your-password/) ### Build the Project ``` From 95f51e577bc80b8cafe200d2d9ff5b9732eb9566 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:46:41 +0200 Subject: [PATCH 0100/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index 6b56f4b918..b592f7558c 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -18,6 +18,7 @@ - [REST Query Language with Spring Data JPA and QueryDSL](http://www.baeldung.com/rest-api-search-language-spring-data-querydsl) - [REST Query Language – Advanced Search Operations](http://www.baeldung.com/rest-api-query-search-language-more-operations) - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) +- [REST Query Language with RSQL](http://www.baeldung.com/rest-api-search-language-rsql-fiql) ### Build the Project From 9f3be320b49901d8900cab69d010f50346e579c4 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:47:44 +0200 Subject: [PATCH 0101/1106] Update README.md --- httpclient/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/httpclient/README.md b/httpclient/README.md index 1cf788287c..e06c57da71 100644 --- a/httpclient/README.md +++ b/httpclient/README.md @@ -16,3 +16,4 @@ - [HttpClient Basic Authentication](http://www.baeldung.com/httpclient-4-basic-authentication) - [Multipart Upload with HttpClient 4](http://www.baeldung.com/httpclient-multipart-upload) - [HttpAsyncClient Tutorial](http://www.baeldung.com/httpasyncclient-tutorial) +- [HttpClient 4 Tutorial](http://www.baeldung.com/httpclient-guide) From ac96fae1a7bd262e77ae1e51b650ad2115bf35a3 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:50:01 +0200 Subject: [PATCH 0102/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index d49ad9088a..c17d89912f 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -11,3 +11,4 @@ - [Jackson Exceptions – Problems and Solutions](http://www.baeldung.com/jackson-exception) - [Jackson Date](http://www.baeldung.com/jackson-serialize-dates) - [Jackson – Bidirectional Relationships](http://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) +- [Jackson JSON Tutorial](http://www.baeldung.com/jackson) From dbaf47927008cf4fb467d93a66b55982df354083 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:50:52 +0200 Subject: [PATCH 0103/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index c17d89912f..cd08926386 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -12,3 +12,4 @@ - [Jackson Date](http://www.baeldung.com/jackson-serialize-dates) - [Jackson – Bidirectional Relationships](http://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) - [Jackson JSON Tutorial](http://www.baeldung.com/jackson) +- [Jackson – Working with Maps and nulls](http://www.baeldung.com/jackson-map-null-values-or-null-key) From c273b4eda0ce1a5011dca9c04550d0763309a069 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:52:25 +0200 Subject: [PATCH 0104/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index cd08926386..1a445b701b 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -13,3 +13,4 @@ - [Jackson – Bidirectional Relationships](http://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion) - [Jackson JSON Tutorial](http://www.baeldung.com/jackson) - [Jackson – Working with Maps and nulls](http://www.baeldung.com/jackson-map-null-values-or-null-key) +- [Jackson – Decide What Fields Get Serialized/Deserializaed](http://www.baeldung.com/jackson-field-serializable-deserializable-or-not) From 9bba394195c6d274d4a120cc0be6c0ba869a774d Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 13:53:22 +0200 Subject: [PATCH 0105/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index 1a445b701b..e226721d61 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -14,3 +14,4 @@ - [Jackson JSON Tutorial](http://www.baeldung.com/jackson) - [Jackson – Working with Maps and nulls](http://www.baeldung.com/jackson-map-null-values-or-null-key) - [Jackson – Decide What Fields Get Serialized/Deserializaed](http://www.baeldung.com/jackson-field-serializable-deserializable-or-not) +- [A Guide to Jackson Annotations](http://www.baeldung.com/jackson-annotations) From 6a56dcaa15798e1f6724f3c74683f4e8512778f7 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:03:31 +0200 Subject: [PATCH 0106/1106] Create README.md --- spring-data-mongodb/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spring-data-mongodb/README.md diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md new file mode 100644 index 0000000000..7d194b72c8 --- /dev/null +++ b/spring-data-mongodb/README.md @@ -0,0 +1,7 @@ +========= + +## Spring Data MongoDB + + +### Relevant Articles: +-[A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) From 034c57571330f02a7616ca4406478728c10c42d6 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:03:50 +0200 Subject: [PATCH 0107/1106] Update README.md --- spring-data-mongodb/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md index 7d194b72c8..d92edc8940 100644 --- a/spring-data-mongodb/README.md +++ b/spring-data-mongodb/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: --[A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) +- [A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) From 344c29cc11c84e3de0d042fa448076d5bd63aa24 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:11:27 +0200 Subject: [PATCH 0108/1106] Update README.md --- spring-data-mongodb/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md index d92edc8940..4a140c1be6 100644 --- a/spring-data-mongodb/README.md +++ b/spring-data-mongodb/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) +- [Spring Data MongoDB – Indexes, Annotations and Converters](http://www.baeldung.com/spring-data-mongodb-index-annotations-converter) From 04947776da282b21b1b640bef6d76e9167fe7aa5 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:12:20 +0200 Subject: [PATCH 0109/1106] Update README.md --- spring-data-mongodb/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md index 4a140c1be6..e784176879 100644 --- a/spring-data-mongodb/README.md +++ b/spring-data-mongodb/README.md @@ -6,3 +6,4 @@ ### Relevant Articles: - [A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) - [Spring Data MongoDB – Indexes, Annotations and Converters](http://www.baeldung.com/spring-data-mongodb-index-annotations-converter) +- [Custom Cascading in Spring Data MongoDB](http://www.baeldung.com/cascading-with-dbref-and-lifecycle-events-in-spring-data-mongodb) From 11b30eea02668bf6c54f5e78a48821e843b07672 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:13:27 +0200 Subject: [PATCH 0110/1106] Update README.md --- spring-security-rest-full/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index b592f7558c..c6d6ed5848 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -19,6 +19,7 @@ - [REST Query Language – Advanced Search Operations](http://www.baeldung.com/rest-api-query-search-language-more-operations) - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) - [REST Query Language with RSQL](http://www.baeldung.com/rest-api-search-language-rsql-fiql) +- [Spring RestTemplate Tutorial](http://www.baeldung.com/rest-template) ### Build the Project From 09e896a3577ff8a42c8516f972bdaf8c5abdeeda Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:20:12 +0200 Subject: [PATCH 0111/1106] Create README.md --- spring-katharsis/README.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 spring-katharsis/README.md diff --git a/spring-katharsis/README.md b/spring-katharsis/README.md new file mode 100644 index 0000000000..ec0141f41a --- /dev/null +++ b/spring-katharsis/README.md @@ -0,0 +1,6 @@ +========= + +## Java Web Application + +### Relevant Articles: +- [JSON API in a Java Web Application](http://www.baeldung.com/json-api-java-spring-web-app) From 15b5ac439e675d47bd1151caad401654e129ab92 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:24:04 +0200 Subject: [PATCH 0112/1106] Update README.md --- spring-all/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-all/README.md b/spring-all/README.md index baab7ec083..977b8b7357 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -8,3 +8,4 @@ This project is used to replicate Spring Exceptions only. ### Relevant articles: - [Properties with Spring](http://www.baeldung.com/2012/02/06/properties-with-spring) - checkout the `org.baeldung.properties` package for all scenarios of properties injection and usage - [Spring Profiles](http://www.baeldung.com/spring-profiles) +- [A Spring Custom Annotation for a Better DAO](http://www.baeldung.com/spring-annotation-bean-pre-processor) From 0b55104f32e22152e9dd2657a3359c0f2fe57e85 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:25:03 +0200 Subject: [PATCH 0113/1106] Update README.md --- spring-data-mongodb/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md index e784176879..c5d2d2df41 100644 --- a/spring-data-mongodb/README.md +++ b/spring-data-mongodb/README.md @@ -7,3 +7,4 @@ - [A Guide to Queries in Spring Data MongoDB](http://www.baeldung.com/queries-in-spring-data-mongodb) - [Spring Data MongoDB – Indexes, Annotations and Converters](http://www.baeldung.com/spring-data-mongodb-index-annotations-converter) - [Custom Cascading in Spring Data MongoDB](http://www.baeldung.com/cascading-with-dbref-and-lifecycle-events-in-spring-data-mongodb) +- [GridFS in Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-gridfs) From f602cea186c7fe224b2c537116d4e7db9fe73e97 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:25:49 +0200 Subject: [PATCH 0114/1106] Update README.md --- spring-mvc-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index bf76c7e1d4..113f690920 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -4,3 +4,4 @@ ### Relevant Articles: +- [http://www.baeldung.com/spring-bean-annotations](http://www.baeldung.com/spring-bean-annotations) From d91f7672ff4f8f4b7938be4fd686f3685cce4ac8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:26:17 +0200 Subject: [PATCH 0115/1106] Update README.md --- spring-mvc-java/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 113f690920..ccbd1288f0 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: -- [http://www.baeldung.com/spring-bean-annotations](http://www.baeldung.com/spring-bean-annotations) +- [Spring Bean Annotations](http://www.baeldung.com/spring-bean-annotations) From eb3b30e9b1fa190c26629ef7152607e1c7e02bea Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:27:10 +0200 Subject: [PATCH 0116/1106] Update README.md --- spring-security-rest/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest/README.md b/spring-security-rest/README.md index a3fce32a9c..d17cb24f7e 100644 --- a/spring-security-rest/README.md +++ b/spring-security-rest/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [Spring REST Service Security](http://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/) +- [Setting Up Swagger 2 with a Spring REST API](http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) From 238f5d340f286e64f91da86a0eb49864e29ea4b6 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:28:15 +0200 Subject: [PATCH 0117/1106] Update README.md --- spring-mvc-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index ccbd1288f0..f6bb37b600 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [Spring Bean Annotations](http://www.baeldung.com/spring-bean-annotations) +- [Introduction to Pointcut Expressions in Spring](http://www.baeldung.com/spring-aop-pointcut-tutorial) From fda7b00e6be4707912c038b7d28e74b52964839b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:29:26 +0200 Subject: [PATCH 0118/1106] Update README.md --- spring-mvc-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index f6bb37b600..2de2373149 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -6,3 +6,4 @@ ### Relevant Articles: - [Spring Bean Annotations](http://www.baeldung.com/spring-bean-annotations) - [Introduction to Pointcut Expressions in Spring](http://www.baeldung.com/spring-aop-pointcut-tutorial) +- [Introduction to Advice Types in Spring](http://www.baeldung.com/spring-aop-advice-tutorial) From 03ddc9056e271240838413ddd857d520d2995db2 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:30:23 +0200 Subject: [PATCH 0119/1106] Update README.md --- spring-data-cassandra/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-cassandra/README.md b/spring-data-cassandra/README.md index a245ff62a1..85ea3b8649 100644 --- a/spring-data-cassandra/README.md +++ b/spring-data-cassandra/README.md @@ -2,7 +2,7 @@ ### Relevant Articles: - [Introduction to Spring Data Cassandra](http://www.baeldung.com/spring-data-cassandra-tutorial) - +- [http://www.baeldung.com/spring-data-cassandratemplate-cqltemplate](http://www.baeldung.com/spring-data-cassandratemplate-cqltemplate) ### Build the Project with Tests Running ``` mvn clean install From cde526808ad9c504871c6aa8b7aecb28f2b9542b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:31:11 +0200 Subject: [PATCH 0120/1106] Update README.md --- spring-data-cassandra/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-data-cassandra/README.md b/spring-data-cassandra/README.md index 85ea3b8649..456eefcf18 100644 --- a/spring-data-cassandra/README.md +++ b/spring-data-cassandra/README.md @@ -2,7 +2,8 @@ ### Relevant Articles: - [Introduction to Spring Data Cassandra](http://www.baeldung.com/spring-data-cassandra-tutorial) -- [http://www.baeldung.com/spring-data-cassandratemplate-cqltemplate](http://www.baeldung.com/spring-data-cassandratemplate-cqltemplate) +- [Using the CassandraTemplate from Spring Data](http://www.baeldung.com/spring-data-cassandratemplate-cqltemplate) + ### Build the Project with Tests Running ``` mvn clean install From cd8c2517dbf51fdd0a590afb8ab3b9f000ab62b3 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:32:10 +0200 Subject: [PATCH 0121/1106] Update README.md --- guava18/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guava18/README.md b/guava18/README.md index 8960b4676e..9924d7c16f 100644 --- a/guava18/README.md +++ b/guava18/README.md @@ -7,7 +7,6 @@ - [Guava Collections Cookbook](http://www.baeldung.com/guava-collections) - [Guava Ordering Cookbook](http://www.baeldung.com/guava-order) - [Guava Functional Cookbook](http://www.baeldung.com/guava-functions-predicates) - - [Hamcrest Collections Cookbook](http://www.baeldung.com/hamcrest-collections-arrays) - - [Partition a List in Java](http://www.baeldung.com/java-list-split) +- [Guava 18: What’s New?](http://www.baeldung.com/whats-new-in-guava-18) From f7bd8093d037108b03591e7c32b584b5c495fdba Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:33:03 +0200 Subject: [PATCH 0122/1106] Update README.md --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index e3fa3f9848..62040ba5cf 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: // - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) - [Java – Directory Size](http://www.baeldung.com/java-folder-size) +- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) From 2b4b9fa79c3fdb70590e7ee8f356da6e2cdac740 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:33:55 +0200 Subject: [PATCH 0123/1106] Update README.md --- spring-security-mvc-ldap/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-mvc-ldap/README.md b/spring-security-mvc-ldap/README.md index 260b4b38d8..686f611f99 100644 --- a/spring-security-mvc-ldap/README.md +++ b/spring-security-mvc-ldap/README.md @@ -5,7 +5,7 @@ ### Relevant Article: - [Spring Security - security none, filters none, access permitAll](http://www.baeldung.com/security-none-filters-none-access-permitAll) - [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication) - +- [Intro to Spring Security LDAP](http://www.baeldung.com/spring-security-ldap) ### Notes - the project uses Spring Boot - simply run 'SampleLDAPApplication.java' to start up Spring Boot with a Tomcat container and embedded LDAP server. From 573f4bed69eafd21bbbb3908f538bb746de175dc Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Wed, 10 Feb 2016 14:35:56 +0200 Subject: [PATCH 0124/1106] Update README.md --- spring-batch/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spring-batch/README.md b/spring-batch/README.md index 8b13789179..953e652cea 100644 --- a/spring-batch/README.md +++ b/spring-batch/README.md @@ -1 +1,7 @@ +========= +## Spring Batch + + +### Relevant Articles: +- [Introduction to Spring Batch](http://www.baeldung.com/introduction-to-spring-batch) From ebce69d28d14f77da8c390b92db58d15cd66ce04 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:25:41 +0200 Subject: [PATCH 0125/1106] Update README.md --- spring-data-mongodb/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-mongodb/README.md b/spring-data-mongodb/README.md index c5d2d2df41..d656bc897c 100644 --- a/spring-data-mongodb/README.md +++ b/spring-data-mongodb/README.md @@ -8,3 +8,4 @@ - [Spring Data MongoDB – Indexes, Annotations and Converters](http://www.baeldung.com/spring-data-mongodb-index-annotations-converter) - [Custom Cascading in Spring Data MongoDB](http://www.baeldung.com/cascading-with-dbref-and-lifecycle-events-in-spring-data-mongodb) - [GridFS in Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-gridfs) +- [Introduction to Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-tutorial) From c3e5eb7ccfd942761e01d9b15ed21cf57f8511fe Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:40:35 +0200 Subject: [PATCH 0126/1106] Update README.md --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index 62040ba5cf..ab89bbdaf2 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -6,3 +6,4 @@ // - [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda) - [Java – Directory Size](http://www.baeldung.com/java-folder-size) - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) +- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) From a7cd46c02230f5f589fa58bb60e3873f092de5ec Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:45:49 +0200 Subject: [PATCH 0127/1106] Create README.md --- mockito-mocks-spring-beans/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 mockito-mocks-spring-beans/README.md diff --git a/mockito-mocks-spring-beans/README.md b/mockito-mocks-spring-beans/README.md new file mode 100644 index 0000000000..3ced7161fa --- /dev/null +++ b/mockito-mocks-spring-beans/README.md @@ -0,0 +1,7 @@ +========= + +## Mockito Mocks into Spring Beans + + +### Relevant Articles: +- [Injecting Mockito Mocks into Spring Beans](http://www.baeldung.com/injecting-mocks-in-spring) From fffeb216f5c22fa3399e61d4a0211c0595be9bfc Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:47:43 +0200 Subject: [PATCH 0128/1106] Update README.md --- spring-security-rest/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-security-rest/README.md b/spring-security-rest/README.md index d17cb24f7e..6261fbe83d 100644 --- a/spring-security-rest/README.md +++ b/spring-security-rest/README.md @@ -6,3 +6,4 @@ ### Relevant Articles: - [Spring REST Service Security](http://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/) - [Setting Up Swagger 2 with a Spring REST API](http://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) +- [Custom Error Message Handling for REST API](http://www.baeldung.com/global-error-handler-in-a-spring-rest-api) From ae8d5ca8db2087d120e236c8d1a01d693fb3068b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:48:47 +0200 Subject: [PATCH 0129/1106] Update README.md --- spring-hibernate4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-hibernate4/README.md b/spring-hibernate4/README.md index acf20632fe..4c0c6706d6 100644 --- a/spring-hibernate4/README.md +++ b/spring-hibernate4/README.md @@ -7,6 +7,7 @@ - [The DAO with Spring 3 and Hibernate](http://www.baeldung.com/2011/12/02/the-persistence-layer-with-spring-3-1-and-hibernate/) - [Hibernate Pagination](http://www.baeldung.com/hibernate-pagination) - [Sorting with Hibernate](http://www.baeldung.com/hibernate-sort) +- [Auditing with JPA, Hibernate, and Spring Data JPA](http://www.baeldung.com/database-auditing-jpa) ### Quick Start From 80da6e8668dbe02bcd3777529ec801dafb10e8d9 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:51:08 +0200 Subject: [PATCH 0130/1106] Create README.md --- spring-freemarker/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spring-freemarker/README.md diff --git a/spring-freemarker/README.md b/spring-freemarker/README.md new file mode 100644 index 0000000000..bd939d11e9 --- /dev/null +++ b/spring-freemarker/README.md @@ -0,0 +1,7 @@ +========= + +## Using FreeMarker in Spring MVC + + +### Relevant Articles: +- [Introduction to Using FreeMarker in Spring MVC](http://www.baeldung.com/freemarker-in-spring-mvc-tutorial) From 02ebbd4044ef107f69bc89823827f37064afe50b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:52:17 +0200 Subject: [PATCH 0131/1106] Update README.md --- spring-security-rest-full/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-rest-full/README.md b/spring-security-rest-full/README.md index c6d6ed5848..f648c49244 100644 --- a/spring-security-rest-full/README.md +++ b/spring-security-rest-full/README.md @@ -20,7 +20,7 @@ - [Metrics for your Spring REST API](http://www.baeldung.com/spring-rest-api-metrics) - [REST Query Language with RSQL](http://www.baeldung.com/rest-api-search-language-rsql-fiql) - [Spring RestTemplate Tutorial](http://www.baeldung.com/rest-template) - +- [A Guide to CSRF Protection in Spring Security](http://www.baeldung.com/spring-security-csrf) ### Build the Project ``` From 7011fa40fec956a2bfce298d896129ccccc96354 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:53:18 +0200 Subject: [PATCH 0132/1106] Update README.md --- jackson/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jackson/README.md b/jackson/README.md index e226721d61..53b9c7c31d 100644 --- a/jackson/README.md +++ b/jackson/README.md @@ -15,3 +15,4 @@ - [Jackson – Working with Maps and nulls](http://www.baeldung.com/jackson-map-null-values-or-null-key) - [Jackson – Decide What Fields Get Serialized/Deserializaed](http://www.baeldung.com/jackson-field-serializable-deserializable-or-not) - [A Guide to Jackson Annotations](http://www.baeldung.com/jackson-annotations) +- [Working with Tree Model Nodes in Jackson](http://www.baeldung.com/jackson-json-node-tree-model) From edcb2e2e69edcc25c8f9233a899fab5020a2f7f4 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:54:21 +0200 Subject: [PATCH 0133/1106] Update README.md --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index ab89bbdaf2..8bef3a1be0 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -7,3 +7,4 @@ - [Java – Directory Size](http://www.baeldung.com/java-folder-size) - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) - [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) +- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) From 71ef292b3a18992345b58007cb0b9c26d63ff56c Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 02:56:17 +0200 Subject: [PATCH 0134/1106] Create README.md --- spring-zuul/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spring-zuul/README.md diff --git a/spring-zuul/README.md b/spring-zuul/README.md new file mode 100644 index 0000000000..41a77f70c8 --- /dev/null +++ b/spring-zuul/README.md @@ -0,0 +1,7 @@ +========= + +## Spring REST with a Zuul + + +### Relevant Articles: +- [Spring REST with a Zuul Proxy](http://www.baeldung.com/spring-rest-with-zuul-proxy) From e77e6ebfcf045138cf9e8b2cf9650516d09718e0 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 03:03:08 +0200 Subject: [PATCH 0135/1106] Update README.md --- spring-rest/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-rest/README.md b/spring-rest/README.md index 3b93b06d66..9d373962c4 100644 --- a/spring-rest/README.md +++ b/spring-rest/README.md @@ -7,3 +7,4 @@ - [Spring @RequestMapping](http://www.baeldung.com/spring-requestmapping) - [Http Message Converters with the Spring Framework](http://www.baeldung.com/spring-httpmessageconverter-rest) - [Redirect in Spring](http://www.baeldung.com/spring-redirect-and-forward) +- [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code) From b0d8d832804b8366d025e02f01e5d6ea2821af81 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Thu, 11 Feb 2016 03:04:45 +0200 Subject: [PATCH 0136/1106] Update README.md --- spring-mvc-java/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 2de2373149..e5264b0370 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -7,3 +7,4 @@ - [Spring Bean Annotations](http://www.baeldung.com/spring-bean-annotations) - [Introduction to Pointcut Expressions in Spring](http://www.baeldung.com/spring-aop-pointcut-tutorial) - [Introduction to Advice Types in Spring](http://www.baeldung.com/spring-aop-advice-tutorial) +- [A Guide to the ViewResolver in Spring MVC](http://www.baeldung.com/spring-mvc-view-resolver-tutorial) From 45358317b6b4f33ead9c4d923c3d7d3bf3e7c281 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 13 Feb 2016 22:25:31 +0200 Subject: [PATCH 0137/1106] OpenID Connect example --- spring-openid/.classpath | 32 ++++++++ spring-openid/.project | 48 +++++++++++ spring-openid/pom.xml | 68 ++++++++++++++++ .../config/GoogleOpenIdConnectConfig.java | 51 ++++++++++++ .../org/baeldung/config/HomeController.java | 22 +++++ .../org/baeldung/config/SecurityConfig.java | 49 +++++++++++ .../config/SpringOpenidApplication.java | 13 +++ .../security/OpenIdConnectFilter.java | 71 ++++++++++++++++ .../security/OpenIdConnectUserDetails.java | 81 +++++++++++++++++++ .../src/main/resources/application.properties | 6 ++ 10 files changed, 441 insertions(+) create mode 100644 spring-openid/.classpath create mode 100644 spring-openid/.project create mode 100644 spring-openid/pom.xml create mode 100644 spring-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java create mode 100644 spring-openid/src/main/java/org/baeldung/config/HomeController.java create mode 100644 spring-openid/src/main/java/org/baeldung/config/SecurityConfig.java create mode 100644 spring-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java create mode 100644 spring-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java create mode 100644 spring-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java create mode 100644 spring-openid/src/main/resources/application.properties diff --git a/spring-openid/.classpath b/spring-openid/.classpath new file mode 100644 index 0000000000..0cad5db2d0 --- /dev/null +++ b/spring-openid/.classpath @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-openid/.project b/spring-openid/.project new file mode 100644 index 0000000000..81874eb896 --- /dev/null +++ b/spring-openid/.project @@ -0,0 +1,48 @@ + + + spring-openid + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.springframework.ide.eclipse.core.springnature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/spring-openid/pom.xml b/spring-openid/pom.xml new file mode 100644 index 0000000000..641fe93a09 --- /dev/null +++ b/spring-openid/pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + + org.baeldung + spring-openid + 0.0.1-SNAPSHOT + war + + spring-openid + Spring OpenID sample project + + + org.springframework.boot + spring-boot-starter-parent + 1.3.2.RELEASE + + + + + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.springframework.security.oauth + spring-security-oauth2 + + + + org.springframework.security + spring-security-jwt + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + UTF-8 + 1.8 + + diff --git a/spring-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java b/spring-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java new file mode 100644 index 0000000000..8e9c6e974e --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/config/GoogleOpenIdConnectConfig.java @@ -0,0 +1,51 @@ +package org.baeldung.config; + +import java.util.Arrays; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.client.OAuth2ClientContext; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; +import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails; +import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client; + +@Configuration +@EnableOAuth2Client +public class GoogleOpenIdConnectConfig { + @Value("${google.clientId}") + private String clientId; + + @Value("${google.clientSecret}") + private String clientSecret; + + @Value("${google.accessTokenUri}") + private String accessTokenUri; + + @Value("${google.userAuthorizationUri}") + private String userAuthorizationUri; + + @Value("${google.redirectUri}") + private String redirectUri; + + @Bean + public OAuth2ProtectedResourceDetails googleOpenId() { + final AuthorizationCodeResourceDetails details = new AuthorizationCodeResourceDetails(); + details.setClientId(clientId); + details.setClientSecret(clientSecret); + details.setAccessTokenUri(accessTokenUri); + details.setUserAuthorizationUri(userAuthorizationUri); + details.setScope(Arrays.asList("openid", "email")); + details.setPreEstablishedRedirectUri(redirectUri); + details.setUseCurrentUri(false); + return details; + } + + @Bean + public OAuth2RestTemplate googleOpenIdTemplate(final OAuth2ClientContext clientContext) { + final OAuth2RestTemplate template = new OAuth2RestTemplate(googleOpenId(), clientContext); + return template; + } + +} diff --git a/spring-openid/src/main/java/org/baeldung/config/HomeController.java b/spring-openid/src/main/java/org/baeldung/config/HomeController.java new file mode 100644 index 0000000000..f0a5378019 --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/config/HomeController.java @@ -0,0 +1,22 @@ +package org.baeldung.config; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class HomeController { + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @RequestMapping("/") + @ResponseBody + public final String home() { + final String username = SecurityContextHolder.getContext().getAuthentication().getName(); + logger.info(username); + return "Welcome, " + username; + } + +} diff --git a/spring-openid/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-openid/src/main/java/org/baeldung/config/SecurityConfig.java new file mode 100644 index 0000000000..d929bfd631 --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/config/SecurityConfig.java @@ -0,0 +1,49 @@ +package org.baeldung.config; + +import org.baeldung.security.OpenIdConnectFilter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter; +import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; +import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter; + +@Configuration +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + @Autowired + private OAuth2RestTemplate restTemplate; + + @Override + public void configure(WebSecurity web) throws Exception { + web.ignoring().antMatchers("/resources/**"); + } + + @Bean + public OpenIdConnectFilter myFilter() { + final OpenIdConnectFilter filter = new OpenIdConnectFilter("/google-login"); + filter.setRestTemplate(restTemplate); + return filter; + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + // @formatter:off + http + .addFilterAfter(new OAuth2ClientContextFilter(), AbstractPreAuthenticatedProcessingFilter.class) + .addFilterAfter(myFilter(), OAuth2ClientContextFilter.class) + .httpBasic().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/google-login")) + .and() + .authorizeRequests() + // .antMatchers("/","/index*").permitAll() + .anyRequest().authenticated() + ; + + // @formatter:on + } +} \ No newline at end of file diff --git a/spring-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java b/spring-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java new file mode 100644 index 0000000000..608e8a6819 --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/config/SpringOpenidApplication.java @@ -0,0 +1,13 @@ +package org.baeldung.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringOpenidApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringOpenidApplication.class, args); + } + +} diff --git a/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java b/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java new file mode 100644 index 0000000000..c0970ab3cf --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectFilter.java @@ -0,0 +1,71 @@ +package org.baeldung.security; + +import java.io.IOException; +import java.util.Map; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.jwt.Jwt; +import org.springframework.security.jwt.JwtHelper; +import org.springframework.security.oauth2.client.OAuth2RestOperations; +import org.springframework.security.oauth2.client.OAuth2RestTemplate; +import org.springframework.security.oauth2.common.OAuth2AccessToken; +import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; +import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; +import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class OpenIdConnectFilter extends AbstractAuthenticationProcessingFilter { + public OAuth2RestOperations restTemplate; + + public OpenIdConnectFilter(String defaultFilterProcessesUrl) { + super(defaultFilterProcessesUrl); + setAuthenticationManager(new NoopAuthenticationManager()); + } + + @Override + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { + + OAuth2AccessToken accessToken; + try { + accessToken = restTemplate.getAccessToken(); + } catch (final OAuth2Exception e) { + throw new BadCredentialsException("Could not obtain access token", e); + } + try { + final String idToken = accessToken.getAdditionalInformation().get("id_token").toString(); + final Jwt tokenDecoded = JwtHelper.decode(idToken); + System.out.println("===== : " + tokenDecoded.getClaims()); + + final Map authInfo = new ObjectMapper().readValue(tokenDecoded.getClaims(), Map.class); + + final OpenIdConnectUserDetails user = new OpenIdConnectUserDetails(authInfo, accessToken); + return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities()); + } catch (final InvalidTokenException e) { + throw new BadCredentialsException("Could not obtain user details from token", e); + } + + } + + public void setRestTemplate(OAuth2RestTemplate restTemplate2) { + restTemplate = restTemplate2; + + } + + private static class NoopAuthenticationManager implements AuthenticationManager { + + @Override + public Authentication authenticate(Authentication authentication) throws AuthenticationException { + throw new UnsupportedOperationException("No authentication should be done with this AuthenticationManager"); + } + + } +} diff --git a/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java b/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java new file mode 100644 index 0000000000..f0d91fdc27 --- /dev/null +++ b/spring-openid/src/main/java/org/baeldung/security/OpenIdConnectUserDetails.java @@ -0,0 +1,81 @@ +package org.baeldung.security; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Map; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.oauth2.common.OAuth2AccessToken; + +public class OpenIdConnectUserDetails implements UserDetails { + + private static final long serialVersionUID = 1L; + + private String userId; + private String username; + private OAuth2AccessToken token; + + public OpenIdConnectUserDetails(Map userInfo, OAuth2AccessToken token) { + this.userId = userInfo.get("sub"); + this.username = userInfo.get("email"); + this.token = token; + } + + @Override + public String getUsername() { + return username; + } + + @Override + public Collection getAuthorities() { + return Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public OAuth2AccessToken getToken() { + return token; + } + + public void setToken(OAuth2AccessToken token) { + this.token = token; + } + + public void setUsername(String username) { + this.username = username; + } + + @Override + public String getPassword() { + return null; + } + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return true; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } + +} diff --git a/spring-openid/src/main/resources/application.properties b/spring-openid/src/main/resources/application.properties new file mode 100644 index 0000000000..fa567a164c --- /dev/null +++ b/spring-openid/src/main/resources/application.properties @@ -0,0 +1,6 @@ +server.port=8081 +google.clientId=497324626536-d6fphsh1qpl2o6j2j66nukajrfqc0rtq.apps.googleusercontent.com +google.clientSecret=vtueZycMsrRjjCjnY6JzbEZT +google.accessTokenUri=https://www.googleapis.com/oauth2/v3/token +google.userAuthorizationUri=https://accounts.google.com/o/oauth2/auth +google.redirectUri=http://localhost:8081/google-login \ No newline at end of file From 4b5ad0629a854078437e8248bbbf341165f7e4f8 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0138/1106] RestEasy Tutorial, CRUD Services example --- RestEasy Example/pom.xml | 91 +++ .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../baeldung/client/ServicesInterface.java | 44 ++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../src/main/resources/schema1.xsd | 29 + .../main/webapp/WEB-INF/classes/logback.xml | 3 + .../WEB-INF/jboss-deployment-structure.xml | 16 + .../src/main/webapp/WEB-INF/jboss-web.xml | 4 + .../src/main/webapp/WEB-INF/web.xml | 51 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 12 files changed, 979 insertions(+) create mode 100644 RestEasy Example/pom.xml create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/main/resources/schema1.xsd create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml create mode 100644 RestEasy Example/src/main/webapp/WEB-INF/web.xml create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml new file mode 100644 index 0000000000..b16c5e8267 --- /dev/null +++ b/RestEasy Example/pom.xml @@ -0,0 +1,91 @@ + + + 4.0.0 + + com.baeldung + resteasy-tutorial + 1.0 + war + + + + jboss + http://repository.jboss.org/nexus/content/groups/public/ + + + + + 3.0.14.Final + runtime + + + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + org.jboss.resteasy + jaxrs-api + 3.0.12.Final + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + ${resteasy.scope} + + + jboss-jaxrs-api_2.0_spec + org.jboss.spec.javax.ws.rs + + + + + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + ${resteasy.scope} + + + + + javax.ws.rs + javax.ws.rs-api + 2.0.1 + + + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + ${resteasy.scope} + + + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + ${resteasy.scope} + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java new file mode 100644 index 0000000000..53e88961be --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -0,0 +1,44 @@ +package com.baeldung.client; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +public interface ServicesInterface { + + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response addMovie(Movie movie); + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + Response updateMovie(Movie movie); + + + @DELETE + @Path("/deletemovie") + Response deleteMovie(@QueryParam("imdbID") String imdbID); + + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd new file mode 100644 index 0000000000..0d74b7c366 --- /dev/null +++ b/RestEasy Example/src/main/resources/schema1.xsd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml new file mode 100644 index 0000000000..d94e9f71ab --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000000..84d75934a7 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..694bb71332 --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c66d3b56ae --- /dev/null +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,51 @@ + + + + RestEasy Example + + + + org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap + + + + RestEasy Example + + + webAppRootKey + RestEasyExample + + + + + + resteasy.servlet.mapping.prefix + /rest + + + + + resteasy-servlet + + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + javax.ws.rs.Application + com.baeldung.server.service.RestEasyServices + + + + + resteasy-servlet + /rest/* + + + + + index.html + + + + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From 663def8e2c00957b8913afcb118bde494c85f987 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0139/1106] Added testCase for List All Movies and Add a Movie --- RestEasy Example/pom.xml | 29 +++++ .../baeldung/client/ServicesInterface.java | 6 +- .../java/com/baeldung/{ => model}/Movie.java | 45 +++++++- .../{service => }/MovieCrudService.java | 5 +- .../{service => }/RestEasyServices.java | 2 +- .../com/baeldung/server/RestEasyClient.java | 104 ++++++++++++++---- .../com/baeldung/server/movies/batman.json | 22 ++++ .../baeldung}/server/movies/transformer.json | 2 +- 8 files changed, 184 insertions(+), 31 deletions(-) rename RestEasy Example/src/main/java/com/baeldung/{ => model}/Movie.java (86%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/MovieCrudService.java (96%) rename RestEasy Example/src/main/java/com/baeldung/server/{service => }/RestEasyServices.java (95%) create mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json rename RestEasy Example/src/test/resources/{ => com/baeldung}/server/movies/transformer.json (99%) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index b16c5e8267..8dabfc863b 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -85,6 +85,35 @@ ${resteasy.scope} + + + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + + com.fasterxml.jackson.core + jackson-core + 2.7.0 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.7.0 + + + + + diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 53e88961be..2585c32438 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,15 +1,13 @@ package com.baeldung.client; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; - +@Path("/movies") public interface ServicesInterface { diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java similarity index 86% rename from RestEasy Example/src/main/java/com/baeldung/Movie.java rename to RestEasy Example/src/main/java/com/baeldung/model/Movie.java index c0041d2e95..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,5 +1,5 @@ -package com.baeldung; +package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -532,4 +532,47 @@ public class Movie { this.year = value; } + @Override + public String toString() { + return "Movie{" + + "actors='" + actors + '\'' + + ", awards='" + awards + '\'' + + ", country='" + country + '\'' + + ", director='" + director + '\'' + + ", genre='" + genre + '\'' + + ", imdbID='" + imdbID + '\'' + + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + + ", language='" + language + '\'' + + ", metascore='" + metascore + '\'' + + ", poster='" + poster + '\'' + + ", rated='" + rated + '\'' + + ", released='" + released + '\'' + + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + + ", title='" + title + '\'' + + ", type='" + type + '\'' + + ", writer='" + writer + '\'' + + ", year='" + year + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Movie movie = (Movie) o; + + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + return title != null ? title.equals(movie.title) : movie.title == null; + + } + + @Override + public int hashCode() { + int result = imdbID != null ? imdbID.hashCode() : 0; + result = 31 * result + (title != null ? title.hashCode() : 0); + return result; + } } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java similarity index 96% rename from RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java rename to RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index d1973e7037..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,11 +1,10 @@ -package com.baeldung.server.service; +package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java similarity index 95% rename from RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java rename to RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 16b6200ad1..8c57d2c9b4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,4 +1,4 @@ -package com.baeldung.server.service; +package com.baeldung.server; import javax.ws.rs.ApplicationPath; diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json new file mode 100644 index 0000000000..28061d5bf9 --- /dev/null +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -0,0 +1,22 @@ +{ + "title": "Batman", + "year": "1989", + "rated": "PG-13", + "released": "23 Jun 1989", + "runtime": "126 min", + "genre": "Action, Adventure", + "director": "Tim Burton", + "writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)", + "actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl", + "plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.", + "language": "English, French", + "country": "USA, UK", + "awards": "Won 1 Oscar. Another 9 wins & 22 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg", + "metascore": "66", + "imdbRating": "7.6", + "imdbVotes": "256,000", + "imdbID": "tt0096895", + "type": "movie", + "response": "True" +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json similarity index 99% rename from RestEasy Example/src/test/resources/server/movies/transformer.json rename to RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index 2154868265..a3b033a8ba 100644 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -17,6 +17,6 @@ "imdbRating": "7.1", "imdbVotes": "492,225", "imdbID": "tt0418279", - "Type": "movie", + "type": "movie", "response": "True" } \ No newline at end of file From b39ec7d76ee55ffe0165aa82ff23f2da3bd8475c Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0140/1106] Added testCase for all Services --- RestEasy Example/pom.xml | 15 -- .../baeldung/client/ServicesInterface.java | 10 +- .../com/baeldung/server/MovieCrudService.java | 15 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../com/baeldung/server/RestEasyClient.java | 112 ----------- .../baeldung/server/RestEasyClientTest.java | 189 ++++++++++++++++++ 6 files changed, 206 insertions(+), 137 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 8dabfc863b..6935238d91 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -99,21 +99,6 @@ 2.4 - - com.fasterxml.jackson.core - jackson-core - 2.7.0 - - - - com.fasterxml.jackson.core - jackson-annotations - 2.7.0 - - - - - diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 2585c32438..7efed546d8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -17,6 +17,12 @@ public interface ServicesInterface { Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -34,9 +40,5 @@ public interface ServicesInterface { Response deleteMovie(@QueryParam("imdbID") String imdbID); - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index c66d3b56ae..ab3bc1aa83 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -33,7 +33,7 @@ javax.ws.rs.Application - com.baeldung.server.service.RestEasyServices + com.baeldung.server.RestEasyServices diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java new file mode 100644 index 0000000000..fb4205bcd7 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -0,0 +1,189 @@ +package com.baeldung.server; + +import com.baeldung.model.Movie; +import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +public class RestEasyClientTest { + + + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; + + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + + @Test + public void testListAllMovies() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testMovieByImdbID() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + + final Movie movies = simple.movieByImdbID(transformerImdbId); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); + + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testDeleteMovie() { + + String transformerImdbId="tt0418279"; + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(transformerImdbId); + moviesResponse.close(); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + @Test + public void testUpdateMovie() { + + try { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + //System.out.println(moviesResponse.readEntity(String.class)); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} \ No newline at end of file From 5cdf7185a4eed764473b76b365f14c2737f7c0bb Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0141/1106] Minor Bugfix --- .../baeldung/client/ServicesInterface.java | 4 +- .../main/java/com/baeldung/model/Movie.java | 22 +-- .../com/baeldung/server/MovieCrudService.java | 12 +- .../src/main/webapp/WEB-INF/web.xml | 37 +---- .../java/baeldung/client/RestEasyClient.java | 7 + .../baeldung/server/RestEasyClientTest.java | 149 +++++++----------- 6 files changed, 81 insertions(+), 150 deletions(-) create mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 7efed546d8..749cabc757 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -14,7 +14,7 @@ public interface ServicesInterface { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - Movie movieByImdbID(@QueryParam("imdbID") String imdbID); + Movie movieByImdbId(@QueryParam("imdbId") String imdbId); @GET @@ -37,7 +37,7 @@ public interface ServicesInterface { @DELETE @Path("/deletemovie") - Response deleteMovie(@QueryParam("imdbID") String imdbID); + Response deleteMovie(@QueryParam("imdbId") String imdbID); diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index ab3bc1aa83..f70fdf7975 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,47 +5,12 @@ RestEasy Example - - - org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap - - - - RestEasy Example - - - webAppRootKey - RestEasyExample - - - - + resteasy.servlet.mapping.prefix /rest - - resteasy-servlet - - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - javax.ws.rs.Application - com.baeldung.server.RestEasyServices - - - - - resteasy-servlet - /rest/* - - - - - index.html - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java new file mode 100644 index 0000000000..b474b3d4f8 --- /dev/null +++ b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java @@ -0,0 +1,7 @@ +package baeldung.client; + +/** + * Created by Admin on 29/01/2016. + */ +public class RestEasyClient { +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index fb4205bcd7..b6a2e2a0c1 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -1,7 +1,7 @@ package com.baeldung.server; -import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; import org.apache.commons.io.IOUtils; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; @@ -9,7 +9,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import javax.naming.NamingException; @@ -23,22 +22,13 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; Movie batmanMovie=null; ObjectMapper jsonMapper=null; - @BeforeClass - public static void loadMovieInventory(){ - - - - } - @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); @@ -57,133 +47,102 @@ public class RestEasyClientTest { batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); } catch (Exception e) { - e.printStackTrace(); throw new RuntimeException("Test is going to die ...", e); } - } - @Test public void testListAllMovies() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + List movies = simple.listMovies(); + System.out.println(movies); } - @Test - public void testMovieByImdbID() { + public void testMovieByImdbId() { String transformerImdbId="tt0418279"; - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); - final Movie movies = simple.movieByImdbID(transformerImdbId); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } + Movie movies = simple.movieByImdbId(transformerImdbId); + System.out.println(movies); } @Test public void testAddMovie() { - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); - if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test - public void testDeleteMovie() { + public void testDeleteMovi1e() { - String transformerImdbId="tt0418279"; + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.deleteMovie(transformerImdbId); - moviesResponse.close(); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } @Test public void testUpdateMovie() { - try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setImdbVotes("300,000"); + moviesResponse = simple.updateMovie(batmanMovie); - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - batmanMovie.setImdbVotes("300,000"); - moviesResponse = simple.updateMovie(batmanMovie); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - //System.out.println(moviesResponse.readEntity(String.class)); - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } + + moviesResponse.close(); + System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); } } \ No newline at end of file From 9b5818262decbcfcfc302ab15c5f3347dbaeecfd Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sat, 30 Jan 2016 17:48:56 +0100 Subject: [PATCH 0142/1106] RestEasy Tutorial, CRUD Services example --- .../src/main/java/com/baeldung/Movie.java | 535 ++++++++++++++++++ .../server/service/MovieCrudService.java | 94 +++ .../server/service/RestEasyServices.java | 40 ++ .../com/baeldung/server/RestEasyClient.java | 50 ++ .../resources/server/movies/transformer.json | 22 + 5 files changed, 741 insertions(+) create mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java create mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java create mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java create mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java new file mode 100644 index 0000000000..c0041d2e95 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/Movie.java @@ -0,0 +1,535 @@ + +package com.baeldung; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "movie", propOrder = { + "actors", + "awards", + "country", + "director", + "genre", + "imdbID", + "imdbRating", + "imdbVotes", + "language", + "metascore", + "plot", + "poster", + "rated", + "released", + "response", + "runtime", + "title", + "type", + "writer", + "year" +}) +public class Movie { + + protected String actors; + protected String awards; + protected String country; + protected String director; + protected String genre; + protected String imdbID; + protected String imdbRating; + protected String imdbVotes; + protected String language; + protected String metascore; + protected String plot; + protected String poster; + protected String rated; + protected String released; + protected String response; + protected String runtime; + protected String title; + protected String type; + protected String writer; + protected String year; + + /** + * Recupera il valore della propriet� actors. + * + * @return + * possible object is + * {@link String } + * + */ + public String getActors() { + return actors; + } + + /** + * Imposta il valore della propriet� actors. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setActors(String value) { + this.actors = value; + } + + /** + * Recupera il valore della propriet� awards. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAwards() { + return awards; + } + + /** + * Imposta il valore della propriet� awards. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAwards(String value) { + this.awards = value; + } + + /** + * Recupera il valore della propriet� country. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCountry() { + return country; + } + + /** + * Imposta il valore della propriet� country. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCountry(String value) { + this.country = value; + } + + /** + * Recupera il valore della propriet� director. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDirector() { + return director; + } + + /** + * Imposta il valore della propriet� director. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDirector(String value) { + this.director = value; + } + + /** + * Recupera il valore della propriet� genre. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGenre() { + return genre; + } + + /** + * Imposta il valore della propriet� genre. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGenre(String value) { + this.genre = value; + } + + /** + * Recupera il valore della propriet� imdbID. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbID() { + return imdbID; + } + + /** + * Imposta il valore della propriet� imdbID. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbID(String value) { + this.imdbID = value; + } + + /** + * Recupera il valore della propriet� imdbRating. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbRating() { + return imdbRating; + } + + /** + * Imposta il valore della propriet� imdbRating. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbRating(String value) { + this.imdbRating = value; + } + + /** + * Recupera il valore della propriet� imdbVotes. + * + * @return + * possible object is + * {@link String } + * + */ + public String getImdbVotes() { + return imdbVotes; + } + + /** + * Imposta il valore della propriet� imdbVotes. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setImdbVotes(String value) { + this.imdbVotes = value; + } + + /** + * Recupera il valore della propriet� language. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLanguage() { + return language; + } + + /** + * Imposta il valore della propriet� language. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLanguage(String value) { + this.language = value; + } + + /** + * Recupera il valore della propriet� metascore. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMetascore() { + return metascore; + } + + /** + * Imposta il valore della propriet� metascore. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMetascore(String value) { + this.metascore = value; + } + + /** + * Recupera il valore della propriet� plot. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlot() { + return plot; + } + + /** + * Imposta il valore della propriet� plot. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlot(String value) { + this.plot = value; + } + + /** + * Recupera il valore della propriet� poster. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoster() { + return poster; + } + + /** + * Imposta il valore della propriet� poster. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoster(String value) { + this.poster = value; + } + + /** + * Recupera il valore della propriet� rated. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRated() { + return rated; + } + + /** + * Imposta il valore della propriet� rated. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRated(String value) { + this.rated = value; + } + + /** + * Recupera il valore della propriet� released. + * + * @return + * possible object is + * {@link String } + * + */ + public String getReleased() { + return released; + } + + /** + * Imposta il valore della propriet� released. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setReleased(String value) { + this.released = value; + } + + /** + * Recupera il valore della propriet� response. + * + * @return + * possible object is + * {@link String } + * + */ + public String getResponse() { + return response; + } + + /** + * Imposta il valore della propriet� response. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setResponse(String value) { + this.response = value; + } + + /** + * Recupera il valore della propriet� runtime. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuntime() { + return runtime; + } + + /** + * Imposta il valore della propriet� runtime. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuntime(String value) { + this.runtime = value; + } + + /** + * Recupera il valore della propriet� title. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Imposta il valore della propriet� title. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Recupera il valore della propriet� type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Imposta il valore della propriet� type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Recupera il valore della propriet� writer. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWriter() { + return writer; + } + + /** + * Imposta il valore della propriet� writer. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWriter(String value) { + this.writer = value; + } + + /** + * Recupera il valore della propriet� year. + * + * @return + * possible object is + * {@link String } + * + */ + public String getYear() { + return year; + } + + /** + * Imposta il valore della propriet� year. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setYear(String value) { + this.year = value; + } + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java new file mode 100644 index 0000000000..d1973e7037 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java @@ -0,0 +1,94 @@ +package com.baeldung.server.service; + +import com.baeldung.Movie; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Provider; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + + +@Path("/movies") +public class MovieCrudService { + + + private Map inventory = new HashMap(); + + @GET + @Path("/getinfo") + @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling getinfo ***"); + + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; + } + + @POST + @Path("/addmovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response addMovie(Movie movie){ + + System.out.println("*** Calling addMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is Already in the database.").build(); + } + inventory.put(movie.getImdbID(),movie); + + return Response.status(Response.Status.CREATED).build(); + } + + + @PUT + @Path("/updatemovie") + @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + public Response updateMovie(Movie movie){ + + System.out.println("*** Calling updateMovie ***"); + + if (null!=inventory.get(movie.getImdbID())){ + return Response.status(Response.Status.NOT_MODIFIED) + .entity("Movie is not in the database.\nUnable to Update").build(); + } + inventory.put(movie.getImdbID(),movie); + return Response.status(Response.Status.OK).build(); + + } + + + @DELETE + @Path("/deletemovie") + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + + System.out.println("*** Calling deleteMovie ***"); + + if (null==inventory.get(imdbID)){ + return Response.status(Response.Status.NOT_FOUND) + .entity("Movie is not in the database.\nUnable to Delete").build(); + } + + inventory.remove(imdbID); + return Response.status(Response.Status.OK).build(); + } + + @GET + @Path("/listmovies") + @Produces({"application/json"}) + public List listMovies(){ + + return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); + + } + + + +} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java new file mode 100644 index 0000000000..16b6200ad1 --- /dev/null +++ b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java @@ -0,0 +1,40 @@ +package com.baeldung.server.service; + + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Created by Admin on 29/01/2016. + */ + + + +@ApplicationPath("/rest") +public class RestEasyServices extends Application { + + private Set singletons = new HashSet(); + + public RestEasyServices() { + singletons.add(new MovieCrudService()); + } + + @Override + public Set getSingletons() { + return singletons; + } + + @Override + public Set> getClasses() { + return super.getClasses(); + } + + @Override + public Map getProperties() { + return super.getProperties(); + } +} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java new file mode 100644 index 0000000000..e711233979 --- /dev/null +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -0,0 +1,50 @@ +package com.baeldung.server; + +import com.baeldung.Movie; +import com.baeldung.client.ServicesInterface; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; + +import java.util.List; + +public class RestEasyClient { + + public static void main(String[] args) { + + Movie st = new Movie(); + st.setImdbID("12345"); + + /* + * Alternatively you can use this simple String to send + * instead of using a Student instance + * + * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; + */ + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + + ServicesInterface simple = target.proxy(ServicesInterface.class); + final List movies = simple.listMovies(); + + /* + if (response.getStatus() != 200) { + throw new RuntimeException("Failed : HTTP error code : " + + response.getStatus()); + } + + System.out.println("Server response : \n"); + System.out.println(response.readEntity(String.class)); + + response.close(); +*/ + } catch (Exception e) { + + e.printStackTrace(); + + } + } + +} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json new file mode 100644 index 0000000000..2154868265 --- /dev/null +++ b/RestEasy Example/src/test/resources/server/movies/transformer.json @@ -0,0 +1,22 @@ +{ + "title": "Transformers", + "year": "2007", + "rated": "PG-13", + "released": "03 Jul 2007", + "runtime": "144 min", + "genre": "Action, Adventure, Sci-Fi", + "director": "Michael Bay", + "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", + "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", + "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", + "language": "English, Spanish", + "country": "USA", + "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", + "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", + "metascore": "61", + "imdbRating": "7.1", + "imdbVotes": "492,225", + "imdbID": "tt0418279", + "Type": "movie", + "response": "True" +} \ No newline at end of file From df982db26b1a356a77b0b9eaf1ba6e2bb32c9b51 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 30 Jan 2016 20:39:28 +0100 Subject: [PATCH 0143/1106] Added testCase for List All Movies and Add a Movie --- .../src/main/java/com/baeldung/Movie.java | 535 ------------------ .../main/java/com/baeldung/model/Movie.java | 22 +- .../com/baeldung/server/MovieCrudService.java | 25 +- .../server/service/MovieCrudService.java | 94 --- .../server/service/RestEasyServices.java | 40 -- .../com/baeldung/server/RestEasyClient.java | 104 +++- .../resources/server/movies/transformer.json | 22 - 7 files changed, 104 insertions(+), 738 deletions(-) delete mode 100644 RestEasy Example/src/main/java/com/baeldung/Movie.java delete mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java delete mode 100644 RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java delete mode 100644 RestEasy Example/src/test/resources/server/movies/transformer.json diff --git a/RestEasy Example/src/main/java/com/baeldung/Movie.java b/RestEasy Example/src/main/java/com/baeldung/Movie.java deleted file mode 100644 index c0041d2e95..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/Movie.java +++ /dev/null @@ -1,535 +0,0 @@ - -package com.baeldung; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { - "actors", - "awards", - "country", - "director", - "genre", - "imdbID", - "imdbRating", - "imdbVotes", - "language", - "metascore", - "plot", - "poster", - "rated", - "released", - "response", - "runtime", - "title", - "type", - "writer", - "year" -}) -public class Movie { - - protected String actors; - protected String awards; - protected String country; - protected String director; - protected String genre; - protected String imdbID; - protected String imdbRating; - protected String imdbVotes; - protected String language; - protected String metascore; - protected String plot; - protected String poster; - protected String rated; - protected String released; - protected String response; - protected String runtime; - protected String title; - protected String type; - protected String writer; - protected String year; - - /** - * Recupera il valore della propriet� actors. - * - * @return - * possible object is - * {@link String } - * - */ - public String getActors() { - return actors; - } - - /** - * Imposta il valore della propriet� actors. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setActors(String value) { - this.actors = value; - } - - /** - * Recupera il valore della propriet� awards. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAwards() { - return awards; - } - - /** - * Imposta il valore della propriet� awards. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAwards(String value) { - this.awards = value; - } - - /** - * Recupera il valore della propriet� country. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCountry() { - return country; - } - - /** - * Imposta il valore della propriet� country. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCountry(String value) { - this.country = value; - } - - /** - * Recupera il valore della propriet� director. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDirector() { - return director; - } - - /** - * Imposta il valore della propriet� director. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDirector(String value) { - this.director = value; - } - - /** - * Recupera il valore della propriet� genre. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGenre() { - return genre; - } - - /** - * Imposta il valore della propriet� genre. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGenre(String value) { - this.genre = value; - } - - /** - * Recupera il valore della propriet� imdbID. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbID() { - return imdbID; - } - - /** - * Imposta il valore della propriet� imdbID. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbID(String value) { - this.imdbID = value; - } - - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbRating() { - return imdbRating; - } - - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbRating(String value) { - this.imdbRating = value; - } - - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ - public String getImdbVotes() { - return imdbVotes; - } - - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setImdbVotes(String value) { - this.imdbVotes = value; - } - - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLanguage() { - return language; - } - - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLanguage(String value) { - this.language = value; - } - - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMetascore() { - return metascore; - } - - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMetascore(String value) { - this.metascore = value; - } - - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPlot() { - return plot; - } - - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPlot(String value) { - this.plot = value; - } - - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPoster() { - return poster; - } - - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPoster(String value) { - this.poster = value; - } - - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRated() { - return rated; - } - - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRated(String value) { - this.rated = value; - } - - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ - public String getReleased() { - return released; - } - - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setReleased(String value) { - this.released = value; - } - - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ - public String getResponse() { - return response; - } - - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setResponse(String value) { - this.response = value; - } - - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ - public String getRuntime() { - return runtime; - } - - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setRuntime(String value) { - this.runtime = value; - } - - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTitle() { - return title; - } - - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTitle(String value) { - this.title = value; - } - - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWriter() { - return writer; - } - - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWriter(String value) { - this.writer = value; - } - - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ - public String getYear() { - return year; - } - - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setYear(String value) { - this.year = value; - } - -} diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index a2b2bd5250..052ba081c1 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbId", + "imdbID", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbId; + protected String imdbID; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbId. + * Recupera il valore della propriet� imdbID. * * @return * possible object is * {@link String } * */ - public String getImdbId() { - return imdbId; + public String getImdbID() { + return imdbID; } /** - * Imposta il valore della propriet� imdbId. + * Imposta il valore della propriet� imdbID. * * @param value * allowed object is * {@link String } * */ - public void setImdbId(String value) { - this.imdbId = value; + public void setImdbID(String value) { + this.imdbID = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbId='" + imdbId + '\'' + + ", imdbID='" + imdbID + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; + if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbId != null ? imdbId.hashCode() : 0; + int result = imdbID != null ? imdbID.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..60e0121966 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,21 +18,18 @@ public class MovieCrudService { private Map inventory = new HashMap(); - @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo for a given ImdbID***"); - - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); - }else return null; + System.out.println("*** Calling getinfo ***"); + Movie movie=new Movie(); + movie.setImdbID(imdbID); + return movie; } - @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -40,12 +37,11 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbId())){ + if (null!=inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +54,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbId())){ + if (null!=inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +66,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbID") String imdbID){ System.out.println("*** Calling deleteMovie ***"); @@ -83,7 +79,6 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } - @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java deleted file mode 100644 index d1973e7037..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/MovieCrudService.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.baeldung.server.service; - -import com.baeldung.Movie; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.Provider; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - - -@Path("/movies") -public class MovieCrudService { - - - private Map inventory = new HashMap(); - - @GET - @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - - System.out.println("*** Calling getinfo ***"); - - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; - } - - @POST - @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response addMovie(Movie movie){ - - System.out.println("*** Calling addMovie ***"); - - if (null!=inventory.get(movie.getImdbID())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is Already in the database.").build(); - } - inventory.put(movie.getImdbID(),movie); - - return Response.status(Response.Status.CREATED).build(); - } - - - @PUT - @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response updateMovie(Movie movie){ - - System.out.println("*** Calling updateMovie ***"); - - if (null!=inventory.get(movie.getImdbID())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is not in the database.\nUnable to Update").build(); - } - inventory.put(movie.getImdbID(),movie); - return Response.status(Response.Status.OK).build(); - - } - - - @DELETE - @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ - - System.out.println("*** Calling deleteMovie ***"); - - if (null==inventory.get(imdbID)){ - return Response.status(Response.Status.NOT_FOUND) - .entity("Movie is not in the database.\nUnable to Delete").build(); - } - - inventory.remove(imdbID); - return Response.status(Response.Status.OK).build(); - } - - @GET - @Path("/listmovies") - @Produces({"application/json"}) - public List listMovies(){ - - return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); - - } - - - -} diff --git a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java deleted file mode 100644 index 16b6200ad1..0000000000 --- a/RestEasy Example/src/main/java/com/baeldung/server/service/RestEasyServices.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.server.service; - - -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * Created by Admin on 29/01/2016. - */ - - - -@ApplicationPath("/rest") -public class RestEasyServices extends Application { - - private Set singletons = new HashSet(); - - public RestEasyServices() { - singletons.add(new MovieCrudService()); - } - - @Override - public Set getSingletons() { - return singletons; - } - - @Override - public Set> getClasses() { - return super.getClasses(); - } - - @Override - public Map getProperties() { - return super.getProperties(); - } -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java index e711233979..c77f494862 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java @@ -1,49 +1,111 @@ package com.baeldung.server; -import com.baeldung.Movie; +import com.baeldung.model.Movie; import com.baeldung.client.ServicesInterface; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Link; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.List; +import java.util.Locale; public class RestEasyClient { - public static void main(String[] args) { - Movie st = new Movie(); - st.setImdbID("12345"); + Movie transformerMovie=null; + Movie batmanMovie=null; + ObjectMapper jsonMapper=null; - /* - * Alternatively you can use this simple String to send - * instead of using a Student instance - * - * String jsonString = "{\"id\":12,\"firstName\":\"Catain\",\"lastName\":\"Hook\",\"age\":10}"; - */ + @BeforeClass + public static void loadMovieInventory(){ + + + + } + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + + jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + } + + @Test + public void testListAllMovies() { try { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target("http://localhost:8080/RestEasyTutorial/rest/movies/listmovies"); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + final List movies = simple.listMovies(); + System.out.println(movies); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + + @Test + public void testAddMovie() { + + try { + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); ServicesInterface simple = target.proxy(ServicesInterface.class); - final List movies = simple.listMovies(); + final Response moviesResponse = simple.addMovie(batmanMovie); - /* - if (response.getStatus() != 200) { + if (moviesResponse.getStatus() != 201) { + System.out.println(moviesResponse.readEntity(String.class)); throw new RuntimeException("Failed : HTTP error code : " - + response.getStatus()); + + moviesResponse.getStatus()); } - System.out.println("Server response : \n"); - System.out.println(response.readEntity(String.class)); + moviesResponse.close(); - response.close(); -*/ } catch (Exception e) { - e.printStackTrace(); - } } diff --git a/RestEasy Example/src/test/resources/server/movies/transformer.json b/RestEasy Example/src/test/resources/server/movies/transformer.json deleted file mode 100644 index 2154868265..0000000000 --- a/RestEasy Example/src/test/resources/server/movies/transformer.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "title": "Transformers", - "year": "2007", - "rated": "PG-13", - "released": "03 Jul 2007", - "runtime": "144 min", - "genre": "Action, Adventure, Sci-Fi", - "director": "Michael Bay", - "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", - "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", - "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", - "language": "English, Spanish", - "country": "USA", - "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", - "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", - "metascore": "61", - "imdbRating": "7.1", - "imdbVotes": "492,225", - "imdbID": "tt0418279", - "Type": "movie", - "response": "True" -} \ No newline at end of file From 6db36f902b1e7cf6f1c7857e5a14295e8881c732 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 31 Jan 2016 11:05:11 +0100 Subject: [PATCH 0144/1106] Added testCase for all Services --- .../baeldung/client/ServicesInterface.java | 6 + .../com/baeldung/server/MovieCrudService.java | 15 ++- .../com/baeldung/server/RestEasyClient.java | 112 ------------------ 3 files changed, 16 insertions(+), 117 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 749cabc757..8898b83483 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -23,6 +23,12 @@ public interface ServicesInterface { List listMovies(); + @GET + @Path("/listmovies") + @Produces({"application/json"}) + List listMovies(); + + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 60e0121966..18366e2faa 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -18,18 +18,21 @@ public class MovieCrudService { private Map inventory = new HashMap(); + @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ - System.out.println("*** Calling getinfo ***"); + System.out.println("*** Calling getinfo for a given ImdbID***"); + + if(inventory.containsKey(imdbID)){ + return inventory.get(imdbID); + }else return null; - Movie movie=new Movie(); - movie.setImdbID(imdbID); - return movie; } + @POST @Path("/addmovie") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @@ -41,6 +44,7 @@ public class MovieCrudService { return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } + inventory.put(movie.getImdbID(),movie); return Response.status(Response.Status.CREATED).build(); @@ -54,7 +58,7 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbID())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } @@ -79,6 +83,7 @@ public class MovieCrudService { return Response.status(Response.Status.OK).build(); } + @GET @Path("/listmovies") @Produces({"application/json"}) diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java deleted file mode 100644 index c77f494862..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClient.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.model.Movie; -import com.baeldung.client.ServicesInterface; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import javax.naming.NamingException; -import javax.ws.rs.core.Link; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class RestEasyClient { - - - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; - - @BeforeClass - public static void loadMovieInventory(){ - - - - } - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClient().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - } - - @Test - public void testListAllMovies() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - final List movies = simple.listMovies(); - System.out.println(movies); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - - - @Test - public void testAddMovie() { - - try { - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://localhost:8080/RestEasyTutorial/rest")); - - ServicesInterface simple = target.proxy(ServicesInterface.class); - final Response moviesResponse = simple.addMovie(batmanMovie); - - if (moviesResponse.getStatus() != 201) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " - + moviesResponse.getStatus()); - } - - moviesResponse.close(); - - } catch (Exception e) { - e.printStackTrace(); - } - } - -} \ No newline at end of file From 33223becff3f88fd3bb8e5734f621c780c1ba454 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:29:30 +0100 Subject: [PATCH 0145/1106] Minor Bugfix --- .../main/java/com/baeldung/model/Movie.java | 22 +++++++++---------- .../com/baeldung/server/MovieCrudService.java | 12 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 052ba081c1..a2b2bd5250 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlType; "country", "director", "genre", - "imdbID", + "imdbId", "imdbRating", "imdbVotes", "language", @@ -36,7 +36,7 @@ public class Movie { protected String country; protected String director; protected String genre; - protected String imdbID; + protected String imdbId; protected String imdbRating; protected String imdbVotes; protected String language; @@ -173,27 +173,27 @@ public class Movie { } /** - * Recupera il valore della propriet� imdbID. + * Recupera il valore della propriet� imdbId. * * @return * possible object is * {@link String } * */ - public String getImdbID() { - return imdbID; + public String getImdbId() { + return imdbId; } /** - * Imposta il valore della propriet� imdbID. + * Imposta il valore della propriet� imdbId. * * @param value * allowed object is * {@link String } * */ - public void setImdbID(String value) { - this.imdbID = value; + public void setImdbId(String value) { + this.imdbId = value; } /** @@ -540,7 +540,7 @@ public class Movie { ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + - ", imdbID='" + imdbID + '\'' + + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + @@ -564,14 +564,14 @@ public class Movie { Movie movie = (Movie) o; - if (imdbID != null ? !imdbID.equals(movie.imdbID) : movie.imdbID != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; return title != null ? title.equals(movie.title) : movie.title == null; } @Override public int hashCode() { - int result = imdbID != null ? imdbID.hashCode() : 0; + int result = imdbId != null ? imdbId.hashCode() : 0; result = 31 * result + (title != null ? title.hashCode() : 0); return result; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 18366e2faa..29226aa0e0 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -22,7 +22,7 @@ public class MovieCrudService { @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbID") String imdbID){ + public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling getinfo for a given ImdbID***"); @@ -40,12 +40,12 @@ public class MovieCrudService { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbID())){ + if (null!=inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.CREATED).build(); } @@ -58,11 +58,11 @@ public class MovieCrudService { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbID())){ + if (null==inventory.get(movie.getImdbId())){ return Response.status(Response.Status.NOT_MODIFIED) .entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbID(),movie); + inventory.put(movie.getImdbId(),movie); return Response.status(Response.Status.OK).build(); } @@ -70,7 +70,7 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbID") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbID){ System.out.println("*** Calling deleteMovie ***"); From 783dc6bdc2cb172dd3bacf01faba9531675c45ab Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:39:35 +0100 Subject: [PATCH 0146/1106] Minor Bugfix --- .../main/java/com/baeldung/model/Movie.java | 321 +----------------- 1 file changed, 1 insertion(+), 320 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index a2b2bd5250..805ba95209 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -52,482 +52,163 @@ public class Movie { protected String writer; protected String year; - /** - * Recupera il valore della propriet� actors. - * - * @return - * possible object is - * {@link String } - * - */ + public String getActors() { return actors; } - /** - * Imposta il valore della propriet� actors. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setActors(String value) { this.actors = value; } - /** - * Recupera il valore della propriet� awards. - * - * @return - * possible object is - * {@link String } - * - */ public String getAwards() { return awards; } - /** - * Imposta il valore della propriet� awards. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setAwards(String value) { this.awards = value; } - /** - * Recupera il valore della propriet� country. - * - * @return - * possible object is - * {@link String } - * - */ public String getCountry() { return country; } - /** - * Imposta il valore della propriet� country. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setCountry(String value) { this.country = value; } - /** - * Recupera il valore della propriet� director. - * - * @return - * possible object is - * {@link String } - * - */ public String getDirector() { return director; } - /** - * Imposta il valore della propriet� director. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setDirector(String value) { this.director = value; } - /** - * Recupera il valore della propriet� genre. - * - * @return - * possible object is - * {@link String } - * - */ public String getGenre() { return genre; } - /** - * Imposta il valore della propriet� genre. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setGenre(String value) { this.genre = value; } - /** - * Recupera il valore della propriet� imdbId. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbId() { return imdbId; } - /** - * Imposta il valore della propriet� imdbId. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbId(String value) { this.imdbId = value; } - /** - * Recupera il valore della propriet� imdbRating. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbRating() { return imdbRating; } - /** - * Imposta il valore della propriet� imdbRating. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbRating(String value) { this.imdbRating = value; } - /** - * Recupera il valore della propriet� imdbVotes. - * - * @return - * possible object is - * {@link String } - * - */ public String getImdbVotes() { return imdbVotes; } - /** - * Imposta il valore della propriet� imdbVotes. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setImdbVotes(String value) { this.imdbVotes = value; } - /** - * Recupera il valore della propriet� language. - * - * @return - * possible object is - * {@link String } - * - */ public String getLanguage() { return language; } - /** - * Imposta il valore della propriet� language. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setLanguage(String value) { this.language = value; } - /** - * Recupera il valore della propriet� metascore. - * - * @return - * possible object is - * {@link String } - * - */ public String getMetascore() { return metascore; } - /** - * Imposta il valore della propriet� metascore. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setMetascore(String value) { this.metascore = value; } - /** - * Recupera il valore della propriet� plot. - * - * @return - * possible object is - * {@link String } - * - */ public String getPlot() { return plot; } - /** - * Imposta il valore della propriet� plot. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPlot(String value) { this.plot = value; } - /** - * Recupera il valore della propriet� poster. - * - * @return - * possible object is - * {@link String } - * - */ public String getPoster() { return poster; } - /** - * Imposta il valore della propriet� poster. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setPoster(String value) { this.poster = value; } - /** - * Recupera il valore della propriet� rated. - * - * @return - * possible object is - * {@link String } - * - */ public String getRated() { return rated; } - /** - * Imposta il valore della propriet� rated. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRated(String value) { this.rated = value; } - /** - * Recupera il valore della propriet� released. - * - * @return - * possible object is - * {@link String } - * - */ public String getReleased() { return released; } - /** - * Imposta il valore della propriet� released. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setReleased(String value) { this.released = value; } - /** - * Recupera il valore della propriet� response. - * - * @return - * possible object is - * {@link String } - * - */ public String getResponse() { return response; } - /** - * Imposta il valore della propriet� response. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setResponse(String value) { this.response = value; } - /** - * Recupera il valore della propriet� runtime. - * - * @return - * possible object is - * {@link String } - * - */ public String getRuntime() { return runtime; } - /** - * Imposta il valore della propriet� runtime. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setRuntime(String value) { this.runtime = value; } - /** - * Recupera il valore della propriet� title. - * - * @return - * possible object is - * {@link String } - * - */ public String getTitle() { return title; } - /** - * Imposta il valore della propriet� title. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setTitle(String value) { this.title = value; } - /** - * Recupera il valore della propriet� type. - * - * @return - * possible object is - * {@link String } - * - */ public String getType() { return type; } - /** - * Imposta il valore della propriet� type. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setType(String value) { this.type = value; } - /** - * Recupera il valore della propriet� writer. - * - * @return - * possible object is - * {@link String } - * - */ public String getWriter() { return writer; } - /** - * Imposta il valore della propriet� writer. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setWriter(String value) { this.writer = value; } - /** - * Recupera il valore della propriet� year. - * - * @return - * possible object is - * {@link String } - * - */ public String getYear() { return year; } - /** - * Imposta il valore della propriet� year. - * - * @param value - * allowed object is - * {@link String } - * - */ public void setYear(String value) { this.year = value; } From 71793635d32d50427bc4165b29b39aaabec3d743 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 7 Feb 2016 20:55:46 +0100 Subject: [PATCH 0147/1106] CleanUp Code --- RestEasy Example/pom.xml | 3 +- .../baeldung/client/ServicesInterface.java | 1 - .../main/java/com/baeldung/model/Movie.java | 2 -- .../com/baeldung/server/MovieCrudService.java | 17 ++++------- .../com/baeldung/server/RestEasyServices.java | 8 ----- .../src/main/resources/schema1.xsd | 29 ------------------- .../src/main/webapp/WEB-INF/web.xml | 3 -- .../java/baeldung/client/RestEasyClient.java | 7 ----- .../baeldung/server/RestEasyClientTest.java | 1 - 9 files changed, 7 insertions(+), 64 deletions(-) delete mode 100644 RestEasy Example/src/main/resources/schema1.xsd delete mode 100644 RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 6935238d91..9c890da2b7 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -36,7 +36,7 @@ - + org.jboss.resteasy jaxrs-api @@ -101,5 +101,4 @@ - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 8898b83483..22669717a8 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -1,7 +1,6 @@ package com.baeldung.client; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 805ba95209..56ba766ff4 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -1,11 +1,9 @@ - package com.baeldung.model; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "movie", propOrder = { "actors", diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 29226aa0e0..bbb3b1e953 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -1,7 +1,6 @@ package com.baeldung.server; import com.baeldung.model.Movie; - import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @@ -11,23 +10,21 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; - @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); @GET @Path("/getinfo") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbID(@QueryParam("imdbId") String imdbID){ + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbID)){ - return inventory.get(imdbID); + if(inventory.containsKey(imdbId)){ + return inventory.get(imdbId); }else return null; } @@ -70,16 +67,16 @@ public class MovieCrudService { @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbID){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId){ System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbID)){ + if (null==inventory.get(imdbId)){ return Response.status(Response.Status.NOT_FOUND) .entity("Movie is not in the database.\nUnable to Delete").build(); } - inventory.remove(imdbID); + inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } @@ -93,6 +90,4 @@ public class MovieCrudService { } - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java index 8c57d2c9b4..7726e49f38 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java @@ -1,19 +1,11 @@ package com.baeldung.server; - import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; -import java.util.Arrays; import java.util.HashSet; import java.util.Map; import java.util.Set; -/** - * Created by Admin on 29/01/2016. - */ - - - @ApplicationPath("/rest") public class RestEasyServices extends Application { diff --git a/RestEasy Example/src/main/resources/schema1.xsd b/RestEasy Example/src/main/resources/schema1.xsd deleted file mode 100644 index 0d74b7c366..0000000000 --- a/RestEasy Example/src/main/resources/schema1.xsd +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index f70fdf7975..1e7f64004d 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -5,12 +5,9 @@ RestEasy Example - resteasy.servlet.mapping.prefix /rest - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java b/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java deleted file mode 100644 index b474b3d4f8..0000000000 --- a/RestEasy Example/src/test/java/baeldung/client/RestEasyClient.java +++ /dev/null @@ -1,7 +0,0 @@ -package baeldung.client; - -/** - * Created by Admin on 29/01/2016. - */ -public class RestEasyClient { -} diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index b6a2e2a0c1..faa39e0199 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -10,7 +10,6 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.junit.Before; import org.junit.Test; - import javax.naming.NamingException; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; From 04d9bbb7682999c0d90054150aac69cbfa442781 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 14:00:11 +0100 Subject: [PATCH 0148/1106] CleanUp and reformatting Code; dependency fix in pom.xml --- RestEasy Example/pom.xml | 147 +++++++----------- .../baeldung/client/ServicesInterface.java | 21 +-- .../main/java/com/baeldung/model/Movie.java | 56 ++----- .../com/baeldung/server/MovieCrudService.java | 49 +++--- .../WEB-INF/jboss-deployment-structure.xml | 22 +-- .../src/main/webapp/WEB-INF/web.xml | 14 +- .../baeldung/server/RestEasyClientTest.java | 23 ++- .../com/baeldung/server/movies/batman.json | 2 +- .../baeldung/server/movies/transformer.json | 2 +- 9 files changed, 125 insertions(+), 211 deletions(-) diff --git a/RestEasy Example/pom.xml b/RestEasy Example/pom.xml index 9c890da2b7..ec9e87b0d1 100644 --- a/RestEasy Example/pom.xml +++ b/RestEasy Example/pom.xml @@ -1,104 +1,77 @@ - - 4.0.0 + + 4.0.0 - com.baeldung - resteasy-tutorial - 1.0 - war + com.baeldung + resteasy-tutorial + 1.0 + war - - - jboss - http://repository.jboss.org/nexus/content/groups/public/ - - + + 3.0.14.Final + - - 3.0.14.Final - runtime - + + RestEasyTutorial + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + - - RestEasyTutorial - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - + - + - - org.jboss.resteasy - jaxrs-api - 3.0.12.Final - ${resteasy.scope} - - - - org.jboss.resteasy - resteasy-servlet-initializer - ${resteasy.version} - ${resteasy.scope} - - - jboss-jaxrs-api_2.0_spec - org.jboss.spec.javax.ws.rs - - - - - - org.jboss.resteasy - resteasy-client - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-servlet-initializer + ${resteasy.version} + - - javax.ws.rs - javax.ws.rs-api - 2.0.1 - + + org.jboss.resteasy + resteasy-client + ${resteasy.version} + - - org.jboss.resteasy - resteasy-jackson-provider - ${resteasy.version} - ${resteasy.scope} - + - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - ${resteasy.scope} - + + org.jboss.resteasy + resteasy-jaxb-provider + ${resteasy.version} + - + + org.jboss.resteasy + resteasy-jackson-provider + ${resteasy.version} + - - junit - junit - 4.4 - + - - commons-io - commons-io - 2.4 - + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + - \ No newline at end of file diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java index 22669717a8..3d03c16faf 100644 --- a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java @@ -9,41 +9,28 @@ import java.util.List; @Path("/movies") public interface ServicesInterface { - @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Movie movieByImdbId(@QueryParam("imdbId") String imdbId); - @GET @Path("/listmovies") - @Produces({"application/json"}) + @Produces({ "application/json" }) List listMovies(); - - @GET - @Path("/listmovies") - @Produces({"application/json"}) - List listMovies(); - - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response addMovie(Movie movie); - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response updateMovie(Movie movie); - @DELETE @Path("/deletemovie") Response deleteMovie(@QueryParam("imdbId") String imdbID); - - } diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 56ba766ff4..a959682a75 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -5,28 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { - "actors", - "awards", - "country", - "director", - "genre", - "imdbId", - "imdbRating", - "imdbVotes", - "language", - "metascore", - "plot", - "poster", - "rated", - "released", - "response", - "runtime", - "title", - "type", - "writer", - "year" -}) +@XmlType(name = "movie", propOrder = { "actors", "awards", "country", "director", "genre", "imdbId", "imdbRating", "imdbVotes", "language", "metascore", "plot", "poster", "rated", "released", "response", "runtime", "title", "type", "writer", "year" }) public class Movie { protected String actors; @@ -213,37 +192,22 @@ public class Movie { @Override public String toString() { - return "Movie{" + - "actors='" + actors + '\'' + - ", awards='" + awards + '\'' + - ", country='" + country + '\'' + - ", director='" + director + '\'' + - ", genre='" + genre + '\'' + - ", imdbId='" + imdbId + '\'' + - ", imdbRating='" + imdbRating + '\'' + - ", imdbVotes='" + imdbVotes + '\'' + - ", language='" + language + '\'' + - ", metascore='" + metascore + '\'' + - ", poster='" + poster + '\'' + - ", rated='" + rated + '\'' + - ", released='" + released + '\'' + - ", response='" + response + '\'' + - ", runtime='" + runtime + '\'' + - ", title='" + title + '\'' + - ", type='" + type + '\'' + - ", writer='" + writer + '\'' + - ", year='" + year + '\'' + - '}'; + return "Movie{" + "actors='" + actors + '\'' + ", awards='" + awards + '\'' + ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' + + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + ", metascore='" + metascore + '\'' + ", poster='" + poster + '\'' + ", rated='" + rated + '\'' + ", released='" + released + '\'' + ", response='" + response + '\'' + + ", runtime='" + runtime + '\'' + ", title='" + title + '\'' + ", type='" + type + '\'' + ", writer='" + writer + '\'' + ", year='" + year + '\'' + '}'; } @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Movie movie = (Movie) o; - if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) return false; + if (imdbId != null ? !imdbId.equals(movie.imdbId) : movie.imdbId != null) + return false; return title != null ? title.equals(movie.title) : movie.title == null; } diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index bbb3b1e953..6a0699874a 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -13,78 +13,71 @@ import java.util.stream.Collectors; @Path("/movies") public class MovieCrudService { - private Map inventory = new HashMap(); - + private Map inventory = new HashMap(); @GET @Path("/getinfo") - @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Movie movieByImdbId(@QueryParam("imdbId") String imdbId){ + @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Movie movieByImdbId(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling getinfo for a given ImdbID***"); - if(inventory.containsKey(imdbId)){ + if (inventory.containsKey(imdbId)) { return inventory.get(imdbId); - }else return null; + } else + return null; } - @POST @Path("/addmovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response addMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response addMovie(Movie movie) { System.out.println("*** Calling addMovie ***"); - if (null!=inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is Already in the database.").build(); + if (null != inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is Already in the database.").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.CREATED).build(); } - @PUT @Path("/updatemovie") - @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) - public Response updateMovie(Movie movie){ + @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public Response updateMovie(Movie movie) { System.out.println("*** Calling updateMovie ***"); - if (null==inventory.get(movie.getImdbId())){ - return Response.status(Response.Status.NOT_MODIFIED) - .entity("Movie is not in the database.\nUnable to Update").build(); + if (null == inventory.get(movie.getImdbId())) { + return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } - inventory.put(movie.getImdbId(),movie); + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); } - @DELETE @Path("/deletemovie") - public Response deleteMovie(@QueryParam("imdbId") String imdbId){ + public Response deleteMovie(@QueryParam("imdbId") String imdbId) { System.out.println("*** Calling deleteMovie ***"); - if (null==inventory.get(imdbId)){ - return Response.status(Response.Status.NOT_FOUND) - .entity("Movie is not in the database.\nUnable to Delete").build(); + if (null == inventory.get(imdbId)) { + return Response.status(Response.Status.NOT_FOUND).entity("Movie is not in the database.\nUnable to Delete").build(); } inventory.remove(imdbId); return Response.status(Response.Status.OK).build(); } - @GET @Path("/listmovies") - @Produces({"application/json"}) - public List listMovies(){ + @Produces({ "application/json" }) + public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 84d75934a7..7879603d19 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,16 +1,16 @@ - - - - + + + + - - - - - + + + + + - - + + \ No newline at end of file diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/RestEasy Example/src/main/webapp/WEB-INF/web.xml index 1e7f64004d..d5f00293f4 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/web.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/web.xml @@ -1,13 +1,13 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> - RestEasy Example + RestEasy Example - - resteasy.servlet.mapping.prefix - /rest - + + resteasy.servlet.mapping.prefix + /rest + \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index faa39e0199..3760ae2415 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -21,14 +21,14 @@ import java.util.Locale; public class RestEasyClientTest { - Movie transformerMovie=null; - Movie batmanMovie=null; - ObjectMapper jsonMapper=null; + Movie transformerMovie = null; + Movie batmanMovie = null; + ObjectMapper jsonMapper = null; @Before public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - jsonMapper=new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); jsonMapper.setDateFormat(sdf); @@ -69,7 +69,7 @@ public class RestEasyClientTest { @Test public void testMovieByImdbId() { - String transformerImdbId="tt0418279"; + String transformerImdbId = "tt0418279"; ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); @@ -82,7 +82,6 @@ public class RestEasyClientTest { System.out.println(movies); } - @Test public void testAddMovie() { @@ -99,10 +98,9 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testDeleteMovi1e() { @@ -116,14 +114,13 @@ public class RestEasyClientTest { if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } - @Test public void testUpdateMovie() { @@ -137,11 +134,11 @@ public class RestEasyClientTest { moviesResponse = simple.updateMovie(batmanMovie); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); } moviesResponse.close(); - System.out.println("Response Code: "+Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); } } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json index 28061d5bf9..173901c948 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -16,7 +16,7 @@ "metascore": "66", "imdbRating": "7.6", "imdbVotes": "256,000", - "imdbID": "tt0096895", + "imdbId": "tt0096895", "type": "movie", "response": "True" } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index a3b033a8ba..a4fd061a82 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -16,7 +16,7 @@ "metascore": "61", "imdbRating": "7.1", "imdbVotes": "492,225", - "imdbID": "tt0418279", + "imdbId": "tt0418279", "type": "movie", "response": "True" } \ No newline at end of file From 81f498407142bcc91071110ef20d0ee9a5b5da98 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Mon, 8 Feb 2016 16:08:15 +0100 Subject: [PATCH 0149/1106] CleanUp and reformatting Code. --- .../src/main/java/com/baeldung/server/MovieCrudService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java index 6a0699874a..b7f3215f3f 100644 --- a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java +++ b/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java @@ -26,7 +26,6 @@ public class MovieCrudService { return inventory.get(imdbId); } else return null; - } @POST @@ -41,7 +40,6 @@ public class MovieCrudService { } inventory.put(movie.getImdbId(), movie); - return Response.status(Response.Status.CREATED).build(); } @@ -55,9 +53,9 @@ public class MovieCrudService { if (null == inventory.get(movie.getImdbId())) { return Response.status(Response.Status.NOT_MODIFIED).entity("Movie is not in the database.\nUnable to Update").build(); } + inventory.put(movie.getImdbId(), movie); return Response.status(Response.Status.OK).build(); - } @DELETE @@ -80,7 +78,6 @@ public class MovieCrudService { public List listMovies() { return inventory.values().stream().collect(Collectors.toCollection(ArrayList::new)); - } } From 1c8e8a2e0c5683bcc0b992e631807b016d1d45a6 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 13 Feb 2016 23:48:11 +0100 Subject: [PATCH 0150/1106] Formatting and many fields removed from Movie class --- .../main/java/com/baeldung/model/Movie.java | 188 ++---------------- .../WEB-INF/jboss-deployment-structure.xml | 3 - .../baeldung/server/RestEasyClientTest.java | 2 +- .../com/baeldung/server/movies/batman.json | 20 +- .../baeldung/server/movies/transformer.json | 20 +- 5 files changed, 20 insertions(+), 213 deletions(-) diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java index 5aade4591a..408f2144fb 100644 --- a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java +++ b/RestEasy Example/src/main/java/com/baeldung/model/Movie.java @@ -5,195 +5,33 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "movie", propOrder = { "actors", "awards", "country", "director", "genre", "imdbId", "imdbRating", "imdbVotes", "language", "metascore", "plot", "poster", "rated", "released", "response", "runtime", "title", "type", "writer", "year" }) +@XmlType(name = "movie", propOrder = { "imdbId", "title" }) public class Movie { - protected String actors; - protected String awards; - protected String country; - protected String director; - protected String genre; protected String imdbId; - protected String imdbRating; - protected String imdbVotes; - protected String language; - protected String metascore; - protected String plot; - protected String poster; - protected String rated; - protected String released; - protected String response; - protected String runtime; protected String title; - protected String type; - protected String writer; - protected String year; - public String getActors() { - return actors; + public Movie(String imdbId, String title) { + this.imdbId = imdbId; + this.title = title; } - public void setActors(String value) { - this.actors = value; - } - - public String getAwards() { - return awards; - } - - public void setAwards(String value) { - this.awards = value; - } - - public String getCountry() { - return country; - } - - public void setCountry(String value) { - this.country = value; - } - - public String getDirector() { - return director; - } - - public void setDirector(String value) { - this.director = value; - } - - public String getGenre() { - return genre; - } - - public void setGenre(String value) { - this.genre = value; - } + public Movie() {} public String getImdbId() { return imdbId; } - public void setImdbId(String value) { - this.imdbId = value; - } - - public String getImdbRating() { - return imdbRating; - } - - public void setImdbRating(String value) { - this.imdbRating = value; - } - - public String getImdbVotes() { - return imdbVotes; - } - - public void setImdbVotes(String value) { - this.imdbVotes = value; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String value) { - this.language = value; - } - - public String getMetascore() { - return metascore; - } - - public void setMetascore(String value) { - this.metascore = value; - } - - public String getPlot() { - return plot; - } - - public void setPlot(String value) { - this.plot = value; - } - - public String getPoster() { - return poster; - } - - public void setPoster(String value) { - this.poster = value; - } - - public String getRated() { - return rated; - } - - public void setRated(String value) { - this.rated = value; - } - - public String getReleased() { - return released; - } - - public void setReleased(String value) { - this.released = value; - } - - public String getResponse() { - return response; - } - - public void setResponse(String value) { - this.response = value; - } - - public String getRuntime() { - return runtime; - } - - public void setRuntime(String value) { - this.runtime = value; + public void setImdbId(String imdbId) { + this.imdbId = imdbId; } public String getTitle() { return title; } - public void setTitle(String value) { - this.title = value; - } - - public String getType() { - return type; - } - - public void setType(String value) { - this.type = value; - } - - public String getWriter() { - return writer; - } - - public void setWriter(String value) { - this.writer = value; - } - - public String getYear() { - return year; - } - - public void setYear(String value) { - this.year = value; - } - - @Override - public String toString() { - return "Movie{" + "actors='" + actors + '\'' + ", awards='" + awards + '\'' + ", country='" + country + '\'' + ", director='" + director + '\'' + ", genre='" + genre + '\'' + ", imdbId='" + imdbId + '\'' + ", imdbRating='" + imdbRating + '\'' - + ", imdbVotes='" + imdbVotes + '\'' + ", language='" + language + '\'' + ", metascore='" + metascore + '\'' + ", poster='" + poster + '\'' + ", rated='" + rated + '\'' + ", released='" + released + '\'' + ", response='" + response + '\'' - + ", runtime='" + runtime + '\'' + ", title='" + title + '\'' + ", type='" + type + '\'' + ", writer='" + writer + '\'' + ", year='" + year + '\'' + '}'; + public void setTitle(String title) { + this.title = title; } @Override @@ -217,4 +55,12 @@ public class Movie { result = 31 * result + (title != null ? title.hashCode() : 0); return result; } + + @Override + public String toString() { + return "Movie{" + + "imdbId='" + imdbId + '\'' + + ", title='" + title + '\'' + + '}'; + } } diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 7879603d19..e5b893e56a 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -3,14 +3,11 @@ - - - \ No newline at end of file diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java index 3760ae2415..2a13465ebc 100644 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -130,7 +130,7 @@ public class RestEasyClientTest { Response moviesResponse = simple.addMovie(batmanMovie); moviesResponse.close(); - batmanMovie.setImdbVotes("300,000"); + batmanMovie.setTitle("Batman Begins"); moviesResponse = simple.updateMovie(batmanMovie); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json index 173901c948..82aaaa8f40 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json @@ -1,22 +1,4 @@ { "title": "Batman", - "year": "1989", - "rated": "PG-13", - "released": "23 Jun 1989", - "runtime": "126 min", - "genre": "Action, Adventure", - "director": "Tim Burton", - "writer": "Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)", - "actors": "Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl", - "plot": "The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.", - "language": "English, French", - "country": "USA, UK", - "awards": "Won 1 Oscar. Another 9 wins & 22 nominations.", - "poster": "http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg", - "metascore": "66", - "imdbRating": "7.6", - "imdbVotes": "256,000", - "imdbId": "tt0096895", - "type": "movie", - "response": "True" + "imdbId": "tt0096895" } \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json index a4fd061a82..634cefc73c 100644 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json +++ b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json @@ -1,22 +1,4 @@ { "title": "Transformers", - "year": "2007", - "rated": "PG-13", - "released": "03 Jul 2007", - "runtime": "144 min", - "genre": "Action, Adventure, Sci-Fi", - "director": "Michael Bay", - "writer": "Roberto Orci (screenplay), Alex Kurtzman (screenplay), John Rogers (story), Roberto Orci (story), Alex Kurtzman (story)", - "actors": "Shia LaBeouf, Megan Fox, Josh Duhamel, Tyrese Gibson", - "plot": "A long time ago, far away on the planet of Cybertron, a war is being waged between the noble Autobots (led by the wise Optimus Prime) and the devious Decepticons (commanded by the dreaded Megatron) for control over the Allspark, a mystical talisman that would grant unlimited power to whoever possesses it. The Autobots managed to smuggle the Allspark off the planet, but Megatron blasts off in search of it. He eventually tracks it to the planet of Earth (circa 1850), but his reckless desire for power sends him right into the Arctic Ocean, and the sheer cold forces him into a paralyzed state. His body is later found by Captain Archibald Witwicky, but before going into a comatose state Megatron uses the last of his energy to engrave into the Captain's glasses a map showing the location of the Allspark, and to send a transmission to Cybertron. Megatron is then carried away aboard the Captain's ship. A century later, Captain Witwicky's grandson Sam Witwicky (nicknamed Spike by his friends) buys his first car. To his shock, he discovers it to be Bumblebee, an Autobot in disguise who is to protect Spike, who possesses the Captain's glasses and the map engraved on them. But Bumblebee is not the only Transformer to have arrived on Earth - in the desert of Qatar, the Decepticons Blackout and Scorponok attack a U.S. military base, causing the Pentagon to send their special Sector Seven agents to capture all \"specimens of this alien race.\" Spike and his girlfriend Mikaela find themselves in the midst of a grand battle between the Autobots and the Decepticons, stretching from Hoover Dam all the way to Los Angeles. Meanwhile, deep inside Hoover Dam, the cryogenically stored body of Megatron awakens.", - "language": "English, Spanish", - "country": "USA", - "awards": "Nominated for 3 Oscars. Another 18 wins & 40 nominations.", - "poster": "http://ia.media-imdb.com/images/M/MV5BMTQwNjU5MzUzNl5BMl5BanBnXkFtZTYwMzc1MTI3._V1_SX300.jpg", - "metascore": "61", - "imdbRating": "7.1", - "imdbVotes": "492,225", - "imdbId": "tt0418279", - "type": "movie", - "response": "True" + "imdbId": "tt0418279" } \ No newline at end of file From 957b0958e3190caf2790d8cac15715be20a1e57a Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 14 Feb 2016 00:35:19 +0100 Subject: [PATCH 0151/1106] Reformatting Code. --- .../main/webapp/WEB-INF/jboss-deployment-structure.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index e5b893e56a..45dfd9f075 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,13 +1,17 @@ + - + + - - + + + + \ No newline at end of file From fa39351b6e31f8ed1483e75df5448e3a333cd7b1 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Sun, 14 Feb 2016 00:40:02 +0100 Subject: [PATCH 0152/1106] Reformatting Code. --- .../WEB-INF/jboss-deployment-structure.xml | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 45dfd9f075..cb258374a1 100644 --- a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,17 +1,13 @@ + - - - - - - + + + + - - - - - - - + + + + - \ No newline at end of file + From 72214652846664333aaa334b1f05d88e13a0c070 Mon Sep 17 00:00:00 2001 From: eugenp Date: Sun, 14 Feb 2016 11:15:29 +0200 Subject: [PATCH 0153/1106] cleanup work --- spring-security-login-and-registration/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-security-login-and-registration/pom.xml b/spring-security-login-and-registration/pom.xml index f5b62be553..bcbe9371e2 100644 --- a/spring-security-login-and-registration/pom.xml +++ b/spring-security-login-and-registration/pom.xml @@ -269,7 +269,8 @@ ${maven-surefire-plugin.version} - + **/*IntegrationTest.java + **/*LiveTest.java From 33e5f14e86ee2913d11d8df5603dd9d20d70d34b Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sun, 14 Feb 2016 12:34:32 +0100 Subject: [PATCH 0154/1106] Example folders cleaned --- .../baeldung/server/RestEasyClientTest.java | 144 ------------------ .../com/baeldung/server/movies/batman.json | 4 - .../baeldung/server/movies/transformer.json | 4 - 3 files changed, 152 deletions(-) delete mode 100644 RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java delete mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json delete mode 100644 RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json diff --git a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java b/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java deleted file mode 100644 index 2a13465ebc..0000000000 --- a/RestEasy Example/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.baeldung.server; - -import com.baeldung.client.ServicesInterface; -import com.baeldung.model.Movie; -import org.apache.commons.io.IOUtils; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; -import org.junit.Before; -import org.junit.Test; -import javax.naming.NamingException; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.List; -import java.util.Locale; - -public class RestEasyClientTest { - - Movie transformerMovie = null; - Movie batmanMovie = null; - ObjectMapper jsonMapper = null; - - @Before - public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { - - jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); - jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); - SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); - jsonMapper.setDateFormat(sdf); - - try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { - String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Test is going to die ...", e); - } - - try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { - String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); - batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); - - } catch (Exception e) { - throw new RuntimeException("Test is going to die ...", e); - } - } - - @Test - public void testListAllMovies() { - - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - - List movies = simple.listMovies(); - System.out.println(movies); - } - - @Test - public void testMovieByImdbId() { - - String transformerImdbId = "tt0418279"; - - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - Response moviesResponse = simple.addMovie(transformerMovie); - moviesResponse.close(); - - Movie movies = simple.movieByImdbId(transformerImdbId); - System.out.println(movies); - } - - @Test - public void testAddMovie() { - - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); - - if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); - } - - @Test - public void testDeleteMovi1e() { - - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println(moviesResponse.readEntity(String.class)); - throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); - } - - @Test - public void testUpdateMovie() { - - ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); - ServicesInterface simple = target.proxy(ServicesInterface.class); - - Response moviesResponse = simple.addMovie(batmanMovie); - moviesResponse.close(); - batmanMovie.setTitle("Batman Begins"); - moviesResponse = simple.updateMovie(batmanMovie); - - if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { - System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); - } - - moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); - } - -} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json deleted file mode 100644 index 82aaaa8f40..0000000000 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/batman.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "Batman", - "imdbId": "tt0096895" -} \ No newline at end of file diff --git a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json b/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json deleted file mode 100644 index 634cefc73c..0000000000 --- a/RestEasy Example/src/test/resources/com/baeldung/server/movies/transformer.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "Transformers", - "imdbId": "tt0418279" -} \ No newline at end of file From aedffc1d139ce5c54fec86d1e0d411ee09a8c590 Mon Sep 17 00:00:00 2001 From: ypatil Date: Mon, 15 Feb 2016 15:29:13 +0530 Subject: [PATCH 0155/1106] data folder moved under test/data. Test cases added. Code & POM updated. --- spring-apache-camel/data/file1.txt | 1 - .../data/input/.camel/file1.txt | 1 - .../data/outputLowerCase/file1.txt | 1 - .../data/outputUppperCase/file1.txt | 1 - spring-apache-camel/pom.xml | 26 +++- .../main/java/org/apache/camel/main/App.java | 4 +- .../apache/camel/processor/FileProcessor.java | 7 +- .../src/main/resources/camel-context.xml | 35 +++--- .../src/test/data/sampleInputFile/file.txt | 1 + .../java/org/apache/camel/main/AppTest.java | 117 ++++++++++++++++++ 10 files changed, 163 insertions(+), 31 deletions(-) delete mode 100644 spring-apache-camel/data/file1.txt delete mode 100644 spring-apache-camel/data/input/.camel/file1.txt delete mode 100644 spring-apache-camel/data/outputLowerCase/file1.txt delete mode 100644 spring-apache-camel/data/outputUppperCase/file1.txt create mode 100644 spring-apache-camel/src/test/data/sampleInputFile/file.txt create mode 100644 spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java diff --git a/spring-apache-camel/data/file1.txt b/spring-apache-camel/data/file1.txt deleted file mode 100644 index c8436b654b..0000000000 --- a/spring-apache-camel/data/file1.txt +++ /dev/null @@ -1 +0,0 @@ -THIS IS UPPERCASE CONTENT. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/input/.camel/file1.txt b/spring-apache-camel/data/input/.camel/file1.txt deleted file mode 100644 index c8436b654b..0000000000 --- a/spring-apache-camel/data/input/.camel/file1.txt +++ /dev/null @@ -1 +0,0 @@ -THIS IS UPPERCASE CONTENT. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/outputLowerCase/file1.txt b/spring-apache-camel/data/outputLowerCase/file1.txt deleted file mode 100644 index 06a9866342..0000000000 --- a/spring-apache-camel/data/outputLowerCase/file1.txt +++ /dev/null @@ -1 +0,0 @@ -this is uppercase content. this is lowecase content. \ No newline at end of file diff --git a/spring-apache-camel/data/outputUppperCase/file1.txt b/spring-apache-camel/data/outputUppperCase/file1.txt deleted file mode 100644 index ce07e477bc..0000000000 --- a/spring-apache-camel/data/outputUppperCase/file1.txt +++ /dev/null @@ -1 +0,0 @@ -THIS IS UPPERCASE CONTENT. THIS IS LOWECASE CONTENT. \ No newline at end of file diff --git a/spring-apache-camel/pom.xml b/spring-apache-camel/pom.xml index 5b143fedb4..fbea9b779d 100644 --- a/spring-apache-camel/pom.xml +++ b/spring-apache-camel/pom.xml @@ -11,10 +11,19 @@ 2.16.1 4.2.4.RELEASE + 1.7 + 4.1 - + + + junit + junit + ${junit.version} + test + + org.apache.camel camel-core @@ -40,4 +49,19 @@ + + + + + maven-compiler-plugin + + true + true + ${java.version} + ${java.version} + ${java.version} + + + + diff --git a/spring-apache-camel/src/main/java/org/apache/camel/main/App.java b/spring-apache-camel/src/main/java/org/apache/camel/main/App.java index 4d0793903e..8674caefca 100644 --- a/spring-apache-camel/src/main/java/org/apache/camel/main/App.java +++ b/spring-apache-camel/src/main/java/org/apache/camel/main/App.java @@ -4,9 +4,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class App { public static void main(final String[] args) throws Exception { - //Load application context ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context.xml"); - Thread.sleep(5000); + // Keep main thread alive for some time to let application finish processing the input files. + Thread.sleep(5000); applicationContext.close(); } } \ No newline at end of file diff --git a/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java b/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java index 961f877806..a98c77feb8 100644 --- a/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java +++ b/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java @@ -6,13 +6,8 @@ import org.apache.camel.Processor; public class FileProcessor implements Processor { public void process(Exchange exchange) throws Exception { - //Read file content - String originalFileContent = (String)exchange.getIn().getBody(String.class); - - //Convert file content to upper case. + String originalFileContent = exchange.getIn().getBody(String.class); String upperCaseFileContent = originalFileContent.toUpperCase(); - - //Update file content. exchange.getIn().setBody(upperCaseFileContent); } diff --git a/spring-apache-camel/src/main/resources/camel-context.xml b/spring-apache-camel/src/main/resources/camel-context.xml index d304ceb857..75e2a61711 100644 --- a/spring-apache-camel/src/main/resources/camel-context.xml +++ b/spring-apache-camel/src/main/resources/camel-context.xml @@ -1,40 +1,39 @@ + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - - + + + - - + + - + - - + + ${body.toLowerCase()} - + - - + + - .......... File content conversion completed .......... + .......... File content conversion completed .......... + - + - + diff --git a/spring-apache-camel/src/test/data/sampleInputFile/file.txt b/spring-apache-camel/src/test/data/sampleInputFile/file.txt new file mode 100644 index 0000000000..c1df3791c9 --- /dev/null +++ b/spring-apache-camel/src/test/data/sampleInputFile/file.txt @@ -0,0 +1 @@ +THIS IS UPPERCASE CONTENT. this is lowercase content. \ No newline at end of file diff --git a/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java b/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java new file mode 100644 index 0000000000..75a161d8cc --- /dev/null +++ b/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java @@ -0,0 +1,117 @@ +package org.apache.camel.main; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.nio.file.Files; +import java.nio.file.Paths; + +import junit.framework.TestCase; + +import org.apache.camel.util.FileUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class AppTest extends TestCase { + + private static final String FILE_NAME = "file.txt"; + private static final String SAMPLE_INPUT_DIR = "src/test/data/sampleInputFile/"; + private static final String TEST_INPUT_DIR = "src/test/data/input/"; + private static final String UPPERCARE_OUTPUT_DIR = "src/test/data/outputUpperCase/"; + private static final String LOWERCASE_OUTPUT_DIR = "src/test/data/outputLowerCase/"; + + @Before + public void setUp() throws Exception { + // Prepare input file for test + copySampleFileToInputDirectory(); + } + + @After + public void tearDown() throws Exception { + System.out.println("Deleting the test input and output files..."); + deleteFile(TEST_INPUT_DIR); + deleteFile(LOWERCASE_OUTPUT_DIR); + deleteFile(UPPERCARE_OUTPUT_DIR); + } + + @Test + public final void testMain() throws Exception { + App.main(null); + + String inputFileContent = readFileContent(SAMPLE_INPUT_DIR+FILE_NAME); + String outputUpperCase = readFileContent(UPPERCARE_OUTPUT_DIR+FILE_NAME); + String outputLowerCase = readFileContent(LOWERCASE_OUTPUT_DIR+FILE_NAME); + + System.out.println("Input File content = ["+inputFileContent+"]"); + System.out.println("UpperCaseOutput file content = ["+outputUpperCase+"]"); + System.out.println("LowerCaseOtput file content = ["+outputLowerCase+"]"); + + assertEquals(inputFileContent.toUpperCase(), outputUpperCase); + assertEquals(inputFileContent.toLowerCase(), outputLowerCase); + } + + private String readFileContent(String path) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded); + } + + private void deleteFile(String path) { + try { + FileUtil.removeDir(new File(path)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Copy sample input file to input directory. + */ + private void copySampleFileToInputDirectory() { + File sourceFile = new File(SAMPLE_INPUT_DIR + FILE_NAME); + File destFile = new File(TEST_INPUT_DIR + FILE_NAME); + + if (!sourceFile.exists()) { + System.out.println("Sample input file not found at location = [" + SAMPLE_INPUT_DIR + FILE_NAME + "]. Please provide this file."); + } + + if (!destFile.exists()) { + try { + System.out.println("Creating input file = [" + TEST_INPUT_DIR + FILE_NAME + "]"); + + File destDir = new File(TEST_INPUT_DIR); + if(!destDir.exists()) { + destDir.mkdir(); + } + destFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + FileChannel source = null; + FileChannel destination = null; + + try { + source = new FileInputStream(sourceFile).getChannel(); + destination = new FileOutputStream(destFile).getChannel(); + if (destination != null && source != null) { + destination.transferFrom(source, 0, source.size()); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + source.close(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + destination.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} From 7fb50bfaed8280acf7c4dbdf486087dac7d2b7b0 Mon Sep 17 00:00:00 2001 From: Kevin Gilmore Date: Wed, 17 Feb 2016 11:38:29 -0600 Subject: [PATCH 0156/1106] Added files for RAML annotations article --- raml/annotations/api.raml | 126 ++++++++++++++++++ raml/annotations/examples/Bar.json | 6 + raml/annotations/examples/Bars.json | 19 +++ raml/annotations/examples/Error.json | 4 + raml/annotations/examples/Foo.json | 4 + raml/annotations/examples/Foos.json | 16 +++ .../extensions/en_US/additionalResources.raml | 13 ++ raml/annotations/libraries/dataTypes.raml | 19 +++ raml/annotations/libraries/resourceTypes.raml | 38 ++++++ .../libraries/securitySchemes.raml | 20 +++ raml/annotations/libraries/traits.raml | 32 +++++ .../overlays/es_ES/additionalResources.raml | 11 ++ .../overlays/es_ES/documentationItems.raml | 22 +++ 13 files changed, 330 insertions(+) create mode 100644 raml/annotations/api.raml create mode 100644 raml/annotations/examples/Bar.json create mode 100644 raml/annotations/examples/Bars.json create mode 100644 raml/annotations/examples/Error.json create mode 100644 raml/annotations/examples/Foo.json create mode 100644 raml/annotations/examples/Foos.json create mode 100644 raml/annotations/extensions/en_US/additionalResources.raml create mode 100644 raml/annotations/libraries/dataTypes.raml create mode 100644 raml/annotations/libraries/resourceTypes.raml create mode 100644 raml/annotations/libraries/securitySchemes.raml create mode 100644 raml/annotations/libraries/traits.raml create mode 100644 raml/annotations/overlays/es_ES/additionalResources.raml create mode 100644 raml/annotations/overlays/es_ES/documentationItems.raml diff --git a/raml/annotations/api.raml b/raml/annotations/api.raml new file mode 100644 index 0000000000..e0123536eb --- /dev/null +++ b/raml/annotations/api.raml @@ -0,0 +1,126 @@ +#%RAML 1.0 +title: API for REST Services used in the RAML tutorials on Baeldung.com +documentation: + - title: Overview + content: | + This document defines the interface for the REST services + used in the popular RAML Tutorial series at Baeldung.com. + - title: Disclaimer + content: | + All names used in this definition are purely fictional. + Any similarities between the names used in this tutorial and those of real persons, whether living or dead, are merely coincidental. + - title: Copyright + content: Copyright 2016 by Baeldung.com. All rights reserved. +uses: + mySecuritySchemes: !include libraries/securitySchemes.raml + myDataTypes: !include libraries/dataTypes.raml + myTraits: !include libraries/traits.raml + myResourceTypes: !include libraries/resourceTypes.raml +version: v1 +protocols: [ HTTPS ] +baseUri: http://rest-api.baeldung.com/api/{version} +mediaType: application/json +securedBy: [ mySecuritySchemes.basicAuth ] +annotationTypes: + testCase: + allowedTargets: [ Method ] + allowMultiple: true + usage: | + Use this annotation to declare a test case + within a testSuite declaration. + You may apply this annotation multiple times + within the target testSuite. + properties: + scenario: string + setupScript?: string[] + testScript: string[] + expectedOutput?: string + cleanupScript?: string[] +/foos: + type: myResourceTypes.collection + get: + queryParameters: + name?: string + ownerName?: string + responses: + 200: + body: + example: !include examples/Foos.json + (testCase): + scenario: No Foos + setupScript: deleteAllFoosIfAny + testScript: getAllFoos + expectedOutput: "" + (testCase): + scenario: One Foo + setupScript: [ deleteAllFoosIfAny, addInputFoos ] + testScript: getAllFoos + expectedOutput: '[ { "id": 999, "name": Joe } ]' + cleanupScript: deleteInputFoos + (testCase): + scenario: Multiple Foos + setupScript: [ deleteAllFoosIfAny, addInputFoos ] + testScript: getAllFoos + expectedOutput: '[ { "id": 998, "name": "Bob" }, { "id": 999, "name": "Joe", "ownerName": "Bob" } ]' + cleanupScript: deleteInputFoos + post: + responses: + 200: + body: + example: !include examples/Foo.json + /{fooId}: + type: myResourceTypes.item + get: + responses: + 200: + body: + example: !include examples/Foo.json + put: + responses: + 200: + body: + example: !include examples/Foo.json +/foos/name/{name}: + get: + description: Get all Foos with the name {name} + responses: + 200: + body: + type: myDataTypes.Foo + 404: + body: + type: myDataTypes.Error +/foos/bar/{barId}: + get: + description: Get the Foo for the Bar with barId = {barId} + responses: + 200: + body: + example: !include examples/Foo.json +/bars: + type: myResourceTypes.collection + get: + queryParameters: + name?: string + ownerName?: string + responses: + 200: + body: + example: !include examples/Bars.json + post: + responses: + 200: + body: + example: !include examples/Bar.json + /{barId}: + type: myResourceTypes.item + get: + responses: + 200: + body: + example: !include examples/Bar.json + put: + responses: + 200: + body: + example: !include examples/Bars.json diff --git a/raml/annotations/examples/Bar.json b/raml/annotations/examples/Bar.json new file mode 100644 index 0000000000..0ee1b34edb --- /dev/null +++ b/raml/annotations/examples/Bar.json @@ -0,0 +1,6 @@ +{ + "id" : 1, + "name" : "First Bar", + "city" : "Austin", + "fooId" : 2 +} \ No newline at end of file diff --git a/raml/annotations/examples/Bars.json b/raml/annotations/examples/Bars.json new file mode 100644 index 0000000000..89ea875432 --- /dev/null +++ b/raml/annotations/examples/Bars.json @@ -0,0 +1,19 @@ +[ + { + "id" : 1, + "name" : "First Bar", + "city" : "Austin", + "fooId" : 2 + }, + { + "id" : 2, + "name" : "Second Bar", + "city" : "Dallas", + "fooId" : 1 + }, + { + "id" : 3, + "name" : "Third Bar", + "fooId" : 2 + } +] \ No newline at end of file diff --git a/raml/annotations/examples/Error.json b/raml/annotations/examples/Error.json new file mode 100644 index 0000000000..dca56da7c2 --- /dev/null +++ b/raml/annotations/examples/Error.json @@ -0,0 +1,4 @@ +{ + "message" : "Not found", + "code" : 1001 +} \ No newline at end of file diff --git a/raml/annotations/examples/Foo.json b/raml/annotations/examples/Foo.json new file mode 100644 index 0000000000..1b1b8c891e --- /dev/null +++ b/raml/annotations/examples/Foo.json @@ -0,0 +1,4 @@ +{ + "id" : 1, + "name" : "First Foo" +} \ No newline at end of file diff --git a/raml/annotations/examples/Foos.json b/raml/annotations/examples/Foos.json new file mode 100644 index 0000000000..74f64689f0 --- /dev/null +++ b/raml/annotations/examples/Foos.json @@ -0,0 +1,16 @@ +[ + { + "id" : 1, + "name" : "First Foo", + "ownerName" : "Jack Robinson" + }, + { + "id" : 2, + "name" : "Second Foo" + }, + { + "id" : 3, + "name" : "Third Foo", + "ownerName" : "Chuck Norris" + } +] \ No newline at end of file diff --git a/raml/annotations/extensions/en_US/additionalResources.raml b/raml/annotations/extensions/en_US/additionalResources.raml new file mode 100644 index 0000000000..9ab0d0a243 --- /dev/null +++ b/raml/annotations/extensions/en_US/additionalResources.raml @@ -0,0 +1,13 @@ +#%RAML 1.0 Extension +# File located at: +# /extensions/en_US/additionalResources.raml +masterRef: ../../api.raml +usage: This extension defines additional resources for version 2 of the API. +version: v2 +/foos: + /bar/{barId}: + get: + description: | + Get the foo that is related to the bar having barId = {barId} + queryParameters: + barId?: integer diff --git a/raml/annotations/libraries/dataTypes.raml b/raml/annotations/libraries/dataTypes.raml new file mode 100644 index 0000000000..8a240e62dc --- /dev/null +++ b/raml/annotations/libraries/dataTypes.raml @@ -0,0 +1,19 @@ +#%RAML 1.0 Library +# This is the file /libraries/dataTypes.raml +usage: This library defines the data types for the API +types: + Foo: + properties: + id: integer + name: string + ownerName?: string + Bar: + properties: + id: integer + name: string + city?: string + fooId: integer + Error: + properties: + code: integer + message: string diff --git a/raml/annotations/libraries/resourceTypes.raml b/raml/annotations/libraries/resourceTypes.raml new file mode 100644 index 0000000000..fb054f1a36 --- /dev/null +++ b/raml/annotations/libraries/resourceTypes.raml @@ -0,0 +1,38 @@ +#%RAML 1.0 Library +# This is the file /libraries/resourceTypes.raml +usage: This library defines the resource types for the API +uses: + myTraits: !include traits.raml +resourceTypes: + collection: + usage: Use this resourceType to represent a collection of items + description: A collection of <> + get: + description: | + Get all <>, + optionally filtered + is: [ myTraits.hasResponseCollection ] + post: + description: | + Create a new <> + is: [ myTraits.hasRequestItem ] + item: + usage: Use this resourceType to represent any single item + description: A single <> + get: + description: | + Get a <> + by <>Id + is: [ myTraits.hasResponseItem, myTraits.hasNotFound ] + put: + description: | + Update a <> + by <>Id + is: [ myTraits.hasRequestItem, myTraits.hasResponseItem, myTraits.hasNotFound ] + delete: + description: | + Delete a <> + by <>Id + is: [ myTraits.hasNotFound ] + responses: + 204: diff --git a/raml/annotations/libraries/securitySchemes.raml b/raml/annotations/libraries/securitySchemes.raml new file mode 100644 index 0000000000..621c6ac975 --- /dev/null +++ b/raml/annotations/libraries/securitySchemes.raml @@ -0,0 +1,20 @@ +#%RAML 1.0 Library +# This is the file /libraries/securitySchemes.raml +securitySchemes: + - basicAuth: + description: Each request must contain the headers necessary for + basic authentication + type: Basic Authentication + describedBy: + headers: + Authorization: + description: | + Used to send the Base64 encoded "username:password" + credentials + type: string + responses: + 401: + description: | + Unauthorized. Either the provided username and password + combination is invalid, or the user is not allowed to + access the content provided by the requested URL. diff --git a/raml/annotations/libraries/traits.raml b/raml/annotations/libraries/traits.raml new file mode 100644 index 0000000000..610747e79f --- /dev/null +++ b/raml/annotations/libraries/traits.raml @@ -0,0 +1,32 @@ +#%RAML 1.0 Library +# This is the file /libraries/traits.raml +usage: This library defines some basic traits +uses: + myDataTypes: !include dataTypes.raml +traits: + hasRequestItem: + usage: Use this trait for resources whose request body is a single item + body: + application/json: + type: <> + hasResponseItem: + usage: Use this trait for resources whose response body is a single item + responses: + 200: + body: + application/json: + type: <> + hasResponseCollection: + usage: Use this trait for resources whose response body is a collection of items + responses: + 200: + body: + application/json: + type: <>[] + hasNotFound: + usage: Use this trait for resources that could respond with a 404 status + responses: + 404: + body: + application/json: + type: myDataTypes.Error diff --git a/raml/annotations/overlays/es_ES/additionalResources.raml b/raml/annotations/overlays/es_ES/additionalResources.raml new file mode 100644 index 0000000000..0edd6a9231 --- /dev/null +++ b/raml/annotations/overlays/es_ES/additionalResources.raml @@ -0,0 +1,11 @@ +#%RAML 1.0 Overlay +# Archivo situado en: +# /overlays/es_ES/additionalResources.raml +masterRef: ../../api.raml +usage: | + Se trata de un español demasiado que describe los recursos adicionales + para la versión 1 del API. +/foos/bar/{barId}: + get: + description: | + Obtener el foo que se relaciona con el bar tomando barId = {barId} diff --git a/raml/annotations/overlays/es_ES/documentationItems.raml b/raml/annotations/overlays/es_ES/documentationItems.raml new file mode 100644 index 0000000000..49dd46fb59 --- /dev/null +++ b/raml/annotations/overlays/es_ES/documentationItems.raml @@ -0,0 +1,22 @@ +#%RAML 1.0 Overlay +# File located at (archivo situado en): +# /overlays/es_ES/documentationItems.raml +masterRef: ../../api.raml +usage: | + To provide user documentation and other descriptive text in Spanish + (Para proporcionar la documentación del usuario y otro texto descriptivo en español) +title: API para servicios REST utilizados en los tutoriales RAML en Baeldung.com +documentation: + - title: Descripción general + content: | + Este documento define la interfaz para los servicios REST + utilizados en la popular serie de RAML Tutorial en Baeldung.com + - title: Renuncia + content: | + Todos los nombres usados ​​en esta definición son pura ficción. + Cualquier similitud entre los nombres utilizados en este tutorial + y los de las personas reales, ya sea vivo o muerto, + no son más que coincidenta. + - title: Derechos de autor + content: | + Derechos de autor 2016 por Baeldung.com. Todos los derechos reservados. From eabccf2b8ff2225a135b5d7981623cd67c053bc3 Mon Sep 17 00:00:00 2001 From: ankur-singhal Date: Wed, 17 Feb 2016 23:43:27 +0530 Subject: [PATCH 0157/1106] Performance of GSON and Jackson Code Changes Performance of GSON and Jackson Code Changes --- gson-jackson-performance/.classpath | 14 + gson-jackson-performance/.project | 14 + gson-jackson-performance/README.md | 5 + gson-jackson-performance/log.out | 35 + .../log4j-application 100mb gson.log | 490 +++++++++++ .../log4j-application 100mb jackson.log | 370 +++++++++ .../log4j-application 10kb gson.log | 490 +++++++++++ .../log4j-application 10kb jackson.log | 370 +++++++++ ...ication complex Gson Jackson 250mb 10R.log | 151 ++++ ...ication complex Gson Jackson 250mb 50R.log | 710 ++++++++++++++++ ...lication simple Gson Jackson 100mb 10R.log | 160 ++++ ...lication simple Gson Jackson 100mb 50R.log | 760 ++++++++++++++++++ ...lication simple Gson Jackson 250mb 10R.log | 160 ++++ ...lication simple Gson Jackson 250mb 50R.log | 760 ++++++++++++++++++ gson-jackson-performance/pom.xml | 72 ++ .../data/complex/ComplexDataGeneration.java | 63 ++ .../data/complex/ComplexDataGson.java | 91 +++ .../data/complex/ComplexDataJackson.java | 95 +++ .../data/simple/SimpleDataGeneration.java | 35 + .../baeldung/data/simple/SimpleDataGson.java | 91 +++ .../data/simple/SimpleDataJackson.java | 95 +++ .../org/baeldung/data/utility/Utility.java | 90 +++ .../baeldung/pojo/complex/AddressDetails.java | 37 + .../baeldung/pojo/complex/ContactDetails.java | 25 + .../pojo/complex/CustomerAddressDetails.java | 18 + .../complex/CustomerPortfolioComplex.java | 17 + .../org/baeldung/pojo/simple/Customer.java | 36 + .../pojo/simple/CustomerPortfolioSimple.java | 16 + .../src/main/resources/log4j.properties | 16 + 29 files changed, 5286 insertions(+) create mode 100644 gson-jackson-performance/.classpath create mode 100644 gson-jackson-performance/.project create mode 100644 gson-jackson-performance/README.md create mode 100644 gson-jackson-performance/log.out create mode 100644 gson-jackson-performance/logs_Performance/log4j-application 100mb gson.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application 100mb jackson.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application 10kb gson.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application 10kb jackson.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 10R.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 50R.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 10R.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 50R.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 10R.log create mode 100644 gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 50R.log create mode 100644 gson-jackson-performance/pom.xml create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGeneration.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGson.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataJackson.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGeneration.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGson.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataJackson.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/data/utility/Utility.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/AddressDetails.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/ContactDetails.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerAddressDetails.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerPortfolioComplex.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/Customer.java create mode 100644 gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/CustomerPortfolioSimple.java create mode 100644 gson-jackson-performance/src/main/resources/log4j.properties diff --git a/gson-jackson-performance/.classpath b/gson-jackson-performance/.classpath new file mode 100644 index 0000000000..85e0397901 --- /dev/null +++ b/gson-jackson-performance/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gson-jackson-performance/.project b/gson-jackson-performance/.project new file mode 100644 index 0000000000..b3b5ccad87 --- /dev/null +++ b/gson-jackson-performance/.project @@ -0,0 +1,14 @@ + + + gson-jackson-performance + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/gson-jackson-performance/README.md b/gson-jackson-performance/README.md new file mode 100644 index 0000000000..9bbe679dfc --- /dev/null +++ b/gson-jackson-performance/README.md @@ -0,0 +1,5 @@ +## Performance of GSON and Jackson + +## STandalone java programs to measure the performance of both JSON API's + +## based on file size , iterations. \ No newline at end of file diff --git a/gson-jackson-performance/log.out b/gson-jackson-performance/log.out new file mode 100644 index 0000000000..076ff3892c --- /dev/null +++ b/gson-jackson-performance/log.out @@ -0,0 +1,35 @@ +Java HotSpot(TM) 64-Bit Server VM (25.45-b02) for windows-amd64 JRE (1.8.0_45-b15), built on Apr 30 2015 12:40:44 by "java_re" with MS VC++ 10.0 (VS2010) +Memory: 4k page, physical 8291728k(5579796k free), swap 16581620k(12609940k free) +CommandLine flags: -XX:InitialHeapSize=132667648 -XX:MaxHeapSize=2122682368 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC +0.363: [GC (Allocation Failure) [PSYoungGen: 33280K->5096K(38400K)] 33280K->10228K(125952K), 0.0092249 secs] [Times: user=0.00 sys=0.00, real=0.01 secs] +0.414: [GC (Allocation Failure) [PSYoungGen: 38376K->5106K(71680K)] 43508K->24102K(159232K), 0.0186113 secs] [Times: user=0.06 sys=0.00, real=0.02 secs] +0.516: [GC (Allocation Failure) [PSYoungGen: 71666K->5097K(71680K)] 90662K->52229K(159232K), 0.0445313 secs] [Times: user=0.16 sys=0.03, real=0.04 secs] +0.651: [GC (Allocation Failure) [PSYoungGen: 71657K->5109K(138240K)] 118789K->80322K(225792K), 0.0512456 secs] [Times: user=0.19 sys=0.02, real=0.06 secs] +0.702: [Full GC (Ergonomics) [PSYoungGen: 5109K->0K(138240K)] [ParOldGen: 75212K->77437K(170496K)] 80322K->77437K(308736K), [Metaspace: 7004K->7004K(1056768K)], 0.5375812 secs] [Times: user=1.48 sys=0.00, real=0.54 secs] +1.406: [GC (Allocation Failure) [PSYoungGen: 133120K->5088K(138240K)] 210557K->133918K(308736K), 0.1172537 secs] [Times: user=0.34 sys=0.03, real=0.13 secs] +1.523: [Full GC (Ergonomics) [PSYoungGen: 5088K->0K(138240K)] [ParOldGen: 128829K->133416K(284160K)] 133918K->133416K(422400K), [Metaspace: 7004K->7004K(1056768K)], 0.9853907 secs] [Times: user=2.78 sys=0.02, real=0.99 secs] +2.691: [GC (Allocation Failure) [PSYoungGen: 133120K->56497K(227840K)] 266536K->189913K(512000K), 0.1302934 secs] [Times: user=0.33 sys=0.03, real=0.13 secs] +3.015: [GC (Allocation Failure) [PSYoungGen: 222385K->71657K(237568K)] 355801K->259810K(521728K), 0.1589475 secs] [Times: user=0.50 sys=0.02, real=0.17 secs] +3.372: [GC (Allocation Failure) [PSYoungGen: 237545K->112638K(295424K)] 425698K->329655K(579584K), 0.1698426 secs] [Times: user=0.47 sys=0.00, real=0.17 secs] +3.761: [GC (Allocation Failure) [PSYoungGen: 295422K->145918K(328704K)] 512439K->406791K(612864K), 0.2285356 secs] [Times: user=0.67 sys=0.03, real=0.24 secs] +3.989: [Full GC (Ergonomics) [PSYoungGen: 145918K->121734K(328704K)] [ParOldGen: 260872K->283948K(478720K)] 406791K->405682K(807424K), [Metaspace: 7004K->7004K(1056768K)], 2.7389690 secs] [Times: user=7.89 sys=0.00, real=2.74 secs] +6.963: [GC (Allocation Failure) [PSYoungGen: 304518K->189438K(378368K)] 588466K->484050K(857088K), 0.2961369 secs] [Times: user=0.87 sys=0.06, real=0.30 secs] +7.486: [GC (Allocation Failure) [PSYoungGen: 378366K->220926K(413696K)] 672978K->563874K(892416K), 0.2904383 secs] [Times: user=0.86 sys=0.03, real=0.30 secs] +8.002: [GC (System.gc()) [PSYoungGen: 409787K->158432K(460800K)] 752736K->643074K(946176K), 0.3470548 secs] [Times: user=1.01 sys=0.05, real=0.35 secs] +8.349: [Full GC (System.gc()) [PSYoungGen: 158432K->155661K(460800K)] [ParOldGen: 484642K->484968K(485376K)] 643074K->640630K(946176K), [Metaspace: 7039K->7039K(1056768K)], 3.8112607 secs] [Times: user=10.73 sys=0.03, real=3.81 secs] +12.864: [Full GC (Ergonomics) [PSYoungGen: 385748K->319385K(460800K)] [ParOldGen: 484968K->485363K(773632K)] 870716K->804749K(1234432K), [Metaspace: 7719K->7719K(1056768K)], 2.7333253 secs] [Times: user=7.02 sys=0.02, real=2.73 secs] +15.598: [GC (Allocation Failure) [PSYoungGen: 319494K->163753K(460800K)] 805371K->805902K(1234432K), 0.2532505 secs] [Times: user=0.98 sys=0.08, real=0.25 secs] +15.851: [Full GC (Ergonomics) [PSYoungGen: 163753K->31983K(460800K)] [ParOldGen: 642148K->772967K(1150976K)] 805902K->804950K(1611776K), [Metaspace: 7720K->7720K(1056768K)], 3.1227324 secs] [Times: user=8.89 sys=0.05, real=3.12 secs] +19.257: [GC (Allocation Failure) [PSYoungGen: 262383K->169509K(460800K)] 1035350K->974460K(1611776K), 0.1370666 secs] [Times: user=0.36 sys=0.02, real=0.14 secs] +19.691: [GC (Allocation Failure) --[PSYoungGen: 273197K->273197K(460800K)] 1487836K->1656297K(1844224K), 0.1069653 secs] [Times: user=0.06 sys=0.05, real=0.10 secs] +19.798: [Full GC (Ergonomics) [PSYoungGen: 273197K->77314K(460800K)] [ParOldGen: 1383099K->1383092K(1383424K)] 1656297K->1460407K(1844224K), [Metaspace: 7720K->7720K(1056768K)], 2.2582744 secs] [Times: user=6.10 sys=0.02, real=2.26 secs] +22.056: [Full GC (Allocation Failure) [PSYoungGen: 77314K->77314K(460800K)] [ParOldGen: 1383092K->1383008K(1383424K)] 1460407K->1460322K(1844224K), [Metaspace: 7720K->7720K(1056768K)], 3.0326600 secs] [Times: user=7.74 sys=0.02, real=3.04 secs] +Heap + PSYoungGen total 460800K, used 85443K [0x00000000d5d00000, 0x0000000100000000, 0x0000000100000000) + eden space 230400K, 3% used [0x00000000d5d00000,0x00000000d64f02b8,0x00000000e3e00000) + from space 230400K, 33% used [0x00000000f1f00000,0x00000000f6a809a0,0x0000000100000000) + to space 230400K, 0% used [0x00000000e3e00000,0x00000000e3e00000,0x00000000f1f00000) + ParOldGen total 1383424K, used 1383008K [0x0000000081600000, 0x00000000d5d00000, 0x00000000d5d00000) + object space 1383424K, 99% used [0x0000000081600000,0x00000000d5c980e8,0x00000000d5d00000) + Metaspace used 7736K, capacity 7846K, committed 8064K, reserved 1056768K + class space used 849K, capacity 857K, committed 896K, reserved 1048576K diff --git a/gson-jackson-performance/logs_Performance/log4j-application 100mb gson.log b/gson-jackson-performance/logs_Performance/log4j-application 100mb gson.log new file mode 100644 index 0000000000..827fc6b8ff --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application 100mb gson.log @@ -0,0 +1,490 @@ +2016-02-13 19:37:16 INFO ComplexDataGson:27 - -------Round 1 +2016-02-13 19:37:18 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1278083466 +2016-02-13 19:37:19 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:37:19 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:37:27 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8332113036 +2016-02-13 19:37:27 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:37:30 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1113664562 +2016-02-13 19:37:30 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:37:31 INFO ComplexDataGson:27 - -------Round 2 +2016-02-13 19:37:33 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1000705020 +2016-02-13 19:37:33 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:37:33 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:37:42 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8658432353 +2016-02-13 19:37:42 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:37:44 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1243221682 +2016-02-13 19:37:44 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:37:45 INFO ComplexDataGson:27 - -------Round 3 +2016-02-13 19:37:47 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1008859332 +2016-02-13 19:37:48 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:37:48 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:37:56 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8392288043 +2016-02-13 19:37:56 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:37:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1277124228 +2016-02-13 19:37:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:37:59 INFO ComplexDataGson:27 - -------Round 4 +2016-02-13 19:38:01 INFO ComplexDataGson:53 - Json Generation Time(ms):: 995015515 +2016-02-13 19:38:02 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:38:02 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:38:10 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8797346582 +2016-02-13 19:38:10 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:38:13 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1649643681 +2016-02-13 19:38:13 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:38:14 INFO ComplexDataGson:27 - -------Round 5 +2016-02-13 19:38:17 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1272820685 +2016-02-13 19:38:17 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:38:17 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:38:26 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9312540240 +2016-02-13 19:38:26 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:38:28 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1257408139 +2016-02-13 19:38:28 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:38:30 INFO ComplexDataGson:27 - -------Round 6 +2016-02-13 19:38:32 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1068332478 +2016-02-13 19:38:32 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:38:32 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:38:41 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8912581452 +2016-02-13 19:38:41 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:38:43 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1264009906 +2016-02-13 19:38:43 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:38:44 INFO ComplexDataGson:27 - -------Round 7 +2016-02-13 19:38:46 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1008157075 +2016-02-13 19:38:46 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:38:46 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:38:55 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8505211268 +2016-02-13 19:38:55 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:38:57 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1251681923 +2016-02-13 19:38:57 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:38:58 INFO ComplexDataGson:27 - -------Round 8 +2016-02-13 19:39:01 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1006583609 +2016-02-13 19:39:01 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:39:01 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:39:10 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8752857286 +2016-02-13 19:39:10 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:39:12 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1414701446 +2016-02-13 19:39:12 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:39:13 INFO ComplexDataGson:27 - -------Round 9 +2016-02-13 19:39:16 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1294525120 +2016-02-13 19:39:16 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:39:16 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:39:26 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10191596918 +2016-02-13 19:39:26 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:39:29 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1658383009 +2016-02-13 19:39:29 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:39:30 INFO ComplexDataGson:27 - -------Round 10 +2016-02-13 19:39:33 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1309101589 +2016-02-13 19:39:33 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:39:33 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:39:43 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9762623354 +2016-02-13 19:39:43 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:39:45 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1260306380 +2016-02-13 19:39:45 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:39:46 INFO ComplexDataGson:39 - -------------------------------------------------------------------------- +2016-02-13 19:39:46 INFO ComplexDataGson:40 - Average Time to Generate JSON : 1124218388 +2016-02-13 19:39:46 INFO ComplexDataGson:41 - Average Time to Parse JSON To Map : 8961759053 +2016-02-13 19:39:46 INFO ComplexDataGson:42 - Average Time to Parse JSON To Actual Object : 1339014495 +2016-02-13 19:39:46 INFO ComplexDataGson:43 - -------------------------------------------------------------------------- +2016-02-13 19:41:32 INFO ComplexDataGson:27 - -------Round 1 +2016-02-13 19:41:34 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1191851136 +2016-02-13 19:41:35 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:41:35 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:41:45 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10080407033 +2016-02-13 19:41:45 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:41:48 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1379953348 +2016-02-13 19:41:48 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:41:50 INFO ComplexDataGson:27 - -------Round 2 +2016-02-13 19:41:52 INFO ComplexDataGson:53 - Json Generation Time(ms):: 956293094 +2016-02-13 19:41:52 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:41:52 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:42:01 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8813430199 +2016-02-13 19:42:01 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:42:03 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1274304543 +2016-02-13 19:42:03 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:42:04 INFO ComplexDataGson:27 - -------Round 3 +2016-02-13 19:42:06 INFO ComplexDataGson:53 - Json Generation Time(ms):: 927398321 +2016-02-13 19:42:06 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:42:06 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:42:15 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8356408992 +2016-02-13 19:42:15 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:42:17 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1322685660 +2016-02-13 19:42:17 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:42:18 INFO ComplexDataGson:27 - -------Round 4 +2016-02-13 19:42:21 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1207259733 +2016-02-13 19:42:21 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:42:21 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:42:31 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10045768675 +2016-02-13 19:42:31 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:42:33 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1245056076 +2016-02-13 19:42:33 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:42:34 INFO ComplexDataGson:27 - -------Round 5 +2016-02-13 19:42:36 INFO ComplexDataGson:53 - Json Generation Time(ms):: 915288634 +2016-02-13 19:42:36 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:42:36 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:42:45 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8618376472 +2016-02-13 19:42:45 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:42:47 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1269665068 +2016-02-13 19:42:47 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:42:49 INFO ComplexDataGson:27 - -------Round 6 +2016-02-13 19:42:50 INFO ComplexDataGson:53 - Json Generation Time(ms):: 932316093 +2016-02-13 19:42:51 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:42:51 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:43:00 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8813796130 +2016-02-13 19:43:00 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:43:02 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1313783696 +2016-02-13 19:43:02 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:43:03 INFO ComplexDataGson:27 - -------Round 7 +2016-02-13 19:43:05 INFO ComplexDataGson:53 - Json Generation Time(ms):: 915598117 +2016-02-13 19:43:05 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:43:05 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:43:14 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8961026913 +2016-02-13 19:43:14 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:43:16 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1261592864 +2016-02-13 19:43:16 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:43:17 INFO ComplexDataGson:27 - -------Round 8 +2016-02-13 19:43:19 INFO ComplexDataGson:53 - Json Generation Time(ms):: 920982875 +2016-02-13 19:43:19 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:43:19 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:43:28 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8618532792 +2016-02-13 19:43:28 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:43:30 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1245481219 +2016-02-13 19:43:30 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:43:31 INFO ComplexDataGson:27 - -------Round 9 +2016-02-13 19:43:33 INFO ComplexDataGson:53 - Json Generation Time(ms):: 913480688 +2016-02-13 19:43:34 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:43:34 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:43:42 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8243017597 +2016-02-13 19:43:42 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:43:44 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1230475265 +2016-02-13 19:43:44 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:43:45 INFO ComplexDataGson:27 - -------Round 10 +2016-02-13 19:43:47 INFO ComplexDataGson:53 - Json Generation Time(ms):: 927227001 +2016-02-13 19:43:47 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:43:47 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:43:55 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 7879612879 +2016-02-13 19:43:55 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:43:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1296596758 +2016-02-13 19:43:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:43:59 INFO ComplexDataGson:27 - -------Round 11 +2016-02-13 19:44:01 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1105414720 +2016-02-13 19:44:01 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:44:01 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:44:12 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10599177108 +2016-02-13 19:44:12 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:44:14 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1250150300 +2016-02-13 19:44:14 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:44:15 INFO ComplexDataGson:27 - -------Round 12 +2016-02-13 19:44:17 INFO ComplexDataGson:53 - Json Generation Time(ms):: 934354968 +2016-02-13 19:44:18 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:44:18 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:44:26 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8623628596 +2016-02-13 19:44:26 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:44:28 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1266831567 +2016-02-13 19:44:28 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:44:30 INFO ComplexDataGson:27 - -------Round 13 +2016-02-13 19:44:32 INFO ComplexDataGson:53 - Json Generation Time(ms):: 915319424 +2016-02-13 19:44:32 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:44:32 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:44:40 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8506292877 +2016-02-13 19:44:40 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:44:43 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1263272517 +2016-02-13 19:44:43 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:44:44 INFO ComplexDataGson:27 - -------Round 14 +2016-02-13 19:44:46 INFO ComplexDataGson:53 - Json Generation Time(ms):: 953177742 +2016-02-13 19:44:46 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:44:46 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:44:55 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8520122877 +2016-02-13 19:44:55 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:44:57 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1295778051 +2016-02-13 19:44:57 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:44:58 INFO ComplexDataGson:27 - -------Round 15 +2016-02-13 19:45:00 INFO ComplexDataGson:53 - Json Generation Time(ms):: 917475933 +2016-02-13 19:45:00 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:45:00 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:45:09 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8470522382 +2016-02-13 19:45:09 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:45:11 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1220261157 +2016-02-13 19:45:11 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:45:12 INFO ComplexDataGson:27 - -------Round 16 +2016-02-13 19:45:14 INFO ComplexDataGson:53 - Json Generation Time(ms):: 915774963 +2016-02-13 19:45:14 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:45:14 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:45:22 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 7762057680 +2016-02-13 19:45:22 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:45:24 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1231289630 +2016-02-13 19:45:24 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:45:25 INFO ComplexDataGson:27 - -------Round 17 +2016-02-13 19:45:27 INFO ComplexDataGson:53 - Json Generation Time(ms):: 914879280 +2016-02-13 19:45:27 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:45:27 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:45:36 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8748457028 +2016-02-13 19:45:36 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:45:39 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1555775737 +2016-02-13 19:45:39 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:45:40 INFO ComplexDataGson:27 - -------Round 18 +2016-02-13 19:45:42 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1093209109 +2016-02-13 19:45:43 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:45:43 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:45:52 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9098222804 +2016-02-13 19:45:52 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:45:54 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1255617562 +2016-02-13 19:45:54 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:45:55 INFO ComplexDataGson:27 - -------Round 19 +2016-02-13 19:45:57 INFO ComplexDataGson:53 - Json Generation Time(ms):: 950926099 +2016-02-13 19:45:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:45:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:46:06 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8670918236 +2016-02-13 19:46:06 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:46:08 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1280563669 +2016-02-13 19:46:08 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:46:09 INFO ComplexDataGson:27 - -------Round 20 +2016-02-13 19:46:11 INFO ComplexDataGson:53 - Json Generation Time(ms):: 933908902 +2016-02-13 19:46:12 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:46:12 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:46:21 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9708235748 +2016-02-13 19:46:21 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:46:24 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1574329688 +2016-02-13 19:46:24 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:46:25 INFO ComplexDataGson:27 - -------Round 21 +2016-02-13 19:46:28 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1066257681 +2016-02-13 19:46:28 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:46:28 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:46:37 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9000526594 +2016-02-13 19:46:37 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:46:39 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1241094778 +2016-02-13 19:46:39 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:46:40 INFO ComplexDataGson:27 - -------Round 22 +2016-02-13 19:46:42 INFO ComplexDataGson:53 - Json Generation Time(ms):: 921404072 +2016-02-13 19:46:42 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:46:42 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:46:51 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8424769102 +2016-02-13 19:46:51 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:46:53 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1230215126 +2016-02-13 19:46:53 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:46:54 INFO ComplexDataGson:27 - -------Round 23 +2016-02-13 19:46:56 INFO ComplexDataGson:53 - Json Generation Time(ms):: 913987938 +2016-02-13 19:46:56 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:46:56 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:47:06 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10028036985 +2016-02-13 19:47:06 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:47:09 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1651288202 +2016-02-13 19:47:09 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:47:10 INFO ComplexDataGson:27 - -------Round 24 +2016-02-13 19:47:12 INFO ComplexDataGson:53 - Json Generation Time(ms):: 916371822 +2016-02-13 19:47:12 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:47:12 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:47:21 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8624285851 +2016-02-13 19:47:21 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:47:23 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1258091448 +2016-02-13 19:47:23 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:47:24 INFO ComplexDataGson:27 - -------Round 25 +2016-02-13 19:47:26 INFO ComplexDataGson:53 - Json Generation Time(ms):: 915687329 +2016-02-13 19:47:27 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:47:27 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:47:35 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8610528090 +2016-02-13 19:47:35 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:47:38 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1235425406 +2016-02-13 19:47:38 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:47:39 INFO ComplexDataGson:27 - -------Round 26 +2016-02-13 19:47:41 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1088816746 +2016-02-13 19:47:41 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:47:41 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:47:52 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10322615396 +2016-02-13 19:47:52 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:47:54 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1234155501 +2016-02-13 19:47:54 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:47:55 INFO ComplexDataGson:27 - -------Round 27 +2016-02-13 19:47:57 INFO ComplexDataGson:53 - Json Generation Time(ms):: 933214540 +2016-02-13 19:47:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:47:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:48:06 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8857891864 +2016-02-13 19:48:06 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:48:08 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1286999247 +2016-02-13 19:48:08 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:48:10 INFO ComplexDataGson:27 - -------Round 28 +2016-02-13 19:48:12 INFO ComplexDataGson:53 - Json Generation Time(ms):: 944816187 +2016-02-13 19:48:12 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:48:12 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:48:20 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8230042621 +2016-02-13 19:48:20 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:48:23 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1387615409 +2016-02-13 19:48:23 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:48:24 INFO ComplexDataGson:27 - -------Round 29 +2016-02-13 19:48:26 INFO ComplexDataGson:53 - Json Generation Time(ms):: 940160923 +2016-02-13 19:48:26 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:48:26 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:48:35 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8740729045 +2016-02-13 19:48:35 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:48:37 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1315723884 +2016-02-13 19:48:37 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:48:38 INFO ComplexDataGson:27 - -------Round 30 +2016-02-13 19:48:40 INFO ComplexDataGson:53 - Json Generation Time(ms):: 949497111 +2016-02-13 19:48:41 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:48:41 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:48:49 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8546455339 +2016-02-13 19:48:49 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:48:52 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1655064756 +2016-02-13 19:48:52 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:48:53 INFO ComplexDataGson:27 - -------Round 31 +2016-02-13 19:48:56 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1209183341 +2016-02-13 19:48:56 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:48:56 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:49:07 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 10523212176 +2016-02-13 19:49:07 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:49:09 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1385741146 +2016-02-13 19:49:09 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:49:10 INFO ComplexDataGson:27 - -------Round 32 +2016-02-13 19:49:12 INFO ComplexDataGson:53 - Json Generation Time(ms):: 926668433 +2016-02-13 19:49:13 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:49:13 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:49:21 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8096297617 +2016-02-13 19:49:21 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:49:23 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1237708235 +2016-02-13 19:49:23 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:49:24 INFO ComplexDataGson:27 - -------Round 33 +2016-02-13 19:49:26 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1194291074 +2016-02-13 19:49:27 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:49:27 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:49:36 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9445080077 +2016-02-13 19:49:36 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:49:39 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1488176702 +2016-02-13 19:49:39 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:49:40 INFO ComplexDataGson:27 - -------Round 34 +2016-02-13 19:49:42 INFO ComplexDataGson:53 - Json Generation Time(ms):: 956147827 +2016-02-13 19:49:42 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:49:42 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:49:50 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8222404640 +2016-02-13 19:49:50 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:49:53 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1235773969 +2016-02-13 19:49:53 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:49:54 INFO ComplexDataGson:27 - -------Round 35 +2016-02-13 19:49:56 INFO ComplexDataGson:53 - Json Generation Time(ms):: 908857793 +2016-02-13 19:49:56 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:49:56 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:50:05 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9117024263 +2016-02-13 19:50:05 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:50:07 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1239985931 +2016-02-13 19:50:07 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:50:08 INFO ComplexDataGson:27 - -------Round 36 +2016-02-13 19:50:10 INFO ComplexDataGson:53 - Json Generation Time(ms):: 912435394 +2016-02-13 19:50:11 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:50:11 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:50:19 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8580239068 +2016-02-13 19:50:19 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:50:21 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1258180661 +2016-02-13 19:50:21 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:50:23 INFO ComplexDataGson:27 - -------Round 37 +2016-02-13 19:50:25 INFO ComplexDataGson:53 - Json Generation Time(ms):: 928991525 +2016-02-13 19:50:25 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:50:25 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:50:34 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8749988257 +2016-02-13 19:50:34 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:50:36 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1259627018 +2016-02-13 19:50:36 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:50:37 INFO ComplexDataGson:27 - -------Round 38 +2016-02-13 19:50:39 INFO ComplexDataGson:53 - Json Generation Time(ms):: 912076963 +2016-02-13 19:50:39 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:50:39 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:50:48 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8553354747 +2016-02-13 19:50:48 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:50:50 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1272567256 +2016-02-13 19:50:50 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:50:51 INFO ComplexDataGson:27 - -------Round 39 +2016-02-13 19:50:53 INFO ComplexDataGson:53 - Json Generation Time(ms):: 937653878 +2016-02-13 19:50:53 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:50:53 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:51:02 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8570808929 +2016-02-13 19:51:02 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:51:04 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1278280050 +2016-02-13 19:51:04 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:51:05 INFO ComplexDataGson:27 - -------Round 40 +2016-02-13 19:51:07 INFO ComplexDataGson:53 - Json Generation Time(ms):: 948231943 +2016-02-13 19:51:08 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:51:08 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:51:16 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8258665807 +2016-02-13 19:51:16 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:51:18 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1226364358 +2016-02-13 19:51:18 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:51:19 INFO ComplexDataGson:27 - -------Round 41 +2016-02-13 19:51:21 INFO ComplexDataGson:53 - Json Generation Time(ms):: 913137256 +2016-02-13 19:51:21 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:51:21 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:51:29 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8291304765 +2016-02-13 19:51:29 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:51:31 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1227485837 +2016-02-13 19:51:31 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:51:33 INFO ComplexDataGson:27 - -------Round 42 +2016-02-13 19:51:35 INFO ComplexDataGson:53 - Json Generation Time(ms):: 913072123 +2016-02-13 19:51:35 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:51:35 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:51:43 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8564229663 +2016-02-13 19:51:43 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:51:46 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1247028238 +2016-02-13 19:51:46 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:51:47 INFO ComplexDataGson:27 - -------Round 43 +2016-02-13 19:51:49 INFO ComplexDataGson:53 - Json Generation Time(ms):: 916980130 +2016-02-13 19:51:49 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:51:49 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:51:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8671670625 +2016-02-13 19:51:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:52:00 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1270874971 +2016-02-13 19:52:00 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:52:01 INFO ComplexDataGson:27 - -------Round 44 +2016-02-13 19:52:03 INFO ComplexDataGson:53 - Json Generation Time(ms):: 948609717 +2016-02-13 19:52:04 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:52:04 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:52:13 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8829447104 +2016-02-13 19:52:13 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:52:15 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1663932772 +2016-02-13 19:52:15 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:52:17 INFO ComplexDataGson:27 - -------Round 45 +2016-02-13 19:52:19 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1123397471 +2016-02-13 19:52:19 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:52:19 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:52:29 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 9946999145 +2016-02-13 19:52:29 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:52:32 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1236672021 +2016-02-13 19:52:32 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:52:33 INFO ComplexDataGson:27 - -------Round 46 +2016-02-13 19:52:35 INFO ComplexDataGson:53 - Json Generation Time(ms):: 912870802 +2016-02-13 19:52:35 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:52:35 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:52:43 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8255520848 +2016-02-13 19:52:43 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:52:46 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1263055011 +2016-02-13 19:52:46 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:52:47 INFO ComplexDataGson:27 - -------Round 47 +2016-02-13 19:52:49 INFO ComplexDataGson:53 - Json Generation Time(ms):: 945563840 +2016-02-13 19:52:49 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:52:49 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:52:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8534561184 +2016-02-13 19:52:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:53:00 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1230407368 +2016-02-13 19:53:00 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:53:01 INFO ComplexDataGson:27 - -------Round 48 +2016-02-13 19:53:03 INFO ComplexDataGson:53 - Json Generation Time(ms):: 936955963 +2016-02-13 19:53:03 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:53:03 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:53:12 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8602107323 +2016-02-13 19:53:12 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:53:14 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1262269462 +2016-02-13 19:53:14 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:53:15 INFO ComplexDataGson:27 - -------Round 49 +2016-02-13 19:53:17 INFO ComplexDataGson:53 - Json Generation Time(ms):: 931142113 +2016-02-13 19:53:17 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:53:17 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:53:26 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8802198431 +2016-02-13 19:53:26 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:53:29 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1268525825 +2016-02-13 19:53:29 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:53:30 INFO ComplexDataGson:27 - -------Round 50 +2016-02-13 19:53:32 INFO ComplexDataGson:53 - Json Generation Time(ms):: 930833420 +2016-02-13 19:53:32 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 100 MB +2016-02-13 19:53:32 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:53:41 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 8785328081 +2016-02-13 19:53:41 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:53:44 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1582174517 +2016-02-13 19:53:44 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:53:45 INFO ComplexDataGson:39 - -------------------------------------------------------------------------- +2016-02-13 19:53:45 INFO ComplexDataGson:40 - Average Time to Generate JSON : 966789043 +2016-02-13 19:53:45 INFO ComplexDataGson:41 - Average Time to Parse JSON To Map : 8838486733 +2016-02-13 19:53:45 INFO ComplexDataGson:42 - Average Time to Parse JSON To Actual Object : 1313279389 +2016-02-13 19:53:45 INFO ComplexDataGson:43 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application 100mb jackson.log b/gson-jackson-performance/logs_Performance/log4j-application 100mb jackson.log new file mode 100644 index 0000000000..49b5ffd43c --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application 100mb jackson.log @@ -0,0 +1,370 @@ +2016-02-13 20:01:02 INFO ComplexDataJackson:31 - -------Round 1 +2016-02-13 20:01:06 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 2236390565 +2016-02-13 20:01:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:11 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4683849394 +2016-02-13 20:01:14 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1071287562 +2016-02-13 20:01:15 INFO ComplexDataJackson:31 - -------Round 2 +2016-02-13 20:01:17 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 516507379 +2016-02-13 20:01:17 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:17 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:22 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4538998942 +2016-02-13 20:01:24 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 726254816 +2016-02-13 20:01:25 INFO ComplexDataJackson:31 - -------Round 3 +2016-02-13 20:01:26 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 456587379 +2016-02-13 20:01:27 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:27 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:28 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1302570482 +2016-02-13 20:01:30 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 705463037 +2016-02-13 20:01:31 INFO ComplexDataJackson:31 - -------Round 4 +2016-02-13 20:01:33 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 456497377 +2016-02-13 20:01:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:34 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1315460586 +2016-02-13 20:01:36 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 714554876 +2016-02-13 20:01:37 INFO ComplexDataJackson:31 - -------Round 5 +2016-02-13 20:01:38 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 459663651 +2016-02-13 20:01:39 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:39 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:40 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1309177380 +2016-02-13 20:01:42 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 720221485 +2016-02-13 20:01:43 INFO ComplexDataJackson:31 - -------Round 6 +2016-02-13 20:01:44 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 455687353 +2016-02-13 20:01:45 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:45 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:46 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1308595522 +2016-02-13 20:01:48 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 706818208 +2016-02-13 20:01:49 INFO ComplexDataJackson:31 - -------Round 7 +2016-02-13 20:01:50 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 453952830 +2016-02-13 20:01:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:01:55 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4143528046 +2016-02-13 20:01:57 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 719641600 +2016-02-13 20:01:58 INFO ComplexDataJackson:31 - -------Round 8 +2016-02-13 20:01:59 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 465429737 +2016-02-13 20:01:59 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:01:59 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:01 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1342607808 +2016-02-13 20:02:03 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 713900779 +2016-02-13 20:02:04 INFO ComplexDataJackson:31 - -------Round 9 +2016-02-13 20:02:05 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 456318950 +2016-02-13 20:02:06 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:02:06 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1314650958 +2016-02-13 20:02:09 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 719420542 +2016-02-13 20:02:10 INFO ComplexDataJackson:31 - -------Round 10 +2016-02-13 20:02:11 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 462624657 +2016-02-13 20:02:12 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:02:12 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:13 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1340021024 +2016-02-13 20:02:15 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 721704949 +2016-02-13 20:02:16 INFO ComplexDataJackson:43 - -------------------------------------------------------------------------- +2016-02-13 20:02:16 INFO ComplexDataJackson:44 - Average Time to Generate JSON : 641965987 +2016-02-13 20:02:16 INFO ComplexDataJackson:45 - Average Time to Parse JSON To Map : 2259946014 +2016-02-13 20:02:16 INFO ComplexDataJackson:46 - Average Time to Parse JSON To Actual Object : 751926785 +2016-02-13 20:02:16 INFO ComplexDataJackson:47 - -------------------------------------------------------------------------- +2016-02-13 20:02:29 INFO ComplexDataJackson:31 - -------Round 1 +2016-02-13 20:02:33 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 2068828281 +2016-02-13 20:02:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:02:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:38 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4407230838 +2016-02-13 20:02:41 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1326748014 +2016-02-13 20:02:42 INFO ComplexDataJackson:31 - -------Round 2 +2016-02-13 20:02:44 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 644018520 +2016-02-13 20:02:45 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:02:45 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:50 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 5663806849 +2016-02-13 20:02:52 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 714395004 +2016-02-13 20:02:53 INFO ComplexDataJackson:31 - -------Round 3 +2016-02-13 20:02:55 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 453922434 +2016-02-13 20:02:55 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:02:55 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:02:56 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1351852020 +2016-02-13 20:02:58 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 692848072 +2016-02-13 20:02:59 INFO ComplexDataJackson:31 - -------Round 4 +2016-02-13 20:03:01 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 456597642 +2016-02-13 20:03:01 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:01 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:03 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1326427084 +2016-02-13 20:03:05 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 712403893 +2016-02-13 20:03:06 INFO ComplexDataJackson:31 - -------Round 5 +2016-02-13 20:03:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 454851671 +2016-02-13 20:03:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:09 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1390244827 +2016-02-13 20:03:11 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 700532239 +2016-02-13 20:03:12 INFO ComplexDataJackson:31 - -------Round 6 +2016-02-13 20:03:13 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 447829103 +2016-02-13 20:03:14 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:14 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:15 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1300572267 +2016-02-13 20:03:17 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 695462883 +2016-02-13 20:03:18 INFO ComplexDataJackson:31 - -------Round 7 +2016-02-13 20:03:20 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 445790229 +2016-02-13 20:03:20 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:20 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:24 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4166359881 +2016-02-13 20:03:26 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 698059536 +2016-02-13 20:03:27 INFO ComplexDataJackson:31 - -------Round 8 +2016-02-13 20:03:28 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 454490872 +2016-02-13 20:03:28 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:28 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:30 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1303103786 +2016-02-13 20:03:32 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 696194352 +2016-02-13 20:03:33 INFO ComplexDataJackson:31 - -------Round 9 +2016-02-13 20:03:34 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 448600046 +2016-02-13 20:03:34 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:34 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:36 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1310695582 +2016-02-13 20:03:38 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 694635491 +2016-02-13 20:03:39 INFO ComplexDataJackson:31 - -------Round 10 +2016-02-13 20:03:40 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 448167007 +2016-02-13 20:03:40 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:40 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:42 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1460439331 +2016-02-13 20:03:44 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 835431485 +2016-02-13 20:03:45 INFO ComplexDataJackson:31 - -------Round 11 +2016-02-13 20:03:47 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 551898916 +2016-02-13 20:03:47 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:47 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:53 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 5210407849 +2016-02-13 20:03:54 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 700618294 +2016-02-13 20:03:55 INFO ComplexDataJackson:31 - -------Round 12 +2016-02-13 20:03:57 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 466824777 +2016-02-13 20:03:57 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:03:57 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:03:58 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1311879826 +2016-02-13 20:04:00 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 699696952 +2016-02-13 20:04:02 INFO ComplexDataJackson:31 - -------Round 13 +2016-02-13 20:04:03 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 456079732 +2016-02-13 20:04:03 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:03 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:05 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1351933338 +2016-02-13 20:04:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 699846956 +2016-02-13 20:04:08 INFO ComplexDataJackson:31 - -------Round 14 +2016-02-13 20:04:09 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 444370320 +2016-02-13 20:04:09 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:09 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:10 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1303638275 +2016-02-13 20:04:12 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 701946227 +2016-02-13 20:04:14 INFO ComplexDataJackson:31 - -------Round 15 +2016-02-13 20:04:15 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 531660180 +2016-02-13 20:04:16 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:16 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:21 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 5208485427 +2016-02-13 20:04:23 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 910483366 +2016-02-13 20:04:24 INFO ComplexDataJackson:31 - -------Round 16 +2016-02-13 20:04:26 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 479905545 +2016-02-13 20:04:26 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:26 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:28 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1702826909 +2016-02-13 20:04:30 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 883772734 +2016-02-13 20:04:31 INFO ComplexDataJackson:31 - -------Round 17 +2016-02-13 20:04:33 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 451210120 +2016-02-13 20:04:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:34 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1339389427 +2016-02-13 20:04:36 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 722647212 +2016-02-13 20:04:37 INFO ComplexDataJackson:31 - -------Round 18 +2016-02-13 20:04:39 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 446093790 +2016-02-13 20:04:39 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:39 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:40 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1330858920 +2016-02-13 20:04:42 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 719837790 +2016-02-13 20:04:43 INFO ComplexDataJackson:31 - -------Round 19 +2016-02-13 20:04:45 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 459770232 +2016-02-13 20:04:45 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:45 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:46 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1348367183 +2016-02-13 20:04:48 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 723020249 +2016-02-13 20:04:49 INFO ComplexDataJackson:31 - -------Round 20 +2016-02-13 20:04:51 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 455603272 +2016-02-13 20:04:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:04:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:04:55 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4300788194 +2016-02-13 20:04:57 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 721742845 +2016-02-13 20:04:58 INFO ComplexDataJackson:31 - -------Round 21 +2016-02-13 20:05:00 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 449699025 +2016-02-13 20:05:00 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:00 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:01 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1338069784 +2016-02-13 20:05:03 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 720708999 +2016-02-13 20:05:04 INFO ComplexDataJackson:31 - -------Round 22 +2016-02-13 20:05:06 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 439571367 +2016-02-13 20:05:06 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:06 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1379395964 +2016-02-13 20:05:09 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 724697929 +2016-02-13 20:05:10 INFO ComplexDataJackson:31 - -------Round 23 +2016-02-13 20:05:11 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 497673947 +2016-02-13 20:05:12 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:12 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:13 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1612324194 +2016-02-13 20:05:16 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 884663681 +2016-02-13 20:05:17 INFO ComplexDataJackson:31 - -------Round 24 +2016-02-13 20:05:18 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 503245816 +2016-02-13 20:05:19 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:19 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:24 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 5022807757 +2016-02-13 20:05:25 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 699435628 +2016-02-13 20:05:26 INFO ComplexDataJackson:31 - -------Round 25 +2016-02-13 20:05:28 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 461511072 +2016-02-13 20:05:28 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:28 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:30 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1359426447 +2016-02-13 20:05:32 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 722071275 +2016-02-13 20:05:33 INFO ComplexDataJackson:31 - -------Round 26 +2016-02-13 20:05:34 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 459509304 +2016-02-13 20:05:34 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:34 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:36 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1304302241 +2016-02-13 20:05:38 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 706119109 +2016-02-13 20:05:39 INFO ComplexDataJackson:31 - -------Round 27 +2016-02-13 20:05:40 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 443023833 +2016-02-13 20:05:41 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:41 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:42 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1308951979 +2016-02-13 20:05:44 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 693649805 +2016-02-13 20:05:45 INFO ComplexDataJackson:31 - -------Round 28 +2016-02-13 20:05:46 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 443872148 +2016-02-13 20:05:46 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:46 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:51 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4176743730 +2016-02-13 20:05:52 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 700535397 +2016-02-13 20:05:53 INFO ComplexDataJackson:31 - -------Round 29 +2016-02-13 20:05:55 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 445953655 +2016-02-13 20:05:55 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:05:55 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:05:56 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1296523334 +2016-02-13 20:05:58 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 701827802 +2016-02-13 20:05:59 INFO ComplexDataJackson:31 - -------Round 30 +2016-02-13 20:06:01 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 443719775 +2016-02-13 20:06:01 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:01 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:02 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1309741475 +2016-02-13 20:06:04 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 698006640 +2016-02-13 20:06:06 INFO ComplexDataJackson:31 - -------Round 31 +2016-02-13 20:06:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 442733694 +2016-02-13 20:06:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:09 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1322123934 +2016-02-13 20:06:10 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 698388757 +2016-02-13 20:06:11 INFO ComplexDataJackson:31 - -------Round 32 +2016-02-13 20:06:13 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 474821189 +2016-02-13 20:06:13 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:13 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:17 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4296608996 +2016-02-13 20:06:19 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 705003946 +2016-02-13 20:06:20 INFO ComplexDataJackson:31 - -------Round 33 +2016-02-13 20:06:22 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 449688760 +2016-02-13 20:06:22 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:22 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:23 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1326667485 +2016-02-13 20:06:25 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 699966170 +2016-02-13 20:06:26 INFO ComplexDataJackson:31 - -------Round 34 +2016-02-13 20:06:27 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 441669847 +2016-02-13 20:06:28 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:28 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:29 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1299277887 +2016-02-13 20:06:31 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 723641978 +2016-02-13 20:06:32 INFO ComplexDataJackson:31 - -------Round 35 +2016-02-13 20:06:34 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 454130467 +2016-02-13 20:06:34 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:34 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:35 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1316463641 +2016-02-13 20:06:37 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 722224437 +2016-02-13 20:06:38 INFO ComplexDataJackson:31 - -------Round 36 +2016-02-13 20:06:40 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 444313082 +2016-02-13 20:06:40 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:40 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:44 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4168720870 +2016-02-13 20:06:46 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 716292162 +2016-02-13 20:06:47 INFO ComplexDataJackson:31 - -------Round 37 +2016-02-13 20:06:48 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 453859275 +2016-02-13 20:06:49 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:49 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:50 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1354556045 +2016-02-13 20:06:52 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 702207944 +2016-02-13 20:06:53 INFO ComplexDataJackson:31 - -------Round 38 +2016-02-13 20:06:54 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 441460631 +2016-02-13 20:06:55 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:06:55 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:06:56 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1310969931 +2016-02-13 20:06:58 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 698961536 +2016-02-13 20:06:59 INFO ComplexDataJackson:31 - -------Round 39 +2016-02-13 20:07:01 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 452284230 +2016-02-13 20:07:01 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:01 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:02 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1362443112 +2016-02-13 20:07:04 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 714802778 +2016-02-13 20:07:05 INFO ComplexDataJackson:31 - -------Round 40 +2016-02-13 20:07:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 446338533 +2016-02-13 20:07:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:12 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4707047557 +2016-02-13 20:07:14 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 887842982 +2016-02-13 20:07:15 INFO ComplexDataJackson:31 - -------Round 41 +2016-02-13 20:07:16 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 520853950 +2016-02-13 20:07:17 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:17 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:18 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1669910838 +2016-02-13 20:07:21 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 792730003 +2016-02-13 20:07:22 INFO ComplexDataJackson:31 - -------Round 42 +2016-02-13 20:07:24 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 446619989 +2016-02-13 20:07:24 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:24 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:28 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4114083784 +2016-02-13 20:07:30 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 699097725 +2016-02-13 20:07:31 INFO ComplexDataJackson:31 - -------Round 43 +2016-02-13 20:07:32 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 446668148 +2016-02-13 20:07:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:34 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1315005047 +2016-02-13 20:07:36 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 715094891 +2016-02-13 20:07:37 INFO ComplexDataJackson:31 - -------Round 44 +2016-02-13 20:07:38 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 452608713 +2016-02-13 20:07:39 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:39 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:40 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1348105860 +2016-02-13 20:07:42 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 727506562 +2016-02-13 20:07:43 INFO ComplexDataJackson:31 - -------Round 45 +2016-02-13 20:07:45 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 458520855 +2016-02-13 20:07:45 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:45 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:46 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1331530782 +2016-02-13 20:07:48 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 726158102 +2016-02-13 20:07:49 INFO ComplexDataJackson:31 - -------Round 46 +2016-02-13 20:07:51 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 445496931 +2016-02-13 20:07:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:07:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:07:55 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4215771687 +2016-02-13 20:07:57 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 703152577 +2016-02-13 20:07:58 INFO ComplexDataJackson:31 - -------Round 47 +2016-02-13 20:07:59 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 445821809 +2016-02-13 20:08:00 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:08:00 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:08:01 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1301186100 +2016-02-13 20:08:03 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 700948698 +2016-02-13 20:08:04 INFO ComplexDataJackson:31 - -------Round 48 +2016-02-13 20:08:05 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 447174215 +2016-02-13 20:08:06 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:08:06 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:08:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1314801751 +2016-02-13 20:08:09 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 702852568 +2016-02-13 20:08:10 INFO ComplexDataJackson:31 - -------Round 49 +2016-02-13 20:08:11 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 443597403 +2016-02-13 20:08:12 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:08:12 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:08:13 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 1307441278 +2016-02-13 20:08:15 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 700476579 +2016-02-13 20:08:16 INFO ComplexDataJackson:31 - -------Round 50 +2016-02-13 20:08:17 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 464090357 +2016-02-13 20:08:18 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 100 MB +2016-02-13 20:08:18 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 20:08:22 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 4154225719 +2016-02-13 20:08:23 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 702714012 +2016-02-13 20:08:24 INFO ComplexDataJackson:43 - -------------------------------------------------------------------------- +2016-02-13 20:08:24 INFO ComplexDataJackson:44 - Average Time to Generate JSON : 494540894 +2016-02-13 20:08:24 INFO ComplexDataJackson:45 - Average Time to Parse JSON To Map : 2254690740 +2016-02-13 20:08:24 INFO ComplexDataJackson:46 - Average Time to Parse JSON To Actual Object : 738842085 +2016-02-13 20:08:24 INFO ComplexDataJackson:47 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application 10kb gson.log b/gson-jackson-performance/logs_Performance/log4j-application 10kb gson.log new file mode 100644 index 0000000000..3798f54438 --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application 10kb gson.log @@ -0,0 +1,490 @@ +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 1 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 29919933 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 8431031 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 6431631 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 2 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 2422174 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 1543070 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 1984794 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 3 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 7451266 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 2946400 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 1498858 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 4 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 1223325 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 447250 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 692783 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 5 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 806075 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 552647 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 620939 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 6 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 917000 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 440934 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 660808 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 7 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 799365 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 386063 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 615807 +2016-02-13 19:28:29 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:24 - -------Round 8 +2016-02-13 19:28:29 INFO ComplexDataGson:50 - Json Generation Time(ms):: 676993 +2016-02-13 19:28:29 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:29 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:29 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 1876632 +2016-02-13 19:28:29 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 380143 +2016-02-13 19:28:30 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:24 - -------Round 9 +2016-02-13 19:28:30 INFO ComplexDataGson:50 - Json Generation Time(ms):: 652913 +2016-02-13 19:28:30 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:30 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 4579078 +2016-02-13 19:28:30 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 594885 +2016-02-13 19:28:30 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:24 - -------Round 10 +2016-02-13 19:28:30 INFO ComplexDataGson:50 - Json Generation Time(ms):: 630018 +2016-02-13 19:28:30 INFO ComplexDataGson:26 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:30 INFO ComplexDataGson:27 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:60 - Generating Map from json Time(ms):: 317772 +2016-02-13 19:28:30 INFO ComplexDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:72 - Generating Actual Object from json Time(ms):: 846735 +2016-02-13 19:28:30 INFO ComplexDataGson:73 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:36 - -------------------------------------------------------------------------- +2016-02-13 19:28:30 INFO ComplexDataGson:37 - Average Time to Generate JSON : 4549906 +2016-02-13 19:28:30 INFO ComplexDataGson:38 - Average Time to Parse JSON To Map : 2152087 +2016-02-13 19:28:30 INFO ComplexDataGson:39 - Average Time to Parse JSON To Actual Object : 1432738 +2016-02-13 19:28:30 INFO ComplexDataGson:40 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:27 - -------Round 1 +2016-02-13 19:28:57 INFO ComplexDataGson:53 - Json Generation Time(ms):: 22564197 +2016-02-13 19:28:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 6382682 +2016-02-13 19:28:57 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 5925169 +2016-02-13 19:28:57 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:27 - -------Round 2 +2016-02-13 19:28:57 INFO ComplexDataGson:53 - Json Generation Time(ms):: 2213352 +2016-02-13 19:28:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 1366223 +2016-02-13 19:28:57 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1049240 +2016-02-13 19:28:57 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:27 - -------Round 3 +2016-02-13 19:28:57 INFO ComplexDataGson:53 - Json Generation Time(ms):: 4573551 +2016-02-13 19:28:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 795023 +2016-02-13 19:28:57 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:57 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 1174770 +2016-02-13 19:28:57 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 4 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 1064636 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 432249 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 537647 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 5 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 780417 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 570411 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 711336 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 6 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 865288 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 268824 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 718836 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 7 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 427907 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 430671 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 676993 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 8 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 624097 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 409748 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 643045 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 9 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 622123 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 441328 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 545937 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 10 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 603175 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 388037 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 555016 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 11 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 568832 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 360405 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 545147 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 12 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 546726 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 221059 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 541594 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 13 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 533700 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 393959 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 537253 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 14 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 456329 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 347378 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 478435 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 15 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 485935 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 336326 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 436197 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 16 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 482777 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 309878 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 926869 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 17 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 503699 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 322509 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 483566 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 18 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 564885 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 298825 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 403038 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 19 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 421986 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 128688 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 222243 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 20 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 424354 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 238427 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 396327 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 21 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 397906 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 161057 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 236060 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 22 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 417643 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 466592 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 392380 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 23 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 279482 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 134609 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 325667 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 24 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 243165 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 223033 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 337904 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 25 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 247507 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 135398 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 179216 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 26 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 235270 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 112109 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 202111 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 27 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 319746 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 114082 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 171716 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 28 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 201717 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 112504 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 165399 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 29 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 247507 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 112504 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 176058 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 30 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 226586 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 114872 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 179216 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 31 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 203295 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 98687 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 176847 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 32 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 332378 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 208822 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 340668 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 33 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 370274 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 120793 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 185137 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 34 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 308298 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 230138 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 270402 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 35 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 290929 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 206848 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 178426 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 36 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 311851 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 222243 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 174084 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 37 +2016-02-13 19:28:58 INFO ComplexDataGson:53 - Json Generation Time(ms):: 295667 +2016-02-13 19:28:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 210795 +2016-02-13 19:28:58 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 220269 +2016-02-13 19:28:58 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:58 INFO ComplexDataGson:27 - -------Round 38 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 181978 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 131451 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 170531 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 39 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 302772 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 125135 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 160663 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 40 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 287377 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 214743 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 260139 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 41 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 181189 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 114082 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 147636 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 42 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 274350 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 181189 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 224217 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 43 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 181189 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 121583 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 139346 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 44 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 181190 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 101450 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 135793 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 45 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 185531 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 101450 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 139741 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 46 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 274745 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 211980 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 137372 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 47 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 185532 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 114477 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 134214 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 48 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 206059 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 128293 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 143688 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 49 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 261324 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 189479 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 220269 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:27 - -------Round 50 +2016-02-13 19:28:59 INFO ComplexDataGson:53 - Json Generation Time(ms):: 316588 +2016-02-13 19:28:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:28:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:63 - Generating Map from json Time(ms):: 209217 +2016-02-13 19:28:59 INFO ComplexDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:75 - Generating Actual Object from json Time(ms):: 248296 +2016-02-13 19:28:59 INFO ComplexDataGson:76 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:39 - -------------------------------------------------------------------------- +2016-02-13 19:28:59 INFO ComplexDataGson:40 - Average Time to Generate JSON : 945540 +2016-02-13 19:28:59 INFO ComplexDataGson:41 - Average Time to Parse JSON To Map : 387445 +2016-02-13 19:28:59 INFO ComplexDataGson:42 - Average Time to Parse JSON To Actual Object : 473642 +2016-02-13 19:28:59 INFO ComplexDataGson:43 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application 10kb jackson.log b/gson-jackson-performance/logs_Performance/log4j-application 10kb jackson.log new file mode 100644 index 0000000000..3959c60eb2 --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application 10kb jackson.log @@ -0,0 +1,370 @@ +2016-02-13 19:58:48 INFO ComplexDataJackson:29 - -------Round 1 +2016-02-13 19:58:48 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 87235780 +2016-02-13 19:58:48 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:48 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:48 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 29891117 +2016-02-13 19:58:48 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 18692902 +2016-02-13 19:58:48 INFO ComplexDataJackson:29 - -------Round 2 +2016-02-13 19:58:48 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 1735313 +2016-02-13 19:58:48 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:48 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:48 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 1242667 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 2039268 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 3 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 1130953 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 721205 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 5425418 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 4 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 761864 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 688441 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 959238 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 5 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 636334 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 589754 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 846735 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 6 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 1905844 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 495409 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 933974 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 7 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 654098 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 474882 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 753574 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 8 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 3619051 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 515146 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 607912 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 9 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 404617 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 930816 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 498566 +2016-02-13 19:58:49 INFO ComplexDataJackson:29 - -------Round 10 +2016-02-13 19:58:49 INFO ComplexDataJackson:56 - Json Generation Time(ms):: 384879 +2016-02-13 19:58:49 INFO ComplexDataJackson:31 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:58:49 INFO ComplexDataJackson:32 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:66 - Generating Map from json Time(ms):: 270008 +2016-02-13 19:58:49 INFO ComplexDataJackson:79 - Generating Actual Object from json Time(ms):: 547516 +2016-02-13 19:58:49 INFO ComplexDataJackson:41 - -------------------------------------------------------------------------- +2016-02-13 19:58:49 INFO ComplexDataJackson:42 - Average Time to Generate JSON : 9846873 +2016-02-13 19:58:49 INFO ComplexDataJackson:43 - Average Time to Parse JSON To Map : 3581944 +2016-02-13 19:58:49 INFO ComplexDataJackson:44 - Average Time to Parse JSON To Actual Object : 3130510 +2016-02-13 19:58:49 INFO ComplexDataJackson:45 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 1 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 68404321 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 27264858 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 18062489 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 2 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 1630310 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 876340 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1223324 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 3 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 907921 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 660019 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1451884 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 4 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 838445 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 886999 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1187797 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 5 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 768970 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 577122 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 858972 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 6 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 756732 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 626465 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 878709 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 7 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 616992 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 414486 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 779628 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 8 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 519093 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 480408 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 596859 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 9 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 482382 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 552647 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 594096 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 10 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 392774 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 337904 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 966344 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 11 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 430671 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 416065 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 546726 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 12 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 353695 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 292508 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 297245 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 13 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 396722 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 341852 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 420407 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 14 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 357247 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 354089 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 410143 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 15 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 382906 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 279087 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 433039 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 16 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 728310 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 713705 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 1305037 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 17 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 318167 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 288166 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 445670 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 18 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 246718 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 287377 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 453566 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 19 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 250270 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 286587 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 469356 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 20 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 234875 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 286981 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 459487 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 21 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 255007 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 350536 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 620544 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 22 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 265666 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 309087 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 545937 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 23 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 235270 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 250270 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 411328 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 24 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 254218 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 236059 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 394353 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 25 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 203690 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 247508 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 196585 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 26 +2016-02-13 19:59:07 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 244349 +2016-02-13 19:59:07 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:07 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:07 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 243954 +2016-02-13 19:59:07 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 213953 +2016-02-13 19:59:07 INFO ComplexDataJackson:31 - -------Round 27 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 176058 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 167373 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 436986 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 28 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 287377 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 275534 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 302377 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 29 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 258560 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 164216 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 268034 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 30 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 148031 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 152373 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 201321 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 31 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 232112 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 307114 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 332378 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 32 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 325272 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 249086 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 335536 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 33 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 232507 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 262113 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 325667 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 34 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 256587 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 269613 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 313825 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 35 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 230532 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 242375 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 267244 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 36 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 223032 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 227375 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 287377 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 37 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 157899 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 159084 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 285403 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 38 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 249086 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 243165 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 312640 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 39 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 149610 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 244349 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 298429 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 40 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 190268 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 564095 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 287772 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 41 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 216322 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 166583 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 290534 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 42 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 205269 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 215532 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 279482 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 43 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 164215 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 248297 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 283823 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 44 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 211190 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 204479 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 328825 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 45 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 238822 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 240007 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 262902 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 46 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 241586 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 238033 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 281060 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 47 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 215532 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 258165 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 262113 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 48 +2016-02-13 19:59:08 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 142109 +2016-02-13 19:59:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:08 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 125924 +2016-02-13 19:59:08 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 163426 +2016-02-13 19:59:08 INFO ComplexDataJackson:31 - -------Round 49 +2016-02-13 19:59:09 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 148030 +2016-02-13 19:59:09 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:09 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:09 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 233296 +2016-02-13 19:59:09 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 225006 +2016-02-13 19:59:09 INFO ComplexDataJackson:31 - -------Round 50 +2016-02-13 19:59:09 INFO ComplexDataJackson:58 - Json Generation Time(ms):: 219086 +2016-02-13 19:59:09 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 10 KB +2016-02-13 19:59:09 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 19:59:09 INFO ComplexDataJackson:68 - Generating Map from json Time(ms):: 135004 +2016-02-13 19:59:09 INFO ComplexDataJackson:81 - Generating Actual Object from json Time(ms):: 176453 +2016-02-13 19:59:09 INFO ComplexDataJackson:43 - -------------------------------------------------------------------------- +2016-02-13 19:59:09 INFO ComplexDataJackson:44 - Average Time to Generate JSON : 1711896 +2016-02-13 19:59:09 INFO ComplexDataJackson:45 - Average Time to Parse JSON To Map : 869085 +2016-02-13 19:59:09 INFO ComplexDataJackson:46 - Average Time to Parse JSON To Actual Object : 820641 +2016-02-13 19:59:09 INFO ComplexDataJackson:47 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 10R.log b/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 10R.log new file mode 100644 index 0000000000..11e7aa481b --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 10R.log @@ -0,0 +1,151 @@ +2016-02-14 07:09:34 INFO ComplexDataGson:27 - -------Round 1 +2016-02-14 07:13:19 INFO ComplexDataGson:27 - -------Round 1 +2016-02-14 07:13:26 INFO ComplexDataGson:54 - Json Generation Time(ms):: 3300743982 +2016-02-14 07:13:27 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:13:27 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:13:31 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 3791867873 +2016-02-14 07:13:31 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:13:38 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2877543214 +2016-02-14 07:13:38 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:13:42 INFO ComplexDataGson:27 - -------Round 2 +2016-02-14 07:13:49 INFO ComplexDataGson:54 - Json Generation Time(ms):: 3081464563 +2016-02-14 07:13:50 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:13:50 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:13:53 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 3414915004 +2016-02-14 07:13:53 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:13:59 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2745001008 +2016-02-14 07:13:59 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:14:02 INFO ComplexDataGson:27 - -------Round 3 +2016-02-14 07:14:07 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2452611871 +2016-02-14 07:14:08 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:14:08 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:14:13 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5147569477 +2016-02-14 07:14:13 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:14:49 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 5151814203 +2016-02-14 07:14:49 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:14:53 INFO ComplexDataGson:27 - -------Round 4 +2016-02-14 07:14:58 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2499724269 +2016-02-14 07:14:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:14:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:15:23 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 23671387986 +2016-02-14 07:15:23 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:16:30 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2889390000 +2016-02-14 07:16:30 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:16:34 INFO ComplexDataGson:27 - -------Round 5 +2016-02-14 07:16:39 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2421770990 +2016-02-14 07:16:40 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:16:40 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:16:45 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4739247161 +2016-02-14 07:16:45 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:16:59 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2774260133 +2016-02-14 07:16:59 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:17:02 INFO ComplexDataGson:27 - -------Round 6 +2016-02-14 07:17:08 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2418834853 +2016-02-14 07:17:08 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:17:08 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:17:13 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4871088293 +2016-02-14 07:17:13 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:17:21 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2690487083 +2016-02-14 07:17:21 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:17:25 INFO ComplexDataGson:27 - -------Round 7 +2016-02-14 07:17:30 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2447246454 +2016-02-14 07:17:31 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:17:31 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:17:35 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4567768185 +2016-02-14 07:17:35 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:17:43 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2672816184 +2016-02-14 07:17:43 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:17:46 INFO ComplexDataGson:27 - -------Round 8 +2016-02-14 07:17:51 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2453208335 +2016-02-14 07:17:52 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:17:52 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:17:57 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5084245563 +2016-02-14 07:17:57 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:18:05 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2931465412 +2016-02-14 07:18:05 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:18:08 INFO ComplexDataGson:27 - -------Round 9 +2016-02-14 07:18:14 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2447660150 +2016-02-14 07:18:14 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:18:14 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:18:19 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4877367551 +2016-02-14 07:18:19 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:18:26 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2738904519 +2016-02-14 07:18:26 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:18:29 INFO ComplexDataGson:27 - -------Round 10 +2016-02-14 07:18:35 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2463570868 +2016-02-14 07:18:35 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:18:35 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:18:40 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4857563433 +2016-02-14 07:18:40 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:18:47 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2706159768 +2016-02-14 07:18:47 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:18:50 INFO ComplexDataGson:40 - -------------------------------------------------------------------------- +2016-02-14 07:18:52 INFO ComplexDataGson:41 - Average Time to Generate JSON : 2598683633 +2016-02-14 07:18:52 INFO ComplexDataGson:42 - Average Time to Parse JSON To Map : 6502302052 +2016-02-14 07:18:52 INFO ComplexDataGson:43 - Average Time to Parse JSON To Actual Object : 3017784152 +2016-02-14 07:18:52 INFO ComplexDataGson:44 - -------------------------------------------------------------------------- +2016-02-14 07:30:16 INFO ComplexDataJackson:31 - -------Round 1 +2016-02-14 07:30:22 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1913798065 +2016-02-14 07:30:23 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:30:23 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:30:26 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 3501212864 +2016-02-14 07:30:33 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2519328644 +2016-02-14 07:30:37 INFO ComplexDataJackson:31 - -------Round 2 +2016-02-14 07:30:41 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1122079407 +2016-02-14 07:30:42 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:30:42 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:30:44 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1650946350 +2016-02-14 07:30:48 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1493836600 +2016-02-14 07:30:51 INFO ComplexDataJackson:31 - -------Round 3 +2016-02-14 07:30:55 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1056702014 +2016-02-14 07:30:56 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:30:56 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:30:58 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1769576448 +2016-02-14 07:31:02 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1515188920 +2016-02-14 07:31:05 INFO ComplexDataJackson:31 - -------Round 4 +2016-02-14 07:31:10 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1385929835 +2016-02-14 07:31:11 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:31:11 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:31:13 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1979048349 +2016-02-14 07:31:17 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1616521550 +2016-02-14 07:31:20 INFO ComplexDataJackson:31 - -------Round 5 +2016-02-14 07:31:24 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1076380997 +2016-02-14 07:31:25 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:31:25 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:31:27 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1786553379 +2016-02-14 07:31:31 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1514234815 +2016-02-14 07:31:34 INFO ComplexDataJackson:31 - -------Round 6 +2016-02-14 07:31:39 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1068609985 +2016-02-14 07:31:39 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:31:39 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:31:42 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2419927122 +2016-02-14 07:31:47 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1525414870 +2016-02-14 07:31:50 INFO ComplexDataJackson:31 - -------Round 7 +2016-02-14 07:31:54 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1210651015 +2016-02-14 07:31:55 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:31:55 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:31:57 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2127036259 +2016-02-14 07:32:03 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2067842595 +2016-02-14 07:32:06 INFO ComplexDataJackson:31 - -------Round 8 +2016-02-14 07:32:10 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1044809437 +2016-02-14 07:32:10 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:32:10 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:32:13 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2159417841 +2016-02-14 07:32:18 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2045629724 +2016-02-14 07:32:21 INFO ComplexDataJackson:31 - -------Round 9 +2016-02-14 07:32:25 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1063275754 +2016-02-14 07:32:25 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:32:25 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:32:28 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2249796606 +2016-02-14 07:32:33 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2037722525 +2016-02-14 07:32:36 INFO ComplexDataJackson:31 - -------Round 10 +2016-02-14 07:32:40 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1046656069 +2016-02-14 07:32:40 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:32:40 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 07:32:43 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2209315582 +2016-02-14 07:32:48 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2623449380 +2016-02-14 07:32:52 INFO ComplexDataJackson:44 - -------------------------------------------------------------------------- +2016-02-14 07:32:52 INFO ComplexDataJackson:45 - Average Time to Generate JSON : 1198889257 +2016-02-14 07:32:52 INFO ComplexDataJackson:46 - Average Time to Parse JSON To Map : 2185283080 +2016-02-14 07:32:52 INFO ComplexDataJackson:47 - Average Time to Parse JSON To Actual Object : 1895916962 +2016-02-14 07:32:52 INFO ComplexDataJackson:48 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 50R.log b/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 50R.log new file mode 100644 index 0000000000..f46f494f35 --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application complex Gson Jackson 250mb 50R.log @@ -0,0 +1,710 @@ +2016-02-14 07:40:07 INFO ComplexDataGson:27 - -------Round 1 +2016-02-14 07:40:15 INFO ComplexDataGson:54 - Json Generation Time(ms):: 3797149997 +2016-02-14 07:40:16 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:40:16 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:40:19 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 3387405404 +2016-02-14 07:40:19 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:40:27 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2878285736 +2016-02-14 07:40:27 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:40:31 INFO ComplexDataGson:27 - -------Round 2 +2016-02-14 07:40:37 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2490870463 +2016-02-14 07:40:38 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:40:38 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:40:41 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 3039905087 +2016-02-14 07:40:41 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:40:47 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3045785254 +2016-02-14 07:40:47 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:40:50 INFO ComplexDataGson:27 - -------Round 3 +2016-02-14 07:40:55 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2523651926 +2016-02-14 07:40:56 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:40:56 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:41:01 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4578827448 +2016-02-14 07:41:01 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:41:23 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 8280810781 +2016-02-14 07:41:23 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:41:27 INFO ComplexDataGson:27 - -------Round 4 +2016-02-14 07:41:33 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2370172675 +2016-02-14 07:41:34 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:41:34 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:42:06 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 32830902935 +2016-02-14 07:42:06 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:42:14 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2791214171 +2016-02-14 07:42:14 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:42:17 INFO ComplexDataGson:27 - -------Round 5 +2016-02-14 07:42:23 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2517693992 +2016-02-14 07:42:24 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:42:24 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:42:29 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4962835649 +2016-02-14 07:42:29 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:42:40 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2876976750 +2016-02-14 07:42:40 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:42:44 INFO ComplexDataGson:27 - -------Round 6 +2016-02-14 07:42:50 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2983421369 +2016-02-14 07:42:51 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:42:51 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:43:05 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 13683434909 +2016-02-14 07:43:05 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:43:16 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2770234887 +2016-02-14 07:43:16 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:43:20 INFO ComplexDataGson:27 - -------Round 7 +2016-02-14 07:43:25 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2405473419 +2016-02-14 07:43:26 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:43:26 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:43:33 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 6810693016 +2016-02-14 07:43:33 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:43:42 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2768497206 +2016-02-14 07:43:42 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:43:45 INFO ComplexDataGson:27 - -------Round 8 +2016-02-14 07:43:50 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2374051075 +2016-02-14 07:43:51 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:43:51 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:43:59 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 7719104349 +2016-02-14 07:43:59 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:44:58 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 20399180345 +2016-02-14 07:44:58 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:45:02 INFO ComplexDataGson:27 - -------Round 9 +2016-02-14 07:45:07 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2533230094 +2016-02-14 07:45:08 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:45:08 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:45:44 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 35641108832 +2016-02-14 07:45:44 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:46:41 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 4185201210 +2016-02-14 07:46:41 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:46:45 INFO ComplexDataGson:27 - -------Round 10 +2016-02-14 07:46:51 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2466678325 +2016-02-14 07:46:52 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:46:52 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:47:04 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 12154237562 +2016-02-14 07:47:04 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:47:13 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2783741983 +2016-02-14 07:47:13 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:47:17 INFO ComplexDataGson:27 - -------Round 11 +2016-02-14 07:47:22 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2476994277 +2016-02-14 07:47:23 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:47:23 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:47:36 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 13312892750 +2016-02-14 07:47:36 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:48:03 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3745747872 +2016-02-14 07:48:03 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:48:08 INFO ComplexDataGson:27 - -------Round 12 +2016-02-14 07:48:14 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2477815749 +2016-02-14 07:48:14 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:48:14 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:48:19 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5183533399 +2016-02-14 07:48:19 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:48:29 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2717330745 +2016-02-14 07:48:29 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:48:33 INFO ComplexDataGson:27 - -------Round 13 +2016-02-14 07:48:38 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2483506437 +2016-02-14 07:48:39 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:48:39 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:48:48 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 9145250726 +2016-02-14 07:48:48 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:49:46 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 5718372485 +2016-02-14 07:49:46 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:49:51 INFO ComplexDataGson:27 - -------Round 14 +2016-02-14 07:49:56 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2375017418 +2016-02-14 07:49:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:49:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:50:05 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 8356615446 +2016-02-14 07:50:05 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:50:12 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2680602591 +2016-02-14 07:50:12 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:50:15 INFO ComplexDataGson:27 - -------Round 15 +2016-02-14 07:50:20 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2352459143 +2016-02-14 07:50:21 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:50:21 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:50:26 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4920213117 +2016-02-14 07:50:26 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:50:33 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2853892670 +2016-02-14 07:50:33 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:50:36 INFO ComplexDataGson:27 - -------Round 16 +2016-02-14 07:50:41 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2431161653 +2016-02-14 07:50:42 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:50:42 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:50:46 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4680718647 +2016-02-14 07:50:46 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:50:53 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3122951011 +2016-02-14 07:50:53 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:50:57 INFO ComplexDataGson:27 - -------Round 17 +2016-02-14 07:51:02 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2421268081 +2016-02-14 07:51:02 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:51:02 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:51:07 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4890545033 +2016-02-14 07:51:07 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:51:14 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3173707723 +2016-02-14 07:51:14 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:51:18 INFO ComplexDataGson:27 - -------Round 18 +2016-02-14 07:51:24 INFO ComplexDataGson:54 - Json Generation Time(ms):: 3015968746 +2016-02-14 07:51:25 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:51:25 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:51:30 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4825937003 +2016-02-14 07:51:30 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:51:36 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2780808215 +2016-02-14 07:51:36 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:51:40 INFO ComplexDataGson:27 - -------Round 19 +2016-02-14 07:51:45 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2449963505 +2016-02-14 07:51:46 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:51:46 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:51:51 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5297335332 +2016-02-14 07:51:51 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:51:57 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2769354993 +2016-02-14 07:51:57 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:52:01 INFO ComplexDataGson:27 - -------Round 20 +2016-02-14 07:52:07 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2474888297 +2016-02-14 07:52:07 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:52:07 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:52:12 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4832219815 +2016-02-14 07:52:12 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:52:19 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2738290291 +2016-02-14 07:52:19 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:52:22 INFO ComplexDataGson:27 - -------Round 21 +2016-02-14 07:52:28 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2521485548 +2016-02-14 07:52:29 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:52:29 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:52:34 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4986757780 +2016-02-14 07:52:34 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:52:41 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2767275460 +2016-02-14 07:52:41 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:52:45 INFO ComplexDataGson:27 - -------Round 22 +2016-02-14 07:52:51 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2819066808 +2016-02-14 07:52:52 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:52:52 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:52:57 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5448328064 +2016-02-14 07:52:57 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:53:04 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2726202709 +2016-02-14 07:53:04 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:53:08 INFO ComplexDataGson:27 - -------Round 23 +2016-02-14 07:53:13 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2524093649 +2016-02-14 07:53:14 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:53:14 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:53:19 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5153818734 +2016-02-14 07:53:19 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:53:26 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3535297784 +2016-02-14 07:53:26 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:53:30 INFO ComplexDataGson:27 - -------Round 24 +2016-02-14 07:53:36 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2601603625 +2016-02-14 07:53:37 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:53:37 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:53:42 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5013024319 +2016-02-14 07:53:42 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:53:49 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2825129744 +2016-02-14 07:53:49 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:53:53 INFO ComplexDataGson:27 - -------Round 25 +2016-02-14 07:53:58 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2467801778 +2016-02-14 07:53:59 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:53:59 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:54:04 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4986123024 +2016-02-14 07:54:04 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:54:11 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2805291678 +2016-02-14 07:54:11 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:54:14 INFO ComplexDataGson:27 - -------Round 26 +2016-02-14 07:54:19 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2373800804 +2016-02-14 07:54:20 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:54:20 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:54:25 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5206601294 +2016-02-14 07:54:25 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:54:32 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2715289502 +2016-02-14 07:54:32 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:54:35 INFO ComplexDataGson:27 - -------Round 27 +2016-02-14 07:54:41 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2401132374 +2016-02-14 07:54:41 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:54:41 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:54:46 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4847989607 +2016-02-14 07:54:46 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:54:53 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2784961360 +2016-02-14 07:54:53 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:54:57 INFO ComplexDataGson:27 - -------Round 28 +2016-02-14 07:55:02 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2589043530 +2016-02-14 07:55:03 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:55:03 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:55:08 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4939033522 +2016-02-14 07:55:08 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:55:15 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2813883370 +2016-02-14 07:55:15 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:55:18 INFO ComplexDataGson:27 - -------Round 29 +2016-02-14 07:55:24 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2444364004 +2016-02-14 07:55:24 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:55:24 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:55:30 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5366266642 +2016-02-14 07:55:30 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:55:36 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2712294943 +2016-02-14 07:55:36 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:55:40 INFO ComplexDataGson:27 - -------Round 30 +2016-02-14 07:55:45 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2430504792 +2016-02-14 07:55:46 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:55:46 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:55:51 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4817296757 +2016-02-14 07:55:51 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:55:57 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2742085794 +2016-02-14 07:55:57 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:56:01 INFO ComplexDataGson:27 - -------Round 31 +2016-02-14 07:56:07 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2737635009 +2016-02-14 07:56:08 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:56:08 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:56:13 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5277481080 +2016-02-14 07:56:13 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:56:20 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2757257938 +2016-02-14 07:56:20 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:56:23 INFO ComplexDataGson:27 - -------Round 32 +2016-02-14 07:56:29 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2423339719 +2016-02-14 07:56:29 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:56:29 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:56:34 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4689185204 +2016-02-14 07:56:34 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:56:41 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3093930314 +2016-02-14 07:56:41 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:56:45 INFO ComplexDataGson:27 - -------Round 33 +2016-02-14 07:56:50 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2399545487 +2016-02-14 07:56:51 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:56:51 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:56:55 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4826696105 +2016-02-14 07:56:55 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:57:02 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2978790184 +2016-02-14 07:57:02 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:57:06 INFO ComplexDataGson:27 - -------Round 34 +2016-02-14 07:57:12 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2718127741 +2016-02-14 07:57:13 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:57:13 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:57:17 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4706243059 +2016-02-14 07:57:17 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:57:25 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3105616831 +2016-02-14 07:57:25 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:57:28 INFO ComplexDataGson:27 - -------Round 35 +2016-02-14 07:57:34 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2631047886 +2016-02-14 07:57:35 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:57:35 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:57:39 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4823275612 +2016-02-14 07:57:39 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:57:48 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3703097312 +2016-02-14 07:57:48 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:57:51 INFO ComplexDataGson:27 - -------Round 36 +2016-02-14 07:57:57 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2436002054 +2016-02-14 07:57:58 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:57:58 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:58:02 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4684077163 +2016-02-14 07:58:02 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:58:09 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2743737815 +2016-02-14 07:58:09 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:58:13 INFO ComplexDataGson:27 - -------Round 37 +2016-02-14 07:58:18 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2464042197 +2016-02-14 07:58:19 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:58:19 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:58:23 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4845604539 +2016-02-14 07:58:23 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:58:30 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2730389802 +2016-02-14 07:58:30 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:58:34 INFO ComplexDataGson:27 - -------Round 38 +2016-02-14 07:58:39 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2450035744 +2016-02-14 07:58:40 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:58:40 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:58:45 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4703580879 +2016-02-14 07:58:45 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:58:51 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2761148969 +2016-02-14 07:58:51 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:58:55 INFO ComplexDataGson:27 - -------Round 39 +2016-02-14 07:59:01 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2461427780 +2016-02-14 07:59:01 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:59:01 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:59:06 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4850024928 +2016-02-14 07:59:06 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:59:13 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2769605659 +2016-02-14 07:59:13 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:59:16 INFO ComplexDataGson:27 - -------Round 40 +2016-02-14 07:59:22 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2419508689 +2016-02-14 07:59:22 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:59:22 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:59:27 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4708503388 +2016-02-14 07:59:27 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:59:34 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2737963439 +2016-02-14 07:59:34 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:59:37 INFO ComplexDataGson:27 - -------Round 41 +2016-02-14 07:59:43 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2796656957 +2016-02-14 07:59:44 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 07:59:44 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 07:59:49 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5214122035 +2016-02-14 07:59:49 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 07:59:56 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2818194809 +2016-02-14 07:59:56 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 07:59:59 INFO ComplexDataGson:27 - -------Round 42 +2016-02-14 08:00:05 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2467121627 +2016-02-14 08:00:05 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:00:05 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:00:10 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4789276352 +2016-02-14 08:00:10 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:00:19 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3489966490 +2016-02-14 08:00:19 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:00:22 INFO ComplexDataGson:27 - -------Round 43 +2016-02-14 08:00:28 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2483219849 +2016-02-14 08:00:29 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:00:29 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:00:34 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5075942431 +2016-02-14 08:00:34 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:00:41 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2818891934 +2016-02-14 08:00:41 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:00:44 INFO ComplexDataGson:27 - -------Round 44 +2016-02-14 08:00:50 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2487425891 +2016-02-14 08:00:50 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:00:50 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:00:55 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4765529489 +2016-02-14 08:00:55 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:01:03 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2788979501 +2016-02-14 08:01:03 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:01:07 INFO ComplexDataGson:27 - -------Round 45 +2016-02-14 08:01:13 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2601907186 +2016-02-14 08:01:14 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:01:14 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:01:19 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5569084670 +2016-02-14 08:01:19 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:01:26 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2955014505 +2016-02-14 08:01:26 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:01:30 INFO ComplexDataGson:27 - -------Round 46 +2016-02-14 08:01:36 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2449779158 +2016-02-14 08:01:36 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:01:36 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:01:41 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4740324033 +2016-02-14 08:01:41 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:01:48 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2783091438 +2016-02-14 08:01:48 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:01:51 INFO ComplexDataGson:27 - -------Round 47 +2016-02-14 08:01:57 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2465765273 +2016-02-14 08:01:57 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:01:57 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:02:02 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4886437678 +2016-02-14 08:02:02 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:02:10 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 3316012444 +2016-02-14 08:02:10 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:02:13 INFO ComplexDataGson:27 - -------Round 48 +2016-02-14 08:02:20 INFO ComplexDataGson:54 - Json Generation Time(ms):: 3236147401 +2016-02-14 08:02:21 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:02:21 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:02:26 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 5479380529 +2016-02-14 08:02:26 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:02:33 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2714805541 +2016-02-14 08:02:33 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:02:36 INFO ComplexDataGson:27 - -------Round 49 +2016-02-14 08:02:42 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2405275256 +2016-02-14 08:02:42 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:02:42 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:02:47 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4832263632 +2016-02-14 08:02:47 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:02:54 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2773142206 +2016-02-14 08:02:54 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:02:57 INFO ComplexDataGson:27 - -------Round 50 +2016-02-14 08:03:03 INFO ComplexDataGson:54 - Json Generation Time(ms):: 2341883841 +2016-02-14 08:03:03 INFO ComplexDataGson:29 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:03:03 INFO ComplexDataGson:30 - -------------------------------------------------------------------------- +2016-02-14 08:03:08 INFO ComplexDataGson:64 - Generating Map from json Time(ms):: 4684440727 +2016-02-14 08:03:08 INFO ComplexDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 08:03:15 INFO ComplexDataGson:76 - Generating Actual Object from json Time(ms):: 2707959030 +2016-02-14 08:03:15 INFO ComplexDataGson:77 - -------------------------------------------------------------------------- +2016-02-14 08:03:18 INFO ComplexDataGson:40 - -------------------------------------------------------------------------- +2016-02-14 08:03:18 INFO ComplexDataGson:41 - Average Time to Generate JSON : 2549404565 +2016-02-14 08:03:18 INFO ComplexDataGson:42 - Average Time to Parse JSON To Map : 6783408594 +2016-02-14 08:03:18 INFO ComplexDataGson:43 - Average Time to Parse JSON To Actual Object : 3441125908 +2016-02-14 08:03:18 INFO ComplexDataGson:44 - -------------------------------------------------------------------------- +2016-02-14 08:12:17 INFO ComplexDataJackson:31 - -------Round 1 +2016-02-14 08:12:24 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 2440775348 +2016-02-14 08:12:24 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:12:24 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:12:27 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2956427703 +2016-02-14 08:12:32 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1768665369 +2016-02-14 08:12:36 INFO ComplexDataJackson:31 - -------Round 2 +2016-02-14 08:12:40 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1076246782 +2016-02-14 08:12:40 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:12:40 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:12:42 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1699796428 +2016-02-14 08:12:46 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1435017947 +2016-02-14 08:12:49 INFO ComplexDataJackson:31 - -------Round 3 +2016-02-14 08:12:53 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1085262040 +2016-02-14 08:12:53 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:12:53 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:12:55 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1698377309 +2016-02-14 08:12:59 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1442987517 +2016-02-14 08:13:01 INFO ComplexDataJackson:31 - -------Round 4 +2016-02-14 08:13:05 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1040101277 +2016-02-14 08:13:06 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:13:06 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:13:07 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1670708624 +2016-02-14 08:13:12 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1441443262 +2016-02-14 08:13:14 INFO ComplexDataJackson:31 - -------Round 5 +2016-02-14 08:13:19 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1341135004 +2016-02-14 08:13:20 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:13:20 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:13:22 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1978411620 +2016-02-14 08:13:26 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1450048771 +2016-02-14 08:13:29 INFO ComplexDataJackson:31 - -------Round 6 +2016-02-14 08:13:32 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1071070845 +2016-02-14 08:13:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:13:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:13:35 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2355220405 +2016-02-14 08:13:41 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1639170619 +2016-02-14 08:13:43 INFO ComplexDataJackson:31 - -------Round 7 +2016-02-14 08:13:47 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1191407439 +2016-02-14 08:13:48 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:13:48 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:13:50 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 1984646667 +2016-02-14 08:13:55 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1957293386 +2016-02-14 08:13:57 INFO ComplexDataJackson:31 - -------Round 8 +2016-02-14 08:14:01 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1035984844 +2016-02-14 08:14:01 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:14:01 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:14:04 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2125148573 +2016-02-14 08:14:08 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1951296372 +2016-02-14 08:14:11 INFO ComplexDataJackson:31 - -------Round 9 +2016-02-14 08:14:15 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1037756473 +2016-02-14 08:14:15 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:14:15 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:14:17 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2125514505 +2016-02-14 08:14:22 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1948151809 +2016-02-14 08:14:25 INFO ComplexDataJackson:31 - -------Round 10 +2016-02-14 08:14:28 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1032009335 +2016-02-14 08:14:29 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:14:29 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:14:31 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2120127773 +2016-02-14 08:14:36 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1954880686 +2016-02-14 08:14:38 INFO ComplexDataJackson:31 - -------Round 11 +2016-02-14 08:14:42 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1012279825 +2016-02-14 08:14:43 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:14:43 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:14:45 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2114519980 +2016-02-14 08:14:49 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1956102826 +2016-02-14 08:14:52 INFO ComplexDataJackson:31 - -------Round 12 +2016-02-14 08:14:56 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1019135415 +2016-02-14 08:14:56 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:14:56 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:14:58 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2116012128 +2016-02-14 08:15:03 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2005033828 +2016-02-14 08:15:06 INFO ComplexDataJackson:31 - -------Round 13 +2016-02-14 08:15:09 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1030257443 +2016-02-14 08:15:10 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:15:10 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:15:12 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2146258913 +2016-02-14 08:15:17 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1975422588 +2016-02-14 08:15:19 INFO ComplexDataJackson:31 - -------Round 14 +2016-02-14 08:15:23 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1031869989 +2016-02-14 08:15:24 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:15:24 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:15:26 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2132500362 +2016-02-14 08:15:30 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1958415260 +2016-02-14 08:15:33 INFO ComplexDataJackson:31 - -------Round 15 +2016-02-14 08:15:37 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1032830806 +2016-02-14 08:15:37 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:15:37 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:15:40 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2184912648 +2016-02-14 08:15:44 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1979574943 +2016-02-14 08:15:46 INFO ComplexDataJackson:31 - -------Round 16 +2016-02-14 08:15:50 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1035782337 +2016-02-14 08:15:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:15:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:15:53 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2126135444 +2016-02-14 08:15:58 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1957399178 +2016-02-14 08:16:00 INFO ComplexDataJackson:31 - -------Round 17 +2016-02-14 08:16:04 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1042031595 +2016-02-14 08:16:05 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:16:05 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:16:07 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2127070207 +2016-02-14 08:16:12 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2462038061 +2016-02-14 08:16:15 INFO ComplexDataJackson:31 - -------Round 18 +2016-02-14 08:16:19 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1195357288 +2016-02-14 08:16:20 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:16:20 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:16:22 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2348974306 +2016-02-14 08:16:27 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1949930939 +2016-02-14 08:16:30 INFO ComplexDataJackson:31 - -------Round 19 +2016-02-14 08:16:34 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1050152353 +2016-02-14 08:16:34 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:16:34 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:16:36 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2125778986 +2016-02-14 08:16:41 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1942497437 +2016-02-14 08:16:43 INFO ComplexDataJackson:31 - -------Round 20 +2016-02-14 08:16:47 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1030772194 +2016-02-14 08:16:48 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:16:48 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:16:50 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2126496243 +2016-02-14 08:16:55 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1947109675 +2016-02-14 08:16:57 INFO ComplexDataJackson:31 - -------Round 21 +2016-02-14 08:17:01 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1028750295 +2016-02-14 08:17:02 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:17:02 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:17:04 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2124714745 +2016-02-14 08:17:08 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1955796501 +2016-02-14 08:17:11 INFO ComplexDataJackson:31 - -------Round 22 +2016-02-14 08:17:15 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1062502837 +2016-02-14 08:17:16 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:17:16 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:17:18 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2125079493 +2016-02-14 08:17:22 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1971739193 +2016-02-14 08:17:25 INFO ComplexDataJackson:31 - -------Round 23 +2016-02-14 08:17:29 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1059218533 +2016-02-14 08:17:29 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:17:29 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:17:32 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2168292568 +2016-02-14 08:17:36 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2030034016 +2016-02-14 08:17:39 INFO ComplexDataJackson:31 - -------Round 24 +2016-02-14 08:17:44 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1350753436 +2016-02-14 08:17:44 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:17:44 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:17:47 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2723882380 +2016-02-14 08:17:52 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2221258291 +2016-02-14 08:17:55 INFO ComplexDataJackson:31 - -------Round 25 +2016-02-14 08:17:59 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1023832128 +2016-02-14 08:18:00 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:18:00 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:18:02 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2157595684 +2016-02-14 08:18:06 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1956225592 +2016-02-14 08:18:09 INFO ComplexDataJackson:31 - -------Round 26 +2016-02-14 08:18:12 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1023012236 +2016-02-14 08:18:13 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:18:13 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:18:15 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2125057782 +2016-02-14 08:18:20 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1935725534 +2016-02-14 08:18:22 INFO ComplexDataJackson:31 - -------Round 27 +2016-02-14 08:18:26 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1012124294 +2016-02-14 08:18:26 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:18:26 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:18:29 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2109949982 +2016-02-14 08:18:33 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1985652090 +2016-02-14 08:18:36 INFO ComplexDataJackson:31 - -------Round 28 +2016-02-14 08:18:40 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1030921014 +2016-02-14 08:18:40 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:18:40 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:18:42 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2122576789 +2016-02-14 08:18:47 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1932141615 +2016-02-14 08:18:50 INFO ComplexDataJackson:31 - -------Round 29 +2016-02-14 08:18:53 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1021380348 +2016-02-14 08:18:54 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:18:54 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:18:56 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2144563470 +2016-02-14 08:19:01 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1958701453 +2016-02-14 08:19:03 INFO ComplexDataJackson:31 - -------Round 30 +2016-02-14 08:19:07 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1019731484 +2016-02-14 08:19:08 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:19:08 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:19:10 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2240348705 +2016-02-14 08:19:16 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2485404386 +2016-02-14 08:19:19 INFO ComplexDataJackson:31 - -------Round 31 +2016-02-14 08:19:22 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1042472529 +2016-02-14 08:19:23 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:19:23 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:19:25 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2124567109 +2016-02-14 08:19:30 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2000236849 +2016-02-14 08:19:32 INFO ComplexDataJackson:31 - -------Round 32 +2016-02-14 08:19:36 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1019639508 +2016-02-14 08:19:37 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:19:37 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:19:39 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2165450777 +2016-02-14 08:19:44 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1950601221 +2016-02-14 08:19:47 INFO ComplexDataJackson:31 - -------Round 33 +2016-02-14 08:19:50 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1016860876 +2016-02-14 08:19:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:19:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:19:53 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2119094717 +2016-02-14 08:19:57 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1948888804 +2016-02-14 08:20:00 INFO ComplexDataJackson:31 - -------Round 34 +2016-02-14 08:20:04 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1036841447 +2016-02-14 08:20:04 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:20:04 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:20:07 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2110651055 +2016-02-14 08:20:11 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1937063730 +2016-02-14 08:20:14 INFO ComplexDataJackson:31 - -------Round 35 +2016-02-14 08:20:18 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1290871331 +2016-02-14 08:20:19 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:20:19 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:20:22 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2592745083 +2016-02-14 08:20:27 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1944194064 +2016-02-14 08:20:29 INFO ComplexDataJackson:31 - -------Round 36 +2016-02-14 08:20:33 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1010976761 +2016-02-14 08:20:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:20:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:20:36 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2119356830 +2016-02-14 08:20:40 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1946314257 +2016-02-14 08:20:43 INFO ComplexDataJackson:31 - -------Round 37 +2016-02-14 08:20:46 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1030989306 +2016-02-14 08:20:47 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:20:47 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:20:49 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2116773203 +2016-02-14 08:20:54 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1950905572 +2016-02-14 08:20:56 INFO ComplexDataJackson:31 - -------Round 38 +2016-02-14 08:21:00 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1017828404 +2016-02-14 08:21:01 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:21:01 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:21:03 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2115104602 +2016-02-14 08:21:08 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1937908885 +2016-02-14 08:21:10 INFO ComplexDataJackson:31 - -------Round 39 +2016-02-14 08:21:14 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1035317324 +2016-02-14 08:21:15 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:21:15 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:21:17 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2116247398 +2016-02-14 08:21:21 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1968002902 +2016-02-14 08:21:24 INFO ComplexDataJackson:31 - -------Round 40 +2016-02-14 08:21:28 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1079234236 +2016-02-14 08:21:28 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:21:29 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:21:31 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2150258895 +2016-02-14 08:21:36 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1981606712 +2016-02-14 08:21:38 INFO ComplexDataJackson:31 - -------Round 41 +2016-02-14 08:21:42 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1024907027 +2016-02-14 08:21:43 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:21:43 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:21:45 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2132610102 +2016-02-14 08:21:49 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1951541511 +2016-02-14 08:21:52 INFO ComplexDataJackson:31 - -------Round 42 +2016-02-14 08:21:56 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1026086139 +2016-02-14 08:21:56 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:21:56 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:21:58 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2130974266 +2016-02-14 08:22:03 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1942215193 +2016-02-14 08:22:06 INFO ComplexDataJackson:31 - -------Round 43 +2016-02-14 08:22:09 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1012376932 +2016-02-14 08:22:10 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:22:10 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:22:12 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2112633874 +2016-02-14 08:22:17 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1950879123 +2016-02-14 08:22:19 INFO ComplexDataJackson:31 - -------Round 44 +2016-02-14 08:22:23 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1031510768 +2016-02-14 08:22:24 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:22:24 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:22:26 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2111779244 +2016-02-14 08:22:31 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1954917791 +2016-02-14 08:22:33 INFO ComplexDataJackson:31 - -------Round 45 +2016-02-14 08:22:37 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1011530593 +2016-02-14 08:22:37 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:22:37 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:22:40 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2112648085 +2016-02-14 08:22:44 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1950791884 +2016-02-14 08:22:47 INFO ComplexDataJackson:31 - -------Round 46 +2016-02-14 08:22:50 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1024148321 +2016-02-14 08:22:51 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:22:51 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:22:53 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2126121233 +2016-02-14 08:22:58 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1985191814 +2016-02-14 08:23:01 INFO ComplexDataJackson:31 - -------Round 47 +2016-02-14 08:23:04 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1038904795 +2016-02-14 08:23:05 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:23:05 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:23:07 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2171032910 +2016-02-14 08:23:12 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1942167823 +2016-02-14 08:23:15 INFO ComplexDataJackson:31 - -------Round 48 +2016-02-14 08:23:18 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1019919780 +2016-02-14 08:23:19 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:23:19 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:23:21 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2116935444 +2016-02-14 08:23:26 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 1966154692 +2016-02-14 08:23:28 INFO ComplexDataJackson:31 - -------Round 49 +2016-02-14 08:23:32 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1038407413 +2016-02-14 08:23:33 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:23:33 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:23:35 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2164705097 +2016-02-14 08:23:40 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2018967252 +2016-02-14 08:23:42 INFO ComplexDataJackson:31 - -------Round 50 +2016-02-14 08:23:47 INFO ComplexDataJackson:59 - Json Generation Time(ms):: 1333104642 +2016-02-14 08:23:48 INFO ComplexDataJackson:33 - Size of Complex content Jackson :: 250 MB +2016-02-14 08:23:48 INFO ComplexDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 08:23:50 INFO ComplexDataJackson:69 - Generating Map from json Time(ms):: 2717974579 +2016-02-14 08:23:56 INFO ComplexDataJackson:82 - Generating Actual Object from json Time(ms):: 2187066394 +2016-02-14 08:23:59 INFO ComplexDataJackson:44 - -------------------------------------------------------------------------- +2016-02-14 08:23:59 INFO ComplexDataJackson:45 - Average Time to Generate JSON : 1092127467 +2016-02-14 08:23:59 INFO ComplexDataJackson:46 - Average Time to Parse JSON To Map : 2158655298 +2016-02-14 08:23:59 INFO ComplexDataJackson:47 - Average Time to Parse JSON To Actual Object : 1939415512 +2016-02-14 08:23:59 INFO ComplexDataJackson:48 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 10R.log b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 10R.log new file mode 100644 index 0000000000..6d66c79825 --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 10R.log @@ -0,0 +1,160 @@ +2016-02-13 22:32:02 INFO SimpleDataGson:25 - -------Round 1 +2016-02-13 22:32:07 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1802698961 +2016-02-13 22:32:08 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:08 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:10 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 2003962071 +2016-02-13 22:32:10 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:12 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1005873828 +2016-02-13 22:32:12 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:14 INFO SimpleDataGson:25 - -------Round 2 +2016-02-13 22:32:16 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1222128229 +2016-02-13 22:32:16 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:16 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:18 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1672580233 +2016-02-13 22:32:18 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:20 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 914391709 +2016-02-13 22:32:20 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:21 INFO SimpleDataGson:25 - -------Round 3 +2016-02-13 22:32:23 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1232757569 +2016-02-13 22:32:24 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:24 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:25 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1761755454 +2016-02-13 22:32:25 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:28 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1042478282 +2016-02-13 22:32:28 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:29 INFO SimpleDataGson:25 - -------Round 4 +2016-02-13 22:32:31 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1350677839 +2016-02-13 22:32:31 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:31 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:33 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1997474806 +2016-02-13 22:32:33 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:35 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 999789995 +2016-02-13 22:32:35 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:36 INFO SimpleDataGson:25 - -------Round 5 +2016-02-13 22:32:39 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1269646240 +2016-02-13 22:32:39 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:39 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:41 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 2061314403 +2016-02-13 22:32:41 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:44 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1455524498 +2016-02-13 22:32:44 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:45 INFO SimpleDataGson:25 - -------Round 6 +2016-02-13 22:32:47 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1304567889 +2016-02-13 22:32:47 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:47 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:49 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1370549381 +2016-02-13 22:32:49 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:51 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1153593911 +2016-02-13 22:32:51 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:52 INFO SimpleDataGson:25 - -------Round 7 +2016-02-13 22:32:54 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1258311882 +2016-02-13 22:32:55 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:32:55 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:32:56 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1423511342 +2016-02-13 22:32:56 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:32:58 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1174751932 +2016-02-13 22:32:58 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:32:59 INFO SimpleDataGson:25 - -------Round 8 +2016-02-13 22:33:02 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1233054419 +2016-02-13 22:33:02 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:33:02 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:33:03 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1644931000 +2016-02-13 22:33:03 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:33:06 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1299340655 +2016-02-13 22:33:06 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:33:07 INFO SimpleDataGson:25 - -------Round 9 +2016-02-13 22:33:09 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1250320633 +2016-02-13 22:33:09 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:33:09 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:33:11 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1876958683 +2016-02-13 22:33:11 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:33:14 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1180127985 +2016-02-13 22:33:14 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:33:15 INFO SimpleDataGson:25 - -------Round 10 +2016-02-13 22:33:18 INFO SimpleDataGson:50 - Json Generation Time(ms):: 1314250627 +2016-02-13 22:33:18 INFO SimpleDataGson:27 - Size of Simple content Gson :: 101 MB +2016-02-13 22:33:18 INFO SimpleDataGson:28 - -------------------------------------------------------------------------- +2016-02-13 22:33:20 INFO SimpleDataGson:60 - Generating Map from json Time(ms):: 1483840853 +2016-02-13 22:33:20 INFO SimpleDataGson:61 - -------------------------------------------------------------------------- +2016-02-13 22:33:22 INFO SimpleDataGson:73 - Generating Actual Object from json Time(ms):: 1179707185 +2016-02-13 22:33:22 INFO SimpleDataGson:74 - -------------------------------------------------------------------------- +2016-02-13 22:33:23 INFO SimpleDataGson:36 - -------------------------------------------------------------------------- +2016-02-13 22:33:23 INFO SimpleDataGson:37 - Average Time to Generate JSON : 1323841428 +2016-02-13 22:33:23 INFO SimpleDataGson:38 - Average Time to Parse JSON To Map : 1729687822 +2016-02-13 22:33:23 INFO SimpleDataGson:39 - Average Time to Parse JSON To Actual Object : 1140557998 +2016-02-13 22:33:23 INFO SimpleDataGson:40 - -------------------------------------------------------------------------- +2016-02-13 22:34:23 INFO SimpleDataJackson:28 - -------Round 1 +2016-02-13 22:34:28 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 3749361201 +2016-02-13 22:34:29 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:34:29 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:34:34 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 5117887111 +2016-02-13 22:34:34 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:34:36 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 1086143172 +2016-02-13 22:34:38 INFO SimpleDataJackson:28 - -------Round 2 +2016-02-13 22:34:39 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 434662538 +2016-02-13 22:34:39 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:34:39 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:34:41 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1334135590 +2016-02-13 22:34:41 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:34:43 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 771198580 +2016-02-13 22:34:44 INFO SimpleDataJackson:28 - -------Round 3 +2016-02-13 22:34:45 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 448593143 +2016-02-13 22:34:45 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:34:45 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:34:50 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 4189457425 +2016-02-13 22:34:50 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:34:52 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 887058668 +2016-02-13 22:34:53 INFO SimpleDataJackson:28 - -------Round 4 +2016-02-13 22:34:54 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 465465795 +2016-02-13 22:34:54 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:34:54 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:34:56 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1384778810 +2016-02-13 22:34:56 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:34:58 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 772597563 +2016-02-13 22:34:59 INFO SimpleDataJackson:28 - -------Round 5 +2016-02-13 22:35:01 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 431909574 +2016-02-13 22:35:01 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:01 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:02 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1414299931 +2016-02-13 22:35:02 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:04 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 758118259 +2016-02-13 22:35:05 INFO SimpleDataJackson:28 - -------Round 6 +2016-02-13 22:35:07 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 420912330 +2016-02-13 22:35:07 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:07 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:08 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1330342865 +2016-02-13 22:35:08 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:11 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 1147846006 +2016-02-13 22:35:12 INFO SimpleDataJackson:28 - -------Round 7 +2016-02-13 22:35:14 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 637133177 +2016-02-13 22:35:14 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:14 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:16 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1710650775 +2016-02-13 22:35:16 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:18 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 1022232915 +2016-02-13 22:35:20 INFO SimpleDataJackson:28 - -------Round 8 +2016-02-13 22:35:21 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 469254572 +2016-02-13 22:35:22 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:22 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:23 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1375411079 +2016-02-13 22:35:23 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:25 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 774870908 +2016-02-13 22:35:26 INFO SimpleDataJackson:28 - -------Round 9 +2016-02-13 22:35:28 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 451041361 +2016-02-13 22:35:28 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:28 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:29 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1419613220 +2016-02-13 22:35:29 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:31 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 772284924 +2016-02-13 22:35:32 INFO SimpleDataJackson:28 - -------Round 10 +2016-02-13 22:35:34 INFO SimpleDataJackson:55 - Json Generation Time(ms):: 422704085 +2016-02-13 22:35:34 INFO SimpleDataJackson:30 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:35:34 INFO SimpleDataJackson:31 - -------------------------------------------------------------------------- +2016-02-13 22:35:35 INFO SimpleDataJackson:65 - Generating Map from json Time(ms):: 1396597916 +2016-02-13 22:35:35 INFO SimpleDataJackson:66 - -------------------------------------------------------------------------- +2016-02-13 22:35:38 INFO SimpleDataJackson:78 - Generating Actual Object from json Time(ms):: 794414020 +2016-02-13 22:35:39 INFO SimpleDataJackson:41 - -------------------------------------------------------------------------- +2016-02-13 22:35:39 INFO SimpleDataJackson:42 - Average Time to Generate JSON : 793103777 +2016-02-13 22:35:39 INFO SimpleDataJackson:43 - Average Time to Parse JSON To Map : 2067317472 +2016-02-13 22:35:39 INFO SimpleDataJackson:44 - Average Time to Parse JSON To Actual Object : 878676501 +2016-02-13 22:35:39 INFO SimpleDataJackson:45 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 50R.log b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 50R.log new file mode 100644 index 0000000000..76e666651b --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 100mb 50R.log @@ -0,0 +1,760 @@ +2016-02-13 22:52:31 INFO SimpleDataGson:28 - -------Round 1 +2016-02-13 22:52:36 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1585839020 +2016-02-13 22:52:36 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:52:36 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:52:38 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1861804362 +2016-02-13 22:52:38 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:52:40 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1055169779 +2016-02-13 22:52:40 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:52:42 INFO SimpleDataGson:28 - -------Round 2 +2016-02-13 22:52:44 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1490347460 +2016-02-13 22:52:45 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:52:45 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:52:47 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1916539920 +2016-02-13 22:52:47 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:52:49 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1129162257 +2016-02-13 22:52:49 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:52:50 INFO SimpleDataGson:28 - -------Round 3 +2016-02-13 22:52:53 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1305021058 +2016-02-13 22:52:53 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:52:53 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:52:55 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1462674147 +2016-02-13 22:52:55 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:52:57 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 887290384 +2016-02-13 22:52:57 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:52:57 INFO SimpleDataGson:28 - -------Round 4 +2016-02-13 22:53:00 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1203500534 +2016-02-13 22:53:00 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:00 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:01 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1451261630 +2016-02-13 22:53:01 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:03 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 879235582 +2016-02-13 22:53:03 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:04 INFO SimpleDataGson:28 - -------Round 5 +2016-02-13 22:53:06 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1230461723 +2016-02-13 22:53:07 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:07 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:08 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1412145404 +2016-02-13 22:53:08 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:10 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1140904783 +2016-02-13 22:53:10 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:11 INFO SimpleDataGson:28 - -------Round 6 +2016-02-13 22:53:13 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1228443779 +2016-02-13 22:53:14 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:14 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:15 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1289356331 +2016-02-13 22:53:15 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:17 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1152567569 +2016-02-13 22:53:17 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:18 INFO SimpleDataGson:28 - -------Round 7 +2016-02-13 22:53:20 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1209992931 +2016-02-13 22:53:21 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:21 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:22 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1286039275 +2016-02-13 22:53:22 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:24 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1170658409 +2016-02-13 22:53:24 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:25 INFO SimpleDataGson:28 - -------Round 8 +2016-02-13 22:53:27 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1196618916 +2016-02-13 22:53:28 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:28 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:29 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1466708852 +2016-02-13 22:53:29 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:31 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1168917972 +2016-02-13 22:53:31 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:32 INFO SimpleDataGson:28 - -------Round 9 +2016-02-13 22:53:34 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1221654533 +2016-02-13 22:53:35 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:35 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:36 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1618379162 +2016-02-13 22:53:36 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:38 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1154904864 +2016-02-13 22:53:38 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:39 INFO SimpleDataGson:28 - -------Round 10 +2016-02-13 22:53:42 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1195265726 +2016-02-13 22:53:42 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:42 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:43 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1436078099 +2016-02-13 22:53:43 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:45 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1167637809 +2016-02-13 22:53:45 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:46 INFO SimpleDataGson:28 - -------Round 11 +2016-02-13 22:53:49 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1185569172 +2016-02-13 22:53:49 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:49 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:50 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1516646659 +2016-02-13 22:53:50 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:53:52 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1148949718 +2016-02-13 22:53:52 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:53:53 INFO SimpleDataGson:28 - -------Round 12 +2016-02-13 22:53:56 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1187248028 +2016-02-13 22:53:56 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:53:56 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:53:57 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1448880519 +2016-02-13 22:53:57 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:00 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1176675926 +2016-02-13 22:54:00 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:01 INFO SimpleDataGson:28 - -------Round 13 +2016-02-13 22:54:03 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1443600783 +2016-02-13 22:54:03 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:03 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:06 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 2164118644 +2016-02-13 22:54:06 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:08 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1488725447 +2016-02-13 22:54:08 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:09 INFO SimpleDataGson:28 - -------Round 14 +2016-02-13 22:54:12 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1435152023 +2016-02-13 22:54:12 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:12 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:14 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1460023030 +2016-02-13 22:54:14 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:16 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1178285702 +2016-02-13 22:54:16 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:17 INFO SimpleDataGson:28 - -------Round 15 +2016-02-13 22:54:19 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1180117721 +2016-02-13 22:54:19 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:19 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:21 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1515058200 +2016-02-13 22:54:21 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:23 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1144468160 +2016-02-13 22:54:23 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:24 INFO SimpleDataGson:28 - -------Round 16 +2016-02-13 22:54:26 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1192200519 +2016-02-13 22:54:26 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:26 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:28 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1461303587 +2016-02-13 22:54:28 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:30 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1144667902 +2016-02-13 22:54:30 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:31 INFO SimpleDataGson:28 - -------Round 17 +2016-02-13 22:54:33 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1189731774 +2016-02-13 22:54:33 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:33 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:35 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1517573920 +2016-02-13 22:54:35 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:37 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1155008682 +2016-02-13 22:54:37 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:38 INFO SimpleDataGson:28 - -------Round 18 +2016-02-13 22:54:40 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1193380811 +2016-02-13 22:54:40 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:40 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:42 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1445793205 +2016-02-13 22:54:42 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:44 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1166141325 +2016-02-13 22:54:44 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:45 INFO SimpleDataGson:28 - -------Round 19 +2016-02-13 22:54:47 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1205077151 +2016-02-13 22:54:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:49 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1513504082 +2016-02-13 22:54:49 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:51 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1147742582 +2016-02-13 22:54:51 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:52 INFO SimpleDataGson:28 - -------Round 20 +2016-02-13 22:54:54 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1198880420 +2016-02-13 22:54:55 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:54:55 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:54:56 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1448043261 +2016-02-13 22:54:56 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:54:58 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1173471373 +2016-02-13 22:54:58 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:54:59 INFO SimpleDataGson:28 - -------Round 21 +2016-02-13 22:55:01 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1217035603 +2016-02-13 22:55:02 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:02 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:03 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1510510720 +2016-02-13 22:55:03 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:05 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1155864098 +2016-02-13 22:55:05 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:06 INFO SimpleDataGson:28 - -------Round 22 +2016-02-13 22:55:08 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1187136316 +2016-02-13 22:55:09 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:09 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:10 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1444711995 +2016-02-13 22:55:10 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:13 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1458993925 +2016-02-13 22:55:13 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:14 INFO SimpleDataGson:28 - -------Round 23 +2016-02-13 22:55:16 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1526195184 +2016-02-13 22:55:17 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:17 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:19 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 2012367410 +2016-02-13 22:55:19 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:21 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1515431630 +2016-02-13 22:55:21 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:22 INFO SimpleDataGson:28 - -------Round 24 +2016-02-13 22:55:25 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1193182253 +2016-02-13 22:55:25 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:25 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:26 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1438591450 +2016-02-13 22:55:26 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:29 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1192834482 +2016-02-13 22:55:29 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:30 INFO SimpleDataGson:28 - -------Round 25 +2016-02-13 22:55:32 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1253599398 +2016-02-13 22:55:32 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:32 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:34 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1629483384 +2016-02-13 22:55:34 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:36 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1333719528 +2016-02-13 22:55:36 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:37 INFO SimpleDataGson:28 - -------Round 26 +2016-02-13 22:55:40 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1230578174 +2016-02-13 22:55:40 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:40 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:41 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1600000552 +2016-02-13 22:55:41 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:44 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1209411074 +2016-02-13 22:55:44 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:45 INFO SimpleDataGson:28 - -------Round 27 +2016-02-13 22:55:47 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1204880173 +2016-02-13 22:55:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:49 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1511346398 +2016-02-13 22:55:49 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:51 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1148985640 +2016-02-13 22:55:51 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:55:52 INFO SimpleDataGson:28 - -------Round 28 +2016-02-13 22:55:54 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1587746830 +2016-02-13 22:55:55 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:55:55 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:55:56 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1689343146 +2016-02-13 22:55:56 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:55:59 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1498482397 +2016-02-13 22:55:59 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:00 INFO SimpleDataGson:28 - -------Round 29 +2016-02-13 22:56:03 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1663758832 +2016-02-13 22:56:03 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:03 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:05 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1872788185 +2016-02-13 22:56:06 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:08 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1250957359 +2016-02-13 22:56:08 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:09 INFO SimpleDataGson:28 - -------Round 30 +2016-02-13 22:56:11 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1188576745 +2016-02-13 22:56:11 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:11 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:13 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1449096050 +2016-02-13 22:56:13 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:15 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1179020720 +2016-02-13 22:56:15 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:16 INFO SimpleDataGson:28 - -------Round 31 +2016-02-13 22:56:18 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1453226678 +2016-02-13 22:56:19 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:19 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:20 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1506877077 +2016-02-13 22:56:20 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:22 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1145879774 +2016-02-13 22:56:22 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:23 INFO SimpleDataGson:28 - -------Round 32 +2016-02-13 22:56:25 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1190798379 +2016-02-13 22:56:26 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:26 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:27 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1434053443 +2016-02-13 22:56:27 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:29 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1177356075 +2016-02-13 22:56:29 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:30 INFO SimpleDataGson:28 - -------Round 33 +2016-02-13 22:56:33 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1191705111 +2016-02-13 22:56:33 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:33 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:34 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1502436968 +2016-02-13 22:56:34 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:36 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1153789705 +2016-02-13 22:56:36 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:37 INFO SimpleDataGson:28 - -------Round 34 +2016-02-13 22:56:40 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1194646368 +2016-02-13 22:56:40 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:40 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:41 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1437310102 +2016-02-13 22:56:41 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:43 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1185691542 +2016-02-13 22:56:43 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:44 INFO SimpleDataGson:28 - -------Round 35 +2016-02-13 22:56:47 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1189237551 +2016-02-13 22:56:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:48 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1490416540 +2016-02-13 22:56:48 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:50 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1143874066 +2016-02-13 22:56:50 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:51 INFO SimpleDataGson:28 - -------Round 36 +2016-02-13 22:56:54 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1188084496 +2016-02-13 22:56:54 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:56:54 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:56:55 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1448132868 +2016-02-13 22:56:55 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:56:57 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1162009908 +2016-02-13 22:56:57 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:56:58 INFO SimpleDataGson:28 - -------Round 37 +2016-02-13 22:57:01 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1197328276 +2016-02-13 22:57:01 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:01 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:02 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1498333577 +2016-02-13 22:57:02 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:04 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1158750879 +2016-02-13 22:57:04 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:05 INFO SimpleDataGson:28 - -------Round 38 +2016-02-13 22:57:08 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1171911335 +2016-02-13 22:57:08 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:08 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:09 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1439759504 +2016-02-13 22:57:09 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:11 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1174249814 +2016-02-13 22:57:11 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:12 INFO SimpleDataGson:28 - -------Round 39 +2016-02-13 22:57:15 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1193157384 +2016-02-13 22:57:15 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:15 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:16 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1524814361 +2016-02-13 22:57:16 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:19 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1160014858 +2016-02-13 22:57:19 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:20 INFO SimpleDataGson:28 - -------Round 40 +2016-02-13 22:57:22 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1246414616 +2016-02-13 22:57:22 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:22 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:24 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1537631387 +2016-02-13 22:57:24 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:26 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1195739421 +2016-02-13 22:57:26 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:27 INFO SimpleDataGson:28 - -------Round 41 +2016-02-13 22:57:29 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1177802928 +2016-02-13 22:57:29 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:29 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:31 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1622097675 +2016-02-13 22:57:31 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:34 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1579197410 +2016-02-13 22:57:34 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:35 INFO SimpleDataGson:28 - -------Round 42 +2016-02-13 22:57:38 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1561412498 +2016-02-13 22:57:38 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:38 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:40 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 2263416744 +2016-02-13 22:57:40 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:43 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1524538828 +2016-02-13 22:57:43 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:44 INFO SimpleDataGson:28 - -------Round 43 +2016-02-13 22:57:46 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1210692026 +2016-02-13 22:57:46 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:46 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:48 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1532155857 +2016-02-13 22:57:48 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:50 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1145853325 +2016-02-13 22:57:50 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:51 INFO SimpleDataGson:28 - -------Round 44 +2016-02-13 22:57:53 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1238135991 +2016-02-13 22:57:54 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:57:54 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:57:55 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1515745453 +2016-02-13 22:57:55 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:57:57 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1289585678 +2016-02-13 22:57:57 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:57:58 INFO SimpleDataGson:28 - -------Round 45 +2016-02-13 22:58:01 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1255531683 +2016-02-13 22:58:01 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:01 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:03 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1723848336 +2016-02-13 22:58:03 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:05 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1152875078 +2016-02-13 22:58:05 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:06 INFO SimpleDataGson:28 - -------Round 46 +2016-02-13 22:58:08 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1184311903 +2016-02-13 22:58:08 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:08 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:10 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1442687734 +2016-02-13 22:58:10 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:12 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1166037112 +2016-02-13 22:58:12 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:13 INFO SimpleDataGson:28 - -------Round 47 +2016-02-13 22:58:15 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1182361066 +2016-02-13 22:58:15 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:15 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:17 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1538499040 +2016-02-13 22:58:17 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:19 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1152594808 +2016-02-13 22:58:19 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:20 INFO SimpleDataGson:28 - -------Round 48 +2016-02-13 22:58:22 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1189790196 +2016-02-13 22:58:22 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:22 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:24 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1436873118 +2016-02-13 22:58:24 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:26 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1165948689 +2016-02-13 22:58:26 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:27 INFO SimpleDataGson:28 - -------Round 49 +2016-02-13 22:58:29 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1187428428 +2016-02-13 22:58:29 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:29 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:31 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1504368068 +2016-02-13 22:58:31 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:33 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1247714122 +2016-02-13 22:58:33 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:34 INFO SimpleDataGson:28 - -------Round 50 +2016-02-13 22:58:36 INFO SimpleDataGson:53 - Json Generation Time(ms):: 1186676830 +2016-02-13 22:58:37 INFO SimpleDataGson:30 - Size of Simple content Gson :: 101 MB +2016-02-13 22:58:37 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 22:58:38 INFO SimpleDataGson:63 - Generating Map from json Time(ms):: 1520818736 +2016-02-13 22:58:38 INFO SimpleDataGson:64 - -------------------------------------------------------------------------- +2016-02-13 22:58:40 INFO SimpleDataGson:76 - Generating Actual Object from json Time(ms):: 1243656521 +2016-02-13 22:58:40 INFO SimpleDataGson:77 - -------------------------------------------------------------------------- +2016-02-13 22:58:41 INFO SimpleDataGson:39 - -------------------------------------------------------------------------- +2016-02-13 22:58:41 INFO SimpleDataGson:40 - Average Time to Generate JSON : 1262428946 +2016-02-13 22:58:41 INFO SimpleDataGson:41 - Average Time to Parse JSON To Map : 1555408963 +2016-02-13 22:58:41 INFO SimpleDataGson:42 - Average Time to Parse JSON To Actual Object : 1201992893 +2016-02-13 22:58:41 INFO SimpleDataGson:43 - -------------------------------------------------------------------------- +2016-02-13 22:59:20 INFO SimpleDataJackson:31 - -------Round 1 +2016-02-13 22:59:23 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1994045248 +2016-02-13 22:59:23 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:59:23 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 22:59:28 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 4419702826 +2016-02-13 22:59:28 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 22:59:30 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 871548287 +2016-02-13 22:59:31 INFO SimpleDataJackson:31 - -------Round 2 +2016-02-13 22:59:33 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 450226605 +2016-02-13 22:59:33 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:59:33 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 22:59:37 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 4073340752 +2016-02-13 22:59:37 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 22:59:39 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 807173018 +2016-02-13 22:59:40 INFO SimpleDataJackson:31 - -------Round 3 +2016-02-13 22:59:42 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 441634946 +2016-02-13 22:59:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:59:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 22:59:43 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1366655996 +2016-02-13 22:59:43 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 22:59:46 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 994427363 +2016-02-13 22:59:47 INFO SimpleDataJackson:31 - -------Round 4 +2016-02-13 22:59:48 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 513586979 +2016-02-13 22:59:49 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:59:49 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 22:59:50 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1715857087 +2016-02-13 22:59:50 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 22:59:53 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 952180402 +2016-02-13 22:59:54 INFO SimpleDataJackson:31 - -------Round 5 +2016-02-13 22:59:56 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 532706528 +2016-02-13 22:59:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 22:59:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 22:59:57 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1361951011 +2016-02-13 22:59:57 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:00 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 814924656 +2016-02-13 23:00:01 INFO SimpleDataJackson:31 - -------Round 6 +2016-02-13 23:00:02 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 438322627 +2016-02-13 23:00:02 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:02 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:04 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1357691696 +2016-02-13 23:00:04 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:06 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 787639774 +2016-02-13 23:00:07 INFO SimpleDataJackson:31 - -------Round 7 +2016-02-13 23:00:08 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 438668425 +2016-02-13 23:00:08 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:08 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:10 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1374237103 +2016-02-13 23:00:10 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:12 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 807600529 +2016-02-13 23:00:13 INFO SimpleDataJackson:31 - -------Round 8 +2016-02-13 23:00:14 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 457305594 +2016-02-13 23:00:14 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:14 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:16 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1384583805 +2016-02-13 23:00:16 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:18 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 810993376 +2016-02-13 23:00:19 INFO SimpleDataJackson:31 - -------Round 9 +2016-02-13 23:00:20 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 440303465 +2016-02-13 23:00:21 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:21 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:22 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1378739583 +2016-02-13 23:00:22 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:24 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 785994471 +2016-02-13 23:00:25 INFO SimpleDataJackson:31 - -------Round 10 +2016-02-13 23:00:26 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 442248382 +2016-02-13 23:00:27 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:27 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:28 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1338413458 +2016-02-13 23:00:28 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:30 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 783347301 +2016-02-13 23:00:31 INFO SimpleDataJackson:31 - -------Round 11 +2016-02-13 23:00:33 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 444837129 +2016-02-13 23:00:33 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:33 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:34 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1337033424 +2016-02-13 23:00:34 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:36 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 779409704 +2016-02-13 23:00:37 INFO SimpleDataJackson:31 - -------Round 12 +2016-02-13 23:00:39 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 444052373 +2016-02-13 23:00:39 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:39 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:40 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1352965001 +2016-02-13 23:00:40 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:42 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 781962924 +2016-02-13 23:00:43 INFO SimpleDataJackson:31 - -------Round 13 +2016-02-13 23:00:45 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 440353993 +2016-02-13 23:00:45 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:45 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:46 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1368178532 +2016-02-13 23:00:46 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:49 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1065239369 +2016-02-13 23:00:50 INFO SimpleDataJackson:31 - -------Round 14 +2016-02-13 23:00:52 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 615157241 +2016-02-13 23:00:52 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:52 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:00:54 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1728276604 +2016-02-13 23:00:54 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:00:56 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 998166402 +2016-02-13 23:00:57 INFO SimpleDataJackson:31 - -------Round 15 +2016-02-13 23:00:59 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 539145239 +2016-02-13 23:00:59 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:00:59 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:01 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1374288420 +2016-02-13 23:01:01 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:03 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 780897109 +2016-02-13 23:01:04 INFO SimpleDataJackson:31 - -------Round 16 +2016-02-13 23:01:05 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435791118 +2016-02-13 23:01:06 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:06 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:07 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1343672272 +2016-02-13 23:01:07 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:09 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 792992933 +2016-02-13 23:01:10 INFO SimpleDataJackson:31 - -------Round 17 +2016-02-13 23:01:11 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 438859483 +2016-02-13 23:01:12 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:12 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:13 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1382370461 +2016-02-13 23:01:13 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:16 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 951572098 +2016-02-13 23:01:16 INFO SimpleDataJackson:31 - -------Round 18 +2016-02-13 23:01:18 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 433854491 +2016-02-13 23:01:18 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:18 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:19 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1358839224 +2016-02-13 23:01:19 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:22 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 782784392 +2016-02-13 23:01:23 INFO SimpleDataJackson:31 - -------Round 19 +2016-02-13 23:01:24 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435710984 +2016-02-13 23:01:24 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:24 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:26 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1349415440 +2016-02-13 23:01:26 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:28 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 982777208 +2016-02-13 23:01:29 INFO SimpleDataJackson:31 - -------Round 20 +2016-02-13 23:01:31 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 505858237 +2016-02-13 23:01:31 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:31 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:33 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1726464717 +2016-02-13 23:01:33 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:35 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 984660544 +2016-02-13 23:01:37 INFO SimpleDataJackson:31 - -------Round 21 +2016-02-13 23:01:38 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 614672493 +2016-02-13 23:01:39 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:39 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:41 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1369641858 +2016-02-13 23:01:41 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:43 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 787754251 +2016-02-13 23:01:44 INFO SimpleDataJackson:31 - -------Round 22 +2016-02-13 23:01:45 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 433494877 +2016-02-13 23:01:46 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:46 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:47 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1349406755 +2016-02-13 23:01:47 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:49 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 797948581 +2016-02-13 23:01:50 INFO SimpleDataJackson:31 - -------Round 23 +2016-02-13 23:01:51 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 432709726 +2016-02-13 23:01:52 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:52 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:53 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1356035734 +2016-02-13 23:01:53 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:01:55 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 808091594 +2016-02-13 23:01:56 INFO SimpleDataJackson:31 - -------Round 24 +2016-02-13 23:01:58 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435182418 +2016-02-13 23:01:58 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:01:58 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:01:59 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1364351859 +2016-02-13 23:01:59 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:01 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 788939675 +2016-02-13 23:02:02 INFO SimpleDataJackson:31 - -------Round 25 +2016-02-13 23:02:04 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 439961220 +2016-02-13 23:02:04 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:04 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:05 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1352715915 +2016-02-13 23:02:06 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:08 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 792822008 +2016-02-13 23:02:09 INFO SimpleDataJackson:31 - -------Round 26 +2016-02-13 23:02:10 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 443481964 +2016-02-13 23:02:10 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:10 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:12 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1324584302 +2016-02-13 23:02:12 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:14 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 779368255 +2016-02-13 23:02:15 INFO SimpleDataJackson:31 - -------Round 27 +2016-02-13 23:02:16 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 470963035 +2016-02-13 23:02:17 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:17 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:18 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1342280001 +2016-02-13 23:02:18 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:20 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 831557303 +2016-02-13 23:02:21 INFO SimpleDataJackson:31 - -------Round 28 +2016-02-13 23:02:22 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 439997932 +2016-02-13 23:02:23 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:23 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:24 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1353183690 +2016-02-13 23:02:24 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:26 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 807440262 +2016-02-13 23:02:27 INFO SimpleDataJackson:31 - -------Round 29 +2016-02-13 23:02:29 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 442765105 +2016-02-13 23:02:29 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:29 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:30 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1384797757 +2016-02-13 23:02:30 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:32 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 796111036 +2016-02-13 23:02:33 INFO SimpleDataJackson:31 - -------Round 30 +2016-02-13 23:02:35 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 446163873 +2016-02-13 23:02:35 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:35 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:36 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1362167727 +2016-02-13 23:02:36 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:38 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 774013124 +2016-02-13 23:02:39 INFO SimpleDataJackson:31 - -------Round 31 +2016-02-13 23:02:41 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 438451709 +2016-02-13 23:02:41 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:41 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:42 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1366723892 +2016-02-13 23:02:42 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:45 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 785803808 +2016-02-13 23:02:46 INFO SimpleDataJackson:31 - -------Round 32 +2016-02-13 23:02:47 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 432899599 +2016-02-13 23:02:47 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:47 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:48 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1352116295 +2016-02-13 23:02:48 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:51 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 802779884 +2016-02-13 23:02:52 INFO SimpleDataJackson:31 - -------Round 33 +2016-02-13 23:02:53 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435379397 +2016-02-13 23:02:53 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:53 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:02:55 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1359177127 +2016-02-13 23:02:55 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:02:57 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 774916304 +2016-02-13 23:02:58 INFO SimpleDataJackson:31 - -------Round 34 +2016-02-13 23:02:59 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 437675243 +2016-02-13 23:02:59 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:02:59 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:01 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1358610665 +2016-02-13 23:03:01 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:03 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 784634964 +2016-02-13 23:03:04 INFO SimpleDataJackson:31 - -------Round 35 +2016-02-13 23:03:05 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 436069019 +2016-02-13 23:03:05 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:05 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:07 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1388644958 +2016-02-13 23:03:07 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:09 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 781348304 +2016-02-13 23:03:10 INFO SimpleDataJackson:31 - -------Round 36 +2016-02-13 23:03:11 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 436565216 +2016-02-13 23:03:11 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:11 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:13 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1373221420 +2016-02-13 23:03:13 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:15 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 778034801 +2016-02-13 23:03:16 INFO SimpleDataJackson:31 - -------Round 37 +2016-02-13 23:03:17 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 437646426 +2016-02-13 23:03:18 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:18 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:19 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1371113868 +2016-02-13 23:03:19 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:21 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 773487322 +2016-02-13 23:03:22 INFO SimpleDataJackson:31 - -------Round 38 +2016-02-13 23:03:23 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 428990029 +2016-02-13 23:03:24 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:24 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:25 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1372305608 +2016-02-13 23:03:25 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:27 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 787641353 +2016-02-13 23:03:28 INFO SimpleDataJackson:31 - -------Round 39 +2016-02-13 23:03:29 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435520716 +2016-02-13 23:03:30 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:30 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:31 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1344215838 +2016-02-13 23:03:31 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:33 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 780171564 +2016-02-13 23:03:34 INFO SimpleDataJackson:31 - -------Round 40 +2016-02-13 23:03:36 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 431967602 +2016-02-13 23:03:36 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:36 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:37 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1342673957 +2016-02-13 23:03:37 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:39 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 830946630 +2016-02-13 23:03:40 INFO SimpleDataJackson:31 - -------Round 41 +2016-02-13 23:03:42 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 439787136 +2016-02-13 23:03:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:43 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1336626046 +2016-02-13 23:03:43 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:46 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 966202984 +2016-02-13 23:03:47 INFO SimpleDataJackson:31 - -------Round 42 +2016-02-13 23:03:48 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 558927568 +2016-02-13 23:03:49 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:49 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:50 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1730400735 +2016-02-13 23:03:50 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:03:53 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1018089261 +2016-02-13 23:03:54 INFO SimpleDataJackson:31 - -------Round 43 +2016-02-13 23:03:56 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 553832969 +2016-02-13 23:03:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:03:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:03:58 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1374591980 +2016-02-13 23:03:58 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:00 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 791875011 +2016-02-13 23:04:01 INFO SimpleDataJackson:31 - -------Round 44 +2016-02-13 23:04:02 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 435538085 +2016-02-13 23:04:02 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:02 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:04 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1347747635 +2016-02-13 23:04:04 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:06 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 781452122 +2016-02-13 23:04:07 INFO SimpleDataJackson:31 - -------Round 45 +2016-02-13 23:04:08 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 430329799 +2016-02-13 23:04:08 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:08 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:10 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1355000709 +2016-02-13 23:04:10 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:12 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 783088347 +2016-02-13 23:04:13 INFO SimpleDataJackson:31 - -------Round 46 +2016-02-13 23:04:14 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 434882016 +2016-02-13 23:04:14 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:14 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:16 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1345464421 +2016-02-13 23:04:16 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:18 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 828007347 +2016-02-13 23:04:19 INFO SimpleDataJackson:31 - -------Round 47 +2016-02-13 23:04:21 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 488757026 +2016-02-13 23:04:21 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:21 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:22 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1430288745 +2016-02-13 23:04:22 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:24 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 821152573 +2016-02-13 23:04:27 INFO SimpleDataJackson:31 - -------Round 48 +2016-02-13 23:04:34 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1746328759 +2016-02-13 23:04:35 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:35 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:39 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 3671360072 +2016-02-13 23:04:39 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:43 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1560371551 +2016-02-13 23:04:45 INFO SimpleDataJackson:31 - -------Round 49 +2016-02-13 23:04:47 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 690772918 +2016-02-13 23:04:48 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:48 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:50 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 2070935956 +2016-02-13 23:04:50 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:04:53 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1102717396 +2016-02-13 23:04:54 INFO SimpleDataJackson:31 - -------Round 50 +2016-02-13 23:04:56 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 521889684 +2016-02-13 23:04:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 101 MB +2016-02-13 23:04:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-13 23:04:58 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1620059599 +2016-02-13 23:04:58 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-13 23:05:00 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 813171982 +2016-02-13 23:05:01 INFO SimpleDataJackson:44 - -------------------------------------------------------------------------- +2016-02-13 23:05:01 INFO SimpleDataJackson:45 - Average Time to Generate JSON : 522685452 +2016-02-13 23:05:01 INFO SimpleDataJackson:46 - Average Time to Parse JSON To Map : 1571262450 +2016-02-13 23:05:01 INFO SimpleDataJackson:47 - Average Time to Parse JSON To Actual Object : 852524629 +2016-02-13 23:05:01 INFO SimpleDataJackson:48 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 10R.log b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 10R.log new file mode 100644 index 0000000000..3926f450b9 --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 10R.log @@ -0,0 +1,160 @@ +2016-02-13 23:46:10 INFO SimpleDataGson:28 - -------Round 1 +2016-02-13 23:46:17 INFO SimpleDataGson:54 - Json Generation Time(ms):: 4115421919 +2016-02-13 23:46:18 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:46:18 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:46:24 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5979578577 +2016-02-13 23:46:24 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:46:37 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 8799068872 +2016-02-13 23:46:37 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:46:41 INFO SimpleDataGson:28 - -------Round 2 +2016-02-13 23:46:46 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3215032264 +2016-02-13 23:46:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:46:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:46:52 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5430384274 +2016-02-13 23:46:52 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:46:58 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3081980964 +2016-02-13 23:46:58 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:47:02 INFO SimpleDataGson:28 - -------Round 3 +2016-02-13 23:47:08 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3074217879 +2016-02-13 23:47:08 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:47:08 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:47:14 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 6177310679 +2016-02-13 23:47:14 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:47:21 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3172692933 +2016-02-13 23:47:21 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:47:24 INFO SimpleDataGson:28 - -------Round 4 +2016-02-13 23:47:31 INFO SimpleDataGson:54 - Json Generation Time(ms):: 4090244194 +2016-02-13 23:47:32 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:47:32 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:47:39 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 7408656634 +2016-02-13 23:47:39 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:47:45 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3023505579 +2016-02-13 23:47:45 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:47:48 INFO SimpleDataGson:28 - -------Round 5 +2016-02-13 23:47:54 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3196609048 +2016-02-13 23:47:55 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:47:55 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:48:31 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 36806648005 +2016-02-13 23:48:31 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:48:38 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3057928662 +2016-02-13 23:48:38 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:48:41 INFO SimpleDataGson:28 - -------Round 6 +2016-02-13 23:48:46 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3116500761 +2016-02-13 23:48:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:48:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:48:53 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5492820152 +2016-02-13 23:48:53 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:48:59 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3008170464 +2016-02-13 23:48:59 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:49:02 INFO SimpleDataGson:28 - -------Round 7 +2016-02-13 23:49:08 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3101777899 +2016-02-13 23:49:09 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:49:09 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:49:31 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 22060865577 +2016-02-13 23:49:31 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:49:37 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3004783539 +2016-02-13 23:49:37 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:49:40 INFO SimpleDataGson:28 - -------Round 8 +2016-02-13 23:49:45 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3105519701 +2016-02-13 23:49:46 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:49:46 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:50:08 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 22301662159 +2016-02-13 23:50:08 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:50:14 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2975667427 +2016-02-13 23:50:14 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:50:17 INFO SimpleDataGson:28 - -------Round 9 +2016-02-13 23:50:23 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3198289879 +2016-02-13 23:50:23 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:50:23 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:50:44 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 20094735621 +2016-02-13 23:50:44 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:50:50 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2982894448 +2016-02-13 23:50:50 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:50:53 INFO SimpleDataGson:28 - -------Round 10 +2016-02-13 23:50:58 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3078554959 +2016-02-13 23:50:59 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-13 23:50:59 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-13 23:51:21 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 21830630833 +2016-02-13 23:51:21 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-13 23:51:27 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3010499469 +2016-02-13 23:51:27 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-13 23:51:30 INFO SimpleDataGson:40 - -------------------------------------------------------------------------- +2016-02-13 23:51:30 INFO SimpleDataGson:41 - Average Time to Generate JSON : 3329216850 +2016-02-13 23:51:30 INFO SimpleDataGson:42 - Average Time to Parse JSON To Map : 15358329251 +2016-02-13 23:51:30 INFO SimpleDataGson:43 - Average Time to Parse JSON To Actual Object : 3611719235 +2016-02-13 23:51:30 INFO SimpleDataGson:44 - -------------------------------------------------------------------------- +2016-02-14 00:02:42 INFO SimpleDataJackson:31 - -------Round 1 +2016-02-14 00:02:47 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1640080750 +2016-02-14 00:02:48 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:02:48 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:02:50 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 2672981690 +2016-02-14 00:02:50 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:02:55 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1793866507 +2016-02-14 00:02:59 INFO SimpleDataJackson:31 - -------Round 2 +2016-02-14 00:03:02 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1085543552 +2016-02-14 00:03:03 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:03:03 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:03:05 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1884080700 +2016-02-14 00:03:05 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:03:09 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1622782955 +2016-02-14 00:03:11 INFO SimpleDataJackson:31 - -------Round 3 +2016-02-14 00:03:15 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1087769528 +2016-02-14 00:03:15 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:03:15 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:03:17 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1866192760 +2016-02-14 00:03:17 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:03:22 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2164019167 +2016-02-14 00:03:25 INFO SimpleDataJackson:31 - -------Round 4 +2016-02-14 00:03:29 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1518929874 +2016-02-14 00:03:30 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:03:30 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:03:32 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1863419271 +2016-02-14 00:03:32 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:03:36 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1623395996 +2016-02-14 00:03:39 INFO SimpleDataJackson:31 - -------Round 5 +2016-02-14 00:03:42 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1071791372 +2016-02-14 00:03:43 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:03:43 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:03:45 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 1861038555 +2016-02-14 00:03:45 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:03:49 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 1679350531 +2016-02-14 00:03:51 INFO SimpleDataJackson:31 - -------Round 6 +2016-02-14 00:03:55 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1046878522 +2016-02-14 00:03:55 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:03:55 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:03:58 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 3142311264 +2016-02-14 00:03:58 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:04:05 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2276167059 +2016-02-14 00:04:07 INFO SimpleDataJackson:31 - -------Round 7 +2016-02-14 00:04:11 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1128271314 +2016-02-14 00:04:12 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:04:12 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:04:14 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 2644174666 +2016-02-14 00:04:14 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:04:19 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2244204035 +2016-02-14 00:04:22 INFO SimpleDataJackson:31 - -------Round 8 +2016-02-14 00:04:25 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1049764909 +2016-02-14 00:04:26 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:04:26 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:04:29 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 3621206732 +2016-02-14 00:04:29 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:04:35 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2355619671 +2016-02-14 00:04:38 INFO SimpleDataJackson:31 - -------Round 9 +2016-02-14 00:04:42 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1104708497 +2016-02-14 00:04:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:04:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:04:47 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 5293797624 +2016-02-14 00:04:47 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:04:53 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2276509304 +2016-02-14 00:04:57 INFO SimpleDataJackson:31 - -------Round 10 +2016-02-14 00:05:01 INFO SimpleDataJackson:58 - Json Generation Time(ms):: 1187760804 +2016-02-14 00:05:01 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 00:05:01 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 00:05:05 INFO SimpleDataJackson:68 - Generating Map from json Time(ms):: 3760862932 +2016-02-14 00:05:05 INFO SimpleDataJackson:69 - -------------------------------------------------------------------------- +2016-02-14 00:05:11 INFO SimpleDataJackson:81 - Generating Actual Object from json Time(ms):: 2363176304 +2016-02-14 00:05:13 INFO SimpleDataJackson:44 - -------------------------------------------------------------------------- +2016-02-14 00:05:13 INFO SimpleDataJackson:45 - Average Time to Generate JSON : 1192149912 +2016-02-14 00:05:13 INFO SimpleDataJackson:46 - Average Time to Parse JSON To Map : 2861006619 +2016-02-14 00:05:13 INFO SimpleDataJackson:47 - Average Time to Parse JSON To Actual Object : 2039909152 +2016-02-14 00:05:13 INFO SimpleDataJackson:48 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 50R.log b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 50R.log new file mode 100644 index 0000000000..c15b4155fd --- /dev/null +++ b/gson-jackson-performance/logs_Performance/log4j-application simple Gson Jackson 250mb 50R.log @@ -0,0 +1,760 @@ +2016-02-14 00:11:43 INFO SimpleDataGson:28 - -------Round 1 +2016-02-14 00:11:50 INFO SimpleDataGson:54 - Json Generation Time(ms):: 4340606275 +2016-02-14 00:11:51 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:11:51 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:12:03 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 12287382597 +2016-02-14 00:12:04 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:12:17 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 6381797289 +2016-02-14 00:12:17 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:12:20 INFO SimpleDataGson:28 - -------Round 2 +2016-02-14 00:12:26 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3447057973 +2016-02-14 00:12:27 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:12:27 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:12:34 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 6964375308 +2016-02-14 00:12:34 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:12:40 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3299282232 +2016-02-14 00:12:40 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:12:44 INFO SimpleDataGson:28 - -------Round 3 +2016-02-14 00:12:49 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3187362899 +2016-02-14 00:12:50 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:12:50 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:12:56 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5988912359 +2016-02-14 00:12:56 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:13:02 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3037755534 +2016-02-14 00:13:02 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:13:05 INFO SimpleDataGson:28 - -------Round 4 +2016-02-14 00:13:11 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3119391095 +2016-02-14 00:13:11 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:13:11 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:13:17 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5743481451 +2016-02-14 00:13:17 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:13:24 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3686319782 +2016-02-14 00:13:24 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:13:28 INFO SimpleDataGson:28 - -------Round 5 +2016-02-14 00:13:34 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3934239566 +2016-02-14 00:13:35 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:13:35 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:14:09 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 33567932922 +2016-02-14 00:14:09 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:14:15 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3086910165 +2016-02-14 00:14:15 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:14:18 INFO SimpleDataGson:28 - -------Round 6 +2016-02-14 00:14:24 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3234168394 +2016-02-14 00:14:24 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:14:24 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:14:45 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 20216556381 +2016-02-14 00:14:45 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:14:51 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3030008238 +2016-02-14 00:14:51 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:14:54 INFO SimpleDataGson:28 - -------Round 7 +2016-02-14 00:15:00 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3455602658 +2016-02-14 00:15:00 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:15:00 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:15:20 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19443209589 +2016-02-14 00:15:20 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:15:26 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2945137729 +2016-02-14 00:15:26 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:15:29 INFO SimpleDataGson:28 - -------Round 8 +2016-02-14 00:15:34 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3152326775 +2016-02-14 00:15:35 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:15:35 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:15:40 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5166017769 +2016-02-14 00:15:40 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:15:47 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2933530996 +2016-02-14 00:15:47 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:15:49 INFO SimpleDataGson:28 - -------Round 9 +2016-02-14 00:15:55 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3271454180 +2016-02-14 00:15:56 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:15:56 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:16:15 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19051407844 +2016-02-14 00:16:15 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:16:21 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2955690488 +2016-02-14 00:16:21 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:16:24 INFO SimpleDataGson:28 - -------Round 10 +2016-02-14 00:16:29 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3172185290 +2016-02-14 00:16:30 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:16:30 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:16:35 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5183987817 +2016-02-14 00:16:35 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:16:42 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2976106781 +2016-02-14 00:16:42 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:16:44 INFO SimpleDataGson:28 - -------Round 11 +2016-02-14 00:16:50 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3160732507 +2016-02-14 00:16:51 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:16:51 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:16:56 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5154795125 +2016-02-14 00:16:56 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:17:02 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2901304677 +2016-02-14 00:17:02 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:17:05 INFO SimpleDataGson:28 - -------Round 12 +2016-02-14 00:17:11 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3154345113 +2016-02-14 00:17:11 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:17:12 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:17:32 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19767182825 +2016-02-14 00:17:32 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:17:38 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2936730417 +2016-02-14 00:17:38 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:17:41 INFO SimpleDataGson:28 - -------Round 13 +2016-02-14 00:17:47 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3175565109 +2016-02-14 00:17:48 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:17:48 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:17:53 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5111310238 +2016-02-14 00:17:53 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:17:59 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2914264207 +2016-02-14 00:17:59 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:18:02 INFO SimpleDataGson:28 - -------Round 14 +2016-02-14 00:18:08 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3156483456 +2016-02-14 00:18:08 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:18:08 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:18:27 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19026387623 +2016-02-14 00:18:27 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:18:33 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2898468817 +2016-02-14 00:18:33 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:18:37 INFO SimpleDataGson:28 - -------Round 15 +2016-02-14 00:18:43 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3176971986 +2016-02-14 00:18:44 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:18:44 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:19:03 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18819822277 +2016-02-14 00:19:03 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:19:09 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2944195074 +2016-02-14 00:19:09 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:19:13 INFO SimpleDataGson:28 - -------Round 16 +2016-02-14 00:19:19 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3148834846 +2016-02-14 00:19:19 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:19:19 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:19:38 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19390679087 +2016-02-14 00:19:39 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:19:45 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3183360565 +2016-02-14 00:19:45 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:19:48 INFO SimpleDataGson:28 - -------Round 17 +2016-02-14 00:19:53 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3150490019 +2016-02-14 00:19:54 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:19:54 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:19:59 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5132583526 +2016-02-14 00:19:59 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:20:07 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2966433121 +2016-02-14 00:20:07 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:20:10 INFO SimpleDataGson:28 - -------Round 18 +2016-02-14 00:20:17 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3550768946 +2016-02-14 00:20:17 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:20:17 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:20:38 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 20364043958 +2016-02-14 00:20:38 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:20:44 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2927474400 +2016-02-14 00:20:44 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:20:47 INFO SimpleDataGson:28 - -------Round 19 +2016-02-14 00:20:52 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3118286199 +2016-02-14 00:20:53 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:20:53 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:21:13 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19960982856 +2016-02-14 00:21:13 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:21:20 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3604365266 +2016-02-14 00:21:20 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:21:25 INFO SimpleDataGson:28 - -------Round 20 +2016-02-14 00:21:31 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3673000243 +2016-02-14 00:21:32 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:21:32 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:21:37 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5155220266 +2016-02-14 00:21:37 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:21:43 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2926214763 +2016-02-14 00:21:43 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:21:47 INFO SimpleDataGson:28 - -------Round 21 +2016-02-14 00:21:52 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3158473373 +2016-02-14 00:21:53 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:21:53 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:22:12 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19593056961 +2016-02-14 00:22:12 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:22:18 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2941365137 +2016-02-14 00:22:18 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:22:21 INFO SimpleDataGson:28 - -------Round 22 +2016-02-14 00:22:27 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3240733819 +2016-02-14 00:22:28 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:22:28 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:22:33 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5260135611 +2016-02-14 00:22:33 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:22:41 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3164218514 +2016-02-14 00:22:41 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:22:44 INFO SimpleDataGson:28 - -------Round 23 +2016-02-14 00:22:51 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3950377990 +2016-02-14 00:22:52 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:22:52 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:22:59 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 6942376082 +2016-02-14 00:22:59 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:23:06 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2912013756 +2016-02-14 00:23:06 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:23:09 INFO SimpleDataGson:28 - -------Round 24 +2016-02-14 00:23:14 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3162496235 +2016-02-14 00:23:15 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:23:15 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:23:34 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18938874285 +2016-02-14 00:23:34 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:23:40 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2913962225 +2016-02-14 00:23:40 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:23:43 INFO SimpleDataGson:28 - -------Round 25 +2016-02-14 00:23:48 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3180082589 +2016-02-14 00:23:49 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:23:49 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:23:54 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5144263286 +2016-02-14 00:23:54 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:24:00 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2901693502 +2016-02-14 00:24:00 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:24:03 INFO SimpleDataGson:28 - -------Round 26 +2016-02-14 00:24:09 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3219238684 +2016-02-14 00:24:09 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:24:09 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:24:28 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18842977321 +2016-02-14 00:24:28 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:24:34 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2952234483 +2016-02-14 00:24:34 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:24:37 INFO SimpleDataGson:28 - -------Round 27 +2016-02-14 00:24:43 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3272345911 +2016-02-14 00:24:43 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:24:43 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:24:49 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5632996628 +2016-02-14 00:24:49 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:24:56 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3029633229 +2016-02-14 00:24:56 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:24:59 INFO SimpleDataGson:28 - -------Round 28 +2016-02-14 00:25:04 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3169683386 +2016-02-14 00:25:05 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:25:05 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:25:23 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18181483545 +2016-02-14 00:25:23 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:25:29 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2923402589 +2016-02-14 00:25:29 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:25:32 INFO SimpleDataGson:28 - -------Round 29 +2016-02-14 00:25:37 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3212580494 +2016-02-14 00:25:38 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:25:38 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:25:59 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 21118590549 +2016-02-14 00:25:59 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:26:05 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2979127381 +2016-02-14 00:26:05 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:26:08 INFO SimpleDataGson:28 - -------Round 30 +2016-02-14 00:26:13 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3180047456 +2016-02-14 00:26:14 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:26:14 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:26:32 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18226907030 +2016-02-14 00:26:32 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:26:38 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2914835010 +2016-02-14 00:26:38 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:26:41 INFO SimpleDataGson:28 - -------Round 31 +2016-02-14 00:26:46 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3184658097 +2016-02-14 00:26:47 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:26:47 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:27:08 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 20737813285 +2016-02-14 00:27:08 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:27:14 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2930900800 +2016-02-14 00:27:14 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:27:17 INFO SimpleDataGson:28 - -------Round 32 +2016-02-14 00:27:22 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3259012163 +2016-02-14 00:27:23 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:27:23 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:27:44 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 21144334736 +2016-02-14 00:27:44 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:27:50 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2934185091 +2016-02-14 00:27:50 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:27:53 INFO SimpleDataGson:28 - -------Round 33 +2016-02-14 00:27:58 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3177588580 +2016-02-14 00:27:59 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:27:59 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:28:18 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18644949554 +2016-02-14 00:28:18 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:28:24 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2912270342 +2016-02-14 00:28:24 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:28:27 INFO SimpleDataGson:28 - -------Round 34 +2016-02-14 00:28:32 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3174772459 +2016-02-14 00:28:33 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:28:33 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:28:52 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 18805845881 +2016-02-14 00:28:52 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:28:57 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2899120150 +2016-02-14 00:28:57 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:29:00 INFO SimpleDataGson:28 - -------Round 35 +2016-02-14 00:29:06 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3385021974 +2016-02-14 00:29:07 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:29:07 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:29:12 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5143330105 +2016-02-14 00:29:12 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:29:18 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2915072648 +2016-02-14 00:29:18 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:29:21 INFO SimpleDataGson:28 - -------Round 36 +2016-02-14 00:29:27 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3176665663 +2016-02-14 00:29:27 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:29:27 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:29:33 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5483340314 +2016-02-14 00:29:33 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:29:39 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2939049553 +2016-02-14 00:29:39 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:29:43 INFO SimpleDataGson:28 - -------Round 37 +2016-02-14 00:29:49 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3838179966 +2016-02-14 00:29:50 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:29:50 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:29:56 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 6331521578 +2016-02-14 00:29:56 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:30:03 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2932029380 +2016-02-14 00:30:03 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:30:06 INFO SimpleDataGson:28 - -------Round 38 +2016-02-14 00:30:11 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3232773754 +2016-02-14 00:30:12 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:30:12 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:30:17 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5111574325 +2016-02-14 00:30:17 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:30:24 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2937454777 +2016-02-14 00:30:24 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:30:26 INFO SimpleDataGson:28 - -------Round 39 +2016-02-14 00:30:32 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3155400666 +2016-02-14 00:30:33 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:30:33 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:30:55 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 22127306948 +2016-02-14 00:30:55 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:31:01 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2945046938 +2016-02-14 00:31:01 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:31:04 INFO SimpleDataGson:28 - -------Round 40 +2016-02-14 00:31:09 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3303421545 +2016-02-14 00:31:10 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:31:10 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:31:29 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19267411185 +2016-02-14 00:31:29 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:31:35 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2978847900 +2016-02-14 00:31:35 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:31:38 INFO SimpleDataGson:28 - -------Round 41 +2016-02-14 00:31:47 INFO SimpleDataGson:54 - Json Generation Time(ms):: 6197094586 +2016-02-14 00:31:51 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:31:51 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:32:04 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 13564575996 +2016-02-14 00:32:04 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:32:14 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 4029021372 +2016-02-14 00:32:14 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:32:18 INFO SimpleDataGson:28 - -------Round 42 +2016-02-14 00:32:25 INFO SimpleDataGson:54 - Json Generation Time(ms):: 4386850044 +2016-02-14 00:32:26 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:32:26 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:32:32 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 6199628465 +2016-02-14 00:32:32 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:32:39 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3232875598 +2016-02-14 00:32:39 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:32:43 INFO SimpleDataGson:28 - -------Round 43 +2016-02-14 00:32:49 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3261124847 +2016-02-14 00:32:50 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:32:50 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:32:55 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 5414788232 +2016-02-14 00:32:55 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:33:03 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3900553079 +2016-02-14 00:33:03 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:33:06 INFO SimpleDataGson:28 - -------Round 44 +2016-02-14 00:33:13 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3806054701 +2016-02-14 00:33:13 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:33:13 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:33:33 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19901549025 +2016-02-14 00:33:33 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:33:40 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3087670842 +2016-02-14 00:33:40 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:33:43 INFO SimpleDataGson:28 - -------Round 45 +2016-02-14 00:33:49 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3496904200 +2016-02-14 00:33:50 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:33:50 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:34:09 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19760852273 +2016-02-14 00:34:09 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:34:16 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3030993526 +2016-02-14 00:34:16 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:34:18 INFO SimpleDataGson:28 - -------Round 46 +2016-02-14 00:34:24 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3224896192 +2016-02-14 00:34:25 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:34:25 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:34:46 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 21800935233 +2016-02-14 00:34:46 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:34:53 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 2988645905 +2016-02-14 00:34:53 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:34:56 INFO SimpleDataGson:28 - -------Round 47 +2016-02-14 00:35:02 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3325038261 +2016-02-14 00:35:02 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:35:02 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:35:22 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19895342820 +2016-02-14 00:35:22 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:35:29 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3399804048 +2016-02-14 00:35:29 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:35:32 INFO SimpleDataGson:28 - -------Round 48 +2016-02-14 00:35:38 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3353567383 +2016-02-14 00:35:39 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:35:39 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:36:02 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 23112502373 +2016-02-14 00:36:02 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:36:08 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3315296705 +2016-02-14 00:36:08 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:36:11 INFO SimpleDataGson:28 - -------Round 49 +2016-02-14 00:36:17 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3274835184 +2016-02-14 00:36:18 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:36:18 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:36:35 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 17724232426 +2016-02-14 00:36:35 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:36:41 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3032271715 +2016-02-14 00:36:41 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:36:45 INFO SimpleDataGson:28 - -------Round 50 +2016-02-14 00:36:50 INFO SimpleDataGson:54 - Json Generation Time(ms):: 3274908606 +2016-02-14 00:36:51 INFO SimpleDataGson:30 - Size of Simple content Gson :: 251 MB +2016-02-14 00:36:51 INFO SimpleDataGson:31 - -------------------------------------------------------------------------- +2016-02-14 00:37:10 INFO SimpleDataGson:64 - Generating Map from json Time(ms):: 19519852002 +2016-02-14 00:37:10 INFO SimpleDataGson:65 - -------------------------------------------------------------------------- +2016-02-14 00:37:17 INFO SimpleDataGson:77 - Generating Actual Object from json Time(ms):: 3261170242 +2016-02-14 00:37:17 INFO SimpleDataGson:78 - -------------------------------------------------------------------------- +2016-02-14 00:37:20 INFO SimpleDataGson:40 - -------------------------------------------------------------------------- +2016-02-14 00:37:20 INFO SimpleDataGson:41 - Average Time to Generate JSON : 3400294046 +2016-02-14 00:37:20 INFO SimpleDataGson:42 - Average Time to Parse JSON To Map : 14381392397 +2016-02-14 00:37:20 INFO SimpleDataGson:43 - Average Time to Parse JSON To Actual Object : 3135402339 +2016-02-14 00:37:20 INFO SimpleDataGson:44 - -------------------------------------------------------------------------- +2016-02-14 01:10:20 INFO SimpleDataJackson:31 - -------Round 1 +2016-02-14 01:10:26 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 2029986528 +2016-02-14 01:10:27 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:10:27 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:10:32 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 4698777983 +2016-02-14 01:10:32 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:10:37 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1658963845 +2016-02-14 01:10:41 INFO SimpleDataJackson:31 - -------Round 2 +2016-02-14 01:10:44 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1031786966 +2016-02-14 01:10:45 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:10:45 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:10:47 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1817755779 +2016-02-14 01:10:47 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:10:51 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1585730859 +2016-02-14 01:10:54 INFO SimpleDataJackson:31 - -------Round 3 +2016-02-14 01:10:57 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1055084513 +2016-02-14 01:10:58 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:10:58 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:11:00 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1829403961 +2016-02-14 01:11:00 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:11:04 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1573906621 +2016-02-14 01:11:06 INFO SimpleDataJackson:31 - -------Round 4 +2016-02-14 01:11:10 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1023955984 +2016-02-14 01:11:10 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:11:10 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:11:12 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1797498570 +2016-02-14 01:11:12 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:11:16 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1626333701 +2016-02-14 01:11:19 INFO SimpleDataJackson:31 - -------Round 5 +2016-02-14 01:11:22 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1006898985 +2016-02-14 01:11:23 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:11:23 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:11:25 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1798982027 +2016-02-14 01:11:25 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:11:29 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1667870513 +2016-02-14 01:11:32 INFO SimpleDataJackson:31 - -------Round 6 +2016-02-14 01:11:35 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1002808227 +2016-02-14 01:11:36 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:11:36 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:11:38 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1998326275 +2016-02-14 01:11:38 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:11:42 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1645837733 +2016-02-14 01:11:44 INFO SimpleDataJackson:31 - -------Round 7 +2016-02-14 01:11:48 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1003553509 +2016-02-14 01:11:48 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:11:48 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:11:50 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2018994020 +2016-02-14 01:11:50 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:11:55 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1657835265 +2016-02-14 01:11:57 INFO SimpleDataJackson:31 - -------Round 8 +2016-02-14 01:12:01 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1005108020 +2016-02-14 01:12:01 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:12:01 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:12:03 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1996226617 +2016-02-14 01:12:03 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:12:07 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1645807733 +2016-02-14 01:12:10 INFO SimpleDataJackson:31 - -------Round 9 +2016-02-14 01:12:13 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 991788482 +2016-02-14 01:12:14 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:12:14 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:12:16 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1991979539 +2016-02-14 01:12:16 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:12:20 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1657106958 +2016-02-14 01:12:22 INFO SimpleDataJackson:31 - -------Round 10 +2016-02-14 01:12:26 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1002594274 +2016-02-14 01:12:26 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:12:26 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:12:28 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2016278558 +2016-02-14 01:12:28 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:12:33 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1661181926 +2016-02-14 01:12:35 INFO SimpleDataJackson:31 - -------Round 11 +2016-02-14 01:12:39 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1000298034 +2016-02-14 01:12:39 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:12:39 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:12:41 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1993129831 +2016-02-14 01:12:41 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:12:45 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1664888991 +2016-02-14 01:12:48 INFO SimpleDataJackson:31 - -------Round 12 +2016-02-14 01:12:52 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1259261248 +2016-02-14 01:12:52 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:12:52 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:12:55 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2235383423 +2016-02-14 01:12:55 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:12:59 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1690719232 +2016-02-14 01:13:01 INFO SimpleDataJackson:31 - -------Round 13 +2016-02-14 01:13:05 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1014408644 +2016-02-14 01:13:05 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:13:05 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:13:07 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2043347909 +2016-02-14 01:13:07 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:13:12 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1663652250 +2016-02-14 01:13:14 INFO SimpleDataJackson:31 - -------Round 14 +2016-02-14 01:13:19 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1333126618 +2016-02-14 01:13:19 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:13:19 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:13:22 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2481588034 +2016-02-14 01:13:22 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:13:27 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1933185198 +2016-02-14 01:13:29 INFO SimpleDataJackson:31 - -------Round 15 +2016-02-14 01:13:33 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1020516558 +2016-02-14 01:13:33 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:13:33 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:13:35 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 1997307828 +2016-02-14 01:13:35 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:13:40 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1665160971 +2016-02-14 01:13:42 INFO SimpleDataJackson:31 - -------Round 16 +2016-02-14 01:13:46 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1047870915 +2016-02-14 01:13:46 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:13:46 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:13:48 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2007945854 +2016-02-14 01:13:48 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:13:53 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1713994673 +2016-02-14 01:13:55 INFO SimpleDataJackson:31 - -------Round 17 +2016-02-14 01:13:59 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1021864222 +2016-02-14 01:14:00 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:14:00 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:14:02 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2119751499 +2016-02-14 01:14:02 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:14:06 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1819921754 +2016-02-14 01:14:09 INFO SimpleDataJackson:31 - -------Round 18 +2016-02-14 01:14:12 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1100389181 +2016-02-14 01:14:13 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:14:13 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:14:15 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2190647586 +2016-02-14 01:14:15 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:14:20 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1918921820 +2016-02-14 01:14:23 INFO SimpleDataJackson:31 - -------Round 19 +2016-02-14 01:14:27 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1095955782 +2016-02-14 01:14:27 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:14:27 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:14:29 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2203353688 +2016-02-14 01:14:29 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:14:34 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2183651493 +2016-02-14 01:14:37 INFO SimpleDataJackson:31 - -------Round 20 +2016-02-14 01:14:41 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1346518000 +2016-02-14 01:14:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:14:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:14:44 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2305701995 +2016-02-14 01:14:44 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:14:49 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1834727512 +2016-02-14 01:14:52 INFO SimpleDataJackson:31 - -------Round 21 +2016-02-14 01:14:56 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1054845297 +2016-02-14 01:14:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:14:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:14:58 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2085967115 +2016-02-14 01:14:58 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:15:04 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2635661561 +2016-02-14 01:15:07 INFO SimpleDataJackson:31 - -------Round 22 +2016-02-14 01:15:11 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1221064781 +2016-02-14 01:15:11 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:15:11 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:15:13 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2105141139 +2016-02-14 01:15:13 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:15:19 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2733167908 +2016-02-14 01:15:22 INFO SimpleDataJackson:31 - -------Round 23 +2016-02-14 01:15:27 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1667984199 +2016-02-14 01:15:28 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:15:28 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:15:30 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2661075740 +2016-02-14 01:15:30 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:15:35 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1807353417 +2016-02-14 01:15:38 INFO SimpleDataJackson:31 - -------Round 24 +2016-02-14 01:15:42 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1088799421 +2016-02-14 01:15:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:15:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:15:44 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2133273543 +2016-02-14 01:15:44 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:15:49 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1796471834 +2016-02-14 01:15:52 INFO SimpleDataJackson:31 - -------Round 25 +2016-02-14 01:15:56 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1061435591 +2016-02-14 01:15:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:15:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:15:59 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2772566377 +2016-02-14 01:15:59 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:16:04 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2127388266 +2016-02-14 01:16:07 INFO SimpleDataJackson:31 - -------Round 26 +2016-02-14 01:16:13 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1570076001 +2016-02-14 01:16:13 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:16:13 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:16:16 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 3026015772 +2016-02-14 01:16:16 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:16:22 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2328930067 +2016-02-14 01:16:25 INFO SimpleDataJackson:31 - -------Round 27 +2016-02-14 01:16:29 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1047895784 +2016-02-14 01:16:29 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:16:29 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:16:32 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2165248408 +2016-02-14 01:16:32 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:16:37 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1919710920 +2016-02-14 01:16:40 INFO SimpleDataJackson:31 - -------Round 28 +2016-02-14 01:16:44 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1461024502 +2016-02-14 01:16:45 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:16:45 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:16:48 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2548823636 +2016-02-14 01:16:48 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:16:53 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1884536633 +2016-02-14 01:16:56 INFO SimpleDataJackson:31 - -------Round 29 +2016-02-14 01:16:59 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1075140796 +2016-02-14 01:17:00 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:17:00 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:17:02 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2158603245 +2016-02-14 01:17:02 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:17:07 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1728481872 +2016-02-14 01:17:09 INFO SimpleDataJackson:31 - -------Round 30 +2016-02-14 01:17:13 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1122247876 +2016-02-14 01:17:14 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:17:14 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:17:17 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2610826477 +2016-02-14 01:17:17 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:17:22 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2207052069 +2016-02-14 01:17:25 INFO SimpleDataJackson:31 - -------Round 31 +2016-02-14 01:17:29 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1052980909 +2016-02-14 01:17:30 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:17:30 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:17:32 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2052367868 +2016-02-14 01:17:32 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:17:36 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1718415440 +2016-02-14 01:17:39 INFO SimpleDataJackson:31 - -------Round 32 +2016-02-14 01:17:43 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1055489524 +2016-02-14 01:17:43 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:17:43 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:17:45 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2063065499 +2016-02-14 01:17:45 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:17:50 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1710515377 +2016-02-14 01:17:53 INFO SimpleDataJackson:31 - -------Round 33 +2016-02-14 01:17:57 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1129909512 +2016-02-14 01:17:57 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:17:57 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:17:59 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2102819240 +2016-02-14 01:17:59 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:18:04 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1730105070 +2016-02-14 01:18:07 INFO SimpleDataJackson:31 - -------Round 34 +2016-02-14 01:18:11 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1101129726 +2016-02-14 01:18:11 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:18:11 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:18:13 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2206549951 +2016-02-14 01:18:13 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:18:18 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1903037219 +2016-02-14 01:18:21 INFO SimpleDataJackson:31 - -------Round 35 +2016-02-14 01:18:26 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1386136343 +2016-02-14 01:18:27 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:18:27 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:18:29 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2646813152 +2016-02-14 01:18:29 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:18:35 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2271873400 +2016-02-14 01:18:38 INFO SimpleDataJackson:31 - -------Round 36 +2016-02-14 01:18:41 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1072219672 +2016-02-14 01:18:42 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:18:42 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:18:44 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2116882876 +2016-02-14 01:18:44 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:18:49 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1785044316 +2016-02-14 01:18:52 INFO SimpleDataJackson:31 - -------Round 37 +2016-02-14 01:18:56 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1060936236 +2016-02-14 01:18:56 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:18:56 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:18:59 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2095196685 +2016-02-14 01:18:59 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:19:03 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1748247622 +2016-02-14 01:19:06 INFO SimpleDataJackson:31 - -------Round 38 +2016-02-14 01:19:10 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1086578972 +2016-02-14 01:19:11 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:19:11 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:19:13 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2089427069 +2016-02-14 01:19:13 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:19:17 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1754304218 +2016-02-14 01:19:20 INFO SimpleDataJackson:31 - -------Round 39 +2016-02-14 01:19:24 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1100743269 +2016-02-14 01:19:25 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:19:25 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:19:27 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2122292877 +2016-02-14 01:19:27 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:19:32 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1843712339 +2016-02-14 01:19:35 INFO SimpleDataJackson:31 - -------Round 40 +2016-02-14 01:19:38 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1098107940 +2016-02-14 01:19:39 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:19:39 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:19:41 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2207965512 +2016-02-14 01:19:41 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:19:46 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1741791936 +2016-02-14 01:19:48 INFO SimpleDataJackson:31 - -------Round 41 +2016-02-14 01:19:52 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1064537903 +2016-02-14 01:19:53 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:19:53 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:19:55 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2320554730 +2016-02-14 01:19:55 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:20:00 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 2170266821 +2016-02-14 01:20:03 INFO SimpleDataJackson:31 - -------Round 42 +2016-02-14 01:20:07 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1157553613 +2016-02-14 01:20:08 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:20:08 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:20:10 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2269739005 +2016-02-14 01:20:10 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:20:15 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1772026365 +2016-02-14 01:20:18 INFO SimpleDataJackson:31 - -------Round 43 +2016-02-14 01:20:22 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1136483621 +2016-02-14 01:20:22 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:20:22 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:20:24 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2159793800 +2016-02-14 01:20:24 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:20:29 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1784084293 +2016-02-14 01:20:32 INFO SimpleDataJackson:31 - -------Round 44 +2016-02-14 01:20:36 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1173644668 +2016-02-14 01:20:37 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:20:37 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:20:39 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2320150509 +2016-02-14 01:20:39 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:20:44 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1940564196 +2016-02-14 01:20:47 INFO SimpleDataJackson:31 - -------Round 45 +2016-02-14 01:20:51 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1265839699 +2016-02-14 01:20:52 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:20:52 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:20:54 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2558040573 +2016-02-14 01:20:54 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:20:59 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1758794065 +2016-02-14 01:21:02 INFO SimpleDataJackson:31 - -------Round 46 +2016-02-14 01:21:06 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1181087613 +2016-02-14 01:21:06 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:21:06 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:21:09 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2079106420 +2016-02-14 01:21:09 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:21:13 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1790406553 +2016-02-14 01:21:16 INFO SimpleDataJackson:31 - -------Round 47 +2016-02-14 01:21:20 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1106377880 +2016-02-14 01:21:21 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:21:21 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:21:23 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2087174645 +2016-02-14 01:21:23 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:21:27 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1880122182 +2016-02-14 01:21:30 INFO SimpleDataJackson:31 - -------Round 48 +2016-02-14 01:21:34 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1059543570 +2016-02-14 01:21:35 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:21:35 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:21:37 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2060372538 +2016-02-14 01:21:37 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:21:41 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1789722458 +2016-02-14 01:21:44 INFO SimpleDataJackson:31 - -------Round 49 +2016-02-14 01:21:48 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1144693560 +2016-02-14 01:21:49 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:21:49 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:21:51 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2089575493 +2016-02-14 01:21:51 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:21:55 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1759762378 +2016-02-14 01:21:58 INFO SimpleDataJackson:31 - -------Round 50 +2016-02-14 01:22:02 INFO SimpleDataJackson:59 - Json Generation Time(ms):: 1074021689 +2016-02-14 01:22:03 INFO SimpleDataJackson:33 - Size of Simple content Jackson :: 251 MB +2016-02-14 01:22:03 INFO SimpleDataJackson:34 - -------------------------------------------------------------------------- +2016-02-14 01:22:05 INFO SimpleDataJackson:69 - Generating Map from json Time(ms):: 2073524704 +2016-02-14 01:22:05 INFO SimpleDataJackson:70 - -------------------------------------------------------------------------- +2016-02-14 01:22:09 INFO SimpleDataJackson:82 - Generating Actual Object from json Time(ms):: 1845090005 +2016-02-14 01:22:12 INFO SimpleDataJackson:45 - -------------------------------------------------------------------------- +2016-02-14 01:22:12 INFO SimpleDataJackson:46 - Average Time to Generate JSON : 1145446097 +2016-02-14 01:22:12 INFO SimpleDataJackson:47 - Average Time to Parse JSON To Map : 2230626711 +2016-02-14 01:22:12 INFO SimpleDataJackson:48 - Average Time to Parse JSON To Actual Object : 1846720796 +2016-02-14 01:22:12 INFO SimpleDataJackson:49 - -------------------------------------------------------------------------- diff --git a/gson-jackson-performance/pom.xml b/gson-jackson-performance/pom.xml new file mode 100644 index 0000000000..1a65ed54a0 --- /dev/null +++ b/gson-jackson-performance/pom.xml @@ -0,0 +1,72 @@ + + 4.0.0 + + org.baeldung + gson-jackson-performance + 0.0.1-SNAPSHOT + jar + + gson-jackson-performance + http://maven.apache.org + + + UTF-8 + + + + gson-jackson-performance + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + + + + + com.google.code.gson + gson + 2.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.7.1-1 + + + + junit + junit + 3.8.1 + test + + + + log4j + log4j + 1.2.17 + + + + + + + diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGeneration.java b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGeneration.java new file mode 100644 index 0000000000..1596c029b5 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGeneration.java @@ -0,0 +1,63 @@ +package org.baeldung.data.complex; + +import java.util.ArrayList; +import java.util.List; + +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.complex.AddressDetails; +import org.baeldung.pojo.complex.ContactDetails; +import org.baeldung.pojo.complex.CustomerAddressDetails; +import org.baeldung.pojo.complex.CustomerPortfolioComplex; + +/** + * + * This class is responsible for generating data for complex type object + */ + +public class ComplexDataGeneration { + + public static CustomerPortfolioComplex generateData() { + List customerAddressDetailsList = new ArrayList(); + for (int i = 0; i < 600000; i++) { + CustomerAddressDetails customerAddressDetails = new CustomerAddressDetails(); + customerAddressDetails.setAge(20); + customerAddressDetails.setFirstName(Utility.generateRandomName()); + customerAddressDetails.setLastName(Utility.generateRandomName()); + + List addressDetailsList = new ArrayList(); + customerAddressDetails.setAddressDetails(addressDetailsList); + + for (int j = 0; j < 2; j++) { + AddressDetails addressDetails = new AddressDetails(); + addressDetails.setZipcode(Utility.generateRandomZip()); + addressDetails.setAddress(Utility.generateRandomAddress()); + + List contactDetailsList = new ArrayList(); + addressDetails.setContactDetails(contactDetailsList); + + for (int k = 0; k < 2; k++) { + ContactDetails contactDetails = new ContactDetails(); + contactDetails.setLandline(Utility.generateRandomPhone()); + contactDetails.setMobile(Utility.generateRandomPhone()); + contactDetailsList.add(contactDetails); + contactDetails = null; + } + + addressDetailsList.add(addressDetails); + addressDetails = null; + contactDetailsList = null; + } + customerAddressDetailsList.add(customerAddressDetails); + customerAddressDetails = null; + + if (i % 6000 == 0) { + Runtime.getRuntime().gc(); + } + } + + CustomerPortfolioComplex customerPortfolioComplex = new CustomerPortfolioComplex(); + customerPortfolioComplex.setCustomerAddressDetailsList(customerAddressDetailsList); + customerAddressDetailsList = null; + return customerPortfolioComplex; + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGson.java b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGson.java new file mode 100644 index 0000000000..23ce668d17 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataGson.java @@ -0,0 +1,91 @@ +package org.baeldung.data.complex; + +import java.util.Map; + +import org.apache.log4j.Logger; +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.complex.CustomerPortfolioComplex; + +import com.google.gson.Gson; + +/** + * + * This class is responsible for performing functions for Complex type + * GSON like + * Java to Json + * Json to Map + * Json to Java Object + */ + +public class ComplexDataGson { + + private static final Logger logger = Logger.getLogger(ComplexDataGson.class); + + static Gson gson = new Gson(); + + static long generateJsonAvgTime = 0L; + + static long parseJsonToMapAvgTime = 0L; + + static long parseJsonToActualObjectAvgTime = 0L; + + public static void main(String[] args) { + CustomerPortfolioComplex customerPortfolioComplex = ComplexDataGeneration.generateData(); + int j = 50; + for (int i = 0; i < j; i++) { + logger.info("-------Round " + (i + 1)); + String jsonStr = generateJson(customerPortfolioComplex); + logger.info("Size of Complex content Jackson :: " + Utility.bytesIntoMB(jsonStr.getBytes().length)); + logger.info("--------------------------------------------------------------------------"); + parseJsonToMap(jsonStr); + parseJsonToActualObject(jsonStr); + jsonStr = null; + } + + generateJsonAvgTime = generateJsonAvgTime / j; + parseJsonToMapAvgTime = parseJsonToMapAvgTime / j; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime / j; + + logger.info("--------------------------------------------------------------------------"); + logger.info("Average Time to Generate JSON : " + generateJsonAvgTime); + logger.info("Average Time to Parse JSON To Map : " + parseJsonToMapAvgTime); + logger.info("Average Time to Parse JSON To Actual Object : " + parseJsonToActualObjectAvgTime); + logger.info("--------------------------------------------------------------------------"); + } + + private static String generateJson(CustomerPortfolioComplex customerPortfolioComplex) { + Runtime.getRuntime().gc(); + long startParsTime = System.nanoTime(); + String json = gson.toJson(customerPortfolioComplex); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + generateJsonAvgTime = generateJsonAvgTime + elapsedTime; + logger.info("Json Generation Time(ms):: " + elapsedTime); + return json; + } + + private static void parseJsonToMap(String jsonStr) { + long startParsTime = System.nanoTime(); + Map parsedMap = gson.fromJson(jsonStr , Map.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToMapAvgTime = parseJsonToMapAvgTime + elapsedTime; + logger.info("Generating Map from json Time(ms):: " + elapsedTime); + logger.info("--------------------------------------------------------------------------"); + parsedMap = null; + Runtime.getRuntime().gc(); + } + + private static void parseJsonToActualObject(String jsonStr) { + long startParsTime = System.nanoTime(); + CustomerPortfolioComplex customerPortfolioComplex = gson.fromJson(jsonStr , CustomerPortfolioComplex.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime + elapsedTime; + logger.info("Generating Actual Object from json Time(ms):: " + elapsedTime); + logger.info("--------------------------------------------------------------------------"); + customerPortfolioComplex = null; + Runtime.getRuntime().gc(); + + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataJackson.java b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataJackson.java new file mode 100644 index 0000000000..6447060856 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/complex/ComplexDataJackson.java @@ -0,0 +1,95 @@ +package org.baeldung.data.complex; + +import java.io.IOException; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.complex.CustomerPortfolioComplex; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * + * This class is responsible for performing functions for Complex type + * Jackson like + * Java to Json + * Json to Map + * Json to Java Object + */ + +public class ComplexDataJackson { + + private static final Logger logger = Logger.getLogger(ComplexDataJackson.class); + + static ObjectMapper mapper = new ObjectMapper(); + + static long generateJsonAvgTime = 0L; + + static long parseJsonToMapAvgTime = 0L; + + static long parseJsonToActualObjectAvgTime = 0L; + + public static void main(String[] args) throws IOException { + CustomerPortfolioComplex customerPortfolioComplex = ComplexDataGeneration.generateData(); + int j = 50; + for (int i = 0; i < j; i++) { + logger.info("-------Round " + (i + 1)); + String jsonStr = generateJson(customerPortfolioComplex); + logger.info("Size of Complex content Jackson :: " + Utility.bytesIntoMB(jsonStr.getBytes().length)); + logger.info("--------------------------------------------------------------------------"); + parseJsonToMap(jsonStr); + parseJsonToActualObject(jsonStr); + jsonStr = null; + } + + generateJsonAvgTime = generateJsonAvgTime / j; + parseJsonToMapAvgTime = parseJsonToMapAvgTime / j; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime / j; + + logger.info("--------------------------------------------------------------------------"); + logger.info("Average Time to Generate JSON : " + generateJsonAvgTime); + logger.info("Average Time to Parse JSON To Map : " + parseJsonToMapAvgTime); + logger.info("Average Time to Parse JSON To Actual Object : " + parseJsonToActualObjectAvgTime); + logger.info("--------------------------------------------------------------------------"); + } + + private static String generateJson(CustomerPortfolioComplex customerPortfolioComplex) + throws JsonProcessingException { + Runtime.getRuntime().gc(); + long startParsTime = System.nanoTime(); + String json = mapper.writeValueAsString(customerPortfolioComplex); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + generateJsonAvgTime = generateJsonAvgTime + elapsedTime; + logger.info("Json Generation Time(ms):: " + elapsedTime); + return json; + } + + private static void parseJsonToMap(String jsonStr) throws JsonParseException , JsonMappingException , IOException { + long startParsTime = System.nanoTime(); + Map parsedMap = mapper.readValue(jsonStr , Map.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToMapAvgTime = parseJsonToMapAvgTime + elapsedTime; + logger.info("Generating Map from json Time(ms):: " + elapsedTime); + parsedMap = null; + Runtime.getRuntime().gc(); + + } + + private static void parseJsonToActualObject(String jsonStr) throws JsonParseException , JsonMappingException , + IOException { + long startParsTime = System.nanoTime(); + CustomerPortfolioComplex customerPortfolioComplex = mapper.readValue(jsonStr , CustomerPortfolioComplex.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime + elapsedTime; + logger.info("Generating Actual Object from json Time(ms):: " + elapsedTime); + customerPortfolioComplex = null; + Runtime.getRuntime().gc(); + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGeneration.java b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGeneration.java new file mode 100644 index 0000000000..69cf87e7b2 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGeneration.java @@ -0,0 +1,35 @@ +package org.baeldung.data.simple; + +import java.util.ArrayList; +import java.util.List; + +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.simple.Customer; +import org.baeldung.pojo.simple.CustomerPortfolioSimple; + +/** + * + * This class is responsible for generating data for simple type object + */ + +public class SimpleDataGeneration { + + public static CustomerPortfolioSimple generateData() { + List customerList = new ArrayList(); + for (int i = 0; i < 1; i++) { + Customer customer = new Customer(); + customer.setAge(20); + customer.setFirstName(Utility.generateRandomName()); + customer.setLastName(Utility.generateRandomName()); + + customerList.add(customer); + customer = null; + + } + + CustomerPortfolioSimple customerPortfolioSimple = new CustomerPortfolioSimple(); + customerPortfolioSimple.setCustomerLists(customerList); + customerList = null; + return customerPortfolioSimple; + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGson.java b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGson.java new file mode 100644 index 0000000000..b41aab53e7 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataGson.java @@ -0,0 +1,91 @@ +package org.baeldung.data.simple; + +import java.util.Map; + +import org.apache.log4j.Logger; +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.simple.CustomerPortfolioSimple; + +import com.google.gson.Gson; + +/** + * + * This class is responsible for performing functions for Simple type + * GSON like + * Java to Json + * Json to Map + * Json to Java Object + */ + +public class SimpleDataGson { + + private static final Logger logger = Logger.getLogger(SimpleDataGson.class); + + static Gson gson = new Gson(); + + static long generateJsonAvgTime = 0L; + + static long parseJsonToMapAvgTime = 0L; + + static long parseJsonToActualObjectAvgTime = 0L; + + public static void main(String[] args) { + CustomerPortfolioSimple customerPortfolioSimple = SimpleDataGeneration.generateData(); + String jsonStr = null; + int j = 5; + for (int i = 0; i < j; i++) { + logger.info("-------Round " + (i + 1)); + jsonStr = generateJson(customerPortfolioSimple); + logger.info("Size of Simple content Gson :: " + Utility.bytesIntoMB(jsonStr.getBytes().length)); + logger.info("--------------------------------------------------------------------------"); + parseJsonToMap(jsonStr); + parseJsonToActualObject(jsonStr); + jsonStr = null; + } + generateJsonAvgTime = generateJsonAvgTime / j; + parseJsonToMapAvgTime = parseJsonToMapAvgTime / j; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime / j; + + logger.info("--------------------------------------------------------------------------"); + logger.info("Average Time to Generate JSON : " + generateJsonAvgTime); + logger.info("Average Time to Parse JSON To Map : " + parseJsonToMapAvgTime); + logger.info("Average Time to Parse JSON To Actual Object : " + parseJsonToActualObjectAvgTime); + logger.info("--------------------------------------------------------------------------"); + } + + private static String generateJson(CustomerPortfolioSimple customerPortfolioSimple) { + Runtime.getRuntime().gc(); + long startParsTime = System.nanoTime(); + String json = gson.toJson(customerPortfolioSimple); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + generateJsonAvgTime = generateJsonAvgTime + elapsedTime; + logger.info("Json Generation Time(ms):: " + elapsedTime); + return json; + } + + private static void parseJsonToMap(String jsonStr) { + long startParsTime = System.nanoTime(); + Map parsedMap = gson.fromJson(jsonStr , Map.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToMapAvgTime = parseJsonToMapAvgTime + elapsedTime; + logger.info("Generating Map from json Time(ms):: " + elapsedTime); + logger.info("--------------------------------------------------------------------------"); + parsedMap = null; + Runtime.getRuntime().gc(); + + } + + private static void parseJsonToActualObject(String jsonStr) { + long startParsTime = System.nanoTime(); + CustomerPortfolioSimple customerPortfolioSimple = gson.fromJson(jsonStr , CustomerPortfolioSimple.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime + elapsedTime; + logger.info("Generating Actual Object from json Time(ms):: " + elapsedTime); + logger.info("--------------------------------------------------------------------------"); + customerPortfolioSimple = null; + Runtime.getRuntime().gc(); + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataJackson.java b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataJackson.java new file mode 100644 index 0000000000..9280a2a6e9 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/simple/SimpleDataJackson.java @@ -0,0 +1,95 @@ +package org.baeldung.data.simple; + +import java.io.IOException; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.baeldung.data.utility.Utility; +import org.baeldung.pojo.simple.CustomerPortfolioSimple; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * + * This class is responsible for performing functions for Simple type + * GSON like + * Java to Json + * Json to Map + * Json to Java Object + */ + +public class SimpleDataJackson { + + private static final Logger logger = Logger.getLogger(SimpleDataJackson.class); + + static ObjectMapper mapper = new ObjectMapper(); + + static long generateJsonAvgTime = 0L; + + static long parseJsonToMapAvgTime = 0L; + + static long parseJsonToActualObjectAvgTime = 0L; + + public static void main(String[] args) throws IOException { + CustomerPortfolioSimple customerPortfolioSimple = SimpleDataGeneration.generateData(); + int j = 50; + for (int i = 0; i < j; i++) { + logger.info("-------Round " + (i + 1)); + String jsonStr = generateJson(customerPortfolioSimple); + logger.info("Size of Simple content Jackson :: " + Utility.bytesIntoMB(jsonStr.getBytes().length)); + logger.info("--------------------------------------------------------------------------"); + + parseJsonToMap(jsonStr); + parseJsonToActualObject(jsonStr); + jsonStr = null; + } + + generateJsonAvgTime = generateJsonAvgTime / j; + parseJsonToMapAvgTime = parseJsonToMapAvgTime / j; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime / j; + + logger.info("--------------------------------------------------------------------------"); + logger.info("Average Time to Generate JSON : " + generateJsonAvgTime); + logger.info("Average Time to Parse JSON To Map : " + parseJsonToMapAvgTime); + logger.info("Average Time to Parse JSON To Actual Object : " + parseJsonToActualObjectAvgTime); + logger.info("--------------------------------------------------------------------------"); + } + + private static String generateJson(CustomerPortfolioSimple customerPortfolioSimple) throws JsonProcessingException { + Runtime.getRuntime().gc(); + long startParsTime = System.nanoTime(); + String json = mapper.writeValueAsString(customerPortfolioSimple); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + generateJsonAvgTime = generateJsonAvgTime + elapsedTime; + logger.info("Json Generation Time(ms):: " + elapsedTime); + return json; + } + + private static void parseJsonToMap(String jsonStr) throws JsonParseException , JsonMappingException , IOException { + long startParsTime = System.nanoTime(); + Map parsedMap = mapper.readValue(jsonStr , Map.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToMapAvgTime = parseJsonToMapAvgTime + elapsedTime; + logger.info("Generating Map from json Time(ms):: " + elapsedTime); + logger.info("--------------------------------------------------------------------------"); + parsedMap = null; + Runtime.getRuntime().gc(); + } + + private static void parseJsonToActualObject(String jsonStr) throws JsonParseException , JsonMappingException , + IOException { + long startParsTime = System.nanoTime(); + CustomerPortfolioSimple customerPortfolioSimple = mapper.readValue(jsonStr , CustomerPortfolioSimple.class); + long endParsTime = System.nanoTime(); + long elapsedTime = endParsTime - startParsTime; + parseJsonToActualObjectAvgTime = parseJsonToActualObjectAvgTime + elapsedTime; + logger.info("Generating Actual Object from json Time(ms):: " + elapsedTime); + customerPortfolioSimple = null; + Runtime.getRuntime().gc(); + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/data/utility/Utility.java b/gson-jackson-performance/src/main/java/org/baeldung/data/utility/Utility.java new file mode 100644 index 0000000000..852fc56929 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/data/utility/Utility.java @@ -0,0 +1,90 @@ +package org.baeldung.data.utility; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.util.Random; + +public class Utility { + + public static String generateRandomName() { + char[] chars = "abcdefghijklmnopqrstuvwxyz ".toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < 8; i++) { + char c = chars[random.nextInt(chars.length)]; + sb.append(c); + } + return sb.toString(); + } + + public static String generateRandomAddress() { + char[] chars = "abcdefghijklmnopqrstuvwxyz ".toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < 30; i++) { + char c = chars[random.nextInt(chars.length)]; + sb.append(c); + } + return sb.toString(); + } + + public static String generateRandomZip() { + char[] chars = "1234567890".toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < 8; i++) { + char c = chars[random.nextInt(chars.length)]; + sb.append(c); + } + return sb.toString(); + } + + public static String generateRandomPhone() { + char[] chars = "1234567890".toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; i < 10; i++) { + char c = chars[random.nextInt(chars.length)]; + sb.append(c); + } + return sb.toString(); + } + + public static String readFile(String fileName , Class clazz) throws IOException { + String dir = clazz.getResource("/").getFile(); + dir = dir + "/" + fileName; + + BufferedReader br = new BufferedReader(new FileReader(dir)); + try { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append(System.lineSeparator()); + line = br.readLine(); + } + return sb.toString(); + } finally { + br.close(); + } + } + + public static String bytesIntoMB(long bytes) { + long kilobyte = 1024; + long megabyte = kilobyte * 1024; + + if ((bytes >= 0) && (bytes < kilobyte)) { + return bytes + " B"; + + } else if ((bytes >= kilobyte) && (bytes < megabyte)) { + return (bytes / kilobyte) + " KB"; + + } else if ((bytes >= megabyte)) { + return (bytes / megabyte) + " MB"; + } + + return null; + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/AddressDetails.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/AddressDetails.java new file mode 100644 index 0000000000..67908c599a --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/AddressDetails.java @@ -0,0 +1,37 @@ +package org.baeldung.pojo.complex; + +import java.util.List; + +public class AddressDetails { + + private String address; + + private String zipcode; + + private List contactDetails; + + public String getZipcode() { + return zipcode; + } + + public void setZipcode(String zipcode) { + this.zipcode = zipcode; + } + + public List getContactDetails() { + return contactDetails; + } + + public void setContactDetails(List contactDetails) { + this.contactDetails = contactDetails; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/ContactDetails.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/ContactDetails.java new file mode 100644 index 0000000000..fa848c8d84 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/ContactDetails.java @@ -0,0 +1,25 @@ +package org.baeldung.pojo.complex; + +public class ContactDetails { + + private String mobile; + + private String landline; + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getLandline() { + return landline; + } + + public void setLandline(String landline) { + this.landline = landline; + } + +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerAddressDetails.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerAddressDetails.java new file mode 100644 index 0000000000..921b7e126b --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerAddressDetails.java @@ -0,0 +1,18 @@ +package org.baeldung.pojo.complex; + +import java.util.List; + +import org.baeldung.pojo.simple.Customer; + +public class CustomerAddressDetails extends Customer { + + private List addressDetails; + + public List getAddressDetails() { + return addressDetails; + } + + public void setAddressDetails(List addressDetails) { + this.addressDetails = addressDetails; + } +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerPortfolioComplex.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerPortfolioComplex.java new file mode 100644 index 0000000000..407cc49bea --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/complex/CustomerPortfolioComplex.java @@ -0,0 +1,17 @@ +package org.baeldung.pojo.complex; + +import java.util.List; + +public class CustomerPortfolioComplex { + + private List customerAddressDetailsList; + + public List getCustomerAddressDetailsList() { + return customerAddressDetailsList; + } + + public void setCustomerAddressDetailsList(List customerAddressDetailsList) { + this.customerAddressDetailsList = customerAddressDetailsList; + } + +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/Customer.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/Customer.java new file mode 100644 index 0000000000..bb88b55ef3 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/Customer.java @@ -0,0 +1,36 @@ +package org.baeldung.pojo.simple; + + +public class Customer { + + private String firstName; + + private String lastName; + + private int age; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + +} diff --git a/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/CustomerPortfolioSimple.java b/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/CustomerPortfolioSimple.java new file mode 100644 index 0000000000..ccd17e1a56 --- /dev/null +++ b/gson-jackson-performance/src/main/java/org/baeldung/pojo/simple/CustomerPortfolioSimple.java @@ -0,0 +1,16 @@ +package org.baeldung.pojo.simple; + +import java.util.List; + +public class CustomerPortfolioSimple { + + private List customerLists; + + public List getCustomerLists() { + return customerLists; + } + + public void setCustomerLists(List customerLists) { + this.customerLists = customerLists; + } +} diff --git a/gson-jackson-performance/src/main/resources/log4j.properties b/gson-jackson-performance/src/main/resources/log4j.properties new file mode 100644 index 0000000000..371cbc9048 --- /dev/null +++ b/gson-jackson-performance/src/main/resources/log4j.properties @@ -0,0 +1,16 @@ +# Root logger option +log4j.rootLogger=DEBUG, file + +# Redirect log messages to console +# log4j.appender.stdout=org.apache.log4j.ConsoleAppender +# log4j.appender.stdout.Target=System.out +# log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +# log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +# Redirect log messages to a log file, support file rolling. +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=log4j-application.log +log4j.appender.file.MaxFileSize=5MB +log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file From 90d7b0236b928daa11787d543a33878946e60d2f Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Wed, 17 Feb 2016 23:37:16 +0100 Subject: [PATCH 0158/1106] Folder renamed e client code reverted --- {RestEasy Example => resteasy}/pom.xml | 0 .../baeldung/client/ServicesInterface.java | 0 .../main/java/com/baeldung/model/Movie.java | 0 .../com/baeldung/server/MovieCrudService.java | 0 .../com/baeldung/server/RestEasyServices.java | 0 .../main/webapp/WEB-INF/classes/logback.xml | 0 .../WEB-INF/jboss-deployment-structure.xml | 0 .../src/main/webapp/WEB-INF/jboss-web.xml | 0 .../src/main/webapp/WEB-INF/web.xml | 0 .../baeldung/server/RestEasyClientTest.java | 144 ++++++++++++++++++ .../com/baeldung/server/movies/batman.json | 4 + .../baeldung/server/movies/transformer.json | 4 + 12 files changed, 152 insertions(+) rename {RestEasy Example => resteasy}/pom.xml (100%) rename {RestEasy Example => resteasy}/src/main/java/com/baeldung/client/ServicesInterface.java (100%) rename {RestEasy Example => resteasy}/src/main/java/com/baeldung/model/Movie.java (100%) rename {RestEasy Example => resteasy}/src/main/java/com/baeldung/server/MovieCrudService.java (100%) rename {RestEasy Example => resteasy}/src/main/java/com/baeldung/server/RestEasyServices.java (100%) rename {RestEasy Example => resteasy}/src/main/webapp/WEB-INF/classes/logback.xml (100%) rename {RestEasy Example => resteasy}/src/main/webapp/WEB-INF/jboss-deployment-structure.xml (100%) rename {RestEasy Example => resteasy}/src/main/webapp/WEB-INF/jboss-web.xml (100%) rename {RestEasy Example => resteasy}/src/main/webapp/WEB-INF/web.xml (100%) create mode 100644 resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java create mode 100644 resteasy/src/test/resources/com/baeldung/server/movies/batman.json create mode 100644 resteasy/src/test/resources/com/baeldung/server/movies/transformer.json diff --git a/RestEasy Example/pom.xml b/resteasy/pom.xml similarity index 100% rename from RestEasy Example/pom.xml rename to resteasy/pom.xml diff --git a/RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java b/resteasy/src/main/java/com/baeldung/client/ServicesInterface.java similarity index 100% rename from RestEasy Example/src/main/java/com/baeldung/client/ServicesInterface.java rename to resteasy/src/main/java/com/baeldung/client/ServicesInterface.java diff --git a/RestEasy Example/src/main/java/com/baeldung/model/Movie.java b/resteasy/src/main/java/com/baeldung/model/Movie.java similarity index 100% rename from RestEasy Example/src/main/java/com/baeldung/model/Movie.java rename to resteasy/src/main/java/com/baeldung/model/Movie.java diff --git a/RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java b/resteasy/src/main/java/com/baeldung/server/MovieCrudService.java similarity index 100% rename from RestEasy Example/src/main/java/com/baeldung/server/MovieCrudService.java rename to resteasy/src/main/java/com/baeldung/server/MovieCrudService.java diff --git a/RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java b/resteasy/src/main/java/com/baeldung/server/RestEasyServices.java similarity index 100% rename from RestEasy Example/src/main/java/com/baeldung/server/RestEasyServices.java rename to resteasy/src/main/java/com/baeldung/server/RestEasyServices.java diff --git a/RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml b/resteasy/src/main/webapp/WEB-INF/classes/logback.xml similarity index 100% rename from RestEasy Example/src/main/webapp/WEB-INF/classes/logback.xml rename to resteasy/src/main/webapp/WEB-INF/classes/logback.xml diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/resteasy/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from RestEasy Example/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to resteasy/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml b/resteasy/src/main/webapp/WEB-INF/jboss-web.xml similarity index 100% rename from RestEasy Example/src/main/webapp/WEB-INF/jboss-web.xml rename to resteasy/src/main/webapp/WEB-INF/jboss-web.xml diff --git a/RestEasy Example/src/main/webapp/WEB-INF/web.xml b/resteasy/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from RestEasy Example/src/main/webapp/WEB-INF/web.xml rename to resteasy/src/main/webapp/WEB-INF/web.xml diff --git a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java new file mode 100644 index 0000000000..2a13465ebc --- /dev/null +++ b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -0,0 +1,144 @@ +package com.baeldung.server; + +import com.baeldung.client.ServicesInterface; +import com.baeldung.model.Movie; +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.client.jaxrs.ResteasyClient; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.junit.Before; +import org.junit.Test; +import javax.naming.NamingException; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.List; +import java.util.Locale; + +public class RestEasyClientTest { + + Movie transformerMovie = null; + Movie batmanMovie = null; + ObjectMapper jsonMapper = null; + + @Before + public void setup() throws ClassNotFoundException, IllegalAccessException, InstantiationException, NamingException { + + jsonMapper = new ObjectMapper().configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); + jsonMapper.configure(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); + SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); + jsonMapper.setDateFormat(sdf); + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/transformer.json")) { + String transformerMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + transformerMovie = jsonMapper.readValue(transformerMovieAsString, Movie.class); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Test is going to die ...", e); + } + + try (InputStream inputStream = new RestEasyClientTest().getClass().getResourceAsStream("./movies/batman.json")) { + String batmanMovieAsString = String.format(IOUtils.toString(inputStream, StandardCharsets.UTF_8)); + batmanMovie = jsonMapper.readValue(batmanMovieAsString, Movie.class); + + } catch (Exception e) { + throw new RuntimeException("Test is going to die ...", e); + } + } + + @Test + public void testListAllMovies() { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + + List movies = simple.listMovies(); + System.out.println(movies); + } + + @Test + public void testMovieByImdbId() { + + String transformerImdbId = "tt0418279"; + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(transformerMovie); + moviesResponse.close(); + + Movie movies = simple.movieByImdbId(transformerImdbId); + System.out.println(movies); + } + + @Test + public void testAddMovie() { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.addMovie(transformerMovie); + + if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + } + + @Test + public void testDeleteMovi1e() { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println(moviesResponse.readEntity(String.class)); + throw new RuntimeException("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + } + + @Test + public void testUpdateMovie() { + + ResteasyClient client = new ResteasyClientBuilder().build(); + ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response moviesResponse = simple.addMovie(batmanMovie); + moviesResponse.close(); + batmanMovie.setTitle("Batman Begins"); + moviesResponse = simple.updateMovie(batmanMovie); + + if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { + System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); + } + + moviesResponse.close(); + System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + } + +} \ No newline at end of file diff --git a/resteasy/src/test/resources/com/baeldung/server/movies/batman.json b/resteasy/src/test/resources/com/baeldung/server/movies/batman.json new file mode 100644 index 0000000000..82aaaa8f40 --- /dev/null +++ b/resteasy/src/test/resources/com/baeldung/server/movies/batman.json @@ -0,0 +1,4 @@ +{ + "title": "Batman", + "imdbId": "tt0096895" +} \ No newline at end of file diff --git a/resteasy/src/test/resources/com/baeldung/server/movies/transformer.json b/resteasy/src/test/resources/com/baeldung/server/movies/transformer.json new file mode 100644 index 0000000000..634cefc73c --- /dev/null +++ b/resteasy/src/test/resources/com/baeldung/server/movies/transformer.json @@ -0,0 +1,4 @@ +{ + "title": "Transformers", + "imdbId": "tt0418279" +} \ No newline at end of file From 6d9aee71bbbd62fe285f99f32e7bf8cb5a735638 Mon Sep 17 00:00:00 2001 From: Alex V Date: Thu, 18 Feb 2016 01:33:05 +0200 Subject: [PATCH 0159/1106] ExecutorService tutorial --- .../java8/Java8ExecutorServiceTest.java | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java new file mode 100644 index 0000000000..1609ae98a4 --- /dev/null +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java @@ -0,0 +1,155 @@ +package com.baeldung.java8; + + +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.*; +import static org.junit.Assert.*; + + +public class Java8ExecutorServiceTest { + + private Runnable runnableTask; + private Callable callableTask; + private List> callableTasks; + + @Before + public void init() { + + runnableTask = () -> { + try { + TimeUnit.MILLISECONDS.sleep(300); + } catch (InterruptedException e) { + e.printStackTrace(); + } + }; + + callableTask = () -> { + TimeUnit.MILLISECONDS.sleep(300); + return "Task's execution"; + }; + + callableTasks = new ArrayList<>(); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + callableTasks.add(callableTask); + } + + @Test + public void creationSubmittingTaskShuttingDown_whenShutDown_thenCorrect() { + + ExecutorService executorService = Executors.newFixedThreadPool(10); + executorService.submit(runnableTask); + executorService.submit(callableTask); + executorService.shutdown(); + + assertTrue(executorService.isShutdown()); + } + + @Test + public void creationSubmittingTasksShuttingDownNow_whenShutDownAfterAwating_thenCorrect() { + + ExecutorService threadPoolExecutor = + new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>()); + + for (int i = 0; i < 100; i++) { + threadPoolExecutor.submit(callableTask); + } + + List notExecutedTasks = smartShutdown(threadPoolExecutor); + + assertTrue(threadPoolExecutor.isShutdown()); + assertFalse(notExecutedTasks.isEmpty()); + assertTrue(notExecutedTasks.size() > 0 && notExecutedTasks.size() < 98); + } + + private List smartShutdown(ExecutorService executorService) { + + List notExecutedTasks = new ArrayList<>(); + executorService.shutdown(); + try { + if (!executorService.awaitTermination(800, TimeUnit.MILLISECONDS)) { + notExecutedTasks = executorService.shutdownNow(); + } + } catch (InterruptedException e) { + notExecutedTasks = executorService.shutdownNow(); + } + return notExecutedTasks; + } + + @Test + public void submittingTasks_whenExecutedOneAndAll_thenCorrect() { + + ExecutorService executorService = Executors.newFixedThreadPool(10); + + String result = null; + List> futures = new ArrayList<>(); + try { + result = executorService.invokeAny(callableTasks); + futures = executorService.invokeAll(callableTasks); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + + assertEquals("Task's execution", result); + assertTrue(futures.size() == 3); + } + + @Test + public void submittingTaskShuttingDown_whenGetExpectedResult_thenCorrect() { + + ExecutorService executorService = Executors.newFixedThreadPool(10); + + Future future = executorService.submit(callableTask); + String result = null; + try { + result = future.get(); + result = future.get(200, TimeUnit.MILLISECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e) { + e.printStackTrace(); + } + + executorService.shutdown(); + + assertEquals("Task's execution", result); + } + + @Test + public void submittingTask_whenCanceled_thenCorrect() { + + ExecutorService executorService = Executors.newFixedThreadPool(10); + + Future future = executorService.submit(callableTask); + + boolean canceled = future.cancel(true); + boolean isCancelled = future.isCancelled(); + + executorService.shutdown(); + + assertTrue(canceled); + assertTrue(isCancelled); + } + + @Test + public void submittingTaskScheduling_whenExecuted_thenCorrect() { + + ScheduledExecutorService executorService = Executors + .newSingleThreadScheduledExecutor(); + + Future resultFuture = executorService.schedule(callableTask, 1, TimeUnit.SECONDS); + String result = null; + try { + result = resultFuture.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + + executorService.shutdown(); + + assertEquals("Task's execution", result); + } +} From e58f0b0e43182616c1d3b1124778b1f6dfea8cdf Mon Sep 17 00:00:00 2001 From: David Morley Date: Thu, 18 Feb 2016 07:21:46 -0600 Subject: [PATCH 0160/1106] Refactor package name to conform to standard --- json-path/pom.xml | 2 +- .../baeldung/jsonpath/introduction/ChangingPasswordTest.java | 2 +- .../baeldung/jsonpath/introduction/LoggingInTest.java | 2 +- .../baeldung/jsonpath/introduction/OperationTest.java | 2 +- .../baeldung/jsonpath/introduction/RegisteringAccountTest.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename json-path/src/test/java/{org => com}/baeldung/jsonpath/introduction/ChangingPasswordTest.java (98%) rename json-path/src/test/java/{org => com}/baeldung/jsonpath/introduction/LoggingInTest.java (97%) rename json-path/src/test/java/{org => com}/baeldung/jsonpath/introduction/OperationTest.java (98%) rename json-path/src/test/java/{org => com}/baeldung/jsonpath/introduction/RegisteringAccountTest.java (97%) diff --git a/json-path/pom.xml b/json-path/pom.xml index b51f59c411..ca37447a50 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -1,7 +1,7 @@ 4.0.0 - org.baeldung + com.baeldung json-path 0.0.1-SNAPSHOT json-path diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ChangingPasswordTest.java similarity index 98% rename from json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java rename to json-path/src/test/java/com/baeldung/jsonpath/introduction/ChangingPasswordTest.java index 24f8500d3d..9f616e1a32 100644 --- a/json-path/src/test/java/org/baeldung/jsonpath/introduction/ChangingPasswordTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ChangingPasswordTest.java @@ -1,4 +1,4 @@ -package org.baeldung.jsonpath.introduction; +package com.baeldung.jsonpath.introduction; import static org.junit.Assert.*; diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/LoggingInTest.java similarity index 97% rename from json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java rename to json-path/src/test/java/com/baeldung/jsonpath/introduction/LoggingInTest.java index 1ab7dad88e..9f0be349c9 100644 --- a/json-path/src/test/java/org/baeldung/jsonpath/introduction/LoggingInTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/LoggingInTest.java @@ -1,4 +1,4 @@ -package org.baeldung.jsonpath.introduction; +package com.baeldung.jsonpath.introduction; import static org.junit.Assert.*; diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationTest.java similarity index 98% rename from json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java rename to json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationTest.java index 9347a7f754..d90fafb7cb 100644 --- a/json-path/src/test/java/org/baeldung/jsonpath/introduction/OperationTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.jsonpath.introduction; +package com.baeldung.jsonpath.introduction; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; diff --git a/json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/RegisteringAccountTest.java similarity index 97% rename from json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java rename to json-path/src/test/java/com/baeldung/jsonpath/introduction/RegisteringAccountTest.java index 6e5cba63b0..04bb04528a 100644 --- a/json-path/src/test/java/org/baeldung/jsonpath/introduction/RegisteringAccountTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/RegisteringAccountTest.java @@ -1,4 +1,4 @@ -package org.baeldung.jsonpath.introduction; +package com.baeldung.jsonpath.introduction; import static org.junit.Assert.*; From 54b0d4c0498a8e09405f3b3f23f9163c3fd2c3dd Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Thu, 18 Feb 2016 18:08:58 +0100 Subject: [PATCH 0161/1106] CleanUp --- .../src/main/java/com/baeldung/client/ServicesInterface.java | 2 +- .../src/test/java/com/baeldung/server/RestEasyClientTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resteasy/src/main/java/com/baeldung/client/ServicesInterface.java b/resteasy/src/main/java/com/baeldung/client/ServicesInterface.java index 3d03c16faf..19ad0c1ec3 100644 --- a/resteasy/src/main/java/com/baeldung/client/ServicesInterface.java +++ b/resteasy/src/main/java/com/baeldung/client/ServicesInterface.java @@ -31,6 +31,6 @@ public interface ServicesInterface { @DELETE @Path("/deletemovie") - Response deleteMovie(@QueryParam("imdbId") String imdbID); + Response deleteMovie(@QueryParam("imdbId") String imdbId); } diff --git a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java index 2a13465ebc..680affe042 100644 --- a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -102,7 +102,7 @@ public class RestEasyClientTest { } @Test - public void testDeleteMovi1e() { + public void testDeleteMovie() { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); From 66eb5d7270fc9d7eac0a13a0a76c6612bea2d713 Mon Sep 17 00:00:00 2001 From: sameira Date: Thu, 18 Feb 2016 22:48:42 +0530 Subject: [PATCH 0162/1106] Added publish subscribe example using redis --- spring-data-redis/pom.xml | 124 +++++++++--------- .../spring/data/redis/config/RedisConfig.java | 31 ++++- .../data/redis/queue/MessagePublisher.java | 7 + .../redis/queue/RedisMessagePublisher.java | 28 ++++ .../redis/queue/RedisMessageSubscriber.java | 19 +++ .../data/redis/repo/StudentRepository.java | 4 +- .../data/redis/RedisMessageListenerTest.java | 51 +++++++ 7 files changed, 198 insertions(+), 66 deletions(-) create mode 100644 spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java create mode 100644 spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java create mode 100644 spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessageSubscriber.java create mode 100644 spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java diff --git a/spring-data-redis/pom.xml b/spring-data-redis/pom.xml index 98da69934c..3f9eb705f4 100644 --- a/spring-data-redis/pom.xml +++ b/spring-data-redis/pom.xml @@ -1,76 +1,76 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.baeldung - sprint-data-redis - 0.0.1-SNAPSHOT - jar + org.baeldung + sprint-data-redis + 0.0.1-SNAPSHOT + jar - - UTF-8 - 4.2.2.RELEASE - 1.6.2.RELEASE - 0.8.0 - + + UTF-8 + 4.2.2.RELEASE + 1.6.2.RELEASE + 0.8.0 + - - - org.springframework.data - spring-data-redis - ${spring-data-redis} - + + + org.springframework.data + spring-data-redis + ${spring-data-redis} + - - cglib - cglib-nodep - 2.2 - + + cglib + cglib-nodep + 2.2 + - - log4j - log4j - 1.2.16 - + + log4j + log4j + 1.2.16 + - - redis.clients - jedis - 2.5.1 - jar - + + redis.clients + jedis + 2.5.1 + jar + - - org.springframework - spring-core - ${spring.version} - + + org.springframework + spring-core + ${spring.version} + - - org.springframework - spring-context - ${spring.version} - + + org.springframework + spring-context + ${spring.version} + - - junit - junit - 4.12 - test - + + junit + junit + 4.12 + test + - - org.springframework - spring-test - ${spring.version} - test - + + org.springframework + spring-test + ${spring.version} + test + - - com.lordofthejars - nosqlunit-redis - ${nosqlunit.version} - + + com.lordofthejars + nosqlunit-redis + ${nosqlunit.version} + - + diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/config/RedisConfig.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/config/RedisConfig.java index a7e75a438a..0b64afe56c 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/config/RedisConfig.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/config/RedisConfig.java @@ -1,10 +1,16 @@ package org.baeldung.spring.data.redis.config; +import org.baeldung.spring.data.redis.queue.RedisMessageSubscriber; +import org.baeldung.spring.data.redis.queue.RedisMessagePublisher; +import org.baeldung.spring.data.redis.queue.MessagePublisher; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.data.redis.listener.RedisMessageListenerContainer; +import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; @Configuration @ComponentScan("org.baeldung.spring.data.redis") @@ -17,8 +23,31 @@ public class RedisConfig { @Bean public RedisTemplate redisTemplate() { - final RedisTemplate< String, Object> template = new RedisTemplate(); + final RedisTemplate template = new RedisTemplate(); template.setConnectionFactory(jedisConnectionFactory()); return template; } + + @Bean + MessageListenerAdapter messageListener() { + return new MessageListenerAdapter(new RedisMessageSubscriber()); + } + + @Bean + RedisMessageListenerContainer redisContainer() { + final RedisMessageListenerContainer container = new RedisMessageListenerContainer(); + container.setConnectionFactory(jedisConnectionFactory()); + container.addMessageListener(messageListener(), topic()); + return container; + } + + @Bean + MessagePublisher redisPublisher() { + return new RedisMessagePublisher(redisTemplate(), topic()); + } + + @Bean + ChannelTopic topic() { + return new ChannelTopic("pubsub:queue"); + } } diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java new file mode 100644 index 0000000000..a05f524f60 --- /dev/null +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java @@ -0,0 +1,7 @@ +package org.baeldung.spring.data.redis.queue; + + +public interface MessagePublisher { + + void publish(String message); +} diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java new file mode 100644 index 0000000000..4eb7f69cdb --- /dev/null +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java @@ -0,0 +1,28 @@ +package org.baeldung.spring.data.redis.queue; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.listener.ChannelTopic; +import org.springframework.stereotype.Service; + +@Service +public class RedisMessagePublisher implements MessagePublisher { + + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private ChannelTopic topic; + + public RedisMessagePublisher() { + } + + public RedisMessagePublisher(RedisTemplate redisTemplate, + ChannelTopic topic) { + this.redisTemplate = redisTemplate; + this.topic = topic; + } + + public void publish(String message) { + redisTemplate.convertAndSend(topic.getTopic(), message); + } +} diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessageSubscriber.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessageSubscriber.java new file mode 100644 index 0000000000..4bc60849fb --- /dev/null +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessageSubscriber.java @@ -0,0 +1,19 @@ +package org.baeldung.spring.data.redis.queue; + +import org.springframework.data.redis.connection.Message; +import org.springframework.data.redis.connection.MessageListener; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class RedisMessageSubscriber implements MessageListener { + + public static List messageList = new ArrayList(); + + public void onMessage(final Message message, final byte[] pattern) { + messageList.add(message.toString()); + System.out.println("Message received: " + message.toString()); + } +} \ No newline at end of file diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java index 9e5502f8e0..2a1f6afcce 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/repo/StudentRepository.java @@ -1,15 +1,13 @@ package org.baeldung.spring.data.redis.repo; import org.baeldung.spring.data.redis.model.Student; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Component; import java.util.Map; public interface StudentRepository { void saveStudent(Student person); - + void updateStudent(Student student); Student findStudent(String id); diff --git a/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java new file mode 100644 index 0000000000..7308424a90 --- /dev/null +++ b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java @@ -0,0 +1,51 @@ +package org.baeldung.spring.data.redis; + +import org.baeldung.spring.data.redis.config.RedisConfig; +import org.baeldung.spring.data.redis.queue.RedisMessageSubscriber; +import org.baeldung.spring.data.redis.queue.RedisMessagePublisher; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.util.UUID; + +import static org.junit.Assert.assertTrue; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = RedisConfig.class) +public class RedisMessageListenerTest { + + + @Autowired + private RedisMessagePublisher redisMessagePublisher; + + @Test + public void testOnMessage() throws Exception { + String message = "Message " + UUID.randomUUID(); + redisMessagePublisher.publish(message); + Thread.sleep(100); + assertTrue(RedisMessageSubscriber.messageList.get(0).contains(message)); + } + + public void testOnPMessage() throws Exception { + + } + + public void testOnSubscribe() throws Exception { + + } + + public void testOnUnsubscribe() throws Exception { + + } + + public void testOnPUnsubscribe() throws Exception { + + } + + public void testOnPSubscribe() throws Exception { + + } +} \ No newline at end of file From a304aa9860f60268bdbf33f2ff8fa428fd642f2f Mon Sep 17 00:00:00 2001 From: sameira Date: Thu, 18 Feb 2016 22:49:50 +0530 Subject: [PATCH 0163/1106] Refined the test case --- .../data/redis/RedisMessageListenerTest.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java index 7308424a90..19612e0029 100644 --- a/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java +++ b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java @@ -28,24 +28,4 @@ public class RedisMessageListenerTest { Thread.sleep(100); assertTrue(RedisMessageSubscriber.messageList.get(0).contains(message)); } - - public void testOnPMessage() throws Exception { - - } - - public void testOnSubscribe() throws Exception { - - } - - public void testOnUnsubscribe() throws Exception { - - } - - public void testOnPUnsubscribe() throws Exception { - - } - - public void testOnPSubscribe() throws Exception { - - } } \ No newline at end of file From 2ccdd4ecbb16184a03ed095df8a020748b3a325b Mon Sep 17 00:00:00 2001 From: sameira Date: Thu, 18 Feb 2016 22:51:35 +0530 Subject: [PATCH 0164/1106] Refined the test case --- .../baeldung/spring/data/redis/queue/MessagePublisher.java | 2 +- .../spring/data/redis/queue/RedisMessagePublisher.java | 6 +++--- .../spring/data/redis/RedisMessageListenerTest.java | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java index a05f524f60..e1f2e3d4b2 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/MessagePublisher.java @@ -3,5 +3,5 @@ package org.baeldung.spring.data.redis.queue; public interface MessagePublisher { - void publish(String message); + void publish(final String message); } diff --git a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java index 4eb7f69cdb..58e789daab 100644 --- a/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java +++ b/spring-data-redis/src/main/java/org/baeldung/spring/data/redis/queue/RedisMessagePublisher.java @@ -16,13 +16,13 @@ public class RedisMessagePublisher implements MessagePublisher { public RedisMessagePublisher() { } - public RedisMessagePublisher(RedisTemplate redisTemplate, - ChannelTopic topic) { + public RedisMessagePublisher(final RedisTemplate redisTemplate, + final ChannelTopic topic) { this.redisTemplate = redisTemplate; this.topic = topic; } - public void publish(String message) { + public void publish(final String message) { redisTemplate.convertAndSend(topic.getTopic(), message); } } diff --git a/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java index 19612e0029..f355e7f63a 100644 --- a/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java +++ b/spring-data-redis/src/test/java/org/baeldung/spring/data/redis/RedisMessageListenerTest.java @@ -17,7 +17,6 @@ import static org.junit.Assert.assertTrue; @ContextConfiguration(classes = RedisConfig.class) public class RedisMessageListenerTest { - @Autowired private RedisMessagePublisher redisMessagePublisher; From 54a1235d175827af25d7089f644549365fbb9ff9 Mon Sep 17 00:00:00 2001 From: David Morley Date: Thu, 18 Feb 2016 21:31:51 -0600 Subject: [PATCH 0165/1106] Clean up Apache Camel example --- spring-apache-camel/README.md | 4 +- .../baeldung}/camel/main/App.java | 22 +- .../camel/processor/FileProcessor.java | 14 ++ .../apache/camel/processor/FileProcessor.java | 14 -- .../src/main/resources/camel-context.xml | 49 +++-- .../src/test/data/sampleInputFile/file.txt | 2 +- .../java/org/apache/camel/main/AppTest.java | 190 +++++++++--------- 7 files changed, 147 insertions(+), 148 deletions(-) rename spring-apache-camel/src/main/java/{org/apache => com/baeldung}/camel/main/App.java (62%) create mode 100644 spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java delete mode 100644 spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md index 28b95bdf89..f6ae77b2a5 100644 --- a/spring-apache-camel/README.md +++ b/spring-apache-camel/README.md @@ -23,6 +23,6 @@ To build this application execute following maven command in ApacheCamelFileProc mvn clean install -To run this application you can either run our main class org.apache.camel.main.App from your IDE or you can execute following maven command: +To run this application you can either run our main class App from your IDE or you can execute following maven command: -mvn exec:java -Dexec.mainClass="org.apache.camel.main.App" \ No newline at end of file +mvn exec:java -Dexec.mainClass="App" \ No newline at end of file diff --git a/spring-apache-camel/src/main/java/org/apache/camel/main/App.java b/spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java similarity index 62% rename from spring-apache-camel/src/main/java/org/apache/camel/main/App.java rename to spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java index 8674caefca..ac0605a215 100644 --- a/spring-apache-camel/src/main/java/org/apache/camel/main/App.java +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/main/App.java @@ -1,12 +1,12 @@ -package org.apache.camel.main; - -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class App { - public static void main(final String[] args) throws Exception { - ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context.xml"); - // Keep main thread alive for some time to let application finish processing the input files. - Thread.sleep(5000); - applicationContext.close(); - } +package com.baeldung.camel.main; + +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class App { + public static void main(final String[] args) throws Exception { + ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("camel-context.xml"); + // Keep main thread alive for some time to let application finish processing the input files. + Thread.sleep(5000); + applicationContext.close(); + } } \ No newline at end of file diff --git a/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java b/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java new file mode 100644 index 0000000000..971dd206cd --- /dev/null +++ b/spring-apache-camel/src/main/java/com/baeldung/camel/processor/FileProcessor.java @@ -0,0 +1,14 @@ +package com.baeldung.camel.processor; + +import org.apache.camel.Exchange; +import org.apache.camel.Processor; + +public class FileProcessor implements Processor { + + public void process(Exchange exchange) throws Exception { + String originalFileContent = exchange.getIn().getBody(String.class); + String upperCaseFileContent = originalFileContent.toUpperCase(); + exchange.getIn().setBody(upperCaseFileContent); + } + +} diff --git a/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java b/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java deleted file mode 100644 index a98c77feb8..0000000000 --- a/spring-apache-camel/src/main/java/org/apache/camel/processor/FileProcessor.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.apache.camel.processor; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; - -public class FileProcessor implements Processor { - - public void process(Exchange exchange) throws Exception { - String originalFileContent = exchange.getIn().getBody(String.class); - String upperCaseFileContent = originalFileContent.toUpperCase(); - exchange.getIn().setBody(upperCaseFileContent); - } - -} diff --git a/spring-apache-camel/src/main/resources/camel-context.xml b/spring-apache-camel/src/main/resources/camel-context.xml index 75e2a61711..0c10e0ecef 100644 --- a/spring-apache-camel/src/main/resources/camel-context.xml +++ b/spring-apache-camel/src/main/resources/camel-context.xml @@ -1,40 +1,39 @@ - + - + - - + + - - + + - - + + - - - ${body.toLowerCase()} - + + + ${body.toLowerCase()} + - - + + - - - .......... File content conversion completed .......... - - - + + + .......... File content conversion completed .......... + + - + - + - + \ No newline at end of file diff --git a/spring-apache-camel/src/test/data/sampleInputFile/file.txt b/spring-apache-camel/src/test/data/sampleInputFile/file.txt index c1df3791c9..e057427864 100644 --- a/spring-apache-camel/src/test/data/sampleInputFile/file.txt +++ b/spring-apache-camel/src/test/data/sampleInputFile/file.txt @@ -1 +1 @@ -THIS IS UPPERCASE CONTENT. this is lowercase content. \ No newline at end of file +This is data that will be processed by a Camel route! \ No newline at end of file diff --git a/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java b/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java index 75a161d8cc..87b20369f3 100644 --- a/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java +++ b/spring-apache-camel/src/test/java/org/apache/camel/main/AppTest.java @@ -1,5 +1,12 @@ package org.apache.camel.main; +import com.baeldung.camel.main.App; +import junit.framework.TestCase; +import org.apache.camel.util.FileUtil; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -8,110 +15,103 @@ import java.nio.channels.FileChannel; import java.nio.file.Files; import java.nio.file.Paths; -import junit.framework.TestCase; - -import org.apache.camel.util.FileUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - public class AppTest extends TestCase { - private static final String FILE_NAME = "file.txt"; - private static final String SAMPLE_INPUT_DIR = "src/test/data/sampleInputFile/"; - private static final String TEST_INPUT_DIR = "src/test/data/input/"; - private static final String UPPERCARE_OUTPUT_DIR = "src/test/data/outputUpperCase/"; - private static final String LOWERCASE_OUTPUT_DIR = "src/test/data/outputLowerCase/"; + private static final String FILE_NAME = "file.txt"; + private static final String SAMPLE_INPUT_DIR = "src/test/data/sampleInputFile/"; + private static final String TEST_INPUT_DIR = "src/test/data/input/"; + private static final String UPPERCASE_OUTPUT_DIR = "src/test/data/outputUpperCase/"; + private static final String LOWERCASE_OUTPUT_DIR = "src/test/data/outputLowerCase/"; - @Before - public void setUp() throws Exception { - // Prepare input file for test - copySampleFileToInputDirectory(); - } + @Before + public void setUp() throws Exception { + // Prepare input file for test + copySampleFileToInputDirectory(); + } - @After - public void tearDown() throws Exception { - System.out.println("Deleting the test input and output files..."); - deleteFile(TEST_INPUT_DIR); - deleteFile(LOWERCASE_OUTPUT_DIR); - deleteFile(UPPERCARE_OUTPUT_DIR); - } + @After + public void tearDown() throws Exception { + System.out.println("Deleting the test input and output files..."); + deleteFile(TEST_INPUT_DIR); + deleteFile(LOWERCASE_OUTPUT_DIR); + deleteFile(UPPERCASE_OUTPUT_DIR); + } - @Test - public final void testMain() throws Exception { - App.main(null); + @Test + public final void testMain() throws Exception { + App.main(null); - String inputFileContent = readFileContent(SAMPLE_INPUT_DIR+FILE_NAME); - String outputUpperCase = readFileContent(UPPERCARE_OUTPUT_DIR+FILE_NAME); - String outputLowerCase = readFileContent(LOWERCASE_OUTPUT_DIR+FILE_NAME); - - System.out.println("Input File content = ["+inputFileContent+"]"); - System.out.println("UpperCaseOutput file content = ["+outputUpperCase+"]"); - System.out.println("LowerCaseOtput file content = ["+outputLowerCase+"]"); - - assertEquals(inputFileContent.toUpperCase(), outputUpperCase); - assertEquals(inputFileContent.toLowerCase(), outputLowerCase); - } + String inputFileContent = readFileContent(SAMPLE_INPUT_DIR + FILE_NAME); + String outputUpperCase = readFileContent(UPPERCASE_OUTPUT_DIR + FILE_NAME); + String outputLowerCase = readFileContent(LOWERCASE_OUTPUT_DIR + FILE_NAME); - private String readFileContent(String path) throws IOException { - byte[] encoded = Files.readAllBytes(Paths.get(path)); - return new String(encoded); - } + System.out.println("Input File content = [" + inputFileContent + "]"); + System.out.println("UpperCaseOutput file content = [" + outputUpperCase + "]"); + System.out.println("LowerCaseOtput file content = [" + outputLowerCase + "]"); - private void deleteFile(String path) { - try { - FileUtil.removeDir(new File(path)); - } catch (Exception e) { - e.printStackTrace(); - } - } + assertEquals(inputFileContent.toUpperCase(), outputUpperCase); + assertEquals(inputFileContent.toLowerCase(), outputLowerCase); + } - /** - * Copy sample input file to input directory. - */ - private void copySampleFileToInputDirectory() { - File sourceFile = new File(SAMPLE_INPUT_DIR + FILE_NAME); - File destFile = new File(TEST_INPUT_DIR + FILE_NAME); - - if (!sourceFile.exists()) { - System.out.println("Sample input file not found at location = [" + SAMPLE_INPUT_DIR + FILE_NAME + "]. Please provide this file."); - } + private String readFileContent(String path) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded); + } - if (!destFile.exists()) { - try { - System.out.println("Creating input file = [" + TEST_INPUT_DIR + FILE_NAME + "]"); - - File destDir = new File(TEST_INPUT_DIR); - if(!destDir.exists()) { - destDir.mkdir(); - } - destFile.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - } - FileChannel source = null; - FileChannel destination = null; + private void deleteFile(String path) { + try { + FileUtil.removeDir(new File(path)); + } catch (Exception e) { + e.printStackTrace(); + } + } - try { - source = new FileInputStream(sourceFile).getChannel(); - destination = new FileOutputStream(destFile).getChannel(); - if (destination != null && source != null) { - destination.transferFrom(source, 0, source.size()); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - source.close(); - } catch (Exception e) { - e.printStackTrace(); - } - try { - destination.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } + /** + * Copy sample input file to input directory. + */ + private void copySampleFileToInputDirectory() { + File sourceFile = new File(SAMPLE_INPUT_DIR + FILE_NAME); + File destFile = new File(TEST_INPUT_DIR + FILE_NAME); + + if (!sourceFile.exists()) { + System.out.println("Sample input file not found at location = [" + SAMPLE_INPUT_DIR + FILE_NAME + "]. Please provide this file."); + } + + if (!destFile.exists()) { + try { + System.out.println("Creating input file = [" + TEST_INPUT_DIR + FILE_NAME + "]"); + + File destDir = new File(TEST_INPUT_DIR); + if (!destDir.exists()) { + destDir.mkdir(); + } + destFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + FileChannel source = null; + FileChannel destination = null; + + try { + source = new FileInputStream(sourceFile).getChannel(); + destination = new FileOutputStream(destFile).getChannel(); + if (destination != null && source != null) { + destination.transferFrom(source, 0, source.size()); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + source.close(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + destination.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } } From 2f1270d047690d6a58b5a2073bea24c062db0427 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Fri, 19 Feb 2016 19:50:19 +0100 Subject: [PATCH 0166/1106] HttpClient with Connection Pool --- .../baeldung/server/RestEasyClientTest.java | 51 ++++++++++++++++--- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java index 680affe042..9a292bf3c3 100644 --- a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -3,11 +3,15 @@ package com.baeldung.server; import com.baeldung.client.ServicesInterface; import com.baeldung.model.Movie; import org.apache.commons.io.IOUtils; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.codehaus.jackson.map.DeserializationConfig; import org.codehaus.jackson.map.ObjectMapper; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; +import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; import org.junit.Before; import org.junit.Test; import javax.naming.NamingException; @@ -21,6 +25,7 @@ import java.util.Locale; public class RestEasyClientTest { + public static final UriBuilder FULL_PATH = UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest"); Movie transformerMovie = null; Movie batmanMovie = null; ObjectMapper jsonMapper = null; @@ -54,7 +59,7 @@ public class RestEasyClientTest { public void testListAllMovies() { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ResteasyWebTarget target = client.target(FULL_PATH); ServicesInterface simple = target.proxy(ServicesInterface.class); Response moviesResponse = simple.addMovie(transformerMovie); @@ -72,7 +77,7 @@ public class RestEasyClientTest { String transformerImdbId = "tt0418279"; ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ResteasyWebTarget target = client.target(FULL_PATH); ServicesInterface simple = target.proxy(ServicesInterface.class); Response moviesResponse = simple.addMovie(transformerMovie); @@ -86,7 +91,7 @@ public class RestEasyClientTest { public void testAddMovie() { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ResteasyWebTarget target = client.target(FULL_PATH); ServicesInterface simple = target.proxy(ServicesInterface.class); Response moviesResponse = simple.addMovie(batmanMovie); @@ -98,14 +103,44 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + moviesResponse.getStatus()); + } + + @Test + public void testAddMovieMultiConnection() { + + PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); + CloseableHttpClient httpClient = HttpClients.custom() + .setConnectionManager(cm) + .build(); + ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); + ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build(); + ResteasyWebTarget target = client.target(FULL_PATH); + ServicesInterface simple = target.proxy(ServicesInterface.class); + + Response batmanResponse = simple.addMovie(batmanMovie); + Response transformerResponse = simple.addMovie(transformerMovie); + + if (batmanResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Batman Movie creation Failed : HTTP error code : " + batmanResponse.getStatus()); + } + if (batmanResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { + System.out.println("Batman Movie creation Failed : HTTP error code : " + batmanResponse.getStatus()); + } + + batmanResponse.close(); + transformerResponse.close(); + cm.close(); + + + } @Test public void testDeleteMovie() { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ResteasyWebTarget target = client.target(FULL_PATH); ServicesInterface simple = target.proxy(ServicesInterface.class); Response moviesResponse = simple.addMovie(batmanMovie); @@ -118,14 +153,14 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + moviesResponse.getStatus()); } @Test public void testUpdateMovie() { ResteasyClient client = new ResteasyClientBuilder().build(); - ResteasyWebTarget target = client.target(UriBuilder.fromPath("http://127.0.0.1:8080/RestEasyTutorial/rest")); + ResteasyWebTarget target = client.target(FULL_PATH); ServicesInterface simple = target.proxy(ServicesInterface.class); Response moviesResponse = simple.addMovie(batmanMovie); @@ -138,7 +173,7 @@ public class RestEasyClientTest { } moviesResponse.close(); - System.out.println("Response Code: " + Response.Status.OK.getStatusCode()); + System.out.println("Response Code: " + moviesResponse.getStatus()); } } \ No newline at end of file From e00f62fb033e312e4a63bb17a971984583c32d42 Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Fri, 19 Feb 2016 20:04:06 +0100 Subject: [PATCH 0167/1106] cleanUp --- .../baeldung/server/RestEasyClientTest.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java index 9a292bf3c3..ef18b0f23f 100644 --- a/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java +++ b/resteasy/src/test/java/com/baeldung/server/RestEasyClientTest.java @@ -60,14 +60,14 @@ public class RestEasyClientTest { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = proxy.addMovie(transformerMovie); moviesResponse.close(); - moviesResponse = simple.addMovie(batmanMovie); + moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); - List movies = simple.listMovies(); + List movies = proxy.listMovies(); System.out.println(movies); } @@ -78,12 +78,12 @@ public class RestEasyClientTest { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(transformerMovie); + Response moviesResponse = proxy.addMovie(transformerMovie); moviesResponse.close(); - Movie movies = simple.movieByImdbId(transformerImdbId); + Movie movies = proxy.movieByImdbId(transformerImdbId); System.out.println(movies); } @@ -92,11 +92,11 @@ public class RestEasyClientTest { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); + Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); - moviesResponse = simple.addMovie(transformerMovie); + moviesResponse = proxy.addMovie(transformerMovie); if (moviesResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); @@ -116,10 +116,10 @@ public class RestEasyClientTest { ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response batmanResponse = simple.addMovie(batmanMovie); - Response transformerResponse = simple.addMovie(transformerMovie); + Response batmanResponse = proxy.addMovie(batmanMovie); + Response transformerResponse = proxy.addMovie(transformerMovie); if (batmanResponse.getStatus() != Response.Status.CREATED.getStatusCode()) { System.out.println("Batman Movie creation Failed : HTTP error code : " + batmanResponse.getStatus()); @@ -141,11 +141,11 @@ public class RestEasyClientTest { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); + Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); - moviesResponse = simple.deleteMovie(batmanMovie.getImdbId()); + moviesResponse = proxy.deleteMovie(batmanMovie.getImdbId()); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { System.out.println(moviesResponse.readEntity(String.class)); @@ -161,12 +161,12 @@ public class RestEasyClientTest { ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target(FULL_PATH); - ServicesInterface simple = target.proxy(ServicesInterface.class); + ServicesInterface proxy = target.proxy(ServicesInterface.class); - Response moviesResponse = simple.addMovie(batmanMovie); + Response moviesResponse = proxy.addMovie(batmanMovie); moviesResponse.close(); batmanMovie.setTitle("Batman Begins"); - moviesResponse = simple.updateMovie(batmanMovie); + moviesResponse = proxy.updateMovie(batmanMovie); if (moviesResponse.getStatus() != Response.Status.OK.getStatusCode()) { System.out.println("Failed : HTTP error code : " + moviesResponse.getStatus()); From 95bc7e515d37107a12b9d3e6b1f792bd15889ecb Mon Sep 17 00:00:00 2001 From: DOHA Date: Fri, 19 Feb 2016 22:12:57 +0200 Subject: [PATCH 0168/1106] oauth multiple resources authorization --- .../config/OAuth2ResourceServerConfig.java | 26 +++++++--- .../web/controller/BarController.java | 41 +++++++++++++++ .../web/controller/FooController.java | 16 +++++- .../main/java/org/baeldung/web/dto/Bar.java | 36 +++++++++++++ .../OAuth2AuthorizationServerConfig.java | 6 +-- .../baeldung/config/ServerSecurityConfig.java | 3 +- .../.project | 10 ++-- .../src/main/resources/templates/header.html | 50 +++++++++++++++++-- .../src/main/resources/templates/index.html | 40 ++++++++++++--- 9 files changed, 200 insertions(+), 28 deletions(-) create mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java create mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Bar.java diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java index c5e33739ae..52bfeb4233 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java @@ -7,12 +7,13 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; +import org.springframework.http.HttpMethod; import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; -import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; -import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; +import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; @@ -20,14 +21,25 @@ import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; @PropertySource({ "classpath:persistence.properties" }) @EnableResourceServer @EnableGlobalMethodSecurity(prePostEnabled = true) -public class OAuth2ResourceServerConfig extends GlobalMethodSecurityConfiguration { - +public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter { @Autowired private Environment env; @Override - protected MethodSecurityExpressionHandler createExpressionHandler() { - return new OAuth2MethodSecurityExpressionHandler(); + public void configure(HttpSecurity http) throws Exception { + // @formatter:off + http + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) + .and() + .requestMatchers().antMatchers("/foos/**","/bars/**") + .and() + .authorizeRequests() + .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('read')") + .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('write')") + .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") + .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") + ; + // @formatter:on } @Bean diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java new file mode 100644 index 0000000000..a716635f6d --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java @@ -0,0 +1,41 @@ +package org.baeldung.web.controller; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; + +import org.baeldung.web.dto.Bar; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@Controller +public class BarController { + + public BarController() { + super(); + } + + // API - read + // @PreAuthorize("#oauth2.hasScope('read')") + @RequestMapping(method = RequestMethod.GET, value = "/bars/{id}") + @ResponseBody + public Bar findById(@PathVariable final long id) { + return new Bar(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); + } + + // API - write + // @PreAuthorize("#oauth2.hasScope('write')") + @RequestMapping(method = RequestMethod.POST, value = "/bars") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public Bar create(@RequestBody final Bar bar) { + bar.setId(Long.parseLong(randomNumeric(2))); + return bar; + } + +} diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java index 8dfa19bd84..a1275670f0 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java @@ -4,12 +4,14 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; import org.baeldung.web.dto.Foo; -import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; @Controller public class FooController { @@ -19,11 +21,21 @@ public class FooController { } // API - read - @PreAuthorize("#oauth2.hasScope('read')") + // @PreAuthorize("#oauth2.hasScope('read')") @RequestMapping(method = RequestMethod.GET, value = "/foos/{id}") @ResponseBody public Foo findById(@PathVariable final long id) { return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); } + // API - write + // @PreAuthorize("#oauth2.hasScope('write')") + @RequestMapping(method = RequestMethod.POST, value = "/foos") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public Foo create(@RequestBody final Foo foo) { + foo.setId(Long.parseLong(randomNumeric(2))); + return foo; + } + } diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Bar.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Bar.java new file mode 100644 index 0000000000..adbb2aa2ad --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Bar.java @@ -0,0 +1,36 @@ +package org.baeldung.web.dto; + +public class Bar { + private long id; + private String name; + + public Bar() { + super(); + } + + public Bar(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java index c2f6ca41ae..a0f8baa4bc 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java @@ -47,10 +47,10 @@ public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigur public void configure(ClientDetailsServiceConfigurer clients) throws Exception { // @formatter:off clients.jdbc(dataSource()) - .withClient("clientId") + .withClient("sampleClientId") .authorizedGrantTypes("implicit") - .scopes("read") - .autoApprove(true) + .scopes("read","write") + .autoApprove(false) .and() .withClient("clientIdPassword") .secret("secret") diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java index 3e1a8a8ccb..46870f3fc3 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java @@ -12,8 +12,7 @@ public class ServerSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().withUser("john").password("123").roles("USER"); - + auth.inMemoryAuthentication().withUser("john").password("123").roles("USER").and().withUser("tom").password("111").roles("ADMIN"); } @Override diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/.project b/spring-security-oauth/spring-security-oauth-ui-implicit/.project index c9fc2aa8f0..b96a26c60d 100644 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/.project +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/.project @@ -25,11 +25,6 @@ - - org.eclipse.m2e.core.maven2Builder - - - org.springframework.ide.eclipse.core.springbuilder @@ -40,6 +35,11 @@ + + org.eclipse.m2e.core.maven2Builder + + + org.eclipse.jem.workbench.JavaEMFNature diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html index a62bce9747..8cd7be67c3 100644 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html @@ -11,9 +11,9 @@ @@ -34,9 +34,21 @@ app.config(function($locationProvider) { }).hashPrefix('!'); }); +app.config(['$httpProvider', function ($httpProvider) { + $httpProvider.interceptors.push(function ($q,$rootScope) { + return { + 'responseError': function (responseError) { + $rootScope.message = responseError.statusText; + console.log("error here"); + console.log(responseError); + return $q.reject(responseError); + } + }; + }); +}]); -app.controller('mainCtrl', function($scope,$resource,$http) { +app.controller('mainCtrl', function($scope,$resource,$http,$rootScope) { $scope.$on('oauth:login', function(event, token) { $http.defaults.headers.common.Authorization= 'Bearer ' + token.access_token; @@ -49,6 +61,38 @@ app.controller('mainCtrl', function($scope,$resource,$http) { $scope.getFoo = function(){ $scope.foo = $scope.foos.get({fooId:$scope.foo.id}); } + + $scope.createFoo = function(){ + if($scope.foo.name.length==0) + { + $rootScope.message = "Foo name can not be empty"; + return; + } + $scope.foo.id = null; + $scope.foo = $scope.foos.save($scope.foo, function(){ + $rootScope.message = "Foo Created Successfully"; + }); + } + + // bar + $scope.bar = {id:0 , name:"sample bar"}; + $scope.bars = $resource("http://localhost:8081/spring-security-oauth-resource/bars/:barId",{barId:'@id'}); + + $scope.getBar = function(){ + $scope.bar = $scope.bars.get({barId:$scope.bar.id}); + } + + $scope.createBar = function(){ + if($scope.bar.name.length==0) + { + $rootScope.message = "Bar name can not be empty"; + return; + } + $scope.bar.id = null; + $scope.bar = $scope.bars.save($scope.bar, function(){ + $rootScope.message = "Bar Created Successfully"; + }); + } }); /*]]>*/ diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html index c98ed493bd..c50781caf1 100755 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html @@ -10,19 +10,47 @@
-

Foo Details

+
{{message}}
+

Foo Details

+
- - {{foo.id}} + +
- -{{foo.name}} + +
+
+ +
+
+
+
+
+

Bar Details

+
+
+ + +
+ +
+ + +
+ + +
From f8258e92210dbd61dae5aeb010360dff577c77f7 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sun, 21 Feb 2016 12:58:42 +0200 Subject: [PATCH 0169/1106] oauth2 live test --- .../baeldung/config/MethodSecurityConfig.java | 16 ++++++ .../config/OAuth2ResourceServerConfig.java | 2 - .../web/controller/BarController.java | 4 +- .../OAuth2AuthorizationServerConfig.java | 2 +- .../spring-security-oauth-ui-password/pom.xml | 40 +++++++++++++ .../baeldung/live/AuthorizationLiveTest.java | 57 +++++++++++++++++++ 6 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/MethodSecurityConfig.java create mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/MethodSecurityConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/MethodSecurityConfig.java new file mode 100644 index 0000000000..c0a7f86207 --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/MethodSecurityConfig.java @@ -0,0 +1,16 @@ +package org.baeldung.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; +import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; + +@Configuration +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration { + @Override + protected MethodSecurityExpressionHandler createExpressionHandler() { + return new OAuth2MethodSecurityExpressionHandler(); + } +} \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java index 52bfeb4233..c2db6748f1 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java @@ -9,7 +9,6 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.http.HttpMethod; import org.springframework.jdbc.datasource.DriverManagerDataSource; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; @@ -20,7 +19,6 @@ import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; @Configuration @PropertySource({ "classpath:persistence.properties" }) @EnableResourceServer -@EnableGlobalMethodSecurity(prePostEnabled = true) public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter { @Autowired private Environment env; diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java index a716635f6d..1f42f9dafd 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java @@ -21,7 +21,7 @@ public class BarController { } // API - read - // @PreAuthorize("#oauth2.hasScope('read')") + // @PreAuthorize("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") @RequestMapping(method = RequestMethod.GET, value = "/bars/{id}") @ResponseBody public Bar findById(@PathVariable final long id) { @@ -29,7 +29,7 @@ public class BarController { } // API - write - // @PreAuthorize("#oauth2.hasScope('write')") + // @PreAuthorize("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") @RequestMapping(method = RequestMethod.POST, value = "/bars") @ResponseStatus(HttpStatus.CREATED) @ResponseBody diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java index a0f8baa4bc..caae7760d3 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java @@ -55,7 +55,7 @@ public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigur .withClient("clientIdPassword") .secret("secret") .authorizedGrantTypes("password","authorization_code", "refresh_token") - .scopes("read"); + .scopes("read","write"); // @formatter:on } diff --git a/spring-security-oauth/spring-security-oauth-ui-password/pom.xml b/spring-security-oauth/spring-security-oauth-ui-password/pom.xml index a2bf3d07bb..4a42081f78 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/pom.xml +++ b/spring-security-oauth/spring-security-oauth-ui-password/pom.xml @@ -22,8 +22,48 @@ org.springframework.boot spring-boot-starter-thymeleaf + + + + + + org.springframework + spring-test + test + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + com.jayway.restassured + rest-assured + ${rest-assured.version} + test + + + commons-logging + commons-logging + + + + spring-security-oauth-ui-password diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java new file mode 100644 index 0000000000..456245daff --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java @@ -0,0 +1,57 @@ +package org.baeldung.live; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import com.jayway.restassured.RestAssured; +import com.jayway.restassured.response.Response; + +public class AuthorizationLiveTest { + + private String obtainAccessToken(String username, String password) { + final Map params = new HashMap(); + params.put("grant_type", "password"); + params.put("client_id", "clientIdPassword"); + params.put("username", username); + params.put("password", password); + final Response response = RestAssured.given().auth().preemptive().basic("clientIdPassword", "secret").and().with().params(params).when().post("http://localhost:8081/spring-security-oauth-server/oauth/token"); + return response.jsonPath().getString("access_token"); + } + + @Test + public void givenUser_whenAccessFoosResource_thenOk() { + final String accessToken = obtainAccessToken("john", "123"); + final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.jsonPath().get("name")); + } + + @Test + public void givenUser_whenAccessBarssResource_thenUnauthorized() { + final String accessToken = obtainAccessToken("john", "123"); + final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(403, response.getStatusCode()); + } + + @Test + public void givenAdmin_whenAccessFoosResource_thenOk() { + final String accessToken = obtainAccessToken("tom", "111"); + final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.jsonPath().get("name")); + } + + @Test + public void givenAdmin_whenAccessBarssResource_thenOk() { + final String accessToken = obtainAccessToken("tom", "111"); + final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.jsonPath().get("name")); + } + +} From 04f794a255506f6f2ef0018f6957cbee15889eae Mon Sep 17 00:00:00 2001 From: joetaras Date: Sun, 21 Feb 2016 20:03:37 +0100 Subject: [PATCH 0170/1106] zip and unzip --- .../java/com/baeldung/unzip/UnzipFile.java | 31 +++++++++++++++++++ .../main/java/com/baeldung/zip/ZipFile.java | 29 +++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java create mode 100644 core-java-8/src/main/java/com/baeldung/zip/ZipFile.java diff --git a/core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java b/core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java new file mode 100644 index 0000000000..d0b4274731 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java @@ -0,0 +1,31 @@ +package com.baeldung.unzip; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +public class UnzipFile { + public static void main(String[] args) throws FileNotFoundException, IOException { + String fileZip = "/opt/zipped/cities.zip"; + byte[] buffer = new byte[1024]; + ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip)); + ZipEntry zipEntry = zis.getNextEntry(); + while(zipEntry != null){ + String fileName = zipEntry.getName(); + File newFile = new File("/opt/unzipped/" + fileName); + FileOutputStream fos = new FileOutputStream(newFile); + int len; + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len); + } + fos.close(); + zipEntry = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + } +} \ No newline at end of file diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipFile.java b/core-java-8/src/main/java/com/baeldung/zip/ZipFile.java new file mode 100644 index 0000000000..dccd3f2347 --- /dev/null +++ b/core-java-8/src/main/java/com/baeldung/zip/ZipFile.java @@ -0,0 +1,29 @@ +package com.baeldung.zip; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipFile { + public static void main(String[] args) throws FileNotFoundException, IOException { + String sourceFile = "/opt/photos/photo.png"; + FileOutputStream fos = new FileOutputStream("/opt/zipped/cities.zip"); + ZipOutputStream zipOut = new ZipOutputStream(fos); + File fileToZip = new File(sourceFile); + FileInputStream fis = new FileInputStream(fileToZip); + ZipEntry zipEntry = new ZipEntry(fileToZip.getName()); + zipOut.putNextEntry(zipEntry); + byte[] bytes = new byte[1024]; + int length; + while((length = fis.read(bytes)) >= 0) { + zipOut.write(bytes, 0, length); + } + zipOut.close(); + fis.close(); + fos.close(); + } +} \ No newline at end of file From 87392e16b6dfbe2a16a4733a42e1611c7a0c5172 Mon Sep 17 00:00:00 2001 From: DOHA Date: Tue, 23 Feb 2016 21:44:57 +0200 Subject: [PATCH 0171/1106] modify oauth scopes --- .../config/OAuth2ResourceServerConfig.java | 12 +-- .../web/controller/BarController.java | 4 +- .../web/controller/BazController.java | 41 ++++++++++ .../web/controller/FooController.java | 4 +- .../main/java/org/baeldung/web/dto/Baz.java | 36 +++++++++ .../OAuth2AuthorizationServerConfig.java | 12 ++- .../src/main/resources/templates/header.html | 22 +++++- .../src/main/resources/templates/index.html | 25 ++++++- .../src/main/resources/templates/header.html | 4 +- .../baeldung/live/AuthorizationLiveTest.java | 75 +++++++++++++------ 10 files changed, 197 insertions(+), 38 deletions(-) create mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java create mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java index c2db6748f1..8fe4cda6a1 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java @@ -29,13 +29,15 @@ public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter http .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) .and() - .requestMatchers().antMatchers("/foos/**","/bars/**") + .requestMatchers().antMatchers("/foos/**","/bars/**","/bazes/**") .and() .authorizeRequests() - .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('read')") - .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('write')") - .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") - .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") + .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('read')") + .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('write')") + .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('read')") + .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('write')") + .antMatchers(HttpMethod.GET,"/bazes/**").access("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") + .antMatchers(HttpMethod.POST,"/bazes/**").access("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") ; // @formatter:on } diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java index 1f42f9dafd..938cf18129 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java @@ -21,7 +21,7 @@ public class BarController { } // API - read - // @PreAuthorize("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") + // @PreAuthorize("#oauth2.hasScope('bar') and #oauth2.hasScope('read')") @RequestMapping(method = RequestMethod.GET, value = "/bars/{id}") @ResponseBody public Bar findById(@PathVariable final long id) { @@ -29,7 +29,7 @@ public class BarController { } // API - write - // @PreAuthorize("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") + // @PreAuthorize("#oauth2.hasScope('bar') and #oauth2.hasScope('write')") @RequestMapping(method = RequestMethod.POST, value = "/bars") @ResponseStatus(HttpStatus.CREATED) @ResponseBody diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java new file mode 100644 index 0000000000..880f41de07 --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java @@ -0,0 +1,41 @@ +package org.baeldung.web.controller; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; + +import org.baeldung.web.dto.Baz; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; + +@Controller +public class BazController { + + public BazController() { + super(); + } + + // API - read + // @PreAuthorize("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") + @RequestMapping(method = RequestMethod.GET, value = "/bazes/{id}") + @ResponseBody + public Baz findById(@PathVariable final long id) { + return new Baz(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); + } + + // API - write + // @PreAuthorize("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") + @RequestMapping(method = RequestMethod.POST, value = "/bazes") + @ResponseStatus(HttpStatus.CREATED) + @ResponseBody + public Baz create(@RequestBody final Baz baz) { + baz.setId(Long.parseLong(randomNumeric(2))); + return baz; + } + +} diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java index a1275670f0..d9ef1baa31 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/FooController.java @@ -21,7 +21,7 @@ public class FooController { } // API - read - // @PreAuthorize("#oauth2.hasScope('read')") + // @PreAuthorize("#oauth2.hasScope('foo') and #oauth2.hasScope('read')") @RequestMapping(method = RequestMethod.GET, value = "/foos/{id}") @ResponseBody public Foo findById(@PathVariable final long id) { @@ -29,7 +29,7 @@ public class FooController { } // API - write - // @PreAuthorize("#oauth2.hasScope('write')") + // @PreAuthorize("#oauth2.hasScope('foo') and #oauth2.hasScope('write')") @RequestMapping(method = RequestMethod.POST, value = "/foos") @ResponseStatus(HttpStatus.CREATED) @ResponseBody diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java new file mode 100644 index 0000000000..69a6bf2e6a --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java @@ -0,0 +1,36 @@ +package org.baeldung.web.dto; + +public class Baz { + private long id; + private String name; + + public Baz() { + super(); + } + + public Baz(final long id, final String name) { + super(); + + this.id = id; + this.name = name; + } + + // + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + +} \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java index caae7760d3..c7c90d177a 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/OAuth2AuthorizationServerConfig.java @@ -49,13 +49,19 @@ public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigur clients.jdbc(dataSource()) .withClient("sampleClientId") .authorizedGrantTypes("implicit") - .scopes("read","write") + .scopes("read","write","foo","bar") .autoApprove(false) .and() - .withClient("clientIdPassword") + .withClient("fooClientIdPassword") .secret("secret") .authorizedGrantTypes("password","authorization_code", "refresh_token") - .scopes("read","write"); + .scopes("foo","read","write") + .and() + .withClient("barClientIdPassword") + .secret("secret") + .authorizedGrantTypes("password","authorization_code", "refresh_token") + .scopes("bar","read","write") + ; // @formatter:on } diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html index 8cd7be67c3..d3cf521c0a 100644 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html @@ -13,7 +13,7 @@ site="http://localhost:8081/spring-security-oauth-server" client-id="sampleClientId" redirect-uri="http://localhost:8081/spring-security-oauth-ui-implicit/" - scope="read write" + scope="read write foo bar" template="oauthTemp"> @@ -94,6 +94,26 @@ app.controller('mainCtrl', function($scope,$resource,$http,$rootScope) { }); } + // baz + $scope.baz = {id:0 , name:"sample baz"}; + $scope.bazes = $resource("http://localhost:8081/spring-security-oauth-resource/bazes/:bazId",{bazId:'@id'}); + + $scope.getBaz = function(){ + $scope.baz = $scope.bazes.get({bazId:$scope.baz.id}); + } + + $scope.createBaz = function(){ + if($scope.baz.name.length==0) + { + $rootScope.message = "Baz name can not be empty"; + return; + } + $scope.baz.id = null; + $scope.baz = $scope.bazes.save($scope.baz, function(){ + $rootScope.message = "Baz Created Successfully"; + }); + } + }); /*]]>*/ diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html index c50781caf1..0b4c7563ce 100755 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html @@ -50,8 +50,31 @@ Get Bar Create Bar - +
+
+
+
+
+

Baz Details

+
+
+ + +
+ +
+ + +
+ + +
+ + \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html index 0bfe086bf1..cafba4eb65 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html @@ -28,8 +28,8 @@ app.controller('mainCtrl', function($scope,$resource,$http,$httpParamSerializer, $scope.foo = $scope.foos.get({fooId:$scope.foo.id}); } - $scope.data = {grant_type:"password", username: "", password: "", client_id: "clientIdPassword"}; - $scope.encoded = btoa("clientIdPassword:secret"); + $scope.data = {grant_type:"password", username: "", password: "", client_id: "fooClientIdPassword"}; + $scope.encoded = btoa("fooClientIdPassword:secret"); var isLoginPage = window.location.href.indexOf("login") != -1; if(isLoginPage){ diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java index 456245daff..5827be548b 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java @@ -13,45 +13,76 @@ import com.jayway.restassured.response.Response; public class AuthorizationLiveTest { - private String obtainAccessToken(String username, String password) { + private String obtainAccessToken(String clientId, String username, String password) { final Map params = new HashMap(); params.put("grant_type", "password"); - params.put("client_id", "clientIdPassword"); + params.put("client_id", clientId); params.put("username", username); params.put("password", password); - final Response response = RestAssured.given().auth().preemptive().basic("clientIdPassword", "secret").and().with().params(params).when().post("http://localhost:8081/spring-security-oauth-server/oauth/token"); + final Response response = RestAssured.given().auth().preemptive().basic(clientId, "secret").and().with().params(params).when().post("http://localhost:8081/spring-security-oauth-server/oauth/token"); return response.jsonPath().getString("access_token"); } @Test - public void givenUser_whenAccessFoosResource_thenOk() { - final String accessToken = obtainAccessToken("john", "123"); - final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.jsonPath().get("name")); + public void givenUser_whenUseFooClient_thenOkForFooResourceOnly() { + final String accessToken = obtainAccessToken("fooClientIdPassword", "john", "123"); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(200, fooResponse.getStatusCode()); + assertNotNull(fooResponse.jsonPath().get("name")); + + final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(403, barResponse.getStatusCode()); + + final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); + assertEquals(403, bazResponse.getStatusCode()); } @Test - public void givenUser_whenAccessBarssResource_thenUnauthorized() { - final String accessToken = obtainAccessToken("john", "123"); - final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); - assertEquals(403, response.getStatusCode()); + public void givenUser_whenUseBarClient_thenOkForBarResourceOnly() { + final String accessToken = obtainAccessToken("barClientIdPassword", "john", "123"); + + final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(200, barResponse.getStatusCode()); + assertNotNull(barResponse.jsonPath().get("name")); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(403, fooResponse.getStatusCode()); + + final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); + assertEquals(403, bazResponse.getStatusCode()); } @Test - public void givenAdmin_whenAccessFoosResource_thenOk() { - final String accessToken = obtainAccessToken("tom", "111"); - final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.jsonPath().get("name")); + public void givenAdmin_whenUseFooClient_thenOkForFooAndBazResourceOnly() { + final String accessToken = obtainAccessToken("fooClientIdPassword", "tom", "111"); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(200, fooResponse.getStatusCode()); + assertNotNull(fooResponse.jsonPath().get("name")); + + final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); + assertEquals(200, bazResponse.getStatusCode()); + assertNotNull(bazResponse.jsonPath().get("name")); + + final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(403, barResponse.getStatusCode()); } @Test - public void givenAdmin_whenAccessBarssResource_thenOk() { - final String accessToken = obtainAccessToken("tom", "111"); - final Response response = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.jsonPath().get("name")); + public void givenAdmin_whenUseBarClient_thenOkForBarAndBazResourceOnly() { + final String accessToken = obtainAccessToken("barClientIdPassword", "tom", "111"); + + final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(200, barResponse.getStatusCode()); + assertNotNull(barResponse.jsonPath().get("name")); + + final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); + assertEquals(200, bazResponse.getStatusCode()); + assertNotNull(bazResponse.jsonPath().get("name")); + + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(403, fooResponse.getStatusCode()); } } From 595c1c2b1128de279db5f0ebd2ac5713e225139b Mon Sep 17 00:00:00 2001 From: eugenp Date: Wed, 24 Feb 2016 00:06:52 +0200 Subject: [PATCH 0172/1106] minor cleanup --- .../baeldung/config/ResourceServerWebConfig.java | 2 +- .../spring-security-oauth-server/.springBeans | 16 ++++++++++++++++ ....java => AuthorizationServerApplication.java} | 4 ++-- ...ecurityConfig.java => WebSecurityConfig.java} | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 spring-security-oauth/spring-security-oauth-server/.springBeans rename spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/{ServerApplication.java => AuthorizationServerApplication.java} (65%) rename spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/{ServerSecurityConfig.java => WebSecurityConfig.java} (94%) diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java index c040c8ac42..81b2d242ac 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/ResourceServerWebConfig.java @@ -9,5 +9,5 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @EnableWebMvc @ComponentScan({ "org.baeldung.web.controller" }) public class ResourceServerWebConfig extends WebMvcConfigurerAdapter { - + // } diff --git a/spring-security-oauth/spring-security-oauth-server/.springBeans b/spring-security-oauth/spring-security-oauth-server/.springBeans new file mode 100644 index 0000000000..18656ebe2e --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-server/.springBeans @@ -0,0 +1,16 @@ + + + 1 + + + + + + + java:org.baeldung.config.AuthorizationServerApplication + + + + + + diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerApplication.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java similarity index 65% rename from spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerApplication.java rename to spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java index 4b1ff2c7ad..73b8fc1976 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerApplication.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java @@ -5,10 +5,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.web.SpringBootServletInitializer; @SpringBootApplication -public class ServerApplication extends SpringBootServletInitializer { +public class AuthorizationServerApplication extends SpringBootServletInitializer { public static void main(String[] args) { - SpringApplication.run(ServerApplication.class, args); + SpringApplication.run(AuthorizationServerApplication.class, args); } } \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/WebSecurityConfig.java similarity index 94% rename from spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java rename to spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/WebSecurityConfig.java index 46870f3fc3..f8218a0c03 100644 --- a/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/ServerSecurityConfig.java +++ b/spring-security-oauth/spring-security-oauth-server/src/main/java/org/baeldung/config/WebSecurityConfig.java @@ -8,7 +8,7 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration -public class ServerSecurityConfig extends WebSecurityConfigurerAdapter { +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(final AuthenticationManagerBuilder auth) throws Exception { From 11461268feeb62bf76064ec60e681d826c0a0c14 Mon Sep 17 00:00:00 2001 From: DOHA Date: Wed, 24 Feb 2016 01:10:50 +0200 Subject: [PATCH 0173/1106] remove oauth extra resource --- .../config/OAuth2ResourceServerConfig.java | 6 +-- .../web/controller/BarController.java | 2 +- .../web/controller/BazController.java | 41 ---------------- .../main/java/org/baeldung/web/dto/Baz.java | 36 -------------- .../src/main/resources/templates/header.html | 19 -------- .../src/main/resources/templates/index.html | 22 --------- .../baeldung/live/AuthorizationLiveTest.java | 48 ++++++------------- 7 files changed, 18 insertions(+), 156 deletions(-) delete mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java delete mode 100644 spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java index 8fe4cda6a1..7809278ad8 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/config/OAuth2ResourceServerConfig.java @@ -29,15 +29,13 @@ public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter http .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED) .and() - .requestMatchers().antMatchers("/foos/**","/bars/**","/bazes/**") + .requestMatchers().antMatchers("/foos/**","/bars/**") .and() .authorizeRequests() .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('read')") .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('write')") .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('read')") - .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('write')") - .antMatchers(HttpMethod.GET,"/bazes/**").access("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") - .antMatchers(HttpMethod.POST,"/bazes/**").access("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") + .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") ; // @formatter:on } diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java index 938cf18129..72163ff9ff 100644 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java +++ b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BarController.java @@ -29,7 +29,7 @@ public class BarController { } // API - write - // @PreAuthorize("#oauth2.hasScope('bar') and #oauth2.hasScope('write')") + // @PreAuthorize("#oauth2.hasScope('bar') and #oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") @RequestMapping(method = RequestMethod.POST, value = "/bars") @ResponseStatus(HttpStatus.CREATED) @ResponseBody diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java deleted file mode 100644 index 880f41de07..0000000000 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/controller/BazController.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.baeldung.web.controller; - -import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; -import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; - -import org.baeldung.web.dto.Baz; -import org.springframework.http.HttpStatus; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.ResponseStatus; - -@Controller -public class BazController { - - public BazController() { - super(); - } - - // API - read - // @PreAuthorize("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')") - @RequestMapping(method = RequestMethod.GET, value = "/bazes/{id}") - @ResponseBody - public Baz findById(@PathVariable final long id) { - return new Baz(Long.parseLong(randomNumeric(2)), randomAlphabetic(4)); - } - - // API - write - // @PreAuthorize("#oauth2.hasScope('write') and hasRole('ROLE_ADMIN')") - @RequestMapping(method = RequestMethod.POST, value = "/bazes") - @ResponseStatus(HttpStatus.CREATED) - @ResponseBody - public Baz create(@RequestBody final Baz baz) { - baz.setId(Long.parseLong(randomNumeric(2))); - return baz; - } - -} diff --git a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java b/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java deleted file mode 100644 index 69a6bf2e6a..0000000000 --- a/spring-security-oauth/spring-security-oauth-resource/src/main/java/org/baeldung/web/dto/Baz.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.baeldung.web.dto; - -public class Baz { - private long id; - private String name; - - public Baz() { - super(); - } - - public Baz(final long id, final String name) { - super(); - - this.id = id; - this.name = name; - } - - // - - public long getId() { - return id; - } - - public void setId(final long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(final String name) { - this.name = name; - } - -} \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html index d3cf521c0a..aa891bc289 100644 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/header.html @@ -94,25 +94,6 @@ app.controller('mainCtrl', function($scope,$resource,$http,$rootScope) { }); } - // baz - $scope.baz = {id:0 , name:"sample baz"}; - $scope.bazes = $resource("http://localhost:8081/spring-security-oauth-resource/bazes/:bazId",{bazId:'@id'}); - - $scope.getBaz = function(){ - $scope.baz = $scope.bazes.get({bazId:$scope.baz.id}); - } - - $scope.createBaz = function(){ - if($scope.baz.name.length==0) - { - $rootScope.message = "Baz name can not be empty"; - return; - } - $scope.baz.id = null; - $scope.baz = $scope.bazes.save($scope.baz, function(){ - $rootScope.message = "Baz Created Successfully"; - }); - } }); /*]]>*/ diff --git a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html index 0b4c7563ce..2996af04f0 100755 --- a/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html +++ b/spring-security-oauth/spring-security-oauth-ui-implicit/src/main/resources/templates/index.html @@ -51,28 +51,6 @@ Create Bar -
-
-
-
-
-

Baz Details

-
-
- - -
- -
- - -
- - -
diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java index 5827be548b..e5e9d8428f 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/test/java/org/baeldung/live/AuthorizationLiveTest.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.Map; import org.junit.Test; +import org.springframework.http.MediaType; import com.jayway.restassured.RestAssured; import com.jayway.restassured.response.Response; @@ -33,56 +34,37 @@ public class AuthorizationLiveTest { final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); assertEquals(403, barResponse.getStatusCode()); - - final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); - assertEquals(403, bazResponse.getStatusCode()); } @Test - public void givenUser_whenUseBarClient_thenOkForBarResourceOnly() { + public void givenUser_whenUseBarClient_thenOkForBarResourceReadOnly() { final String accessToken = obtainAccessToken("barClientIdPassword", "john", "123"); - final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); - assertEquals(200, barResponse.getStatusCode()); - assertNotNull(barResponse.jsonPath().get("name")); - final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); assertEquals(403, fooResponse.getStatusCode()); - final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); - assertEquals(403, bazResponse.getStatusCode()); + final Response barReadResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); + assertEquals(200, barReadResponse.getStatusCode()); + assertNotNull(barReadResponse.jsonPath().get("name")); + + final Response barWritResponse = RestAssured.given().contentType(MediaType.APPLICATION_JSON_VALUE).header("Authorization", "Bearer " + accessToken).body("{\"id\":1,\"name\":\"MyBar\"}").post("http://localhost:8081/spring-security-oauth-resource/bars"); + assertEquals(403, barWritResponse.getStatusCode()); } @Test - public void givenAdmin_whenUseFooClient_thenOkForFooAndBazResourceOnly() { - final String accessToken = obtainAccessToken("fooClientIdPassword", "tom", "111"); - - final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); - assertEquals(200, fooResponse.getStatusCode()); - assertNotNull(fooResponse.jsonPath().get("name")); - - final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); - assertEquals(200, bazResponse.getStatusCode()); - assertNotNull(bazResponse.jsonPath().get("name")); - - final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); - assertEquals(403, barResponse.getStatusCode()); - } - - @Test - public void givenAdmin_whenUseBarClient_thenOkForBarAndBazResourceOnly() { + public void givenAdmin_whenUseBarClient_thenOkForBarResourceReadWrite() { final String accessToken = obtainAccessToken("barClientIdPassword", "tom", "111"); + final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); + assertEquals(403, fooResponse.getStatusCode()); + final Response barResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bars/1"); assertEquals(200, barResponse.getStatusCode()); assertNotNull(barResponse.jsonPath().get("name")); - final Response bazResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/bazes/1"); - assertEquals(200, bazResponse.getStatusCode()); - assertNotNull(bazResponse.jsonPath().get("name")); - - final Response fooResponse = RestAssured.given().header("Authorization", "Bearer " + accessToken).get("http://localhost:8081/spring-security-oauth-resource/foos/1"); - assertEquals(403, fooResponse.getStatusCode()); + final Response barWritResponse = RestAssured.given().contentType(MediaType.APPLICATION_JSON_VALUE).header("Authorization", "Bearer " + accessToken).body("{\"id\":1,\"name\":\"MyBar\"}").post("http://localhost:8081/spring-security-oauth-resource/bars"); + assertEquals(201, barWritResponse.getStatusCode()); + assertEquals("MyBar", barWritResponse.jsonPath().get("name")); } } From 3b5c46bbbf9b0c99344ff0973807ebc9d406c8ab Mon Sep 17 00:00:00 2001 From: "giuseppe.bueti" Date: Fri, 26 Feb 2016 16:43:11 +0100 Subject: [PATCH 0174/1106] JPA Stored Procedure --- persistence-jpa/pom.xml | 81 +++++++++++++++++++ .../main/java/com/baeldung/jpa/model/Car.java | 59 ++++++++++++++ .../baeldung/jpa/model/QueryParameter.java | 27 +++++++ .../main/resources/META-INF/persistence.xml | 20 +++++ .../config/database/create_database.sql | 34 ++++++++ .../resources/config/database/insert_cars.sql | 4 + .../storedprocedure/StoredProcedureTest.java | 66 +++++++++++++++ .../src/test/resources/persistence.xml | 21 +++++ 8 files changed, 312 insertions(+) create mode 100644 persistence-jpa/pom.xml create mode 100644 persistence-jpa/src/main/java/com/baeldung/jpa/model/Car.java create mode 100644 persistence-jpa/src/main/java/com/baeldung/jpa/model/QueryParameter.java create mode 100644 persistence-jpa/src/main/resources/META-INF/persistence.xml create mode 100644 persistence-jpa/src/main/resources/config/database/create_database.sql create mode 100644 persistence-jpa/src/main/resources/config/database/insert_cars.sql create mode 100644 persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java create mode 100644 persistence-jpa/src/test/resources/persistence.xml diff --git a/persistence-jpa/pom.xml b/persistence-jpa/pom.xml new file mode 100644 index 0000000000..66f0264f2c --- /dev/null +++ b/persistence-jpa/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + com.baeldung + jpa-storedprocedure + 1.0 + jar + + + 7.0 + 11.2.0.4 + 5.1.0.Final + + + + JpaStoredProcedure + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + maven-assembly-plugin + + + + jar-with-dependencies + + + + + + + + + + + + javax + javaee-api + ${jee.version} + provided + + + + org.hibernate + hibernate-entitymanager + ${hibernate.version} + + + + + com.oracle + ojdbc6 + ${oracle.version} + + + + + + junit + junit + 4.4 + + + + commons-io + commons-io + 2.4 + + + + + \ No newline at end of file diff --git a/persistence-jpa/src/main/java/com/baeldung/jpa/model/Car.java b/persistence-jpa/src/main/java/com/baeldung/jpa/model/Car.java new file mode 100644 index 0000000000..d57cff200e --- /dev/null +++ b/persistence-jpa/src/main/java/com/baeldung/jpa/model/Car.java @@ -0,0 +1,59 @@ +package com.baeldung.jpa.model; + +import javax.persistence.*; + +/** + * Created by Giuseppe Bueti on 22/02/2016. + */ + +@Entity +@Table(name = "CAR") +@NamedStoredProcedureQueries({ + @NamedStoredProcedureQuery(name = "findByModelProcedure", procedureName = "FIND_CAR_BY_MODEL", resultClasses = { Car.class }, parameters = { @StoredProcedureParameter(name = "p_model", type = String.class, mode = ParameterMode.IN), + @StoredProcedureParameter(name = "data", type = Car.class, mode = ParameterMode.REF_CURSOR) }), + @NamedStoredProcedureQuery(name = "findByYearProcedure", procedureName = "FIND_CAR_BY_YEAR", resultClasses = { Car.class }, parameters = { @StoredProcedureParameter(name = "p_year", type = Integer.class, mode = ParameterMode.IN), + @StoredProcedureParameter(name = "data", type = Car.class, mode = ParameterMode.REF_CURSOR) }) }) +public class Car { + + private long id; + private String model; + private Integer year; + + public Car(String model, Integer year) { + this.model = model; + this.year = year; + } + + public Car() { + } + + @Id + @SequenceGenerator(name = "CarIdSequence", sequenceName = "SEQ_CAR_ID", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CarIdSequence") + @Column(name = "ID", unique = true, nullable = false, scale = 0) + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "MODEL") + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + @Column(name = "YEAR") + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } +} diff --git a/persistence-jpa/src/main/java/com/baeldung/jpa/model/QueryParameter.java b/persistence-jpa/src/main/java/com/baeldung/jpa/model/QueryParameter.java new file mode 100644 index 0000000000..326886842d --- /dev/null +++ b/persistence-jpa/src/main/java/com/baeldung/jpa/model/QueryParameter.java @@ -0,0 +1,27 @@ +package com.baeldung.jpa.model; + +import java.util.HashMap; +import java.util.Map; + +public class QueryParameter { + + private Map parameters = null; + + private QueryParameter(String name, Object value) { + this.parameters = new HashMap<>(); + this.parameters.put(name, value); + } + + public static QueryParameter with(String name, Object value) { + return new QueryParameter(name, value); + } + + public QueryParameter and(String name, Object value) { + this.parameters.put(name, value); + return this; + } + + public Map parameters() { + return this.parameters; + } +} \ No newline at end of file diff --git a/persistence-jpa/src/main/resources/META-INF/persistence.xml b/persistence-jpa/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..9c5adbac2a --- /dev/null +++ b/persistence-jpa/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,20 @@ + + + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.model.Car + + + + + + + + + + \ No newline at end of file diff --git a/persistence-jpa/src/main/resources/config/database/create_database.sql b/persistence-jpa/src/main/resources/config/database/create_database.sql new file mode 100644 index 0000000000..d84007b74d --- /dev/null +++ b/persistence-jpa/src/main/resources/config/database/create_database.sql @@ -0,0 +1,34 @@ +CREATE TABLESPACE JPA DATAFILE 'C:\oraclexe\app\oracle\oradata\XE\JPA.DBF' SIZE 100M AUTOEXTEND ON MAXSIZE 2048M; + +--DROP USER JPA CASCADE; +CREATE USER JPA IDENTIFIED BY JPA DEFAULT TABLESPACE JPA; +ALTER USER JPA QUOTA UNLIMITED ON "JPA" ACCOUNT UNLOCK; + +GRANT CREATE SESSION TO "JPA"; +GRANT ALTER SESSION TO "JPA"; +GRANT CREATE TABLE TO "JPA"; +GRANT CREATE TRIGGER TO "JPA"; +GRANT CREATE VIEW TO "JPA"; +GRANT CREATE DIMENSION TO "JPA"; +GRANT CREATE CLUSTER TO "JPA"; +GRANT CREATE INDEXTYPE TO "JPA"; +GRANT CREATE ROLE TO "JPA"; +GRANT CREATE SEQUENCE TO "JPA"; +GRANT CREATE TYPE TO "JPA"; +GRANT CREATE MATERIALIZED VIEW TO "JPA"; +GRANT CREATE PROCEDURE TO "JPA"; +GRANT CREATE SYNONYM TO "JPA"; + +CREATE SEQUENCE SEQ_CAR_ID INCREMENT BY 1 START WITH 1 MAXVALUE 999999999999999 MINVALUE 1; + +CREATE TABLE CAR +( + ID NUMBER NOT NULL, + MODEL VARCHAR2(50) NOT NULL, + YEAR NUMBER(4) NOT NULL +); + +ALTER TABLE CAR ADD CONSTRAINT CAR_PK PRIMARY KEY ( ID ); + +commit; + diff --git a/persistence-jpa/src/main/resources/config/database/insert_cars.sql b/persistence-jpa/src/main/resources/config/database/insert_cars.sql new file mode 100644 index 0000000000..5fef151c70 --- /dev/null +++ b/persistence-jpa/src/main/resources/config/database/insert_cars.sql @@ -0,0 +1,4 @@ +INSERT INTO CAR (ID, MODEL, YEAR) VALUES ('123456', 'Camaro', '2012'); +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('12112', 'Fiat Panda', '2000') +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('111000', 'Fiat Punto', '2007') +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('3382', 'Citroen C3', '2009') diff --git a/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java b/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java new file mode 100644 index 0000000000..61d4aca85e --- /dev/null +++ b/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java @@ -0,0 +1,66 @@ +package com.baeldung.jpa.storedprocedure; + +import com.baeldung.jpa.model.Car; +import org.junit.*; + +import javax.persistence.*; + +/** + * Created by Giuseppe Bueti on 23/02/2016. + */ +public class StoredProcedureTest { + + private static EntityManagerFactory factory = null; + private static EntityManager entityManager = null; + + @BeforeClass + public static void init() { + factory = Persistence.createEntityManagerFactory("jpa-db"); + entityManager = factory.createEntityManager(); + } + + @Before + public void setup() { + } + + @Test + public void createCarTest() { + EntityTransaction transaction = entityManager.getTransaction(); + try { + transaction.begin(); + Car car = new Car("Ford Mustang", 2015); + entityManager.persist(car); + transaction.commit(); + } catch (Exception e) { + System.out.println(e.getCause()); + if (transaction.isActive()) { + transaction.rollback(); + } + } + } + + @Test + public void findCarsByYear() { + final StoredProcedureQuery findByYearProcedure = entityManager.createNamedStoredProcedureQuery("findByYearProcedure"); + StoredProcedureQuery storedProcedure = findByYearProcedure.setParameter("p_year", 2015); + storedProcedure.getResultList().forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); + } + + @Test + public void findCarsByModel() { + final StoredProcedureQuery findByModelProcedure = entityManager.createNamedStoredProcedureQuery("findByModelProcedure"); + StoredProcedureQuery storedProcedure = findByModelProcedure.setParameter("p_model", "Camaro"); + storedProcedure.getResultList().forEach(c -> Assert.assertEquals("Camaro", ((Car) c).getModel())); + } + + @AfterClass + public static void destroy() { + + if (entityManager != null) { + entityManager.close(); + } + if (factory != null) { + factory.close(); + } + } +} diff --git a/persistence-jpa/src/test/resources/persistence.xml b/persistence-jpa/src/test/resources/persistence.xml new file mode 100644 index 0000000000..9a5d8acc36 --- /dev/null +++ b/persistence-jpa/src/test/resources/persistence.xml @@ -0,0 +1,21 @@ + + + + + org.hibernate.jpa.HibernatePersistenceProvider + com.baeldung.jpa.model.Car + + + + + + + + + + + From f8b8a5d7bb8e08bb1dd5c259bae7358cfc585f13 Mon Sep 17 00:00:00 2001 From: DOHA Date: Sat, 27 Feb 2016 20:37:56 +0200 Subject: [PATCH 0175/1106] oauth refresh token --- .../spring-security-oauth-ui-password/pom.xml | 8 +- .../baeldung/config/CustomPostZuulFilter.java | 70 +++++++++++++++++ .../baeldung/config/CustomPreZuulFilter.java | 52 +++++++++++++ .../org/baeldung/config/HomeController.java | 20 +++++ .../org/baeldung/config/UiApplication.java | 2 + .../src/main/resources/application.properties | 2 - .../src/main/resources/application.yml | 13 ++++ .../src/main/resources/templates/header.html | 77 +++++++++++-------- .../src/main/resources/templates/login.html | 5 +- spring-zuul/spring-zuul-ui/.project | 10 +-- 10 files changed, 216 insertions(+), 43 deletions(-) create mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPostZuulFilter.java create mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPreZuulFilter.java create mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/HomeController.java delete mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.properties create mode 100644 spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.yml diff --git a/spring-security-oauth/spring-security-oauth-ui-password/pom.xml b/spring-security-oauth/spring-security-oauth-ui-password/pom.xml index 4a42081f78..e8b2aa3d0d 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/pom.xml +++ b/spring-security-oauth/spring-security-oauth-ui-password/pom.xml @@ -17,11 +17,17 @@ org.springframework.boot spring-boot-starter-web - + org.springframework.boot spring-boot-starter-thymeleaf + + + org.springframework.cloud + spring-cloud-starter-zuul + 1.0.4.RELEASE + diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPostZuulFilter.java b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPostZuulFilter.java new file mode 100644 index 0000000000..319bd2f783 --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPostZuulFilter.java @@ -0,0 +1,70 @@ +package org.baeldung.config; + +import java.io.InputStream; + +import javax.servlet.http.Cookie; + +import org.apache.commons.io.IOUtils; +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.map.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; + +@Component +public class CustomPostZuulFilter extends ZuulFilter { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public Object run() { + final RequestContext ctx = RequestContext.getCurrentContext(); + logger.info("in zuul filter " + ctx.getRequest().getRequestURI()); + if (ctx.getRequest().getRequestURI().contains("oauth/token")) { + + final ObjectMapper mapper = new ObjectMapper(); + JsonNode json; + try { + final InputStream is = ctx.getResponseDataStream(); + final String responseBody = IOUtils.toString(is, "UTF-8"); + + ctx.setResponseBody(responseBody); + + if (responseBody.contains("refresh_token")) { + json = mapper.readTree(responseBody); + final String refreshToken = json.get("refresh_token").getTextValue(); + final Cookie cookie = new Cookie("refreshToken", refreshToken); + cookie.setHttpOnly(true); + cookie.setPath(ctx.getRequest().getContextPath() + "/refreshToken"); + cookie.setMaxAge(2592000); // 30 days + ctx.getResponse().addCookie(cookie); + + logger.info("refresh token = " + refreshToken); + } + } catch (final Exception e) { + logger.error("Error occured in zuul post filter", e); + } + + } + return null; + } + + @Override + public boolean shouldFilter() { + return true; + } + + @Override + public int filterOrder() { + return 10; + } + + @Override + public String filterType() { + return "post"; + } + +} diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPreZuulFilter.java b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPreZuulFilter.java new file mode 100644 index 0000000000..e0e38b2030 --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/CustomPreZuulFilter.java @@ -0,0 +1,52 @@ +package org.baeldung.config; + +import java.io.UnsupportedEncodingException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.crypto.codec.Base64; +import org.springframework.stereotype.Component; + +import com.netflix.zuul.ZuulFilter; +import com.netflix.zuul.context.RequestContext; + +@Component +public class CustomPreZuulFilter extends ZuulFilter { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public Object run() { + final RequestContext ctx = RequestContext.getCurrentContext(); + logger.info("in zuul filter " + ctx.getRequest().getRequestURI()); + if (ctx.getRequest().getRequestURI().contains("oauth/token")) { + byte[] encoded; + try { + encoded = Base64.encode("fooClientIdPassword:secret".getBytes("UTF-8")); + ctx.addZuulRequestHeader("Authorization", "Basic " + new String(encoded)); + logger.info("pre filter"); + logger.info(ctx.getRequest().getHeader("Authorization")); + } catch (final UnsupportedEncodingException e) { + logger.error("Error occured in pre filter", e); + } + + } + return null; + } + + @Override + public boolean shouldFilter() { + return true; + } + + @Override + public int filterOrder() { + return 111110; + } + + @Override + public String filterType() { + return "pre"; + } + +} diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/HomeController.java b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/HomeController.java new file mode 100644 index 0000000000..a56407a58e --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/HomeController.java @@ -0,0 +1,20 @@ +package org.baeldung.config; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseStatus; + +@Controller +public class HomeController { + + @RequestMapping(method = RequestMethod.GET, value = "/refreshToken") + @ResponseStatus(HttpStatus.OK) + public void getRefreshToken(@CookieValue(value = "refreshToken", defaultValue = "") String cookie, HttpServletResponse response) { + response.addHeader("refreshToken", cookie); + } +} diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/UiApplication.java index 8f491516aa..60c92d9eef 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/java/org/baeldung/config/UiApplication.java @@ -3,7 +3,9 @@ package org.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.cloud.netflix.zuul.EnableZuulProxy; +@EnableZuulProxy @SpringBootApplication public class UiApplication extends SpringBootServletInitializer { diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.properties b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.properties deleted file mode 100644 index e76a587680..0000000000 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.contextPath=/spring-security-oauth-ui-password -server.port=8081 \ No newline at end of file diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.yml b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.yml new file mode 100644 index 0000000000..9c9e9000e7 --- /dev/null +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/application.yml @@ -0,0 +1,13 @@ +server: + port: 8081 +zuul: + routes: + foos: + path: /foos/** + url: http://localhost:8081/spring-security-oauth-resource/foos + bars: + path: /bars/** + url: http://localhost:8081/spring-security-oauth-resource/bars + oauth: + path: /oauth/** + url: http://localhost:8081/spring-security-oauth-server/oauth diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html index cafba4eb65..92a771de12 100644 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/header.html @@ -21,52 +21,63 @@ var app = angular.module('myApp', ["ngResource","ngRoute","ngCookies"]); app.controller('mainCtrl', function($scope,$resource,$http,$httpParamSerializer,$cookies) { - $scope.foo = {id:0 , name:"sample foo"}; - $scope.foos = $resource("http://localhost:8081/spring-security-oauth-resource/foos/:fooId",{fooId:'@id'}); + $scope.foo = {id:0 , name:"sample foo"}; + $scope.foos = $resource("foos/:fooId",{fooId:'@id'}); - $scope.getFoo = function(){ - $scope.foo = $scope.foos.get({fooId:$scope.foo.id}); - } - - $scope.data = {grant_type:"password", username: "", password: "", client_id: "fooClientIdPassword"}; - $scope.encoded = btoa("fooClientIdPassword:secret"); + $scope.getFoo = function(){ + $scope.foo = $scope.foos.get({fooId:$scope.foo.id}); + } + $scope.loginData = {grant_type:"password", username: "", password: "", client_id: "fooClientIdPassword"}; + $scope.refreshData = {grant_type:"refresh_token", refresh_token:""}; + var isLoginPage = window.location.href.indexOf("login") != -1; if(isLoginPage){ - if($cookies.get("access_token")){ + if($cookies.get("access_token")){ window.location.href = "index"; - }else{ - $http.defaults.headers.common.Authorization= 'Basic ' + $scope.encoded; } }else{ - if($cookies.get("access_token")){ - $http.defaults.headers.common.Authorization= 'Bearer ' + $cookies.get("access_token"); - }else{ - window.location.href = "login"; - } - + if($cookies.get("access_token")){ + $http.defaults.headers.common.Authorization= 'Bearer ' + $cookies.get("access_token"); + }else{ + refreshAccessToken(); + } } $scope.login = function() { - var req = { + $scope.obtainAccessToken($scope.loginData); + } + + function refreshAccessToken(){ + $http.get("refreshToken"). + success(function(data, status, headers, config) { + if(headers("refreshToken") && headers("refreshToken").length>0){ + $scope.refreshData.refresh_token = headers("refreshToken"); + $scope.obtainAccessToken($scope.refreshData); + }else{ + window.location.href = "login"; + } + }); + } + + $scope.obtainAccessToken = function(params){ + var req = { method: 'POST', - url: "http://localhost:8081/spring-security-oauth-server/oauth/token", - headers: { - "Authorization": "Basic " + $scope.encoded, - "Content-type": "application/x-www-form-urlencoded; charset=utf-8" - }, - data: $httpParamSerializer($scope.data) + url: "oauth/token", + headers: {"Content-type": "application/x-www-form-urlencoded; charset=utf-8"}, + data: $httpParamSerializer(params) } $http(req).then( - function(data){ - $http.defaults.headers.common.Authorization= 'Bearer ' + data.data.access_token; - $cookies.put("access_token", data.data.access_token); - window.location.href="index"; - },function(){ - console.log("error"); - }); - } - + function(data){ + $http.defaults.headers.common.Authorization= 'Bearer ' + data.data.access_token; + var expireDate = new Date (new Date().getTime() + (1000 * data.data.expires_in)); + $cookies.put("access_token", data.data.access_token, {'expires': expireDate}); + window.location.href="index"; + },function(){ + console.log("error"); + window.location.href = "login"; + }); + } }); /*]]>*/ diff --git a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/login.html b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/login.html index 4d105cec6c..e1e6e3e6e0 100755 --- a/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/login.html +++ b/spring-security-oauth/spring-security-oauth-ui-password/src/main/resources/templates/login.html @@ -15,16 +15,17 @@
- +
- +
Login +
diff --git a/spring-zuul/spring-zuul-ui/.project b/spring-zuul/spring-zuul-ui/.project index ec0f2cde81..d87aec6bec 100644 --- a/spring-zuul/spring-zuul-ui/.project +++ b/spring-zuul/spring-zuul-ui/.project @@ -20,11 +20,6 @@ - - org.eclipse.m2e.core.maven2Builder - - - org.springframework.ide.eclipse.core.springbuilder @@ -35,6 +30,11 @@ + + org.eclipse.m2e.core.maven2Builder + + + org.eclipse.jem.workbench.JavaEMFNature From 50fc18b7d2e67ce4fd51c13ecbc9dff7552897b0 Mon Sep 17 00:00:00 2001 From: sghosh Date: Sun, 28 Feb 2016 17:40:14 +0530 Subject: [PATCH 0176/1106] more queries using QueryDSL --- .../src/main/java/org/baeldung/dao/PersonDao.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/querydsl/src/main/java/org/baeldung/dao/PersonDao.java b/querydsl/src/main/java/org/baeldung/dao/PersonDao.java index cc193de44b..17be05bff8 100644 --- a/querydsl/src/main/java/org/baeldung/dao/PersonDao.java +++ b/querydsl/src/main/java/org/baeldung/dao/PersonDao.java @@ -2,11 +2,22 @@ package org.baeldung.dao; import org.baeldung.entity.Person; +import javax.persistence.Tuple; import java.util.List; +import java.util.Map; public interface PersonDao { public Person save(Person person); public List findPersonsByFirstnameQueryDSL(String firstname); + + public List findPersonsByFirstnameAndSurnameQueryDSL(String firstname, String surname); + + public List findPersonsByFirstnameInDescendingOrderQueryDSL(String firstname); + + public int findMaxAge(); + + public Map findMaxAgeByName(); + } \ No newline at end of file From 1ff8bc970dcd7bd3d0d1b94928e1f492c35fbb7f Mon Sep 17 00:00:00 2001 From: sghosh Date: Sun, 28 Feb 2016 18:04:44 +0530 Subject: [PATCH 0177/1106] more queries using QueryDSL --- .../java/org/baeldung/dao/PersonDaoImpl.java | 40 ++++++++++++++++ .../main/java/org/baeldung/entity/Person.java | 15 ++++++ .../java/org/baeldung/dao/PersonDaoTest.java | 46 +++++++++++++++++++ 3 files changed, 101 insertions(+) diff --git a/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java b/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java index 82ee4c16cd..209ff699af 100644 --- a/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java +++ b/querydsl/src/main/java/org/baeldung/dao/PersonDaoImpl.java @@ -1,13 +1,18 @@ package org.baeldung.dao; +import com.mysema.query.group.GroupBy; import com.mysema.query.jpa.impl.JPAQuery; +import com.mysema.query.jpa.impl.JPAQueryFactory; import org.baeldung.entity.Person; import org.baeldung.entity.QPerson; import org.springframework.stereotype.Repository; +import javax.inject.Provider; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; +import javax.persistence.Tuple; import java.util.List; +import java.util.Map; @Repository public class PersonDaoImpl implements PersonDao { @@ -20,6 +25,7 @@ public class PersonDaoImpl implements PersonDao { return person; } + @Override public List findPersonsByFirstnameQueryDSL(String firstname) { JPAQuery query = new JPAQuery(em); QPerson person = QPerson.person; @@ -27,4 +33,38 @@ public class PersonDaoImpl implements PersonDao { return query.from(person).where(person.firstname.eq(firstname)).list(person); } + @Override + public List findPersonsByFirstnameAndSurnameQueryDSL(String firstname, String surname) { + JPAQuery query = new JPAQuery(em); + QPerson person = QPerson.person; + + return query.from(person).where(person.firstname.eq(firstname).and( + person.surname.eq(surname))).list(person); + } + + @Override + public List findPersonsByFirstnameInDescendingOrderQueryDSL(String firstname) { + JPAQuery query = new JPAQuery(em); + QPerson person = QPerson.person; + + return query.from(person).where(person.firstname.eq(firstname)).orderBy( + person.surname.desc()).list(person); + } + + @Override + public int findMaxAge() { + JPAQuery query = new JPAQuery(em); + QPerson person = QPerson.person; + + return query.from(person).list(person.age.max()).get(0); + } + + @Override + public Map findMaxAgeByName() { + JPAQuery query = new JPAQuery(em); + QPerson person = QPerson.person; + + return query.from(person).transform(GroupBy.groupBy(person.firstname).as(GroupBy.max(person.age))); + } + } \ No newline at end of file diff --git a/querydsl/src/main/java/org/baeldung/entity/Person.java b/querydsl/src/main/java/org/baeldung/entity/Person.java index d9b0a5a97d..056b2eb79c 100644 --- a/querydsl/src/main/java/org/baeldung/entity/Person.java +++ b/querydsl/src/main/java/org/baeldung/entity/Person.java @@ -15,6 +15,9 @@ public class Person { @Column private String surname; + @Column + private int age; + Person() { } @@ -23,6 +26,11 @@ public class Person { this.surname = surname; } + public Person(String firstname, String surname, int age) { + this(firstname, surname); + this.age = age; + } + public Long getId() { return id; } @@ -47,4 +55,11 @@ public class Person { this.surname = surname; } + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } } \ No newline at end of file diff --git a/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java b/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java index 29d4dd98e9..da3a95b7f8 100644 --- a/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java +++ b/querydsl/src/test/java/org/baeldung/dao/PersonDaoTest.java @@ -10,6 +10,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; +import java.util.Map; + @ContextConfiguration("/test-context.xml") @RunWith(SpringJUnit4ClassRunner.class) @@ -30,4 +32,48 @@ public class PersonDaoTest { Person personFromDb = personDao.findPersonsByFirstnameQueryDSL("Kent").get(0); Assert.assertEquals(person.getId(), personFromDb.getId()); } + + @Test + public void testMultipleFilter() { + personDao.save(new Person("Erich", "Gamma")); + Person person = personDao.save(new Person("Ralph", "Beck")); + Person person2 = personDao.save(new Person("Ralph", "Johnson")); + + Person personFromDb = personDao.findPersonsByFirstnameAndSurnameQueryDSL("Ralph", "Johnson").get(0); + Assert.assertNotSame(person.getId(), personFromDb.getId()); + Assert.assertEquals(person2.getId(), personFromDb.getId()); + } + + @Test + public void testOrdering() { + Person person = personDao.save(new Person("Kent", "Gamma")); + personDao.save(new Person("Ralph", "Johnson")); + Person person2 = personDao.save(new Person("Kent", "Zivago")); + + Person personFromDb = personDao.findPersonsByFirstnameInDescendingOrderQueryDSL("Kent").get(0); + Assert.assertNotSame(person.getId(), personFromDb.getId()); + Assert.assertEquals(person2.getId(), personFromDb.getId()); + } + + @Test + public void testMaxAge() { + personDao.save(new Person("Kent", "Gamma", 20)); + personDao.save(new Person("Ralph", "Johnson", 35)); + personDao.save(new Person("Kent", "Zivago", 30)); + + int maxAge = personDao.findMaxAge(); + Assert.assertTrue(maxAge == 35); + } + + @Test + public void testMaxAgeByName() { + personDao.save(new Person("Kent", "Gamma", 20)); + personDao.save(new Person("Ralph", "Johnson", 35)); + personDao.save(new Person("Kent", "Zivago", 30)); + + Map maxAge = personDao.findMaxAgeByName(); + Assert.assertTrue(maxAge.size() == 2); + Assert.assertSame(35, maxAge.get("Ralph")); + Assert.assertSame(30, maxAge.get("Kent")); + } } \ No newline at end of file From 202a99786a68802645105390e5ca3868360c5a9f Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 27 Feb 2016 10:52:54 +0100 Subject: [PATCH 0178/1106] Stored Procedure added. Added TestCase without using NamedStoredProcedure --- .../config/database/FIND_CAR_BY_YEAR_PROCEDURE.sql | 7 +++++++ .../src/main/resources/config/database/insert_cars.sql | 7 ++++--- .../jpa/storedprocedure/StoredProcedureTest.java | 10 ++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 persistence-jpa/src/main/resources/config/database/FIND_CAR_BY_YEAR_PROCEDURE.sql diff --git a/persistence-jpa/src/main/resources/config/database/FIND_CAR_BY_YEAR_PROCEDURE.sql b/persistence-jpa/src/main/resources/config/database/FIND_CAR_BY_YEAR_PROCEDURE.sql new file mode 100644 index 0000000000..f9230aad42 --- /dev/null +++ b/persistence-jpa/src/main/resources/config/database/FIND_CAR_BY_YEAR_PROCEDURE.sql @@ -0,0 +1,7 @@ +create or replace PROCEDURE FIND_CAR_BY_YEAR ( p_year IN NUMBER, data OUT SYS_REFCURSOR ) AS + BEGIN + OPEN data FOR + SELECT ID, MODEL, YEAR + FROM CAR + WHERE YEAR = p_year; + END FIND_CAR_BY_YEAR; \ No newline at end of file diff --git a/persistence-jpa/src/main/resources/config/database/insert_cars.sql b/persistence-jpa/src/main/resources/config/database/insert_cars.sql index 5fef151c70..4879ffc79e 100644 --- a/persistence-jpa/src/main/resources/config/database/insert_cars.sql +++ b/persistence-jpa/src/main/resources/config/database/insert_cars.sql @@ -1,4 +1,5 @@ INSERT INTO CAR (ID, MODEL, YEAR) VALUES ('123456', 'Camaro', '2012'); -INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('12112', 'Fiat Panda', '2000') -INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('111000', 'Fiat Punto', '2007') -INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('3382', 'Citroen C3', '2009') +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('12112', 'Fiat Panda', '2000'); +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('111000', 'Fiat Punto', '2007'); +INSERT INTO "JPA"."CAR" (ID, MODEL, YEAR) VALUES ('3382', 'Citroen C3', '2009'); +commit; \ No newline at end of file diff --git a/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java b/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java index 61d4aca85e..e6880c4d76 100644 --- a/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java +++ b/persistence-jpa/src/test/java/com/baeldung/jpa/storedprocedure/StoredProcedureTest.java @@ -53,6 +53,16 @@ public class StoredProcedureTest { storedProcedure.getResultList().forEach(c -> Assert.assertEquals("Camaro", ((Car) c).getModel())); } + @Test + public void findCarsByYearNoNamedStored() { + StoredProcedureQuery findByYearProcedure = + entityManager.createStoredProcedureQuery("FIND_CAR_BY_YEAR", Car.class) + .registerStoredProcedureParameter("p_year", Integer.class, ParameterMode.IN) + .registerStoredProcedureParameter("data", Void.class, ParameterMode.REF_CURSOR).setParameter("p_year", 2015); + + findByYearProcedure.getResultList().forEach(c -> Assert.assertEquals(new Integer(2015), ((Car) c).getYear())); + } + @AfterClass public static void destroy() { From 24786192029922ce3e5ad392e88cd3b3f86d5df8 Mon Sep 17 00:00:00 2001 From: Giuseppe Bueti Date: Sat, 27 Feb 2016 11:03:32 +0100 Subject: [PATCH 0179/1106] Modified persistence xsd reference --- .../src/main/resources/META-INF/persistence.xml | 10 +++++----- persistence-jpa/src/test/resources/persistence.xml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/persistence-jpa/src/main/resources/META-INF/persistence.xml b/persistence-jpa/src/main/resources/META-INF/persistence.xml index 9c5adbac2a..e862311620 100644 --- a/persistence-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-jpa/src/main/resources/META-INF/persistence.xml @@ -1,9 +1,9 @@ - + org.hibernate.jpa.HibernatePersistenceProvider diff --git a/persistence-jpa/src/test/resources/persistence.xml b/persistence-jpa/src/test/resources/persistence.xml index 9a5d8acc36..fc6c7273b2 100644 --- a/persistence-jpa/src/test/resources/persistence.xml +++ b/persistence-jpa/src/test/resources/persistence.xml @@ -1,9 +1,9 @@ - + org.hibernate.jpa.HibernatePersistenceProvider From ac458df0c7cbf275cd2a1c1f6703d4c83898fe30 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:02:46 +0200 Subject: [PATCH 0180/1106] Update README.md --- spring-data-redis/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-redis/README.md b/spring-data-redis/README.md index b9b2e5d93d..89eae99f05 100644 --- a/spring-data-redis/README.md +++ b/spring-data-redis/README.md @@ -1,7 +1,7 @@ ## Spring Data Redis ### Relevant Articles: -- [Introduction to Spring Data Redis] +- [Introduction to Spring Data Redis](http://www.baeldung.com/spring-data-redis-tutorial) ### Build the Project with Tests Running ``` From 1259a0c41ed74d4b7b69577a3b40ceb6f3783267 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:09:52 +0200 Subject: [PATCH 0181/1106] Create ========= --- raml/modularization/========= | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 raml/modularization/========= diff --git a/raml/modularization/========= b/raml/modularization/========= new file mode 100644 index 0000000000..bb1839f361 --- /dev/null +++ b/raml/modularization/========= @@ -0,0 +1,6 @@ +========= + +## Modular RAML + +### Relevant Articles: +- [Modular RAML Using Includes, Libraries, Overlays and Extensions](http://www.baeldung.com/modular-raml-includes-overlays-libraries-extensions) From b8f0d8a077df29b7a645b7d73ba2e714c119e609 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:10:16 +0200 Subject: [PATCH 0182/1106] Rename ========= to README.md --- raml/modularization/{========= => README.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename raml/modularization/{========= => README.md} (100%) diff --git a/raml/modularization/========= b/raml/modularization/README.md similarity index 100% rename from raml/modularization/========= rename to raml/modularization/README.md From bea7d842c2e6fac36c360687fb58bf356e74074e Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:11:36 +0200 Subject: [PATCH 0183/1106] Update README.md --- raml/modularization/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raml/modularization/README.md b/raml/modularization/README.md index bb1839f361..de0e047ea6 100644 --- a/raml/modularization/README.md +++ b/raml/modularization/README.md @@ -1,6 +1,6 @@ ========= -## Modular RAML +## Modular RESTful API Modeling Language ### Relevant Articles: - [Modular RAML Using Includes, Libraries, Overlays and Extensions](http://www.baeldung.com/modular-raml-includes-overlays-libraries-extensions) From f76c47ee8f3ccd1d384b6563946f5ad29a8587e3 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:19:33 +0200 Subject: [PATCH 0184/1106] Update README.md --- spring-data-elasticsearch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-data-elasticsearch/README.md b/spring-data-elasticsearch/README.md index 0dae92e0e7..e94f99f587 100644 --- a/spring-data-elasticsearch/README.md +++ b/spring-data-elasticsearch/README.md @@ -1,5 +1,5 @@ ## Spring Data Elasticsearch - +- [Introduction to Spring Data Elasticsearch](http://www.baeldung.com/spring-data-elasticsearch-tutorial) ### Build the Project with Tests Running ``` mvn clean install From cff3d8665f8a8c8863ee72386a8a65eb860f041c Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:19:56 +0200 Subject: [PATCH 0185/1106] Update README.md --- spring-data-elasticsearch/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-data-elasticsearch/README.md b/spring-data-elasticsearch/README.md index e94f99f587..74d9e4f642 100644 --- a/spring-data-elasticsearch/README.md +++ b/spring-data-elasticsearch/README.md @@ -1,5 +1,6 @@ ## Spring Data Elasticsearch - [Introduction to Spring Data Elasticsearch](http://www.baeldung.com/spring-data-elasticsearch-tutorial) + ### Build the Project with Tests Running ``` mvn clean install From 2c7262dac54e0821e8b5e7b4273f09139322815a Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:23:59 +0200 Subject: [PATCH 0186/1106] Create README.md --- guava19/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 guava19/README.md diff --git a/guava19/README.md b/guava19/README.md new file mode 100644 index 0000000000..5602ad83f6 --- /dev/null +++ b/guava19/README.md @@ -0,0 +1,7 @@ +========= + +## Guava 19 + + +### Relevant Articles: +[Guava 19: What’s New?](http://www.baeldung.com/whats-new-in-guava-19) From 72ac8a9d4137907a0601a9529f3849c5ef7590f8 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:26:19 +0200 Subject: [PATCH 0187/1106] Create README.md --- resteasy/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 resteasy/README.md diff --git a/resteasy/README.md b/resteasy/README.md new file mode 100644 index 0000000000..67550d77d0 --- /dev/null +++ b/resteasy/README.md @@ -0,0 +1,7 @@ +========= + +## A Guide to RESTEasy + + +### Relevant Articles: +- [A Guide to RESTEasy](http://www.baeldung.com/resteasy-tutorial) From b189d03388f13aee01bc2e2f8dbb955655a45706 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:27:08 +0200 Subject: [PATCH 0188/1106] Update README.md --- guava19/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guava19/README.md b/guava19/README.md index 5602ad83f6..be9f2d72a4 100644 --- a/guava19/README.md +++ b/guava19/README.md @@ -4,4 +4,4 @@ ### Relevant Articles: -[Guava 19: What’s New?](http://www.baeldung.com/whats-new-in-guava-19) +- [Guava 19: What’s New?](http://www.baeldung.com/whats-new-in-guava-19) From 31a5c6ea5c96502bcbf89a9f1728e61e9b871f4b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:29:53 +0200 Subject: [PATCH 0189/1106] Create README.md --- raml/annotations/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 raml/annotations/README.md diff --git a/raml/annotations/README.md b/raml/annotations/README.md new file mode 100644 index 0000000000..4142b33353 --- /dev/null +++ b/raml/annotations/README.md @@ -0,0 +1,7 @@ +========= + +## Define Custom RAML + + +### Relevant Articles: +- [Define Custom RAML Properties Using Annotations](http://www.baeldung.com/raml-custom-properties-with-annotations) From f02faf32a7410f1d721a19a8335a37444cae6c1b Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:31:47 +0200 Subject: [PATCH 0190/1106] Update README.md --- resteasy/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/resteasy/README.md b/resteasy/README.md index 67550d77d0..722f1dfe93 100644 --- a/resteasy/README.md +++ b/resteasy/README.md @@ -5,3 +5,4 @@ ### Relevant Articles: - [A Guide to RESTEasy](http://www.baeldung.com/resteasy-tutorial) +- [RESTEasy Client API](http://www.baeldung.com/resteasy-client-tutorial) From 7cffb8a17ca97005f5ad5804db8bfd118613057a Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:34:23 +0200 Subject: [PATCH 0191/1106] Update README.md --- spring-apache-camel/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md index f6ae77b2a5..d9f380055b 100644 --- a/spring-apache-camel/README.md +++ b/spring-apache-camel/README.md @@ -15,6 +15,7 @@ This article will demonstrate how to configure and use Apache Camel with Spring
  • Spring 4.2.4
  • Apache Camel 2.16.1
  • +
  • Using Apache Camel with Spring

Build and Run Application

@@ -25,4 +26,4 @@ To build this application execute following maven command in ApacheCamelFileProc To run this application you can either run our main class App from your IDE or you can execute following maven command: -mvn exec:java -Dexec.mainClass="App" \ No newline at end of file +mvn exec:java -Dexec.mainClass="App" From 95046958487bb7ba84406c69cbaaaf223e6be642 Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:34:55 +0200 Subject: [PATCH 0192/1106] Update README.md --- spring-apache-camel/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md index d9f380055b..5b24c63cbc 100644 --- a/spring-apache-camel/README.md +++ b/spring-apache-camel/README.md @@ -15,7 +15,6 @@ This article will demonstrate how to configure and use Apache Camel with Spring
  • Spring 4.2.4
  • Apache Camel 2.16.1
  • -
  • Using Apache Camel with Spring

Build and Run Application

From bf9e0b607f46121669249cbcda1275f7bc713e6f Mon Sep 17 00:00:00 2001 From: MichelLeBon Date: Tue, 1 Mar 2016 02:38:43 +0200 Subject: [PATCH 0193/1106] Update README.md --- core-java-8/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-8/README.md b/core-java-8/README.md index 8bef3a1be0..b03d24c34e 100644 --- a/core-java-8/README.md +++ b/core-java-8/README.md @@ -8,3 +8,4 @@ - [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources) - [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips) - [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator) +- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial) From 87e391661d5336f06d2eb19010aadbc772ee8a32 Mon Sep 17 00:00:00 2001 From: Eugen Date: Tue, 1 Mar 2016 11:38:37 +0200 Subject: [PATCH 0194/1106] Update README.md --- spring-apache-camel/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-apache-camel/README.md b/spring-apache-camel/README.md index 5b24c63cbc..4015760f7d 100644 --- a/spring-apache-camel/README.md +++ b/spring-apache-camel/README.md @@ -3,7 +3,7 @@ This article will demonstrate how to configure and use Apache Camel with Spring Framework. -

Relevant Article

+

Relevant Articles