camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-8880: Fix CS.
Date Wed, 05 Aug 2015 07:56:23 GMT
CAMEL-8880: Fix CS.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8a414c3d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8a414c3d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8a414c3d

Branch: refs/heads/master
Commit: 8a414c3d9da3e26b26bca4f3f7374c525c287b10
Parents: a003434
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Aug 5 10:03:52 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Aug 5 10:03:52 2015 +0200

----------------------------------------------------------------------
 .../management/DefaultManagementAgent.java      | 30 +++++-----
 .../DefaultManagementAgentMockTest.java         | 60 ++++++++++----------
 .../camel/core/xml/CamelJMXAgentDefinition.java | 18 +++---
 .../camel/spring/JMXAgentPropertiesTest.java    | 16 ++----
 4 files changed, 58 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8a414c3d/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
index e2f40b8..60706ce 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
@@ -84,7 +84,7 @@ public class DefaultManagementAgent extends ServiceSupport implements Management
     private Boolean registerNewRoutes = true;
     private Boolean mask = true;
     private Boolean includeHostName = false;
-    private Boolean useHostIPAddress= false;
+    private Boolean useHostIPAddress = false;
     private String managementNamePattern = "#name#";
     private ManagementStatisticsLevel statisticsLevel = ManagementStatisticsLevel.Default;
 
@@ -280,18 +280,16 @@ public class DefaultManagementAgent extends ServiceSupport implements
Management
     public void setIncludeHostName(Boolean includeHostName) {
         this.includeHostName = includeHostName;
     }
-    
-    @Override
+
     public Boolean getUseHostIPAddress() {
-		return useHostIPAddress !=null && useHostIPAddress;
-	}
+        return useHostIPAddress != null && useHostIPAddress;
+    }
 
-    @Override
-	public void setUseHostIPAddress(Boolean useHostIPAddress) {
-		this.useHostIPAddress = useHostIPAddress;
-	}
+    public void setUseHostIPAddress(Boolean useHostIPAddress) {
+        this.useHostIPAddress = useHostIPAddress;
+    }
 
