Fixed deletion by path routine
This commit is contained in:
parent
fc0f4e6411
commit
6a22868696
|
@ -737,7 +737,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
|||
throw new WebApplicationException("Multiple Fileset (" + matchingPaths.size() + ") matching " + path, Response.Status.BAD_REQUEST);
|
||||
|
||||
|
||||
RegisteredFileSet fs = Serialization.convert(wrapper.getByPath(path), RegisteredFileSet.class);
|
||||
RegisteredFileSet fs = Serialization.convert(wrapper.getByPath(path).get(0), RegisteredFileSet.class);
|
||||
log.debug("Going to delete {}", fs);
|
||||
|
||||
doc = triggerEvent(doc,EventExecutionRequest.Events.ON_DELETE_FILESET,new Document("force",force).append("path",path));
|
||||
|
|
|
@ -26,6 +26,15 @@ import static org.junit.Assume.assumeTrue;
|
|||
|
||||
public class DummyProjectTest extends AbstractProfiledDocumentsTests{
|
||||
|
||||
|
||||
// Try set releazione scavo
|
||||
String parentPath="section";
|
||||
String fieldName="fileset";
|
||||
String fieldDefinition="section."+Field.CHILDREN+"[?(@.fileset)]";
|
||||
|
||||
String filename = "sample.tif";
|
||||
|
||||
|
||||
@Override
|
||||
protected WebTarget baseTarget() {
|
||||
String testProfileId="basic";
|
||||
|
@ -69,6 +78,23 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
|
|||
RegisteredFileSet fs = Serialization.convert(wrapper.getByPath("section.fileset").get(0),RegisteredFileSet.class);
|
||||
assertTrue(fs.getPayloads().size()==1);
|
||||
assertTrue(fs.getString("customField").equals("customFieldValue"));
|
||||
|
||||
// test replace
|
||||
doc = upload(
|
||||
new StorageUtils(),
|
||||
doc.getId(),
|
||||
parentPath,fieldName,
|
||||
fieldDefinition,
|
||||
new Document("customField","customFieldValue"),
|
||||
RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING,
|
||||
filename);
|
||||
|
||||
wrapper = new JSONPathWrapper(doc.getTheDocument().toJson());
|
||||
assertTrue("Relazione exists",wrapper.getMatchingPaths("section").size()==1);
|
||||
fs = Serialization.convert(wrapper.getByPath("section.fileset").get(0),RegisteredFileSet.class);
|
||||
assertTrue(fs.getPayloads().size()==1);
|
||||
assertTrue(fs.getString("customField").equals("customFieldValue"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,12 +111,6 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
|
|||
|
||||
Project doc = createNew(baseDoc);
|
||||
|
||||
// Try set releazione scavo
|
||||
String parentPath="section";
|
||||
String fieldName="fileset";
|
||||
String fieldDefinition="section."+Field.CHILDREN+"[?(@.fileset)]";
|
||||
|
||||
String filename = "sample.tif";
|
||||
|
||||
|
||||
|
||||
|
@ -103,6 +123,7 @@ public class DummyProjectTest extends AbstractProfiledDocumentsTests{
|
|||
new Document("customField","customFieldValue"),
|
||||
RegisterFileSetRequest.ClashOptions.REPLACE_EXISTING,
|
||||
filename);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue