Skip to content

Commit 143359f

Browse files
authored
BXC-3419 - Upgrade to camel 3 (#1765)
* Update to camel 3, fix syntax errors * Get OrderMembersRouter working with junit 5 and camel 3. Add mockito-junit-jupiter to services-camel and make it centrally managed * Update longleaf register test to work with camel 3, junit 5. Add slightly more test coverage * Update deregister test * Update enhancement router and test to work with camel 3 * Update full text router * Update DestroyDerivatives router and test * Split router test from processor test * Update CdrEventRouter and related tests. Update SolrUpdateRouter, although tests specific to it still need updating. Add camel spring junit 5 library * Update destroy route * Update ViewSettingRouter * Commiting updates for triples indexing router * Potential local inclusion of triplestore router from fcrepo camel due to conflict with camel 3 * Non-functional fcrepo jetty impl * Continuing to update tests * Update AccessSurrogateRouter for camel 3 * Mostly working TriplesReindexingRouter and test. Added method for executing updates to triple store. Performing updates via a processor rather than forwarding to fcrepo camel toolbox * Use TriplestoreRouter for indexing. Replace deprecated inOnly call. Adjust test to start checking for objects to be indexed sooner, to be more flexible about the exact number of messages being processed * Updating tests * Replace redirect uuidGenerator usage with a lambda since it doesn't have a process method anymore. * Update test to junit 5 * Update SolrUpdateRouter and test * Update DestroyDerivativesRouterIT * Updated ExportXMLRouteIT * Updated ImportXMLIT * Get Solr related tests working, and a few others * Junit 5 updates * Restoring EnhancementRouterIT * Tidying up and fixing longleaf routes * Remove unused embedded-redis * Move sparql update usage over to SparqlUpdateService. Remove method from the query service * Remove unused dependencies and class * Remove unnecessary changes, commented out code * Group camel routes into single context. Add spring boot xml jar which seems to be necessary for camel namespaces in spring context files now. Replace some additional hardcoded activemq routes with variables * Adjusting startup orders to avoid conflicts now that everything is in the same context * Remove import * Fix property name * Codeclimate * Remove unused import
1 parent aa5e63e commit 143359f

File tree

93 files changed

+2282
-2300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2282
-2300
lines changed

Diff for: common-utils/pom.xml

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<groupId>org.apache.commons</groupId>
3535
<artifactId>commons-lang3</artifactId>
3636
</dependency>
37+
<dependency>
38+
<groupId>org.apache.commons</groupId>
39+
<artifactId>commons-collections4</artifactId>
40+
</dependency>
3741
<dependency>
3842
<groupId>joda-time</groupId>
3943
<artifactId>joda-time</artifactId>

Diff for: fcrepo-utils/src/main/java/edu/unc/lib/boxc/fcrepo/utils/FedoraSparqlUpdateService.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void executeUpdate(String uri, String updateString) {
3232
URI rescUri = URI.create(uri);
3333

3434
try (InputStream sparqlStream = new ByteArrayInputStream(updateString.getBytes(UTF_8))) {
35-
try (FcrepoResponse response = fcrepoClient.patch(rescUri)
35+
try (FcrepoResponse ignored = fcrepoClient.patch(rescUri)
3636
.body(sparqlStream)
3737
.perform()) {
3838
}
@@ -43,6 +43,11 @@ public void executeUpdate(String uri, String updateString) {
4343
}
4444
}
4545

46+
@Override
47+
public void executeUpdate(String updateString) {
48+
throw new UnsupportedOperationException("FedoraSparqlUpdateService requires a resource URI to update");
49+
}
50+
4651
/**
4752
* @param fcrepoClient the fcrepoClient to set
4853
*/

Diff for: model-api/src/main/java/edu/unc/lib/boxc/model/api/sparql/SparqlUpdateService.java

+2
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ public interface SparqlUpdateService {
1717
*/
1818
public void executeUpdate(String uri, String updateString);
1919

20+
public void executeUpdate(String updateString);
21+
2022
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package edu.unc.lib.boxc.model.fcrepo.sparql;
2+
3+
import edu.unc.lib.boxc.model.api.sparql.SparqlUpdateService;
4+
import org.apache.jena.update.UpdateExecutionFactory;
5+
import org.apache.jena.update.UpdateFactory;
6+
import org.apache.jena.update.UpdateProcessor;
7+
import org.apache.jena.update.UpdateRequest;
8+
9+
/**
10+
* Query service for updating triples in a triple store
11+
*
12+
* @author bbpennel
13+
*/
14+
public class TripleStoreSparqlUpdateService implements SparqlUpdateService {
15+
private String fusekiQueryURL;
16+
17+
@Override
18+
public void executeUpdate(String uri, String updateString) {
19+
executeUpdate(updateString);
20+
}
21+
22+
@Override
23+
public void executeUpdate(String queryString) {
24+
UpdateRequest updateRequest = UpdateFactory.create(queryString);
25+
UpdateProcessor updateProcessor = UpdateExecutionFactory.createRemote(updateRequest, fusekiQueryURL);
26+
updateProcessor.execute();
27+
}
28+
29+
public void setFusekiQueryURL(String fusekiQueryURL) {
30+
this.fusekiQueryURL = fusekiQueryURL;
31+
}
32+
}

Diff for: pom.xml

+15-11
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<grizzly.version>2.4.4</grizzly.version>
7676
<jersey.version>2.34</jersey.version>
7777
<mockito.version>5.11.0</mockito.version>
78-
<mockito.junit.version>5.0.0</mockito.junit.version>
78+
<mockito.junit.version>5.11.0</mockito.junit.version>
7979
<fcrepo.client.version>5.0.0</fcrepo.client.version>
8080
<mock.server.version>5.4.1</mock.server.version>
8181
<awaitility.version>4.0.3</awaitility.version>
@@ -101,10 +101,10 @@
101101
<commons-csv.version>1.6</commons-csv.version>
102102
<commons-lang3.version>3.8.1</commons-lang3.version>
103103
<commons-fileupload.version>1.5</commons-fileupload.version>
104+
<commons-collections.version>4.4</commons-collections.version>
104105
<abdera.version>1.1.3</abdera.version>
105106

106107
<activemq.version>5.17.6</activemq.version>
107-
<activemq-camel.version>5.16.7</activemq-camel.version>
108108
<activemq-protobuf.version>1.1</activemq-protobuf.version>
109109

110110
<slf4j.version>1.7.25</slf4j.version>
@@ -126,13 +126,12 @@
126126
<jsp-api.version>2.3.6</jsp-api.version>
127127

128128
<jedis.version>3.10.0</jedis.version>
129-
<embedded-redis.version>0.7.3</embedded-redis.version>
130129
<solr.version>8.10.1</solr.version>
131130
<metrics.version>5.0.0</metrics.version>
132131
<jena.version>4.4.0</jena.version>
133132

134-
<fcrepo-camel.version>5.0.0</fcrepo-camel.version>
135-
<camel.version>2.25.4</camel.version>
133+
<fcrepo-camel.version>6.0.0</fcrepo-camel.version>
134+
<camel.version>3.22.1</camel.version>
136135
<tika.version>2.8.0</tika.version>
137136

138137
<maven.failsafe.version>2.22.1</maven.failsafe.version>
@@ -681,6 +680,12 @@
681680
<version>${mockito.version}</version>
682681
<scope>test</scope>
683682
</dependency>
683+
<dependency>
684+
<groupId>org.mockito</groupId>
685+
<artifactId>mockito-junit-jupiter</artifactId>
686+
<version>${mockito.junit.version}</version>
687+
<scope>test</scope>
688+
</dependency>
684689
<dependency>
685690
<groupId>org.awaitility</groupId>
686691
<artifactId>awaitility</artifactId>
@@ -885,6 +890,11 @@
885890
<artifactId>commons-fileupload</artifactId>
886891
<version>${commons-fileupload.version}</version>
887892
</dependency>
893+
<dependency>
894+
<groupId>org.apache.commons</groupId>
895+
<artifactId>commons-collections4</artifactId>
896+
<version>${commons-collections.version}</version>
897+
</dependency>
888898
<dependency>
889899
<groupId>org.apache.abdera</groupId>
890900
<artifactId>abdera-client</artifactId>
@@ -896,12 +906,6 @@
896906
<artifactId>jedis</artifactId>
897907
<version>${jedis.version}</version>
898908
</dependency>
899-
<dependency>
900-
<groupId>it.ozimov</groupId>
901-
<artifactId>embedded-redis</artifactId>
902-
<version>${embedded-redis.version}</version>
903-
<scope>test</scope>
904-
</dependency>
905909
<dependency>
906910
<groupId>org.apache.activemq</groupId>
907911
<artifactId>activemq-kahadb-store</artifactId>

Diff for: services-camel-app/pom.xml

+35-53
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
<groupId>org.apache.camel</groupId>
3232
<artifactId>camel-spring</artifactId>
3333
<version>${camel.version}</version>
34-
<exclusions>
35-
<exclusion>
36-
<groupId>org.springframework</groupId>
37-
<artifactId>spring-expression</artifactId>
38-
</exclusion>
39-
</exclusions>
34+
</dependency>
35+
<dependency>
36+
<groupId>org.apache.camel.springboot</groupId>
37+
<artifactId>camel-spring-boot-xml-starter</artifactId>
38+
<version>${camel.version}</version>
4039
</dependency>
4140
<dependency>
4241
<groupId>org.apache.camel</groupId>
@@ -50,14 +49,9 @@
5049
</dependency>
5150
<dependency>
5251
<groupId>org.apache.camel</groupId>
53-
<artifactId>camel-spring-javaconfig</artifactId>
52+
<artifactId>camel-activemq</artifactId>
5453
<version>${camel.version}</version>
5554
</dependency>
56-
<dependency>
57-
<groupId>org.apache.activemq</groupId>
58-
<artifactId>activemq-camel</artifactId>
59-
<version>${activemq-camel.version}</version>
60-
</dependency>
6155
<dependency>
6256
<groupId>org.apache.activemq</groupId>
6357
<artifactId>activemq-broker</artifactId>
@@ -66,11 +60,6 @@
6660
<groupId>org.apache.activemq</groupId>
6761
<artifactId>activemq-client</artifactId>
6862
</dependency>
69-
<dependency>
70-
<groupId>org.apache.camel</groupId>
71-
<artifactId>camel-sjms</artifactId>
72-
<version>${camel.version}</version>
73-
</dependency>
7463

7564
<dependency>
7665
<groupId>commons-io</groupId>
@@ -81,39 +70,13 @@
8170
<groupId>org.fcrepo.camel</groupId>
8271
<artifactId>fcrepo-camel</artifactId>
8372
<version>${fcrepo-camel.version}</version>
84-
<exclusions>
85-
<exclusion>
86-
<groupId>org.apache.camel</groupId>
87-
<artifactId>camel-jackson</artifactId>
88-
</exclusion>
89-
<exclusion>
90-
<groupId>org.apache.jena</groupId>
91-
<artifactId>jena-osgi</artifactId>
92-
</exclusion>
93-
</exclusions>
9473
</dependency>
9574

9675
<dependency>
9776
<groupId>org.apache.camel</groupId>
98-
<artifactId>camel-http4</artifactId>
77+
<artifactId>camel-http</artifactId>
9978
<version>${camel.version}</version>
10079
</dependency>
101-
102-
<dependency>
103-
<groupId>org.fcrepo.camel</groupId>
104-
<artifactId>fcrepo-indexing-triplestore</artifactId>
105-
<version>${fcrepo-indexing-triplestore.version}</version>
106-
<exclusions>
107-
<exclusion>
108-
<groupId>org.apache.camel</groupId>
109-
<artifactId>camel-blueprint</artifactId>
110-
</exclusion>
111-
<exclusion>
112-
<groupId>org.apache.camel</groupId>
113-
<artifactId>camel-http4</artifactId>
114-
</exclusion>
115-
</exclusions>
116-
</dependency>
11780

11881
<dependency>
11982
<groupId>org.fcrepo.client</groupId>
@@ -130,6 +93,10 @@
13093
<groupId>org.springframework</groupId>
13194
<artifactId>spring-core</artifactId>
13295
</dependency>
96+
<dependency>
97+
<groupId>org.springframework</groupId>
98+
<artifactId>spring-context</artifactId>
99+
</dependency>
133100
<dependency>
134101
<groupId>org.springframework</groupId>
135102
<artifactId>spring-expression</artifactId>
@@ -229,6 +196,22 @@
229196
<version>${camel.version}</version>
230197
<scope>test</scope>
231198
</dependency>
199+
<dependency>
200+
<groupId>org.apache.camel</groupId>
201+
<artifactId>camel-test-spring-junit5</artifactId>
202+
<version>${camel.version}</version>
203+
<scope>test</scope>
204+
</dependency>
205+
<dependency>
206+
<groupId>org.apache.camel</groupId>
207+
<artifactId>camel-test-junit5</artifactId>
208+
<version>${camel.version}</version>
209+
<scope>test</scope>
210+
</dependency>
211+
<dependency>
212+
<groupId>org.mockito</groupId>
213+
<artifactId>mockito-junit-jupiter</artifactId>
214+
</dependency>
232215
<dependency>
233216
<groupId>org.junit.jupiter</groupId>
234217
<artifactId>junit-jupiter-engine</artifactId>
@@ -241,11 +224,6 @@
241224
<groupId>org.junit.jupiter</groupId>
242225
<artifactId>junit-jupiter-params</artifactId>
243226
</dependency>
244-
<dependency>
245-
<groupId>org.junit.vintage</groupId>
246-
<artifactId>junit-vintage-engine</artifactId>
247-
<version>${junit.jupiter.version}</version>
248-
</dependency>
249227
<dependency>
250228
<groupId>com.github.tomakehurst</groupId>
251229
<artifactId>wiremock-jre8</artifactId>
@@ -299,10 +277,14 @@
299277
<artifactId>activemq-protobuf</artifactId>
300278
<scope>test</scope>
301279
</dependency>
302-
<dependency>
303-
<groupId>org.junit.jupiter</groupId>
304-
<artifactId>junit-jupiter-api</artifactId>
305-
</dependency>
280+
<dependency>
281+
<groupId>org.junit.jupiter</groupId>
282+
<artifactId>junit-jupiter-api</artifactId>
283+
</dependency>
284+
<dependency>
285+
<groupId>com.github.tomakehurst</groupId>
286+
<artifactId>wiremock-jre8</artifactId>
287+
</dependency>
306288
</dependencies>
307289

308290
<build>

Diff for: services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/accessSurrogates/AccessSurrogateRouter.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package edu.unc.lib.boxc.services.camel.accessSurrogates;
22

33
import org.apache.camel.BeanInject;
4+
import org.apache.camel.PropertyInject;
45
import org.apache.camel.builder.RouteBuilder;
56
import org.slf4j.Logger;
67

@@ -16,11 +17,22 @@ public class AccessSurrogateRouter extends RouteBuilder {
1617
@BeanInject(value = "accessSurrogateRequestProcessor")
1718
private AccessSurrogateRequestProcessor processor;
1819

20+
private String accessSurrogatesStreamCamel;
21+
1922
@Override
2023
public void configure() throws Exception {
21-
from("{{cdr.access.surrogates.stream.camel}}")
24+
from(accessSurrogatesStreamCamel)
2225
.routeId("DcrAccessSurrogates")
2326
.log(DEBUG, log, "Received access surrogate request")
2427
.bean(processor);
2528
}
29+
30+
public void setAccessSurrogateRequestProcessor(AccessSurrogateRequestProcessor processor) {
31+
this.processor = processor;
32+
}
33+
34+
@PropertyInject("cdr.access.surrogates.stream.camel")
35+
public void setAccessSurrogatesStreamCamel(String accessSurrogatesStreamCamel) {
36+
this.accessSurrogatesStreamCamel = accessSurrogatesStreamCamel;
37+
}
2638
}

Diff for: services-camel-app/src/main/java/edu/unc/lib/boxc/services/camel/binaryCleanup/BinaryCleanupRouter.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.slf4j.LoggerFactory.getLogger;
44

55
import org.apache.camel.LoggingLevel;
6+
import org.apache.camel.PropertyInject;
67
import org.apache.camel.builder.RouteBuilder;
78
import org.slf4j.Logger;
89
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,13 +16,23 @@ public class BinaryCleanupRouter extends RouteBuilder {
1516
private final Logger log = getLogger(BinaryCleanupRouter.class);
1617
@Autowired
1718
private BinaryCleanupProcessor binaryCleanupProcessor;
19+
private String binaryCleanupStream;
1820

1921
@Override
2022
public void configure() throws Exception {
21-
from("{{cdr.registration.successful.dest}}")
23+
from(binaryCleanupStream)
2224
.routeId("CleanupOldBinaryBatch")
2325
.log(LoggingLevel.DEBUG, log, "Cleaning up old binaries")
2426
.startupOrder(119)
2527
.process(binaryCleanupProcessor);
2628
}
29+
30+
public void setBinaryCleanupProcessor(BinaryCleanupProcessor binaryCleanupProcessor) {
31+
this.binaryCleanupProcessor = binaryCleanupProcessor;
32+
}
33+
34+
@PropertyInject("cdr.registration.successful.dest")
35+
public void setBinaryCleanupStream(String binaryCleanupStream) {
36+
this.binaryCleanupStream = binaryCleanupStream;
37+
}
2738
}

0 commit comments

Comments
 (0)