Example usage for org.springframework.transaction.support DefaultTransactionDefinition DefaultTransactionDefinition

List of usage examples for org.springframework.transaction.support DefaultTransactionDefinition DefaultTransactionDefinition

Introduction

In this page you can find the example usage for org.springframework.transaction.support DefaultTransactionDefinition DefaultTransactionDefinition.

Prototype

public DefaultTransactionDefinition(int propagationBehavior) 

Source Link

Document

Create a new DefaultTransactionDefinition with the given propagation behavior.

Usage

From source file:com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryCache.java

protected CachedItem getCachedItem(ExecutionContext context, FileResource resource,
        RepositoryCacheableItem cacheableItem) {
    if (log.isDebugEnabled()) {
        log.debug("Looking in repository cache \"" + cacheableItem.getCacheName() + "\" for resource \""
                + resource.getURIString() + "\", version " + resource.getVersion() + "\", version date "
                + resource.getCreationDate());
    }//from w ww  . j a v a 2 s  .  c  om

    LockHandle lock = lock(resource, cacheableItem);

    //Because of bug #25373 we need to manually manipulate with transaction:
    //open it AFTER thread acquires lock
    //and commit BEFORE thread releases the lock.
    TransactionStatus transaction = null;

    try {
        transaction = transactionManager.getTransaction(
                new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));

        CachedItem cachedItem = getCachedItem(resource.getURIString(), cacheableItem, true);
        if (cachedItem == null || cachedItem.getVersion() < resource.getVersion()
                || cachedItem.getVersionDate() == null
                || cachedItem.getVersionDate().before(resource.getCreationDate())) {
            if (resource.isReference()) {
                cachedItem = saveRefence(context, resource, cachedItem, cacheableItem);
            } else {
                cachedItem = saveData(context, resource, cachedItem, cacheableItem);
            }
        } else if (resource.isReference()) {
            //load the reference to force updates
            FileResource ref = (FileResource) repository.getResource(context, resource.getReferenceURI());
            CachedItem refItem = getCachedItem(context, ref, cacheableItem);
            if (!refItem.equals(cachedItem.getReference())) {
                updateReference(cachedItem, refItem);
            }
        }

        transactionManager.commit(transaction);
        return cachedItem;
    } finally {
        if (transaction != null && !transaction.isCompleted()) {
            try {
                transactionManager.rollback(transaction);
            } catch (Exception e) {
                // suppress exception throwing
                log.error(e.getMessage(), e);
            }
        }

        unlock(lock);
    }
}

From source file:hoot.services.writers.review.ReviewPrepareDbWriter.java

/**
 * Prepares a map's conflated data for review
 *
 * @param command input parameters containing a map and job ID
 * @throws Exception//from  ww  w  .  j  av  a2 s. c o m
 */
