Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing movie-spa, adding movie-client, adding testcontainers and
fixing cloud contract stuff
- Loading branch information
Billy Korando
committed
Jun 7, 2018
1 parent
4177b34
commit 1adabda
Showing
59 changed files
with
978 additions
and
13,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.metadata/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>PortableReliableIntegrationTestingWithSpring</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>RemoteSystemsTempFiles</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?xml version="1.0"?> | ||
<project | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.0.1.RELEASE</version> | ||
<relativePath /> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.bk.movie</groupId> | ||
<artifactId>movie-client</artifactId> | ||
<version>1.0.0</version> | ||
<name>movie-client</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
<spring-cloud.version>Edgware.RELEASE</spring-cloud.version> | ||
<junit-jupiter.version>5.1.0</junit-jupiter.version> | ||
<junit-platform.version>1.1.0</junit-platform.version> | ||
<spring-restdocs.version>2.0.1.RELEASE</spring-restdocs.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit-jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-engine</artifactId> | ||
<version>${junit-platform.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-launcher</artifactId> | ||
<version>${junit-platform.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit</groupId> | ||
<artifactId>junit-bom</artifactId> | ||
<version>5.2.0</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<repositories> | ||
<repository> | ||
<id>spring-milestones</id> | ||
<name>Spring Milestones</name> | ||
<url>https://repo.spring.io/milestone</url> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
movie-client/src/main/java/com/bk/movie/client/LocalWireMockServerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.bk.movie.client; | ||
|
||
import org.springframework.cloud.contract.stubrunner.server.EnableStubRunnerServer; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
@Profile("!dev,!prod") | ||
@Configuration | ||
@EnableStubRunnerServer | ||
public class LocalWireMockServerConfig { | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.bk.movie.client; | ||
|
||
import java.io.Serializable; | ||
|
||
public class Movie implements Serializable { | ||
|
||
private static final long serialVersionUID = -8553189923124180473L; | ||
private String title; | ||
private String genre; | ||
private int releaseYear; | ||
private int runTimeMins; | ||
|
||
public Movie() { | ||
} | ||
|
||
public Movie(String title, String genre, int releaseYear, int runTimeMins) { | ||
this.title = title; | ||
this.genre = genre; | ||
this.releaseYear = releaseYear; | ||
this.runTimeMins = runTimeMins; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public String getGenre() { | ||
return genre; | ||
} | ||
|
||
public int getReleaseYear() { | ||
return releaseYear; | ||
} | ||
|
||
public int getRunTimeMins() { | ||
return runTimeMins; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + ((genre == null) ? 0 : genre.hashCode()); | ||
result = prime * result + releaseYear; | ||
result = prime * result + runTimeMins; | ||
result = prime * result + ((title == null) ? 0 : title.hashCode()); | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
if (this == obj) | ||
return true; | ||
if (obj == null) | ||
return false; | ||
if (getClass() != obj.getClass()) | ||
return false; | ||
Movie other = (Movie) obj; | ||
if (genre == null) { | ||
if (other.genre != null) | ||
return false; | ||
} else if (!genre.equals(other.genre)) | ||
return false; | ||
if (releaseYear != other.releaseYear) | ||
return false; | ||
if (runTimeMins != other.runTimeMins) | ||
return false; | ||
if (title == null) { | ||
if (other.title != null) | ||
return false; | ||
} else if (!title.equals(other.title)) | ||
return false; | ||
return true; | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
movie-client/src/main/java/com/bk/movie/client/MovieClientServiceApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.bk.movie.client; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.web.servlet.config.annotation.CorsRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
@SpringBootApplication | ||
public class MovieClientServiceApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(MovieClientServiceApplication.class, args); | ||
} | ||
|
||
@Bean | ||
public WebMvcConfigurer corsConfigurer() { | ||
return new WebMvcConfigurer() { | ||
@Override | ||
public void addCorsMappings(CorsRegistry registry) { | ||
registry.addMapping("/**").allowedMethods("GET", "POST", "PUT", "DELETE").allowedOrigins("*") | ||
.allowedHeaders("*"); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
server.port=8000 | ||
|
||
stubrunner.work-offline=true | ||
stubrunner.ids=com.bk.movie:movie-service:+:8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>MovieSpa</title> | ||
<base href="/"> | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico"> | ||
</head> | ||
<body> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
$("#showMovies").click(function() { | ||
$.get("http://localhost:8081/movies", function( data ) { | ||
$.each(data, function(i, data){ | ||
$("#movies").append("<tr><td>" + data.id + "</td><td>" + data.title + "</td></tr>"); | ||
}); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
<button id="showMovies">Show Movies</button> | ||
<table id="movies"></table> | ||
|
||
<!-- <app-root></app-root> --> | ||
</body> | ||
</html> |
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
movie-client/src/test/java/com/bk/movie/client/TestContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.bk.movie.client; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner; | ||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
@SpringJUnitConfig(MovieClientServiceApplication.class) | ||
@AutoConfigureStubRunner(ids = "com.bk.movie:movie-service:+:8081", workOffline=true) | ||
public class TestContract { | ||
|
||
private RestTemplate restTemplate = new RestTemplate(); | ||
|
||
@Test | ||
public void testCallFindAllMovies() { | ||
Movie[] movies = restTemplate.getForObject("http://localhost:8081/movies", Movie[].class); | ||
|
||
for (Movie movie : movies) { | ||
System.out.println(movie.toString()); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.