Avoid double serialization of json mode in recon config
This commit is contained in:
parent
8853e72ab9
commit
1e578384e2
@ -43,8 +43,8 @@ import java.util.Map;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
|
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
|
||||||
import com.google.refine.model.Cell;
|
import com.google.refine.model.Cell;
|
||||||
import com.google.refine.model.Project;
|
import com.google.refine.model.Project;
|
||||||
@ -131,7 +131,8 @@ abstract public class ReconConfig {
|
|||||||
/**
|
/**
|
||||||
* Returns the identifier for the reconciliation mode, as serialized in JSON.
|
* Returns the identifier for the reconciliation mode, as serialized in JSON.
|
||||||
* This is the same identifier that was used to register the registration mode.
|
* This is the same identifier that was used to register the registration mode.
|
||||||
|
* Jackson already adds the mode during serialization hence the JsonIgnore here.
|
||||||
*/
|
*/
|
||||||
@JsonProperty("mode")
|
@JsonIgnore
|
||||||
abstract public String getMode();
|
abstract public String getMode();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.google.refine.tests.model.recon;
|
package com.google.refine.tests.model.recon;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -14,6 +16,7 @@ import com.google.refine.operations.OperationRegistry;
|
|||||||
import com.google.refine.operations.recon.ReconOperation;
|
import com.google.refine.operations.recon.ReconOperation;
|
||||||
import com.google.refine.tests.RefineTest;
|
import com.google.refine.tests.RefineTest;
|
||||||
import com.google.refine.tests.util.TestUtils;
|
import com.google.refine.tests.util.TestUtils;
|
||||||
|
import com.google.refine.util.ParsingUtilities;
|
||||||
|
|
||||||
public class StandardReconConfigTests extends RefineTest {
|
public class StandardReconConfigTests extends RefineTest {
|
||||||
|
|
||||||
@ -85,5 +88,9 @@ public class StandardReconConfigTests extends RefineTest {
|
|||||||
" }";
|
" }";
|
||||||
ReconConfig config = ReconConfig.reconstruct(json);
|
ReconConfig config = ReconConfig.reconstruct(json);
|
||||||
TestUtils.isSerializedTo(config, json);
|
TestUtils.isSerializedTo(config, json);
|
||||||
|
|
||||||
|
// the "mode" only appears once in the serialization result
|
||||||
|
String fullJson = ParsingUtilities.mapper.writeValueAsString(config);
|
||||||
|
assertEquals(fullJson.indexOf("\"mode\"", fullJson.indexOf("\"mode\"")+1), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user