ignite-2175

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

Branch: refs/heads/ignite-1.5.1-2
Commit: bd05fa90b1d04c8c488717302d55558d84fb02e1
Parents: 29c4778
Author: Anton Vinogradov <a...@apache.org>
Authored: Wed Dec 23 18:05:06 2015 +0300
Committer: Anton Vinogradov <a...@apache.org>
Committed: Wed Dec 23 18:05:06 2015 +0300

----------------------------------------------------------------------
 .../ignite/internal/binary/BinaryContext.java   |   2 +-
 .../internal/binary/BinaryObjectImpl.java       |   2 +-
 .../ignite/tests/p2p/cache/PersonWrapper.java   | 121 +++++++++++++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |   2 +-
 .../IgniteBinaryObjectFieldsQuerySelfTest.java  |  16 ++-
 ...eBinaryWrappedObjectFieldsQuerySelfTest.java |  28 +++++
 .../IgniteBinaryCacheQueryTestSuite.java        |   4 +
 .../IgniteCacheQuerySelfTestSuite.java          |   4 +
 8 files changed, 171 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 5c63fbd..a27a3d0 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -743,7 +743,7 @@ public class BinaryContext implements Externalizable {
      */
     protected Object readResolve() throws ObjectStreamException {
         try {
-            IgniteKernal g = IgnitionEx.gridx(gridName);
+            IgniteKernal g = IgnitionEx.localIgnite();
 
             if (g == null)
                 throw new IllegalStateException("Failed to find grid for name: 
" + gridName);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
index d712eb8..fca8955 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryObjectImpl.java
@@ -533,7 +533,7 @@ public final class BinaryObjectImpl extends 
BinaryObjectExImpl implements Extern
      */
     private Object deserializeValue(@Nullable CacheObjectContext coCtx) {
         BinaryReaderExImpl reader = reader(null,
-            coCtx != null ? coCtx.kernalContext().config().getClassLoader() : 
null);
+            coCtx != null ? coCtx.kernalContext().config().getClassLoader() : 
ctx.configuration().getClassLoader());
 
         Object obj0 = reader.deserialize();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
----------------------------------------------------------------------
diff --git 
a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
 
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
new file mode 100644
index 0000000..2655e39
--- /dev/null
+++ 
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/cache/PersonWrapper.java
@@ -0,0 +1,121 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.ignite.tests.p2p.cache;
+
+import java.io.Serializable;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
+
+/**
+ * Wraps Person class.
+ */
+public class PersonWrapper {
+    public static class Person implements Serializable {
+        /** */
+        @QuerySqlField
+        private String name;
+
+        /** */
+        @QuerySqlField(index = true)
+        private int id;
+
+        /** */
+        @QuerySqlField
+        private String lastName;
+
+        /** */
+        @QuerySqlField
+        private double salary;
+
+        /**
+         *
+         */
+        public Person() {
+            // No-op.
+        }
+
+        /**
+         * @param name Name.
+         */
+        public Person(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String name() {
+            return name;
+        }
+
+        /**
+         * @return Name.
+         */
+        public String getName() {
+            return name;
+        }
+
+        /**
+         * @param name Name.
+         */
+        public void setName(String name) {
+            this.name = name;
+        }
+
+        /**
+         * @return ID.
+         */
+        public int getId() {
+            return id;
+        }
+
+        /**
+         * @param id ID.
+         */
+        public void setId(int id) {
+            this.id = id;
+        }
+
+        /**
+         * @return Last name.
+         */
+        public String getLastName() {
+            return lastName;
+        }
+
+        /**
+         * @param lastName Last name.
+         */
+        public void setLastName(String lastName) {
+            this.lastName = lastName;
+        }
+
+        /**
+         * @return Salary.
+         */
+        public double getSalary() {
+            return salary;
+        }
+
+        /**
+         * @param salary Salary.
+         */
+        public void setSalary(double salary) {
+            this.salary = salary;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index dead526..be72888 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1584,7 +1584,7 @@ public class IgniteH2Indexing implements 
GridQueryIndexing {
         Schema rmv = schemas.remove(schema);
 
         if (rmv != null) {
-            space2schema.remove(rmv.spaceName);
+            space2schema.remove(emptyIfNull(rmv.spaceName));
             mapQryExec.onCacheStop(ccfg.getName());
 
             try {

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
index 5c1e578..fb53b8a 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryObjectFieldsQuerySelfTest.java
@@ -45,9 +45,6 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends 
GridCommonAbstractTes
     /** */
     public static final String PERSON_KEY_CLS_NAME = 
"org.apache.ignite.tests.p2p.cache.PersonKey";
 
-    /** */
-    public static final String PERSON_CLS_NAME = 
"org.apache.ignite.tests.p2p.cache.Person";
-
     /** IP finder. */
     private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
 
@@ -57,6 +54,14 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends 
GridCommonAbstractTes
     /** */
     private static ClassLoader extClassLoader;
 
+    /**
+     * Gets Person class name.
+     * @return class name.
+     */
+    protected String getPersonClassName(){
+        return "org.apache.ignite.tests.p2p.cache.Person";
+    }
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
@@ -91,7 +96,8 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends 
GridCommonAbstractTes
         cache.setCacheMode(cacheMode);
         cache.setAtomicityMode(atomicity);
 
-        cache.setIndexedTypes(extClassLoader.loadClass(PERSON_KEY_CLS_NAME), 
extClassLoader.loadClass(PERSON_CLS_NAME));
+        cache.setIndexedTypes(extClassLoader.loadClass(PERSON_KEY_CLS_NAME),
+            extClassLoader.loadClass(getPersonClassName()));
 
         return cache;
     }
@@ -251,7 +257,7 @@ public class IgniteBinaryObjectFieldsQuerySelfTest extends 
GridCommonAbstractTes
      */
     private void populate(IgniteCache<Object, Object> cache) throws Exception {
         Class<?> keyCls = extClassLoader.loadClass(PERSON_KEY_CLS_NAME);
-        Class<?> cls = extClassLoader.loadClass(PERSON_CLS_NAME);
+        Class<?> cls = extClassLoader.loadClass(getPersonClassName());
 
         for (int i = 0; i < 100; i++) {
             Object key = keyCls.newInstance();

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
new file mode 100644
index 0000000..923d601
--- /dev/null
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteBinaryWrappedObjectFieldsQuerySelfTest.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ignite.internal.processors.cache;
+
+/**
+ * Tests that server nodes do not need class definitions to execute queries.
+ * Used internal class.
+ */
+public class IgniteBinaryWrappedObjectFieldsQuerySelfTest extends 
IgniteBinaryObjectFieldsQuerySelfTest {
+    /** {@inheritDoc} */
+    protected String getPersonClassName() {
+        return "org.apache.ignite.tests.p2p.cache.PersonWrapper$Person";
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
index b145a90..eddfcf4 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteBinaryCacheQueryTestSuite.java
@@ -33,6 +33,8 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisable
 import 
org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheBinaryObjectsScanSelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
@@ -160,6 +162,8 @@ public class IgniteBinaryCacheQueryTestSuite extends 
TestSuite {
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);
         suite.addTestSuite(IgniteCacheBinaryObjectsScanSelfTest.class);
+        suite.addTestSuite(IgniteBinaryObjectFieldsQuerySelfTest.class);
+        suite.addTestSuite(IgniteBinaryWrappedObjectFieldsQuerySelfTest.class);
 
         // Scan queries.
         suite.addTestSuite(CacheScanPartitionQueryFallbackSelfTest.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bd05fa90/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 7c8d1d7..4b1eafa 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -30,6 +30,8 @@ import 
org.apache.ignite.internal.processors.cache.GridCacheQueryIndexingDisable
 import 
org.apache.ignite.internal.processors.cache.GridCacheQueryInternalKeysSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridCacheQuerySerializationSelfTest;
 import 
org.apache.ignite.internal.processors.cache.GridCacheReduceQueryMultithreadedSelfTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteBinaryObjectFieldsQuerySelfTest;
+import 
org.apache.ignite.internal.processors.cache.IgniteBinaryWrappedObjectFieldsQuerySelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheCollocatedQuerySelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheDuplicateEntityConfigurationSelfTest;
 import 
org.apache.ignite.internal.processors.cache.IgniteCacheFieldsQueryNoDataSelfTest;
@@ -149,6 +151,8 @@ public class IgniteCacheQuerySelfTestSuite extends 
TestSuite {
         suite.addTestSuite(GridCacheReduceQueryMultithreadedSelfTest.class);
         suite.addTestSuite(GridCacheCrossCacheQuerySelfTest.class);
         suite.addTestSuite(GridCacheQuerySerializationSelfTest.class);
+        suite.addTestSuite(IgniteBinaryObjectFieldsQuerySelfTest.class);
+        suite.addTestSuite(IgniteBinaryWrappedObjectFieldsQuerySelfTest.class);
 
         // Scan queries.
         suite.addTestSuite(CacheScanPartitionQueryFallbackSelfTest.class);

Reply via email to