Java Code Examples for org.apache.http.util.Asserts#notNull()

The following examples show how to use org.apache.http.util.Asserts#notNull() . 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: InstamojoImpl.java    From instamojo-java with MIT License 6 votes vote down vote up
@Override
public Refund createRefund(Refund refund) throws HTTPException, ConnectionException {
    Asserts.notNull(refund, "Refund");

    try {
        String response = HttpUtils.post(context.getApiPath(Constants.PATH_REFUND + refund.getPaymentId() + "" +
                "/refund/"), getHeaders(), gson.toJson(refund));

        Type type = new TypeToken<ApiResponse<Refund>>() {
        }.getType();
        ApiResponse<Refund> createRefundResponse = gson.fromJson(response, type);
        return createRefundResponse.getResult();

    } catch (IOException e) {
        throw new ConnectionException(e.getMessage(), e);
    }
}
 
Example 2
Source File: ElasticSearchServer.java    From vind with Apache License 2.0 5 votes vote down vote up
@Override
public IndexResult index(List<Document> docs) {
    Asserts.notNull(docs,"Document to index should not be null.");
    Asserts.check(!docs.isEmpty(), "Should be at least one document to index.");

    return  indexMultipleDocuments(docs, -1);
}
 
Example 3
Source File: ElasticSearchServer.java    From vind with Apache License 2.0 5 votes vote down vote up
@Override
public IndexResult indexWithin(List<Document> docs, int withinMs) {
    Asserts.notNull(docs,"Document to index should not be null.");
    Asserts.check(!docs.isEmpty(), "Should be at least one document to index.");
    log.warn("Parameter 'within' not in use in elastic search backend");
    return  indexMultipleDocuments(docs, withinMs);
}
 
Example 4
Source File: SolrSearchServer.java    From vind with Apache License 2.0 5 votes vote down vote up
@Override
public IndexResult index(List<Document> docs) {
    Asserts.notNull(docs,"Document to index should not be null.");
    Asserts.check(docs.size() > 0, "Should be at least one document to index.");

    return  indexMultipleDocuments(docs, -1);
}
 
Example 5
Source File: InstamojoImpl.java    From instamojo-java with MIT License 5 votes vote down vote up
@Override
public PaymentOrderResponse createPaymentOrder(PaymentOrder paymentOrder) throws HTTPException, ConnectionException {
    Asserts.notNull(paymentOrder, "Payment Order");

    try {
        String response = HttpUtils.post(context.getApiPath(Constants.PATH_PAYMENT_ORDER), getHeaders(),
                gson.toJson(paymentOrder));
        return gson.fromJson(response, PaymentOrderResponse.class);

    } catch (IOException e) {
        throw new ConnectionException(e.getMessage(), e);
    }
}
 
Example 6
Source File: InstamojoImpl.java    From instamojo-java with MIT License 5 votes vote down vote up
@Override
public PaymentRequest createPaymentRequest(PaymentRequest paymentRequest) throws ConnectionException, HTTPException {
    Asserts.notNull(paymentRequest, "payment request");

    try {
        String response = HttpUtils.post(
                context.getApiPath(Constants.PATH_PAYMENT_REQUEST), getHeaders(), gson.toJson(paymentRequest));
        return gson.fromJson(response, PaymentRequest.class);

    } catch (IOException e) {
        throw new ConnectionException(e.getMessage(), e);
    }
}
 
Example 7
Source File: EntityBuilderProvider.java    From timer with Apache License 2.0 4 votes vote down vote up
public HttpEntity builder() {
    Asserts.notNull(this.entityBuilder, "entityBuilder should not be null");
    return this.entityBuilder.build();
}
 
Example 8
Source File: MultipartEntityBuilderProvider.java    From timer with Apache License 2.0 4 votes vote down vote up
public HttpEntity builder() {
    Asserts.notNull(multipartEntityBuilder, "entityBuilder should not be null");
    return this.multipartEntityBuilder.build();
}
 
Example 9
Source File: ElasticSearchServer.java    From vind with Apache License 2.0 4 votes vote down vote up
@Override
public IndexResult index(Document... docs) {
    Asserts.notNull(docs,"Document to index should not be null.");
    Asserts.check(docs.length > 0, "Should be at least one document to index.");
    return indexMultipleDocuments(Arrays.asList(docs), -1);
}
 
Example 10
Source File: ElasticSearchServer.java    From vind with Apache License 2.0 4 votes vote down vote up
@Override
public IndexResult indexWithin(Document doc, int withinMs) {
    Asserts.notNull(doc,"Document to index should not be null.");
    log.warn("Parameter 'within' not in use in elastic search backend");
    return indexMultipleDocuments(Collections.singletonList(doc), withinMs);
}
 
Example 11
Source File: SolrSearchServer.java    From vind with Apache License 2.0 4 votes vote down vote up
@Override
public IndexResult index(Document ... docs) {
    Asserts.notNull(docs,"Document to index should not be null.");
    Asserts.check(docs.length > 0, "Should be at least one document to index.");
    return indexMultipleDocuments(Arrays.asList(docs), -1);
}
 
Example 12
Source File: Config.java    From jkes with Apache License 2.0 4 votes vote down vote up
public static JkesProperties getJkesProperties() {
    Asserts.notNull(jkesProperties, "JkesProperties config must be set into Config");
    return jkesProperties;
}