com.google.api.client.util.Lists Java Examples

The following examples show how to use com.google.api.client.util.Lists. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleSpreadsheetWriter.java    From SPDS with Eclipse Public License 2.0 7 votes vote down vote up
public static void createSheet(List<Object> headers) throws IOException, GeneralSecurityException{
	if(onlyOnce)
		return;
	onlyOnce = true;	
	Sheets service = getService();
	String sheetID = getGitRepositoryState().commitId;
	List<Request> requests = new ArrayList<>(); 
	AddSheetRequest addSheet = new AddSheetRequest();
	addSheet.setProperties(new SheetProperties().setTitle(sheetID));
	requests.add(new Request().setAddSheet(addSheet));
	BatchUpdateSpreadsheetRequest requestBody = new BatchUpdateSpreadsheetRequest();
	requestBody.setRequests(requests);
	service.spreadsheets().batchUpdate(SPREADSHEET_ID, requestBody).execute();
	
	ArrayList<List<Object>> rows = Lists.newArrayList();
	rows.add(headers);
	ValueRange body = new ValueRange().setValues(Arrays.asList(headers));
	service.spreadsheets().values().append(SPREADSHEET_ID, sheetID, body).setValueInputOption("USER_ENTERED")
			.execute();
}
 
Example #2
Source File: CustomDataStoreFactory.java    From hop with Apache License 2.0 6 votes vote down vote up
public final Collection<V> values() throws IOException {
  this.lock.lock();

  try {
    List<V> result = Lists.newArrayList();
    Iterator i$ = this.keyValueMap.values().iterator();

    while ( i$.hasNext() ) {
      byte[] bytes = (byte[]) i$.next();
      result.add( IOUtils.deserialize( bytes ) );
    }

    List var7 = Collections.unmodifiableList( result );
    return var7;
  } finally {
    this.lock.unlock();
  }
}
 
Example #3
Source File: SolrSearcher.java    From q with Apache License 2.0 6 votes vote down vote up
public String getUrlForGettingDoc(String q, List<String> languages, String dataSetId)
{
	List<NameValuePair> parameters = Lists.newArrayList();

	parameters.add(new BasicNameValuePair("q", getPhraseQueryString(q)));
	parameters.add(new BasicNameValuePair("defType", "edismax"));
	parameters.add(new BasicNameValuePair("lowercaseOperators", "false"));
	parameters.add(new BasicNameValuePair("rows", "100000"));
	parameters.add(new BasicNameValuePair("qs", "10"));
	parameters.add(new BasicNameValuePair("fl", Properties.idField.get() + ", " + Properties.titleFields.get().get(0) + "_en"));
	parameters.add(new BasicNameValuePair("sort", Properties.idField.get() + " DESC"));
	parameters.add(new BasicNameValuePair("qf", getQueryFields(languages)));
	parameters.add(new BasicNameValuePair("fq", Properties.docTypeFieldName.get() + ":" + dataSetId));
	parameters.add(new BasicNameValuePair("wt", "json"));

	return getServerUrl() + "/select?" + URLEncodedUtils.format(parameters, BaseIndexer.ENCODING);
}
 
Example #4
Source File: CloudSpannerPreparedStatementTest.java    From spanner-jdbc with MIT License 6 votes vote down vote up
@Test()
public void testDeleteStatementWithNullValueInKey()
    throws SQLException, NoSuchMethodException, SecurityException, IllegalAccessException,
    IllegalArgumentException, InvocationTargetException {
  CloudSpannerPreparedStatement ps =
      CloudSpannerTestObjects.createPreparedStatement("DELETE FROM FOO WHERE ID=?");
  ps.setNull(1, Types.BIGINT);
  Mutations mutations;
  Method createMutations = ps.getClass().getDeclaredMethod("createMutations");
  createMutations.setAccessible(true);
  mutations = (Mutations) createMutations.invoke(ps);

  Mutation deleteMutation = mutations.getMutations().get(0);
  Assert.assertNotNull(deleteMutation);
  Assert.assertEquals(Op.DELETE, deleteMutation.getOperation());
  List<Key> keys = Lists.newArrayList(deleteMutation.getKeySet().getKeys());
  Assert.assertEquals(1, keys.size());
  Assert.assertNull(keys.get(0).getParts().iterator().next());
}
 
