Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix ngsa-java linter issues (#65)
Browse files Browse the repository at this point in the history
* Removed duplicate entries

* Fix linter issues
  • Loading branch information
joaquinrz authored Sep 1, 2021
1 parent cb91e40 commit c22b4a9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
log/

.idea
.DS_Store

.vscode
.vscode/*
!.vscode/settings.json
Expand All @@ -60,10 +58,6 @@ buildNumber.properties

# Mac
.DS_Store

# Maven
log/
target/

run.sh
t.sh
Expand All @@ -80,6 +74,5 @@ drun.sh
singletest.sh
run_with_appinsights.sh
druncli.sh
.DS_Store

CosmosKey*
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void createExtendAndIncrementCorrelationVectorV1() {
@Test
public void createExtendAndIncrementCorrelationVectorV2() {
final CorrelationVector cv = new CorrelationVector(CorrelationVectorVersion.V2);
Assert.assertEquals(cv.getVersion(), CorrelationVectorVersion.V2);
Assert.assertEquals(CorrelationVectorVersion.V2,cv.getVersion());

final String[] splitCv = cv.getValue().split("\\.");

Expand Down
2 changes: 2 additions & 0 deletions ngsa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
</configuration>
<executions>
<execution>
<?m2e execute onConfiguration,onIncremental?>
<id>validate</id>
<phase>compile</phase>
<goals>
Expand Down Expand Up @@ -265,6 +266,7 @@
</configuration>
<executions>
<execution>
<?m2e execute onConfiguration,onIncremental?>
<phase>compile</phase>
<goals>
<goal>check</goal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class MoviesController extends Controller {
@Autowired MoviesDao moviesDao;

private static final Logger logger = LogManager.getLogger(MoviesController.class);
private static final String INVALID_MOVIE_MSG = "Invalid Movie ID parameter {0}";

/** getMovie. */
@GetMapping(value = "/{id}")
Expand All @@ -62,7 +63,7 @@ public Object getMovie(
new ResponseStatusException(HttpStatus.NOT_FOUND, "Movie Not Found"))));
} else {

logger.warn(MessageFormat.format("Invalid Movie ID parameter {0}", movieId));
logger.warn(MessageFormat.format(INVALID_MOVIE_MSG, movieId));

String invalidResponse = super.invalidParameterResponses
.invalidMovieDirectReadResponse(request.getURI().getPath());
Expand Down Expand Up @@ -90,7 +91,7 @@ public Object upsertMovie(
if (Boolean.TRUE.equals(validator.isValidMovieId(movieIdOrig) && movieId.startsWith("zz"))) {
return moviesDao.upsertMovieById(movieIdOrig);
} else {
logger.warn(MessageFormat.format("Invalid Movie ID parameter {0}", movieId));
logger.warn(MessageFormat.format(INVALID_MOVIE_MSG, movieId));
String invalidResponse = super.invalidParameterResponses
.invalidMovieDeleteResponse(request.getURI().getPath());
return ResponseEntity.badRequest()
Expand All @@ -116,7 +117,7 @@ public Object deleteMovie(
&& movieId.startsWith("zz")) {
return moviesDao.deleteMovieById(movieId);
} else {
logger.warn(MessageFormat.format("Invalid Movie ID parameter {0}", movieId));
logger.warn(MessageFormat.format(INVALID_MOVIE_MSG, movieId));
String invalidResponse = super.invalidParameterResponses
.invalidMovieDeleteResponse(request.getURI().getPath());
return ResponseEntity.badRequest()
Expand Down
2 changes: 1 addition & 1 deletion ngsa/src/main/java/com/cse/ngsa/app/dao/MoviesDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Mono<ResponseEntity<Object>> deleteMovieById(String movieId) {
.delete().flatMap(
cosmosItemResponse ->
Mono.just(ResponseEntity.status(HttpStatus.NO_CONTENT).build()))
.onErrorResume((e) -> {
.onErrorResume(e -> {
if (e.getMessage().contains("Resource Not Found")) {
return Mono.just(ResponseEntity.status(HttpStatus.NO_CONTENT).build());
}
Expand Down
3 changes: 1 addition & 2 deletions ngsa/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<script>
window.onload = function() {
// begin Swagger UI call region
const ui = SwaggerUIBundle({
window.ui = SwaggerUIBundle({
url: '/swagger.json',
dom_id: '#swagger-ui',
deepLinking: true,
Expand All @@ -59,7 +59,6 @@
})
// end Swagger UI call region

window.ui = ui
}
</script>
</body>
Expand Down

0 comments on commit c22b4a9

Please sign in to comment.