mirror of
https://github.com/jlengrand/baker-recipe-tuto.git
synced 2026-03-10 08:01:22 +00:00
Gets first step of the recipe working
* Reduces sbt version to be compatible with Baker
This commit is contained in:
@@ -2,5 +2,6 @@ name := "baker-recipe-tuto"
|
||||
|
||||
version := "1.0"
|
||||
|
||||
scalaVersion := "2.12.2"
|
||||
scalaVersion := "2.11.8"
|
||||
libraryDependencies += "com.ing" % "baker_2.11" % "0.2.30"
|
||||
libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.21"
|
||||
|
||||
24
src/main/java/Runner.java
Normal file
24
src/main/java/Runner.java
Normal file
@@ -0,0 +1,24 @@
|
||||
import com.ing.baker.java_api.JCompiledRecipe;
|
||||
import com.ing.baker.java_api.JInteractionDescriptor;
|
||||
import com.ing.baker.java_api.JRecipe;
|
||||
import erwtensoep.events.BoodschappenGedaan;
|
||||
import erwtensoep.events.KitchenToolsReady;
|
||||
import erwtensoep.interactions.SoupPreheating;
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
public class Runner {
|
||||
|
||||
public static void main(String[] args){
|
||||
JRecipe recipe = new JRecipe("ErwtenSoepRecipe")
|
||||
.withInteraction(
|
||||
JInteractionDescriptor.of(SoupPreheating.class))
|
||||
.withSensoryEvents(
|
||||
KitchenToolsReady.class,
|
||||
BoodschappenGedaan.class
|
||||
);
|
||||
|
||||
JCompiledRecipe compiledRecipe = recipe.compileRecipe();
|
||||
}
|
||||
}
|
||||
28
src/main/java/erwtensoep/interactions/SoupPreheating.java
Normal file
28
src/main/java/erwtensoep/interactions/SoupPreheating.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package erwtensoep.interactions;
|
||||
|
||||
import com.ing.baker.java_api.JInteraction;
|
||||
import com.ing.baker.java_api.ProvidesIngredient;
|
||||
import com.ing.baker.java_api.RequiresIngredient;
|
||||
import erwtensoep.events.HeatedBasicSoup;
|
||||
import erwtensoep.ingredients.*;
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
public class SoupPreheating implements JInteraction{
|
||||
|
||||
@ProvidesIngredient("HeatedBasicSoup")
|
||||
public HeatedBasicSoup apply(
|
||||
@RequiresIngredient("water") Water water,
|
||||
@RequiresIngredient("laurier") Laurier laurier,
|
||||
@RequiresIngredient("rookspek") RookSpek rookSpek,
|
||||
@RequiresIngredient("hamschrijf") Hamschijf hamschijf,
|
||||
@RequiresIngredient("zout") Zout zout,
|
||||
@RequiresIngredient("pan") Pan pan,
|
||||
@RequiresIngredient("lepel") Lepel lepel,
|
||||
@RequiresIngredient("gasFournuis") GasFournuis gasFournuis
|
||||
){
|
||||
System.out.println("Interaction HeatedBasicSoup");
|
||||
return new HeatedBasicSoup();
|
||||
}
|
||||
}
|
||||
37
src/main/java/erwtensoep/recipes/ErwtenSoepRecipe.java
Normal file
37
src/main/java/erwtensoep/recipes/ErwtenSoepRecipe.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package erwtensoep.recipes;
|
||||
|
||||
import com.ing.baker.compiler.Recipe;
|
||||
import com.ing.baker.core.InteractionDescriptor;
|
||||
import com.ing.baker.core.InteractionFailureStrategy;
|
||||
import scala.collection.Seq;
|
||||
import scala.collection.immutable.Set;
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
public class ErwtenSoepRecipe implements Recipe {
|
||||
@Override
|
||||
public String name() {
|
||||
return "ErwtenSoepRecipe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Seq<InteractionDescriptor<?>> interactionDescriptors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Seq<InteractionDescriptor<?>> sieveDescriptors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Class<?>> events() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionFailureStrategy defaultFailureStrategy() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package erwtensoep.recipes;
|
||||
|
||||
import com.ing.baker.java_api.JInteractionDescriptor;
|
||||
import com.ing.baker.java_api.JRecipe;
|
||||
import erwtensoep.events.BoodschappenGedaan;
|
||||
import erwtensoep.events.KitchenToolsReady;
|
||||
import erwtensoep.interactions.SoupPreheating;
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
public final class ErwtenSoepRecipeCreator {
|
||||
|
||||
public JRecipe createRecipe(){
|
||||
return new JRecipe("ErwtenSoepRecipe")
|
||||
.withInteraction(
|
||||
JInteractionDescriptor.of(SoupPreheating.class))
|
||||
.withSensoryEvents(
|
||||
KitchenToolsReady.class,
|
||||
BoodschappenGedaan.class
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
19
src/main/scala/ErwtenSoepCooker.scala
Normal file
19
src/main/scala/ErwtenSoepCooker.scala
Normal file
@@ -0,0 +1,19 @@
|
||||
import com.ing.baker.java_api.JCompiledRecipe
|
||||
import erwtensoep.events.KitchenToolsReady
|
||||
import erwtensoep.ingredients.SplitErwten
|
||||
import erwtensoep.recipes.{ErwtenSoepRecipe, ErwtenSoepRecipeCreator}
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
object ErwtenSoepCooker {
|
||||
def main(args: Array[String]): Unit = {
|
||||
|
||||
// Let's create a recipe and validate it
|
||||
val recipeCreator = new ErwtenSoepRecipeCreator
|
||||
val recipe = recipeCreator.createRecipe()
|
||||
val compiledRecipe = recipe.compileRecipe
|
||||
|
||||
println(compiledRecipe.getRecipeVisualization())
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import erwtensoep.events.KitchenToolsReady
|
||||
import erwtensoep.ingredients.SplitErwten
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
object HelloWorld {
|
||||
def main(args: Array[String]): Unit = {
|
||||
println("Hello, world!")
|
||||
|
||||
val test = new SplitErwten();
|
||||
println(test.toString)
|
||||
|
||||
val testEvent = new KitchenToolsReady
|
||||
println(testEvent.pan)
|
||||
}
|
||||
}
|
||||
8
src/main/scala/erwtensoep/events/HeatedBasicSoup.scala
Normal file
8
src/main/scala/erwtensoep/events/HeatedBasicSoup.scala
Normal file
@@ -0,0 +1,8 @@
|
||||
package erwtensoep.events
|
||||
|
||||
import com.ing.baker.api.Ingredient
|
||||
|
||||
/**
|
||||
* Created by jll on 5/4/2017.
|
||||
*/
|
||||
class HeatedBasicSoup extends Ingredient
|
||||
@@ -7,9 +7,7 @@ import com.ing.baker.api.Ingredient
|
||||
*/
|
||||
class KitchenTools
|
||||
|
||||
class Pan extends Ingredient {
|
||||
override def toString: String = "Pan"
|
||||
}
|
||||
class Pan extends Ingredient
|
||||
class Mes extends Ingredient
|
||||
class Lepel extends Ingredient
|
||||
class GasFournuis extends Ingredient
|
||||
|
||||
Reference in New Issue
Block a user