Skip to content

Commit

Permalink
Merge pull request #311 from zipdabang/refactor/296
Browse files Browse the repository at this point in the history
Refactor/296 parallelStream + Async 혼합 테스트
  • Loading branch information
Hanvp authored Feb 4, 2024
2 parents 73fac7b + 1045584 commit 5db1118
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/zipdabang/server/converter/RecipeConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ public static TestRecipe toTestRecipe(RecipeRequestDto.CreateRecipeDto request,


public static CompletableFuture<List<TestRecipeCategoryMapping>> toTestRecipeCategory(List<Long> categoryIds, TestRecipe recipe) {
return CompletableFuture.completedFuture(categoryIds.stream()
return CompletableFuture.completedFuture(categoryIds.stream().parallel()
.map(recipeCategoryId -> toTestRecipeCategoryMappingDto(recipeCategoryId, recipe))
.collect(Collectors.toList()));
}
Expand All @@ -762,7 +762,7 @@ private static TestRecipeCategoryMapping toTestRecipeCategoryMappingDto(Long cat
}

public static CompletableFuture<List<TestStep>> toTestStep(RecipeRequestDto.CreateRecipeDto request, TestRecipe recipe, List<MultipartFile> stepImages) {
return CompletableFuture.completedFuture(request.getSteps().stream()
return CompletableFuture.completedFuture(request.getSteps().stream().parallel()
.map(step-> {
if (step.getDescription() == null)
throw new RecipeException(CommonStatus.NULL_RECIPE_ERROR);
Expand Down Expand Up @@ -805,7 +805,7 @@ private static TestStep toTestStepDto(RecipeRequestDto.StepDto step, TestRecipe
}

public static CompletableFuture<List<TestIngredient>> toTestIngredient(RecipeRequestDto.CreateRecipeDto request, TestRecipe recipe) {
return CompletableFuture.completedFuture(request.getIngredients().stream()
return CompletableFuture.completedFuture(request.getIngredients().stream().parallel()
.map(ingredient -> toTestIngredientDto(ingredient, recipe))
.collect(Collectors.toList()));
}
Expand Down

0 comments on commit 5db1118

Please sign in to comment.