Examples of Builder


Examples of com.github.kristofa.test.http.MockAndProxyFacade.Builder

            httpClient.getConnectionManager().shutdown();
        }
    }

    private MockAndProxyFacade buildFacade(final Mode mode) {
        final Builder builder = new Builder();
        return builder
            .mode(mode)
            .addForwardHttpRequestBuilder(new PassthroughForwardHttpRequestBuilder("localhost", SERVICE_PORT))
            .httpRequestResponseLoggerFactory(new HttpRequestResponseFileLoggerFactory(LOGGING_DIRECTORY, LOGGING_FILE_NAME))
            .port(MOCK_PROXY_PORT).httpResponseProvider(new FileHttpResponseProvider(LOGGING_DIRECTORY, LOGGING_FILE_NAME))
            .build();
View Full Code Here

Examples of com.github.nmorel.gwtjackson.client.JsonDeserializationContext.Builder

        static IgnoreStaticBeanMapper INSTANCE = GWT.create( IgnoreStaticBeanMapper.class );
    }

    public void testDeserializeValue() {
        IgnoreStaticTester.INSTANCE.testDeserializeValue( createReader( IgnoreStaticBeanMapper.INSTANCE, new Builder()
                .failOnUnknownProperties( false ).build() ) );
    }
View Full Code Here

Examples of com.github.nmorel.gwtjackson.client.JsonSerializationContext.Builder

    }

    private DateOptionsTester tester = DateOptionsTester.INSTANCE;

    public void testSerializeDatesAsTimestamps() {
        tester.testSerializeDatesAsTimestamps( createWriter( BeanWithDatesMapper.INSTANCE, new Builder().writeDatesAsTimestamps( true )
                .writeDateKeysAsTimestamps( true ).build() ) );
    }
View Full Code Here

Examples of com.github.sommeri.sourcemap.Mapping.OriginalMapping.Builder

  private OriginalMapping getOriginalMappingForEntry(Entry entry) {
    if (entry.getSourceFileId() == UNMAPPED) {
      return null;
    } else {
      // Adjust the line/column here to be start at 1.
      Builder x = OriginalMapping.newBuilder().setOriginalFile(sources[entry.getSourceFileId()]).setLineNumber(entry.getSourceLine() + 1).setColumnPosition(entry.getSourceColumn() + 1);
      if (entry.getNameId() != UNMAPPED) {
        x.setIdentifier(names[entry.getNameId()]);
      }
      return x.build();
    }
  }
View Full Code Here

Examples of com.github.youtube.vitess.jdbc.vtocc.QueryService.QueryResult.Builder

    sessionInfo.setSessionId((Long) body.get("SessionId"));
    return sessionInfo.build();
  }

  protected QueryResult createQueryResult(BSONObject bsonBody) {
    Builder queryResult = QueryResult.newBuilder();
    queryResult.setInsertId((Long) bsonBody.get("InsertId"));
    BSONObject fields = (BSONObject) bsonBody.get("Fields");
    for (String index : fields.keySet()) {
      BSONObject field = (BSONObject) fields.get(index);
      queryResult.addFields(
          Field.newBuilder()
              .setName(new String((byte[]) field.get("Name"), StandardCharsets.UTF_8))
              .setType(Type.valueOf(Ints.checkedCast((Long) field.get("Type"))))
              .build()
      );
    }

    BSONObject rows = (BSONObject) bsonBody.get("Rows");
    for (String rowIndex : rows.keySet()) {
      BSONObject bsonRow = (BSONObject) rows.get(rowIndex);
      Row.Builder queryRow = Row.newBuilder();
      for (String cellIndex : bsonRow.keySet()) {
        queryRow.addValues(Cell.newBuilder()
            .setValue(ByteString.copyFrom((byte[]) bsonRow.get(cellIndex))));
      }
      queryResult.addRows(queryRow);
    }

    queryResult.setRowsAffected((Long) bsonBody.get("RowsAffected"));
    return queryResult.build();
  }
View Full Code Here

Examples of com.github.youtube.vitess.jdbc.vtocc.QueryService.SessionParams.Builder

   */
  void init() throws SQLException {
    try {
      // lazy session creation to allow creation of VtoccTransactionHandler via Provider
      if (sessionInfo == null) {
        Builder sessionParams = SessionParams.newBuilder();
        Matcher matcher = Pattern.compile("([^/]*)(?:/(\\d+))?").matcher(vtoccKeyspaceShard);
        if (!matcher.matches()) {
          throw new IllegalArgumentException("Invalid keyspace/shard " + vtoccKeyspaceShard);
        }
        sessionParams.setKeyspace(matcher.group(1));
        if (matcher.group(2) != null) {
          sessionParams.setShard(matcher.group(2));
        }

        sessionInfo = sqlQueryBlockingInterface
            .getSessionId(rpcControllerProvider.get(), sessionParams.build());
      }
    } catch (ServiceException e) {
      throw VtoccSqlExceptionFactory.getSqlException(e);
    }
  }
