@Commit static class ClassLevelRollbackViaMetaAnnotationTestCase { public void test() { } }
@Commit public void test() { } }
@Commit interface RollbackFalseViaMetaAnnotationTestInterface { }
/** * Concrete subclass of {@link AbstractEjbTxDaoTests} which uses the * {@link RequiredEjbTxTestEntityDao} and sets the default rollback semantics * for the {@link TransactionalTestExecutionListener} to {@code false} (i.e., * <em>commit</em>). * * @author Sam Brannen * @since 4.0.1 */ @ContextConfiguration("required-tx-config.xml") @Commit public class CommitForRequiredEjbTxDaoTests extends AbstractEjbTxDaoTests { /* test methods in superclass */ }
/** * Concrete subclass of {@link AbstractEjbTxDaoTests} which uses the * {@link RequiresNewEjbTxTestEntityDao} and sets the default rollback semantics * for the {@link TransactionalTestExecutionListener} to {@code false} (i.e., * <em>commit</em>). * * @author Sam Brannen * @since 4.0.1 */ @ContextConfiguration("requires-new-tx-config.xml") @Commit public class CommitForRequiresNewEjbTxDaoTests extends AbstractEjbTxDaoTests { /* test methods in superclass */ }
/** * Concrete subclass of {@link AbstractEjbTxDaoTestNGTests} which uses the * {@link RequiresNewEjbTxTestEntityDao} and sets the default rollback semantics * for the {@link TransactionalTestExecutionListener} to {@code false} (i.e., * <em>commit</em>). * * @author Sam Brannen * @since 4.0.1 */ @Test(suiteName = "Commit for REQUIRES_NEW") @ContextConfiguration("/org/springframework/test/context/transaction/ejb/requires-new-tx-config.xml") @Commit public class CommitForRequiresNewEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { /* test methods in superclass */ }
/** * Concrete subclass of {@link AbstractEjbTxDaoTestNGTests} which uses the * {@link RequiredEjbTxTestEntityDao} and sets the default rollback semantics * for the {@link TransactionalTestExecutionListener} to {@code false} (i.e., * <em>commit</em>). * * @author Sam Brannen * @since 4.0.1 */ @Test(suiteName = "Commit for REQUIRED") @ContextConfiguration("/org/springframework/test/context/transaction/ejb/required-tx-config.xml") @Commit public class CommitForRequiredEjbTxDaoTestNGTests extends AbstractEjbTxDaoTestNGTests { /* test methods in superclass */ }
@Test(groups = { "createCustomerIdGeneration" }) @Commit @Transactional public void createCustomerIdGeneration() { IdGenerationImpl gen = em.find(IdGenerationImpl.class, "org.broadleafcommerce.profile.core.domain.Customer"); if (gen == null) { IdGeneration idGeneration = new IdGenerationImpl(); idGeneration.setType("org.broadleafcommerce.profile.core.domain.Customer"); idGeneration.setBatchStart(1L); idGeneration.setBatchSize(10L); em.persist(idGeneration); } }
@Test(groups = { "changeCustomerPassword" }, dependsOnGroups = { "readCustomer" }) @Transactional @Commit public void changeCustomerPasswords() { for (String userName : userNames) { Customer customer = customerService.readCustomerByUsername(userName); customer.setPassword(customer.getPassword() + "-Changed"); customerService.saveCustomer(customer); } }
@Test(groups = "createCustomerPhoneFromController", dataProvider = "setupCustomerPhoneControllerData", dataProviderClass = CustomerPhoneControllerTestDataProvider.class, dependsOnGroups = "readCustomer") @Transactional @Commit public void createCustomerPhoneFromController(PhoneNameForm phoneNameForm) { BindingResult errors = new BeanPropertyBindingResult(phoneNameForm, "phoneNameForm"); Customer customer = customerService.readCustomerByUsername("customer1"); request = this.getNewServletInstance(); request.setAttribute(CustomerStateRequestProcessor.getCustomerRequestAttributeName(), customer); String view = customerPhoneController.savePhone(phoneNameForm, errors, request, null, null); assert (view.indexOf(SUCCESS) >= 0); List<CustomerPhone> phones = customerPhoneService.readAllCustomerPhonesByCustomerId(userId); boolean inPhoneList = false; Long id = (Long) request.getAttribute("customerPhoneId"); assert (id != null); for (CustomerPhone p : phones) { if ((p.getPhoneName() != null) && p.getPhoneName().equals(phoneNameForm.getPhoneName())) { inPhoneList = true; } } assert (inPhoneList == true); createdCustomerPhoneIds.add(id); }
@Test @Commit public void rollbackTxAndStartNewTxWithDefaultCommitSemantics() { assertInTransaction(true); assertTrue(TestTransaction.isActive()); assertUsers("Dilbert"); deleteFromTables("user"); assertUsers(); // Rollback TestTransaction.flagForRollback(); assertTrue(TestTransaction.isFlaggedForRollback()); TestTransaction.end(); assertFalse(TestTransaction.isActive()); assertInTransaction(false); assertUsers("Dilbert"); // Start new transaction with default commit semantics TestTransaction.start(); assertInTransaction(true); assertFalse(TestTransaction.isFlaggedForRollback()); assertTrue(TestTransaction.isActive()); executeSqlScript("classpath:/org/springframework/test/context/jdbc/data-add-dogbert.sql", false); assertUsers("Dilbert", "Dogbert"); }
@Test @Commit public void rollbackTxAndStartNewTxWithDefaultCommitSemantics() { assertInTransaction(true); assertTrue(TestTransaction.isActive()); assertUsers("Dilbert"); deleteFromTables("user"); assertUsers(); // Rollback TestTransaction.flagForRollback(); assertTrue(TestTransaction.isFlaggedForRollback()); TestTransaction.end(); assertFalse(TestTransaction.isActive()); assertInTransaction(false); assertUsers("Dilbert"); // Start new transaction with default commit semantics TestTransaction.start(); assertInTransaction(true); assertFalse(TestTransaction.isFlaggedForRollback()); assertTrue(TestTransaction.isActive()); executeSqlScript("classpath:/org/springframework/test/context/jdbc/data-add-dogbert.sql", false); assertUsers("Dilbert", "Dogbert"); }
@Commit @Test public void testLocalizedAspect() throws Exception { nodeService.addAspect( rootNodeRef, ContentModel.ASPECT_LOCALIZED, Collections.<QName, Serializable>singletonMap(ContentModel.PROP_LOCALE, Locale.CANADA_FRENCH)); // commit to check }
@Commit public void disabled_test100Invites() throws Exception { Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE; String resourceName = SITE_SHORT_NAME_INVITE; String inviteeRole = SiteModel.SITE_COLLABORATOR; String serverPath = "wibble"; String acceptUrl = "froob"; String rejectUrl = "marshmallow"; authenticationComponent.setCurrentUser(USER_MANAGER); // Create 1000 invites for (int i = 0; i < 1000; i++) { invitationService.inviteNominated(USER_ONE, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl); } // Invite USER_TWO NominatedInvitation invite = invitationService.inviteNominated(USER_TWO, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl); InvitationSearchCriteriaImpl query = new InvitationSearchCriteriaImpl(); query.setInvitee(USER_TWO); long start = System.currentTimeMillis(); List<Invitation> results = invitationService.searchInvitation(query); long end= System.currentTimeMillis(); System.out.println("Invitation Search took " + (end - start) + "ms."); assertEquals(1, results.size()); assertEquals(invite.getInviteId(), results.get(0).getInviteId()); }
@Commit @Test public void testDelete() throws Exception
@Ignore @Commit @Test public void testRepositoryExport() { // Create a temp store to hold exports StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis()); NodeRef rootNode = nodeService.getRootNode(storeRef); FileInfo container = fileFolderService.create(rootNode, "export", ContentModel.TYPE_FOLDER); // Export stores RepositoryExportHandle[] handles = repositoryService.export(container.getNodeRef(), "test"); assertNotNull(handles); assertEquals(6, handles.length); for (RepositoryExportHandle handle : handles) { assertTrue(nodeService.exists(handle.exportFile)); } }
@Commit @Test public void testDeleteStore() throws Exception
@Commit @Test public void testDuplicateChildAssocCleanup() throws Exception { Map<QName, ChildAssociationRef> assocRefs = buildNodeGraph(); NodeRef n1Ref = assocRefs.get(QName.createQName(BaseNodeServiceTest.NAMESPACE,"root_p_n1")).getChildRef(); ChildAssociationRef n1pn3Ref = assocRefs.get(QName.createQName(BaseNodeServiceTest.NAMESPACE,"n1_p_n3")); // Recreate the association from n1 to n3 i.e. duplicate it QName assocQName = QName.createQName(BaseNodeServiceTest.NAMESPACE, "dup"); ChildAssociationRef dup1 = nodeService.addChild( n1pn3Ref.getParentRef(), n1pn3Ref.getChildRef(), n1pn3Ref.getTypeQName(), assocQName); ChildAssociationRef dup2 = nodeService.addChild( n1pn3Ref.getParentRef(), n1pn3Ref.getChildRef(), n1pn3Ref.getTypeQName(), assocQName); assertEquals("Duplicate not created", dup1, dup2); List<ChildAssociationRef> dupAssocs = nodeService.getChildAssocs(n1pn3Ref.getParentRef(), n1pn3Ref.getTypeQName(), assocQName); assertEquals("Expected duplicates", 2, dupAssocs.size()); // Now delete the specific association nodeService.removeChildAssociation(dup1); }
/** * Test <a href="https://issues.alfresco.com/jira/browse/ALFCOM-2299">ALFCOM-2299</a> * <p>Needs to be committed for good measure</p> */ @Commit @Test public void testAspectRemovalCascadeDelete() throws Exception { // Create a node to add the aspect to NodeRef sourceNodeRef = nodeService.createNode( rootNodeRef, ASSOC_TYPE_QNAME_TEST_CHILDREN, QName.createQName(BaseNodeServiceTest.NAMESPACE, "testAspectRemovalCascadeDelete"), ContentModel.TYPE_CONTAINER).getChildRef(); // Add the aspect to the source node and add a child using an association defined on the aspect nodeService.addAspect(sourceNodeRef, ASPECT_WITH_ASSOCIATIONS, null); NodeRef targetNodeRef = nodeService.createNode( sourceNodeRef, ASSOC_ASPECT_CHILD_ASSOC, QName.createQName(BaseNodeServiceTest.NAMESPACE, "testAspectRemovalCascadeDelete"), ContentModel.TYPE_CONTAINER).getChildRef(); assertTrue("Child node must exist", nodeService.exists(targetNodeRef)); // Now remove the aspect from the source node and check that the target node was cascade-deleted nodeService.removeAspect(sourceNodeRef, ASPECT_WITH_ASSOCIATIONS); assertFalse("Child node must have been cascade-deleted", nodeService.exists(targetNodeRef)); }
@Commit @Test public void testScriptNodeRevertWithChangeType()