Example #5
Source File: SpecServiceTest.java    From feast with Apache License 2.0 6 votes vote down vote up
@Test
public void applyFeatureSetShouldNotCreateFeatureSetIfFieldsUnordered()
    throws InvalidProtocolBufferException {

  FeatureSet featureSet = featureSets.get(1);
  List<Feature> features = Lists.newArrayList(featureSet.getFeatures());
  Collections.shuffle(features);
  featureSet.setFeatures(Set.copyOf(features));
  FeatureSetProto.FeatureSet incomingFeatureSet = featureSet.toProto();

  ApplyFeatureSetResponse applyFeatureSetResponse =
      specService.applyFeatureSet(incomingFeatureSet);
  assertThat(applyFeatureSetResponse.getStatus(), equalTo(Status.NO_CHANGE));
  assertThat(
      applyFeatureSetResponse.getFeatureSet().getSpec().getMaxAge(),
      equalTo(incomingFeatureSet.getSpec().getMaxAge()));
  assertThat(
      applyFeatureSetResponse.getFeatureSet().getSpec().getEntities(0),
      equalTo(incomingFeatureSet.getSpec().getEntities(0)));
  assertThat(
      applyFeatureSetResponse.getFeatureSet().getSpec().getName(),
      equalTo(incomingFeatureSet.getSpec().getName()));
}
 
Example #6
Source File: CustomDataStoreFactory.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public final Collection<V> values() throws IOException {
  this.lock.lock();

  try {
    List<V> result = Lists.newArrayList();
    Iterator i$ = this.keyValueMap.values().iterator();

    while ( i$.hasNext() ) {
      byte[] bytes = (byte[]) i$.next();
      result.add( IOUtils.deserialize( bytes ) );
    }

    List var7 = Collections.unmodifiableList( result );
    return var7;
  } finally {
    this.lock.unlock();
  }
}
 
Example #7
Source File: IdTokenVerifierTest.java    From google-oauth-java-client with Apache License 2.0 6 votes vote down vote up
public void testBuilder() throws Exception {
  IdTokenVerifier.Builder builder =
      new IdTokenVerifier.Builder().setIssuer(ISSUER).setAudience(TRUSTED_CLIENT_IDS);
  assertEquals(Clock.SYSTEM, builder.getClock());
  assertEquals(ISSUER, builder.getIssuer());
  assertEquals(Collections.singleton(ISSUER), builder.getIssuers());
  assertTrue(TRUSTED_CLIENT_IDS.equals(builder.getAudience()));
  Clock clock = new MyClock();
  builder.setClock(clock);
  assertEquals(clock, builder.getClock());
  IdTokenVerifier verifier = builder.build();
  assertEquals(clock, verifier.getClock());
  assertEquals(ISSUER, verifier.getIssuer());
  assertEquals(Collections.singleton(ISSUER), builder.getIssuers());
  assertEquals(TRUSTED_CLIENT_IDS, Lists.newArrayList(verifier.getAudience()));
}
 
Example #8
Source File: TransactionSnippets.java    From google-cloud-java with Apache License 2.0 6 votes vote down vote up
/** Example of running a query to find all entities with an ancestor. */
// [TARGET run(Query)]
// [VARIABLE "my_parent_key_name"]
public List<Entity> run(String parentKeyName) {
  Datastore datastore = transaction.getDatastore();
  // [START run]
  KeyFactory keyFactory = datastore.newKeyFactory().setKind("ParentKind");
  Key parentKey = keyFactory.newKey(parentKeyName);
  // Build a query
  Query<Entity> query =
      Query.newEntityQueryBuilder()
          .setKind("MyKind")
          .setFilter(PropertyFilter.hasAncestor(parentKey))
          .build();
  QueryResults<Entity> results = transaction.run(query);
  List<Entity> entities = Lists.newArrayList();
  while (results.hasNext()) {
    Entity result = results.next();
    // do something with result
    entities.add(result);
  }
  transaction.commit();
  // [END run]
  return entities;
}
 
