[spring-extensions] 01/04: Auto-added finals

Rod Widdowson rdw at steadingsoftware.com
Mon Sep 19 12:24:33 EDT 2016


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=011059102d13613e4ec1d98741574ceafbc62c02

commit 011059102d13613e4ec1d98741574ceafbc62c02
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Sep 18 15:46:40 2016 +0100

    Auto-added finals
---
 .../spring/factory/DOMDocumentFactoryBeanTest.java | 14 ++++++-------
 .../resource/FileBackedHTTPResourceTest.java       | 16 +++++++--------
 .../ext/spring/resource/TestHTTPResource.java      |  4 ++--
 .../service/ReloadableSpringServiceTest.java       | 24 +++++++++++-----------
 .../spring/service/TestServiceableComponent.java   |  6 ++----
 5 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/src/test/java/net/shibboleth/ext/spring/factory/DOMDocumentFactoryBeanTest.java b/src/test/java/net/shibboleth/ext/spring/factory/DOMDocumentFactoryBeanTest.java
index b53be4a..d872a03 100644
--- a/src/test/java/net/shibboleth/ext/spring/factory/DOMDocumentFactoryBeanTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/factory/DOMDocumentFactoryBeanTest.java
@@ -36,21 +36,21 @@ public class DOMDocumentFactoryBeanTest {
      */
     @Test
     public void getObject() throws Exception {
-        DOMDocumentFactoryBean factory = new DOMDocumentFactoryBean();
-        Resource resource = new ClassPathResource("data/document.xml");
-        BasicParserPool pool = new BasicParserPool();
+        final DOMDocumentFactoryBean factory = new DOMDocumentFactoryBean();
+        final Resource resource = new ClassPathResource("data/document.xml");
+        final BasicParserPool pool = new BasicParserPool();
         pool.initialize();
         factory.setResource(resource);
         factory.setParserPool(pool);
-        Document doc = factory.getObject();
+        final Document doc = factory.getObject();
 
         // look at the result
-        Element element = doc.getDocumentElement();
+        final Element element = doc.getDocumentElement();
         Assert.assertEquals(element.getLocalName(), "docElement");
 
         // check singleton behaviour
         Assert.assertEquals(factory.isSingleton(), true, "singleton assertion");
-        Document doc2 = factory.getObject();
+        final Document doc2 = factory.getObject();
         Assert.assertEquals(doc2, doc, "singleton equality");
     }
 
@@ -59,7 +59,7 @@ public class DOMDocumentFactoryBeanTest {
      */
     @Test
     public void getObjectType() {
-        DOMDocumentFactoryBean factory = new DOMDocumentFactoryBean();
+        final DOMDocumentFactoryBean factory = new DOMDocumentFactoryBean();
         Assert.assertEquals(factory.getObjectType(), Document.class, "object type");
     }
 
diff --git a/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java b/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java
index 3d347db..5c0bf6c 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/FileBackedHTTPResourceTest.java
@@ -55,12 +55,12 @@ public class FileBackedHTTPResourceTest {
 
     @BeforeClass public void setupClient() throws Exception {
         client = (new HttpClientBuilder()).buildClient();
-        File file = File.createTempFile("FileBackedHTTPResourceTest1", ".xml");
+        final File file = File.createTempFile("FileBackedHTTPResourceTest1", ".xml");
         existsFile = file.getAbsolutePath();
     }
 
     @AfterClass public void deleteFile() {
-        File f = new File(existsFile);
+        final File f = new File(existsFile);
         if (f.exists()) {
             f.delete();
         }
@@ -84,26 +84,26 @@ public class FileBackedHTTPResourceTest {
                 new ClassPathResource("data/document.xml")));
     }
 
-    public GenericApplicationContext getContext(String location) {
+    public GenericApplicationContext getContext(final String location) {
 
-        MockPropertySource mockEnvVars = new MockPropertySource();
+        final MockPropertySource mockEnvVars = new MockPropertySource();
         mockEnvVars.setProperty("file.name", existsFile);
         mockEnvVars.setProperty("the.url", existsURL);
 
-        GenericApplicationContext context = new FilesystemGenericApplicationContext();
+        final GenericApplicationContext context = new FilesystemGenericApplicationContext();
         context.setDisplayName("ApplicationContext");
 
-        MutablePropertySources propertySources = context.getEnvironment().getPropertySources();
+        final MutablePropertySources propertySources = context.getEnvironment().getPropertySources();
         propertySources.replace(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, mockEnvVars);
 
-        PropertySourcesPlaceholderConfigurer placeholderConfig = new PropertySourcesPlaceholderConfigurer();
+        final PropertySourcesPlaceholderConfigurer placeholderConfig = new PropertySourcesPlaceholderConfigurer();
         placeholderConfig.setPlaceholderPrefix("%{");
         placeholderConfig.setPlaceholderSuffix("}");
         placeholderConfig.setPropertySources(propertySources);
 
         context.addBeanFactoryPostProcessor(placeholderConfig);
 
-        SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
+        final SchemaTypeAwareXMLBeanDefinitionReader beanDefinitionReader =
                 new SchemaTypeAwareXMLBeanDefinitionReader(context);
 
         beanDefinitionReader.loadBeanDefinitions(location);
diff --git a/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java b/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
index d7f6052..443b661 100644
--- a/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
+++ b/src/test/java/net/shibboleth/ext/spring/resource/TestHTTPResource.java
@@ -27,12 +27,12 @@ class TestHTTPResource extends HTTPResource {
 
     private CacheResponseStatus responseStatus;
 
-    public TestHTTPResource(HttpClient client, String url) throws IOException {
+    public TestHTTPResource(final HttpClient client, final String url) throws IOException {
         super(client, url);
     }
 
     /** {@inheritDoc} */
-    @Override protected void reportCachingStatus(HttpCacheContext context) {
+    @Override protected void reportCachingStatus(final HttpCacheContext context) {
         responseStatus = context.getCacheResponseStatus();
 
         super.reportCachingStatus(context);
diff --git a/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java b/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
index 315e039..fd7f925 100644
--- a/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
+++ b/src/test/java/net/shibboleth/ext/spring/service/ReloadableSpringServiceTest.java
@@ -48,7 +48,7 @@ public class ReloadableSpringServiceTest {
 
     private File testFile;
 
-    private void createPopulatedFile(String dataPath) throws IOException {
+    private void createPopulatedFile(final String dataPath) throws IOException {
         testFile = File.createTempFile("ReloadableSpringServiceTest", ".xml");
         overwriteFileWith(dataPath);
         testFile.setLastModified(365*24*60*60*1000);
@@ -66,7 +66,7 @@ public class ReloadableSpringServiceTest {
         return new FileSystemResource(testFile);
     }
 
-    private void overwriteFileWith(String newDataPath) throws IOException {
+    private void overwriteFileWith(final String newDataPath) throws IOException {
         final OutputStream stream = new FileOutputStream(testFile);
         ByteStreams.copy(new ClassPathResource(newDataPath).getInputStream(), stream);
         stream.close();
@@ -86,7 +86,7 @@ public class ReloadableSpringServiceTest {
         service.start();
 
         ServiceableComponent<TestServiceableComponent> serviceableComponent = service.getServiceableComponent();
-        TestServiceableComponent component = serviceableComponent.getComponent();
+        final TestServiceableComponent component = serviceableComponent.getComponent();
 
         Assert.assertEquals("One", component.getTheValue());
         Assert.assertFalse(component.getComponent().isDestroyed());
@@ -129,7 +129,7 @@ public class ReloadableSpringServiceTest {
         service.start();
 
         ServiceableComponent<TestServiceableComponent> serviceableComponent = service.getServiceableComponent();
-        TestServiceableComponent component = serviceableComponent.getComponent();
+        final TestServiceableComponent component = serviceableComponent.getComponent();
         
         final DateTime x = service.getLastReloadAttemptInstant();
         Assert.assertEquals(x,  service.getLastSuccessfulReloadInstant());
@@ -190,7 +190,7 @@ public class ReloadableSpringServiceTest {
         try {
             service.start();
             Assert.fail("Expected to fail");
-        } catch (BeanInitializationException e) {
+        } catch (final BeanInitializationException e) {
             // OK
         }
         Assert.assertNull(service.getServiceableComponent());
@@ -247,14 +247,14 @@ public class ReloadableSpringServiceTest {
 
     @Test public void testApplicationContextAware() {
 
-        Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
+        final Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
 
-        GenericApplicationContext appCtx =
+        final GenericApplicationContext appCtx =
                 SpringSupport.newContext("appCtx", Collections.singletonList(parentResource),
                         Collections.<BeanFactoryPostProcessor>emptyList(), Collections.<BeanPostProcessor>emptyList(),
                         Collections.<ApplicationContextInitializer>emptyList(), null);
         try {
-            ReloadableSpringService service = appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
+            final ReloadableSpringService service = appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
     
             Assert.assertNotNull(service.getParentContext(), "Parent context should not be null");
         } finally {
@@ -264,18 +264,18 @@ public class ReloadableSpringServiceTest {
     
     @Test public void testBeanNameAware() {
 
-        Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
+        final Resource parentResource = new ClassPathResource("net/shibboleth/ext/spring/service/ReloadableSpringService.xml");
 
-        GenericApplicationContext appCtx =
+        final GenericApplicationContext appCtx =
                 SpringSupport.newContext("appCtx", Collections.singletonList(parentResource),
                         Collections.<BeanFactoryPostProcessor>emptyList(), Collections.<BeanPostProcessor>emptyList(),
                         Collections.<ApplicationContextInitializer>emptyList(), null);
         try {
-            ReloadableSpringService service1 =
+            final ReloadableSpringService service1 =
                     appCtx.getBean("testReloadableSpringService", ReloadableSpringService.class);
             Assert.assertEquals(service1.getId(), "testReloadableSpringService");
 
-            ReloadableSpringService service2 =
+            final ReloadableSpringService service2 =
                     appCtx.getBean("testReloadableSpringServiceWithCustomID", ReloadableSpringService.class);
             Assert.assertEquals(service2.getId(), "CustomID");
         } finally {
diff --git a/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java b/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
index 4b1b641..662a465 100644
--- a/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
+++ b/src/test/java/net/shibboleth/ext/spring/service/TestServiceableComponent.java
@@ -19,8 +19,6 @@ package net.shibboleth.ext.spring.service;
 
 import javax.annotation.Nonnull;
 
-import net.shibboleth.ext.spring.service.AbstractServiceableComponent;
-
 /**
  *
  */
@@ -44,13 +42,13 @@ public class TestServiceableComponent extends AbstractServiceableComponent<TestS
     /**
      * @param theValue The theValue to set.
      */
-    public void setTheValue(String theValue) {
+    public void setTheValue(final String theValue) {
         this.theValue = theValue;
     }
     
     /** {@inheritDoc} */
     @Override
-    public void setId(@Nonnull String componentId) {
+    public void setId(@Nonnull final String componentId) {
         super.setId(componentId);
     }
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list