public void exec(JSONObject command) throws Exception {
    if (command.containsKey("testDelayMilliseconds")) {
        Thread.sleep((Long) command.get("testDelayMilliseconds"));
    }
    if (command.containsKey("simulateFailure")) {
        simulateFailure = (Boolean) command.get("simulateFailure");
    }

    mapId = (Long) command.get("mapId");
    final String jobId = (String) command.get("jobId");
    log.debug("Executing review prepare job with ID: " + jobId + " for map with ID: " + String.valueOf(mapId)
            + " ...");

    //TODO: verify that no other writes are seen during this transaction

    try {
        log.debug("Initializing database driver...");
        conn = DbUtils.createConnection();

        log.debug("Intializing ReviewDbPreparer transaction...");
        TransactionStatus transactionStatus = transactionManager
                .getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
        conn.setAutoCommit(false);

        try {
            //see if map review info for this map already exists
            final ReviewMap mapReviewInfo = new SQLQuery(conn, DbUtils.getConfiguration(mapId)).from(reviewMap)
                    .where(reviewMap.mapId.eq(mapId)).singleResult(reviewMap);

            if (mapReviewInfo == null) {
                //if not, add new entry to review_map table
                ReviewMap mapReviewInfoRecord = new ReviewMap();
                mapReviewInfoRecord.setMapId(mapId);
                mapReviewInfoRecord.setReviewPrepareJobId((String) command.get("jobId"));
                /* if (mapReviewInfoRecord.insert() != 1)
                 {
                   throw new Exception("Error inserting map review info.");
                 }*/

                SQLInsertClause insert = new SQLInsertClause(conn, DbUtils.getConfiguration(mapId), reviewMap);
                if (insert.populate(mapReviewInfoRecord).execute() != 1) {
                    throw new Exception("Error inserting map review info.");
                }
            } else {
                //if so, overwrite any existing unreviewed data
                deleteExistingUnreviewedItems(mapId);

                //and then write new job id to the review map table
                SQLUpdateClause update = new SQLUpdateClause(conn, DbUtils.getConfiguration(mapId), reviewMap);

                if (update.where(reviewMap.mapId.eq(mapId)).set(reviewMap.reviewPrepareJobId, jobId)
                        .execute() != 1) {
                    throw new Exception("Error updating job entry in review table.");
                }

            }

            //two passes through the data have to be made; one to create the mappings from the unique
            //id's to the osm element id's and then a second to parse the review tags; there might
            //be a way to do this in one pass...

            getPreviouslyReviewedRecords();
            totalParseableRecords = getTotalParseableRecords(mapId);
            totalReviewableRecords = getTotalReviewableRecords(mapId);
            final boolean uuidsExist = parseElementUniqueIdTags(mapId);

            boolean reviewableItemsExist = false;
            final String noRecordsParsedMessage = "No records available for review for map with ID: " + mapId;
            if (!uuidsExist) {
                log.warn("Parsing unique element ID's: " + noRecordsParsedMessage);
            } else {
                //read the review tags from the OSM elements and write their data to services db review
                //tables
                reviewableItemsExist = parseElementReviewTags(mapId);
                if (!reviewableItemsExist) {
                    log.warn("Parsing review tags: " + noRecordsParsedMessage);
                }
            }
            if (!uuidsExist || !reviewableItemsExist) {
                finalStatusDetail = noRecordsParsedMessage;
            } else {
                finalStatusDetail = "Reviewable records successfully prepared.";
            }

            //There may be element id's written as a result of parseElementUniqueIdTags that don't
            //have associated review item records, because of the two pass write operation.  They
            //aren't currently hurting anything by existing and will be ignored, but its a good idea
            //to clean them out.
            removeUnusedElementIdMappings();
        } catch (Exception e) {
            log.debug("Rolling back transaction for ReviewDbPreparer...");
            //transactionManager.rollback(transactionStatus);
            transactionManager.rollback(transactionStatus);
            conn.rollback();
            throw e;
        }

        log.debug("Committing ReviewDbPreparer database transaction...");
        //transactionManager.commit(transactionStatus);
        transactionManager.commit(transactionStatus);
        conn.commit();
    } finally {
        conn.setAutoCommit(true);
        DbUtils.closeConnection(conn);
    }
}

From source file:net.longfalcon.newsj.Backfill.java