Example #9
Source File: TransactionSnippets.java    From google-cloud-java with Apache License 2.0 6 votes vote down vote up
/** Example of getting entities for several keys. */
// [TARGET get(Key...)]
// [VARIABLE "my_first_key_name"]
// [VARIABLE "my_second_key_name"]
public List<Entity> getMultiple(String firstKeyName, String secondKeyName) {
  Datastore datastore = transaction.getDatastore();
  // TODO change so that it's not necessary to hold the entities in a list for integration testing
  // [START getMultiple]
  KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
  Key firstKey = keyFactory.newKey(firstKeyName);
  Key secondKey = keyFactory.newKey(secondKeyName);
  Iterator<Entity> entitiesIterator = transaction.get(firstKey, secondKey);
  List<Entity> entities = Lists.newArrayList();
  while (entitiesIterator.hasNext()) {
    Entity entity = entitiesIterator.next();
    // do something with the entity
    entities.add(entity);
  }
  transaction.commit();
  // [END getMultiple]
  return entities;
}
 
Example #10
Source File: MarkDuplicatesSparkUtilsUnitTest.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testReadsMissingReadGroups() {
    JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();

    SAMRecordSetBuilder samRecordSetBuilder = new SAMRecordSetBuilder(true, SAMFileHeader.SortOrder.queryname,
            true, SAMRecordSetBuilder.DEFAULT_CHROMOSOME_LENGTH, SAMRecordSetBuilder.DEFAULT_DUPLICATE_SCORING_STRATEGY);
    samRecordSetBuilder.addFrag("READ" , 0, 10000, false);

    JavaRDD<GATKRead> reads = ctx.parallelize(Lists.newArrayList(samRecordSetBuilder.getRecords()), 2).map(SAMRecordToGATKReadAdapter::new);
    reads = reads.map(r -> {r.setReadGroup(null); return r;});
    SAMFileHeader header = samRecordSetBuilder.getHeader();

    try {
        MarkDuplicatesSparkUtils.transformToDuplicateNames(header, MarkDuplicatesScoringStrategy.SUM_OF_BASE_QUALITIES, null, reads, 2, false).collect();
        Assert.fail("Should have thrown an exception");
    } catch (Exception e){
        Assert.assertTrue(e instanceof SparkException);
        Assert.assertTrue(e.getCause() instanceof UserException.ReadMissingReadGroup);
    }
}
 
Example #11
Source File: AwsLifecycleHookValidation.java    From halyard with Apache License 2.0 6 votes vote down vote up
public static Stream<String> getValidationErrors(AwsLifecycleHook hook) {
  List<String> errors = Lists.newArrayList();
  String snsArn = hook.getNotificationTargetARN();
  if (!isValidSnsArn(snsArn)) {
    errors.add("Invalid SNS notification ARN: " + snsArn);
  }

  if (!isValidRoleArn(hook.getRoleARN())) {
    errors.add("Invalid IAM role ARN: " + hook.getRoleARN());
  }

  if (!VALID_LIFECYCLE_HOOK_RESULTS.contains(hook.getDefaultResult())) {
    errors.add("Invalid lifecycle default result: " + hook.getDefaultResult());
  }

  if (!isValidHeartbeatTimeout(hook.getHeartbeatTimeout())) {
    errors.add(
        "Lifecycle heartbeat timeout must be between 30 and 7200. Provided value was: "
            + hook.getHeartbeatTimeout());
  }

  return errors.stream();
}
 
