Skip to content

Commit

Permalink
Rely on adoc() like other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
psalagnac committed Feb 26, 2025
1 parent 64d2bcf commit 699b735
Showing 1 changed file with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
*/
package org.apache.solr.update.processor;

import java.io.IOException;
import java.io.StringWriter;
import java.util.Map;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.impl.XMLRequestWriter;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -41,11 +37,9 @@ public void testPartialUpdates() throws Exception {
doc.addField("id", "2a");
Map<String, Object> map = Map.of("set", "Hello Dude man!");
doc.addField("v_t", map);
UpdateRequest req = new UpdateRequest();
req.add(doc);
boolean exception_ok = false;
try {
addDoc(getXML(req), chain);
addDoc(adoc(doc), chain);
} catch (Exception e) {
exception_ok = true;
}
Expand All @@ -59,18 +53,8 @@ public void testPartialUpdates() throws Exception {
doc.addField("id", "2a");
map = Map.of("set", "name changed");
doc.addField("name", map);
req = new UpdateRequest();
req.add(doc);
addDoc(getXML(req), chain);
addDoc(adoc(doc), chain);
addDoc(commit(), chain);
SignatureUpdateProcessorFactoryTest.checkNumDocs(1);
}

public String getXML(UpdateRequest request) throws IOException {
StringWriter writer = new StringWriter();
XMLRequestWriter requestWriter = new XMLRequestWriter();
requestWriter.writeXML(request, writer);
writer.close();
return writer.toString();
}
}

0 comments on commit 699b735

Please sign in to comment.