RepositoryAspect { private Identifiable get(JoinPoint joinPoint){ return ((Repository<?>) joinPoint.getThis()).get(artifactId(joinPoint)); } @Inject  RepositoryAspect(WorkspaceResourceHandler handler); @After("execution(* org.bonitasoft.web.designer.repository.Repository+.updateLastUpdateAndSave(..)) ") void postSaveAndUpdateDate(JoinPoint joinPoint); @After("execution(* org.bonitasoft.web.designer.repository.Repository+.save(..))") void postSave(JoinPoint joinPoint); @Around("execution(* org.bonitasoft.web.designer.repository.AbstractRepository.delete(String))") void delete(JoinPoint joinPoint); @After("execution(* org.bonitasoft.web.designer.repository.Repository+.delete(String))") void postDelete(JoinPoint joinPoint);  }
@Test public void should_NOT_trigger_preOpen_workspaceResourceHandler_when_getting_a_form() throws Exception { formRepository.save(aPage().withId("aPageId").build()); formRepository.get("aPageId"); verify(workspaceResourceHandler, never()).preOpen(formRepository.resolvePath("aPageId")); }
@Test(expected = IllegalArgumentException.class) @Ignore("Test ignored until we find a solution for BS-14120") public void should_throw_an_IllegalArgumentException_when_getting_a_form_with_a_null_id() throws Exception { formRepository.get(null); }
@Test(expected = RepositoryException.class) @Ignore("Test ignored until we find a solution for BS-14120") public void should_throw_a_RepositoryException_when_getting_a_missing_resource() throws Exception { doThrow(ResourceNotFoundException.class).when(workspaceResourceHandler).preOpen(any(Path.class)); formRepository.get("a_form_id"); }
@Test(expected = RepositoryException.class) @Ignore("Test ignored until we find a solution for BS-14120") public void should_throw_a_RepositoryException_when_getting_a_locked_resource() throws Exception { doThrow(LockedResourceException.class).when(workspaceResourceHandler).preOpen(any(Path.class)); formRepository.get("a_form_id"); }