Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

96 #97

Merged
merged 2 commits into from
Apr 26, 2020
Merged

96 #97

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
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
gradle clean build sonarqube \
-Pversion=$CIRCLE_TAG \
-PpullRequestKey=$PR_NUMBER \
--info
--info \
--console=plain
- run:
name: codecov
command: bash <(curl -s https://codecov.io/bash)
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include .env
export $(shell sed 's/=.*//' .env)

.PHONY: bin build gradle src var

tag:
bash bin/create_tag.sh -n1

Expand Down Expand Up @@ -56,4 +58,4 @@ pdd:
pdd --source=/main --exclude=.idea/**/* --verbose --file=/dev/null

build:
bash bin/gradle_in_docker.sh clean build --info
bash bin/gradle_in_docker.sh clean build --info --console=verbose
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static CodexiaProject from(CodexiaClient.Project from) {
return new CodexiaProject()
.setExternalId(from.getId())
.setCoordinates(from.getCoordinates())
.setAuthor(from.getAuthor())
.setAuthor(from.getSubmitter().getLogin())
.setDeleted(from.getDeleted())
.setProjectCreatedAt(
Factory.toLocalDateTIme(from.getCreated())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ ResponseEntity<String> setMeta(
class Project {
private Integer id;
private String coordinates;
private String author;
private Submitter submitter;
private String deleted;

// @todo #6 write tests for different timezones
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss Z")
// @todo #6 replace `Date` with `ZonedDateTime`
private Date created;

@Data
public static class Submitter {
private Integer id;
private String login;
}
}

enum ReviewStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
import dev.iakunin.codexiabot.AbstractIntegrationTest;
import dev.iakunin.codexiabot.util.WireMockServer;
import org.cactoos.text.Joined;
import org.cactoos.io.ResourceOf;
import org.cactoos.text.TextOf;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -45,17 +46,10 @@ public void twoActiveProjectsInRepoButDeletedInCodexia() {
.willReturn(ok()
.withHeader("Content-Type", "application/json")
.withBody(
new Joined(
"\n",
// @todo #6 extract to json-file
"{",
" \"id\": {{ replace request.requestLine.pathSegments.[1] '.json' '' }},",
" \"coordinates\": \"test-project/test-repo\",",
" \"platform\": \"github\",",
" \"author\": \"iakunin-codexia-bot\",",
" \"created\": \"2020-03-10 19:12:21 +0000\",",
" \"deleted\": \"deleted by someone\"",
"}"
new TextOf(
new ResourceOf(
"wiremock/codexia/cron/projects-health-check/twoActiveProjectsInRepoButDeletedInCodexia.json"
)
).toString()
)
.withTransformers(ResponseTemplateTransformer.NAME)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": {{ replace request.requestLine.pathSegments.[1] '.json' '' }},
"coordinates": "test-project/test-repo",
"platform": "github",
"submitter": {
"id": 123,
"login": "iakunin-codexia-bot"
},
"created": "2020-03-10 19:12:21 +0000",
"deleted": "deleted by someone"
}
5 changes: 4 additions & 1 deletion var/wiremock/__files/codexia/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"id": {{ replace request.requestLine.pathSegments.[2] '.json' '' }},
"coordinates": "test-project/test-repo",
"platform": "github",
"author": "iakunin-codexia-bot",
"submitter": {
"id": 123,
"login": "iakunin-codexia-bot"
},
"created": "2020-03-10 19:12:21 +0000",
"deleted": null
}
Loading