Merge branch 'develop' into NIFI-632

This commit is contained in:
danbress 2015-06-15 20:38:54 -04:00
commit 46aa2685e3
9 changed files with 79 additions and 26 deletions

View File

@ -13,7 +13,7 @@ module.exports = function (grunt) {
options: {
force: true
},
js: ['dist/js/'],
js: ['dist/js/*'],
css: ['dist/css/'],
assets: ['dist/assets/*'],
generated: ['dist/docs'],

View File

@ -22,9 +22,9 @@ title: Apache NiFi FAQs
<li>
<p class="description"><b>Where can I find documentation on how to understand and configure NiFi?</b></p>
<ul>
<li>Our draft/preview of the User Guide is now available under the docs dropdown.</li>
<li>We're working on completing that and having it fully integrated to the application.</li>
<li>The developer guide is also in the works.</li>
<li>Documentation is available under the <a href="docs.html">NiFi Docs</a> link within the Documentation dropdown.</li>
<li>A <a href="developer-guide.html">Developer Guide</a> is also available under the Development dropdown.</li>
<li>View the <a href="https://cwiki.apache.org/confluence/display/NIFI">Apache NiFi Wiki</a> for additional information related to the project as well as how to contribute.</li>
<li>For more information on presently outstanding documentation work <a href="https://issues.apache.org/jira/browse/NIFI-162?jql=project%20%3D%20NIFI%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Documentation%20%26%20Website%22%20ORDER%20BY%20priority%20DESC">please click here</a>.</li>
</ul>
</li>

View File

@ -115,6 +115,11 @@ title: Apache NiFi Team
<td>wikier</td>
<td>Sergio Fernandez </td>
<td>Mentor</td>
</tr>
<tr>
<td>danbress</td>
<td>Dan Bress</td>
<td></td>
</tr>
</table>
</div>

View File

@ -1142,11 +1142,10 @@
var target = $(e.target);
if (target.hasClass('delete-property')) {
// mark the property in question for removal
property.hidden = true;
// refresh the table
propertyData.updateItem(property.id, property);
// mark the property in question for removal and refresh the table
propertyData.updateItem(property.id, $.extend(property, {
hidden: true
}));
// prevents standard edit logic
e.stopImmediatePropagation();
@ -1381,15 +1380,15 @@
var propertyData = propertyGrid.getData();
// ensure the property name is unique
var existingPropertyId = null;
var existingItem = null;
$.each(propertyData.getItems(), function (_, item) {
if (propertyName === item.property) {
existingPropertyId = item.id;
existingItem = item;
return false;
}
});
if (existingPropertyId === null) {
if (existingItem === null) {
// load the descriptor and add the property
options.descriptorDeferred(propertyName).done(function(response) {
var descriptor = response.propertyDescriptor;
@ -1418,15 +1417,29 @@
propertyGrid.editActiveCell();
});
} else {
nf.Dialog.showOkDialog({
dialogContent: 'A property with this name already exists.',
overlayBackground: false
});
// select the existing properties row
var row = propertyData.getRowById(existingPropertyId);
propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row);
// if this row is currently hidden, clear the value and show it
if (existingItem.hidden === true) {
propertyData.updateItem(existingItem.id, $.extend(existingItem, {
hidden: false,
previousValue: null,
value: null
}));
// select the new properties row
var row = propertyData.getRowById(existingItem.id);
propertyGrid.setActiveCell(row, propertyGrid.getColumnIndex('value'));
propertyGrid.editActiveCell();
} else {
nf.Dialog.showOkDialog({
dialogContent: 'A property with this name already exists.',
overlayBackground: false
});
// select the existing properties row
var row = propertyData.getRowById(existingItem.id);
propertyGrid.setSelectedRows([row]);
propertyGrid.scrollRowIntoView(row);
}
}
} else {
nf.Dialog.showOkDialog({
@ -1448,6 +1461,10 @@
var code = e.keyCode ? e.keyCode : e.which;
if (code === $.ui.keyCode.ENTER) {
add();
// prevents the enter from propagating into the field for editing the new property value
e.stopImmediatePropagation();
e.preventDefault();
}
});

View File

@ -172,6 +172,11 @@
<artifactId>tika-core</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.5</version>
</dependency>
</dependencies>
<build>
<plugins>
@ -195,6 +200,7 @@
<exclude>src/test/resources/TestEncryptContent/text.txt.asc</exclude>
<exclude>src/test/resources/TestIdentifyMimeType/1.txt</exclude>
<exclude>src/test/resources/TestJson/json-sample.json</exclude>
<exclude>src/test/resources/TestJson/control-characters.json</exclude>
<exclude>src/test/resources/TestMergeContent/demarcate</exclude>
<exclude>src/test/resources/TestMergeContent/foot</exclude>
<exclude>src/test/resources/TestMergeContent/head</exclude>
@ -262,5 +268,5 @@
</configuration>
</plugin>
</plugins>
</build>
</build>
</project>

View File

@ -19,9 +19,8 @@ package org.apache.nifi.processors.standard;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.json.JsonSmartJsonProvider;
import net.minidev.json.parser.JSONParser;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.ValidationContext;
import org.apache.nifi.components.ValidationResult;
@ -50,7 +49,7 @@ import java.util.Objects;
*/
public abstract class AbstractJsonPathProcessor extends AbstractProcessor {
private static final Configuration STRICT_PROVIDER_CONFIGURATION = Configuration.builder().jsonProvider(new JsonSmartJsonProvider(JSONParser.MODE_RFC4627)).build();
private static final Configuration STRICT_PROVIDER_CONFIGURATION = Configuration.builder().jsonProvider(new JacksonJsonProvider()).build();
private static final JsonProvider JSON_PROVIDER = STRICT_PROVIDER_CONFIGURATION.jsonProvider();

View File

@ -16,7 +16,7 @@
-->
<head>
<meta charset="utf-8"/>
<title>EvaluateJsonPath</title>
<title>EncryptContent</title>
<link rel="stylesheet" href="../../css/component-usage.css" type="text/css"/>
</head>

View File

@ -344,4 +344,23 @@ public class TestEvaluateJsonPath {
assertEquals("Null Value", "null", nullValue);
}
@Test
public void testHandleAsciiControlCharacters() throws Exception {
final TestRunner testRunner = TestRunners.newTestRunner(new EvaluateJsonPath());
testRunner.setProperty(EvaluateJsonPath.DESTINATION, EvaluateJsonPath.DESTINATION_ATTRIBUTE);
testRunner.setProperty(EvaluateJsonPath.RETURN_TYPE, EvaluateJsonPath.RETURN_TYPE_JSON);
final String jsonPathControlCharKey = "evaluatejson.controlcharacterpath";
testRunner.setProperty(jsonPathControlCharKey, "$.jinxing_json.object.property");
testRunner.enqueue(Paths.get("src/test/resources/TestJson/control-characters.json"));
testRunner.run();
final Relationship expectedRel = EvaluateJsonPath.REL_MATCH;
testRunner.assertAllFlowFilesTransferred(expectedRel, 1);
final MockFlowFile out = testRunner.getFlowFilesForRelationship(expectedRel).get(0);
Assert.assertNotNull("Transferred flow file did not have the correct result for id attribute", out.getAttribute(jsonPathControlCharKey));
}
}

View File

@ -0,0 +1,7 @@
{
"jinxing_json": {
"object": {
"property": "Arbitrary characters to the right                                more normal characters"
}
}
}