Fix and/or suppress compilation warnings.

Edit Javadoc.
This commit is contained in:
John Blum
2020-06-01 14:30:04 -07:00
parent 22759d7cbe
commit e1f03a71da
16 changed files with 58 additions and 48 deletions

View File

@@ -93,7 +93,6 @@ public class ClientServerGemFireOperationsSessionRepositoryIntegrationTests exte
private static final String TEST_SESSION_REGION_NAME = "TestClientServerSessions";
@Autowired
@SuppressWarnings("all")
private SessionEventListener sessionEventListener;
@BeforeClass
@@ -242,7 +241,7 @@ public class ClientServerGemFireOperationsSessionRepositoryIntegrationTests exte
static class TestGemFireServerConfiguration {
@SuppressWarnings("resource")
public static void main(String[] args) throws IOException {
public static void main(String[] args) {
AnnotationConfigApplicationContext applicationContext =
new AnnotationConfigApplicationContext(TestGemFireServerConfiguration.class);

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire;
import static org.assertj.core.api.Assertions.assertThat;
@@ -84,7 +83,7 @@ public class MultiPoolClientServerGemFireOperationsSessionRepositoryIntegrationT
private static final String SPRING_SESSION_GEMFIRE_REGION_NAME = "TestMultiPoolClientServerSessions";
@Autowired @SuppressWarnings("all")
@Autowired
private SessionEventListener sessionEventListener;
@BeforeClass
@@ -208,7 +207,7 @@ public class MultiPoolClientServerGemFireOperationsSessionRepositoryIntegrationT
static class SpringSessionDataGemFireServerConfiguration {
@SuppressWarnings("resource")
public static void main(final String[] args) throws IOException {
public static void main(final String[] args) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
SpringSessionDataGemFireServerConfiguration.class);

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire;
import static org.assertj.core.api.Assertions.assertThat;
@@ -24,13 +23,13 @@ import java.io.IOException;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import edu.umd.cs.mtc.MultithreadedTestCase;
import edu.umd.cs.mtc.TestFramework;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import edu.umd.cs.mtc.MultithreadedTestCase;
import edu.umd.cs.mtc.TestFramework;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

View File

@@ -13,19 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
import org.junit.runner.RunWith;
import edu.umd.cs.mtc.MultithreadedTestCase;
import edu.umd.cs.mtc.TestFramework;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.springframework.data.gemfire.config.annotation.ClientCacheApplication;

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire;
import static org.assertj.core.api.Assertions.assertThat;
@@ -324,6 +323,7 @@ public class PeerCacheGemFireOperationsSessionRepositoryIntegrationTests extends
}
@Test
@SuppressWarnings("rawtypes")
public void saveAndReadSessionWithAttributes() {
Session expectedSession = this.gemfireSessionRepository.createSession();
@@ -415,7 +415,6 @@ public class PeerCacheGemFireOperationsSessionRepositoryIntegrationTests extends
this.lastName = pdxReader.readString("lastName");
}
@SuppressWarnings("all")
public int compareTo(Person person) {
int compareValue = getLastName().compareTo(person.getLastName());

View File

@@ -46,7 +46,7 @@ import org.springframework.session.data.gemfire.expiration.SessionExpirationPoli
import org.springframework.session.data.gemfire.serialization.SessionSerializer;
/**
* Integration tests testing {@link SpringSessionGemFireConfigurer} based configuration of either Apache Geode
* Integration Tests testing {@link SpringSessionGemFireConfigurer} based configuration of either Apache Geode
* or Pivotal GemFire as the (HTTP) {@link Session} state management provider in Spring Session.
*
* @author John Blum
@@ -173,7 +173,6 @@ public class ConfigurerBasedGemFireHttpSessionConfigurationIntegrationTests exte
}
@ClientCacheApplication
@EnableGemFireMockObjects
@EnableGemFireHttpSession(
clientRegionShortcut = ClientRegionShortcut.LOCAL,
indexableSessionAttributes = { "one", "two" },
@@ -184,6 +183,7 @@ public class ConfigurerBasedGemFireHttpSessionConfigurationIntegrationTests exte
sessionExpirationPolicyBeanName = "TestSessionExpirationPolicy",
sessionSerializerBeanName = "TestSessionSerializer"
)
@EnableGemFireMockObjects
static class TestConfiguration {
@Bean("Car")

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.config.annotation.web.http;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,9 +43,19 @@ import org.springframework.session.data.gemfire.expiration.SessionExpirationPoli
import org.springframework.session.data.gemfire.serialization.SessionSerializer;
/**
* The ExposingSpringSessionGemFireConfigurationIntegrationTests class...
* Integration Tests asserting the correct behavior when exposing Spring Session configuration metadata at runtime.
*
* @author John Blum
* @see org.junit.Test
* @see org.springframework.context.ConfigurableApplicationContext
* @see org.springframework.context.annotation.Bean
* @see org.springframework.context.annotation.Configuration
* @see org.springframework.core.env.Environment
* @see org.springframework.core.env.PropertySource
* @see org.springframework.data.gemfire.config.annotation.ClientCacheApplication
* @see org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects
* @see org.springframework.session.data.gemfire.AbstractGemFireIntegrationTests
* @see org.springframework.session.data.gemfire.config.annotation.web.http.support.SpringSessionGemFireConfigurer
* @since 1.0.0
*/
@SuppressWarnings("unused")
@@ -251,7 +260,6 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
}
@ClientCacheApplication
@EnableGemFireMockObjects
@EnableGemFireHttpSession(
clientRegionShortcut = ClientRegionShortcut.LOCAL,
exposeConfigurationAsProperties = true,
@@ -263,7 +271,7 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
sessionExpirationPolicyBeanName = "AttributeSessionExpirationPolicy",
sessionSerializerBeanName = "AttributeSessionSerializer"
)
@SuppressWarnings("unused")
@EnableGemFireMockObjects
static class TestGemFireHttpSessionConfiguration {
@Bean("Car")
@@ -292,11 +300,13 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
}
@Bean("AttributeSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer attributeSessionSerializer() {
return mock(SessionSerializer.class);
}
@Bean("PropertySessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer propertySessionSerializer() {
return mock(SessionSerializer.class);
}
@@ -316,6 +326,7 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
}
@Bean("ConfigurerSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer configurerSessionSerializer() {
return mock(SessionSerializer.class);
}
@@ -378,6 +389,7 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
static class MockSpringSessionGemFirerConfigurerConfiguration {
@Bean("ConfigurerSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer configurerSessionSerializer() {
return mock(SessionSerializer.class);
}
@@ -399,6 +411,7 @@ public class ExposingSpringSessionGemFireConfigurationIntegrationTests extends A
}
@Bean("ConfigurerSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer configurerSessionSerializer() {
return mock(SessionSerializer.class);
}

View File

@@ -168,6 +168,7 @@ public class GemFireHttpSessionConfigurationIntegrationTests extends SpringAppli
}
@Test
@SuppressWarnings("rawtypes")
public void notUsingDataSerializationWhenPdxConfigured() {
newApplicationContext(TestSessionSerializerConfiguration.class);
@@ -240,6 +241,7 @@ public class GemFireHttpSessionConfigurationIntegrationTests extends SpringAppli
}
@Bean("MockSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer mockSessionSerializer() {
return mock(SessionSerializer.class);
}
@@ -325,6 +327,7 @@ public class GemFireHttpSessionConfigurationIntegrationTests extends SpringAppli
static class TestSessionSerializerConfiguration {
@Bean("TestSessionSerializer")
@SuppressWarnings("rawtypes")
SessionSerializer testSessionSerializer() {
return mock(SessionSerializer.class);
}

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.config.annotation.web.http;
import static org.assertj.core.api.Assertions.assertThat;
@@ -41,7 +40,7 @@ import org.springframework.session.data.gemfire.expiration.SessionExpirationPoli
import org.springframework.session.data.gemfire.serialization.SessionSerializer;
/**
* Integration tests testing property-based configuration of either Apache Geode or Pivotal GemFire
* Integration Tests testing property-based configuration of either Apache Geode or Pivotal GemFire
* as the (HTTP) {@link Session} state management provider in Spring Session.
*
* @author John Blum
@@ -156,7 +155,6 @@ public class PropertyBasedGemFireHttpSessionConfigurationIntegrationTests extend
}
@ClientCacheApplication
@EnableGemFireMockObjects
@EnableGemFireHttpSession(
clientRegionShortcut = ClientRegionShortcut.LOCAL,
indexableSessionAttributes = { "one", "two" },
@@ -167,6 +165,7 @@ public class PropertyBasedGemFireHttpSessionConfigurationIntegrationTests extend
sessionExpirationPolicyBeanName = "TestSessionExpirationPolicy",
sessionSerializerBeanName = "TestSessionSerializer"
)
@EnableGemFireMockObjects
static class TestConfiguration {
@Bean("Dead")

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.expiration;
import static org.assertj.core.api.Assertions.assertThat;
@@ -47,7 +46,7 @@ import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.ReflectionUtils;
/**
* Integration tests for {@link EnableGemFireHttpSession} and {@link GemFireHttpSessionConfiguration}
* Integration Tests for {@link EnableGemFireHttpSession} and {@link GemFireHttpSessionConfiguration}
* involving {@link Session} expiration configuration.
*
* @author John Blum

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.expiration;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,7 +35,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
/**
* Integration tests asserting lazy expiration timeouts on {@link Session} access
* Integration Tests asserting lazy expiration timeouts on {@link Session} access
* using {@link FixedDurationExpirationSessionRepository}.
*
* @author John Blum
@@ -58,7 +57,7 @@ import org.springframework.test.context.junit4.SpringRunner;
public class LazyTimeoutSessionExpirationIntegrationTests extends AbstractGemFireIntegrationTests {
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "rawtypes", "unchecked" })
public void sessionRepositoryIsAFixedDurationExpirationSessionRepository() {
assertThat(this.<Session, SessionRepository>getSessionRepository())

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.support;
import static org.assertj.core.api.Assertions.assertThat;
@@ -34,10 +33,13 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
/**
* The CustomIsDirtyPredicateIntegrationTests class...
* Integration Tests for custom {@link IsDirtyPredicate}.
*
* @author John Blum
* @since 1.0.0
* @see org.junit.Test
* @see org.springframework.session.data.gemfire.support.IsDirtyPredicate
* @see org.springframework.session.data.gemfire.AbstractGemFireIntegrationTests
* @since 2.1.2
*/
@RunWith(SpringRunner.class)
@ContextConfiguration

View File

@@ -121,7 +121,7 @@ public class GemFireHttpSessionConfigurationUnitTests {
return resolveField(obj.getClass(), fieldName);
}
private static Field resolveField(Class type, String fieldName) throws NoSuchFieldException {
private static Field resolveField(Class<?> type, String fieldName) throws NoSuchFieldException {
Field field = ReflectionUtils.findField(type, fieldName);
@@ -149,7 +149,6 @@ public class GemFireHttpSessionConfigurationUnitTests {
}
@Test
@SuppressWarnings("all")
public void setAndGetBeanClassLoader() {
assertThat(this.gemfireConfiguration.getBeanClassLoader()).isNull();
@@ -548,6 +547,7 @@ public class GemFireHttpSessionConfigurationUnitTests {
}
@Test
@SuppressWarnings({ "rawtypes" })
public void exposeSpringSessionGemFireConfigurationAsPropertiesMutatesSpringEnvironment() {
ConfigurableEnvironment environment = new StandardEnvironment();
@@ -613,7 +613,6 @@ public class GemFireHttpSessionConfigurationUnitTests {
}
@Test
@SuppressWarnings("all")
public void exposeSpringSessionGemFireConfigurationAsPropertiesIsNullSafe() {
this.gemfireConfiguration.setEnvironment(null);
@@ -771,7 +770,7 @@ public class GemFireHttpSessionConfigurationUnitTests {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "rawtypes", "unchecked" })
public void createsAndInitializesSessionRegionAttributesWithExpiration() throws Exception {
Cache mockCache = mock(Cache.class);
@@ -802,7 +801,7 @@ public class GemFireHttpSessionConfigurationUnitTests {
}
@Test
@SuppressWarnings("unchecked")
@SuppressWarnings({ "rawtypes", "unchecked" })
public void createsAndInitializesSessionRegionAttributesWithoutExpiration() throws Exception {
ClientCache mockClientCache = mock(ClientCache.class);

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.config.annotation.web.http.support;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,6 +37,7 @@ import org.springframework.session.data.gemfire.config.annotation.web.http.GemFi
*/
public class SessionAttributesIndexFactoryBeanTests {
@SuppressWarnings("unchecked")
static <T> T[] toArray(T... array) {
return array;
}
@@ -51,11 +51,13 @@ public class SessionAttributesIndexFactoryBeanTests {
@Test
public void indexIsNotInitializedWhenNoIndexableSessionAttributesAreConfigured() throws Exception {
final Index mockIndex = mock(Index.class);
SessionAttributesIndexFactoryBean indexFactoryBean = new SessionAttributesIndexFactoryBean() {
@Override
protected Index newIndex() throws Exception {
protected Index newIndex() {
return mockIndex;
}
};
@@ -68,11 +70,13 @@ public class SessionAttributesIndexFactoryBeanTests {
@Test
public void initializesIndexWhenIndexableSessionAttributesAreConfigured() throws Exception {
final Index mockIndex = mock(Index.class);
SessionAttributesIndexFactoryBean indexFactoryBean = new SessionAttributesIndexFactoryBean() {
@Override
protected Index newIndex() throws Exception {
protected Index newIndex() {
return mockIndex;
}
};

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.config.annotation.web.http.support;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,7 +35,7 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.session.Session;
/**
* Unit tests for {@link SessionCacheTypeAwareRegionFactoryBean}.
* Unit Tests for {@link SessionCacheTypeAwareRegionFactoryBean}.
*
* @author John Blum
* @see org.junit.Test
@@ -79,13 +78,13 @@ public class SessionCacheTypeAwareRegionFactoryBeanTests {
this.regionFactoryBean = new SessionCacheTypeAwareRegionFactoryBean<Object, Session>() {
@Override
protected Region<Object, Session> newClientRegion(GemFireCache gemfireCache, String name) throws Exception {
protected Region<Object, Session> newClientRegion(GemFireCache gemfireCache, String name) {
assertThat(gemfireCache).isSameAs(expectedCache);
return SessionCacheTypeAwareRegionFactoryBeanTests.this.mockClientRegion;
}
@Override
protected Region<Object, Session> newServerRegion(GemFireCache gemfireCache, String name) throws Exception {
protected Region<Object, Session> newServerRegion(GemFireCache gemfireCache, String name) {
assertThat(gemfireCache).isSameAs(expectedCache);
return SessionCacheTypeAwareRegionFactoryBeanTests.this.mockServerRegion;
}

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.session.data.gemfire.config.annotation.web.http.support;
import static org.assertj.core.api.Assertions.assertThat;
@@ -32,7 +31,7 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
import org.springframework.session.data.gemfire.config.annotation.web.http.GemFireHttpSessionConfiguration;
/**
* Unit tests for {@link SpringSessionGemFireConfigurer}.
* Unit Tests for {@link SpringSessionGemFireConfigurer}.
*
* @author John Blum
* @see org.junit.Test
@@ -126,8 +125,7 @@ public class SpringSessionGemFireConfigurerUnitTests {
return Arrays.stream(nullSafeArray(methods, Method.class))
.filter(method -> targetMethodNames.contains(method.getName()))
.collect(Collectors.toList())
.toArray(new Method[0]);
.toArray(Method[]::new);
}
@Test