You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by MikeThomsen <gi...@git.apache.org> on 2017/11/25 17:56:31 UTC

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

GitHub user MikeThomsen opened a pull request:

    https://github.com/apache/nifi/pull/2295

    NIFI-4479 Added DeleteMongo processor.

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MikeThomsen/nifi NIFI-4479

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2295.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2295
    
----
commit 8ade06d6a542bfa74bad6026302c1f125bc8419f
Author: Mike Thomsen <mi...@gmail.com>
Date:   2017-11-25T13:51:17Z

    NIFI-4479 Added DeleteMongo processor.

----


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156243392
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/DeleteMongo.java ---
    @@ -0,0 +1,151 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.nifi.processors.mongodb;
    +
    +import com.mongodb.WriteConcern;
    +import com.mongodb.client.MongoCollection;
    +import com.mongodb.client.result.DeleteResult;
    +import org.apache.nifi.annotation.behavior.EventDriven;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.AllowableValue;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.bson.Document;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +@EventDriven
    +@Tags({ "delete", "mongo", "mongodb" })
    +@CapabilityDescription(
    +        "Executes a delete query against a MongoDB collection. The query is provided in the body of the flowfile " +
    +        "and the user can select whether it will delete one or many documents that match it."
    +)
    +public class DeleteMongo extends AbstractMongoProcessor {
    +
    +    private final static Set<Relationship> relationships;
    +    private final static List<PropertyDescriptor> propertyDescriptors;
    +
    +    static final AllowableValue DELETE_ONE = new AllowableValue("one", "Delete One", "Delete only the first document that matches the query.");
    +    static final AllowableValue DELETE_MANY = new AllowableValue("many", "Delete Many", "Delete every document that matches the query.");
    +
    +    static final AllowableValue YES_FAIL = new AllowableValue("true", "True", "Fail when no documents are deleted.");
    +    static final AllowableValue NO_FAIL  = new AllowableValue("false", "False", "Do not fail when nothing is deleted.");
    +
    +    static final PropertyDescriptor DELETE_MODE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-delete-mode")
    +            .displayName("Delete Mode")
    +            .description("Choose between deleting one document by query or many documents by query.")
    +            .allowableValues(DELETE_ONE, DELETE_MANY)
    +            .defaultValue("one")
    +            .addValidator(Validator.VALID)
    +            .build();
    +
    +    static final PropertyDescriptor FAIL_ON_NO_DELETE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-fail-on-no-delete")
    +            .displayName("Fail When Nothing Is Deleted")
    +            .description("Determines whether to send the flowfile to the success or failure relationship if nothing is successfully deleted.")
    +            .allowableValues(YES_FAIL, NO_FAIL)
    +            .defaultValue("true")
    +            .addValidator(Validator.VALID)
    +            .build();
    +
    +    static final Relationship REL_SUCCESS = new Relationship.Builder().name("success")
    +            .description("All FlowFiles that are written to MongoDB are routed to this relationship").build();
    +    static final Relationship REL_FAILURE = new Relationship.Builder().name("failure")
    +            .description("All FlowFiles that cannot be written to MongoDB are routed to this relationship").build();
    +
    +    static {
    +        List<PropertyDescriptor> _propertyDescriptors = new ArrayList<>();
    +        _propertyDescriptors.addAll(descriptors);
    +        _propertyDescriptors.add(DELETE_MODE);
    +        _propertyDescriptors.add(FAIL_ON_NO_DELETE);
    +        _propertyDescriptors.add(WRITE_CONCERN);
    +        propertyDescriptors = Collections.unmodifiableList(_propertyDescriptors);
    +
    +        final Set<Relationship> _relationships = new HashSet<>();
    +        _relationships.add(REL_SUCCESS);
    +        _relationships.add(REL_FAILURE);
    +        relationships = Collections.unmodifiableSet(_relationships);
    +    }
    +
    +    @Override
    +    public Set<Relationship> getRelationships() {
    +        return relationships;
    +    }
    +
    +    @Override
    +    public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
    +        return propertyDescriptors;
    +    }
    +
    +    @Override
    +    public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    +        FlowFile flowFile = session.get();
    +        if (flowFile == null) {
    --- End diff --
    
    If this requires an incoming flow file then we should add the corresponding InputRequirement annotation. Can you think of a use case where you'd want to execute this without an incoming flow file? Doesn't seem very useful unless there's a flow file present...


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156243670
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/DeleteMongo.java ---
    @@ -0,0 +1,151 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.nifi.processors.mongodb;
    +
    +import com.mongodb.WriteConcern;
    +import com.mongodb.client.MongoCollection;
    +import com.mongodb.client.result.DeleteResult;
    +import org.apache.nifi.annotation.behavior.EventDriven;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.AllowableValue;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.bson.Document;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +@EventDriven
    +@Tags({ "delete", "mongo", "mongodb" })
    +@CapabilityDescription(
    +        "Executes a delete query against a MongoDB collection. The query is provided in the body of the flowfile " +
    +        "and the user can select whether it will delete one or many documents that match it."
    +)
    +public class DeleteMongo extends AbstractMongoProcessor {
    +
    +    private final static Set<Relationship> relationships;
    +    private final static List<PropertyDescriptor> propertyDescriptors;
    +
    +    static final AllowableValue DELETE_ONE = new AllowableValue("one", "Delete One", "Delete only the first document that matches the query.");
    +    static final AllowableValue DELETE_MANY = new AllowableValue("many", "Delete Many", "Delete every document that matches the query.");
    +
    +    static final AllowableValue YES_FAIL = new AllowableValue("true", "True", "Fail when no documents are deleted.");
    +    static final AllowableValue NO_FAIL  = new AllowableValue("false", "False", "Do not fail when nothing is deleted.");
    +
    +    static final PropertyDescriptor DELETE_MODE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-delete-mode")
    +            .displayName("Delete Mode")
    +            .description("Choose between deleting one document by query or many documents by query.")
    +            .allowableValues(DELETE_ONE, DELETE_MANY)
    +            .defaultValue("one")
    +            .addValidator(Validator.VALID)
    +            .build();
    +
    +    static final PropertyDescriptor FAIL_ON_NO_DELETE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-fail-on-no-delete")
    +            .displayName("Fail When Nothing Is Deleted")
    +            .description("Determines whether to send the flowfile to the success or failure relationship if nothing is successfully deleted.")
    +            .allowableValues(YES_FAIL, NO_FAIL)
    +            .defaultValue("true")
    +            .addValidator(Validator.VALID)
    +            .build();
    +
    +    static final Relationship REL_SUCCESS = new Relationship.Builder().name("success")
    +            .description("All FlowFiles that are written to MongoDB are routed to this relationship").build();
    +    static final Relationship REL_FAILURE = new Relationship.Builder().name("failure")
    +            .description("All FlowFiles that cannot be written to MongoDB are routed to this relationship").build();
    +
    +    static {
    +        List<PropertyDescriptor> _propertyDescriptors = new ArrayList<>();
    +        _propertyDescriptors.addAll(descriptors);
    +        _propertyDescriptors.add(DELETE_MODE);
    +        _propertyDescriptors.add(FAIL_ON_NO_DELETE);
    +        _propertyDescriptors.add(WRITE_CONCERN);
    +        propertyDescriptors = Collections.unmodifiableList(_propertyDescriptors);
    +
    +        final Set<Relationship> _relationships = new HashSet<>();
    +        _relationships.add(REL_SUCCESS);
    +        _relationships.add(REL_FAILURE);
    +        relationships = Collections.unmodifiableSet(_relationships);
    +    }
    +
    +    @Override
    +    public Set<Relationship> getRelationships() {
    +        return relationships;
    +    }
    +
    +    @Override
    +    public List<PropertyDescriptor> getSupportedPropertyDescriptors() {
    +        return propertyDescriptors;
    +    }
    +
    +    @Override
    +    public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
    +        FlowFile flowFile = session.get();
    +        if (flowFile == null) {
    +            return;
    +        }
    +
    +        final WriteConcern writeConcern = getWriteConcern(context);
    +        final MongoCollection<Document> collection = getCollection(context).withWriteConcern(writeConcern);
    +        final String deleteMode = context.getProperty(DELETE_MODE).getValue();
    +        final Boolean failMode  = context.getProperty(FAIL_ON_NO_DELETE).asBoolean();
    +
    +        DeleteResult result;
    +
    +        try {
    +            ByteArrayOutputStream bos = new ByteArrayOutputStream();
    +            session.exportTo(flowFile, bos);
    +            bos.close();
    +
    +            String json = new String(bos.toByteArray());
    +            Document query = Document.parse(json);
    +
    +            getLogger().info("Test\n\n\n\n\n\n");
    --- End diff --
    
    This can be removed (or replaced with a debug/info message to inform what's going on


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156244249
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/DeleteMongo.java ---
    @@ -0,0 +1,151 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.nifi.processors.mongodb;
    +
    +import com.mongodb.WriteConcern;
    +import com.mongodb.client.MongoCollection;
    +import com.mongodb.client.result.DeleteResult;
    +import org.apache.nifi.annotation.behavior.EventDriven;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.AllowableValue;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.bson.Document;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +@EventDriven
    +@Tags({ "delete", "mongo", "mongodb" })
    +@CapabilityDescription(
    +        "Executes a delete query against a MongoDB collection. The query is provided in the body of the flowfile " +
    +        "and the user can select whether it will delete one or many documents that match it."
    +)
    +public class DeleteMongo extends AbstractMongoProcessor {
    +
    +    private final static Set<Relationship> relationships;
    +    private final static List<PropertyDescriptor> propertyDescriptors;
    +
    +    static final AllowableValue DELETE_ONE = new AllowableValue("one", "Delete One", "Delete only the first document that matches the query.");
    +    static final AllowableValue DELETE_MANY = new AllowableValue("many", "Delete Many", "Delete every document that matches the query.");
    +
    +    static final AllowableValue YES_FAIL = new AllowableValue("true", "True", "Fail when no documents are deleted.");
    +    static final AllowableValue NO_FAIL  = new AllowableValue("false", "False", "Do not fail when nothing is deleted.");
    +
    +    static final PropertyDescriptor DELETE_MODE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-delete-mode")
    +            .displayName("Delete Mode")
    +            .description("Choose between deleting one document by query or many documents by query.")
    +            .allowableValues(DELETE_ONE, DELETE_MANY)
    --- End diff --
    
    Is this something that the user would want to configure per-flow file? If so, one pattern that is used (to keep the dropdown for allowable values) is to pick an attribute (such as "mongodb.delete.mode") and add an allowable value "Use 'mongodb.delete.mode' attribute"


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156244268
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/DeleteMongo.java ---
    @@ -0,0 +1,151 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +
    +package org.apache.nifi.processors.mongodb;
    +
    +import com.mongodb.WriteConcern;
    +import com.mongodb.client.MongoCollection;
    +import com.mongodb.client.result.DeleteResult;
    +import org.apache.nifi.annotation.behavior.EventDriven;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.AllowableValue;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.Validator;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.ProcessContext;
    +import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.Relationship;
    +import org.apache.nifi.processor.exception.ProcessException;
    +import org.bson.Document;
    +
    +import java.io.ByteArrayOutputStream;
    +import java.util.ArrayList;
    +import java.util.Collections;
    +import java.util.HashSet;
    +import java.util.List;
    +import java.util.Set;
    +
    +@EventDriven
    +@Tags({ "delete", "mongo", "mongodb" })
    +@CapabilityDescription(
    +        "Executes a delete query against a MongoDB collection. The query is provided in the body of the flowfile " +
    +        "and the user can select whether it will delete one or many documents that match it."
    +)
    +public class DeleteMongo extends AbstractMongoProcessor {
    +
    +    private final static Set<Relationship> relationships;
    +    private final static List<PropertyDescriptor> propertyDescriptors;
    +
    +    static final AllowableValue DELETE_ONE = new AllowableValue("one", "Delete One", "Delete only the first document that matches the query.");
    +    static final AllowableValue DELETE_MANY = new AllowableValue("many", "Delete Many", "Delete every document that matches the query.");
    +
    +    static final AllowableValue YES_FAIL = new AllowableValue("true", "True", "Fail when no documents are deleted.");
    +    static final AllowableValue NO_FAIL  = new AllowableValue("false", "False", "Do not fail when nothing is deleted.");
    +
    +    static final PropertyDescriptor DELETE_MODE = new PropertyDescriptor.Builder()
    +            .name("delete-mongo-delete-mode")
    +            .displayName("Delete Mode")
    +            .description("Choose between deleting one document by query or many documents by query.")
    +            .allowableValues(DELETE_ONE, DELETE_MANY)
    +            .defaultValue("one")
    --- End diff --
    
    Should we be displaying the friendly name here?


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/2295


---

[GitHub] nifi issue #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on the issue:

    https://github.com/apache/nifi/pull/2295
  
    +1 LGTM, ran a build with unit/integration tests and contrib-check against a live MongoDB, everything works fine. Thanks much for this feature! Merging to master


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156244806
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/MongoWriteTestBase.java ---
    @@ -0,0 +1,65 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.processors.mongodb;
    +
    +import com.google.common.collect.Lists;
    --- End diff --
    
    Do we already have this library available for some other reason? Wondering why we can't use Arrays.asList(), especially if this is the only use of it (I haven't checked)


---

[GitHub] nifi issue #2295: NIFI-4479 Added DeleteMongo processor.

Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:

    https://github.com/apache/nifi/pull/2295
  
    Just checked in the updates.


---

[GitHub] nifi pull request #2295: NIFI-4479 Added DeleteMongo processor.

Posted by mattyb149 <gi...@git.apache.org>.
Github user mattyb149 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2295#discussion_r156244644
  
    --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/PutMongoTest.java ---
    @@ -37,47 +29,24 @@
     import org.junit.Ignore;
     import org.junit.Test;
     
    -import com.google.common.collect.Lists;
    -import com.mongodb.MongoClient;
    -import com.mongodb.MongoClientURI;
    -import com.mongodb.client.MongoCollection;
    -
    -@Ignore("Integration tests that cause failures in some environments. Require that they be run from Maven to run the embedded mongo maven plugin. Maven Plugin also fails in my CentOS 7 environment.")
    -public class PutMongoTest {
    -    private static final String MONGO_URI = "mongodb://localhost";
    -    private static final String DATABASE_NAME = PutMongoTest.class.getSimpleName().toLowerCase();
    -    private static final String COLLECTION_NAME = "test";
    -
    -    private static final List<Document> DOCUMENTS = Lists.newArrayList(
    -        new Document("_id", "doc_1").append("a", 1).append("b", 2).append("c", 3),
    -        new Document("_id", "doc_2").append("a", 1).append("b", 2).append("c", 4),
    -        new Document("_id", "doc_3").append("a", 1).append("b", 3)
    -        );
    +import java.util.Collection;
    +import java.util.HashSet;
    +import java.util.Iterator;
    +import java.util.List;
     
    -    private TestRunner runner;
    -    private MongoClient mongoClient;
    -    private MongoCollection<Document> collection;
    +import static com.google.common.base.Charsets.UTF_8;
    --- End diff --
    
    This doesn't look necessary, and even so we should be using StandardCharsets unless there's some reason not to.


---