Актуализация примеров на занятие 26 (SI: Endpoints и Flow Components) для группы 2019-08

This commit is contained in:
kataus
2019-12-04 18:27:25 +03:00
parent cf2abf5f16
commit 22e5a2b6ab
2 changed files with 5 additions and 17 deletions
@@ -60,25 +60,14 @@ public class App {
while ( true ) {
Thread.sleep( 1000 );
Collection<OrderItem> items = generateOrderItems();
OrderItem items = generateOrderItem();
System.out.println( "New orderItems: " +
items.stream().map( OrderItem::getItemName )
.collect( Collectors.joining( "," ) ) );
Collection<Food> food = cafe.process( items );
System.out.println( "Ready food: " + food.stream()
.map( Food::getName )
.collect( Collectors.joining( "," ) ) );
items.getItemName() );
Food food = cafe.process( items );
System.out.println( "Ready food: " + food.getName() );
}
}
private static Collection<OrderItem> generateOrderItems() {
List<OrderItem> items = new ArrayList<>();
for ( int i = 0; i < RandomUtils.nextInt( 1, 5 ); ++ i ) {
items.add( generateOrderItem() );
}
return items;
}
private static OrderItem generateOrderItem() {
return new OrderItem( MENU[ RandomUtils.nextInt( 0, MENU.length ) ] );
}
@@ -1,6 +1,5 @@
package ru.otus.spring.integration;
import ru.otus.spring.integration.domain.Food;
import ru.otus.spring.integration.domain.OrderItem;
@@ -10,5 +9,5 @@ import java.util.Collection;
public interface Cafe {
// TODO: add gateway annotation with required channels
Collection<Food> process( Collection<OrderItem> orderItem );
Food process( OrderItem orderItem);
}