Permalink
Browse files

CacheAwareLibraryImporter @asynchronous. Workaround for ARQ-626.

  • Loading branch information...
m1key committed Sep 29, 2012
1 parent e3b8bb4 commit adfed86432a77981775eebd3d1cd0d57879d7ef3
@@ -118,7 +118,7 @@
private static final String pathToFile = "../audiolicious-test-data/src/test/resources/libraries/MacOsExportedLibrary-2011-07-28.xml";
@EJB
private LibraryImporter libraryImporter;
private SynchronousLibraryImporter libraryImporter;
@EJB
private IntegrationTestHelperBean testHelperBean;
@@ -172,10 +172,13 @@ public static WebArchive createTestArchive()
RatingTo.class, RawTrackDataHandler.class, Song.class,
SongHandler.class, SongInfo.class, SongMapper.class,
SongTo.class, Stat.class, StatefulSongService.class,
StatInfo.class, ToBasedStatInfo.class,
TrackHandler.class, TrackHandlersFactory.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
StatInfo.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class,
ToBasedStatInfo.class, TrackHandler.class,
TrackHandlersFactory.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -0,0 +1,26 @@
package me.m1key.audiolicious.repositories;
import java.io.File;
import java.util.concurrent.Future;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import me.m1key.audiolicious.domain.to.LibraryTo;
import me.m1key.audiolicious.services.CacheAwareLibraryImporter;
import me.m1key.audiolicious.services.LibraryImporter;
@Stateless
@Local({ LibraryImporter.class, SynchronousLibraryImporter.class })
public class SynchronousCacheAwareLibraryImporter extends
CacheAwareLibraryImporter implements SynchronousLibraryImporter {
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Future<LibraryTo> importLibrary(File libraryFile) {
return super.importLibrary(libraryFile);
}
}
@@ -0,0 +1,7 @@
package me.m1key.audiolicious.repositories;
import me.m1key.audiolicious.services.LibraryImporter;
public interface SynchronousLibraryImporter extends LibraryImporter {
}
@@ -125,7 +125,7 @@
private static final String pathToFile2 = "../audiolicious-test-data/src/test/resources/libraries/Fragment_2.xml";
@EJB
private LibraryImporter libraryImporter;
private SynchronousLibraryImporter libraryImporter;
@EJB
private ArtistRepository artistRepository;
@EJB
@@ -184,10 +184,13 @@ public static WebArchive createTestArchive()
RatingTo.class, RawTrackDataHandler.class, Song.class,
SongHandler.class, SongInfo.class, SongMapper.class,
SongTo.class, Stat.class, StatefulSongService.class,
StatInfo.class, ToBasedStatInfo.class,
TrackHandler.class, TrackHandlersFactory.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
StatInfo.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class,
ToBasedStatInfo.class, TrackHandler.class,
TrackHandlersFactory.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -108,7 +108,7 @@
private static final int TOTAL_VIDEOS = 1;
@EJB
private LibraryImporter importer;
private SynchronousLibraryImporter importer;
@EJB
private StubSongHandler songHandler;
@EJB
@@ -169,9 +169,10 @@ public static WebArchive createTestArchive()
StubLibraryRepositoryWithInfo.class,
StubPodcastHandler.class, StubSongHandler.class,
StubTrackHandlersFactory.class, StubVideoHandler.class,
TrackHandler.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class, TrackHandler.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -104,7 +104,7 @@
private static final String pathToFile = "../audiolicious-test-data/src/test/resources/libraries/MacOsExportedLibrary-2011-07-28.xml";
@EJB
private LibraryImporter libraryImporter;
private SynchronousLibraryImporter libraryImporter;
@EJB
private StubArtistRepository stubArtistRepository;
@EJB
@@ -163,10 +163,13 @@ public static WebArchive createTestArchive()
StatefulSongService.class, StubArtistRepository.class,
StubLibraryRepository.class,
StubLibraryRepositoryWithInfo.class,
StubLibraryService.class, ToBasedStatInfo.class,
TrackHandler.class, TrackHandlersFactory.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
StubLibraryService.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class,
ToBasedStatInfo.class, TrackHandler.class,
TrackHandlersFactory.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -108,7 +108,7 @@
private static final int TOTAL_VIDEOS = 0;
@EJB
private LibraryImporter libraryImporter;
private SynchronousLibraryImporter libraryImporter;
@EJB
private StubSongHandler songHandler;
@EJB
@@ -167,9 +167,10 @@ public static WebArchive createTestArchive()
StubLibraryRepositoryWithInfo.class,
StubPodcastHandler.class, StubSongHandler.class,
StubTrackHandlersFactory.class, StubVideoHandler.class,
TrackHandler.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class, TrackHandler.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -104,7 +104,7 @@
private static final String pathToFile = "../audiolicious-test-data/src/test/resources/libraries/WindowsExportedLibrary-2011-06-18.xml";
@EJB
private LibraryImporter libraryImport;
private SynchronousLibraryImporter libraryImport;
@EJB
private StubArtistRepository stubArtistRepository;
@EJB
@@ -163,10 +163,13 @@ public static WebArchive createTestArchive()
StatInfo.class, StubArtistRepository.class,
StubLibraryRepository.class,
StubLibraryRepositoryWithInfo.class,
StubLibraryService.class, ToBasedStatInfo.class,
TrackHandler.class, TrackHandlersFactory.class,
TrackMapper.class, TrackMappersFactory.class,
TrackTo.class, TrackToType.class, VideoHandler.class,
StubLibraryService.class,
SynchronousCacheAwareLibraryImporter.class,
SynchronousLibraryImporter.class,
ToBasedStatInfo.class, TrackHandler.class,
TrackHandlersFactory.class, TrackMapper.class,
TrackMappersFactory.class, TrackTo.class,
TrackToType.class, VideoHandler.class,
VideoMapper.class, VideoTo.class,
VtdItunesLibraryParser.class, XmlNodeName.class,
XmlParseException.class)
@@ -0,0 +1,24 @@
package me.m1key.audiolicious.services;
import java.io.File;
import java.util.concurrent.Future;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import me.m1key.audiolicious.domain.to.LibraryTo;
@Stateless
@Local({ LibraryImporter.class, SynchronousLibraryImporter.class })
public class SynchronousCacheAwareLibraryImporter extends
CacheAwareLibraryImporter implements SynchronousLibraryImporter {
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Future<LibraryTo> importLibrary(File libraryFile) {
return super.importLibrary(libraryFile);
}
}
@@ -0,0 +1,5 @@
package me.m1key.audiolicious.services;
public interface SynchronousLibraryImporter extends LibraryImporter {
}

0 comments on commit adfed86

Please sign in to comment.