Skip to content

Commit

Permalink
Added actor service
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Jun 15, 2015
1 parent 1e45b81 commit f16c468
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 239 deletions.
20 changes: 18 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ buildscript {
springBootVersion = '1.2.4.RELEASE'
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
Expand Down Expand Up @@ -31,10 +33,12 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
jcenter()
mavenCentral()
mavenLocal()
}

def serenityCoreVersion = "1.0.53"
def serenityCoreVersion = "1.0.56"
def cucumberVersion = "1.2.2"

dependencies {
Expand Down Expand Up @@ -78,14 +82,26 @@ task wrapper(type: Wrapper) {

test {
exclude '**/integration/**'
exclude '**/features/**'
maxParallelForks = 4
}

task integrationTests(type: Test) {
include '**/integration/**'
maxParallelForks = 4
}

task acceptanceTests(type: Test) {
include '**/features/**'
}

acceptanceTests.mustRunAfter integrationTests
integrationTests.mustRunAfter test
aggregate.mustRunAfter acceptanceTests

task verify {}

verify.dependsOn('test', 'integrationTests', 'acceptanceTests', 'aggregate')

cloudfoundry {
target = "https://api.run.pivotal.io"
space = "production"
Expand Down
82 changes: 0 additions & 82 deletions src/main/java/com/wakaleo/myflix/movies/MovieController.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,17 @@ public static void main(String[] args) {
}

@Bean
public Docket petApi() {
public Docket moviesApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/")
.directModelSubstitute(LocalDate.class,
String.class)
.genericModelSubstitutes(ResponseEntity.class)
.alternateTypeRules(
newRule(typeResolver.resolve(DeferredResult.class,
typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
typeResolver.resolve(WildcardType.class)))
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET,
newArrayList(new ResponseMessageBuilder()
.code(500)
.message("500 message")
.responseModel(new ModelRef("Error"))
.build()))
// .securitySchemes(newArrayList(apiKey()))
// .securityContexts(newArrayList(securityContext()))
;
.directModelSubstitute(LocalDate.class, String.class)
.genericModelSubstitutes(ResponseEntity.class);
}

@Autowired
private TypeResolver typeResolver;

// private ApiKey apiKey() {
// return new ApiKey("mykey", "api_key", "header");
// }
//
// private SecurityContext securityContext() {
// return SecurityContext.builder()
// .securityReferences(defaultAuth())
// .forPaths(PathSelectors.regex("/movies.*"))
// .build();
// }
//
// List<SecurityReference> defaultAuth() {
// AuthorizationScope authorizationScope
// = new AuthorizationScope("global", "accessEverything");
// AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
// authorizationScopes[0] = authorizationScope;
// return newArrayList(new SecurityReference("mykey", authorizationScopes));
// }
}
44 changes: 41 additions & 3 deletions src/main/java/com/wakaleo/myflix/movies/model/Artist.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,45 @@
package com.wakaleo.myflix.movies.model;

/**
* Created by john on 11/06/2015.
*/
import com.google.common.collect.ImmutableList;

import java.util.List;

public class Artist {

private String name;
private List<Movie> filmsActedIn;
private List<Movie> filmsDirected;

public Artist() {
}

public Artist(String name, List<Movie> filmsActedIn, List<Movie> filmsDirected) {
this.name = name;
this.filmsActedIn = filmsActedIn;
this.filmsDirected = filmsDirected;
}

public String getName() {
return name;
}

public List<Movie> getFilmsActedIn() {
return filmsActedIn;
}

public List<Movie> getFilmsDirected() {
return filmsDirected;
}

public void setName(String name) {
this.name = name;
}

public void setActedIn(List<Movie> actedIn) {
this.filmsActedIn = actedIn;
}

public void setDirected(List<Movie> directed) {
this.filmsDirected = directed;
}
}
24 changes: 24 additions & 0 deletions src/main/java/com/wakaleo/myflix/movies/model/Movie.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,28 @@ public String toString() {
sb.append('}');
return sb.toString();
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Movie)) return false;

Movie movie = (Movie) o;

if (actors != null ? !actors.equals(movie.actors) : movie.actors != null) return false;
if (description != null ? !description.equals(movie.description) : movie.description != null) return false;
if (director != null ? !director.equals(movie.director) : movie.director != null) return false;
if (title != null ? !title.equals(movie.title) : movie.title != null) return false;

return true;
}

@Override
public int hashCode() {
int result = title != null ? title.hashCode() : 0;
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (director != null ? director.hashCode() : 0);
result = 31 * result + (actors != null ? actors.hashCode() : 0);
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
public interface MovieRepository extends MongoRepository<Movie, String> {

public List<Movie> findByDirector(String director);
// public List<Movie> findByActor(String actor);
// public List<Movie> findByKeyword(String keyword);

public List<Movie> findByActors(String actor);
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit f16c468

Please sign in to comment.