Example #12
Source File: Example.java    From async-datastore-client with Apache License 2.0 6 votes vote down vote up
private static void queryData(final Datastore datastore) {
  final Query get = QueryBuilder.query()
      .kindOf("employee")
      .filterBy(eq("age", 40))
      .orderBy(asc("fullname"));

  List<Entity> entities = Lists.newArrayList();
  try {
    entities = datastore.execute(get).getAll();
  } catch (final DatastoreException e) {
    System.err.println("Storage exception: " + Throwables.getRootCause(e).getMessage());
  }

  for (final Entity entity : entities) {
    System.out.println("Employee name: " + entity.getString("fullname"));
    System.out.println("Employee age: " + entity.getInteger("age"));
  }
}
 
Example #13
Source File: TestCertificates.java    From google-http-java-client with Apache License 2.0 6 votes vote down vote up
public static JsonWebSignature getJsonWebSignature() throws IOException {
  if (jsonWebSignature == null) {
    JsonWebSignature.Header header = new JsonWebSignature.Header();
    header.setAlgorithm("RS256");
    List<String> certificates = Lists.newArrayList();
    certificates.add(FOO_BAR_COM_CERT.getBase64Der());
    certificates.add(CA_CERT.getBase64Der());
    header.setX509Certificates(certificates);
    JsonWebToken.Payload payload = new JsonWebToken.Payload();
    payload.set("foo", "bar");
    int firstDot = JWS_SIGNATURE.indexOf('.');
    int secondDot = JWS_SIGNATURE.indexOf('.', firstDot + 1);
    byte[] signatureBytes = Base64.decodeBase64(JWS_SIGNATURE.substring(secondDot + 1));
    byte[] signedContentBytes = StringUtils.getBytesUtf8(JWS_SIGNATURE.substring(0, secondDot));
    JsonWebSignature signature =
        new JsonWebSignature(header, payload, signatureBytes, signedContentBytes);
    jsonWebSignature = signature;
  }
  return jsonWebSignature;
}
 
Example #14
Source File: AppEngineDataStoreFactory.java    From google-http-java-client with Apache License 2.0 6 votes vote down vote up
@Override
public AppEngineDataStore<V> clear() throws IOException {
  lock.lock();
  try {
    if (memcache != null) {
      memcache.clearAll();
    }
    // no clearAll() method on DataStoreService so have to query all keys & delete them
    List<Key> keys = Lists.newArrayList();
    for (Entity entity : query(true)) {
      keys.add(entity.getKey());
    }
    dataStoreService.delete(keys);
  } finally {
    lock.unlock();
  }
  return this;
}
 
Example #15
Source File: Importer.java    From mail-importer with Apache License 2.0 6 votes vote down vote up
public void importMail() throws MessagingException, IOException {
  LocalStorage storage = storageProvider.get();
  gmailSyncer.init();

  int messagesImported = 0;
  Iterator<LocalMessage> iterator = storage.iterator();
  while (iterator.hasNext() && keepImporting(messagesImported)) {
    List<LocalMessage> batch = Lists.newArrayListWithCapacity(BATCH_SIZE);
    for (int i = 0;
         i < BATCH_SIZE
             && iterator.hasNext()
             && keepImporting(messagesImported);
         i++) {
      LocalMessage message = iterator.next();
      logger.fine(() -> "Id: " + message.getMessageId());
      logger.fine(() -> "Folders: " + message.getFolders());
      batch.add(message);
      messagesImported++;
    }
    gmailSyncer.sync(batch);
  }
}
 
Example #16
Source File: AppEngineDataStoreFactory.java    From google-http-java-client with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<V> values() throws IOException {
  lock.lock();
  try {
    // Unfortunately no getKeys() method on MemcacheService, so the only option is to clear all
    // and re-populate the memcache from scratch. This is clearly inefficient.
    if (memcache != null) {
      memcache.clearAll();
    }
    List<V> result = Lists.newArrayList();
    Map<String, V> map = memcache != null ? Maps.<String, V>newHashMap() : null;
    for (Entity entity : query(false)) {
      V value = deserialize(entity);
      result.add(value);
      if (map != null) {
        map.put(entity.getKey().getName(), value);
      }
    }
    if (memcache != null) {
      memcache.putAll(map, memcacheExpiration);
    }
    return Collections.unmodifiableList(result);
  } finally {
    lock.unlock();
  }
}
 
