File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
main/java/edu/unc/lib/boxc/services/camel/solrUpdate
test/java/edu/unc/lib/boxc/services/camel/solrUpdate Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,10 @@ public void process(Exchange exchange) throws Exception {
50
50
}
51
51
for (Object idObj : idCollection ) {
52
52
PID pid = PIDs .get (idObj .toString ());
53
- messageSender .sendIndexingOperation (null , pid , actionType );
53
+ // Make sure the object exists in solr before attempting to update it
54
+ if (solrClient .getById (pid .getId ()) != null ) {
55
+ messageSender .sendIndexingOperation (null , pid , actionType );
56
+ }
54
57
}
55
58
}
56
59
Original file line number Diff line number Diff line change 16
16
import org .apache .camel .test .spring .CamelSpringRunner ;
17
17
import org .apache .camel .test .spring .CamelTestContextBootstrapper ;
18
18
import org .apache .solr .client .solrj .SolrClient ;
19
+ import org .apache .solr .common .SolrDocument ;
19
20
import org .jdom2 .Document ;
20
21
import org .jdom2 .Element ;
21
22
import org .junit .Before ;
42
43
import static org .mockito .Mockito .timeout ;
43
44
import static org .mockito .Mockito .times ;
44
45
import static org .mockito .Mockito .verify ;
46
+ import static org .mockito .Mockito .when ;
45
47
46
48
/**
47
49
*
@@ -236,6 +238,8 @@ public void indexLowPriority() throws Exception {
236
238
237
239
@ Test
238
240
public void multipleWorkFromFile () throws Exception {
241
+ when (solrClient .getById (any (String .class ))).thenReturn (new SolrDocument ());
242
+
239
243
PID targetPid1 = pidMinter .mintContentPid ();
240
244
PID targetPid2 = pidMinter .mintContentPid ();
241
245
You can’t perform that action at this time.
0 commit comments