defect commit

This commit is contained in:
gexce
2017-09-11 17:14:39 +02:00
parent 2c1542c4f3
commit 9a658f5491
5 changed files with 168 additions and 18 deletions
+51 -18
View File
@@ -1,19 +1,52 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<modelVersion>4.0.0</modelVersion> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>AH-MAM-Migration</groupId> <modelVersion>4.0.0</modelVersion>
<artifactId>AH-MAM-Migration</artifactId> <groupId>AH-MAM-Migration</groupId>
<version>0.0.1-SNAPSHOT</version> <artifactId>AH-MAM-Migration</artifactId>
<build> <version>0.0.1-SNAPSHOT</version>
<sourceDirectory>src</sourceDirectory>
<plugins> <parent>
<plugin> <groupId>org.springframework.boot</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>3.6.1</version> <version>1.5.6.RELEASE</version>
<configuration> </parent>
<source>1.8</source>
<target>1.8</target> <dependencies>
</configuration> <dependency>
</plugin> <groupId>org.springframework.boot</groupId>
</plugins> <artifactId>spring-boot-starter</artifactId>
</build> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
<version>0.23.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
@@ -0,0 +1,31 @@
package com.bayer.edam.migration;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.client.Traverson;
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String args[]) {
Map<String, Object> parameters = new HashMap<>();
parameters.put("user", 27);
Traverson traverson;
try {
traverson = new Traverson(new URI("http://localhost:8080/api/"), MediaTypes.HAL_JSON);
String name = traverson.follow("movies", "movie", "actor").withTemplateParameters(parameters).toObject("$.name");
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
@@ -0,0 +1,18 @@
package hello;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.RestTemplate;
public class Application {
private static final Logger log = LoggerFactory.getLogger(Application.class);
public static void main(String args[]) {
RestTemplate restTemplate = new RestTemplate();
Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class);
restTemplate.
log.info(quote.toString());
}
}
+34
View File
@@ -0,0 +1,34 @@
package hello;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Quote {
private String type;
private Value value;
public Quote() {
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Value getValue() {
return value;
}
public void setValue(Value value) {
this.value = value;
}
@Override
public String toString() {
return "Quote{" + "type='" + type + '\'' + ", value=" + value + '}';
}
}
+34
View File
@@ -0,0 +1,34 @@
package hello;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Value {
private Long id;
private String quote;
public Value() {
}
public Long getId() {
return this.id;
}
public String getQuote() {
return this.quote;
}
public void setId(Long id) {
this.id = id;
}
public void setQuote(String quote) {
this.quote = quote;
}
@Override
public String toString() {
return "Value{" + "id=" + id + ", quote='" + quote + '\'' + '}';
}
}