Exemplo n.º 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;
 }
Exemplo n.º 2
0
 public static PushConnector fromMap(OutputType<PushConnector> ptype, Map<String, Object> params) {
   String type = ptype.value();
   if (BIG_QUERY.value().equals(type)) {
     return PushConnectors.bigQuery().putAll(params);
   }
   if (COUCH_DB.value().equals(type)) {
     return PushConnectors.couchDB().putAll(params);
   }
   if (DYNAMO_DB.value().equals(type)) {
     return PushConnectors.dynamoDB().putAll(params);
   }
   if (ELASTIC_SEARCH.value().equals(type)) {
     return PushConnectors.elasticSearch().putAll(params);
   }
   if (FTP_TYPE.value().equals(type)) {
     return PushConnectors.ftp().putAll(params);
   }
   if (HTTP_TYPE.value().equals(type)) {
     return PushConnectors.http().putAll(params);
   }
   if (MONGO_DB.value().equals(type)) {
     return PushConnectors.mongoDB().putAll(params);
   }
   if (PRECOG.value().equals(type)) {
     return PushConnectors.precog().putAll(params);
   }
   if (REDIS.value().equals(type)) {
     return PushConnectors.redis().putAll(params);
   }
   if (S3_OUTPUT.value().equals(type)) {
     return PushConnectors.s3().putAll(params);
   }
   if (SFTP_OUTPUT.value().equals(type)) {
     return PushConnectors.sftp().putAll(params);
   }
   if (SPLUNK_STORM_REST.value().equals(type)) {
     return PushConnectors.splunkStormRest().putAll(params);
   }
   if (SPLUNK_ENTERPRISE.value().equals(type)) {
     return PushConnectors.splunkEnterprise().putAll(params);
   }
   if (SPLUNK_STORM.value().equals(type)) {
     return PushConnectors.splunkStorm().putAll(params);
   }
   if (ZOOM_DATA.value().equals(type)) {
     return PushConnectors.zoomdata().putAll(params);
   }
   return null;
 }