private void backfillGroup(NewsClient nntpClient, Group group) {
    System.out.println("Processing  " + group.getName());
    try {/*from  w  ww  . j  a v a 2  s. c  o  m*/
        long startLoop = System.currentTimeMillis();
        NewsgroupInfo newsgroupInfo = new NewsgroupInfo();
        boolean exists = nntpClient.selectNewsgroup(group.getName(), newsgroupInfo);
        if (!exists) {
            System.out.println("Could not select group (bad name?): " + group.getName());
            return;
        }

        int backfillTarget = group.getBackfillTarget();
        long targetPost = dayToPost(nntpClient, group, backfillTarget, true);
        long localFirstRecord = group.getFirstRecord();
        long localLastRecord = group.getLastRecord();
        if (localFirstRecord == 0 || localLastRecord == 0) {
            _log.warn("Group " + group.getName()
                    + " has invalid numbers.  Have you run update on it?  Have you set the backfill days amount?");
            return;
        }
        Period daysServerHasPeriod = new Period(
                postDate(nntpClient, newsgroupInfo.getFirstArticleLong(), false),
                postDate(nntpClient, newsgroupInfo.getLastArticleLong(), false));
        Period localDaysPeriod = new Period(postDate(nntpClient, localFirstRecord, false), new DateTime());
        _log.info(String.format(
                "Group %s: server has %s - %s, or %s.\nLocal first = %s (%s). Backfill target of %s days is post %s",
                newsgroupInfo.getNewsgroup(), newsgroupInfo.getFirstArticleLong(),
                newsgroupInfo.getLastArticleLong(), _periodFormatter.print(daysServerHasPeriod),
                localFirstRecord, _periodFormatter.print(localDaysPeriod), backfillTarget, targetPost));

        if (targetPost >= localFirstRecord) { //if our estimate comes back with stuff we already have, finish
            _log.info("Nothing to do, we already have the target post.");
            return;
        }
        //get first and last part numbers from newsgroup
        if (targetPost < newsgroupInfo.getFirstArticleLong()) {
            _log.warn(
                    "WARNING: Backfill came back as before server's first.  Setting targetpost to server first.");
            targetPost = newsgroupInfo.getFirstArticleLong();
        }
        //calculate total number of parts
        long total = localFirstRecord - targetPost;
        boolean done = false;
        //set first and last, moving the window by maxxMssgs
        long last = localFirstRecord - 1L;
        long first = last - FetchBinaries.MESSAGE_BUFFER + 1L; //set initial "chunk"
        if (targetPost > first) {
            first = targetPost;
        }
        while (!done) {
            TransactionStatus transaction = transactionManager.getTransaction(
                    new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
            _log.info(String.format("Getting %s parts (%s in queue)", last - first + 1, first - targetPost));
            fetchBinaries.scan(nntpClient, group, first, last, "backfill", false); // TODO add support for compressed headers

            group.setFirstRecord(first);
            group.setLastUpdated(new Date());
            groupDAO.update(group);
            if (first == targetPost) {
                done = true;
            } else {
                //Keep going: set new last, new first, check for last chunk.
                last = first - 1;
                first = last - FetchBinaries.MESSAGE_BUFFER + 1;
                if (targetPost > first) {
                    first = targetPost;
                }
            }
            transactionManager.commit(transaction);
        }
        DateTime firstRecordPostDate = postDate(nntpClient, first, false);

        Date firstRecordPostDateDate = null;
        if (firstRecordPostDate != null) {
            firstRecordPostDateDate = firstRecordPostDate.toDate();
        }
        group.setFirstRecordPostdate(firstRecordPostDateDate);
        group.setLastUpdated(new Date());
        groupDAO.update(group);

        Period groupTime = new Period(startLoop, System.currentTimeMillis());
        _log.info("Group processed in " + _periodFormatter.print(groupTime));
    } catch (Exception e) {
        _log.error(e, e);
    }
}

From source file:org.fcrepo.camel.FcrepoTransactionManagerTest.java

@Test
public void testTransactionRollback() throws FcrepoOperationFailedException {
    final String baseUrl = "http://localhost:8080/rest";
    final String tx = "tx:1234567890";
    final URI commitUri = URI.create(baseUrl + "/" + tx + FcrepoConstants.COMMIT);
    final URI beginUri = URI.create(baseUrl + FcrepoConstants.TRANSACTION);
    final FcrepoTransactionManager txMgr = new FcrepoTransactionManager();
    txMgr.setBaseUrl(baseUrl);/* ww  w  . j  a  va  2 s  . c  o m*/
    TestUtils.setField(txMgr, "fcrepoClient", mockClient);

    final TransactionTemplate transactionTemplate = new TransactionTemplate(txMgr);
    final DefaultTransactionDefinition txDef = new DefaultTransactionDefinition(
            TransactionDefinition.PROPAGATION_REQUIRED);

    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    transactionTemplate.afterPropertiesSet();

    when(mockClient.post(eq(beginUri))).thenReturn(mockPostBuilder);
    when(mockClient.post(eq(commitUri))).thenReturn(mockPostBuilder2);
    when(mockPostBuilder.perform()).thenReturn(new FcrepoResponse(beginUri, 201,
            singletonMap("Location", singletonList(baseUrl + "/" + tx)), null));
    when(mockPostBuilder2.perform()).thenReturn(new FcrepoResponse(commitUri, 201, emptyMap(), null));

    DefaultTransactionStatus status = (DefaultTransactionStatus) txMgr.getTransaction(txDef);
    FcrepoTransactionObject txObj = (FcrepoTransactionObject) status.getTransaction();

    assertEquals(tx, txObj.getSessionId());
    assertFalse(status.isCompleted());

    status = (DefaultTransactionStatus) txMgr.getTransaction(txDef);

    txMgr.rollback(status);

    txObj = (FcrepoTransactionObject) status.getTransaction();

    assertNull(txObj.getSessionId());
    assertTrue(status.isCompleted());
}

From source file:edu.ur.file.db.service.DefaultFileServerServiceTest.java

/**
 * Test File persistence/*  ww  w .  j  a v  a2  s  . c  o m*/
 * 
 * - Make sure a file can be created.
 * - Makes sure a file can be found.
 * @throws LocationAlreadyExistsException 
 * @throws IllegalFileSystemNameException 
 * 
 */
@Test
public void createFileTest() throws LocationAlreadyExistsException, IllegalFileSystemNameException {
    // Start the transaction this is for lazy loading
    TransactionDefinition td = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED);
    TransactionStatus ts = tm.getTransaction(td);

    DefaultFileServer fs = dfss.createFileServer("service_file_server");

    DefaultFileDatabase fileDatabase = fs.createFileDatabase("nates file server", "file_server_1",
            properties.getProperty("defaultFileServerService.server_path"), "description");

    TreeFolderInfo treeFolderInfo = fileDatabase.createRootFolder("Nates Folder", "folder_1");
    assert fileDatabase
            .setCurrentFileStore(treeFolderInfo.getName()) : "Should be able to set current file store";

    dfss.saveFileServer(fs);

    //commit the transaction this will assing an id to the 
    //file database and folder information
    tm.commit(ts);

    //begin a new transaction
    td = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED);
    ts = tm.getTransaction(td);
    // create the first file to store in the temporary folder
    String tempDirectory = properties.getProperty("file_db_temp_directory");
    File directory = new File(tempDirectory);

    // helper to create the file
    FileUtil testUtil = new FileUtil();
    testUtil.createDirectory(directory);

    File f = testUtil.creatFile(directory, "basicFile1", "Hello  -  This file is for equals 1");

    DefaultFileInfo info = dfss.addFile(fileDatabase, f, "file_service_file", "txt");

    // commit the transaction
    tm.commit(ts);

    //begin a new transaction
    td = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED);
    ts = tm.getTransaction(td);

    DefaultFileInfo myInfo = (DefaultFileInfo) dfss.getFileById(info.getId(), false);

    assert myInfo.equals(info) : "The file information should be the same";

    assert myInfo.getFileInfoChecksums().size() >= 1 : "The file checksum should not be calculated size = "
            + myInfo.getFileInfoChecksums().size();

    assert dfss.findFile(info.getName()).equals(info) : "The file information should be the same";

    File myFile = new File(info.getFullPath());
    assert myFile.exists() : "File " + myFile.getAbsolutePath() + " should exist ";
    assert dfss.deleteFile(dfss.getFileById(info.getId(), false)) : "File " + info + " should be deleted";

    assert !myFile.exists() : "File " + myFile.getAbsolutePath() + " Should no longer exist";

    tm.commit(ts);

    dfss.deleteFileServer(fs.getName());
    assert dfss.getFileServer(fs.getName()) == null : "Should not find the file server";
}

