This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Create transaction and read balance | |
| Background: | |
| * url baseUrl | |
| * def genUUID = function(){ return java.util.UUID.randomUUID() + '' } | |
| * def userId = callonce genUUID | |
| * def transactionRequest = { userId: '#(userId)', amount: 10 } | |
| Scenario: Create transaction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
| @ContextConfiguration(initializers = ContainersSetupIT.Initializer.class) | |
| public class BalanceControllerIT { | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <dependency> | |
| <groupId>org.testcontainers</groupId> | |
| <artifactId>postgresql</artifactId> | |
| <version>1.14.1</version> | |
| <scope>test</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.testcontainers</groupId> | |
| <artifactId>kafka</artifactId> | |
| <version>1.14.1</version> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ContainersSetupIT { | |
| public static PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:12.2") | |
| .withDatabaseName("financial"); | |
| public static KafkaContainer kafka = new KafkaContainer(); | |
| public static class Initializer implements | |
| ApplicationContextInitializer<ConfigurableApplicationContext> { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ParalyzedFetchWeather { | |
| private static final ForkJoinPool forkJoinPool = new ForkJoinPool(); | |
| private static final long TIMEOUT_MINUTES = 60; | |
| private WeatherClient weatherClient; | |
| public List<WeatherDetailsDTO> fetchWeather(List<String> cities) { | |
| List<WeatherDetailsDTO> weathers = Collections.synchronizedList(new ArrayList<>()); | |
| cities.forEach(city -> forkJoinPool.submit(() -> weathers.add(weatherClient.getWeather(city)))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWS.config.update({ | |
| accessKeyId: 'KEY_ID', | |
| secretAccessKey: 'ACCESS_KEY' | |
| }); | |
| let sqs = new AWS.SQS(); | |
| function processEvent(event, context, callback) { | |
| function processMessage() { | |
| let params = { | |
| MessageBody: JSON.stringify(event.body), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let sqs = new AWS.SQS({ | |
| region: 'us-west-2' | |
| }); | |
| let params = { | |
| MessageBody: JSON.stringify(event.body), | |
| QueueUrl: SQS_URL | |
| }; | |
| sqs.sendMessage(params, function(error, data) { |