Skip to content

Commit

Permalink
Dependency updates (duracloud#59)
Browse files Browse the repository at this point in the history
* Update spring, hibernate dependencies
* Various boxing/primitive constructor changes
* Use addAll
* Use equals instead of ==
* Update PageRequest construction
* Use PropertySourcesPlaceholderConfigurer
* Bump mysql-connector version
* Remove duplicate dependency declaration
* Bump spring versions to latest point release
  • Loading branch information
mikejritter authored Oct 23, 2023
1 parent d6c3bba commit 69420f0
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 70 deletions.
6 changes: 0 additions & 6 deletions auditlog-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@
<artifactId>mill-db-repo</artifactId>
</dependency>

<dependency>
<groupId>org.duracloud</groupId>
<artifactId>common-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public void execute() {
// Reads the Audit table, writes each item it finds to a
// space-specific file
int maxItemsPerRequest = Integer.parseInt(System.getProperty("max-audit-items-per-request", "1000"));
Pageable pageRequest = new PageRequest(0, maxItemsPerRequest);
Pageable pageRequest = PageRequest.of(0, maxItemsPerRequest);

while (true) {
List<JpaAuditLogItem> items = auditLogItemRepo.findByWrittenFalseOrderByTimestampAsc(pageRequest);
if (CollectionUtils.isEmpty(items)) {
log.info("No audit items found for processing: nowhere to go, nothing to do.", items.size());
log.info("No audit items found for processing: nowhere to go, nothing to do.");
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public class LastModifiedDateFileComparator implements Comparator<File> {
*/
@Override
public int compare(File o1, File o2) {
return -1 * new Long(o1.lastModified()).compareTo(new Long(o2.lastModified()));
return -1 * Long.compare(o1.lastModified(), o2.lastModified());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/
package org.duracloud.mill.credentials.impl;

import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
* @author Daniel Bernstein
Expand All @@ -18,9 +18,7 @@
public class CredentialsRepoConfig {

@Bean
public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_FALLBACK);
return configurer;
public PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
6 changes: 0 additions & 6 deletions manifest-builder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@
<artifactId>mill-db-repo</artifactId>
</dependency>

<dependency>
<groupId>org.duracloud</groupId>
<artifactId>common-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions manifest-cleaner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
<artifactId>mill-db-repo</artifactId>
</dependency>

<dependency>
<groupId>org.duracloud</groupId>
<artifactId>common-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
Expand Down
35 changes: 24 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,16 @@
<log.level.default>INFO</log.level.default>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<duracloud.version>7.1.0</duracloud.version>
<duracloud.db.version>7.1.0</duracloud.db.version>
<duracloud.version>7.2.0-SNAPSHOT</duracloud.version>
<duracloud.db.version>7.2.0-SNAPSHOT</duracloud.db.version>
<duraspace-codestyle.version>1.1.0</duraspace-codestyle.version>
<aws.sdk.version>1.12.122</aws.sdk.version>
<spring.framework.version>4.3.30.RELEASE</spring.framework.version>
<aws.sdk.version>1.12.548</aws.sdk.version>
<spring.framework.version>5.3.29</spring.framework.version>
<powermock.version>1.5.4</powermock.version>
<spring.framework.data.jpa.version>1.11.23.RELEASE</spring.framework.data.jpa.version>
<hibernate.version>5.4.3.Final</hibernate.version>
<mysql.driver.version>5.1.49</mysql.driver.version>
<spring.framework.data.jpa.version>2.7.15</spring.framework.data.jpa.version>
<hibernate.version>5.4.33.Final</hibernate.version>
<hibernate.validator.version>5.4.3.Final</hibernate.validator.version>
<mysql.driver.version>8.0.33</mysql.driver.version>
<jackson.version>2.12.3</jackson.version>
<jaxb.api.version>2.3.1</jaxb.api.version>
<jaxb.runtime.version>2.3.3</jaxb.runtime.version>
Expand Down Expand Up @@ -512,7 +513,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.0</version>
<version>1.3.8</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -817,6 +818,12 @@
<version>${duracloud.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.4.1.Final</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
Expand All @@ -826,7 +833,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate.version}</version>
<version>${hibernate.validator.version}</version>
</dependency>

<dependency>
Expand All @@ -836,9 +843,15 @@
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.driver.version}</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
package org.duracloud.mill.storagereporter;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -73,12 +74,8 @@ protected void executeImpl(CommandLine commandLine) {
ConfigurationManager configManager = new ConfigurationManager();
List<String> recipients = new LinkedList<>();

for (String email : configManager.getNotificationRecipients()) {
recipients.add(email);
}
for (String email : configManager.getNotificationRecipientsNonTech()) {
recipients.add(email);
}
recipients.addAll(Arrays.asList(configManager.getNotificationRecipients()));
recipients.addAll(Arrays.asList(configManager.getNotificationRecipientsNonTech()));

NotificationManager notification = null;
if (configManager.getEmailerType() == EmailerType.SMTP) {
Expand Down
6 changes: 0 additions & 6 deletions workman/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.duracloud</groupId>
<artifactId>common-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public TaskWorkerManager(List<TaskQueue> taskQueues,

public void init() {

this.defaultMinWaitTime = new Long(System.getProperty(MIN_WAIT_BEFORE_TAKE_KEY,
DEFAULT_MIN_WAIT_BEFORE_TAKE + ""));
this.defaultMinWaitTime = Long.valueOf(System.getProperty(MIN_WAIT_BEFORE_TAKE_KEY,
DEFAULT_MIN_WAIT_BEFORE_TAKE + ""));

Integer maxThreadCount = new Integer(System.getProperty(MAX_WORKER_PROPERTY_KEY,
String.valueOf(DEFAULT_MAX_WORKERS)));
Integer maxThreadCount = Integer.valueOf(System.getProperty(MAX_WORKER_PROPERTY_KEY,
String.valueOf(DEFAULT_MAX_WORKERS)));

//With a bound pool and unbounded queue, rejection should never occur.
this.executor = new ThreadPoolExecutor(maxThreadCount,
Expand Down Expand Up @@ -114,13 +114,11 @@ public void run() {

queueStats.add(formatQueueStat(deadLetterQueue));

log.info("Status: max_workers={} running_workers={} completed_workers={}" +
queueStats,
new Object[] {getMaxWorkers(),
executor.getActiveCount(),
executor.getCompletedTaskCount(),
StringUtils.join(queueStats, " ")
});
log.info("Status: max_workers={} running_workers={} completed_workers={}, {}",
getMaxWorkers(),
executor.getActiveCount(),
executor.getCompletedTaskCount(),
StringUtils.join(queueStats, " "));
}

private String formatQueueStat(TaskQueue queue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
* @author Daniel Bernstein
Expand All @@ -79,10 +79,8 @@ public class AppConfig {
private Connection rabbitMqConnection = null;

@Bean
public PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() {
PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
configurer.setSystemPropertiesMode(PropertyPlaceholderConfigurer.SYSTEM_PROPERTIES_MODE_FALLBACK);
return configurer;
public PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}

@Bean
Expand Down Expand Up @@ -437,8 +435,7 @@ public DuplicationPolicyManager duplicationPolicyManager(WorkmanConfigurationMan
@Bean(initMethod = "init", destroyMethod = "destroy")
public DuplicationPolicyRefresher duplicationPolicyRefresh(WorkmanConfigurationManager workmanConfigurationManager,
DuplicationPolicyManager policyManager) {
return new DuplicationPolicyRefresher(Long.valueOf(workmanConfigurationManager
.getPolicyManagerRefreshFrequencyMs()),
return new DuplicationPolicyRefresher(workmanConfigurationManager.getPolicyManagerRefreshFrequencyMs(),
policyManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void executeImpl(CommandLine cmd) {

String workDirPath = config.getWorkDirectoryPath();

if (workDirPath == null || workDirPath.trim() == "") {
if (workDirPath == null || workDirPath.trim().equals("")) {
// this should never happen since workDirPath is required,
// but I'll leave this in here as a sanity check.
workDirPath = System.getProperty("java.io.tmpdir") + File.separator + "workman-work";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public String getPolicyBucketSuffix() {
public Long getPolicyManagerRefreshFrequencyMs() {
String refresh = System.getProperty(ConfigConstants.DUPLICATION_POLICY_REFRESH_FREQUENCY);
if (refresh != null) {
return new Long(refresh);
return Long.valueOf(refresh);
} else {
return 5 * 60 * 1000l;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void test(StorageProviderType storageProviderType) throws Exception {
expect(task.getAttempts()).andReturn(0);

expect(this.manifestItemRepo.getStorageStatsByAccountAndStoreIdAndSpaceId(account, storeId, spaceId))
.andReturn(new Object[] {new Object[] {new Long(objectCount), new Long(byteCount)}});
.andReturn(new Object[] {new Object[] {objectCount, byteCount}});
expect(spaceStatsManager.addSpaceStats(isA(Date.class),
eq(account),
eq(storeId),
Expand Down

0 comments on commit 69420f0

Please sign in to comment.