use of org.eclipse.che.api.machine.server.recipe.RecipeImpl in project che by eclipse.
the class RecipeTypeAdapter method deserialize.
@Override
public Recipe deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException {
final RecipeImpl recipe = new RecipeImpl();
final JsonObject recipeObj = element.getAsJsonObject();
recipe.setType(recipeObj.get("type") == null ? null : recipeObj.get("type").getAsString());
recipe.setScript(recipeObj.get("script") == null ? null : recipeObj.get("script").getAsString());
return recipe;
}
use of org.eclipse.che.api.machine.server.recipe.RecipeImpl in project che by eclipse.
the class JpaTckModule method configure.
@Override
protected void configure() {
install(new JpaPersistModule("main"));
bind(DBInitializer.class).asEagerSingleton();
bind(SchemaInitializer.class).toInstance(new FlywaySchemaInitializer(H2TestHelper.inMemoryDefault(), "che-schema"));
bind(TckResourcesCleaner.class).to(H2JpaCleaner.class);
bind(new TypeLiteral<TckRepository<RecipeImpl>>() {
}).toInstance(new JpaTckRepository<>(RecipeImpl.class));
bind(new TypeLiteral<TckRepository<SnapshotImpl>>() {
}).toInstance(new JpaTckRepository<>(SnapshotImpl.class));
bind(new TypeLiteral<TckRepository<Workspace>>() {
}).toInstance(new TestWorkspacesTckRepository());
bind(new TypeLiteral<TckRepository<AccountImpl>>() {
}).toInstance(new JpaTckRepository<>(AccountImpl.class));
bind(RecipeDao.class).to(JpaRecipeDao.class);
bind(SnapshotDao.class).to(JpaSnapshotDao.class);
}
use of org.eclipse.che.api.machine.server.recipe.RecipeImpl in project che by eclipse.
the class RecipeDaoTest method shouldUpdateRecipe.
@Test
public void shouldUpdateRecipe() throws Exception {
final RecipeImpl update = recipes.get(0).withName("updatedName");
assertEquals(recipeDao.update(update), update);
}
use of org.eclipse.che.api.machine.server.recipe.RecipeImpl in project che by eclipse.
the class RecipeDaoTest method shouldNotRemoveRecipeWhenSubscriberThrowsExceptionOnRecipeRemoving.
@Test(dependsOnMethods = "shouldGetRecipeById")
public void shouldNotRemoveRecipeWhenSubscriberThrowsExceptionOnRecipeRemoving() throws Exception {
final RecipeImpl recipe = recipes.get(0);
CascadeEventSubscriber<BeforeRecipeRemovedEvent> subscriber = mockCascadeEventSubscriber();
doThrow(new ServerException("error")).when(subscriber).onCascadeEvent(any());
eventService.subscribe(subscriber, BeforeRecipeRemovedEvent.class);
try {
recipeDao.remove(recipe.getId());
fail("RecipeDao#remove had to throw server exception");
} catch (ServerException ignored) {
}
assertEquals(recipeDao.getById(recipe.getId()), recipe);
eventService.unsubscribe(subscriber, BeforeRecipeRemovedEvent.class);
}
use of org.eclipse.che.api.machine.server.recipe.RecipeImpl in project che by eclipse.
the class RecipeDaoTest method shouldGetRecipeById.
@Test
public void shouldGetRecipeById() throws Exception {
final RecipeImpl recipe = recipes.get(0);
assertEquals(recipeDao.getById(recipe.getId()), recipe);
}
Aggregations