ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/31] ignite git commit: ignite-2065: rename "portable" packages to "binary"
Date Fri, 11 Dec 2015 09:38:12 GMT
http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
deleted file mode 100644
index 3bc3922..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryEnumsSelfTest.java
+++ /dev/null
@@ -1,446 +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 org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * Contains tests for binary enums.
- */
-@SuppressWarnings("unchecked")
-public class BinaryEnumsSelfTest extends GridCommonAbstractTest {
-    /** Cache name. */
-    private static String CACHE_NAME = "cache";
-
-    /** Whether to register types or not. */
-    private boolean register;
-
-    /** Node 1. */
-    private Ignite node1;
-
-    /** Node 2. */
-    private Ignite node2;
-
-    /** Cache 1. */
-    private IgniteCache cache1;
-
-    /** Cache 2. */
-    private IgniteCache cache2;
-
-    /** Binary cache 1. */
-    private IgniteCache cacheBinary1;
-
-    /** Binary cache 2. */
-    private IgniteCache cacheBinary2;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        register = false;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        stopAllGrids();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
-        IgniteConfiguration cfg = super.getConfiguration(gridName);
-
-        if (register) {
-            BinaryConfiguration bCfg = new BinaryConfiguration();
-
-            BinaryTypeConfiguration enumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
-            enumCfg.setEnum(true);
-
-            bCfg.setTypeConfigurations(Arrays.asList(enumCfg, new BinaryTypeConfiguration(EnumHolder.class.getName())));
-
-            cfg.setBinaryConfiguration(bCfg);
-        }
-
-        cfg.setMarshaller(new BinaryMarshaller());
-
-        CacheConfiguration ccfg = new CacheConfiguration();
-        ccfg.setName(CACHE_NAME);
-        ccfg.setCacheMode(CacheMode.PARTITIONED);
-
-        cfg.setCacheConfiguration(ccfg);
-
-        return cfg;
-    }
-
-    /**
-     * Start up routine.
-     *
-     * @throws Exception If failed.
-     */
-    private void startUp(boolean register) throws Exception {
-        this.register = register;
-
-        node1 = startGrid(0);
-        cache1 = node1.cache(CACHE_NAME);
-        cacheBinary1 = cache1.withKeepBinary();
-
-        node2 = startGrid(1);
-        cache2 = node2.cache(CACHE_NAME);
-        cacheBinary2 = cache2.withKeepBinary();
-    }
-
-    /**
-     * Test operations on simple type which is registered in advance.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleRegistered() throws Exception {
-        checkSimple(true);
-    }
-
-    /**
-     * Test operations on simple type which is not registered in advance.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleNotRegistered() throws Exception {
-        checkSimple(false);
-    }
-
-    /**
-     * Test operations when enum is nested into an object (registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testNestedRegistered() throws Exception {
-        checkNested(true);
-    }
-
-    /**
-     * Test operations when enum is nested into an object (not registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testNestedNotRegistered() throws Exception {
-        checkNested(false);
-    }
-
-    /**
-     * Test builder operations on simple type which is registered in advance.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleBuilderRegistered() throws Exception {
-        checkSimpleBuilder(true);
-    }
-
-    /**
-     * Test builder operations on simple type which is not registered in advance.
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleBuilderNotRegistered() throws Exception {
-        checkSimpleBuilder(false);
-    }
-
-    /**
-     * Test builder operations when enum is nested into an object (registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testNestedBuilderRegistered() throws Exception {
-        checkNestedBuilder(true);
-    }
-
-    /**
-     * Test builder operations when enum is nested into an object (not registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testNestedBuilderNotRegistered() throws Exception {
-        checkNestedBuilder(false);
-    }
-
-    /**
-     * Check simple serialization - deserialization.
-     *
-     * @param registered If type should be registered in advance.
-     * @throws Exception If failed.
-     */
-    public void checkSimple(boolean registered) throws Exception {
-        startUp(registered);
-
-        cache1.put(1, EnumType.ONE);
-
-        validateSimple(1, EnumType.ONE, registered);
-    }
-
-    /**
-     * Check nested serialization - deserialization.
-     *
-     * @param registered If type should be registered in advance.
-     * @throws Exception If failed.
-     */
-    private void checkNested(boolean registered) throws Exception {
-        startUp(registered);
-
-        cache1.put(1, new EnumHolder(EnumType.ONE));
-
-        validateNested(1, EnumType.ONE, registered);
-    }
-
-    /**
-     * Check nested builder serialization - deserialization.
-     *
-     * @param registered If type should be registered in advance.
-     * @throws Exception If failed.
-     */
-    private void checkNestedBuilder(boolean registered) throws Exception {
-        startUp(registered);
-
-        BinaryObject obj = node1.binary().builder("EnumHolder").setField("val", EnumType.ONE).build();
-
-        assert node1.binary().type("EnumHolder") != null;
-        assert node1.binary().type("EnumType") != null;
-
-        cacheBinary1.put(1, obj);
-
-        validateNested(1, EnumType.ONE, registered);
-
-        obj = (BinaryObject)cacheBinary1.get(1);
-        obj = node1.binary().builder(obj).setField("val", EnumType.TWO).build();
-
-        cacheBinary1.put(1, obj);
-
-        validateNested(1, EnumType.TWO, registered);
-    }
-
-    /**
-     * Validate nested object.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param registered Registered flag.
-     * @throws Exception If failed.
-     */
-    private void validateNested(int key, EnumType val, boolean registered) throws Exception
{
-        if (registered) {
-            EnumHolder res1 = (EnumHolder) cache1.get(key);
-            EnumHolder res2 = (EnumHolder) cache2.get(key);
-
-            assertEquals(val, res1.val);
-            assertEquals(val, res2.val);
-        }
-
-        BinaryObject resBinary1 = (BinaryObject)cacheBinary1.get(key);
-        BinaryObject resBinary2 = (BinaryObject)cacheBinary2.get(key);
-
-        validate((BinaryObject)resBinary1.field("val"), val);
-        validate((BinaryObject)resBinary2.field("val"), val);
-    }
-
-    /**
-     * Check simple serialization - deserialization using builder.
-     *
-     * @param registered If type should be registered in advance.
-     * @throws Exception If failed.
-     */
-    public void checkSimpleBuilder(boolean registered) throws Exception {
-        startUp(registered);
-
-        BinaryObject binary = node1.binary().buildEnum(EnumType.class.getSimpleName(), EnumType.ONE.ordinal());
-
-        cacheBinary1.put(1, binary);
-
-        validateSimple(1, EnumType.ONE, registered);
-    }
-
-    /**
-     * Test enum array (registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleArrayRegistered() throws Exception {
-        checkSimpleArray(true);
-    }
-
-    /**
-     * Test enum array (not registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleArrayNotRegistered() throws Exception {
-        checkSimpleArray(false);
-    }
-
-    /**
-     * Test enum array created using builder (registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleBuilderArrayRegistered() throws Exception {
-        checkSimpleBuilderArray(true);
-    }
-
-    /**
-     * Test enum array created using builder (not registered).
-     *
-     * @throws Exception If failed.
-     */
-    public void testSimpleBuilderArrayNotRegistered() throws Exception {
-        checkSimpleBuilderArray(false);
-    }
-
-    /**
-     * Check arrays with builder.
-     *
-     * @param registered Registered flag.
-     * @throws Exception If failed.
-     */
-    public void checkSimpleArray(boolean registered) throws Exception {
-        startUp(registered);
-
-        cache1.put(1, new EnumType[] { EnumType.ONE, EnumType.TWO });
-
-        validateSimpleArray(registered);
-    }
-
-    /**
-     * Check arrays with builder.
-     *
-     * @param registered Registered flag.
-     * @throws Exception If failed.
-     */
-    public void checkSimpleBuilderArray(boolean registered) throws Exception {
-        startUp(registered);
-
-        BinaryObject binaryOne = node1.binary().buildEnum(EnumType.class.getSimpleName(),
EnumType.ONE.ordinal());
-        BinaryObject binaryTwo = node1.binary().buildEnum(EnumType.class.getSimpleName(),
EnumType.TWO.ordinal());
-
-        cacheBinary1.put(1, new BinaryObject[] { binaryOne, binaryTwo });
-
-        validateSimpleArray(registered);
-    }
-
-    /**
-     * Validate simple array.
-     *
-     * @param registered Registered flag.
-     */
-    private void validateSimpleArray(boolean registered) {
-        if (registered) {
-            Object[] arr1 = (Object[])cache1.get(1);
-            Object[] arr2 = (Object[])cache2.get(1);
-
-            assertEquals(2, arr1.length);
-            assertEquals(2, arr2.length);
-
-            assertEquals(EnumType.ONE, arr1[0]);
-            assertEquals(EnumType.TWO, arr1[1]);
-
-            assertEquals(EnumType.ONE, arr2[0]);
-            assertEquals(EnumType.TWO, arr2[1]);
-        }
-
-        Object[] arrBinary1 = (Object[])cacheBinary1.get(1);
-        Object[] arrBinary2 = (Object[])cacheBinary2.get(1);
-
-        assertEquals(2, arrBinary1.length);
-        assertEquals(2, arrBinary2.length);
-
-        validate((BinaryObject) arrBinary1[0], EnumType.ONE);
-        validate((BinaryObject) arrBinary1[1], EnumType.TWO);
-
-        validate((BinaryObject) arrBinary2[0], EnumType.ONE);
-        validate((BinaryObject) arrBinary2[1], EnumType.TWO);
-    }
-
-    /**
-     * Internal check routine for simple scenario.
-     *
-     * @param key Key.
-     * @param val Value.
-     * @param registered Registered flag.
-     * @throws Exception If failed.
-     */
-    private void validateSimple(int key, EnumType val, boolean registered) throws Exception
{
-        if (registered) {
-            assertEquals(val, cache1.get(key));
-            assertEquals(val, cache2.get(key));
-        }
-
-        validate((BinaryObject) cacheBinary1.get(key), val);
-        validate((BinaryObject) cacheBinary2.get(key), val);
-    }
-
-    /**
-     * Validate single value.
-     *
-     * @param obj Binary value.
-     * @param val Expected value.
-     */
-    private void validate(BinaryObject obj, EnumType val) {
-        assertTrue(obj.type().isEnum());
-
-        assertEquals(node1.binary().typeId(EnumType.class.getName()), obj.type().typeId());
-        assertEquals(node2.binary().typeId(EnumType.class.getName()), obj.type().typeId());
-
-        assertEquals(val.ordinal(), obj.enumOrdinal());
-    }
-
-    /**
-     * Enumeration holder.
-     */
-    public static class EnumHolder implements Serializable {
-        /** Value. */
-        public EnumType val;
-
-        /**
-         * Default constructor.
-         */
-        @SuppressWarnings("UnusedDeclaration")
-        public EnumHolder() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param val Value.
-         */
-        public EnumHolder(EnumType val) {
-            this.val = val;
-        }
-    }
-
-    /**
-     * Enumeration for tests.
-     */
-    public static enum EnumType {
-        ONE,
-        TWO
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
deleted file mode 100644
index 47f3886..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsAbstractSelfTest.java
+++ /dev/null
@@ -1,718 +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 org.apache.ignite.binary.BinaryField;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.UUID;
-
-/**
- * Contains tests for portable object fields.
- */
-public abstract class BinaryFieldsAbstractSelfTest extends GridCommonAbstractTest {
-    /** Marshaller. */
-    protected BinaryMarshaller dfltMarsh;
-
-    /**
-     * Create marshaller.
-     *
-     * @return Portable marshaller.
-     * @throws Exception If failed.
-     */
-    protected BinaryMarshaller createMarshaller() throws Exception {
-        PortableContext ctx = new PortableContext(BinaryCachingMetadataHandler.create(),
new IgniteConfiguration());
-
-        BinaryMarshaller marsh = new BinaryMarshaller();
-
-        BinaryConfiguration bCfg = new BinaryConfiguration();
-        
-        bCfg.setCompactFooter(compactFooter());
-
-        bCfg.setTypeConfigurations(Arrays.asList(
-            new BinaryTypeConfiguration(TestObject.class.getName()),
-            new BinaryTypeConfiguration(TestOuterObject.class.getName()),
-            new BinaryTypeConfiguration(TestInnerObject.class.getName())
-        ));
-
-        IgniteConfiguration iCfg = new IgniteConfiguration();
-
-        iCfg.setBinaryConfiguration(bCfg);
-
-        marsh.setContext(new MarshallerContextTestImpl(null));
-
-        IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg);
-
-        return marsh;
-    }
-
-    /**
-     * @return Whether to use compact footer.
-     */
-    protected boolean compactFooter() {
-        return true;
-    }
-
-    /**
-     * Get portable context for the current marshaller.
-     *
-     * @param marsh Marshaller.
-     * @return Portable context.
-     */
-    protected static PortableContext portableContext(BinaryMarshaller marsh) {
-        GridPortableMarshaller impl = U.field(marsh, "impl");
-
-        return impl.context();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        dfltMarsh = createMarshaller();
-    }
-
-    /**
-     * Test byte field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testByte() throws Exception {
-        check("fByte");
-    }
-
-    /**
-     * Test byte array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testByteArray() throws Exception {
-        check("fByteArr");
-    }
-
-    /**
-     * Test boolean field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testBoolean() throws Exception {
-        check("fBool");
-    }
-
-    /**
-     * Test boolean array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testBooleanArray() throws Exception {
-        check("fBoolArr");
-    }
-
-    /**
-     * Test short field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testShort() throws Exception {
-        check("fShort");
-    }
-
-    /**
-     * Test short array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testShortArray() throws Exception {
-        check("fShortArr");
-    }
-
-    /**
-     * Test char field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testChar() throws Exception {
-        check("fChar");
-    }
-
-    /**
-     * Test char array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testCharArray() throws Exception {
-        check("fCharArr");
-    }
-
-    /**
-     * Test int field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testInt() throws Exception {
-        check("fInt");
-    }
-
-    /**
-     * Test int array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testIntArray() throws Exception {
-        check("fIntArr");
-    }
-
-    /**
-     * Test long field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testLong() throws Exception {
-        check("fLong");
-    }
-
-    /**
-     * Test long array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testLongArray() throws Exception {
-        check("fLongArr");
-    }
-
-    /**
-     * Test float field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testFloat() throws Exception {
-        check("fFloat");
-    }
-
-    /**
-     * Test float array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testFloatArray() throws Exception {
-        check("fFloatArr");
-    }
-
-    /**
-     * Test double field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDouble() throws Exception {
-        check("fDouble");
-    }
-
-    /**
-     * Test double array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDoubleArray() throws Exception {
-        check("fDoubleArr");
-    }
-
-    /**
-     * Test string field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testString() throws Exception {
-        check("fString");
-    }
-
-    /**
-     * Test string array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testStringArray() throws Exception {
-        check("fStringArr");
-    }
-
-    /**
-     * Test date field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDate() throws Exception {
-        check("fDate");
-    }
-
-    /**
-     * Test date array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDateArray() throws Exception {
-        check("fDateArr");
-    }
-
-    /**
-     * Test timestamp field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testTimestamp() throws Exception {
-        check("fTimestamp");
-    }
-
-    /**
-     * Test timestamp array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testTimestampArray() throws Exception {
-        check("fTimestampArr");
-    }
-
-    /**
-     * Test UUID field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testUuid() throws Exception {
-        check("fUuid");
-    }
-
-    /**
-     * Test UUID array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testUuidArray() throws Exception {
-        check("fUuidArr");
-    }
-
-    /**
-     * Test decimal field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDecimal() throws Exception {
-        check("fDecimal");
-    }
-
-    /**
-     * Test decimal array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testDecimalArray() throws Exception {
-        check("fDecimalArr");
-    }
-
-    /**
-     * Test object field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testObject() throws Exception {
-        check("fObj");
-    }
-
-    /**
-     * Test object array field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testObjectArray() throws Exception {
-        check("fObjArr");
-    }
-
-    /**
-     * Test null field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testNull() throws Exception {
-        check("fNull");
-    }
-
-    /**
-     * Test missing field.
-     *
-     * @throws Exception If failed.
-     */
-    public void testMissing() throws Exception {
-        String fieldName = "fMissing";
-
-        checkNormal(dfltMarsh, fieldName, false);
-        checkNested(dfltMarsh, fieldName, false);
-    }
-
-    /**
-     * Check field resolution in both normal and nested modes.
-     *
-     * @param fieldName Field name.
-     * @throws Exception If failed.
-     */
-    public void check(String fieldName) throws Exception {
-        checkNormal(dfltMarsh, fieldName, true);
-        checkNested(dfltMarsh, fieldName, true);
-    }
-
-    /**
-     * Check field.
-     *
-     * @param marsh Marshaller.
-     * @param fieldName Field name.
-     * @param exists Whether field should exist.
-     * @throws Exception If failed.
-     */
-    private void checkNormal(BinaryMarshaller marsh, String fieldName, boolean exists) throws
Exception {
-        TestContext testCtx = context(marsh, fieldName);
-
-        check0(fieldName, testCtx, exists);
-    }
-
-    /**
-     * Check nested field.
-     *
-     * @param marsh Marshaller.
-     * @param fieldName Field name.
-     * @param exists Whether field should exist.
-     * @throws Exception If failed.
-     */
-    private void checkNested(BinaryMarshaller marsh, String fieldName, boolean exists) throws
Exception {
-        TestContext testCtx = nestedContext(marsh, fieldName);
-
-        check0(fieldName, testCtx, exists);
-    }
-
-    /**
-     * Internal check routine.
-     *
-     * @param fieldName Field name.
-     * @param ctx Context.
-     * @param exists Whether field should exist.
-     * @throws Exception If failed.
-     */
-    private void check0(String fieldName, TestContext ctx, boolean exists) throws Exception
{
-        Object val = ctx.field.value(ctx.portObj);
-
-        if (exists) {
-            assertTrue(ctx.field.exists(ctx.portObj));
-
-            Object expVal = U.field(ctx.obj, fieldName);
-
-            if (val instanceof BinaryObject)
-                val = ((BinaryObject) val).deserialize();
-
-            if (val != null && val.getClass().isArray()) {
-                assertNotNull(expVal);
-
-                if (val instanceof byte[])
-                    assertTrue(Arrays.equals((byte[]) expVal, (byte[]) val));
-                else if (val instanceof boolean[])
-                    assertTrue(Arrays.equals((boolean[]) expVal, (boolean[]) val));
-                else if (val instanceof short[])
-                    assertTrue(Arrays.equals((short[]) expVal, (short[]) val));
-                else if (val instanceof char[])
-                    assertTrue(Arrays.equals((char[]) expVal, (char[]) val));
-                else if (val instanceof int[])
-                    assertTrue(Arrays.equals((int[]) expVal, (int[]) val));
-                else if (val instanceof long[])
-                    assertTrue(Arrays.equals((long[]) expVal, (long[]) val));
-                else if (val instanceof float[])
-                    assertTrue(Arrays.equals((float[]) expVal, (float[]) val));
-                else if (val instanceof double[])
-                    assertTrue(Arrays.equals((double[]) expVal, (double[]) val));
-                else {
-                    Object[] expVal0 = (Object[])expVal;
-                    Object[] val0 = (Object[])val;
-
-                    assertEquals(expVal0.length, val0.length);
-
-                    for (int i = 0; i < expVal0.length; i++) {
-                        Object expItem = expVal0[i];
-                        Object item = val0[i];
-
-                        if (item instanceof BinaryObject)
-                            item = ((BinaryObject)item).deserialize();
-
-                        assertEquals(expItem, item);
-                    }
-                }
-            }
-            else
-                assertEquals(expVal, val);
-        }
-        else {
-            assertFalse(ctx.field.exists(ctx.portObj));
-
-            assert val == null;
-        }
-    }
-
-    /**
-     * Get test context.
-     *
-     * @param marsh Portable marshaller.
-     * @param fieldName Field name.
-     * @return Test context.
-     * @throws Exception If failed.
-     */
-    private TestContext context(BinaryMarshaller marsh, String fieldName) throws Exception
{
-        TestObject obj = createObject();
-
-        BinaryObjectExImpl portObj = toPortable(marsh, obj);
-
-        BinaryField field = portObj.type().field(fieldName);
-
-        return new TestContext(obj, portObj, field);
-    }
-
-    /**
-     * Get test context with nested test object.
-     *
-     * @param marsh Portable marshaller.
-     * @param fieldName Field name.
-     * @return Test context.
-     * @throws Exception If failed.
-     */
-    private TestContext nestedContext(BinaryMarshaller marsh, String fieldName)
-        throws Exception {
-        TestObject obj = createObject();
-        TestOuterObject outObj = new TestOuterObject(obj);
-
-        BinaryObjectExImpl portOutObj = toPortable(marsh, outObj);
-        BinaryObjectExImpl portObj = portOutObj.field("fInner");
-
-        assert portObj != null;
-
-        BinaryField field = portObj.type().field(fieldName);
-
-        return new TestContext(obj, portObj, field);
-    }
-
-    /**
-     * Create test object.
-     *
-     * @return Test object.
-     */
-    private TestObject createObject() {
-        return new TestObject(0);
-    }
-
-    /**
-     * Convert object to portable object.
-     *
-     * @param marsh Marshaller.
-     * @param obj Object.
-     * @return Portable object.
-     * @throws Exception If failed.
-     */
-    protected abstract BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception;
-
-    /**
-     * Outer test object.
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    public static class TestOuterObject {
-        /** Inner object. */
-        public TestObject fInner;
-
-        /**
-         * Default constructor.
-         */
-        public TestOuterObject() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param fInner Inner object.
-         */
-        public TestOuterObject(TestObject fInner) {
-            this.fInner = fInner;
-        }
-    }
-
-    /**
-     * Test object class, c
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    public static class TestObject {
-        /** Primitive fields. */
-        public byte fByte;
-        public boolean fBool;
-        public short fShort;
-        public char fChar;
-        public int fInt;
-        public long fLong;
-        public float fFloat;
-        public double fDouble;
-
-        public byte[] fByteArr;
-        public boolean[] fBoolArr;
-        public short[] fShortArr;
-        public char[] fCharArr;
-        public int[] fIntArr;
-        public long[] fLongArr;
-        public float[] fFloatArr;
-        public double[] fDoubleArr;
-
-        /** Special fields. */
-        public String fString;
-        public Date fDate;
-        public Timestamp fTimestamp;
-        public UUID fUuid;
-        public BigDecimal fDecimal;
-
-        public String[] fStringArr;
-        public Date[] fDateArr;
-        public Timestamp[] fTimestampArr;
-        public UUID[] fUuidArr;
-        public BigDecimal[] fDecimalArr;
-
-        /** Nested object. */
-        public TestInnerObject fObj;
-
-        public TestInnerObject[] fObjArr;
-
-        /** Field which is always set to null. */
-        public Object fNull;
-
-        /**
-         * Default constructor.
-         */
-        public TestObject() {
-            // No-op.
-        }
-
-        /**
-         * Non-default constructor.
-         *
-         * @param ignore Ignored.
-         */
-        public TestObject(int ignore) {
-            fByte = 1;
-            fBool = true;
-            fShort = 2;
-            fChar = 3;
-            fInt = 4;
-            fLong = 5;
-            fFloat = 6.6f;
-            fDouble = 7.7;
-
-            fByteArr = new byte[] { 1, 2 };
-            fBoolArr = new boolean[] { true, false };
-            fShortArr = new short[] { 2, 3 };
-            fCharArr = new char[] { 3, 4 };
-            fIntArr = new int[] { 4, 5 };
-            fLongArr = new long[] { 5, 6 };
-            fFloatArr = new float[] { 6.6f, 7.7f };
-            fDoubleArr = new double[] { 7.7, 8.8 };
-
-            fString = "8";
-            fDate = new Date();
-            fTimestamp = new Timestamp(new Date().getTime() + 1);
-            fUuid = UUID.randomUUID();
-            fDecimal = new BigDecimal(9);
-
-            fStringArr = new String[] { "8", "9" };
-            fDateArr = new Date[] { new Date(), new Date(new Date().getTime() + 1) };
-            fTimestampArr =
-                new Timestamp[] { new Timestamp(new Date().getTime() + 1), new Timestamp(new
Date().getTime() + 2) };
-            fUuidArr = new UUID[] { UUID.randomUUID(), UUID.randomUUID() };
-            fDecimalArr = new BigDecimal[] { new BigDecimal(9), new BigDecimal(10) };
-
-            fObj = new TestInnerObject(10);
-            fObjArr = new TestInnerObject[] { new TestInnerObject(10), new TestInnerObject(11)
};
-        }
-    }
-
-    /**
-     * Inner test object.
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    public static class TestInnerObject {
-        /** Value. */
-        private int val;
-
-        /**
-         * Default constructor.
-         */
-        public TestInnerObject() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param val Value.
-         */
-        public TestInnerObject(int val) {
-            this.val = val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public int hashCode() {
-            return val;
-        }
-
-        /** {@inheritDoc} */
-        @Override public boolean equals(Object other) {
-            return other != null && other instanceof TestInnerObject && val
== ((TestInnerObject)(other)).val;
-        }
-    }
-
-    /**
-     * Test context.
-     */
-    public static class TestContext {
-        /** Object. */
-        public final TestObject obj;
-
-        /** Portable object. */
-        public final BinaryObjectExImpl portObj;
-
-        /** Field. */
-        public final BinaryField field;
-
-        /**
-         * Constructor.
-         *
-         * @param obj Object.
-         * @param portObj Portable object.
-         * @param field Field.
-         */
-        public TestContext(TestObject obj, BinaryObjectExImpl portObj, BinaryField field)
{
-            this.obj = obj;
-            this.portObj = portObj;
-            this.field = field;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java
deleted file mode 100644
index a45809f..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsHeapSelfTest.java
+++ /dev/null
@@ -1,30 +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;
-
-/**
- * Field tests for heap-based portables.
- */
-public class BinaryFieldsHeapSelfTest extends BinaryFieldsAbstractSelfTest {
-    /** {@inheritDoc} */
-    @Override protected BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception {
-        byte[] bytes = marsh.marshal(obj);
-
-        return new BinaryObjectImpl(portableContext(marsh), bytes, 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java
deleted file mode 100644
index 2f579e1..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFieldsOffheapSelfTest.java
+++ /dev/null
@@ -1,60 +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 org.apache.ignite.internal.util.GridUnsafe;
-import org.eclipse.jetty.util.ConcurrentHashSet;
-import sun.misc.Unsafe;
-
-/**
- * Field tests for heap-based portables.
- */
-public class BinaryFieldsOffheapSelfTest extends BinaryFieldsAbstractSelfTest {
-    /** Unsafe instance. */
-    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
-    /** Byte array offset for unsafe mechanics. */
-    protected static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
-
-    /** Allocated unsafe pointer. */
-    private final ConcurrentHashSet<Long> ptrs = new ConcurrentHashSet<>();
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        // Cleanup allocated objects.
-        for (Long ptr : ptrs)
-            UNSAFE.freeMemory(ptr);
-
-        ptrs.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception {
-        byte[] arr = marsh.marshal(obj);
-
-        long ptr = UNSAFE.allocateMemory(arr.length);
-
-        ptrs.add(ptr);
-
-        UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr, arr.length);
-
-        return new BinaryObjectOffheapImpl(portableContext(marsh), ptr, 0, arr.length);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsAbstractSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsAbstractSelfTest.java
deleted file mode 100644
index 38c0137..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsAbstractSelfTest.java
+++ /dev/null
@@ -1,205 +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.binary.BinaryField;
-import org.apache.ignite.binary.BinaryTypeConfiguration;
-import org.apache.ignite.configuration.BinaryConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.marshaller.MarshallerContextTestImpl;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- * Contains tests for compact offsets.
- */
-public abstract class BinaryFooterOffsetsAbstractSelfTest extends GridCommonAbstractTest
{
-    /** 2 pow 8. */
-    private static int POW_8 = 1 << 8;
-
-    /** 2 pow 16. */
-    private static int POW_16 = 1 << 16;
-
-    /** Marshaller. */
-    protected BinaryMarshaller marsh;
-
-    /** Portable context. */
-    protected PortableContext ctx;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTest() throws Exception {
-        super.beforeTest();
-
-        ctx = new PortableContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration());
-
-        marsh = new BinaryMarshaller();
-
-        IgniteConfiguration iCfg = new IgniteConfiguration();
-
-        BinaryConfiguration bCfg = new BinaryConfiguration();
-
-        bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));
-        
-        bCfg.setCompactFooter(compactFooter());
-
-        iCfg.setBinaryConfiguration(bCfg);
-
-        marsh.setContext(new MarshallerContextTestImpl(null));
-
-        IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setPortableContext", ctx, iCfg);
-    }
-
-    /**
-     * @return Whether to use compact footers.
-     */
-    protected boolean compactFooter() {
-        return true;
-    }
-    
-    /**
-     * Test 1 byte.
-     *
-     * @throws Exception If failed.
-     */
-    public void test1Byte() throws Exception {
-        check(POW_8 >> 2);
-    }
-
-    /**
-     * Test 1 byte with sign altering.
-     *
-     * @throws Exception If failed.
-     */
-    public void test1ByteSign() throws Exception {
-        check(POW_8 >> 1);
-    }
-
-    /**
-     * Test 2 bytes.
-     *
-     * @throws Exception If failed.
-     */
-    public void test2Bytes() throws Exception {
-        check(POW_16 >> 2);
-    }
-
-    /**
-     * Test 2 bytes with sign altering.
-     *
-     * @throws Exception If failed.
-     */
-    public void test2BytesSign() throws Exception {
-        check(POW_16 >> 1);
-    }
-
-    /**
-     * Test 4 bytes.
-     *
-     * @throws Exception If failed.
-     */
-    public void test4Bytes() throws Exception {
-        check(POW_16 << 2);
-    }
-
-    /**
-     * Main check routine.
-     *
-     * @param len Length of the first field.
-     *
-     * @throws Exception If failed.
-     */
-    private void check(int len) throws Exception {
-        TestObject obj = new TestObject(len);
-
-        BinaryObjectExImpl portObj = toPortable(marsh, obj);
-
-        // 1. Test portable object content.
-        assert portObj.hasField("field1");
-        assert portObj.hasField("field2");
-
-        byte[] field1 = portObj.field("field1");
-        Integer field2 = portObj.field("field2");
-
-        assert field1 != null;
-        assert field2 != null;
-
-        assert Arrays.equals(obj.field1, field1);
-        assert obj.field2 == field2;
-
-        // 2. Test fields API.
-        BinaryField field1Desc = portObj.type().field("field1");
-        BinaryField field2Desc = portObj.type().field("field2");
-
-        assert field1Desc.exists(portObj);
-        assert field2Desc.exists(portObj);
-
-        assert Arrays.equals(obj.field1, (byte[])field1Desc.value(portObj));
-        assert obj.field2 == (Integer)field2Desc.value(portObj);
-
-        // 3. Test deserialize.
-        TestObject objRestored = portObj.deserialize();
-
-        assert objRestored != null;
-
-        assert Arrays.equals(obj.field1, objRestored.field1);
-        assert obj.field2 == objRestored.field2;
-    }
-
-    /**
-     * Convert object to portable object.
-     *
-     * @param marsh Marshaller.
-     * @param obj Object.
-     * @return Portable object.
-     * @throws Exception If failed.
-     */
-    protected abstract BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception;
-
-    /**
-     * Test object.
-     */
-    public static class TestObject {
-        /** First field with variable length. */
-        public byte[] field1;
-
-        /** Second field. */
-        public int field2;
-
-        /**
-         * Default constructor.
-         */
-        public TestObject() {
-            // No-op.
-        }
-
-        /**
-         * Constructor.
-         *
-         * @param len Array length.
-         */
-        public TestObject(int len) {
-            field1 = new byte[len];
-
-            field1[0] = 1;
-            field1[len - 1] = 2;
-
-            field2 = len;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsHeapSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsHeapSelfTest.java
deleted file mode 100644
index bc48bef..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsHeapSelfTest.java
+++ /dev/null
@@ -1,30 +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;
-
-/**
- * Compact offsets tests for heap portable objects.
- */
-public class BinaryFooterOffsetsHeapSelfTest extends BinaryFooterOffsetsAbstractSelfTest
{
-    /** {@inheritDoc} */
-    @Override protected BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception {
-        byte[] bytes = marsh.marshal(obj);
-
-        return new BinaryObjectImpl(ctx, bytes, 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/1dbf20e0/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsOffheapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsOffheapSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsOffheapSelfTest.java
deleted file mode 100644
index a2c0a05..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/portable/BinaryFooterOffsetsOffheapSelfTest.java
+++ /dev/null
@@ -1,60 +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 org.apache.ignite.internal.util.GridUnsafe;
-import org.eclipse.jetty.util.ConcurrentHashSet;
-import sun.misc.Unsafe;
-
-/**
- * Compact offsets tests for offheap portable objects.
- */
-public class BinaryFooterOffsetsOffheapSelfTest extends BinaryFooterOffsetsAbstractSelfTest
{
-    /** Unsafe instance. */
-    private static final Unsafe UNSAFE = GridUnsafe.unsafe();
-
-    /** Byte array offset for unsafe mechanics. */
-    protected static final long BYTE_ARR_OFF = UNSAFE.arrayBaseOffset(byte[].class);
-
-    /** Allocated unsafe pointer. */
-    private final ConcurrentHashSet<Long> ptrs = new ConcurrentHashSet<>();
-
-    /** {@inheritDoc} */
-    @Override protected void afterTest() throws Exception {
-        super.afterTest();
-
-        // Cleanup allocated objects.
-        for (Long ptr : ptrs)
-            UNSAFE.freeMemory(ptr);
-
-        ptrs.clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override protected BinaryObjectExImpl toPortable(BinaryMarshaller marsh, Object obj)
throws Exception {
-        byte[] arr = marsh.marshal(obj);
-
-        long ptr = UNSAFE.allocateMemory(arr.length);
-
-        ptrs.add(ptr);
-
-        UNSAFE.copyMemory(arr, BYTE_ARR_OFF, null, ptr, arr.length);
-
-        return new BinaryObjectOffheapImpl(ctx, ptr, 0, arr.length);
-    }
-}


Mime
View raw message