View Full Code Here

Examples of com.google.android.gcm.server.Message.Builder

    return sendMessageToDevice(apiKey, devices, title, message, null);
  }

  private MulticastResult sendMessageToDevice(String apiKey, List<String> devices, String title, String message, Map<String, String> extraMap) {
    Sender sender = new Sender(apiKey);
    Builder builder = new Message.Builder().addData("title", title).addData("message", message);
    if (null != extraMap) {
      for (String key : extraMap.keySet()) {
        builder.addData(key, extraMap.get(key));
      }
    }
    Message gcmMessage = builder.build();
    MulticastResult result = null;
    try {
      result = sender.send(gcmMessage, devices, 3);
    } catch (IOException e) {
      // e.printStackTrace();
View Full Code Here

Examples of com.google.android.gcm.server.Result.Builder

        }
        String[] responseParts = split(line);
        String token = responseParts[0];
        String value = responseParts[1];
        if (token.equals(TOKEN_MESSAGE_ID)) {
          Builder builder = new Result.Builder().messageId(value);
          // check for canonical registration id
          line = reader.readLine();
          if (line != null) {
            responseParts = split(line);
            token = responseParts[0];
            value = responseParts[1];
            if (token.equals(TOKEN_CANONICAL_REG_ID)) {
              builder.canonicalRegistrationId(value);
            } else {
              logger.warning("Received invalid second line from GCM: " + line);
            }
          }

          Result result = builder.build();
          if (logger.isLoggable(Level.FINE)) {
            logger.fine("Message created succesfully (" + result + ")");
          }
          return result;
        } else if (token.equals(TOKEN_ERROR)) {
View Full Code Here

Examples of com.google.api.ads.adwords.lib.client.AdWordsSession.Builder

   * @param adWordsSession to copy from
   * @param userAgent the new User Agent for the session
   * @return a new copy of the AdWordsSession
   */
  public static AdWordsSession copy(AdWordsSession adWordsSession, String userAgent) {
    AdWordsSession.Builder builder = new Builder();
    if (adWordsSession.getEndpoint() != null) {
      builder = builder.withEndpoint(adWordsSession.getEndpoint());
    }
    if (userAgent != null) {
      builder = builder.withUserAgent(userAgent);
    } else {
      builder = builder.withUserAgent(USER_AGENT);
    }
    if (adWordsSession.getDeveloperToken() != null) {
      builder = builder.withDeveloperToken(adWordsSession.getDeveloperToken());
    }
    if (adWordsSession.getClientCustomerId() != null) {
      builder = builder.withClientCustomerId(adWordsSession.getClientCustomerId());
    }
    if (adWordsSession.getOAuth2Credential() != null) {
      builder = builder.withOAuth2Credential(adWordsSession.getOAuth2Credential());
    }

    try {
      AdWordsSession newAdWordsSession;
      newAdWordsSession = builder.build();
      newAdWordsSession.setPartialFailure(adWordsSession.isPartialFailure());
      newAdWordsSession.setValidateOnly(adWordsSession.isValidateOnly());
      newAdWordsSession.setReportMoneyInMicros(adWordsSession.isReportMoneyInMicros());
      return newAdWordsSession;
    } catch (ValidationException e) {
View Full Code Here

Examples of com.google.appengine.api.datastore.KeyFactory.Builder

        try {
            em = emf.createEntityManager();

            // An entity with a Key ID field. Can have an ancestor set
            // in the Key.
            Key book3key = new Builder("Publisher", "O'Reilly")
                .addChild("BookKeyId", "978-0-596-52272-8")
                .getKey();
            BookKeyId book3 = new BookKeyId(book3key);
            em.persist(book3);

        } finally {
            em.close();
        }

        try {
            em = emf.createEntityManager();

            // An object with its entity's key encoded as two String
            // fields, one for the object's kind and (string or
            // numeric) ID, and one for the parent.  (The class
            // constructor calls KeyFactory.keyToString() to encode
            // the Key values.  See BookEncodedStringId.java.)
            Key book4keyParent = new Builder("Publisher", "O'Reilly").getKey();
            Key book4key = new Builder("BookEncodedStringId", "978-0-596-52272-8")
                .getKey();
            BookEncodedStringId book4 = new BookEncodedStringId(book4key,
                                                                book4keyParent);
            em.persist(book4);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.