From source file:hoot.services.controllers.osm.ChangesetResource.java

/**
  * <NAME>Changeset Create</NAME>
  * <DESCRIPTION>//from   ww  w .  j  av a2 s .co m
  * The Hootenanny Changeset Service implements a subset of the OSM
  * Changeset Service v0.6. It supports the OSM changeset upload process only.
  * It does not support the browsing of changeset contents.
  * </DESCRIPTION>
  * <PARAMETERS>
  *  <mapId>
  *  string; ID or name of the map to which the created changeset will belong
  *  </mapId>
  *  <changesetData>
  *  XML; payload data; an empty OSM xml changeset
  *  </changesetData>
  * </PARAMETERS>
  * <OUTPUT>
  *    ID of the created changeset
  * </OUTPUT>
  * <EXAMPLE>
  *    <URL>http://localhost:8080/hoot-services/osm/api/0.6/changeset/create?mapId=dc-admin</URL>
  *    <REQUEST_TYPE>PUT</REQUEST_TYPE>
  *    <INPUT>
  * Changeset OSM XML
  * See https://insightcloud.digitalglobe.com/redmine/projects/hootenany/wiki/User_-_OsmChangesetService#Changeset-Create
  *   </INPUT>
  * <OUTPUT>
  * 1
  * </OUTPUT>
  * </EXAMPLE>
 *
 * Service method endpoint for creating a new OSM changeset
 * 
 * @param changeset changeset create data
 * @param mapId ID of the map the changeset belongs to
 * @return Response containing the ID assigned to the new changeset
 * @throws Exception 
 * @todo why can't I get changesetData in as an XML doc?
 * @todo update for parsing multiple changesets in one request (#2894): duplicated changeset tag 
   keys are allowed but later changeset tag keys overwrite earlier ones; isn't that contradictory
   with the rest of the logic in this method?
 * @see https://insightcloud.digitalglobe.com/redmine/projects/hootenany/wiki/User_-_OsmChangesetService#Changeset-Create
 */
