Skip to content

Commit

Permalink
Name creation from attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamad Alamili committed Jun 5, 2016
1 parent 7a2ab69 commit cdc54e0
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import java.io.File;
import java.io.InputStream;
import java.net.URI;
import java.util.Properties;
import java.util.UUID;


public class CreateIndividualTest {
Expand All @@ -43,6 +45,29 @@ public void init() {
testRunner = TestRunners.newTestRunner(CreateIndividual.class);
}

@Test
public void testIndividualCreationWithName(){
Properties props = System.getProperties();
props.setProperty("nifi.properties.file.path", "/Users/mohamad/Dev/Coentunnel Backbone/nifi-0.6.1/./conf/nifi.properties");

InputStream cont = new ByteArrayInputStream("Test".getBytes());

ProcessSession session = testRunner.getProcessSessionFactory().createSession();
FlowFile flowFile = session.create();
flowFile = session.importFrom(cont, flowFile);
flowFile = session.putAttribute(flowFile, "id", UUID.randomUUID().toString());
flowFile = session.putAttribute(flowFile, "name", "Name is set");

testRunner.setProperty(CreateIndividual.INDIVIDUAL_ATTRIBUTE, "id");
testRunner.setProperty(CreateIndividual.NAME_ATTRIBUTE, "name");

// Add the flowfile to the runner
testRunner.enqueue(flowFile);

// Run the enqueued content, it also takes an int = number of contents queued
testRunner.run();
}

@Test
public void testOnTrigger(){

Expand Down

0 comments on commit cdc54e0

Please sign in to comment.