http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
index 0000000,1cb9aa6..5b6e059
mode 000000,100644..100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/util/GridStartupWithUndefinedIgniteHomeSelfTest.java
@@@ -1,0 -1,106 +1,106 @@@
+ /*
+  * 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.util;
+ 
+ import junit.framework.*;
+ import org.apache.ignite.*;
+ import org.apache.ignite.configuration.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.logger.java.*;
+ import org.apache.ignite.spi.discovery.tcp.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+ import org.apache.ignite.testframework.junits.common.*;
+ 
+ import static org.apache.ignite.IgniteSystemProperties.*;
+ import static org.apache.ignite.internal.util.IgniteUtils.*;
+ 
+ /**
+  * Checks that node can be started without operations with undefined 
IGNITE_HOME.
+  * <p>
+  * Notes:
+  * 1. The test intentionally extends JUnit {@link TestCase} class to make the 
test
+  * independent from {@link GridCommonAbstractTest} stuff.
+  * 2. Do not replace native Java asserts with JUnit ones - test won't fall on 
TeamCity.
+  */
+ public class GridStartupWithUndefinedIgniteHomeSelfTest extends TestCase {
+     /** */
+     private static final TcpDiscoveryIpFinder IP_FINDER = new 
TcpDiscoveryVmIpFinder(true);
+ 
+     /** */
+     private static final int GRID_COUNT = 2;
+ 
+     /** {@inheritDoc} */
+     @Override protected void tearDown() throws Exception {
+         // Next grid in the same VM shouldn't use cached values produced by 
these tests.
+         nullifyHomeDirectory();
+ 
+         U.getIgniteHome();
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testStartStopWithUndefinedIgniteHome() throws Exception {
+         IgniteUtils.nullifyHomeDirectory();
+ 
+         // We can't use U.getIgniteHome() here because
+         // it will initialize cached value which is forbidden to override.
+         String ggHome = IgniteSystemProperties.getString(IGNITE_HOME);
+ 
+         assert ggHome != null;
+ 
+         U.setIgniteHome(null);
+ 
+         String ggHome0 = U.getIgniteHome();
+ 
+         assert ggHome0 == null;
+ 
 -        IgniteLogger log = new IgniteJavaLogger();
++        IgniteLogger log = new JavaLogger();
+ 
+         log.info(">>> Test started: " + getName());
+         log.info("Grid start-stop test count: " + GRID_COUNT);
+ 
+         for (int i = 0; i < GRID_COUNT; i++) {
+             TcpDiscoverySpi disc = new TcpDiscoverySpi();
+ 
+             disc.setIpFinder(IP_FINDER);
+ 
+             IgniteConfiguration cfg = new IgniteConfiguration();
+ 
+             // We have to explicitly configure path to license config because 
of undefined IGNITE_HOME.
+             cfg.setLicenseUrl("file:///" + ggHome + "/" + 
Ignition.DFLT_LIC_FILE_NAME);
+ 
+             // Default console logger is used
+             cfg.setGridLogger(log);
+             cfg.setDiscoverySpi(disc);
+             cfg.setRestEnabled(false);
+ 
+             try (Ignite g = G.start(cfg)) {
+                 assert g != null;
+ 
+                 ggHome0 = U.getIgniteHome();
+ 
+                 assert ggHome0 == null;
+ 
+                 X.println("Stopping grid " + g.cluster().localNode().id());
+             }
+         }
+     }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/lang/GridFuncSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/loadtest/GridSingleExecutionTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheAbstractLoadTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/loadtests/capacity/spring-capacity-cache.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/loadtests/colocation/spring-colocation.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/loadtests/direct/redeploy/GridSingleSplitsRedeployLoadTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/logger/java/IgniteJavaLoggerTest.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/test/java/org/apache/ignite/logger/java/IgniteJavaLoggerTest.java
index 0000000,4aa440e..9895c07
mode 000000,100644..100644
--- 
a/modules/core/src/test/java/org/apache/ignite/logger/java/IgniteJavaLoggerTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/logger/java/IgniteJavaLoggerTest.java
@@@ -1,0 -1,65 +1,65 @@@
+ /*
+  * 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.logger.java;
+ 
+ import junit.framework.*;
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.logger.*;
+ import org.apache.ignite.testframework.junits.common.*;
+ 
+ import java.util.*;
+ 
+ /**
+  * Java logger test.
+  */
+ @GridCommonTest(group = "Logger")
+ public class IgniteJavaLoggerTest extends TestCase {
+     /** */
+     @SuppressWarnings({"FieldCanBeLocal"})
+     private IgniteLogger log;
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testLogInitialize() throws Exception {
+         U.setWorkDirectory(null, U.getIgniteHome());
+ 
 -        log = new IgniteJavaLogger();
++        log = new JavaLogger();
+ 
 -        
((IgniteLoggerNodeIdAware)log).setNodeId(UUID.fromString("00000000-1111-2222-3333-444444444444"));
++        
((LoggerNodeIdAware)log).setNodeId(UUID.fromString("00000000-1111-2222-3333-444444444444"));
+ 
+         if (log.isDebugEnabled())
+             log.debug("This is 'debug' message.");
+ 
+         assert log.isInfoEnabled();
+ 
+         log.info("This is 'info' message.");
+         log.warning("This is 'warning' message.");
+         log.warning("This is 'warning' message.", new Exception("It's a test 
warning exception"));
+         log.error("This is 'error' message.");
+         log.error("This is 'error' message.", new Exception("It's a test 
error exception"));
+ 
 -        assert log.getLogger(IgniteJavaLoggerTest.class.getName()) instanceof 
IgniteJavaLogger;
++        assert log.getLogger(IgniteJavaLoggerTest.class.getName()) instanceof 
JavaLogger;
+ 
+         assert log.fileName() != null;
+ 
+         // Ensure we don't get pattern, only actual file name is allowed here.
+         assert !log.fileName().contains("%");
+     }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerEnumSelfTest.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerEnumSelfTest.java
index 0000000,7bd5bea..970dd2f
mode 000000,100644..100644
--- 
a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerEnumSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerEnumSelfTest.java
@@@ -1,0 -1,62 +1,62 @@@
+ /*
+  * 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.marshaller.optimized;
+ 
+ import junit.framework.*;
+ 
+ /**
+  *
+  */
+ public class OptimizedMarshallerEnumSelfTest extends TestCase {
+     /**
+      * @throws Exception If failed.
+      */
+     public void testEnumSerialisation() throws Exception {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         byte[] bytes = marsh.marshal(TestEnum.Bond);
+ 
+         TestEnum unmarshalled = marsh.unmarshal(bytes, 
Thread.currentThread().getContextClassLoader());
+ 
+         assertEquals(TestEnum.Bond, unmarshalled);
+         assertEquals(TestEnum.Bond.desc, unmarshalled.desc);
+     }
+ 
+     private enum TestEnum {
+         Equity("Equity") {
+             @Override public String getTestString() {
+                 return "eee";
+             }
+         },
+ 
+         Bond("Bond") {
+             @Override public String getTestString() {
+                 return "qqq";
+             }
+         };
+ 
+         public final String desc;
+ 
+         TestEnum(String desc) {
+             this.desc = desc;
+         }
+ 
+         public abstract String getTestString();
+     }
+ 
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
index 0000000,32ca11a..f2639a4
mode 000000,100644..100644
--- 
a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerSelfTest.java
@@@ -1,0 -1,452 +1,452 @@@
+ /*
+  * 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.marshaller.optimized;
+ 
+ import org.apache.ignite.*;
+ import org.apache.ignite.internal.util.typedef.*;
+ import org.apache.ignite.lang.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.testframework.*;
+ import org.apache.ignite.testframework.junits.common.*;
+ 
+ import java.io.*;
+ import java.util.concurrent.*;
+ 
+ /**
+  * Optimized marshaller self test.
+  */
+ @GridCommonTest(group = "Marshaller")
+ public class OptimizedMarshallerSelfTest extends GridMarshallerAbstractTest {
+     /** {@inheritDoc} */
 -    @Override protected IgniteMarshaller createMarshaller() {
 -        IgniteOptimizedMarshaller m = new IgniteOptimizedMarshaller();
++    @Override protected Marshaller createMarshaller() {
++        OptimizedMarshaller m = new OptimizedMarshaller();
+ 
+         m.setRequireSerializable(false);
+         m.setClassNames(F.asList(GoodMarshallable.class.getName(), 
NoMarshallable.class.getName()));
+ 
+         return m;
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testTestMarshalling() throws Exception {
+         final String msg = "PASSED";
+ 
+         assert msg != null;
+ 
+         byte[] buf = marshal(new IgniteRunnable() {
+             @Override public void run() {
+                 c1.apply(msg);
+                 c2.apply(msg);
+ 
+                 c3.apply();
+                 c4.reduce();
+ 
+                 System.out.println("Test message: " + msg);
+             }
+         });
+ 
+         Runnable r = unmarshal(buf);
+ 
+         assertNotNull(r);
+ 
+         r.run();
+     }
+ 
+     /**
+      * Tests marshal self-linked object.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testMarshallingSelfLink() throws IgniteCheckedException {
+         SelfLink sl = new SelfLink("a string 1");
+ 
+         sl.link(sl);
+ 
+         SelfLink sl1 = unmarshal(marshal(sl));
+ 
+         assert sl1.link() == sl1;
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testInvalid() throws Exception {
+         GridTestUtils.assertThrows(
+             log,
+             new Callable<Object>() {
+                 @Override public Object call() throws Exception {
+                     unmarshal(new byte[10]);
+ 
+                     return null;
+                 }
+             },
+             IgniteCheckedException.class,
+             null
+         );
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testNested() throws Exception {
+         NestedTestObject obj = new NestedTestObject("String", 100);
+ 
+         NestedTestObject newObj = unmarshal(marshal(obj));
+ 
+         assertEquals("String", newObj.str);
+         assertEquals(100, newObj.val);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testGoodMarshallable() throws Exception {
+         GoodMarshallable obj = new GoodMarshallable("String", 100);
+ 
+         GoodMarshallable newObj = unmarshal(marshal(obj));
+ 
+         assertEquals("String", newObj.getString());
+         assertEquals(100, newObj.getInt());
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testBadMarshallable() throws Exception {
+         BadMarshallable obj = new BadMarshallable("String", 100);
+ 
+         try {
+             System.out.println(unmarshal(marshal(obj)));
+ 
+             assert false;
+         }
+         catch (IgniteCheckedException e) {
+             assert e.getCause() instanceof IOException;
+             assert e.getCause().getMessage().contains("must return the value 
of the field");
+         }
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void checkPerformance() throws Exception {
+         final int cnt = 5_000_000;
+ 
+         for (int j = 0; j < 5; j++) {
+             long start = System.nanoTime();
+ 
+             for (int i = 0; i < cnt; i++) {
+                 String s = "string-" + i;
+ 
+                 NoMarshallable obj = new NoMarshallable(s, i);
+ 
+                 NoMarshallable newObj = unmarshal(marshal(obj));
+ 
+                 assertEquals(s, newObj.getString());
+             }
+ 
+             X.println("Marshalling NoMarshallable duration: " + 
((System.nanoTime() - start) / 1_000_000) + "ms");
+         }
+ 
+ 
+         for (int j = 0; j < 5; j++) {
+             long start = System.nanoTime();
+ 
+             for (int i = 0; i < cnt; i++) {
+                 String s = "string-" + i;
+ 
+                 GoodMarshallable obj = new GoodMarshallable(s, i);
+ 
+                 GoodMarshallable newObj = unmarshal(marshal(obj));
+ 
+                 assertEquals(s, newObj.getString());
+             }
+ 
+             X.println("Marshalling Marshallable duration: " + 
((System.nanoTime() - start) / 1_000_000) + "ms");
+         }
+     }
+ 
+     /**
+      * Class for nested execution test.
+      */
+     private static class NestedTestObject implements Serializable {
+         /** */
+         private String str;
+ 
+         /** */
+         private int val;
+ 
+         /**
+          * @param str String.
+          * @param val Value.
+          */
+         private NestedTestObject(String str, int val) {
+             this.str = str;
+             this.val = val;
+         }
+ 
+         /** {@inheritDoc} */
+         private void writeObject(ObjectOutputStream out) throws IOException {
+             try {
+                 byte[] arr = marshal(str);
+ 
+                 out.writeInt(arr.length);
+                 out.write(arr);
+ 
+                 out.writeInt(val);
+             }
+             catch (IgniteCheckedException e) {
+                 throw new IOException(e);
+             }
+         }
+ 
+         /** {@inheritDoc} */
+         @SuppressWarnings("UnusedParameters")
+         private void readObject(ObjectInputStream in) throws IOException {
+             try {
+                 byte[] arr = new byte[in.readInt()];
+ 
+                 in.read(arr);
+ 
+                 str = unmarshal(arr);
+ 
+                 val = in.readInt();
+             }
+             catch (IgniteCheckedException e) {
+                 throw new IOException(e);
+             }
+         }
+     }
+ 
+     /** */
+     private static class TestObject2 {
+         /** */
+         private final int i;
+ 
+         /**
+          * Constructor for TestObject2 instances.
+          *
+          * @param i Integer value to hold.
+          */
+         private TestObject2(int i) {
+             this.i = i;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean equals(Object o) {
+             return i == ((TestObject2)o).i;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public int hashCode() {
+             return i;
+         }
+     }
+ 
+     /**
+      * Static nested class.
+      */
+     private static class TestObject {
+         /** */
+         private final TestObject2 o2;
+ 
+         /** The only meaningful field in the class, used for {@link 
#equals(Object o)} and {@link #hashCode()}. */
+         private final String str;
+ 
+         /**
+          * @param str String to hold.
+          * @param i Integer.
+          */
+         TestObject(String str, int i) {
+             this.str = str;
+ 
+             o2 = new TestObject2(i);
+         }
+ 
+         /**
+          * Method for accessing value of the hold string after the object is 
created.
+          *
+          * @return Wrapped string.
+          */
+         public String string() {
+             return str;
+         }
+ 
+         /**
+          * @return Object held in this wrapped.
+          */
+         public TestObject2 obj() {
+             return o2;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public int hashCode() {
+             return 31 * o2.hashCode() + str.hashCode();
+         }
+ 
+         /** {@inheritDoc} */
+         @SuppressWarnings("RedundantIfStatement")
+         @Override public boolean equals(Object o) {
+             if (this == o)
+                 return true;
+ 
+             if (o == null || getClass() != o.getClass())
+                 return false;
+ 
+             TestObject obj = (TestObject)o;
+ 
+             if (o2 != null ? !o2.equals(obj.o2) : obj.o2 != null)
+                 return false;
+ 
+             if (str != null ? !str.equals(obj.str) : obj.str != null)
+                 return false;
+ 
+             return true;
+         }
+     }
+ 
+     /**
+      * Static nested class.
+      */
+     private static class SelfLink extends TestObject {
+         /** */
+         private SelfLink link;
+ 
+         /**
+          * @param str String to hold.
+          */
+         SelfLink(String str) {
+             super(str, 1);
+         }
+ 
+         /**
+          * @return The object this link points to,.
+          */
+         public SelfLink link() {
+             return link;
+         }
+ 
+         /**
+          * @param link The object this link should points to,
+          */
+         public void link(SelfLink link) {
+             this.link = link;
+         }
+     }
+ 
+     /**
+      *
+      */
 -    public static class GoodMarshallable implements 
IgniteOptimizedMarshallable, Serializable {
 -        /** Class ID required by {@link IgniteOptimizedMarshallable}. */
++    public static class GoodMarshallable implements OptimizedMarshallable, 
Serializable {
++        /** Class ID required by {@link OptimizedMarshallable}. */
+         @SuppressWarnings({"NonConstantFieldWithUpperCaseName", 
"AbbreviationUsage", "UnusedDeclaration"})
+         private static Object GG_CLASS_ID;
+ 
+         /** */
+         private String str;
+ 
+         /** */
+         private int i;
+ 
+         /**
+          * @param str String.
+          * @param i Integer.
+          */
+         public GoodMarshallable(String str, int i) {
+             this.str = str;
+             this.i = i;
+         }
+ 
+         /**
+          * @return Int value.
+          */
+         private int getInt() {
+             return i;
+         }
+ 
+         /**
+          * @return String value
+          */
+         private String getString() {
+             return str;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public Object ggClassId() {
+             return GG_CLASS_ID;
+         }
+     }
+ 
+     /**
+      *
+      */
+     public static class NoMarshallable implements Serializable {
+         /** */
+         private String str;
+ 
+         /** */
+         private int i;
+ 
+         /**
+          * @param str String.
+          * @param i Integer.
+          */
+         public NoMarshallable(String str, int i) {
+             this.str = str;
+             this.i = i;
+         }
+ 
+         /**
+          * @return Int value.
+          */
+         private int getInt() {
+             return i;
+         }
+ 
+         /**
+          * @return String value
+          */
+         private String getString() {
+             return str;
+         }
+     }
+ 
+     /**
+      *
+      */
 -    private static class BadMarshallable extends TestObject implements 
IgniteOptimizedMarshallable {
 -        /** Class ID required by {@link IgniteOptimizedMarshallable}. */
++    private static class BadMarshallable extends TestObject implements 
OptimizedMarshallable {
++        /** Class ID required by {@link OptimizedMarshallable}. */
+         @SuppressWarnings({"NonConstantFieldWithUpperCaseName", 
"AbbreviationUsage", "UnusedDeclaration"})
+         private static Object GG_CLASS_ID;
+ 
+         /**
+          * @param str String.
+          * @param i Integer.
+          */
+         private BadMarshallable(String str, int i) {
+             super(str, i);
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public Object ggClassId() {
+             return new Object();
+         }
+     }
+ }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b08492a5/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
----------------------------------------------------------------------
diff --cc 
modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
index 0000000,a14c175..9d3784a
mode 000000,100644..100644
--- 
a/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/marshaller/optimized/OptimizedMarshallerTest.java
@@@ -1,0 -1,830 +1,830 @@@
+ /*
+  * 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.marshaller.optimized;
+ 
+ import org.apache.ignite.*;
+ import org.apache.ignite.compute.*;
+ import org.apache.ignite.internal.util.typedef.internal.*;
+ import org.apache.ignite.marshaller.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+ import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+ import org.apache.ignite.testframework.junits.common.*;
+ import org.jetbrains.annotations.*;
+ 
+ import java.io.*;
+ import java.lang.reflect.*;
+ import java.lang.reflect.Proxy;
+ import java.net.*;
+ import java.util.*;
+ import java.util.concurrent.*;
+ 
+ /**
+  *
+  */
+ public class OptimizedMarshallerTest extends GridCommonAbstractTest {
+     /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         NonSerializable outObj = marsh.unmarshal(marsh.marshal(new 
NonSerializable(null)), null);
+ 
+         outObj.checkAfterUnmarshalled();
+     }
+ 
+     /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable1() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         byte[] bytes = marsh.marshal(new TcpDiscoveryVmIpFinder());
+ 
+         TcpDiscoveryIpFinder ipFinder = marsh.unmarshal(bytes, null);
+ 
+         assertFalse(ipFinder.isShared());
+ 
+         ipFinder = marsh.unmarshal(marsh.marshal(new 
TcpDiscoveryVmIpFinder(true)), null);
+ 
+         assertTrue(ipFinder.isShared());
+     }
+ 
+     /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable2() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         TcpDiscoveryIpFinderAdapter ipFinder = new 
TcpDiscoveryIpFinderAdapter() {
+             @Override public Collection<InetSocketAddress> 
getRegisteredAddresses() {
+                 return null;
+             }
+ 
+             @Override public void 
registerAddresses(Collection<InetSocketAddress> addrs) {
+                 //No-op.
+             }
+ 
+             @Override public void 
unregisterAddresses(Collection<InetSocketAddress> addrs) {
+                 //No-op.
+             }
+         };
+ 
+         ipFinder.setShared(false);
+ 
+         byte[] bytes = marsh.marshal(ipFinder);
+ 
+         ipFinder = marsh.unmarshal(bytes, null);
+ 
+         assertFalse(ipFinder.isShared());
+     }
+ 
+     /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable3() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         byte[] bytes = marsh.marshal(new TestTcpDiscoveryIpFinderAdapter());
+ 
+         TcpDiscoveryIpFinder ipFinder = marsh.unmarshal(bytes, null);
+ 
+         assertFalse(ipFinder.isShared());
+     }
+ 
+      /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable4() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         byte[] bytes = marsh.marshal(new GridMarshallerTestInheritedBean());
+ 
+         info(Arrays.toString(bytes));
+ 
+         GridMarshallerTestInheritedBean bean = marsh.unmarshal(bytes, null);
+ 
+         assertTrue(bean.isFlag());
+     }
+ 
+      /**
+      * Tests ability to marshal non-serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testNonSerializable5() throws IgniteCheckedException {
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         byte[] bytes = marsh.marshal(true);
+ 
+         Boolean val = marsh.unmarshal(bytes, null);
+ 
+         assertTrue(val);
+     }
+ 
+     /**
+      * Tests ability to marshal serializable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testSerializable() throws IgniteCheckedException {
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         SomeSerializable outObj = marsh.unmarshal(marsh.marshal(new 
SomeSerializable(null)), null);
+ 
+         outObj.checkAfterUnmarshalled();
+     }
+ 
+     /**
+      * @throws IgniteCheckedException If failed.
+      */
+     public void testSerializableAfterChangingValue() throws 
IgniteCheckedException {
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         SomeSimpleSerializable newObj = new SomeSimpleSerializable();
+ 
+         assert(newObj.flag);
+ 
+         newObj.setFlagValue(false);
+ 
+         assert(! newObj.flag);
+ 
+         SomeSimpleSerializable outObj = 
marsh.unmarshal(marsh.marshal(newObj), null);
+ 
+         assert (! outObj.flag);
+     }
+ 
+     /**
+      * Tests ability to marshal externalizable objects.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testExternalizable() throws IgniteCheckedException {
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         ExternalizableA outObj = marsh.unmarshal(marsh.marshal(new 
ExternalizableA(null, true)), null);
+         ExternalizableA outObj1 = marsh.unmarshal(marsh.marshal(new 
ExternalizableA(null, false)), null);
+ 
+         assertNotNull(outObj);
+         assertNotNull(outObj1);
+     }
+ 
+     /**
 -     * Tests {@link 
IgniteOptimizedMarshaller#setRequireSerializable(boolean)}.
++     * Tests {@link OptimizedMarshaller#setRequireSerializable(boolean)}.
+      */
+     public void testRequireSerializable() {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(true);
+ 
+         try {
+             marsh.marshal(new NonSerializable(null));
+ 
+             fail();
+         }
+         catch (IgniteCheckedException ignore) {
+             // No-op.
+         }
+     }
+ 
+     /**
 -     * Tests {@link IgniteOptimizedMarshaller#setClassNames(List)}.
++     * Tests {@link OptimizedMarshaller#setClassNames(List)}.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testUserPreregisteredNames() throws IgniteCheckedException {
+         Object obj = new SomeSerializable(null);
+ 
+         // Clear caches.
 -        ((Map)U.staticField(IgniteOptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
 -        IgniteOptimizedClassResolver.userClasses(null, null);
++        ((Map)U.staticField(OptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
++        OptimizedClassResolver.userClasses(null, null);
+ 
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         int size1 = marsh.marshal(obj).length;
+ 
+         // Clear caches.
 -        ((Map)U.staticField(IgniteOptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
 -        IgniteOptimizedClassResolver.userClasses(null, null);
++        ((Map)U.staticField(OptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
++        OptimizedClassResolver.userClasses(null, null);
+ 
 -        IgniteOptimizedMarshaller marshPreregistered = new 
IgniteOptimizedMarshaller();
++        OptimizedMarshaller marshPreregistered = new OptimizedMarshaller();
+ 
+         
marshPreregistered.setClassNames(Arrays.asList(SomeSerializable.class.getName()));
+ 
+         int size2 = marshPreregistered.marshal(obj).length;
+ 
+         assertTrue(size1 > size2);
+     }
+ 
+     /**
 -     * Tests {@link IgniteOptimizedMarshaller#setClassNames(List)}.
++     * Tests {@link OptimizedMarshaller#setClassNames(List)}.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      * @throws IOException If an I/O error occurs.
+      */
+     public void testUserPreregisteredNamesPath() throws 
IgniteCheckedException, IOException {
+         Object obj = new SomeSerializable(null);
+ 
+         // Clear caches.
 -        ((Map)U.staticField(IgniteOptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
 -        IgniteOptimizedClassResolver.userClasses(null, null);
++        ((Map)U.staticField(OptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
++        OptimizedClassResolver.userClasses(null, null);
+ 
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         int size1 = marsh.marshal(obj).length;
+ 
+         // Clear caches.
 -        ((Map)U.staticField(IgniteOptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
 -        IgniteOptimizedClassResolver.userClasses(null, null);
++        ((Map)U.staticField(OptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE")).clear();
++        OptimizedClassResolver.userClasses(null, null);
+ 
 -        IgniteOptimizedMarshaller marshPreregistered = new 
IgniteOptimizedMarshaller();
++        OptimizedMarshaller marshPreregistered = new OptimizedMarshaller();
+ 
+         File namesFile = File.createTempFile("gg-", null);
+ 
+         U.writeStringToFile(namesFile, SomeSerializable.class.getName(), 
"UTF-8");
+ 
+         marshPreregistered.setClassNamesPath(namesFile.getAbsolutePath());
+ 
+         int size2 = marshPreregistered.marshal(obj).length;
+ 
+         assertTrue(size1 > size2);
+     }
+ 
+     /**
+      * Tests {@link Proxy}.
+      *
+      * @throws IgniteCheckedException If marshalling failed.
+      */
+     public void testProxy() throws IgniteCheckedException {
 -        IgniteOptimizedMarshaller marsh = new IgniteOptimizedMarshaller();
++        OptimizedMarshaller marsh = new OptimizedMarshaller();
+ 
+         marsh.setRequireSerializable(false);
+ 
+         SomeItf inItf = (SomeItf)Proxy.newProxyInstance(
+             OptimizedMarshallerTest.class.getClassLoader(), new Class[] 
{SomeItf.class},
+             new InvocationHandler() {
+                 private NonSerializable obj = new NonSerializable(null);
+ 
+                 @Override public Object invoke(Object proxy, Method mtd, 
Object[] args) throws Throwable {
+                     obj.checkAfterUnmarshalled();
+ 
+                     return 17;
+                 }
+             }
+         );
+ 
+         SomeItf outItf = marsh.unmarshal(marsh.marshal(inItf), null);
+ 
+         assertEquals(outItf.checkAfterUnmarshalled(), 17);
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testDescriptorCache() throws Exception {
+         try {
+             Ignite ignite = startGridsMultiThreaded(2);
+ 
+             String taskClsName = 
"org.apache.ignite.tests.p2p.SingleSplitTestTask";
+             String jobClsName = 
"org.apache.ignite.tests.p2p.SingleSplitTestTask$SingleSplitTestJob";
+ 
+             ClassLoader ldr = getExternalClassLoader();
+ 
+             Class<? extends ComputeTask<?, ?>> taskCls = (Class<? extends 
ComputeTask<?, ?>>)ldr.loadClass(taskClsName);
+             Class<? extends ComputeTask<?, ?>> jobCls = (Class<? extends 
ComputeTask<?, ?>>)ldr.loadClass(jobClsName);
+ 
+             ignite.compute().localDeployTask(taskCls, ldr);
+ 
+             ignite.compute().execute(taskClsName, 2);
+ 
 -            ConcurrentMap<Class<?>, IgniteOptimizedClassDescriptor> cache =
 -                U.staticField(IgniteOptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE");
++            ConcurrentMap<Class<?>, OptimizedClassDescriptor> cache =
++                U.staticField(OptimizedMarshallerUtils.class, 
"CLS_DESC_CACHE");
+ 
+             assertTrue(cache.containsKey(jobCls));
+ 
+             ignite.compute().undeployTask(taskClsName);
+ 
+             // Wait for undeploy.
+             Thread.sleep(1000);
+ 
+             assertFalse(cache.containsKey(jobCls));
+         }
+         finally {
+             stopAllGrids();
+         }
+     }
+ 
+     /**
+      * @throws Exception If failed.
+      */
+     public void testPerformance() throws Exception {
+         System.gc();
+ 
+         checkPerformance(10000, 4);
+     }
+ 
+     /**
+      * @param cnt Number of marshalling attempts.
+      * @param tries Number of retries.
+      * @throws Exception If failed.
+      */
+     private void checkPerformance(int cnt, int tries) throws Exception {
 -        IgniteMarshaller marsh = new IgniteOptimizedMarshaller();
++        Marshaller marsh = new OptimizedMarshaller();
+ 
+         for (int j = 0; j < tries; j++) {
+             System.gc();
+ 
+             long start = System.currentTimeMillis();
+ 
+             for (int i = 0; i < cnt; i++) {
+                 TestCacheKey key = new TestCacheKey("key", "id");
+ 
+                 TestCacheKey outKey = marsh.unmarshal(marsh.marshal(key), 
null);
+ 
+                 assert key.equals(outKey);
+                 assert key.hashCode() == outKey.hashCode();
+             }
+ 
+             info("Time non-serializable: " + (System.currentTimeMillis() - 
start));
+ 
+             System.gc();
+ 
+             start = System.currentTimeMillis();
+ 
+             for (int i = 0; i < cnt; i++) {
+                 TestCacheKeySerializable key1 = new 
TestCacheKeySerializable("key", "id");
+ 
+                 TestCacheKeySerializable outKey = 
marsh.unmarshal(marsh.marshal(key1), null);
+ 
+                 assert key1.equals(outKey);
+                 assert key1.hashCode() == outKey.hashCode();
+             }
+ 
+             info("Time serializable: " + (System.currentTimeMillis() - 
start));
+ 
+             System.gc();
+ 
+             start = System.currentTimeMillis();
+ 
+             for (int i = 0; i < cnt; i++) {
+                 TestCacheKeyExternalizable key2 = new 
TestCacheKeyExternalizable("key", "id");
+ 
+                 TestCacheKeyExternalizable outKey = 
marsh.unmarshal(marsh.marshal(key2), null);
+ 
+                 assert key2.equals(outKey);
+                 assert key2.hashCode() == outKey.hashCode();
+             }
+ 
+             info("Time externalizable: " + (System.currentTimeMillis() - 
start));
+ 
+             info(">>>");
+         }
+ 
+         info(">>> Finished performance check <<<");
+     }
+ 
+     /**
+      * Some non-serializable class.
+      */
+     @SuppressWarnings( 
{"PublicField","TransientFieldInNonSerializableClass","FieldMayBeStatic"})
+     private static class NonSerializableA {
+         /** */
+         private final long longVal = 0x33445566778899AAL;
+ 
+         /** */
+         protected Short shortVal = (short)0xAABB;
+ 
+         /** */
+         public String[] strArr = {"AA","BB"};
+ 
+         /** */
+         public boolean flag1 = true;
+ 
+         /** */
+         public boolean flag2;
+ 
+         /** */
+         public Boolean flag3;
+ 
+         /** */
+         public Boolean flag4 = true;
+ 
+         /** */
+         public Boolean flag5 = false;
+ 
+         /** */
+         private transient int intVal = 0xAABBCCDD;
+ 
+         /**
+          * @param strArr Array.
+          * @param shortVal Short value.
+          */
+         @SuppressWarnings( {"UnusedDeclaration"})
+         private NonSerializableA(@Nullable String[] strArr, @Nullable Short 
shortVal) {
+             // No-op.
+         }
+ 
+         /**
+          * Checks correctness of the state after unmarshalling.
+          */
+         void checkAfterUnmarshalled() {
+             assertEquals(longVal, 0x33445566778899AAL);
+ 
+             assertEquals(shortVal.shortValue(), (short)0xAABB);
+ 
+             assertTrue(Arrays.equals(strArr, new String[] {"AA","BB"}));
+ 
+             assertEquals(intVal, 0);
+ 
+             assertTrue(flag1);
+             assertFalse(flag2);
+             assertNull(flag3);
+             assertTrue(flag4);
+             assertFalse(flag5);
+         }
+     }
+ 
+     /**
+      * Some non-serializable class.
+      */
+     @SuppressWarnings( 
{"PublicField","TransientFieldInNonSerializableClass","PackageVisibleInnerClass"})
+     static class NonSerializableB extends NonSerializableA {
+         /** */
+         public Short shortVal = 0x1122;
+ 
+         /** */
+         public long longVal = 0x8877665544332211L;
+ 
+         /** */
+         private transient NonSerializableA[] aArr = {
+             new NonSerializableA(null, null),
+             new NonSerializableA(null, null),
+             new NonSerializableA(null, null)
+         };
+ 
+         /** */
+         protected Double doubleVal = 123.456;
+ 
+         /**
+          * Just to eliminate the default constructor.
+          */
+         private NonSerializableB() {
+             super(null, null);
+         }
+ 
+         /**
+          * Checks correctness of the state after unmarshalling.
+          */
+         @Override void checkAfterUnmarshalled() {
+             super.checkAfterUnmarshalled();
+ 
+             assertEquals(shortVal.shortValue(), 0x1122);
+ 
+             assertEquals(longVal, 0x8877665544332211L);
+ 
+             assertNull(aArr);
+ 
+             assertEquals(doubleVal, 123.456);
+         }
+     }
+ 
+     /**
+      * Some non-serializable class.
+      */
+     @SuppressWarnings( {"TransientFieldInNonSerializableClass","PublicField"})
+     private static class NonSerializable extends NonSerializableB {
+         /** */
+         private int idVal = -17;
+ 
+         /** */
+         private final NonSerializableA aVal = new NonSerializableB();
+ 
+         /** */
+         private transient NonSerializableB bVal = new NonSerializableB();
+ 
+         /** */
+         private NonSerializableA[] bArr = new NonSerializableA[] {
+             new NonSerializableB(),
+             new NonSerializableA(null, null)
+         };
+ 
+         /** */
+         public float floatVal = 567.89F;
+ 
+         /**
+          * Just to eliminate the default constructor.
+          *
+          * @param aVal Unused.
+          */
+         @SuppressWarnings( {"UnusedDeclaration"})
+         private NonSerializable(NonSerializableA aVal) {
+         }
+ 
+         /**
+          * Checks correctness of the state after unmarshalling.
+          */
+         @Override void checkAfterUnmarshalled() {
+             super.checkAfterUnmarshalled();
+ 
+             assertEquals(idVal, -17);
+ 
+             aVal.checkAfterUnmarshalled();
+ 
+             assertNull(bVal);
+ 
+             for (NonSerializableA a : bArr) {
+                 a.checkAfterUnmarshalled();
+             }
+ 
+             assertEquals(floatVal, 567.89F);
+         }
+     }
+ 
+     /**
+      * Some serializable class.
+      */
+     @SuppressWarnings( 
{"PublicField","TransientFieldInNonSerializableClass","PackageVisibleInnerClass"})
+     static class ForSerializableB {
+         /** */
+         public Short shortVal = 0x1122;
+ 
+         /** */
+         public long longVal = 0x8877665544332211L;
+ 
+         /** */
+         private transient NonSerializableA[] aArr;
+ 
+         /** */
+         private transient String strVal = "abc";
+ 
+         /** */
+         protected Double doubleVal = 123.456;
+ 
+         /**
+          */
+         protected void init() {
+             shortVal = 0x1122;
+ 
+             longVal = 0x8877665544332211L;
+ 
+             aArr = new NonSerializableA[] {
+                 new NonSerializableA(null, null),
+                 new NonSerializableA(null, null),
+                 new NonSerializableA(null, null)
+             };
+         }
+ 
+         /**
+          * Checks correctness of the state after unmarshalling.
+          */
+         void checkAfterUnmarshalled() {
+             assertEquals(shortVal.shortValue(), 0x1122);
+ 
+             assertEquals(longVal, 0x8877665544332211L);
+ 
+             assertNull(aArr);
+ 
+             assertNull(strVal);
+ 
+             assertEquals(doubleVal, 123.456);
+         }
+     }
+ 
+     /**
+      * Some serializable class.
+      */
+     private static class SomeSimpleSerializable extends ComputeJobAdapter {
+         /** */
+         private boolean flag = true;
+ 
+         /**
+          * @param newFlagVal - The new value of flag field.
+          */
+         public void setFlagValue(boolean newFlagVal) {
+             flag = newFlagVal;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public Object execute() {
+             assert false;
+ 
+             return null;
+         }
+     }
+     /**
+      * Some serializable class.
+      */
+     private static class SomeSerializable extends ForSerializableB implements 
Serializable {
+         /**
+          * Just to eliminate the default constructor.
+          *
+          * @param id Unused.
+          */
+         @SuppressWarnings( {"UnusedDeclaration"})
+         private SomeSerializable(Long id) {
+             init();
+         }
+     }
+ 
+     /**
+      */
+     private static interface SomeItf {
+         /**
+          * @return Check result.
+          */
+         int checkAfterUnmarshalled();
+     }
+ 
+     /**
+      * Some externalizable class.
+      */
+     @SuppressWarnings( {"UnusedDeclaration", "PublicField"})
+     private static class ExternalizableA implements Externalizable {
+         /** */
+         private boolean boolVal;
+ 
+         /** */
+         public String[] strArr;
+ 
+         /** No-arg constructor is required by externalization.  */
+         public ExternalizableA() {
+             // No-op.
+         }
+ 
+         /**
+          *
+          * @param strArr String array.
+          * @param boolVal Boolean value.
+          */
+         private ExternalizableA(String[] strArr, boolean boolVal) {
+             this.strArr = strArr;
+             this.boolVal = boolVal;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void writeExternal(ObjectOutput out) throws 
IOException {
+             out.writeBoolean(false);
+             out.writeBoolean(false);
+             out.writeBoolean(false);
+             out.writeBoolean(false);
+             out.writeBoolean(false);
+             out.writeBoolean(false);
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void readExternal(ObjectInput in) throws 
IOException, ClassNotFoundException {
+             boolVal = in.readBoolean();
+             in.readBoolean();
+             in.readBoolean();
+             in.readBoolean();
+             in.readBoolean();
+             in.readBoolean();
+         }
+     }
+ 
+     /**
+      *
+      */
+     private static class TestCacheKey implements Serializable {
+         /** */
+         private String key;
+ 
+         /** */
+         @SuppressWarnings({"UnusedDeclaration"})
+         private String terminalId;
+ 
+         /**
+          * @param key Key.
+          * @param terminalId Some ID.
+          */
+         TestCacheKey(String key, String terminalId) {
+             this.key = key;
+             this.terminalId = terminalId;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public int hashCode() {
+             return key.hashCode();
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean equals(Object obj) {
+             return obj instanceof TestCacheKey && 
key.equals(((TestCacheKey)obj).key);
+         }
+     }
+ 
+     /**
+      *
+      */
+     private static class TestCacheKeySerializable implements Serializable {
+         /** */
+         private String key;
+ 
+         /** */
+         @SuppressWarnings({"UnusedDeclaration"})
+         private String terminalId;
+ 
+         /**
+          * @param key Key.
+          * @param terminalId Some ID.
+          */
+         TestCacheKeySerializable(String key, String terminalId) {
+             this.key = key;
+             this.terminalId = terminalId;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public int hashCode() {
+             return key.hashCode();
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean equals(Object obj) {
+             return obj instanceof TestCacheKeySerializable && 
key.equals(((TestCacheKeySerializable)obj).key);
+         }
+     }
+ 
+     /**
+      *
+      */
+     private static class TestCacheKeyExternalizable implements Externalizable 
{
+         /** */
+         private String key;
+ 
+         /** */
+         private String terminalId;
+ 
+         /**
+          *
+          */
+         public TestCacheKeyExternalizable() {
+             // No-op.
+         }
+ 
+         /**
+          * @param key Key.
+          * @param terminalId Some ID.
+          */
+         TestCacheKeyExternalizable(String key, String terminalId) {
+             this.key = key;
+             this.terminalId = terminalId;
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public int hashCode() {
+             return key.hashCode();
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public boolean equals(Object obj) {
+             return obj instanceof TestCacheKeyExternalizable && 
key.equals(((TestCacheKeyExternalizable)obj).key);
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void writeExternal(ObjectOutput out) throws 
IOException {
+             U.writeString(out, key);
+             U.writeString(out, terminalId);
+         }
+ 
+         /** {@inheritDoc} */
+         @Override public void readExternal(ObjectInput in) throws 
IOException, ClassNotFoundException {
+             key = U.readString(in);
+             terminalId = U.readString(in);
+         }
+     }
+ }

Reply via email to