Пример #1
0
 public PushSubscription createPushSubscription(
     Stream stream, FutureData<PreparedHistoricsQuery> query) throws InterruptedException {
   S3 s3 =
       PushConnectors.s3()
           .accessKey(settings.getS3AccessKey())
           .secretKey(settings.getS3SecretKey())
           .bucket("apitests")
           .directory("java-client")
           .acl("private")
           .deliveryFrequency(0)
           .maxSize(10485760)
           .filePrefix("DataSiftJava-");
   PushValidation pv = datasift.push().validate(s3).sync();
   successful(pv);
   String name = "Java push name", updatedName = name += " updated";
   PushSubscription subscription =
       stream != null
           ? datasift.push().create(s3, stream, name).sync()
           : datasift.push().create(s3, query, name).sync();
   successful(subscription);
   Assert.assertTrue(subscription.status().isActive());
   // test update
   PushSubscription updatedSubscription =
       datasift.push().update(subscription.getId(), s3, updatedName).sync();
   successful(updatedSubscription);
   assertEquals(updatedName, updatedSubscription.name());
   return subscription;
 }
Пример #2
0
 public Stream createStream() throws InterruptedException {
   // create a stream to use
   return datasift.compile(csdlValid).sync();
 }