Example #17
Source File: GeolocationProcessorUpgrader.java    From datacollector with Apache License 2.0 6 votes vote down vote up
private void upgradeV3ToV4(List<Config> configs) {
  List<Config> configsToRemove = new ArrayList<>();

  String geoIP2DBFile = null;
  String geoIP2DBType = null;

  for (Config config : configs) {
    switch (config.getName()) {
      case "geoIP2DBFile":
        configsToRemove.add(config);
        geoIP2DBFile = config.getValue().toString();
        break;
      case "geoIP2DBType":
        configsToRemove.add(config);
        geoIP2DBType = config.getValue().toString();
        break;
    }
  }

  configs.removeAll(configsToRemove);

  List<Map<String, String>> dbConfigs = Lists.newArrayList();
  Map<String, String> dbConfig = ImmutableMap.of("geoIP2DBFile", geoIP2DBFile, "geoIP2DBType", geoIP2DBType);
  dbConfigs.add(dbConfig);
  configs.add(new Config("dbConfigs", dbConfigs));
}
 
Example #18
Source File: VariantSimilarityITCase.java    From dataflow-java with Apache License 2.0 6 votes vote down vote up
private void testBase(String[] ARGS, GraphResult[] expectedResult) throws Exception {
  // Run the pipeline.
  VariantSimilarity.main(ARGS);

  // Download the pipeline results.
  List<String> rawResults = helper.downloadOutputs(outputPrefix, expectedResult.length);
  List<GraphResult> results = Lists.newArrayList();
  for (String result : rawResults) {
    results.add(GraphResult.fromString(result));
  }

  // Check the pipeline results.
  assertEquals(expectedResult.length, results.size());

  assertThat(results,
      CoreMatchers.allOf(CoreMatchers.hasItems(expectedResult)));
}
 
Example #19
Source File: MarkDuplicatesSparkUtilsUnitTest.java    From gatk with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private JavaRDD<GATKRead> generateReadsWithDuplicates(int numReadGroups, int numDuplicatesPerGroup, JavaSparkContext ctx, int numPartitions, boolean coordinate) {
    int readNameCounter = 0;
    SAMRecordSetBuilder samRecordSetBuilder = new SAMRecordSetBuilder(true, SAMFileHeader.SortOrder.coordinate,
            true, SAMRecordSetBuilder.DEFAULT_CHROMOSOME_LENGTH, SAMRecordSetBuilder.DEFAULT_DUPLICATE_SCORING_STRATEGY);

    Random rand = new Random(10);
    for (int i = 0; i < numReadGroups; i++ ) {
        int start1 = rand.nextInt(SAMRecordSetBuilder.DEFAULT_CHROMOSOME_LENGTH);
        int start2 = rand.nextInt(SAMRecordSetBuilder.DEFAULT_CHROMOSOME_LENGTH);
        for (int j = 0; j < numDuplicatesPerGroup; j++) {
            samRecordSetBuilder.addPair("READ" + readNameCounter++, 0, start1, start2);
        }
    }
    List<SAMRecord> records = Lists.newArrayList(samRecordSetBuilder.getRecords());
    if (coordinate) {
        records.sort(new SAMRecordCoordinateComparator());
    } else {
        records.sort(new SAMRecordQueryNameComparator());
    }

    return ctx.parallelize(records, numPartitions).map(SAMRecordToGATKReadAdapter::new);
}
 
Example #20
Source File: GoogleDriveAdapter.java    From jdrivesync with Apache License 2.0 5 votes vote down vote up
private List<String> createParentReferenceList(SyncItem syncItem) {
	if (syncItem.getParent().isPresent()) {
		SyncDirectory syncItemParent = syncItem.getParent().get();
		Optional<File> remoteFileOptional = syncItemParent.getRemoteFile();
		if (remoteFileOptional.isPresent()) {
			return Arrays.asList(remoteFileOptional.get().getId());
		}
	}
	return Lists.newArrayList();
}
 
