Search in sources :

Example 1 with SearchIndexUpdateProgress

use of com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress in project musiccabinet by hakko.

the class LibraryUpdateService method getSearchIndexUpdateProgress.

public List<SearchIndexUpdateProgress> getSearchIndexUpdateProgress() {
    List<SearchIndexUpdateProgress> updateProgress = new ArrayList<>();
    updateProgress.addAll(libraryScannerService.getUpdateProgress());
    for (SearchIndexUpdateService updateService : getUpdateServices()) {
        updateProgress.add(updateService.getProgress());
    }
    return updateProgress;
}
Also used : SearchIndexUpdateProgress(com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress) ArrayList(java.util.ArrayList) SearchIndexUpdateService(com.github.hakko.musiccabinet.service.lastfm.SearchIndexUpdateService)

Example 2 with SearchIndexUpdateProgress

use of com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress in project musiccabinet by hakko.

the class SearchIndexUpdateServiceTest method failingServiceInvocation.

@Test
public void failingServiceInvocation() {
    FailingUpdateService failingService = new FailingUpdateService();
    SearchIndexUpdateProgress progress;
    Assert.assertNotNull(progress = failingService.getProgress());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getTotalOperations());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getFinishedOperations());
    try {
        failingService.updateSearchIndex();
        Assert.fail();
    } catch (ApplicationException e) {
    }
    Assert.assertNotNull(progress = failingService.getProgress());
    Assert.assertEquals(FailingUpdateService.TOTAL_CALCULATIONS, progress.getTotalOperations());
    Assert.assertEquals(FailingUpdateService.FAIL_INDEX, progress.getFinishedOperations());
    failingService.reset();
    Assert.assertNotNull(progress = failingService.getProgress());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getTotalOperations());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getFinishedOperations());
}
Also used : SearchIndexUpdateProgress(com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress) ApplicationException(com.github.hakko.musiccabinet.exception.ApplicationException) Test(org.junit.Test)

Example 3 with SearchIndexUpdateProgress

use of com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress in project musiccabinet by hakko.

the class SearchIndexUpdateServiceTest method successfulServiceInvocation.

@Test
public void successfulServiceInvocation() {
    SuccessfulUpdateService successfulService = new SuccessfulUpdateService();
    SearchIndexUpdateProgress progress;
    Assert.assertNotNull(progress = successfulService.getProgress());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getTotalOperations());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getFinishedOperations());
    successfulService.updateSearchIndex();
    Assert.assertNotNull(progress = successfulService.getProgress());
    Assert.assertEquals(SuccessfulUpdateService.TOTAL_CALCULATIONS, progress.getTotalOperations());
    Assert.assertEquals(SuccessfulUpdateService.TOTAL_CALCULATIONS, progress.getFinishedOperations());
    successfulService.reset();
    Assert.assertNotNull(progress = successfulService.getProgress());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getTotalOperations());
    Assert.assertEquals(SearchIndexUpdateProgress.NOT_INITIALIZED, progress.getFinishedOperations());
}
Also used : SearchIndexUpdateProgress(com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress) Test(org.junit.Test)

Aggregations

SearchIndexUpdateProgress (com.github.hakko.musiccabinet.domain.model.aggr.SearchIndexUpdateProgress)3 Test (org.junit.Test)2 ApplicationException (com.github.hakko.musiccabinet.exception.ApplicationException)1 SearchIndexUpdateService (com.github.hakko.musiccabinet.service.lastfm.SearchIndexUpdateService)1 ArrayList (java.util.ArrayList)1