@PUT
@Path("/create")
@Consumes(MediaType.TEXT_XML)
@Produces(MediaType.TEXT_PLAIN)
public Response create(final String changesetData, @QueryParam("mapId") final String mapId) throws Exception {
    log.debug("Creating changeset for map with ID: " + mapId + " ...");

    Document changesetDoc = null;
    try {
        log.debug("Parsing changeset XML...");
        changesetDoc = XmlDocumentBuilder.parse(changesetData);
    } catch (Exception e) {
        ResourceErrorHandler.handleError("Error parsing changeset XML: "
                + StringUtils.abbreviate(changesetData, 100) + " (" + e.getMessage() + ")", Status.BAD_REQUEST,
                log);
    }

    Connection conn = DbUtils.createConnection();
    long changesetId = -1;
    try {
        log.debug("Initializing database connection...");

        long mapIdNum = -1;
        try {
            QMaps maps = QMaps.maps;
            //input mapId may be a map ID or a map name
            mapIdNum = ModelDaoUtils.getRecordIdForInputString(mapId, conn, maps, maps.id, maps.displayName);
        } catch (Exception e) {
            if (e.getMessage().startsWith("Multiple records exist")) {
                ResourceErrorHandler.handleError(
                        e.getMessage().replaceAll("records", "maps").replaceAll("record", "map"),
                        Status.NOT_FOUND, log);
            } else if (e.getMessage().startsWith("No record exists")) {
                ResourceErrorHandler.handleError(
                        e.getMessage().replaceAll("records", "maps").replaceAll("record", "map"),
                        Status.NOT_FOUND, log);
            }
            ResourceErrorHandler.handleError(
                    "Error requesting map with ID: " + mapId + " (" + e.getMessage() + ")", Status.BAD_REQUEST,
                    log);
        }

        long userId = -1;
        try {
            assert (mapIdNum != -1);
            log.debug("Retrieving user ID associated with map having ID: " + String.valueOf(mapIdNum) + " ...");

            QMaps maps = QMaps.maps;

            SQLQuery query = new SQLQuery(conn, DbUtils.getConfiguration());

            userId = query.from(maps).where(maps.id.eq(mapIdNum)).singleResult(maps.userId);

            log.debug("Retrieved user ID: " + userId);
        } catch (Exception e) {
            ResourceErrorHandler.handleError(
                    "Error locating user associated with map for changeset data: "
                            + StringUtils.abbreviate(changesetData, 100) + " (" + e.getMessage() + ")",
                    Status.BAD_REQUEST, log);
        }

        log.debug("Intializing transaction...");
        TransactionStatus transactionStatus = transactionManager
                .getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
        conn.setAutoCommit(false);

        try {
            changesetId = Changeset.createChangeset(changesetDoc, mapIdNum, userId, conn);
        } catch (Exception e) {
            log.error("Rolling back the database transaction...");
            transactionManager.rollback(transactionStatus);
            conn.rollback();

            ResourceErrorHandler.handleError("Error creating changeset: (" + e.getMessage() + ") "
                    + StringUtils.abbreviate(changesetData, 100), Status.BAD_REQUEST, log);
        }

        log.debug("Committing the database transaction...");
        transactionManager.commit(transactionStatus);
        conn.commit();
    } finally {
        conn.setAutoCommit(true);
        DbUtils.closeConnection(conn);
    }

    log.debug("Returning ID: " + changesetId + " for new changeset...");
    return Response.ok(String.valueOf(changesetId), MediaType.TEXT_PLAIN)
            .header("Content-type", MediaType.TEXT_PLAIN).build();
}

