[37/50] [abbrv] ignite git commit: Revert "ignite-1462: hid portable API in 1.4 release" This reverts commit 71379a8061f50f336adc31fa20cd593b659b050f.

2015-09-15 Thread vozerov
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7eb2b37/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
new file mode 100644
index 000..05df23b
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMetaDataDisabledSelfTest.java
@@ -0,0 +1,238 @@
+/*
+ * 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());
+
+  

[37/50] [abbrv] ignite git commit: Revert "ignite-1462: hid portable API in 1.4 release" This reverts commit 71379a8061f50f336adc31fa20cd593b659b050f.

2015-09-15 Thread vozerov
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7eb2b37/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
--
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
new file mode 100644
index 000..21fc81c
--- /dev/null
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/portable/GridPortableMarshallerSelfTest.java
@@ -0,0 +1,3807 @@
+/*
+ * 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.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetSocketAddress;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListSet;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.portable.builder.PortableBuilderImpl;
+import org.apache.ignite.internal.util.GridUnsafe;
+import org.apache.ignite.internal.util.IgniteUtils;
+import org.apache.ignite.internal.util.lang.GridMapEntry;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.MarshallerContextTestImpl;
+import org.apache.ignite.marshaller.portable.PortableMarshaller;
+import org.apache.ignite.portable.PortableBuilder;
+import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.portable.PortableIdMapper;
+import org.apache.ignite.portable.PortableInvalidClassException;
+import org.apache.ignite.portable.PortableMarshalAware;
+import org.apache.ignite.portable.PortableMetadata;
+import org.apache.ignite.portable.PortableObject;
+import org.apache.ignite.portable.PortableRawReader;
+import org.apache.ignite.portable.PortableRawWriter;
+import org.apache.ignite.portable.PortableReader;
+import org.apache.ignite.portable.PortableSerializer;
+import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.portable.PortableWriter;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.jsr166.ConcurrentHashMap8;
+import sun.misc.Unsafe;
+
+import static 
org.apache.ignite.internal.portable.PortableThreadLocalMemoryAllocator.THREAD_LOCAL_ALLOC;
+import static org.junit.Assert.assertArrayEquals;
+
+/**
+ * Portable marshaller tests.
+ */
+@SuppressWarnings({"OverlyStrongTypeCast", "ArrayHashCode", 
"ConstantConditions"})
+public class GridPortableMarshallerSelfTest extends GridCommonAbstractTest {
+/** */
+private static final Unsafe UNSAFE = GridUnsafe.unsafe();
+
+/** */
+protected static final long BYTE_ARR_OFF = 
UNSAFE.arrayBaseOffset(byte[].class);
+
+/** */
+protected static final PortableMetaDataHandler META_HND = new 
PortableMetaDataHandler() {
+@Override public void addMeta(int typeId, PortableMetadata meta) {
+// No-op.
+}
+
+@Override public PortableMetadata metadata(int typeId) {
+return null;
+}
+};
+
+/**
+ * @throws Exception If failed.
+ */
+public void testNull() throws Exception {
+assertNull(marshalUnmarshal(null));
+}
+
+/**
+ * @throws Exception If failed.
+ */
+public void testByte() throws Exception {
+assertEquals((byte)100, marshalUnmarshal((byte)100).byteValue());
+}
+
+/**
+ * @throws Exception If fa