Examples of OK()


Examples of bear.plugins.sh.WriteStringResult.ok()

    public TaskResult<?> runScript(SessionContext $, String script) {
        final String tempPath = $.var($.bear.randomFilePath).getTempPath("mongo_", ".js");

        WriteStringResult result = $.sys.writeString(script).toPath(tempPath).run();

        if(!result.ok()){
            return TaskResult.value(result);
        }

        CommandLineResult<?> lineResult = $.sys.captureBuilder("mongo " + $.var(connectionString) + " " + tempPath).run();
View Full Code Here

Examples of com.alibaba.rocketmq.client.impl.producer.TopicPublishInfo.ok()

                    this.mQClientFactory.getMQClientAPIImpl()
                        .getTopicRouteInfoFromNameServer(topic, 1000 * 3);
            if (topicRouteData != null) {
                TopicPublishInfo topicPublishInfo =
                        MQClientInstance.topicRouteData2TopicPublishInfo(topic, topicRouteData);
                if (topicPublishInfo != null && topicPublishInfo.ok()) {
                    return topicPublishInfo.getMessageQueueList();
                }
            }
        }
        catch (Exception e) {
View Full Code Here

Examples of com.github.kevinsawicki.http.HttpRequest.ok()

  void download(String path, File toFile) {
    String fullUrl = serverUrl + path;
    try {
      Logs.debug("Download " + fullUrl + " to " + toFile.getAbsolutePath());
      HttpRequest httpRequest = newHttpRequest(new URL(fullUrl));
      if (!httpRequest.ok()) {
        throw new IOException(MessageFormat.format(STATUS_RETURNED_BY_URL_IS_INVALID, fullUrl, httpRequest.code()));
      }
      httpRequest.receive(toFile);

    } catch (Exception e) {
View Full Code Here

Examples of com.github.kevinsawicki.http.HttpRequest.ok()

    try {
      String charset = getCharsetFromContentType(httpRequest.contentType());
      if (charset == null || "".equals(charset)) {
        charset = "UTF-8";
      }
      if (!httpRequest.ok()) {
        throw new IOException(MessageFormat.format(STATUS_RETURNED_BY_URL_IS_INVALID, fullUrl, httpRequest.code()));
      }
      return httpRequest.body(charset);

    } catch (HttpRequest.HttpRequestException e) {
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

        // if invokeGetLastError is set, or a WriteConcern is set which implicitly calls getLastError, then we have the chance to populate
        // the MONGODB_LAST_ERROR header, as well as setting an exception on the Exchange if one occurred at the MongoDB server
        if (endpoint.isInvokeGetLastError() || (endpoint.getWriteConcern() != null ? endpoint.getWriteConcern().callGetLastError() : false)) {
            CommandResult cr = result.getCachedLastError() == null ? result.getLastError() : result.getCachedLastError();
            exchange.getOut().setHeader(MongoDbConstants.LAST_ERROR, cr);
            if (!cr.ok()) {
                exchange.setException(MongoDbComponent.wrapInCamelMongoDbException(cr.getException()));
            }
        }
       
        // determine where to set the WriteResult: as the OUT body or as an IN message header
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

        // if invokeGetLastError is set, or a WriteConcern is set which implicitly calls getLastError, then we have the chance to populate
        // the MONGODB_LAST_ERROR header, as well as setting an exception on the Exchange if one occurred at the MongoDB server
        if (endpoint.isInvokeGetLastError() || (endpoint.getWriteConcern() != null ? endpoint.getWriteConcern().callGetLastError() : false)) {
            CommandResult cr = result.getCachedLastError() == null ? result.getLastError() : result.getCachedLastError();
            exchange.getOut().setHeader(MongoDbConstants.LAST_ERROR, cr);
            if (!cr.ok()) {
                exchange.setException(MongoDbComponent.wrapInCamelMongoDbException(cr.getException()));
            }
        }
       
        // determine where to set the WriteResult: as the OUT body or as an IN message header
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

        in.close();
       
        // execute last statement
        try {
          CommandResult result = db.doEval("(function() {"+data.toString()+"})();", new Object[0]);
          if (!result.ok()) {
              getLog().warn(
                "Error executing "+file.getName()+": "
                +result.getErrorMessage(), result.getException());
          } else {
            getLog().info(" "+file.getName()+" executed successfully");
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

            assertNotNull(wr.getCachedLastError());
        } else {
            assertNull(wr.getCachedLastError());
        }
        CommandResult cr = wr.getLastError();
        assertTrue(cr.ok());
    }
   
    @Test
    public void testDynamicWriteConcernSafe() throws Exception {
        assertEquals(0, testCollection.count());
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

        assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
        WriteResult wr = (WriteResult) result;
        // should not be null because with WriteConcern.SAFE, getLastError was called implicitly by the driver
        assertNotNull(wr.getCachedLastError());
        CommandResult cr = wr.getLastError();
        assertTrue(cr.ok());
       
        // same behaviour should be reproduced with String 'SAFE'
        result = template.requestBodyAndHeader("direct:noWriteConcern", "{\"scientist\":\"newton\"}", MongoDbConstants.WRITECONCERN, "SAFE");
        assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
        wr = (WriteResult) result;
View Full Code Here

Examples of com.mongodb.CommandResult.ok()

        assertTrue("Result is not of type WriteResult", result instanceof WriteResult);
        wr = (WriteResult) result;
        // should not be null because with WriteConcern.SAFE, getLastError was called implicitly by the driver
        assertNotNull(wr.getCachedLastError());
        cr = wr.getLastError();
        assertTrue(cr.ok());
    }
   
    @Test
    public void testDynamicWriteConcernUnknown() throws Exception {
        assertEquals(0, testCollection.count());
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.