Enable ModifierOrderCheck Checkstyle rule (#2673)
* Enable ModifierOrderCheck Checkstyle rule * Fix violations for `static` and `abstract` modifier * Remove redundant code in the `TcpNioConnection` * Mark `connectionFactoryName` as `@Nullable` in the `TcpConnectionSupport` ctor and its inheritors * Fix some smells according IDEA suggestions in the affected classes * This should fix some Sonar smells as well * * Fix `HeaderMapperTests` * * Polishing `TcpConnection` code style and fix Javdocs
This commit is contained in:
committed by
Gary Russell
parent
a01d09f0f1
commit
93d7c58b64
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,13 +61,14 @@ import org.springframework.util.Assert;
|
||||
* for implementations of this class.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractConfigurableMongoDbMessageStore extends AbstractMessageGroupStore
|
||||
implements BasicMessageGroupStore, InitializingBean, ApplicationContextAware {
|
||||
|
||||
public final static String SEQUENCE_NAME = "messagesSequence";
|
||||
public static final String SEQUENCE_NAME = "messagesSequence";
|
||||
|
||||
/**
|
||||
* The name of the message header that stores a flag to indicate that the message has been saved. This is an
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.springframework.util.Assert;
|
||||
public class ConfigurableMongoDbMessageStore extends AbstractConfigurableMongoDbMessageStore
|
||||
implements MessageStore {
|
||||
|
||||
public final static String DEFAULT_COLLECTION_NAME = "configurableStoreMessages";
|
||||
public static final String DEFAULT_COLLECTION_NAME = "configurableStoreMessages";
|
||||
|
||||
|
||||
public ConfigurableMongoDbMessageStore(MongoTemplate mongoTemplate) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,14 +43,15 @@ import org.springframework.util.Assert;
|
||||
* {@code priorityEnabled = true} option.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
public class MongoDbChannelMessageStore extends AbstractConfigurableMongoDbMessageStore
|
||||
implements PriorityCapableChannelMessageStore {
|
||||
|
||||
public final static String DEFAULT_COLLECTION_NAME = "channelMessages";
|
||||
public static final String DEFAULT_COLLECTION_NAME = "channelMessages";
|
||||
|
||||
private volatile boolean priorityEnabled;
|
||||
private boolean priorityEnabled;
|
||||
|
||||
public MongoDbChannelMessageStore(MongoTemplate mongoTemplate) {
|
||||
this(mongoTemplate, DEFAULT_COLLECTION_NAME);
|
||||
|
||||
@@ -100,9 +100,9 @@ import com.mongodb.DBObject;
|
||||
public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
implements MessageStore, BeanClassLoaderAware, ApplicationContextAware, InitializingBean {
|
||||
|
||||
private final static String DEFAULT_COLLECTION_NAME = "messages";
|
||||
public static final String SEQUENCE_NAME = "messagesSequence";
|
||||
|
||||
public final static String SEQUENCE_NAME = "messagesSequence";
|
||||
private static final String DEFAULT_COLLECTION_NAME = "messages";
|
||||
|
||||
/**
|
||||
* The name of the message header that stores a flag to indicate that the message has been saved. This is an
|
||||
@@ -119,17 +119,17 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
@Deprecated
|
||||
public static final String CREATED_DATE_KEY = ConfigurableMongoDbMessageStore.class.getSimpleName() + ".CREATED_DATE";
|
||||
|
||||
private final static String GROUP_ID_KEY = "_groupId";
|
||||
private static final String GROUP_ID_KEY = "_groupId";
|
||||
|
||||
private final static String GROUP_COMPLETE_KEY = "_group_complete";
|
||||
private static final String GROUP_COMPLETE_KEY = "_group_complete";
|
||||
|
||||
private final static String LAST_RELEASED_SEQUENCE_NUMBER = "_last_released_sequence";
|
||||
private static final String LAST_RELEASED_SEQUENCE_NUMBER = "_last_released_sequence";
|
||||
|
||||
private final static String GROUP_TIMESTAMP_KEY = "_group_timestamp";
|
||||
private static final String GROUP_TIMESTAMP_KEY = "_group_timestamp";
|
||||
|
||||
private final static String GROUP_UPDATE_TIMESTAMP_KEY = "_group_update_timestamp";
|
||||
private static final String GROUP_UPDATE_TIMESTAMP_KEY = "_group_update_timestamp";
|
||||
|
||||
private final static String CREATED_DATE = "_createdDate";
|
||||
private static final String CREATED_DATE = "_createdDate";
|
||||
|
||||
private static final String SEQUENCE = "sequence";
|
||||
|
||||
@@ -595,7 +595,7 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
}
|
||||
|
||||
private Map<String, Object> normalizeHeaders(Map<String, Object> headers) {
|
||||
Map<String, Object> normalizedHeaders = new HashMap<String, Object>();
|
||||
Map<String, Object> normalizedHeaders = new HashMap<>();
|
||||
for (Entry<String, Object> entry : headers.entrySet()) {
|
||||
String headerName = entry.getKey();
|
||||
Object headerValue = entry.getValue();
|
||||
@@ -634,7 +634,8 @@ public class MongoDbMessageStore extends AbstractMessageGroupStore
|
||||
Bson payloadObject = (Bson) payload;
|
||||
Object payloadType = asMap(payloadObject).get("_class");
|
||||
try {
|
||||
Class<?> payloadClass = ClassUtils.forName(payloadType.toString(), MongoDbMessageStore.this.classLoader);
|
||||
Class<?> payloadClass =
|
||||
ClassUtils.forName(payloadType.toString(), MongoDbMessageStore.this.classLoader);
|
||||
payload = read(payloadClass, payloadObject);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
* Copyright 2015-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,12 +33,13 @@ import org.springframework.integration.mongodb.rules.MongoDbAvailableTests;
|
||||
/**
|
||||
* @author Senthil Arumugam, Samiraj Panneer Selvam
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.2
|
||||
*
|
||||
*/
|
||||
public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
private final static String DEFAULT_COLLECTION_NAME = "metadataStore";
|
||||
private static final String DEFAULT_COLLECTION_NAME = "metadataStore";
|
||||
|
||||
private final String file1 = "/remotepath/filesTodownload/file-1.txt";
|
||||
|
||||
@@ -47,14 +48,14 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
private MongoDbMetadataStore store = null;
|
||||
|
||||
@Before
|
||||
public void configure() throws Exception {
|
||||
public void configure() {
|
||||
final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME);
|
||||
this.store = new MongoDbMetadataStore(mongoDbFactory);
|
||||
}
|
||||
|
||||
@MongoDbAvailable
|
||||
@Test
|
||||
public void testConfigureCustomCollection() throws Exception {
|
||||
public void testConfigureCustomCollection() {
|
||||
final String collectionName = "testMetadataStore";
|
||||
final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(collectionName);
|
||||
final MongoTemplate template = new MongoTemplate(mongoDbFactory);
|
||||
@@ -64,7 +65,7 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
@MongoDbAvailable
|
||||
@Test
|
||||
public void testConfigureFactory() throws Exception {
|
||||
public void testConfigureFactory() {
|
||||
final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(DEFAULT_COLLECTION_NAME);
|
||||
store = new MongoDbMetadataStore(mongoDbFactory);
|
||||
testBasics();
|
||||
@@ -72,7 +73,7 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
@MongoDbAvailable
|
||||
@Test
|
||||
public void testConfigureFactorCustomCollection() throws Exception {
|
||||
public void testConfigureFactorCustomCollection() {
|
||||
final String collectionName = "testMetadataStore";
|
||||
final MongoDbFactory mongoDbFactory = this.prepareMongoFactory(collectionName);
|
||||
store = new MongoDbMetadataStore(mongoDbFactory, collectionName);
|
||||
@@ -98,7 +99,7 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
@Test
|
||||
@MongoDbAvailable
|
||||
public void testPutIfAbsent() throws Exception {
|
||||
public void testPutIfAbsent() {
|
||||
String fileID = store.get(file1);
|
||||
assertNull("Get First time, Value must not exist", fileID);
|
||||
|
||||
@@ -115,7 +116,7 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
@Test
|
||||
@MongoDbAvailable
|
||||
public void testRemove() throws Exception {
|
||||
public void testRemove() {
|
||||
String fileID = store.remove(file1);
|
||||
assertNull(fileID);
|
||||
|
||||
@@ -132,7 +133,7 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
|
||||
@Test
|
||||
@MongoDbAvailable
|
||||
public void testReplace() throws Exception {
|
||||
public void testReplace() {
|
||||
boolean removedValue = store.replace(file1, file1Id, "4567");
|
||||
assertFalse(removedValue);
|
||||
String fileID = store.get(file1);
|
||||
@@ -147,7 +148,6 @@ public class MongoDbMetadataStoreTests extends MongoDbAvailableTests {
|
||||
fileID = store.get(file1);
|
||||
assertNotNull(fileID);
|
||||
assertEquals("4567", fileID);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user