private void checkStores(List<ContentStore> stores) { // check that list is not empty assertEquals(false, stores.isEmpty()); // check for null entry for (ContentStore store : stores) { if (store == null) { isNullEntry = true; } } }
public void testGetAllStores() throws Exception { final RetryingTransactionCallback<Object> txnWork = new RetryingTransactionCallback<Object>() { public Boolean execute() throws Exception { // The listener final TestAfterRollbackTxnListener listener = new TestAfterRollbackTxnListener(); AlfrescoTransactionSupport.bindListener(listener); NodeRef content = createContent(serviceRegistry); ContentWriter writer = contentService.getWriter(content, ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.putContent("The quick brown fox jumps over the lazy dog"); throw new AlfrescoRuntimeException("Some error that causes RollBack. The transaction will be closed"); } }; try { serviceRegistry.getTransactionService().getRetryingTransactionHelper().doInTransaction(txnWork, false, false); } catch (AlfrescoRuntimeException e) { // Expected } assertFalse("getAllStores method returned the list with null entry", isNullEntry); }