예제 #1
0
    virtual void run() {
        const BSONObj inputBson = pipelineFromJsonArray(inputPipeJson());
        const BSONObj shardPipeExpected = pipelineFromJsonArray(shardPipeJson());
        const BSONObj mergePipeExpected = pipelineFromJsonArray(mergePipeJson());

        intrusive_ptr<ExpressionContext> ctx =
            new ExpressionContext(&_opCtx, NamespaceString("a.collection"));
        string errmsg;
        mergePipe = Pipeline::parseCommand(errmsg, inputBson, ctx);
        ASSERT_EQUALS(errmsg, "");
        ASSERT(mergePipe != NULL);

        shardPipe = mergePipe->splitForSharded();
        ASSERT(shardPipe != NULL);

        ASSERT_EQUALS(Value(shardPipe->writeExplainOps()), Value(shardPipeExpected["pipeline"]));
        ASSERT_EQUALS(Value(mergePipe->writeExplainOps()), Value(mergePipeExpected["pipeline"]));
    }
예제 #2
0
                virtual void run() {
                    const BSONObj inputBson = pipelineFromJsonArray(inputPipeJson());
                    const BSONObj shardPipeExpected = pipelineFromJsonArray(shardPipeJson());
                    const BSONObj mergePipeExpected = pipelineFromJsonArray(mergePipeJson());

                    intrusive_ptr<ExpressionContext> ctx =
                        new ExpressionContext(InterruptStatusMongod::status,
                                              NamespaceString("a.collection"));
                    string errmsg;
                    intrusive_ptr<Pipeline> mergePipe =
                        Pipeline::parseCommand(errmsg, inputBson, ctx);
                    ASSERT_EQUALS(errmsg, "");
                    ASSERT(mergePipe != NULL);

                    intrusive_ptr<Pipeline> shardPipe = mergePipe->splitForSharded();
                    ASSERT(shardPipe != NULL);

                    ASSERT_EQUALS(shardPipe->serialize()["pipeline"],
                                  Value(shardPipeExpected["pipeline"]));
                    ASSERT_EQUALS(mergePipe->serialize()["pipeline"],
                                  Value(mergePipeExpected["pipeline"]));
                }