Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pipeline {
agent {
label 'docker-integration-test'
}
options {
skipStagesAfterUnstable()
}
stages {
stage('Elastic Start') {
steps {
sh 'runuser -l elasticsearch -c /usr/share/elasticsearch/bin/elasticsearch &'
}
}
stage('Seed') {
steps {
sh '/usr/share/elasticsearch/utils/wait-for-it.sh localhost:9200 -- /usr/share/elasticsearch/config/setup.sh'
}
}
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
post {
always {
junit 'target/surefire-reports/*.xml'
}
}
}
stage('Deliver') {
steps {
sh 'chmod +x ./jenkins/scripts/deliver.sh'
sh './jenkins/scripts/deliver.sh'
}
}
}
}
26 changes: 26 additions & 0 deletions jenkins/scripts/deliver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

echo 'The following Maven command installs your Maven-built Java application'
echo 'into the local Maven repository, which will ultimately be stored in'
echo 'Jenkins''s local Maven repository (and the "maven-repository" Docker data'
echo 'volume).'
set -x
mvn jar:jar install:install help:evaluate -Dexpression=project.name
set +x

echo 'The following complex command extracts the value of the <name/> element'
echo 'within <project/> of your Java/Maven project''s "pom.xml" file.'
set -x
NAME=`mvn help:evaluate -Dexpression=project.name | grep "^[^\[]"`
set +x

echo 'The following complex command behaves similarly to the previous one but'
echo 'extracts the value of the <version/> element within <project/> instead.'
set -x
VERSION=`mvn help:evaluate -Dexpression=project.version | grep "^[^\[]"`
set +x

echo 'The following command runs and outputs the execution of your Java'
echo 'application (which Jenkins built using Maven) to the Jenkins UI.'
set -x
java -jar target/${NAME}-${VERSION}.jar
13 changes: 2 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<version>2.3.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

Expand All @@ -39,19 +39,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.20</version>
<version>1.18.16</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import java.util.concurrent.CompletableFuture;

import com.mgiglione.model.Manga;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -13,7 +14,6 @@
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.mgiglione.model.Manga;
import com.mgiglione.service.MangaService;

@RestController
Expand Down
179 changes: 178 additions & 1 deletion src/main/java/com/mgiglione/model/Manga.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,187 @@
import lombok.NoArgsConstructor;
import lombok.Setter;


import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter @Setter @NoArgsConstructor @AllArgsConstructor @Builder
public class Manga {

@JsonProperty("mal_id")
private Integer malId;
@JsonProperty("url")
private String url;
@JsonProperty("image_url")
private String imageUrl;
@JsonProperty("title")
private String title;
private String description;
@JsonProperty("publishing")
private Boolean publishing;
@JsonProperty("synopsis")
private String synopsis;
@JsonProperty("type")
private String type;
@JsonProperty("chapters")
private Integer chapters;
@JsonProperty("volumes")
private Integer volumes;
@JsonProperty("score")
private Double score;
@JsonProperty("start_date")
private String startDate;
@JsonProperty("end_date")
private Object endDate;
@JsonProperty("members")
private Integer members;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

@JsonProperty("mal_id")
public Integer getMalId() {
return malId;
}

@JsonProperty("mal_id")
public void setMalId(Integer malId) {
this.malId = malId;
}

@JsonProperty("url")
public String getUrl() {
return url;
}

@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}

@JsonProperty("image_url")
public String getImageUrl() {
return imageUrl;
}

@JsonProperty("image_url")
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}

@JsonProperty("title")
public String getTitle() {
return title;
}

@JsonProperty("title")
public void setTitle(String title) {
this.title = title;
}

@JsonProperty("publishing")
public Boolean getPublishing() {
return publishing;
}

@JsonProperty("publishing")
public void setPublishing(Boolean publishing) {
this.publishing = publishing;
}

@JsonProperty("synopsis")
public String getSynopsis() {
return synopsis;
}

@JsonProperty("synopsis")
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}

@JsonProperty("type")
public String getType() {
return type;
}

@JsonProperty("type")
public void setType(String type) {
this.type = type;
}

@JsonProperty("chapters")
public Integer getChapters() {
return chapters;
}

@JsonProperty("chapters")
public void setChapters(Integer chapters) {
this.chapters = chapters;
}

@JsonProperty("volumes")
public Integer getVolumes() {
return volumes;
}

@JsonProperty("volumes")
public void setVolumes(Integer volumes) {
this.volumes = volumes;
}

@JsonProperty("score")
public Double getScore() {
return score;
}

@JsonProperty("score")
public void setScore(Double score) {
this.score = score;
}

@JsonProperty("start_date")
public String getStartDate() {
return startDate;
}

@JsonProperty("start_date")
public void setStartDate(String startDate) {
this.startDate = startDate;
}

@JsonProperty("end_date")
public Object getEndDate() {
return endDate;
}

@JsonProperty("end_date")
public void setEndDate(Object endDate) {
this.endDate = endDate;
}

@JsonProperty("members")
public Integer getMembers() {
return members;
}

@JsonProperty("members")
public void setMembers(Integer members) {
this.members = members;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}
85 changes: 83 additions & 2 deletions src/main/java/com/mgiglione/model/MangaResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,90 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter @Setter @NoArgsConstructor
public class MangaResult {

private List<Manga> result;

@JsonProperty("request_hash")
private String requestHash;
@JsonProperty("request_cached")
private Boolean requestCached;
@JsonProperty("request_cache_expiry")
private Integer requestCacheExpiry;
@JsonProperty("results")
private List<Manga> results = null;
@JsonProperty("last_page")
private Integer lastPage;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();

@JsonProperty("request_hash")
public String getRequestHash() {
return requestHash;
}

@JsonProperty("request_hash")
public void setRequestHash(String requestHash) {
this.requestHash = requestHash;
}

@JsonProperty("request_cached")
public Boolean getRequestCached() {
return requestCached;
}

@JsonProperty("request_cached")
public void setRequestCached(Boolean requestCached) {
this.requestCached = requestCached;
}

@JsonProperty("request_cache_expiry")
public Integer getRequestCacheExpiry() {
return requestCacheExpiry;
}

@JsonProperty("request_cache_expiry")
public void setRequestCacheExpiry(Integer requestCacheExpiry) {
this.requestCacheExpiry = requestCacheExpiry;
}

@JsonProperty("results")
public List<Manga> getResults() {
return results;
}

@JsonProperty("mangas")
public void setResults(List<Manga> mangas) {
this.results = mangas;
}

@JsonProperty("last_page")
public Integer getLastPage() {
return lastPage;
}

@JsonProperty("last_page")
public void setLastPage(Integer lastPage) {
this.lastPage = lastPage;
}

@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}

@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}

}
Loading