kopia lustrzana https://github.com/bertrik/ttnhabbridge
remove listener upload
rodzic
ce88959472
commit
ad91226589
|
@ -59,76 +59,8 @@ public final class AmateurSondehubTest {
|
|||
uploader.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Happy flow scenario for listener upload.
|
||||
*/
|
||||
@Test
|
||||
public void testUploadListener() {
|
||||
// create a mocked rest client
|
||||
IAmateurSondehubRestApi restClient = Mockito.mock(IAmateurSondehubRestApi.class);
|
||||
Mockito.when(restClient.getUuids(Mockito.anyInt()))
|
||||
.thenReturn(Calls.response(new UuidsList(Arrays.asList("uuid1", "uuid2"))));
|
||||
Mockito.when(restClient.uploadDocument(Mockito.anyString(), Mockito.anyString()))
|
||||
.thenReturn(Calls.response(new UploadResult(true, "id", "rev")));
|
||||
|
||||
AmateurSondehubUploader uploader = new AmateurSondehubUploader(restClient);
|
||||
|
||||
// verify upload using the uploader
|
||||
uploader.start();
|
||||
try {
|
||||
HabReceiver receiver = new HabReceiver("BERTRIK", LOCATION);
|
||||
Instant instant = Instant.now();
|
||||
|
||||
uploader.scheduleListenerDataUpload(receiver, instant);
|
||||
|
||||
// expect two documents
|
||||
Mockito.verify(restClient, Mockito.timeout(3000).times(2)).uploadDocument(Mockito.anyString(),
|
||||
Mockito.anyString());
|
||||
} finally {
|
||||
uploader.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies upload of payload telemetry to the actual amateurSondehub server on the internet.
|
||||
*
|
||||
* @throws InterruptedException in case the sleep got interrupted
|
||||
*/
|
||||
@Test
|
||||
@Ignore("this is not a junit test")
|
||||
public void testActualPayloadUpload() throws InterruptedException {
|
||||
AmateurSondehubUploader uploader = AmateurSondehubUploader.create(new AmateurSondehubConfig());
|
||||
uploader.start();
|
||||
try {
|
||||
Instant instant = Instant.now();
|
||||
Sentence sentence = new Sentence("NOTAFLIGHT", 1, instant);
|
||||
sentence.addField("52.0182307,4.695772,1000");
|
||||
HabReceiver receiver = new HabReceiver("BERTRIK", null);
|
||||
uploader.schedulePayloadTelemetryUpload(sentence.format(), Arrays.asList(receiver), instant);
|
||||
Thread.sleep(3000);
|
||||
} finally {
|
||||
uploader.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies upload of listener information and telemetry to the actual amateurSondehub server on the internet.
|
||||
*
|
||||
* @throws InterruptedException in case the sleep got interrupted
|
||||
*/
|
||||
@Test
|
||||
@Ignore("this is not a junit test")
|
||||
public void testActualListenerUpload() throws InterruptedException {
|
||||
AmateurSondehubUploader uploader = AmateurSondehubUploader.create(new AmateurSondehubConfig());
|
||||
try {
|
||||
Instant instant = Instant.now();
|
||||
HabReceiver receiver = new HabReceiver("BERTRIK", new Location(52.0182307, 4.695772, 15.0));
|
||||
uploader.scheduleListenerDataUpload(receiver, instant);
|
||||
Thread.sleep(3000);
|
||||
} finally {
|
||||
uploader.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Ładowanie…
Reference in New Issue