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
35 changes: 15 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<version>3.2.12</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
Expand Down Expand Up @@ -43,7 +48,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20200518</version>
<version>20240303</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -54,38 +59,29 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
<version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>

</dependencies>

<properties>
<java.version>1.8</java.version>
<java.version>21</java.version>
</properties>

<build>
Expand All @@ -97,10 +93,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.14.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<release>${java.version}</release>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import software.amazon.awssdk.services.appconfig.AppConfigClient;
import software.amazon.awssdk.services.appconfig.model.GetConfigurationResponse;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.validation.Valid;

import static org.springframework.web.bind.annotation.RequestMethod.POST;
import jakarta.validation.Valid;

@RestController
public class MoviesController {
Expand Down Expand Up @@ -109,8 +107,8 @@ public String movie() {
}
}

@RequestMapping(value = "/movies/{movie}/edit", method = POST)
public String processUpdateMovie(@Valid Movie movie, BindingResult result, @PathVariable("movieId") int movieId) {
@PostMapping("/movies/{movie}/edit")
public String processUpdateMovie(@Valid Movie movie, BindingResult result, @PathVariable int movieId) {
if (!MovieUtils.isValidMovieName(movie.getMovieName())) {
result.rejectValue("name", "error.name", "Invalid movie name");
return "editMovieForm";
Expand Down
29 changes: 15 additions & 14 deletions src/main/java/com/amazonaws/samples/appconfig/utils/Math.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
//example from https://docs.openrewrite.org/running-recipes/popular-recipe-guides/migrate-to-java-17
package com.amazonaws.samples.appconfig.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class Math {
Boolean bool = new Boolean(true);
Byte b = new Byte("1");
Character c = new Character('c');
Double d = new Double(1.0);
Float f = new Float(1.1f);
Long l = new Long(1);
Short sh = new Short("12");
Boolean bool = Boolean.valueOf(true);
Byte b = Byte.valueOf("1");
Character c = Character.valueOf('c');
Double d = Double.valueOf(1.0);
Float f = Float.valueOf(1.1f);
Long l = Long.valueOf(1);
Short sh = Short.valueOf("12");
short s3 = 3;
Short sh3 = new Short(s3);
Integer i = new Integer(1);
Short sh3 = Short.valueOf(s3);
Integer i = Integer.valueOf(1);

public void divide() {
BigDecimal bd = BigDecimal.valueOf(10);
BigDecimal bd2 = BigDecimal.valueOf(2);
bd.divide(bd2, BigDecimal.ROUND_DOWN);
bd.divide(bd2, 1);
bd.divide(bd2, 1, BigDecimal.ROUND_CEILING);
bd.divide(bd2, 1, 1);
bd.setScale(2, 1);
bd.divide(bd2, RoundingMode.DOWN);
bd.divide(bd2, RoundingMode.DOWN);
bd.divide(bd2, 1, RoundingMode.CEILING);
bd.divide(bd2, 1, RoundingMode.DOWN);
bd.setScale(2, RoundingMode.DOWN);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.amazonaws.samples.appconfig.movies;

import org.junit.Test;

import java.math.BigDecimal;
import java.math.RoundingMode;

import com.amazonaws.samples.appconfig.utils.Math;

import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class MathTest {

Expand All @@ -18,21 +20,21 @@ public void testDivide() {
BigDecimal bd = BigDecimal.valueOf(10);
BigDecimal bd2 = BigDecimal.valueOf(2);
BigDecimal expectedResult1 = BigDecimal.valueOf(5);
assertEquals(expectedResult1, bd.divide(bd2, BigDecimal.ROUND_DOWN));
assertEquals(expectedResult1, bd.divide(bd2, RoundingMode.DOWN));

// Test divide(BigDecimal, int)
BigDecimal expectedResult2 = BigDecimal.valueOf(5.0);

// Test divide(BigDecimal, int, int)
BigDecimal expectedResult3 = BigDecimal.valueOf(5.0);
assertEquals(expectedResult3, bd.divide(bd2, 1, BigDecimal.ROUND_CEILING));
assertEquals(expectedResult3, bd.divide(bd2, 1, RoundingMode.CEILING));

BigDecimal expectedResult4 = BigDecimal.valueOf(5.0);
assertEquals(expectedResult4, bd.divide(bd2, 1, 1));
assertEquals(expectedResult4, bd.divide(bd2, 1, RoundingMode.DOWN));

// Test setScale(int, int)
BigDecimal expectedResult5 = BigDecimal.valueOf(10);
bd.setScale(2, 1);
bd.setScale(2, RoundingMode.DOWN);
assertEquals(expectedResult5, bd);
}
}
56 changes: 56 additions & 0 deletions summary/buildCommandOutput.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< org.amazonaws.samples:movie-service >-----------------
[INFO] Building movie-service 0.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.3.2:clean (default-clean) @ movie-service ---
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ movie-service ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO]
[INFO] --- maven-compiler-plugin:3.14.0:compile (default-compile) @ movie-service ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 9 source files with javac [debug parameters release 21] to target/classes
[INFO] Annotation processing is enabled because one or more processors were found
on the class path. A future release of javac may disable annotation processing
unless at least one processor is specified by name (-processor), or a search
path is specified (--processor-path, --processor-module-path), or annotation
processing is enabled explicitly (-proc:only, -proc:full).
Use -Xlint:-options to suppress this message.
Use -proc:none to disable annotation processing.
[INFO]
[INFO] --- maven-resources-plugin:3.3.1:testResources (default-testResources) @ movie-service ---
[INFO] skip non existing resourceDirectory /tmp/originalCopy_53ab3758-8530-47a8-920e-ecc32b663ebf_588a0b62-85c5-4058-86a9-3407babc676a/sources/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.14.0:testCompile (default-testCompile) @ movie-service ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 1 source file with javac [debug parameters release 21] to target/test-classes
[INFO] Annotation processing is enabled because one or more processors were found
on the class path. A future release of javac may disable annotation processing
unless at least one processor is specified by name (-processor), or a search
path is specified (--processor-path, --processor-module-path), or annotation
processing is enabled explicitly (-proc:only, -proc:full).
Use -Xlint:-options to suppress this message.
Use -proc:none to disable annotation processing.
[INFO]
[INFO] --- maven-surefire-plugin:3.1.2:test (default-test) @ movie-service ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.amazonaws.samples.appconfig.movies.MathTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 s -- in com.amazonaws.samples.appconfig.movies.MathTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.136 s
[INFO] Finished at: 2025-09-18T12:51:12Z
[INFO] ------------------------------------------------------------------------
5 changes: 5 additions & 0 deletions summary/qct-icons/transform-build-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions summary/qct-icons/transform-clock-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions summary/qct-icons/transform-dependencies-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions summary/qct-icons/transform-dependencyAnalyzer-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions summary/qct-icons/transform-file-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions summary/qct-icons/transform-listFiles-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions summary/qct-icons/transform-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions summary/qct-icons/transform-smartStepInto-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions summary/qct-icons/transform-step-into-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading