use of org.rembx.jeeshop.catalog.model.Catalog in project jeeshop by remibantos.
the class CatalogsCT method create_shouldSetupOwner_for_admin.
@Test
public void create_shouldSetupOwner_for_admin() {
tester.setAdminUser();
Catalog catalog = new Catalog("Catalog");
catalog.setOwner(TestCatalog.OWNER);
Catalog actualCatalog = tester.test_create(catalog);
assertThat(actualCatalog).isNotNull();
assertThat(actualCatalog.getOwner()).isEqualTo(TestCatalog.OWNER);
}
use of org.rembx.jeeshop.catalog.model.Catalog in project jeeshop by remibantos.
the class CatalogsCT method delete_shouldRemove.
@Test
public void delete_shouldRemove() {
tester.setStoreAdminUser();
Catalog catalog = new Catalog("Test Catalog");
catalog.setOwner(TestCatalog.OWNER);
tester.test_delete(catalog);
assertThat(tester.getEntityManager().find(Catalog.class, catalog.getId())).isNull();
}
use of org.rembx.jeeshop.catalog.model.Catalog in project jeeshop by remibantos.
the class Catalogs method delete.
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@RolesAllowed(ADMIN)
@Path("/{catalogId}")
public void delete(@PathParam("catalogId") Long catalogId) {
Catalog catalog = entityManager.find(Catalog.class, catalogId);
checkNotNull(catalog);
entityManager.remove(catalog);
}
use of org.rembx.jeeshop.catalog.model.Catalog in project jeeshop by remibantos.
the class CatalogsCT method create_shouldPersist.
@Test
public void create_shouldPersist() {
Catalog catalog = new Catalog("New Test Catalog");
entityManager.getTransaction().begin();
service.create(catalog);
entityManager.getTransaction().commit();
assertThat(entityManager.find(Catalog.class, catalog.getId())).isNotNull();
entityManager.remove(catalog);
}
use of org.rembx.jeeshop.catalog.model.Catalog in project jeeshop by remibantos.
the class Catalogs method findPresentationByLocale.
@Path("/{catalogId}/presentations/{locale}")
@PermitAll
public PresentationResource findPresentationByLocale(@PathParam("catalogId") @NotNull Long catalogId, @NotNull @PathParam("locale") String locale) {
Catalog catalog = entityManager.find(Catalog.class, catalogId);
checkNotNull(catalog);
Presentation presentation = catalog.getPresentationByLocale().get(locale);
return presentationResource.init(catalog, locale, presentation);
}
Aggregations