Gets first step of the recipe working

* Reduces sbt version to be compatible with Baker
This commit is contained in:
julien Lengrand-Lambert
2017-05-05 07:38:20 +02:00
parent fe3f0b7ec9
commit 89c8ea57a7
9 changed files with 144 additions and 21 deletions

View File

@@ -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
View 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();
}
}

View 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();
}
}

View 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;
}
}

View File

@@ -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
)
;
}
}

View 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())
}
}

View File

@@ -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)
}
}

View 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

View File

@@ -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