From source file:org.fcrepo.camel.FcrepoTransactionManagerTest.java

@Test(expected = CannotCreateTransactionException.class)
public void testTransactionBeginError() throws FcrepoOperationFailedException {
    final String baseUrl = "http://localhost:8080/rest";
    final String tx = "tx:1234567890";
    final URI beginUri = URI.create(baseUrl + FcrepoConstants.TRANSACTION);
    final FcrepoTransactionManager txMgr = new FcrepoTransactionManager();
    txMgr.setBaseUrl(baseUrl);//from   ww w .j  ava 2s.c om
    TestUtils.setField(txMgr, "fcrepoClient", mockClient);

    final TransactionTemplate transactionTemplate = new TransactionTemplate(txMgr);
    final DefaultTransactionDefinition txDef = new DefaultTransactionDefinition(
            TransactionDefinition.PROPAGATION_REQUIRED);

    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    transactionTemplate.afterPropertiesSet();

    when(mockPostBuilder.perform()).thenThrow(new FcrepoOperationFailedException(beginUri, 400, "Bad Request"));

    txMgr.getTransaction(txDef);
}

From source file:org.fcrepo.camel.FcrepoTransactionManagerTest.java

@Test(expected = CannotCreateTransactionException.class)
public void testTransactionBeginNoLocationError() throws FcrepoOperationFailedException {
    final String baseUrl = "http://localhost:8080/rest";
    final String tx = "tx:1234567890";
    final URI beginUri = URI.create(baseUrl + FcrepoConstants.TRANSACTION);
    final FcrepoTransactionManager txMgr = new FcrepoTransactionManager();
    txMgr.setBaseUrl(baseUrl);/*from ww  w .j  av a  2  s.co m*/
    TestUtils.setField(txMgr, "fcrepoClient", mockClient);

    final TransactionTemplate transactionTemplate = new TransactionTemplate(txMgr);
    final DefaultTransactionDefinition txDef = new DefaultTransactionDefinition(
            TransactionDefinition.PROPAGATION_REQUIRED);

    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    transactionTemplate.afterPropertiesSet();

    when(mockPostBuilder.perform()).thenReturn(new FcrepoResponse(beginUri, 201, emptyMap(), null));

    txMgr.getTransaction(txDef);
}

