Examples of TransactionCallback


Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void findCandidatesByContentProvider() throws Exception {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                String candidateRepoName = "candidate with source";
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void importCandidateRepo() throws Exception {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                Repo candidate = new Repo("create me");
                candidate.setCandidate(true);
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void importCandidateRepoBadId() throws Exception {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                try {
                    List<Integer> repoIds = new ArrayList<Integer>(1);
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void importNonCandidateRepo() throws Exception {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                Repo nonCandidate = new Repo("create me");
                Repo created = repoManager.createRepo(overlord, nonCandidate);
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void deleteCandidatesForContentSource() throws Exception {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                ContentSourceType contentSourceType = new ContentSourceType("testSourceType");
                Set<ContentSourceType> types = new HashSet<ContentSourceType>(1);
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

    @Test(enabled = ENABLED)
    public void updateRepoWithProvider() throws Exception {
        // See BZ 537216 for more details

        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                String newName = "newRepo-" + RandomStringUtils.randomAlphanumeric(6);
                String oldName = "testRepo-" + RandomStringUtils.randomAlphanumeric(6);
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        });
    }

    @Test(enabled = ENABLED)
    public void updateSyncSchedule() {
        executeInTransaction(new TransactionCallback() {

            public void execute() throws Exception {

                Repo repo = new Repo("updateSyncSchedule");
                repo.setSyncSchedule("NOT A VALID CRON");
View Full Code Here

Examples of org.rhq.enterprise.server.test.TransactionCallback

        definition.setBasedir(new DriftDefinition.BaseDirectory(fileSystem, "/foo/bar/test"));

        final DriftDefinitionTemplate newTemplate = templateMgr.createTemplate(getOverlord(), resourceType.getId(),
            true, definition);

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceType updatedType = em.find(ResourceType.class, resourceType.getId());

                assertEquals("Failed to add new drift definition to resource type", 1, updatedType
View Full Code Here

Examples of org.springframework.transaction.support.TransactionCallback

  public static final String HIBERNATE_HOTEL_ADDRESS = "Hibernate Address";

  private TransactionTemplate hibernateTransactionTemplate;

  public void testHibernateIntegration() {
    hibernateTransactionTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        // Testing access through HibernateTemplate
        Hotel hotel = (Hotel)getHibernateTemplate().execute(new HibernateCallback() {
          public Object doInHibernate(org.hibernate.Session session) throws HibernateException, SQLException {
            return getFirstHotel(session);
          }
        });
        hotel.setName(HIBERNATE_HOTEL_NAME);
        return null;
      }
    });
    hibernateTransactionTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        // Testing access through SessionFactory.getCurrentSession()
        Hotel hotel = getFirstHotel(getSessionFactory().getCurrentSession());
        if (!HIBERNATE_HOTEL_NAME.equals(hotel.getName())) {
          throw new RuntimeException("Hotel name not set.  Hibernate integration not working.");
        }
        hotel.setAddress(HIBERNATE_HOTEL_ADDRESS);
        return null;
      }
    });
    hibernateTransactionTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        // Testing access through SessionFactory.getCurrentSession()
        Hotel hotel = getFirstHotel(getSessionFactory().getCurrentSession());
        if (!HIBERNATE_HOTEL_ADDRESS.equals(hotel.getAddress())) {
          throw new RuntimeException("Hotel address not set.  Hibernate integration not working.");
View Full Code Here

Examples of org.springframework.transaction.support.TransactionCallback

  public void testStatefulInTransaction() {
    final Jsr94Template template = getTemplate("ruleSource");
    final Jsr94TransactionManager transactionManager = new Jsr94TransactionManager();
    transactionManager.setRuleSource(template.getRuleSource());
    final TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
    List result = (List) txTemplate.execute(new TransactionCallback() {

          /* (non-Javadoc)
           * @see org.springframework.transaction.support.TransactionCallback#doInTransaction(org.springframework.transaction.TransactionStatus)
           */
          public Object doInTransaction(TransactionStatus status) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.