当前位置: 首页>>代码示例>>Java>>正文


Java UploadTask.TaskSnapshot方法代码示例

本文整理汇总了Java中com.google.firebase.storage.UploadTask.TaskSnapshot方法的典型用法代码示例。如果您正苦于以下问题:Java UploadTask.TaskSnapshot方法的具体用法?Java UploadTask.TaskSnapshot怎么用?Java UploadTask.TaskSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.firebase.storage.UploadTask的用法示例。


在下文中一共展示了UploadTask.TaskSnapshot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPutStream_notSuccessful

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutStream_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putStream(mockInputStream)).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putStream(mockStorageReference, mockInputStream).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例2: testPutFileWithMetadata

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutFileWithMetadata() {
  mockSuccessfulResultForTask(mockUploadTask, mockUploadTaskSnapshot);
  when(mockStorageReference.putFile(mockUri, mockStorageMetadata)).thenReturn(mockUploadTask);
  when(mockUploadTaskSnapshot.getBytesTransferred()).thenReturn(1000L);
  when(mockUploadTaskSnapshot.getTotalByteCount()).thenReturn(1000L);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putFile(mockStorageReference, mockUri, mockStorageMetadata).subscribe(obs);

  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertNoErrors();
  obs.assertComplete();
  obs.assertValue(new Predicate<UploadTask.TaskSnapshot>() {
    @Override public boolean test(UploadTask.TaskSnapshot taskSnapshot) throws Exception {
      return taskSnapshot.getBytesTransferred() == taskSnapshot.getTotalByteCount()
          && taskSnapshot.getTotalByteCount() == 1000L;
    }
  });
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:27,代码来源:RxFirebaseStorageTest.java

示例3: testPutStream

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutStream() {
  mockSuccessfulResultForTask(mockUploadTask, mockUploadTaskSnapshot);
  when(mockStorageReference.putStream(mockInputStream)).thenReturn(mockUploadTask);
  when(mockUploadTaskSnapshot.getBytesTransferred()).thenReturn(1000L);
  when(mockUploadTaskSnapshot.getTotalByteCount()).thenReturn(1000L);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putStream(mockStorageReference, mockInputStream).subscribe(obs);

  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertNoErrors();
  obs.assertComplete();
  obs.assertValue(new Predicate<UploadTask.TaskSnapshot>() {
    @Override public boolean test(UploadTask.TaskSnapshot taskSnapshot) throws Exception {
      return taskSnapshot.getBytesTransferred() == taskSnapshot.getTotalByteCount()
          && taskSnapshot.getTotalByteCount() == 1000L;
    }
  });
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:27,代码来源:RxFirebaseStorageTest.java

示例4: testPutFile

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutFile() {
  mockSuccessfulResultForTask(mockUploadTask, mockUploadTaskSnapshot);
  when(mockStorageReference.putFile(mockUri)).thenReturn(mockUploadTask);
  when(mockUploadTaskSnapshot.getBytesTransferred()).thenReturn(1000L);
  when(mockUploadTaskSnapshot.getTotalByteCount()).thenReturn(1000L);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putFile(mockStorageReference, mockUri).subscribe(obs);

  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertNoErrors();
  obs.assertComplete();
  obs.assertValue(new Predicate<UploadTask.TaskSnapshot>() {
    @Override public boolean test(UploadTask.TaskSnapshot taskSnapshot) throws Exception {
      return taskSnapshot.getBytesTransferred() == taskSnapshot.getTotalByteCount()
          && taskSnapshot.getTotalByteCount() == 1000L;
    }
  });
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:27,代码来源:RxFirebaseStorageTest.java

示例5: testPutFileWithMetadata_notSuccessful

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutFileWithMetadata_notSuccessful() {
  mockNotSuccessfulResultForTask(mockUploadTask, new IllegalStateException());
  when(mockStorageReference.putFile(mockUri, mockStorageMetadata)).thenReturn(mockUploadTask);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putFile(mockStorageReference, mockUri, mockStorageMetadata).subscribe(obs);
  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertError(IllegalStateException.class);
  obs.assertNoValues();
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例6: testPutBytes

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test public void testPutBytes() {
  mockSuccessfulResultForTask(mockUploadTask, mockUploadTaskSnapshot);
  when(mockStorageReference.putBytes(new byte[] { 1, 2, 3 })).thenReturn(mockUploadTask);
  when(mockUploadTaskSnapshot.getBytesTransferred()).thenReturn(1000L);
  when(mockUploadTaskSnapshot.getTotalByteCount()).thenReturn(1000L);

  TestObserver<UploadTask.TaskSnapshot> obs = TestObserver.create();

  RxFirebaseStorage.putBytes(mockStorageReference, new byte[] { 1, 2, 3 }).subscribe(obs);

  verifyAddOnCompleteListenerForTask(mockUploadTask);

  callOnComplete(mockUploadTask);
  obs.dispose();

  callOnComplete(mockUploadTask);

  obs.assertNoErrors();
  obs.assertComplete();
  obs.assertValue(new Predicate<UploadTask.TaskSnapshot>() {
    @Override public boolean test(UploadTask.TaskSnapshot taskSnapshot) throws Exception {
      return taskSnapshot.getBytesTransferred() == taskSnapshot.getTotalByteCount()
          && taskSnapshot.getTotalByteCount() == 1000L;
    }
  });
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:27,代码来源:RxFirebaseStorageTest.java

示例7: putStream

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putStream() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putStream(mockStorageRef, stream)
         .test();

   testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

   verify(mockStorageRef).putStream(stream);

   storageTestObserver.assertNoErrors()
      .assertValueCount(1)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例8: putFileMetadata

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putFileMetadata() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putFile(mockStorageRef, uri, metadata)
         .test();

   testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

   verify(mockStorageRef).putFile(uri, metadata);

   storageTestObserver.assertNoErrors()
      .assertValueCount(1)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例9: putBytesMetadata

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putBytesMetadata() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putBytes(mockStorageRef, notNullbytes, metadata)
         .test();

   testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

   verify(mockStorageRef).putBytes(notNullbytes, metadata);

   storageTestObserver.assertNoErrors()
      .assertValueCount(1)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例10: putBytes

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putBytes() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putBytes(mockStorageRef, notNullbytes)
         .test();

   testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

   verify(mockStorageRef).putBytes(notNullbytes);

   storageTestObserver.assertNoErrors()
      .assertValueCount(1)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例11: putStreamMetadata

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putStreamMetadata() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putStream(mockStorageRef, stream, metadata)
         .test();

   testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

   verify(mockStorageRef).putStream(stream, metadata);

   storageTestObserver.assertNoErrors()
      .assertValueCount(1)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:18,代码来源:RxFirebaseStorageTest.java

示例12: putFileMetadata

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putFileMetadata() throws InterruptedException {

    TestSubscriber<UploadTask.TaskSnapshot> testSubscriber = new TestSubscriber<>();
    RxFirebaseStorage.putFile(mockStorageRef, uri, metadata)
            .subscribeOn(Schedulers.immediate())
            .subscribe(testSubscriber);

    testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

    verify(mockStorageRef).putFile(uri, metadata);

    testSubscriber.assertNoErrors();
    testSubscriber.assertValueCount(1);
    testSubscriber.assertReceivedOnNext(Collections.singletonList(uploadSnapshot));
    testSubscriber.assertNotCompleted();
    testSubscriber.unsubscribe();
}
 
开发者ID:nmoskalenko,项目名称:RxFirebase,代码行数:19,代码来源:RxFirebaseStorageTests.java

示例13: putFileMetadataAndUri

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putFileMetadataAndUri() throws InterruptedException {

    TestSubscriber<UploadTask.TaskSnapshot> testSubscriber = new TestSubscriber<>();
    RxFirebaseStorage.putFile(mockStorageRef, uri, metadata, uri)
            .subscribeOn(Schedulers.immediate())
            .subscribe(testSubscriber);

    testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

    verify(mockStorageRef).putFile(uri, metadata, uri);

    testSubscriber.assertNoErrors();
    testSubscriber.assertValueCount(1);
    testSubscriber.assertReceivedOnNext(Collections.singletonList(uploadSnapshot));
    testSubscriber.assertNotCompleted();
    testSubscriber.unsubscribe();
}
 
开发者ID:nmoskalenko,项目名称:RxFirebase,代码行数:19,代码来源:RxFirebaseStorageTests.java

示例14: putStream

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putStream() throws InterruptedException {

    TestSubscriber<UploadTask.TaskSnapshot> testSubscriber = new TestSubscriber<>();
    RxFirebaseStorage.putStream(mockStorageRef, stream)
            .subscribeOn(Schedulers.immediate())
            .subscribe(testSubscriber);

    testOnSuccessListener.getValue().onSuccess(uploadSnapshot);

    verify(mockStorageRef).putStream(stream);

    testSubscriber.assertNoErrors();
    testSubscriber.assertValueCount(1);
    testSubscriber.assertReceivedOnNext(Collections.singletonList(uploadSnapshot));
    testSubscriber.assertNotCompleted();
    testSubscriber.unsubscribe();
}
 
开发者ID:nmoskalenko,项目名称:RxFirebase,代码行数:19,代码来源:RxFirebaseStorageTests.java

示例15: putBytesNoData

import com.google.firebase.storage.UploadTask; //导入方法依赖的package包/类
@Test
public void putBytesNoData() throws InterruptedException {

   TestObserver<UploadTask.TaskSnapshot> storageTestObserver =
      RxFirebaseStorage.putBytes(mockStorageRef, nullBytes)
         .test();

   testOnFailureListener.getValue().onFailure(NULL_FIREBASE_EXCEPTION);

   verify(mockStorageRef).putBytes(nullBytes);

   storageTestObserver.assertError(NULL_FIREBASE_EXCEPTION)
      .assertValueSet(Collections.singletonList(uploadSnapshot))
      .assertNotComplete()
      .dispose();
}
 
开发者ID:FrangSierra,项目名称:Rx2Firebase,代码行数:17,代码来源:RxFirebaseStorageTest.java


注:本文中的com.google.firebase.storage.UploadTask.TaskSnapshot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。