Example #21
Source File: HighLevelConsumerTest.java    From incubator-gobblin with Apache License 2.0 5 votes vote down vote up
private List<byte[]> createByteArrayMessages() {
  List<byte[]> records = Lists.newArrayList();

  for(int i=0; i<NUM_MSGS; i++) {
    byte[] msg = ("msg_" + i).getBytes();
    records.add(msg);
  }
  return records;
}
 
Example #22
Source File: TurnoverAggregationService.java    From estatio with Apache License 2.0 5 votes vote down vote up
public List<TurnoverReportingConfig> choicesForChildConfig(final TurnoverReportingConfig config) {
    Lease lease = config.getOccupancy().getLease();
    List<TurnoverReportingConfig> result = new ArrayList<>();
    if (lease.getPrevious()!=null) {
        lease = (Lease) lease.getPrevious();
        Lists.newArrayList(lease.getOccupancies()).stream()
                .forEach(o->{
                    result.addAll(turnoverReportingConfigRepository.findByOccupancyAndTypeAndFrequency(o, Type.PRELIMINARY, Frequency.MONTHLY));
                });
    }
    return result;
}
 
Example #23
Source File: AbstractMemoryDataStore.java    From google-http-java-client with Apache License 2.0 5 votes vote down vote up
public final Collection<V> values() throws IOException {
  lock.lock();
  try {
    List<V> result = Lists.newArrayList();
    for (byte[] bytes : keyValueMap.values()) {
      result.add(IOUtils.<V>deserialize(bytes));
    }
    return Collections.unmodifiableList(result);
  } finally {
    lock.unlock();
  }
}
 
Example #24
Source File: Atom.java    From google-http-java-client with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the {@code "Slug"} header, properly escaping the header value. See <a
 * href="http://tools.ietf.org/html/rfc5023#section-9.7">The Slug Header</a>.
 *
 * @since 1.14
 */
public static void setSlugHeader(HttpHeaders headers, String value) {
  if (value == null) {
    headers.remove("Slug");
  } else {
    headers.set("Slug", Lists.newArrayList(Arrays.asList(SLUG_ESCAPER.escape(value))));
  }
}
 
Example #25
Source File: CustomizedProgressActivity.java    From android-oauth-client with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    boolean fullScreen = getActivity().getSharedPreferences("Preference", 0)
        .getBoolean(SamplesActivity.KEY_AUTH_MODE, false);
    // setup credential store
    SharedPreferencesCredentialStore credentialStore =
            new SharedPreferencesCredentialStore(getActivity(),
                    SamplesConstants.CREDENTIALS_STORE_PREF_FILE, OAuth.JSON_FACTORY);
    // setup authorization flow
    AuthorizationFlow flow = new AuthorizationFlow.Builder(
            BearerToken.authorizationHeaderAccessMethod(),
            OAuth.HTTP_TRANSPORT,
            OAuth.JSON_FACTORY,
            new GenericUrl(FoursquareConstants.TOKEN_SERVER_URL),
            new ClientParametersAuthentication(FoursquareConstants.CLIENT_ID, null),
            FoursquareConstants.CLIENT_ID,
            FoursquareConstants.AUTHORIZATION_IMPLICIT_SERVER_URL)
            .setScopes(Lists.<String> newArrayList())
            .setCredentialStore(credentialStore)
            .build();
    // setup UI controller with customized layout
    AuthorizationDialogController controller =
            new CustomController(getFragmentManager(), fullScreen);
    // instantiate an OAuthManager instance
    oauth = new OAuthManager(flow, controller);
}
 
