Author: kwright
Date: Tue Sep 12 18:14:17 2017
New Revision: 1808140
URL: http://svn.apache.org/viewvc?rev=1808140&view=rev
Log:
Test for CONNECTORS-1456.
Modified:
manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/interfaces/ConfigurationTest.java
Modified:
manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/interfaces/ConfigurationTest.java
URL:
http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/interfaces/ConfigurationTest.java?rev=1808140&r1=1808139&r2=1808140&view=diff
==============================================================================
---
manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/interfaces/ConfigurationTest.java
(original)
+++
manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/interfaces/ConfigurationTest.java
Tue Sep 12 18:14:17 2017
@@ -28,6 +28,24 @@ import org.junit.*;
*/
public class ConfigurationTest {
+ private final static String testData =
"{\"job\":{\"id\":\"1505233221607\",\"description\":\"unit test:
job\",\"repository_connection\":\"unit test: Repository
connection\",\"document_specification\":{\"security\":{\"_value_\":\"\",\"_attribute_value\":\"off\"},\"parentfoldersecurity\":{\"_value_\":\"\",\"_attribute_value\":\"off\"},\"startpoint\":[{\"_value_\":\"\",\"_attribute_path\":\"attribute
path
one\",\"include\":[{\"_value_\":\"\",\"_attribute_filespec\":\"*\",\"_attribute_type\":\"directory\"},{\"_value_\":\"\",\"_attribute_filespec\":\"*.msg\",\"_attribute_type\":\"file\"}]},{\"_value_\":\"\",\"_attribute_path\":\"attribute
path
two\",\"include\":[{\"_value_\":\"\",\"_attribute_filespec\":\"*\",\"_attribute_type\":\"directory\"},{\"_value_\":\"\",\"_attribute_filespec\":\"*.msg\",\"_attribute_type\":\"file\"}]}],\"sharesecurity\":{\"_value_\":\"\",\"_attribute_value\":\"off\"}},\"pipelinestage\":[{\"stage_id\":\"0\",\"stage_isoutput\":\"true\",\"stage_connectionname\":\"
unit test: Output
connection\",\"stage_specification\":{}},{\"stage_id\":\"1\",\"stage_prerequisite\":\"0\",\"stage_isoutput\":\"true\",\"stage_connectionname\":\"unit
test: Output
connection\",\"stage_specification\":{}}],\"start_mode\":\"manual\",\"run_mode\":\"scan
once\",\"hopcount_mode\":\"accurate\",\"priority\":\"5\",\"recrawl_interval\":\"infinite\",\"expiration_interval\":\"infinite\",\"reseed_interval\":\"infinite\",\"schedule\":{\"requestminimum\":\"false\",\"dayofmonth\":{\"value\":[\"1\",\"15\"]}}}}";
+
+ @Test
+ public void testNakedValue()
+ throws ManifoldCFException {
+
+ // Deserialize first
+ final Configuration object2 = new Configuration();
+ object2.fromJSON(testData);
+
+ // Now, reserialize
+ final String jsonResult = object2.toJSON();
+
+ // Can't compare in this way; ordering of the input is not consistent.
+ //Assert.assertEquals(jsonResult, testData);
+ Assert.assertEquals(jsonResult.length(), testData.length());
+ }
+
@Test
public void testBackAndForth()
throws ManifoldCFException {