@Test public void testSynchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException, InterruptedException { int expected = 5; ProductService mock = EasyMock.createNiceMock (ProductService.class); EasyMock.expect (mock.processArchiveSync ()).andReturn (expected); EasyMock.replay (mock); archiveService.setDefaultDataStore (mock); int result = archiveService.synchronizeLocalArchive (); Assert.assertEquals (result, expected); expected = -1; mock = EasyMock.createNiceMock (ProductService.class); EasyMock.expect (mock.processArchiveSync ()).andThrow ( new InterruptedException ()); EasyMock.replay (mock); archiveService.setDefaultDataStore (mock); result = archiveService.synchronizeLocalArchive (); Assert.assertEquals (result, expected); }
@PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") public int synchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException { try { return productService.processArchiveSync(); } catch (InterruptedException e) { LOGGER.warn("Synchronization stopped by the user."); } return -1; }
ArchiveService extends WebService { @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") public int synchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException { try { return productService.processArchiveSync(); } catch (InterruptedException e) { LOGGER.warn("Synchronization stopped by the user."); } return -1; } }
ArchiveService extends WebService { @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") public int synchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException { try { return productService.processArchiveSync(); } catch (InterruptedException e) { LOGGER.warn("Synchronization stopped by the user."); } return -1; }  }
ArchiveService extends WebService { @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") public int synchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException { try { return productService.processArchiveSync(); } catch (InterruptedException e) { LOGGER.warn("Synchronization stopped by the user."); } return -1; }  @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") int synchronizeLocalArchive(); }
ArchiveService extends WebService { @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") public int synchronizeLocalArchive () throws DataStoreLocalArchiveNotExistingException { try { return productService.processArchiveSync(); } catch (InterruptedException e) { LOGGER.warn("Synchronization stopped by the user."); } return -1; }  @PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')") int synchronizeLocalArchive();  }