Removed percentage from the event. Moved event into the repo API.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
kaizimmerm
2016-07-08 13:00:47 +02:00
parent 8fb2bd4322
commit 9a4903526a
15 changed files with 78 additions and 80 deletions

View File

@@ -13,7 +13,7 @@ import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.eclipse.hawkbit.eventbus.event.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.eventbus.event.DownloadProgressEvent;
import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.junit.Before;
@@ -59,15 +59,14 @@ public class CacheWriteNotifyTest {
@Test
public void downloadgProgressIsCachedAndEventSent() {
final long knownStatusId = 1;
final int knownPercentage = 23;
when(cacheManagerMock.getCache(ActionStatus.class.getName())).thenReturn(cacheMock);
when(tenantAwareMock.getCurrentTenant()).thenReturn("default");
underTest.downloadProgressPercent(knownStatusId, knownPercentage, 100L, 500L);
underTest.downloadProgress(knownStatusId, 500L, 100L, 100L);
verify(cacheManagerMock).getCache(eq(ActionStatus.class.getName()));
verify(cacheMock).put(knownStatusId + "." + CacheKeys.DOWNLOAD_PROGRESS_PERCENT, knownPercentage);
verify(cacheMock).put(knownStatusId + "." + CacheKeys.DOWNLOAD_PROGRESS_PERCENT, 20);
verify(eventBusMock).post(any(DownloadProgressEvent.class));
}