ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [47/50] [abbrv] incubator-ignite git commit: #ignite-189: Fix Spi tests.
Date Fri, 13 Feb 2015 16:26:14 GMT
#ignite-189: Fix Spi tests.


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

Branch: refs/heads/sprint-1
Commit: cdd3c223f1d646ee2432d6bce05c9f87f606a309
Parents: 0cb8756
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Feb 13 17:34:56 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Feb 13 17:34:56 2015 +0300

----------------------------------------------------------------------
 .../junits/spi/GridSpiAbstractTest.java         | 125 +++++++++++--------
 1 file changed, 74 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cdd3c223/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
index 630d67d..f5a8c11 100644
--- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/spi/GridSpiAbstractTest.java
@@ -99,63 +99,15 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi> extends
GridAbstr
     /**
      * @return Allow all permission security set.
      */
-    private GridSecurityPermissionSet getAllPermissionSet() {
-        return new GridSecurityPermissionSet() {
-            /** Serial version uid. */
-            private static final long serialVersionUID = 0L;
-
-            /** {@inheritDoc} */
-            @Override public boolean defaultAllowAll() {
-                return true;
-            }
-
-            /** {@inheritDoc} */
-            @Override public Map<String, Collection<GridSecurityPermission>>
taskPermissions() {
-                return Collections.emptyMap();
-            }
-
-            /** {@inheritDoc} */
-            @Override public Map<String, Collection<GridSecurityPermission>>
cachePermissions() {
-                return Collections.emptyMap();
-            }
-
-            /** {@inheritDoc} */
-            @Nullable @Override public Collection<GridSecurityPermission> systemPermissions()
{
-                return null;
-            }
-        };
+    private static GridSecurityPermissionSet getAllPermissionSet() {
+        return new GridSecurityPermissionSetImpl();
     }
 
     /**
      * @return Grid allow all security subject.
      */
     protected GridSecuritySubject getGridSecuritySubject(final GridSecuritySubjectType type,
final UUID id) {
-        return new GridSecuritySubject() {
-            /** {@inheritDoc} */
-            @Override public UUID id() {
-                return id;
-            }
-
-            /** {@inheritDoc} */
-            @Override public GridSecuritySubjectType type() {
-                return type;
-            }
-
-            /** {@inheritDoc} */
-            @Override public Object login() {
-                return null;
-            }
-
-            /** {@inheritDoc} */
-            @Override public InetSocketAddress address() {
-                return null;
-            }
-
-            /** {@inheritDoc} */
-            @Override public GridSecurityPermissionSet permissions() {
-                return getAllPermissionSet();
-            }
-        };
+        return new GridSecuritySubjectImpl(id, type);
     }
 
     /**
@@ -749,4 +701,75 @@ public abstract class GridSpiAbstractTest<T extends IgniteSpi>
extends GridAbstr
                 ", allAttrs=" + allAttrs + ']';
         }
     }
+
+    private static class GridSecurityPermissionSetImpl implements GridSecurityPermissionSet
{
+        /** Serial version uid. */
+        private static final long serialVersionUID = 0L;
+
+        /** {@inheritDoc} */
+        @Override public boolean defaultAllowAll() {
+            return true;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, Collection<GridSecurityPermission>> taskPermissions()
{
+            return Collections.emptyMap();
+        }
+
+        /** {@inheritDoc} */
+        @Override public Map<String, Collection<GridSecurityPermission>> cachePermissions()
{
+            return Collections.emptyMap();
+        }
+
+        /** {@inheritDoc} */
+        @Nullable @Override public Collection<GridSecurityPermission> systemPermissions()
{
+            return null;
+        }
+    };
+
+    private static class GridSecuritySubjectImpl implements GridSecuritySubject {
+        /** Node Id. */
+        private UUID id;
+
+        /** Grid security type. */
+        private GridSecuritySubjectType type;
+
+        private GridSecurityPermissionSet permission;
+
+        public GridSecuritySubjectImpl() {
+        }
+
+        public GridSecuritySubjectImpl(UUID id, GridSecuritySubjectType type) {
+            this.id = id;
+
+            this.type = type;
+
+            permission = getAllPermissionSet();
+        }
+
+        /** {@inheritDoc} */
+        @Override public UUID id() {
+            return id;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridSecuritySubjectType type() {
+            return type;
+        }
+
+        /** {@inheritDoc} */
+        @Override public Object login() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public InetSocketAddress address() {
+            return null;
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridSecurityPermissionSet permissions() {
+            return permission;
+        }
+    }
 }


Mime
View raw message