Skip to content

Commit

Permalink
MAILBOX-294 Fix Eclipse warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aduprat committed Apr 25, 2017
1 parent f60dfe3 commit d8e844e
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 32 deletions.
Expand Up @@ -31,7 +31,6 @@
import javax.mail.util.SharedByteArrayInputStream;

import org.apache.james.mailbox.FlagsBuilder;
import org.apache.james.mailbox.MessageManager;
import org.apache.james.mailbox.MessageManager.FlagsUpdateMode;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxNotFoundException;
Expand Down
Expand Up @@ -32,7 +32,6 @@
import org.apache.james.backends.es.IndexName;
import org.apache.james.backends.es.NodeMappingFactory;
import org.apache.james.backends.es.TypeName;
import org.apache.james.filesystem.api.FileSystem;
import org.apache.james.mailbox.elasticsearch.IndexAttachments;
import org.apache.james.mailbox.elasticsearch.MailboxElasticsearchConstants;
import org.apache.james.mailbox.elasticsearch.MailboxMappingFactory;
Expand All @@ -41,8 +40,8 @@
import org.apache.james.mailbox.store.search.ListeningMessageSearchIndex;
import org.apache.james.mailbox.store.search.MessageSearchIndex;
import org.apache.james.mailbox.tika.extractor.TikaTextExtractor;
import org.apache.james.utils.RetryExecutorUtil;
import org.apache.james.utils.PropertiesProvider;
import org.apache.james.utils.RetryExecutorUtil;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.transport.NoNodeAvailableException;
import org.slf4j.Logger;
Expand Down
Expand Up @@ -19,17 +19,17 @@

package org.apache.james;

import com.google.inject.Module;
import java.util.Arrays;

import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.james.modules.mailbox.CassandraSessionConfiguration;
import org.apache.james.modules.mailbox.ElasticSearchConfiguration;
import org.apache.james.util.streams.SwarmGenericContainer;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.testcontainers.shaded.com.github.dockerjava.api.model.ExposedPort;
import org.testcontainers.shaded.com.github.dockerjava.api.model.Ports.Binding;

import java.util.Arrays;
import com.google.inject.Module;


public class DockerElasticSearchRule implements GuiceModuleTestRule {
Expand Down
Expand Up @@ -19,13 +19,7 @@

package org.apache.james;

import org.apache.james.util.streams.SwarmGenericContainer;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.shaded.com.google.common.base.Throwables;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand All @@ -36,16 +30,17 @@
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.util.streams.SwarmGenericContainer;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.testcontainers.shaded.com.google.common.base.Throwables;

public class JamesServerWithRetryConnectionTest {
private static final int IMAP_PORT = 1143;
private static final long WAITING_TIME = TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS);

private static String getDockerHostIp() {
return DockerClientFactory.instance().dockerHostIpAddress();
}

private final DockerCassandraRule dockerCassandraRule = new DockerCassandraRule();
private final DockerElasticSearchRule dockerElasticSearchRule = new DockerElasticSearchRule();

Expand Down
Expand Up @@ -26,7 +26,7 @@ public class RetryExecutorUtil {
public static final int INITIAL_DELAY_MILLIS = 500;
public static final int MULTIPLIER = 2;

public static AsyncRetryExecutor retryOnExceptions(AsyncRetryExecutor executor, int maxRetries, int minDelay, Class<? extends Throwable>... clazz) {
public static AsyncRetryExecutor retryOnExceptions(AsyncRetryExecutor executor, int maxRetries, int minDelay, Class<? extends Throwable> clazz) {
return executor
.retryOn(clazz)
.withExponentialBackoff(INITIAL_DELAY_MILLIS, MULTIPLIER)
Expand Down
Expand Up @@ -21,7 +21,6 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.core.JamesServerResourceLoader;
import org.apache.james.core.filesystem.FileSystemImpl;
Expand Down
Expand Up @@ -19,22 +19,23 @@

package org.apache.james.utils;

import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
import com.nurkiewicz.asyncretry.RetryExecutor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.BDDMockito.given;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.BDDMockito.given;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
import com.nurkiewicz.asyncretry.RetryExecutor;

public class RetryExecutorUtilTest {
private static final int MAX_RETRIES = 3;
Expand All @@ -57,6 +58,7 @@ public void tearDown() throws Exception {
}

@Test
@SuppressWarnings("unchecked")
public void retryOnExceptionsAndExecuteShouldRethrowWhenScheduledServiceAlwaysThrowException() throws Exception {
given(serviceMock.faultyService())
.willThrow(IllegalArgumentException.class)
Expand All @@ -72,6 +74,7 @@ public void retryOnExceptionsAndExecuteShouldRethrowWhenScheduledServiceAlwaysTh
}

@Test
@SuppressWarnings("unchecked")
public void retryOnExceptionsAndExecuteShouldRetryWhenMatchExceptionAndSuccess() throws Exception {
given(serviceMock.faultyService())
.willThrow(IllegalArgumentException.class)
Expand All @@ -84,6 +87,7 @@ public void retryOnExceptionsAndExecuteShouldRetryWhenMatchExceptionAndSuccess()
}

@Test
@SuppressWarnings("unchecked")
public void retryOnExceptionsAndExecuteShouldNotRetryWhenDoesNotMatchException() throws Exception {
given(serviceMock.faultyService())
.willThrow(IllegalStateException.class)
Expand All @@ -97,6 +101,7 @@ public void retryOnExceptionsAndExecuteShouldNotRetryWhenDoesNotMatchException()
}

@Test
@SuppressWarnings("unchecked")
public void retryOnExceptionsAndExecuteShouldRetryWithMaxTimesAndReturnValue() throws Exception {
given(serviceMock.faultyService())
.willThrow(IllegalStateException.class, IllegalStateException.class, IllegalStateException.class)
Expand All @@ -110,6 +115,7 @@ public void retryOnExceptionsAndExecuteShouldRetryWithMaxTimesAndReturnValue() t
}

@Test
@SuppressWarnings("unchecked")
public void retryOnExceptionsAndExecuteShouldFailIfFailMoreThanMaxRetry() throws Exception {
given(serviceMock.faultyService()).
willThrow(IllegalStateException.class, IllegalStateException.class, IllegalStateException.class, IllegalStateException.class).
Expand Down
Expand Up @@ -37,7 +37,6 @@

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.james.filesystem.api.FileSystem;
import org.apache.james.util.RestrictingRMISocketFactory;
import org.apache.james.utils.PropertiesProvider;
import org.slf4j.Logger;
Expand Down
Expand Up @@ -25,7 +25,6 @@
import java.util.Optional;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.io.FileUtils;
import org.apache.james.filesystem.api.FileSystem;
Expand Down

0 comments on commit d8e844e

Please sign in to comment.