From source file:alfio.manager.TicketReservationManager.java

public TicketReservationManager(EventRepository eventRepository, OrganizationRepository organizationRepository,
        TicketRepository ticketRepository, TicketReservationRepository ticketReservationRepository,
        TicketCategoryRepository ticketCategoryRepository,
        TicketCategoryDescriptionRepository ticketCategoryDescriptionRepository,
        ConfigurationManager configurationManager, PaymentManager paymentManager,
        PromoCodeDiscountRepository promoCodeDiscountRepository, SpecialPriceRepository specialPriceRepository,
        TransactionRepository transactionRepository, NotificationManager notificationManager,
        MessageSource messageSource, TemplateManager templateManager,
        PlatformTransactionManager transactionManager, WaitingQueueManager waitingQueueManager,
        PluginManager pluginManager, TicketFieldRepository ticketFieldRepository,
        AdditionalServiceRepository additionalServiceRepository,
        AdditionalServiceItemRepository additionalServiceItemRepository,
        AdditionalServiceTextRepository additionalServiceTextRepository,
        InvoiceSequencesRepository invoiceSequencesRepository, AuditingRepository auditingRepository,
        UserRepository userRepository, ExtensionManager extensionManager) {
    this.eventRepository = eventRepository;
    this.organizationRepository = organizationRepository;
    this.ticketRepository = ticketRepository;
    this.ticketReservationRepository = ticketReservationRepository;
    this.ticketCategoryRepository = ticketCategoryRepository;
    this.ticketCategoryDescriptionRepository = ticketCategoryDescriptionRepository;
    this.configurationManager = configurationManager;
    this.paymentManager = paymentManager;
    this.promoCodeDiscountRepository = promoCodeDiscountRepository;
    this.specialPriceRepository = specialPriceRepository;
    this.transactionRepository = transactionRepository;
    this.notificationManager = notificationManager;
    this.messageSource = messageSource;
    this.templateManager = templateManager;
    this.waitingQueueManager = waitingQueueManager;
    this.pluginManager = pluginManager;
    this.requiresNewTransactionTemplate = new TransactionTemplate(transactionManager,
            new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
    this.ticketFieldRepository = ticketFieldRepository;
    this.additionalServiceRepository = additionalServiceRepository;
    this.additionalServiceItemRepository = additionalServiceItemRepository;
    this.additionalServiceTextRepository = additionalServiceTextRepository;
    this.invoiceSequencesRepository = invoiceSequencesRepository;
    this.auditingRepository = auditingRepository;
    this.userRepository = userRepository;
    this.extensionManager = extensionManager;
}

From source file:org.fcrepo.camel.FcrepoTransactionManagerTest.java

@Test(expected = CannotCreateTransactionException.class)
public void testTransactionNullResponseError() throws FcrepoOperationFailedException {
    final String baseUrl = "http://localhost:8080/rest";
    final String tx = "tx:1234567890";
    final URI beginUri = URI.create(baseUrl + FcrepoConstants.TRANSACTION);
    final FcrepoTransactionManager txMgr = new FcrepoTransactionManager();
    txMgr.setBaseUrl(baseUrl);// w ww .  ja va 2 s .c o m
    TestUtils.setField(txMgr, "fcrepoClient", mockClient);

    final TransactionTemplate transactionTemplate = new TransactionTemplate(txMgr);
    final DefaultTransactionDefinition txDef = new DefaultTransactionDefinition(
            TransactionDefinition.PROPAGATION_REQUIRED);

    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    transactionTemplate.afterPropertiesSet();

    when(mockPostBuilder.perform()).thenReturn(null);

    txMgr.getTransaction(txDef);
}