Example #26
Source File: ListPivotProcessor.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
protected void process(Record record, SingleLaneBatchMaker batchMaker) throws StageException {
  if (!record.has(listPath)) {
    switch (onStagePreConditionFailure) {
      case TO_ERROR:
        throw new OnRecordErrorException(Errors.LIST_PIVOT_01, record.getHeader().getSourceId(), listPath);
      case CONTINUE:
        return;
      default:
        throw new IllegalStateException("Invalid value for on stage pre-condition failure");
    }
  }

  Field listField = record.get(listPath);
  if (!listField.getType().isOneOf(Field.Type.LIST, Field.Type.LIST_MAP, Field.Type.MAP)) {
    throw new OnRecordErrorException(Errors.LIST_PIVOT_00, listPath);
  }

  List<PivotEntry> entries = Lists.newArrayList();
  if (listField.getType() == Field.Type.LIST) {
    List<Field> fieldList = listField.getValueAsList();
    for (Field field : fieldList) {
      entries.add(new PivotEntry(listPath, field));
    }
  } else {
    Set<Map.Entry<String, Field>> fieldEntries = listField.getValueAsMap().entrySet();
    for (Map.Entry<String, Field> entry : fieldEntries) {
      entries.add(new PivotEntry(entry.getKey(), entry.getValue()));
    }
  }

  pivot(entries, record, batchMaker);
}
 
Example #27
Source File: PlurkActivity.java    From android-oauth-client with Apache License 2.0 5 votes vote down vote up
public PlurkLoader(FragmentActivity activity, DateTime offset) {
    super(activity);
    this.offset = offset;
    oauth = OAuth.newInstance(activity.getApplicationContext(),
            activity.getSupportFragmentManager(),
            new ClientParametersAuthentication(PlurkConstants.CONSUMER_KEY,
                    PlurkConstants.CONSUMER_SECRET),
            PlurkConstants.AUTHORIZATION_VERIFIER_SERVER_URL,
            PlurkConstants.TOKEN_SERVER_URL,
            PlurkConstants.REDIRECT_URL,
            Lists.<String> newArrayList(),
            PlurkConstants.TEMPORARY_TOKEN_REQUEST_URL);
}
 
Example #28
Source File: GcpPlatformParameters.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
private Collection<DiskType> getDiskTypes() {
    Collection<DiskType> disks = Lists.newArrayList();
    for (GcpDiskType diskType : GcpDiskType.values()) {
        disks.add(diskType(diskType.value()));
    }
    return disks;
}
 
Example #29
Source File: GoogleIdTokenVerifierTest.java    From google-api-java-client with Apache License 2.0 5 votes vote down vote up
public void testBuilder() throws Exception {
  GoogleIdTokenVerifier.Builder builder = new GoogleIdTokenVerifier.Builder(
      new GooglePublicKeysManagerTest.PublicCertsMockHttpTransport(), new JacksonFactory()).setIssuer(
      ISSUER).setAudience(TRUSTED_CLIENT_IDS);
  assertEquals(Clock.SYSTEM, builder.getClock());
  assertEquals(ISSUER, builder.getIssuer());
  assertTrue(TRUSTED_CLIENT_IDS.equals(builder.getAudience()));
  Clock clock = new FixedClock(4);
  builder.setClock(clock);
  assertEquals(clock, builder.getClock());
  IdTokenVerifier verifier = builder.build();
  assertEquals(clock, verifier.getClock());
  assertEquals(ISSUER, verifier.getIssuer());
  assertEquals(TRUSTED_CLIENT_IDS, Lists.newArrayList(verifier.getAudience()));
}
 
Example #30
Source File: FlickrActivity.java    From android-oauth-client with Apache License 2.0 5 votes vote down vote up
public FlickrLoader(FragmentActivity activity) {
    super(activity);
    oauth = OAuth.newInstance(activity.getApplicationContext(),
            activity.getSupportFragmentManager(),
            new ClientParametersAuthentication(FlickrConstants.CONSUMER_KEY,
                    FlickrConstants.CONSUMER_SECRET),
            FlickrConstants.AUTHORIZATION_VERIFIER_SERVER_URL,
            FlickrConstants.TOKEN_SERVER_URL,
            FlickrConstants.REDIRECT_URL,
            Lists.<String> newArrayList(),
            FlickrConstants.TEMPORARY_TOKEN_REQUEST_URL);
}