Commit id plugin (#626)

* initial

* working

* added injection test

* [COMMIT-ID-PLUGIN] Add default value for testcheck

* pivovarit review refactor

* pivovarit review refactor

* add logback, log level: INFO

* return result in map
This commit is contained in:
pared 2016-08-22 19:05:58 +02:00 committed by Grzegorz Piwowarek
parent fd32feeed3
commit 1fae5622b0
3 changed files with 14 additions and 28 deletions

View File

@ -126,6 +126,10 @@
</executions>
<configuration>
<verbose>true</verbose>
<generateGitPropertiesFilename>
${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
</configuration>
</plugin>

View File

@ -4,6 +4,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
public class CommitInfoController {
@ -17,7 +20,11 @@ public class CommitInfoController {
private String commitId;
@RequestMapping("/commitId")
public GitInfoDto getCommitId() {
return new GitInfoDto(commitMessage, branch, commitId);
public Map<String, String> getCommitId() {
Map<String, String> result = new HashMap<>();
result.put("Commit message",commitMessage);
result.put("Commit branch", branch);
result.put("Commit id", commitId);
return result;
}
}

View File

@ -1,25 +0,0 @@
package com.baeldung.git;
public class GitInfoDto {
private String commitMessage;
private String branch;
private String commitId;
public GitInfoDto(String commitMessage, String branch, String commitId) {
this.commitMessage = commitMessage;
this.branch = branch;
this.commitId = commitId;
}
public String getCommitMessage() {
return commitMessage;
}
public String getBranch() {
return branch;
}
public String getCommitId() {
return commitId;
}
}