You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by yz...@apache.org on 2015/11/18 14:40:51 UTC

[35/50] [abbrv] ignite git commit: IGNITE-1900: Ignite JXM problem with Spring Boot. This closes #227.

IGNITE-1900: Ignite JXM problem with Spring Boot. This closes #227.


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

Branch: refs/heads/ignite-638
Commit: dc32789c270c7d4661178539957b2e27d5dcb91b
Parents: 5a116cb
Author: wmz7year <yd...@gmail.com>
Authored: Mon Nov 16 13:43:23 2015 +0300
Committer: dmagda <ma...@gmail.com>
Committed: Mon Nov 16 13:43:23 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  9 +++---
 .../org/apache/ignite/mxbean/IgniteMXBean.java  |  8 ++---
 .../ignite/util/mbeans/GridMBeanSelfTest.java   | 33 +++++++++++++++++---
 3 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32789c/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index dd129da..f1d67af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -564,10 +564,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
 
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
-    @Override public Collection<String> getUserAttributesFormatted() {
+    @Override public List<String> getUserAttributesFormatted() {
         assert cfg != null;
 
-        return F.transform(cfg.getUserAttributes().entrySet(), new C1<Map.Entry<String, ?>, String>() {
+        return (List<String>)F.transform(cfg.getUserAttributes().entrySet(), new C1<Map.Entry<String, ?>, String>() {
             @Override public String apply(Map.Entry<String, ?> e) {
                 return e.getKey() + ", " + e.getValue().toString();
             }
@@ -582,10 +582,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<String> getLifecycleBeansFormatted() {
+    @Override public List<String> getLifecycleBeansFormatted() {
         LifecycleBean[] beans = cfg.getLifecycleBeans();
 
-        return F.isEmpty(beans) ? Collections.<String>emptyList() : F.transform(beans, F.<LifecycleBean>string());
+        return F.isEmpty(beans) ? Collections.<String>emptyList() :
+            (List<String>)F.transform(beans, F.<LifecycleBean>string());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32789c/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
index c30e0e5..0754c27 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.mxbean;
 
-import java.util.Collection;
+import java.util.List;
 import java.util.UUID;
 import javax.management.JMException;
 
@@ -75,7 +75,7 @@ public interface IgniteMXBean {
     public long getUpTime();
 
     /**
-     * Gets a collection of formatted user-defined attributes added to this node.
+     * Gets a list of formatted user-defined attributes added to this node.
      * <p>
      * Note that grid will add all System properties and environment properties
      * to grid node attributes also. SPIs may also add node attributes that are
@@ -84,7 +84,7 @@ public interface IgniteMXBean {
      * @return User defined attributes for this node.
      */
     @MXBeanDescription("Collection of formatted user-defined attributes added to this node.")
-    public Collection<String> getUserAttributesFormatted();
+    public List<String> getUserAttributesFormatted();
 
     /**
      * Gets a formatted instance of logger that is in grid.
@@ -149,7 +149,7 @@ public interface IgniteMXBean {
      *      with Ignite.
      */
     @MXBeanDescription("String representation of lifecycle beans.")
-    public Collection<String> getLifecycleBeansFormatted();
+    public List<String> getLifecycleBeansFormatted();
 
     /**
      * This method allows manually remove the checkpoint with given {@code key}.

http://git-wip-us.apache.org/repos/asf/ignite/blob/dc32789c/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
index da31742..58be549 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
@@ -23,6 +23,7 @@ import javax.management.MBeanOperationInfo;
 import javax.management.MBeanParameterInfo;
 import javax.management.StandardMBean;
 import org.apache.ignite.internal.mxbean.IgniteStandardMXBean;
+import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.MXBeanDescription;
 import org.apache.ignite.mxbean.MXBeanParametersDescriptions;
 import org.apache.ignite.mxbean.MXBeanParametersNames;
@@ -40,13 +41,13 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
     public void testCorrectMBeanInfo() throws Exception {
         StandardMBean mbean = new IgniteStandardMXBean(new GridMBeanImplementation(), GridMBeanInterface.class);
 
-        MBeanInfo info =  mbean.getMBeanInfo();
+        MBeanInfo info = mbean.getMBeanInfo();
 
         assert info.getDescription().equals("MBeanDescription.") == true;
 
         assert info.getOperations().length == 2;
 
-        for (MBeanOperationInfo opInfo: info.getOperations()) {
+        for (MBeanOperationInfo opInfo : info.getOperations()) {
             if (opInfo.getDescription().equals("MBeanOperation."))
                 assert opInfo.getSignature().length == 2;
             else {
@@ -55,7 +56,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
             }
         }
 
-        for (MBeanParameterInfo paramInfo: info.getOperations()[0].getSignature()) {
+        for (MBeanParameterInfo paramInfo : info.getOperations()[0].getSignature()) {
             if (paramInfo.getName().equals("ignored"))
                 assert paramInfo.getDescription().equals("MBeanOperationParameter1.") == true;
             else {
@@ -64,9 +65,9 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
             }
         }
 
-        assert info.getAttributes().length == 4: "Expected 4 attributes but got " + info.getAttributes().length;
+        assert info.getAttributes().length == 4 : "Expected 4 attributes but got " + info.getAttributes().length;
 
-        for (MBeanAttributeInfo attrInfo: info.getAttributes()) {
+        for (MBeanAttributeInfo attrInfo : info.getAttributes()) {
             if (attrInfo.isWritable() == false) {
                 assert (attrInfo.getDescription().equals("MBeanReadonlyGetter.") == true ||
                     attrInfo.getDescription().equals("MBeanROGetter."));
@@ -80,6 +81,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
 
     /**
      * Tests correct MBean interface.
+     *
      * @throws Exception Thrown if test fails.
      */
     public void testMissedNameMBeanInfo() throws Exception {
@@ -97,6 +99,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
 
     /**
      * Tests correct MBean interface.
+     *
      * @throws Exception Thrown if test fails.
      */
     public void testMissedDescriptionMBeanInfo() throws Exception {
@@ -115,6 +118,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
 
     /**
      * Tests correct MBean interface.
+     *
      * @throws Exception Thrown if test fails.
      */
     public void testEmptyDescriptionMBeanInfo() throws Exception {
@@ -133,6 +137,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
 
     /**
      * Tests correct MBean interface.
+     *
      * @throws Exception Thrown if test fails.
      */
     public void testEmptyNameMBeanInfo() throws Exception {
@@ -150,6 +155,23 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
     }
 
     /**
+     * Tests correct MBean interface.
+     *
+     * @throws Exception Thrown if test fails.
+     */
+    public void testIgniteKernalReturnsValidMBeanInfo() throws Exception {
+        try {
+            IgniteMXBean ignite = (IgniteMXBean)startGrid();
+
+            assertNotNull(ignite.getUserAttributesFormatted());
+            assertNotNull(ignite.getLifecycleBeansFormatted());
+        }
+        finally {
+            stopAllGrids();
+        }
+    }
+
+    /**
      * Super interface for {@link GridMBeanInterface}.
      */
     public static interface GridMBeanSuperInterface {
@@ -211,6 +233,7 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
 
         /**
          * Test boolean setter.
+         *
          * @param isWritable Just a boolean.
          */
         public void setWritable(boolean isWritable);