-	public String getManagementNamePattern() {
+    public String getManagementNamePattern() {
         return managementNamePattern;
     }
 
@@ -480,13 +478,13 @@ public class DefaultManagementAgent extends ServiceSupport implements
Management
 
         if (canAccessSystemProps) {
             try {
-            	if(useHostIPAddress){
-            		hostName = InetAddress.getLocalHost().getHostAddress();
-            	}else{
-            		hostName = InetAddress.getLocalHost().getHostName();
-            	}
+                if (useHostIPAddress) {
+                    hostName = InetAddress.getLocalHost().getHostAddress();
+                } else {
+                    hostName = InetAddress.getLocalHost().getHostName();
+                }
             } catch (UnknownHostException uhe) {
-                LOG.info("Cannot determine localhost name. Using default: " + DEFAULT_REGISTRY_PORT,
uhe);
+                LOG.info("Cannot determine localhost name or address. Using default: " +
DEFAULT_REGISTRY_PORT, uhe);
                 hostName = DEFAULT_HOST;
             }
         } else {

http://git-wip-us.apache.org/repos/asf/camel/blob/8a414c3d/camel-core/src/test/java/org/apache/camel/management/DefaultManagementAgentMockTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/management/DefaultManagementAgentMockTest.java
b/camel-core/src/test/java/org/apache/camel/management/DefaultManagementAgentMockTest.java
index efeb20d..bd469a1 100644
--- a/camel-core/src/test/java/org/apache/camel/management/DefaultManagementAgentMockTest.java
+++ b/camel-core/src/test/java/org/apache/camel/management/DefaultManagementAgentMockTest.java
@@ -16,14 +16,6 @@
  */
 package org.apache.camel.management;
 
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.easymock.EasyMock.verify;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import javax.management.JMException;
 import javax.management.MBeanServer;
 import javax.management.ObjectInstance;
@@ -34,6 +26,14 @@ import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.spi.ManagementAgent;
 import org.junit.Test;
 
+import static org.easymock.EasyMock.createStrictMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
+import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Tests proper behavior of DefaultManagementAgent when
  * {@link MBeanServer#registerMBean(Object, ObjectName)} returns an
@@ -77,29 +77,29 @@ public class DefaultManagementAgentMockTest {
         assertFalse(agent.isRegistered(sourceObjectName));
         verify(mbeanServer);
     }
-    
-	@Test
-	public void testShouldUseHostIPAddressWhenFlagisTrue() throws Exception {
-		System.setProperty(JmxSystemPropertyKeys.USE_HOST_IP_ADDRESS, "true");
-		System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "true");
-		CamelContext ctx = new DefaultCamelContext();
-
-		ManagementAgent agent = new DefaultManagementAgent(ctx);
-		agent.start();
-
-		assertTrue(agent.getUseHostIPAddress());
-	}
-    
+
+    @Test
+    public void testShouldUseHostIPAddressWhenFlagisTrue() throws Exception {
+        System.setProperty(JmxSystemPropertyKeys.USE_HOST_IP_ADDRESS, "true");
+        System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "true");
+        CamelContext ctx = new DefaultCamelContext();
+
+        ManagementAgent agent = new DefaultManagementAgent(ctx);
+        agent.start();
+
+        assertTrue(agent.getUseHostIPAddress());
+    }
+
     @Test
-    public void shouldUseHostNameWhenFlagisFalse() throws Exception{
-    	System.setProperty(JmxSystemPropertyKeys.USE_HOST_IP_ADDRESS, "false");
-    	System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "true");
-		CamelContext ctx = new DefaultCamelContext();
-
-		ManagementAgent agent = new DefaultManagementAgent(ctx);
-		agent.start();
-		
-		assertFalse(agent.getUseHostIPAddress());
+    public void shouldUseHostNameWhenFlagisFalse() throws Exception {
+        System.setProperty(JmxSystemPropertyKeys.USE_HOST_IP_ADDRESS, "false");
+        System.setProperty(JmxSystemPropertyKeys.CREATE_CONNECTOR, "true");
+        CamelContext ctx = new DefaultCamelContext();
+
+        ManagementAgent agent = new DefaultManagementAgent(ctx);
+        agent.start();
+
+        assertFalse(agent.getUseHostIPAddress());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8a414c3d/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
index e2d532ef..861c234 100644
--- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
+++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/CamelJMXAgentDefinition.java
@@ -26,8 +26,6 @@ import org.apache.camel.util.CollectionStringBuffer;
 
 /**
  * The JAXB type class for the configuration of jmxAgent
- *
- * @version 
  */
 @XmlRootElement(name = "jmxAgent")
 @XmlAccessorType(XmlAccessType.FIELD)
@@ -122,7 +120,7 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
      */
     @XmlAttribute
     private String includeHostName;
-    
+
     /**
      * A flag that indicates whether to use hostname or IP Address in the service url.
      */
@@ -262,16 +260,16 @@ public class CamelJMXAgentDefinition extends IdentifiedType {
     public void setMask(String mask) {
         this.mask = mask;
     }
-    
+
     public String getUseHostIPAddress() {
-		return useHostIPAddress;
-	}
+        return useHostIPAddress;
+    }
 
-	public void setUseHostIPAddress(String useHostIPAddress) {
-		this.useHostIPAddress = useHostIPAddress;
-	}
+    public void setUseHostIPAddress(String useHostIPAddress) {
+        this.useHostIPAddress = useHostIPAddress;
+    }
 
-	@Override
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("CamelJMXAgent[");

http://git-wip-us.apache.org/repos/asf/camel/blob/8a414c3d/components/camel-spring/src/test/java/org/apache/camel/spring/JMXAgentPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/JMXAgentPropertiesTest.java
b/components/camel-spring/src/test/java/org/apache/camel/spring/JMXAgentPropertiesTest.java
index e2ac4d3..11de0d9 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/JMXAgentPropertiesTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/JMXAgentPropertiesTest.java
@@ -23,8 +23,6 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 /**
  * Test that verifies JMX properties can be configured via Spring.
- *
- * @version 
  */
 public class JMXAgentPropertiesTest extends JMXAgentTest {
 
@@ -37,14 +35,12 @@ public class JMXAgentPropertiesTest extends JMXAgentTest {
     protected AbstractXmlApplicationContext createApplicationContext() {
         return new ClassPathXmlApplicationContext("org/apache/camel/spring/jmxConfigUsingProperties.xml");
     }
-    
-    public void testEnableUseHostIPAddress() throws Exception{
-    	
-    	CamelContext ctx = createCamelContext();
-    	ManagementAgent agent = ctx.getManagementStrategy().getManagementAgent();
-    	agent.start();
-    	assertTrue(agent.getUseHostIPAddress());
-    	
+
+    public void testEnableUseHostIPAddress() throws Exception {
+        CamelContext ctx = createCamelContext();
+        ManagementAgent agent = ctx.getManagementStrategy().getManagementAgent();
+        agent.start();
+        assertTrue(agent.getUseHostIPAddress());
     }
 
 }
\ No newline at end of file


Mime
View raw message