Skip to content

Commit 934e544

Browse files
committed
Removing some unnecessary test-only dependencies
Trying to make Black Duck happy
1 parent 40ab7cc commit 934e544

File tree

7 files changed

+231
-132
lines changed

7 files changed

+231
-132
lines changed

examples/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ plugins {
77
dependencies {
88
implementation project(':marklogic-client-api')
99

10-
// Forcing usage of 3.4.0 instead of 3.2.0 to address vulnerability - https://security.snyk.io/vuln/SNYK-JAVA-COMSQUAREUPOKIO-5820002
11-
implementation 'com.squareup.okio:okio:3.4.0'
12-
1310
// The 'api' configuration is used so that the test configuration in marklogic-client-api doesn't have to declare
1411
// all of these dependencies. This library project won't otherwise be depended on by anything else as it's not
1512
// setup for publishing.

marklogic-client-api-functionaltests/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131
exclude module: "marklogic-client-api"
3232
}
3333

34-
testImplementation 'ch.qos.logback:logback-classic:1.3.14'
34+
testImplementation 'ch.qos.logback:logback-classic:1.3.15'
3535
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.1'
3636
testImplementation 'org.xmlunit:xmlunit-legacy:2.10.0'
3737
testImplementation 'org.apache.commons:commons-lang3:3.17.0'

marklogic-client-api/build.gradle

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,13 @@ dependencies {
5454
testImplementation "com.squareup.okhttp3:mockwebserver:4.12.0"
5555

5656
testImplementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.2"
57-
testImplementation 'ch.qos.logback:logback-classic:1.3.14'
57+
testImplementation 'ch.qos.logback:logback-classic:1.3.15'
5858

59-
// schema validation issue with testImplementation 'xerces:xercesImpl:2.12.0'
59+
// Using this to avoid a schema validation issue with the regular xercesImpl
6060
testImplementation 'org.opengis.cite.xerces:xercesImpl-xsd11:2.12-beta-r1667115'
6161

6262
testImplementation 'org.apache.commons:commons-lang3:3.17.0'
63-
testImplementation 'org.apache.httpcomponents:httpclient:4.5.14'
6463
testImplementation 'com.opencsv:opencsv:5.10'
65-
66-
// This is used by a single test - JacksonDatabindTest - and it does not need the jdom module for the test to pass.
67-
// The jdom module has a CVE associated with it - https://nvd.nist.gov/vuln/detail/CVE-2021-33813 .
68-
testImplementation ('org.geonames:geonames:1.0') {
69-
exclude module: "jdom"
70-
}
71-
7264
testImplementation 'org.skyscreamer:jsonassert:1.5.3'
7365
}
7466

marklogic-client-api/src/test/java/com/marklogic/client/test/JacksonDatabindTest.java

Lines changed: 216 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.fasterxml.jackson.annotation.JsonTypeInfo;
99
import com.fasterxml.jackson.core.JsonGenerator;
1010
import com.fasterxml.jackson.core.JsonParser;
11-
import com.fasterxml.jackson.core.JsonProcessingException;
1211
import com.fasterxml.jackson.databind.ObjectMapper;
1312
import com.fasterxml.jackson.databind.ObjectReader;
1413
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
@@ -25,7 +24,6 @@
2524
import com.marklogic.client.query.DeleteQueryDefinition;
2625
import com.marklogic.client.query.QueryManager;
2726
import com.marklogic.client.test.BulkReadWriteTest.CityWriter;
28-
import org.geonames.Toponym;
2927
import org.junit.jupiter.api.AfterAll;
3028
import org.junit.jupiter.api.BeforeAll;
3129
import org.junit.jupiter.api.Test;
@@ -157,41 +155,41 @@ class ToponymMixIn2 {
157155
* via JacksonDatabindHandle with configuration provided by mix-in annotations.
158156
**/
159157
@Test
160-
public void testDatabindingThirdPartyPojoWithMixinAnnotations() throws JsonProcessingException, IOException {
158+
public void testDatabindingThirdPartyPojoWithMixinAnnotations() throws IOException {
161159
CsvSchema schema = CsvSchema.builder()
162160
.setColumnSeparator('\t')
163161
.addColumn("geoNameId")
164-
.addColumn("name")
165-
.addColumn("asciiName")
166-
.addColumn("alternateNames")
167-
.addColumn("latitude", CsvSchema.ColumnType.NUMBER)
168-
.addColumn("longitude", CsvSchema.ColumnType.NUMBER)
169-
.addColumn("featureClass")
170-
.addColumn("featureCode")
171-
.addColumn("countryCode")
172-
.addColumn("countryCode2")
173-
.addColumn("adminCode1")
174-
.addColumn("adminCode2")
175-
.addColumn("adminCode3")
176-
.addColumn("adminCode4")
177-
.addColumn("population")
178-
.addColumn("elevation", CsvSchema.ColumnType.NUMBER)
179-
.addColumn("dem", CsvSchema.ColumnType.NUMBER)
180-
.addColumn("timezoneCode")
181-
.addColumn("lastModified")
182-
.build();
162+
.addColumn("name")
163+
.addColumn("asciiName")
164+
.addColumn("alternateNames")
165+
.addColumn("latitude", CsvSchema.ColumnType.NUMBER)
166+
.addColumn("longitude", CsvSchema.ColumnType.NUMBER)
167+
.addColumn("featureClass")
168+
.addColumn("featureCode")
169+
.addColumn("countryCode")
170+
.addColumn("countryCode2")
171+
.addColumn("adminCode1")
172+
.addColumn("adminCode2")
173+
.addColumn("adminCode3")
174+
.addColumn("adminCode4")
175+
.addColumn("population")
176+
.addColumn("elevation", CsvSchema.ColumnType.NUMBER)
177+
.addColumn("dem", CsvSchema.ColumnType.NUMBER)
178+
.addColumn("timezoneCode")
179+
.addColumn("lastModified")
180+
.build();
183181
CsvMapper mapper = new CsvMapper();
184182
mapper.addMixInAnnotations(Toponym.class, ToponymMixIn1.class);
185183
ObjectReader reader = mapper.reader(Toponym.class).with(schema);
186184
try (BufferedReader cityReader = new BufferedReader(Common.testFileToReader(CITIES_FILE))) {
187185
GenericDocumentManager docMgr = client.newDocumentManager();
188186
DocumentWriteSet set = docMgr.newWriteSet();
189-
String line = null;
187+
String line;
190188
for (int numWritten = 0; numWritten < MAX_TO_WRITE && (line = cityReader.readLine()) != null; numWritten++ ) {
191189
Toponym city = reader.readValue(line);
192190
JacksonDatabindHandle handle = new JacksonDatabindHandle(city);
193191
handle.getMapper().addMixInAnnotations(Toponym.class, ToponymMixIn2.class);
194-
set.add(DIRECTORY + "/thirdPartyJsonCities/" + city.getGeoNameId() + ".json", handle);
192+
set.add(DIRECTORY + "/thirdPartyJsonCities/" + city.geoNameId + ".json", handle);
195193
} docMgr.write(set);
196194
// we can add assertions later, for now this test just serves as example code and
197195
// ensures no exceptions are thrown
@@ -203,5 +201,199 @@ public static void cleanUp() {
203201
DeleteQueryDefinition deleteQuery = queryMgr.newDeleteDefinition();
204202
deleteQuery.setDirectory(DIRECTORY);
205203
queryMgr.delete(deleteQuery);
204+
}
205+
206+
// Copy of the class from the org.geonames dependency; copied here to avoid a Black Duck warning on the
207+
// transitive jdom dependency.
208+
private static class Toponym {
209+
private int geoNameId;
210+
private String name;
211+
private String alternateNames;
212+
private String countryCode;
213+
private String countryName;
214+
private Integer population;
215+
private Integer elevation;
216+
private String featureClass;
217+
private String featureClassName;
218+
private String featureCode;
219+
private String featureCodeName;
220+
private double latitude;
221+
private double longitude;
222+
private String adminCode1;
223+
private String adminName1;
224+
private String adminCode2;
225+
private String adminName2;
226+
private String adminCode3;
227+
private String adminCode4;
228+
private String timezone;
229+
private String style;
230+
231+
public String getFeatureClass() {
232+
return featureClass;
233+
}
234+
235+
public void setFeatureClass(String featureClass) {
236+
this.featureClass = featureClass;
237+
}
238+
239+
public String getTimezone() {
240+
return timezone;
241+
}
242+
243+
public void setTimezone(String timezone) {
244+
this.timezone = timezone;
245+
}
246+
247+
public String getStyle() {
248+
return style;
249+
}
250+
251+
public void setStyle(String style) {
252+
this.style = style;
253+
}
254+
255+
public int getGeoNameId() {
256+
return geoNameId;
257+
}
258+
259+
public void setGeoNameId(int geoNameId) {
260+
this.geoNameId = geoNameId;
261+
}
262+
263+
public String getName() {
264+
return name;
265+
}
266+
267+
public void setName(String name) {
268+
this.name = name;
269+
}
270+
271+
public String getAlternateNames() {
272+
return alternateNames;
273+
}
274+
275+
public void setAlternateNames(String alternateNames) {
276+
this.alternateNames = alternateNames;
277+
}
278+
279+
public String getCountryCode() {
280+
return countryCode;
281+
}
282+
283+
public void setCountryCode(String countryCode) {
284+
this.countryCode = countryCode;
285+
}
286+
287+
public String getCountryName() {
288+
return countryName;
289+
}
290+
291+
public void setCountryName(String countryName) {
292+
this.countryName = countryName;
293+
}
294+
295+
public Integer getPopulation() {
296+
return population;
297+
}
298+
299+
public void setPopulation(Integer population) {
300+
this.population = population;
301+
}
302+
303+
public Integer getElevation() {
304+
return elevation;
305+
}
306+
307+
public void setElevation(Integer elevation) {
308+
this.elevation = elevation;
309+
}
310+
311+
public String getFeatureClassName() {
312+
return featureClassName;
313+
}
314+
315+
public void setFeatureClassName(String featureClassName) {
316+
this.featureClassName = featureClassName;
317+
}
318+
319+
public String getFeatureCode() {
320+
return featureCode;
321+
}
322+
323+
public void setFeatureCode(String featureCode) {
324+
this.featureCode = featureCode;
325+
}
326+
327+
public String getFeatureCodeName() {
328+
return featureCodeName;
329+
}
330+
331+
public void setFeatureCodeName(String featureCodeName) {
332+
this.featureCodeName = featureCodeName;
333+
}
334+
335+
public double getLatitude() {
336+
return latitude;
337+
}
338+
339+
public void setLatitude(double latitude) {
340+
this.latitude = latitude;
341+
}
342+
343+
public double getLongitude() {
344+
return longitude;
345+
}
346+
347+
public void setLongitude(double longitude) {
348+
this.longitude = longitude;
349+
}
350+
351+
public String getAdminCode1() {
352+
return adminCode1;
353+
}
354+
355+
public void setAdminCode1(String adminCode1) {
356+
this.adminCode1 = adminCode1;
357+
}
358+
359+
public String getAdminName1() {
360+
return adminName1;
361+
}
362+
363+
public void setAdminName1(String adminName1) {
364+
this.adminName1 = adminName1;
365+
}
366+
367+
public String getAdminCode2() {
368+
return adminCode2;
369+
}
370+
371+
public void setAdminCode2(String adminCode2) {
372+
this.adminCode2 = adminCode2;
373+
}
374+
375+
public String getAdminName2() {
376+
return adminName2;
377+
}
378+
379+
public void setAdminName2(String adminName2) {
380+
this.adminName2 = adminName2;
381+
}
382+
383+
public String getAdminCode3() {
384+
return adminCode3;
385+
}
386+
387+
public void setAdminCode3(String adminCode3) {
388+
this.adminCode3 = adminCode3;
389+
}
390+
391+
public String getAdminCode4() {
392+
return adminCode4;
393+
}
394+
395+
public void setAdminCode4(String adminCode4) {
396+
this.adminCode4 = adminCode4;
397+
}
206398
}
207399
}

0 commit comments

Comments
 (0)