ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [1/3] ignite git commit: IGNITE-1819: First iteration.
Date Thu, 05 Nov 2015 10:00:55 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1819 [created] 74b25b3dc


IGNITE-1819: First iteration.


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

Branch: refs/heads/ignite-1819
Commit: df6b8ee16e9b5803a013a066de6df87f64e23bf1
Parents: f7b308f
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Thu Nov 5 12:43:13 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Thu Nov 5 12:43:13 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/PortableContext.java      |  20 +-
 .../marshaller/portable/PortableMarshaller.java |  23 +-
 .../portable/PortableTypeConfiguration.java     |  24 +-
 .../GridPortableMetaDataDisabledSelfTest.java   | 238 -------------------
 .../IgnitePortableObjectsTestSuite.java         |   2 -
 5 files changed, 9 insertions(+), 298 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/df6b8ee1/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index e61cba7..8380053 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -150,9 +150,6 @@ public class PortableContext implements Externalizable {
     private boolean convertStrings;
 
     /** */
-    private boolean metaDataEnabled;
-
-    /** */
     private boolean keepDeserialized;
 
     /** Object schemas. */
@@ -253,7 +250,6 @@ public class PortableContext implements Externalizable {
             return;
 
         convertStrings = marsh.isConvertStringToBytes();
-        metaDataEnabled = marsh.isMetaDataEnabled();
         keepDeserialized = marsh.isKeepDeserialized();
 
         marshCtx = marsh.getContext();
@@ -265,7 +261,6 @@ public class PortableContext implements Externalizable {
         configure(
             marsh.getIdMapper(),
             marsh.getSerializer(),
-            marsh.isMetaDataEnabled(),
             marsh.isKeepDeserialized(),
             marsh.getClassNames(),
             marsh.getTypeConfigurations()
@@ -275,7 +270,6 @@ public class PortableContext implements Externalizable {
     /**
      * @param globalIdMapper ID mapper.
      * @param globalSerializer Serializer.
-     * @param globalMetaDataEnabled Metadata enabled flag.
      * @param globalKeepDeserialized Keep deserialized flag.
      * @param clsNames Class names.
      * @param typeCfgs Type configurations.
@@ -284,7 +278,6 @@ public class PortableContext implements Externalizable {
     private void configure(
         PortableIdMapper globalIdMapper,
         PortableSerializer globalSerializer,
-        boolean globalMetaDataEnabled,
         boolean globalKeepDeserialized,
         Collection<String> clsNames,
         Collection<PortableTypeConfiguration> typeCfgs
@@ -299,11 +292,11 @@ public class PortableContext implements Externalizable {
                     String pkgName = clsName.substring(0, clsName.length() - 2);
 
                     for (String clsName0 : classesInPackage(pkgName))
-                        descs.add(clsName0, idMapper, null, null, globalMetaDataEnabled,
+                        descs.add(clsName0, idMapper, null, null, true,
                             globalKeepDeserialized, true);
                 }
                 else // Regular single class
-                    descs.add(clsName, idMapper, null, null, globalMetaDataEnabled,
+                    descs.add(clsName, idMapper, null, null, true,
                         globalKeepDeserialized, true);
             }
         }
@@ -327,8 +320,7 @@ public class PortableContext implements Externalizable {
                 if (typeCfg.getSerializer() != null)
                     serializer = typeCfg.getSerializer();
 
-                boolean metaDataEnabled = typeCfg.isMetaDataEnabled() != null ? typeCfg.isMetaDataEnabled()
:
-                    globalMetaDataEnabled;
+                boolean metaDataEnabled = true;
                 boolean keepDeserialized = typeCfg.isKeepDeserialized() != null ? typeCfg.isKeepDeserialized()
:
                     globalKeepDeserialized;
 
@@ -513,7 +505,7 @@ public class PortableContext implements Externalizable {
                 clsName,
                 BASIC_CLS_ID_MAPPER,
                 null,
-                metaDataEnabled,
+                true,
                 keepDeserialized,
                 true, /* registered */
                 false /* predefined */
@@ -559,7 +551,7 @@ public class PortableContext implements Externalizable {
             typeName,
             idMapper,
             null,
-            metaDataEnabled,
+            true,
             keepDeserialized,
             registered,
             false /* predefined */
@@ -806,7 +798,7 @@ public class PortableContext implements Externalizable {
     public boolean isMetaDataEnabled(int typeId) {
         Boolean enabled = metaEnabled.get(typeId);
 
-        return enabled != null ? enabled : metaDataEnabled;
+        return enabled != null ? enabled : true;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/df6b8ee1/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
index f9cf509..026b740 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
@@ -90,9 +90,6 @@ public class PortableMarshaller extends AbstractMarshaller {
     /** Whether to convert string to bytes using UTF-8 encoding. */
     private boolean convertString = true;
 
-    /** Meta data enabled flag. */
-    private boolean metaDataEnabled = true;
-
     /** Keep deserialized flag. */
     private boolean keepDeserialized = true;
 
@@ -197,25 +194,6 @@ public class PortableMarshaller extends AbstractMarshaller {
     }
 
     /**
-     * If {@code true}, meta data will be collected or all types. If you need to override
this behaviour for
-     * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)}
method.
-     * <p>
-     * Default value if {@code true}.
-     *
-     * @return Whether meta data is collected.
-     */
-    public boolean isMetaDataEnabled() {
-        return metaDataEnabled;
-    }
-
-    /**
-     * @param metaDataEnabled Whether meta data is collected.
-     */
-    public void setMetaDataEnabled(boolean metaDataEnabled) {
-        this.metaDataEnabled = metaDataEnabled;
-    }
-
-    /**
      * If {@code true}, {@link PortableObject} will cache deserialized instance after
      * {@link PortableObject#deserialize()} is called. All consequent calls of this
      * method on the same instance of {@link PortableObject} will return that cached
@@ -252,6 +230,7 @@ public class PortableMarshaller extends AbstractMarshaller {
      * <p/>
      * @param ctx Portable context.
      */
+    @SuppressWarnings("UnusedDeclaration")
     private void setPortableContext(PortableContext ctx) {
         ctx.configure(this);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/df6b8ee1/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
index 68f0514..056487a 100644
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableTypeConfiguration.java
@@ -17,11 +17,11 @@
 
 package org.apache.ignite.portable;
 
-import java.sql.Timestamp;
-import java.util.Collection;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.marshaller.portable.PortableMarshaller;
 
+import java.util.Collection;
+
 /**
  * Defines configuration properties for a specific portable type. Providing per-type
  * configuration is optional, as it is generally enough, and also optional, to provide global
portable
@@ -41,9 +41,6 @@ public class PortableTypeConfiguration {
     /** Serializer. */
     private PortableSerializer serializer;
 
-    /** Meta data enabled flag. */
-    private Boolean metaDataEnabled;
-
     /** Keep deserialized flag. */
     private Boolean keepDeserialized;
 
@@ -118,23 +115,6 @@ public class PortableTypeConfiguration {
     }
 
     /**
-     * Defines whether meta data is collected for this type. If provided, this value will
override
-     * {@link PortableMarshaller#isMetaDataEnabled()} property.
-     *
-     * @return Whether meta data is collected.
-     */
-    public Boolean isMetaDataEnabled() {
-        return metaDataEnabled;
-    }
-
-    /**
-     * @param metaDataEnabled Whether meta data is collected.
-     */
-    public void setMetaDataEnabled(Boolean metaDataEnabled) {
-        this.metaDataEnabled = metaDataEnabled;
-    }
-
-    /**
      * Defines whether {@link PortableObject} should cache deserialized instance. If provided,
      * this value will override {@link PortableMarshaller#isKeepDeserialized()}
      * property.

http://git-wip-us.apache.org/repos/asf/ignite/blob/df6b8ee1/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
deleted file mode 100644
index 05df23b..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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.portable;
-
-import java.util.Arrays;
-import org.apache.ignite.IgnitePortables;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-import org.apache.ignite.portable.PortableBuilder;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableMarshalAware;
-import org.apache.ignite.portable.PortableReader;
-import org.apache.ignite.portable.PortableTypeConfiguration;
-import org.apache.ignite.portable.PortableWriter;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Test for disabled meta data.
- */
-public class GridPortableMetaDataDisabledSelfTest extends GridCommonAbstractTest {
-    /** */
-    private PortableMarshaller marsh;
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        cfg.setMarshaller(marsh);
-
-        return cfg;
-    }
-
-    /**
-     * @return Portables.
-     */
-    private IgnitePortables portables() {
-        return grid().portables();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobal() throws Exception {
-        marsh = new PortableMarshaller();
-
-        marsh.setClassNames(Arrays.asList(
-            TestObject1.class.getName(),
-            TestObject2.class.getName()
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-            portables().toPortable(new TestObject3());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-
-            PortableBuilder bldr = portables().builder("FakeType");
-
-            bldr.setField("field1", 0).setField("field2", "value").build();
-
-            assertNull(portables().metadata("FakeType"));
-            assertNull(portables().metadata(TestObject3.class));
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobalSimpleClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
-        typeCfg.setMetaDataEnabled(true);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject1.class.getName()),
-            typeCfg
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(1, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableGlobalMarshalAwareClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
-        typeCfg.setMetaDataEnabled(true);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject2.class.getName()),
-            typeCfg
-        ));
-
-        marsh.setMetaDataEnabled(false);
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(1, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableSimpleClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject1.class.getName());
-
-        typeCfg.setMetaDataEnabled(false);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject2.class.getName()),
-            typeCfg
-        ));
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(0, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(1, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testDisableMarshalAwareClass() throws Exception {
-        marsh = new PortableMarshaller();
-
-        PortableTypeConfiguration typeCfg = new PortableTypeConfiguration(TestObject2.class.getName());
-
-        typeCfg.setMetaDataEnabled(false);
-
-        marsh.setTypeConfigurations(Arrays.asList(
-            new PortableTypeConfiguration(TestObject1.class.getName()),
-            typeCfg
-        ));
-
-        try {
-            startGrid();
-
-            portables().toPortable(new TestObject1());
-            portables().toPortable(new TestObject2());
-
-            assertEquals(1, portables().metadata(TestObject1.class).fields().size());
-            assertEquals(0, portables().metadata(TestObject2.class).fields().size());
-        }
-        finally {
-            stopGrid();
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject1 {
-        /** */
-        private int field;
-    }
-
-    /**
-     */
-    private static class TestObject2 implements PortableMarshalAware {
-        /** {@inheritDoc} */
-        @Override public void writePortable(PortableWriter writer) throws PortableException
{
-            writer.writeInt("field", 1);
-        }
-
-        /** {@inheritDoc} */
-        @Override public void readPortable(PortableReader reader) throws PortableException
{
-            // No-op.
-        }
-    }
-
-    /**
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    private static class TestObject3 {
-        /** */
-        private int field;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/df6b8ee1/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
index 6d8e12d..80893fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePortableObjectsTestSuite.java
@@ -25,7 +25,6 @@ import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsAddit
 import org.apache.ignite.internal.portable.GridPortableBuilderStringAsCharsSelfTest;
 import org.apache.ignite.internal.portable.GridPortableMarshallerCtxDisabledSelfTest;
 import org.apache.ignite.internal.portable.GridPortableMarshallerSelfTest;
-import org.apache.ignite.internal.portable.GridPortableMetaDataDisabledSelfTest;
 import org.apache.ignite.internal.portable.GridPortableMetaDataSelfTest;
 import org.apache.ignite.internal.portable.GridPortableWildcardsSelfTest;
 import org.apache.ignite.internal.portable.PortableCompactOffsetsHeapSelfTest;
@@ -71,7 +70,6 @@ public class IgnitePortableObjectsTestSuite extends TestSuite {
         suite.addTestSuite(PortableCompactOffsetsHeapSelfTest.class);
         suite.addTestSuite(PortableCompactOffsetsOffheapSelfTest.class);
         suite.addTestSuite(GridPortableMetaDataSelfTest.class);
-        suite.addTestSuite(GridPortableMetaDataDisabledSelfTest.class);
         suite.addTestSuite(GridPortableAffinityKeySelfTest.class);
         suite.addTestSuite(GridPortableWildcardsSelfTest.class);
 


Mime
View raw message